text
stringlengths
28
935k
meta
stringlengths
137
139
red_pajama_subset
stringclasses
1 value
\section{Introduction \& Related Work} There is a substantial gap between how many users dream of interacting with intelligent robots and how those robots are programmed in reality. The dream is for the human user to instruct their robot in something not too far from natural language, e.g. ``please visit both the gas station and the grocery store, and make sure you get back here within 30 minutes'', or ``land at one of three landing pads, but stay clear of other aircraft''. Unfortunately, robots today usually expect much more concrete guidance, such as a specific trajectory or feedback controller. As the tasks we wish to assign our robots grow increasingly complex, there is a correspondingly increased need for flexible specification of robot programs and tools to automatically derive concrete plans from those specifications. Moreover, since the real world is unavoidably messy, any plan thus derived must also be robust to unforeseen variation in the environment; the robot must be able to accomplish its plan even when the environment changes. Luckily, when it comes to flexibly specifying complex tasks, we have a convenient tool in the form of \textit{temporal logic}. There are many flavors of temporal logic, but most relevant to many robotics problems is \textit{signal temporal logic} (or STL), which provides a flexible language for specifying requirements for continuous real-valued signals~\cite{donze10,Sun2022,Pant2017}. STL allows a user to specify a wide range of planning problems by combining logical and temporal operators to express requirements about ordering and dependencies between subtasks. In addition, although the formal syntax of STL can seem opaque at first, it is often quite easy to translate STL formulae into readily-understood natural language. Due to its flexibility, STL is a common choice for specifying robotics problems such as trajectory planning~\cite{Pant2018,Pantazides2022} and combined task and motion planning~\cite{Plaku2016,Sun2022,Takano2021}. A number of classical methods exist for planning from STL specifications, the most common being abstraction-based methods~\cite{Plaku2016}, mixed-integer optimization-based methods~\cite{Sun2022,yang20}, and nonlinear optimization methods~\cite{Pant2018, Pantazides2022, Leung2020} (other approaches include sampling-based methods such as~\cite{kantaros20} and~\cite{vasile17}). Abstraction-based methods have the longest history; these methods first construct a discrete abstraction (in the form of a graph or automaton) of the continuous state space, then plan over this discrete abstraction~\cite{Plaku2016}. The drawback of abstraction-based methods is that the size of the discrete abstraction grows exponentially with the dimension of the state space, limiting the scalability of these methods. Other methods, based on mixed-integer optimization, exploit the fact that STL specifications can be expressed as linear constraints with integer variables, and the resulting optimization formulation provide soundness and completeness guarantees. Unfortunately, although mixed-integer optimization is sound and complete, these mixed-integer programs quickly become intractable as the planning horizon increases~\cite{raman15,sadraddini15,yang20}. Some works reduce the size of the program by using timed waypoints instead of a receding horizon~\cite{Sun2022}, but this requires assumptions (such as access to a bounded-error tracking controller) that can be restrictive. A more recent line of work has focused on solving STL planning problems using nonlinear optimization~\cite{Pant2017,Pant2018,Pantazides2022,Leung2020,Takano2021}. In these approaches, the STL specification is replaced with a continuously differentiable approximation and optimized using local gradient-based methods. These approaches achieve increased generality and scalability by sacrificing completeness and optimality guarantees. A significant gap in the state of the art is that existing optimization-based STL planners~\cite{Pant2017,Pant2018,Takano2021,Leung2020,Pantazides2022,Sun2022} do not explicitly consider the effects of environmental disturbances while planning. These approaches include some amount of robustness implicitly, typically by maximizing the margin by which a plan satisfies the STL specification, but this is often not sufficient in practice to prevent the plan from failing in response to small changes in the environment. Some methods do explicitly consider robustness to disturbances~\cite{raman15}, but our experiments show that they yield mixed-integer problems that are intractable in practice. In this paper, we fill this gap by developing a robust planner that uses counterexamples (examples of environmental changes that cause the plan to fail) to refine its plan using nonlinear optimization. This planner relies on an iterative optimization process, inspired by solution methods for multi-player games, that alternates between finding a plan that performs well for all counterexamples seen so far and finding new counterexamples to guide the optimization process. Our framework relies on differentiable simulation and differentiable temporal logic to derive gradients of the plan's performance with respect to both the planning parameters and the environmental disturbance, enabling an efficient search for new plans and counterexamples. We compare our approach against state-of-the-art methods, including both mixed-integer methods~\cite{raman15} and nonlinear optimization methods~\cite{Pant2018,Pantazides2022,Leung2020}. We find that our method not only finds plans that succeed despite worst-case disturbances from the environment, but it also requires less than half the time of the next-most-successful method. Our approach easily scales to handle long-horizon tasks with complex STL specifications that are not tractable for mixed-integer programming, and the plans found using our method are consistently more robust than those found using existing methods. \section{Preliminaries}\label{preliminaries} We begin by introducing the syntax and semantics of signal temporal logic, or STL. STL defines properties about real-valued functions of time $s: \R^+ \mapsto \R^n$ called \textit{signals}. For our purposes, a signal is defined by a finite number of sampled points $(t_i, x_i)$, and we assume that the signal is piecewise-affine in between sampled points and constant after the last sample. Syntactically, an STL formula is constructed from predicates based on functions $\mu: \R^n \mapsto \R$, logical connectives, and temporal operators~\cite{donze13}. The syntax of an STL formula $\psi$ is defined inductively as: \begin{align*} \psi = \text{true}\ |\ \mu(x) \geq 0\ |\ \neg \psi\ |\ \psi_1 \wedge \psi_2\ |\ \psi_1 \ \until_I\ \psi_2 \end{align*} where $I$ is a closed (but potentially unbounded) time interval and $\until_I$ is the ``until'' operator (read as: within interval $I$, $\psi_1$ must be true until $\psi_2$ becomes true). For convenience, when $I$ is omitted it is assumed to be $[0, \infty)$. Additional temporal operators such as eventually $\eventually_I\ \psi = \text{true } \until_I\ \psi$ and always $\always_I = \neg \eventually_I\ \neg \psi$ follow from this basic syntax, as do logical operators such as $\vee$ and $\implies$. For any signal $s$, an STL formula is satisfied at a given time $t$ according to the following Boolean semantics~\cite{donze13}: \begin{alignat*}{3} &s, t &&\models \text{true} && \\ &s, t &&\models \mu(x) \geq 0\quad &&\text{iff}\ \mu(s(t)) \geq 0 \\ &s, t &&\models \neg \psi &&\text{iff}\ s, t \not\models \psi \\ &s, t &&\models \psi_1 \wedge \psi_2 &&\text{iff}\ s, t \models \psi_1 \text{ and } s, t \models \psi_2 \\ &s, t &&\models \psi_1\ \until_I\ \psi_2 &&\text{iff } \exists\ t' \in t + I \text{ s.t. } w, t' \models \psi_2 \\ & && && \phantom{iff} \text{ and } w, t'' \models \psi_1\ \forall\ t'' \in [t, t'] \end{alignat*} A useful feature of STL is that, in addition to the Boolean semantics defined above, it also admits a \textit{quantitative semantics} giving the margin of satisfaction (or robustness margin) of an STL formula, denoted $\rho$. The formula is satisfied when $\rho > 0$ and not satisfied when $\rho < 0$. The robustness margin can also be defined inductively: \begin{align*} \rho(\text{true}, s, t) &= \top \\ \rho(\mu(x) \geq 0, s, t) &= \mu(s(t)) \\ \rho(\neg\psi, s, t) &= -\rho(\psi, s, t) \\ \rho(\psi_1 \wedge \psi_2, s, t) &= \min\{\rho(\psi_1, s, t), \rho(\psi_2, s, t)\} \\ \rho(\psi_1 \until_I\ \psi_2, s, t) &= \sup_{t' \in t + I} \min\{\rho(\psi_2, s, t'), \inf_{t'' \in [t, t']} \rho(\psi_1, s, t'') \end{align*} where $\top$ is a constant taken to be greater than all other real values. In practice, linear-time algorithms exist for evaluating $\rho$ given a piecewise-affine signal $s$~\cite{donze13}. It is important to make a distinction between the robustness margin of the specification, $\rho$, and the robustness of a plan designed to satisfy that specification. $\rho$ measures the margin by which the specification is met for a particular execution of a plan, but it does not provide much information about whether the specification will hold across multiple executions, particularly when external disturbances can affect those executions. In the next section, we formalize the robust planning problem, which aims at finding a plan that will satisfy the STL specification even when affected by external disturbances. STL syntax may appear opaque at first glance, but its myriad symbols belie the fact that it is often straightforward to translate an STL formula into easily-understood natural language. For example, $\eventually_{[10, 20]} ((\always_{[0, 5]}\ x \geq 0)\ \until\ y \leq 0)$ can be read as ``between 10--\SI{20}{s} from now, $x$ must be positive for \SI{5}{s} before $y$ becomes negative.'' We provide more examples of STL formulae for robotics problems in Section~\ref{experiments}. \section{Problem Statement} In this paper, we focus on the problem of robust planning from an STL specification, which we view as a sequential two-player zero-sum game between the planner and its environment. In the first step of this game (planning time), the planner has the opportunity to tune a set of \textit{design parameters} $\theta$, but in the second step (run-time) the environment can change a distinct set of \textit{exogenous parameters} $\chi$ to degrade the performance of the plan. Together, $\theta \in \Theta$ and $\chi \in \mathcal{X}$ define the behavior of an autonomous system $\xi: \Theta \times \mathcal{X} \mapsto X^T$, which we assume is a known simulator function mapping design and exogenous parameters to a length-$T$ trace of states $x_t \in X$. We assume that $\xi$ is deterministic, so all uncertainty must be imported via $\chi$, but we assume that $\chi$ may be chosen \textit{adversarially} to degrade the performance of our chosen $\theta$ as much as possible. We also assume that the designer must commit to a choice of $\theta$ before the adversary chooses $\chi$ The performance of a plan is given by a cost function $J: X^T \mapsto \R$ assigning a scalar cost to a behavior trace. To accommodate STL specifications, we deal mainly with cost functions of the form \begin{align*} J_\psi(\theta, \chi) = -\rho\pn{\psi, \xi(\theta, \chi)} + \lambda J_{other}(\theta, \chi) \end{align*} where $\rho\pn{\psi, \xi(\theta, \chi)}$ is the robustness margin of the behavior trace with respect to a given STL specification $\psi$. We negate $\rho$ so that minimizing $J$ maximizes the robustness margin, and the $\lambda J_{other}$ term permits us to consider other factors in the plan's performance (e.g. fuel use). The scaling factor $\lambda$ is typically small to prioritize satisfying the STL specification. Since we assume that $\chi$ can vary adversarially to impose worst-case performance for any plan $\theta$, our goal is to find $\theta$ that are robust to this variation. Concretely, our goal is to solve an optimization problem representing a two-step sequential zero-sum game with two players: \begin{align} \max_{\chi \in \mathcal{X}}\ \min_{\theta \in \Theta}\ J(\theta, \chi) \label{planning_problem} \end{align} To make this discussion concrete, consider a simple example of path planning for an aerial robot. In this case, $\psi$ might specify that we eventually ($\eventually$) reach a goal and always ($\always$) avoid some obstacles, $\theta$ might represent the locations of waypoints along the path and the parameters of a trajectory-tracking controller to follow those waypoints, and $\chi$ might represent the force from wind that attempts to drive the robot off course. The behavior $\xi$ might be a function that simulates the dynamics of the robot flying through wind, and the additional cost $J_{other}$ might impose a small penalty on large control inputs to conserve battery life. We provide more in-depth examples in Section~\ref{experiments}. Our formulation differs from that presented in~\cite{Pant2018} and~\cite{Pantazides2022}; although both of these works seek to maximize the robustness margin $\rho$, neither consider the effect of disturbances $\chi$. Our formulation is also distinct from the mixed-integer formulation in~\cite{Sun2022}, since we consider $\rho$ as part of an objective rather than as a constraint. Our unconstrained approach does not provide the same completeness guarantees as a mixed-integer constrained optimization (used in~\cite{raman15,sadraddini15,Sun2022}), but empirical results in Section~\ref{experiments} demonstrate that our approach scales much better. Of course, solving~\eqref{planning_problem} to global optimality in the general nonlinear case is intractable. Instead, we take advantage of this game structure to design an iterative algorithm to find the \textit{generalized Nash equilibrium}: the design parameters $\theta$ and corresponding $\chi$ such that neither the planner nor the adversary have an incentive to change their choice~\cite{Facchinei2007}. The next section describes this iterative algorithm, which we implement using nonlinear programming with differentiable simulation and differentiable temporal logic. \section{Approach} To solve the robust STL planning problem~\eqref{planning_problem}, we need to address two key points. First, we must develop a meta-heuristic to find a generalized Nash equilibrium of the sequential game~\eqref{planning_problem}, taking care that we do not overfit to any particular value of $\chi$. We solve this challenge by developing an iterative counterexample-guided nonlinear optimization framework. Second, in order to solve this problem using nonlinear optimization, we need an efficient way to compute gradients of $J$ with respect to both $\theta$ and $\chi$, which requires us to differentiate not only the behavior function $\xi$ but also the robustness margin computation $\rho$. We address this challenge using differentiable programming, which we discuss next before introducing our high-level counterexample-guided optimization strategy. \subsection{Differentiable Simulation and Temporal Logic}\label{autodiff} Although it is possible to solve nonlinear optimization problems without access to the gradients of the objective or constraint functions, either by estimating gradients~\cite{suh2021_bundled_gradients} or using zero-order methods~\cite{nevergrad}, it is often much faster to use exact gradient information when it is available. However, exact gradients can be difficult to derive symbolically for complex optimization problems. Instead, recent works have turned to \textit{automatic differentiation} using differentiable programming to automatically compute gradients in problems such as 3D shape optimization~\cite{cascaval2021differentiable}, aircraft design optimization~\cite{sharpe_thesis}, robot design optimization~\cite{dawson2022architect1,du2021underwater}, and machine learning~\cite{jax2018github}. Inspired by this trend, we implement $\xi$ using the JAX framework for automatic differentiation~\cite{jax2018github}, yielding a differentiable simulation of the underlying autonomous system. For a system where the behavior is defined by continuous-time dynamics $\dot{x} = f(x, \theta, \chi, t)$, implementing numerical integration in a differentiable language such as JAX allows us to automatically back-propagate through the simulator to find the gradients $\nabla_\theta \xi$ and $\nabla_\chi \xi$. These gradients can typically be computed much more quickly using automatic differentiation than by finite-difference methods~\cite{dawson2022architect1}. We can use a similar differentiable programming approach to obtain gradients through the quantitative semantics of an STL specification. Before doing so, we must replace the discontinuous $\max$ and $\min$ operators used to compute $\rho$ with smooth approximations: \begin{align*} \widetilde{\max}(x_1, x_2, \ldots) &= \frac{1}{k}\log\pn{e^{kx_1} + e^{kx_2} + \ldots} \\ \widetilde{\min}(x_1, x_2, \ldots) &= -\widetilde{\max}(-x_1, -x_2, \ldots) \end{align*} where $k$ is a smoothing parameter and $\lim_{k\to\infty} \widetilde{\max} = \max$. This differentiable relaxation was introduced in~\cite{Pant2017} and later used in~\cite{Pant2018,Pantazides2022}; \cite{Leung2020} uses a slightly different approximation. Using these smooth approximations, we implement the fast, linear-time algorithms for computing the robustness margin proposed by~\cite{donze13}, using the JAX framework to enable efficient automatic differentiation. In contrast to~\cite{Leung2020}, our method achieves computational complexity that is linear in the length of the state trace $T$ (the complexity of the \texttt{stlcg} framework in \cite{Leung2020} is quadratic in $T$ for the $\mathcal{U}$ operator). By combining smooth approximations of STL quantitative semantics with differentiable programming, we can efficiently compute the gradients $\nabla_\theta \rho$ and $\nabla_\xi \rho$. By combining these gradients with those found using differentiable simulation, we can efficiently compute the gradient of the objective $J$ with respect to both the design parameters $\theta$ and the adversary's response $\chi$. Usefully, our use of differentiable programming means that we are not restricted to considering trajectory planning separately from the design of a tracking controller, as in~\cite{Pant2018} and~\cite{Sun2022}. Instead, we can consider an end-to-end gradient that combines the planned trajectory and controller parameters in $\theta$ and optimizes them jointly (see Section~\ref{experiments} for an example of this end-to-end optimization). In the next section, we discuss how end-to-end gradients enable an iterative algorithm for counterexample-guided robust optimization. \subsection{Counterexample-guided Optimization} To solve the planning problem in~\eqref{planning_problem}, we need to find a generalized Nash equilibrium between the planner and the adversary; i.e. values of $\theta$ and $\chi$ where neither we nor the adversary has any local incentive to change. A common solution strategy for such problems is the family of nonlinear Gauss-Seidel-type methods~\cite{Facchinei2007}. These methods solve max-min problems like~\eqref{planning_problem} by alternating between $\theta$ and $\chi$, tuning one set of parameters while keeping the others constant; i.e. alternating between the two optimization problems: \begin{subequations} \begin{align}\label{eq:gauss_seidel} \theta^* &= \argmin_\theta J(\theta, \chi^*) \\ \chi^* &= \argmax_\chi J(\theta^*, \chi) \end{align} \end{subequations} Although these methods are not guaranteed to converge, it is known that if they do, then the convergence point $(\theta^*, \chi^*)$ is a Nash equilibrium~\cite{Facchinei2007}. A risk of applying such a simple alternating scheme is that the nonlinear optimization for both $\theta$ and $\chi$ can easily get caught in local minima. Such local minima not only reduce the performance of the optimized plan, but also increase the risk of ``overfitting'' to a particular value of $\chi^*$. This risk is particularly salient because the planner must commit to a choice of $\theta$ before the adversary has a final opportunity to choose $\chi$. To mitigate this risk and improve the robustness of our optimized plan, we extend a standard Gauss-Seidel method with two ideas from the machine learning and optimization literature. First, we take inspiration from the success of domain randomization in robust machine learning~\cite{tobin2017}: instead of optimizing $\theta$ with respect to a single fixed $\chi^*$, we can maintain a dataset $\mathcal{X}_N = \set{\chi_i}_{i=1,\ldots,N}$ and optimize the performance of $\theta$ across all of these samples: \begin{subequations} \begin{align}\label{eq:gauss_seidel_domain_randomization} \theta^* &= \argmin_\theta \mathbb{E}_{\mathcal{X}_N} \left[ J(\theta, \chi_i) \right]\\ \chi^* &= \argmax_\chi J(\theta^*, \chi) \end{align} \end{subequations} Incorporating domain randomization into the Gauss-Seidel method has the potential to improve the robustness of the resulting equilibria, but it is relatively sample inefficient; it may require a large number of random samples $\chi_i$. To address this sample inefficiency, we take inspiration from a second idea in the optimization and learning literature: learning from counterexamples~\cite{Chang2019}. The key insight here is that we can do better than simply randomly sampling $\chi_i$; we can use the values of $\chi^*$ found during successive iterations of the Gauss-Seidel process as high-quality counterexamples to guide the optimization of $\theta$. This insight results in our counterexample-guided Gauss-Seidel optimization method, which is outlined in pseudocode in Algorithm~\ref{alg:cg_gs}. Our algorithm proceeds as follows. We begin by initializing the dataset with $N_0$ i.i.d. examples $\chi_i$, then we alternate between solving the two optimization problems in~\eqref{eq:gauss_seidel_domain_randomization}. At each iteration, we add our current estimate of the adversary's best response $\chi^*$ to the dataset, and we stop either when the algorithm reaches a fixed point (the adversary's best response after solving~\eqref{eq:gauss_seidel_domain_randomization} is the same as the best response from the previous round) or when a maximum number of iterations is reached. As we show experimentally in Section~\ref{experiments}, this counterexample-guided optimization achieves a higher sample efficiency than simple domain randomization, in that it finds plans that are more robust to adversarial disturbance while considering a much smaller dataset. Although our use of nonlinear optimization means that our algorithm is not complete, we find empirically that it succeeds in finding a satisfactory plan in the large majority of cases. It is important to note that this algorithm is fundamentally enabled by the automatic differentiation approach detailed in Section~\ref{autodiff}; without access to the gradients of $J$ it would be much more difficult to solve the subproblems in lines~\ref{alg:opt_theta} and~\ref{alg:opt_chi} of Algorithm~\ref{alg:cg_gs}. Although some previous approaches obtain gradients of STL satisfaction with respect to $\theta$ using standard trajectory optimization formulations, as in~\cite{Pant2018}, we are not aware of any approaches that make use of gradients with respect to disturbance parameters. There has been some work on using counterexamples to guide mixed-integer planning~\cite{raman15}, but our experiments in the next section demonstrate that these mixed-integer programs are intractable for long horizon problems. Specifically, we find that solving even a single mixed-integer program can take more than an hour, so solving multiple programs to derive counterexamples is not a practical solution. In the next section, we demonstrate that our gradient-based counterexample-guided approach outperforms these existing approaches, not only finding more robust plans but requiring substantially less computation time to do so. \begin{algorithm} \caption{Counterexample-guided Gauss-Seidel method for solving robust planning problems}\label{alg:cg_gs} \DontPrintSemicolon \KwInput{Starting dataset size $N_0$\\\phantom{Input: } Maximum number of iterations $M$} \KwOutput{Optimized design parameters $\theta^*$\\\phantom{Output: } Dataset of counterexamples $\mathcal{X}_N$} $\mathcal{X}_N \gets $ $N_0$ examples $\chi_i \in \mathcal{X}$ sampled uniformly i.i.d.\; $\chi^*_{prev} \gets \varnothing$\; \For{$i \in \set{1, \ldots, M}$} { $\theta^* = \argmin_\theta \mathbb{E}_{\mathcal{X}_N} \left[ J(\theta, \chi_i) \right] \label{alg:opt_theta}$ \; $\chi^* = \argmax_\chi J(\theta^*, \chi)$ \label{alg:opt_chi} \; \If{$\chi^* = \chi^*_{prev}$}{\Break} $\chi^*_{prev} \gets \chi^*$\; Append $\chi^*$ to $\mathcal{X}_N$\; } \KwRet{$\theta^*$, $\mathcal{X}_N$} \end{algorithm} \section{Experiments}\label{experiments} We validate our approach by means of two case studies involving the satellite rendezvous problem posed in~\cite{Jewison2016}. We benchmark against state-of-the-art planning algorithms to show the robustness and scalability benefits of our approach. In this satellite rendezvous problem, the goal is to maneuver a chaser satellite to catch a target satellite. We can express this problem in the Clohessy-Wiltshire-Hill coordinate frame~\cite{Jewison2016}, which assumes that the target's orbit is circular and constructs a coordinate frame with the origin at the target, the $x$-axis pointing away from the Earth, the $y$-axis pointing along the target's orbit, and the $z$-axis pointing out of the orbital plane. In this frame, the chaser's dynamics are approximately linear, with positions $p_x$, $p_y$, $p_z$ and velocities $v_x$, $v_y$, $v_z$ varying according to controlled thrust in each direction $u_x$, $u_y$, $u_z$: \begin{align*} \mat{\dot{p}_x \\ \dot{p}_y \\ \dot{p}_z \\ \dot{v}_x \\ \dot{v}_y \\ \dot{v}_z} = \mat{ v_x \\ v_y \\ v_z \\ 3n^2 p_x + 2n v_y + u_x / m\\ -2n v_x + u_y / m\\ -n^2 p_z + u_z / m } \end{align*} $n = \sqrt{\mu / a^3}$ is the mean-motion of the target, determined by the Earth's gravitational constant $\mu = \SI{3.986e14}{m^3/s^2}$ and the target's altitude $a$ (i.e. the length of the semi-major orbital axis, \SI{353}{km} in low Earth orbit). $m = \SI{500}{kg}$ is the mass of the chaser satellite~\cite{Jewison2016}. In this setting, we construct STL specifications for two rendezvous missions: a simple low-speed rendezvous and a more complex loiter-then-rendezvous mission, illustrated in Fig.~\ref{fig:mission_specs}. The STL specifications for each mission, $\psi_1$ and $\psi_2$, are given formally as: \begin{align*} \psi_1 &= \psi_\text{reach target} \wedge \psi_\text{speed limit} \\ \psi_2 &= \psi_\text{reach target} \wedge \psi_\text{speed limit} \wedge \psi_\text{loiter} \\ \psi_\text{reach target} &= \eventually \pn{r \leq 0.1} \\ \psi_\text{speed limit} &= \pn{r \geq 2.0} \until\ \always \pn{v \leq 0.1} \\ \psi_\text{loiter} &= \eventually \always_{[0, T_{obs}]} \pn{2.0 \leq r \wedge r \leq 3.0} \end{align*} where $r = \sqrt{p_x^2 + p_y^2 + p_z^2}$ and $v = \sqrt{v_x^2 + v_y^2 + v_z^2}$. Informally, $\psi_1$ requires that ``the chaser eventually comes within \SI{0.1}{m} of the target and does not come within \SI{2}{m} of the target until its speed is less than \SI{0.1}{m/s}'', and $\psi_2$ additionally requires that ``the chaser eventually spends at least $T_{obs}$ seconds in the region between 2--\SI{3}{m} from the target.'' For each mission, the design parameters $\theta$ include both state/input waypoints along a planned trajectory and the feedback gains used to track that trajectory, and the exogenous parameters $\chi$ represent bounded uncertainty in the initial state of the chaser ($p_x(0), p_y(0) \in [10, 13]$, $p_z(0) \in [-3, 3]$, $v_x(0), v_y(0), v_z(0) \in [-1, 1]$). We use a \SI{200}{s}-long simulation with a \SI{2}{s} timestep for both missions, and $T_{obs} = \SI{10}{s}$. \begin{figure}[t] \centering \includegraphics[width=\linewidth]{figs/satellite_missions.png} \caption{Two satellite rendezvous missions used to test our framework. In the first mission, the chaser satellite must eventually reach the target while respecting a maximum speed constraint in the region immediately around the target. In the second mission, the chaser must still reach the target and obey the speed limit, but it must also loiter in an observation region for some minimum time before approaching. The first mission requires an STL formula with three predicates and three temporal operators, while the second mission requires five predicates and five temporal operators.} \label{fig:mission_specs} \end{figure} For each mission $i=1, 2$, we define a cost function as $J_i = \rho_i + \lambda I$, where $\rho_i = \rho(\psi_i, \xi(\theta, \chi), 0)$ is the STL robustness margin at the start of the trajectory, $I$ is the total impulse required to execute the maneuver (in Newton-seconds), and $\lambda = 5\times10^{-5}$. By applying our iterative counterexample-guided optimization strategy to this problem, we find the optimized trajectories for mission 1 and 2 shown in Figs.~\ref{fig:mission_1_traj} and~\ref{fig:mission_2_traj} along with the worst-case $\chi$. In these examples, we use $N_0=8$ initial examples and $M=10$ maximum rounds, but the algorithm converges in less than 10 rounds in all trials. In both missions, our approach reliably finds a solution that remains feasible despite worst-case variation in the exogenous parameters, achieving a positive STL robustness margin in $>90\%$ of trials in each case. Our counterexample-guided approach requires an average of \SI{53.7}{s} to solve mission 1 and \SI{194.2}{s} to solve mission 2 (averaged across 50 trials). \begin{figure}[t] \centering \includegraphics[width=0.9\linewidth]{figs/satellite_mission1_traj.png} \caption{The optimized trajectory found using our counterexample-guided optimization strategy for mission 1 (rendezvous with speed constraint). The chaser satellite only enters the speed-limit zone once it has slowed down sufficiently.} \label{fig:mission_1_traj} \end{figure} \begin{figure}[t] \centering \includegraphics[width=\linewidth]{figs/mission_1_comparison.png} \caption{Comparison of different STL planning methods on the first example mission, averaged over 50 random seeds. Left: the robustness margin $\rho(\psi_1)$ computed for the optimized design parameters and worst-case exogenous parameters. Right: the planning time required by each method. Our method (CG) achieves much higher robustness than all other methods (satisfying the STL specification despite adversarial perturbations in all but 3 instances) and runs twice as fast as the next-most-robust method.} \label{fig:mission_1_comparison} \end{figure} We can quantitatively compare our approach against two state of the art approaches: a mixed-integer STL planner based on that in~\cite{raman15} and~\cite{sadraddini15} and the nonlinear optimization approach in~\cite{Pant2018,Pantazides2022}. The mixed-integer planner (MIP) in~\cite{raman15} uses a model-predictive control formulation and proposes to add counterexamples after solving each instance of the mixed-integer program; however, we found that even a single instance could not be solved to optimality within 1 hour for either mission, and so we compare with the best solution found within a given period of time. Even though the size of the mixed-integer program in~\cite{raman15} grows linearly with the horizon of the problem, the complexity of solving the resulting MIP grows exponentially in the number of integer variables (these problems require between 2800--4500 integer variables when solved using Gurobi). Since it was not tractable to solve even once instance of the MIP, we were unable to use any MIP-generated counterexamples as proposed in~\cite{raman15}; instead, we take the best feasible solution found after \SI{500}{s} for the first mission and after \SI{1000}{s} for the second mission. We also compare with an extension of the nonlinear optimization from~\cite{Pant2018,Pantazides2022}, where we add domain randomization to the authors' existing trajectory optimization formulation, averaging the objective over either 32 or 64 different values of $\chi$. We note that these methods rely on a similar optimization approach as those proposed in~\cite{Leung2020}, but we re-implement the authors' method to ensure a fair comparison (our implementation makes use of just-in-time compilation to speed the optimization process, and so comparing with off-the-shelf implementations like \texttt{stlcg}~\cite{Leung2020} would not be fair). A comparison of our counterexample-guided approach (CG), nonlinear optimization with domain randomization (NLopt), and the mixed-integer planner (MIP) is shown in Fig.~\ref{fig:mission_1_comparison} for the first mission and Fig.~\ref{fig:mission_2_comparison} for the second mission. In all cases, we compare across 50 random trials, computing the time required to solve each instance and the robustness of the optimized plan when subject to adversarial disturbances. All experiments were run on a laptop computer with \SI{8}{GB} RAM and a \SI{1.8}{GHz} 8-core processor. We find that our method is consistently more robust than prior methods; in the first mission, it satisfies the STL specification in all but 3 trials, despite adversarial disturbances. For comparison, the next-best method (NLopt with domain randomization across 64 examples) failed to solve the first mission in 14 out of 50 trials and took more than twice as long on average to find a plan (\SI{114.3}{s} as opposed to \SI{53.7}{s} for our method). This advantage is due to the quality of the examples used during optimization; instead of 64 random samples, our method uses 8 initial random samples and between 1 and 4 counterexamples (median 2) representing worst-case variation in $\chi$, making our method much more sample-efficient. We also find that our method finds more robust solutions than the MIP method, since MIP cannot tractably consider variation in $\chi$ (the MIP method is also unable to find a feasible solution within \SI{500}{s} in 16 out of 50 trials). MIP's performance also suffers due to discretization error, since we were forced to discretize the continuous-time dynamics with relatively few knot points (one every \SI{2}{s}) to yield a tractable MIP optimization problem. Our method also performs well on the second mission planning problem: only our method consistently finds solutions that are robust to variation in $\chi$ (see Fig.~\ref{fig:mission_2_comparison}). Due to the increased complexity of this example, the MIP method finds a feasible solution within \SI{1000}{s} in only 16 out of 50 trials (the MIP encoding of this mission requires 7769 continuous variables, 2806 binary variables, and 1479 constraints), and the feasible solutions found within \SI{1000}{s} tend to be of poor quality. The second-most-robust method, NLopt with 64 random examples, takes more than twice as long as our method and fails to satisfy the STL specification in 17 out of 50 trials (compared to only 4 failures for our method). Our method required a median of 2 counterexamples in addition to the 8 initial examples to solve this planning problem (the slowest trial required 7 additional examples). These data demonstrate that our counterexample-guided approach to planning from STL specifications is faster, more sample efficient, and more robust to adversarial disturbances than state-of-the-art approaches. A software implementation of our method is available online at \url{https://github.com/MIT-REALM/architect}. \begin{figure}[t] \centering \includegraphics[width=\linewidth]{figs/satellite_mission2_traj.png} \caption{The optimized trajectory found using our counterexample-guided optimization strategy for mission 2 (loiter then rendezvous with speed constraint). The optimized plan satisfies the additional mission requirement of spending time in the observation region before approaching the target.} \label{fig:mission_2_traj} \end{figure} \begin{figure}[t] \centering \includegraphics[width=\linewidth]{figs/mission_2_comparison.png} \caption{Comparison of different STL planning methods on the second example mission, averaged over 50 random seeds. Left: the robustness margin $\rho(\psi_2)$ computed for the optimized design parameters and worst-case exogenous parameters. Right: time required by each method to find a plan. Our method (CG) finds much more robust plans, satisfying the specification in all but 4 instances compared to 17 failures for the next-best method (NLopt with 64 examples). Our method also runs more than twice as fast as the next-most-robust method.} \label{fig:mission_2_comparison} \end{figure} \subsection{Hardware Demonstration} We also validate our approach in hardware by solving the loiter-then-rendezvous mission for a Turtlebot 3 ground robot. We replace the satellite dynamics with nonlinear Dubins dynamics and plan a trajectory that satisfies $\psi = \psi_\text{reach target} \wedge \psi_\text{loiter}$ (we do not include the speed limit because the Turtlebot already has a relatively small maximum speed). Our counterexample-guided planner solves this problem in \SI{26.22}{s}, yielding the trajectory shown in Fig.~\ref{fig:hw}. A video of this demonstration is included in the supplementary materials. \begin{figure}[t] \centering \includegraphics[width=\linewidth]{figs/hw_mission_2.png} \caption{The trajectory found using our counterexample-guided planner successfully moves the robot through the observation zone (where it must spend at least \SI{10}{s}) and into the docking zone. Odometry data indicate that the planned trajectory achieves an STL robustness margin of $0.0255$.} \label{fig:hw} \end{figure} \section{Conclusion} In this paper, we introduce a novel framework for robust optimization-based planning from temporal logic specifications. We frame the robust planning problem as a sequential two-player game between the planner, which chooses a set of design parameters at planning time, and the environment, which picks disturbances adversarially in response to the planner's choice. We develop an iterative counterexample-guided algorithm to find plans that robustly satisfy temporal logic specifications despite worst-case disturbances from the environment. Our method, which relies on differentiable programming for simulation and evaluating the temporal logic specification, not only finds more robust plans than state-of-the-art methods but also runs substantially faster. We apply our method to two planning problems involving time horizons $>$\SI{100}{s} and STL specifications with multiple nested temporal operators, and we provide source code for our approach at \url{https://github.com/MIT-REALM/architect}. In future work, we hope to extend our framework to offer completeness guarantees by combining our counterexample-guided optimization with complete model checking and STL falsification methods, such as the Breach framework~\cite{donze10}. We also look forward to exploring applications of this framework to problems involving multiple agents, particularly for human-robot interaction, and to combining local gradient-based optimization with sampling based methods to solve more complex task-and-motion planning problems. \bibliographystyle{IEEEtran} \section{Introduction \& Related Work} There is a substantial gap between how many users dream of interacting with intelligent robots and how those robots are programmed in reality. The dream is for the human user to instruct their robot in something not too far from natural language, e.g. ``please visit both the gas station and the grocery store, and make sure you get back here within 30 minutes'', or ``land at one of three landing pads, but stay clear of other aircraft''. Unfortunately, robots today usually expect much more concrete guidance, such as a specific trajectory or feedback controller. As the tasks we wish to assign our robots grow increasingly complex, there is a correspondingly increased need for flexible specification of robot programs and tools to automatically derive concrete plans from those specifications. Moreover, since the real world is unavoidably messy, any plan thus derived must also be robust to unforeseen variation in the environment; the robot must be able to accomplish its plan even when the environment changes. Luckily, when it comes to flexibly specifying complex tasks, we have a convenient tool in the form of \textit{temporal logic}. There are many flavors of temporal logic, but most relevant to many robotics problems is \textit{signal temporal logic} (or STL), which provides a flexible language for specifying requirements for continuous real-valued signals~\cite{donze10,Sun2022,Pant2017}. STL allows a user to specify a wide range of planning problems by combining logical and temporal operators to express requirements about ordering and dependencies between subtasks. In addition, although the formal syntax of STL can seem opaque at first, it is often quite easy to translate STL formulae into readily-understood natural language. Due to its flexibility, STL is a common choice for specifying robotics problems such as trajectory planning~\cite{Pant2018,Pantazides2022} and combined task and motion planning~\cite{Plaku2016,Sun2022,Takano2021}. A number of classical methods exist for planning from STL specifications, the most common being abstraction-based methods~\cite{Plaku2016}, mixed-integer optimization-based methods~\cite{Sun2022,yang20}, and nonlinear optimization methods~\cite{Pant2018, Pantazides2022, Leung2020} (other approaches include sampling-based methods such as~\cite{kantaros20} and~\cite{vasile17}). Abstraction-based methods have the longest history; these methods first construct a discrete abstraction (in the form of a graph or automaton) of the continuous state space, then plan over this discrete abstraction~\cite{Plaku2016}. The drawback of abstraction-based methods is that the size of the discrete abstraction grows exponentially with the dimension of the state space, limiting the scalability of these methods. Other methods, based on mixed-integer optimization, exploit the fact that STL specifications can be expressed as linear constraints with integer variables, and the resulting optimization formulation provide soundness and completeness guarantees. Unfortunately, although mixed-integer optimization is sound and complete, these mixed-integer programs quickly become intractable as the planning horizon increases~\cite{raman15,sadraddini15,yang20}. Some works reduce the size of the program by using timed waypoints instead of a receding horizon~\cite{Sun2022}, but this requires assumptions (such as access to a bounded-error tracking controller) that can be restrictive. A more recent line of work has focused on solving STL planning problems using nonlinear optimization~\cite{Pant2017,Pant2018,Pantazides2022,Leung2020,Takano2021}. In these approaches, the STL specification is replaced with a continuously differentiable approximation and optimized using local gradient-based methods. These approaches achieve increased generality and scalability by sacrificing completeness and optimality guarantees. A significant gap in the state of the art is that existing optimization-based STL planners~\cite{Pant2017,Pant2018,Takano2021,Leung2020,Pantazides2022,Sun2022} do not explicitly consider the effects of environmental disturbances while planning. These approaches include some amount of robustness implicitly, typically by maximizing the margin by which a plan satisfies the STL specification, but this is often not sufficient in practice to prevent the plan from failing in response to small changes in the environment. Some methods do explicitly consider robustness to disturbances~\cite{raman15}, but our experiments show that they yield mixed-integer problems that are intractable in practice. In this paper, we fill this gap by developing a robust planner that uses counterexamples (examples of environmental changes that cause the plan to fail) to refine its plan using nonlinear optimization. This planner relies on an iterative optimization process, inspired by solution methods for multi-player games, that alternates between finding a plan that performs well for all counterexamples seen so far and finding new counterexamples to guide the optimization process. Our framework relies on differentiable simulation and differentiable temporal logic to derive gradients of the plan's performance with respect to both the planning parameters and the environmental disturbance, enabling an efficient search for new plans and counterexamples. We compare our approach against state-of-the-art methods, including both mixed-integer methods~\cite{raman15} and nonlinear optimization methods~\cite{Pant2018,Pantazides2022,Leung2020}. We find that our method not only finds plans that succeed despite worst-case disturbances from the environment, but it also requires less than half the time of the next-most-successful method. Our approach easily scales to handle long-horizon tasks with complex STL specifications that are not tractable for mixed-integer programming, and the plans found using our method are consistently more robust than those found using existing methods. \section{Preliminaries}\label{preliminaries} We begin by introducing the syntax and semantics of signal temporal logic, or STL. STL defines properties about real-valued functions of time $s: \R^+ \mapsto \R^n$ called \textit{signals}. For our purposes, a signal is defined by a finite number of sampled points $(t_i, x_i)$, and we assume that the signal is piecewise-affine in between sampled points and constant after the last sample. Syntactically, an STL formula is constructed from predicates based on functions $\mu: \R^n \mapsto \R$, logical connectives, and temporal operators~\cite{donze13}. The syntax of an STL formula $\psi$ is defined inductively as: \begin{align*} \psi = \text{true}\ |\ \mu(x) \geq 0\ |\ \neg \psi\ |\ \psi_1 \wedge \psi_2\ |\ \psi_1 \ \until_I\ \psi_2 \end{align*} where $I$ is a closed (but potentially unbounded) time interval and $\until_I$ is the ``until'' operator (read as: within interval $I$, $\psi_1$ must be true until $\psi_2$ becomes true). For convenience, when $I$ is omitted it is assumed to be $[0, \infty)$. Additional temporal operators such as eventually $\eventually_I\ \psi = \text{true } \until_I\ \psi$ and always $\always_I = \neg \eventually_I\ \neg \psi$ follow from this basic syntax, as do logical operators such as $\vee$ and $\implies$. For any signal $s$, an STL formula is satisfied at a given time $t$ according to the following Boolean semantics~\cite{donze13}: \begin{alignat*}{3} &s, t &&\models \text{true} && \\ &s, t &&\models \mu(x) \geq 0\quad &&\text{iff}\ \mu(s(t)) \geq 0 \\ &s, t &&\models \neg \psi &&\text{iff}\ s, t \not\models \psi \\ &s, t &&\models \psi_1 \wedge \psi_2 &&\text{iff}\ s, t \models \psi_1 \text{ and } s, t \models \psi_2 \\ &s, t &&\models \psi_1\ \until_I\ \psi_2 &&\text{iff } \exists\ t' \in t + I \text{ s.t. } w, t' \models \psi_2 \\ & && && \phantom{iff} \text{ and } w, t'' \models \psi_1\ \forall\ t'' \in [t, t'] \end{alignat*} A useful feature of STL is that, in addition to the Boolean semantics defined above, it also admits a \textit{quantitative semantics} giving the margin of satisfaction (or robustness margin) of an STL formula, denoted $\rho$. The formula is satisfied when $\rho > 0$ and not satisfied when $\rho < 0$. The robustness margin can also be defined inductively: \begin{align*} \rho(\text{true}, s, t) &= \top \\ \rho(\mu(x) \geq 0, s, t) &= \mu(s(t)) \\ \rho(\neg\psi, s, t) &= -\rho(\psi, s, t) \\ \rho(\psi_1 \wedge \psi_2, s, t) &= \min\{\rho(\psi_1, s, t), \rho(\psi_2, s, t)\} \\ \rho(\psi_1 \until_I\ \psi_2, s, t) &= \sup_{t' \in t + I} \min\{\rho(\psi_2, s, t'), \inf_{t'' \in [t, t']} \rho(\psi_1, s, t'') \end{align*} where $\top$ is a constant taken to be greater than all other real values. In practice, linear-time algorithms exist for evaluating $\rho$ given a piecewise-affine signal $s$~\cite{donze13}. It is important to make a distinction between the robustness margin of the specification, $\rho$, and the robustness of a plan designed to satisfy that specification. $\rho$ measures the margin by which the specification is met for a particular execution of a plan, but it does not provide much information about whether the specification will hold across multiple executions, particularly when external disturbances can affect those executions. In the next section, we formalize the robust planning problem, which aims at finding a plan that will satisfy the STL specification even when affected by external disturbances. STL syntax may appear opaque at first glance, but its myriad symbols belie the fact that it is often straightforward to translate an STL formula into easily-understood natural language. For example, $\eventually_{[10, 20]} ((\always_{[0, 5]}\ x \geq 0)\ \until\ y \leq 0)$ can be read as ``between 10--\SI{20}{s} from now, $x$ must be positive for \SI{5}{s} before $y$ becomes negative.'' We provide more examples of STL formulae for robotics problems in Section~\ref{experiments}. \section{Problem Statement} In this paper, we focus on the problem of robust planning from an STL specification, which we view as a sequential two-player zero-sum game between the planner and its environment. In the first step of this game (planning time), the planner has the opportunity to tune a set of \textit{design parameters} $\theta$, but in the second step (run-time) the environment can change a distinct set of \textit{exogenous parameters} $\chi$ to degrade the performance of the plan. Together, $\theta \in \Theta$ and $\chi \in \mathcal{X}$ define the behavior of an autonomous system $\xi: \Theta \times \mathcal{X} \mapsto X^T$, which we assume is a known simulator function mapping design and exogenous parameters to a length-$T$ trace of states $x_t \in X$. We assume that $\xi$ is deterministic, so all uncertainty must be imported via $\chi$, but we assume that $\chi$ may be chosen \textit{adversarially} to degrade the performance of our chosen $\theta$ as much as possible. We also assume that the designer must commit to a choice of $\theta$ before the adversary chooses $\chi$ The performance of a plan is given by a cost function $J: X^T \mapsto \R$ assigning a scalar cost to a behavior trace. To accommodate STL specifications, we deal mainly with cost functions of the form \begin{align*} J_\psi(\theta, \chi) = -\rho\pn{\psi, \xi(\theta, \chi)} + \lambda J_{other}(\theta, \chi) \end{align*} where $\rho\pn{\psi, \xi(\theta, \chi)}$ is the robustness margin of the behavior trace with respect to a given STL specification $\psi$. We negate $\rho$ so that minimizing $J$ maximizes the robustness margin, and the $\lambda J_{other}$ term permits us to consider other factors in the plan's performance (e.g. fuel use). The scaling factor $\lambda$ is typically small to prioritize satisfying the STL specification. Since we assume that $\chi$ can vary adversarially to impose worst-case performance for any plan $\theta$, our goal is to find $\theta$ that are robust to this variation. Concretely, our goal is to solve an optimization problem representing a two-step sequential zero-sum game with two players: \begin{align} \max_{\chi \in \mathcal{X}}\ \min_{\theta \in \Theta}\ J(\theta, \chi) \label{planning_problem} \end{align} To make this discussion concrete, consider a simple example of path planning for an aerial robot. In this case, $\psi$ might specify that we eventually ($\eventually$) reach a goal and always ($\always$) avoid some obstacles, $\theta$ might represent the locations of waypoints along the path and the parameters of a trajectory-tracking controller to follow those waypoints, and $\chi$ might represent the force from wind that attempts to drive the robot off course. The behavior $\xi$ might be a function that simulates the dynamics of the robot flying through wind, and the additional cost $J_{other}$ might impose a small penalty on large control inputs to conserve battery life. We provide more in-depth examples in Section~\ref{experiments}. Our formulation differs from that presented in~\cite{Pant2018} and~\cite{Pantazides2022}; although both of these works seek to maximize the robustness margin $\rho$, neither consider the effect of disturbances $\chi$. Our formulation is also distinct from the mixed-integer formulation in~\cite{Sun2022}, since we consider $\rho$ as part of an objective rather than as a constraint. Our unconstrained approach does not provide the same completeness guarantees as a mixed-integer constrained optimization (used in~\cite{raman15,sadraddini15,Sun2022}), but empirical results in Section~\ref{experiments} demonstrate that our approach scales much better. Of course, solving~\eqref{planning_problem} to global optimality in the general nonlinear case is intractable. Instead, we take advantage of this game structure to design an iterative algorithm to find the \textit{generalized Nash equilibrium}: the design parameters $\theta$ and corresponding $\chi$ such that neither the planner nor the adversary have an incentive to change their choice~\cite{Facchinei2007}. The next section describes this iterative algorithm, which we implement using nonlinear programming with differentiable simulation and differentiable temporal logic. \section{Approach} To solve the robust STL planning problem~\eqref{planning_problem}, we need to address two key points. First, we must develop a meta-heuristic to find a generalized Nash equilibrium of the sequential game~\eqref{planning_problem}, taking care that we do not overfit to any particular value of $\chi$. We solve this challenge by developing an iterative counterexample-guided nonlinear optimization framework. Second, in order to solve this problem using nonlinear optimization, we need an efficient way to compute gradients of $J$ with respect to both $\theta$ and $\chi$, which requires us to differentiate not only the behavior function $\xi$ but also the robustness margin computation $\rho$. We address this challenge using differentiable programming, which we discuss next before introducing our high-level counterexample-guided optimization strategy. \subsection{Differentiable Simulation and Temporal Logic}\label{autodiff} Although it is possible to solve nonlinear optimization problems without access to the gradients of the objective or constraint functions, either by estimating gradients~\cite{suh2021_bundled_gradients} or using zero-order methods~\cite{nevergrad}, it is often much faster to use exact gradient information when it is available. However, exact gradients can be difficult to derive symbolically for complex optimization problems. Instead, recent works have turned to \textit{automatic differentiation} using differentiable programming to automatically compute gradients in problems such as 3D shape optimization~\cite{cascaval2021differentiable}, aircraft design optimization~\cite{sharpe_thesis}, robot design optimization~\cite{dawson2022architect1,du2021underwater}, and machine learning~\cite{jax2018github}. Inspired by this trend, we implement $\xi$ using the JAX framework for automatic differentiation~\cite{jax2018github}, yielding a differentiable simulation of the underlying autonomous system. For a system where the behavior is defined by continuous-time dynamics $\dot{x} = f(x, \theta, \chi, t)$, implementing numerical integration in a differentiable language such as JAX allows us to automatically back-propagate through the simulator to find the gradients $\nabla_\theta \xi$ and $\nabla_\chi \xi$. These gradients can typically be computed much more quickly using automatic differentiation than by finite-difference methods~\cite{dawson2022architect1}. We can use a similar differentiable programming approach to obtain gradients through the quantitative semantics of an STL specification. Before doing so, we must replace the discontinuous $\max$ and $\min$ operators used to compute $\rho$ with smooth approximations: \begin{align*} \widetilde{\max}(x_1, x_2, \ldots) &= \frac{1}{k}\log\pn{e^{kx_1} + e^{kx_2} + \ldots} \\ \widetilde{\min}(x_1, x_2, \ldots) &= -\widetilde{\max}(-x_1, -x_2, \ldots) \end{align*} where $k$ is a smoothing parameter and $\lim_{k\to\infty} \widetilde{\max} = \max$. This differentiable relaxation was introduced in~\cite{Pant2017} and later used in~\cite{Pant2018,Pantazides2022}; \cite{Leung2020} uses a slightly different approximation. Using these smooth approximations, we implement the fast, linear-time algorithms for computing the robustness margin proposed by~\cite{donze13}, using the JAX framework to enable efficient automatic differentiation. In contrast to~\cite{Leung2020}, our method achieves computational complexity that is linear in the length of the state trace $T$ (the complexity of the \texttt{stlcg} framework in \cite{Leung2020} is quadratic in $T$ for the $\mathcal{U}$ operator). By combining smooth approximations of STL quantitative semantics with differentiable programming, we can efficiently compute the gradients $\nabla_\theta \rho$ and $\nabla_\xi \rho$. By combining these gradients with those found using differentiable simulation, we can efficiently compute the gradient of the objective $J$ with respect to both the design parameters $\theta$ and the adversary's response $\chi$. Usefully, our use of differentiable programming means that we are not restricted to considering trajectory planning separately from the design of a tracking controller, as in~\cite{Pant2018} and~\cite{Sun2022}. Instead, we can consider an end-to-end gradient that combines the planned trajectory and controller parameters in $\theta$ and optimizes them jointly (see Section~\ref{experiments} for an example of this end-to-end optimization). In the next section, we discuss how end-to-end gradients enable an iterative algorithm for counterexample-guided robust optimization. \subsection{Counterexample-guided Optimization} To solve the planning problem in~\eqref{planning_problem}, we need to find a generalized Nash equilibrium between the planner and the adversary; i.e. values of $\theta$ and $\chi$ where neither we nor the adversary has any local incentive to change. A common solution strategy for such problems is the family of nonlinear Gauss-Seidel-type methods~\cite{Facchinei2007}. These methods solve max-min problems like~\eqref{planning_problem} by alternating between $\theta$ and $\chi$, tuning one set of parameters while keeping the others constant; i.e. alternating between the two optimization problems: \begin{subequations} \begin{align}\label{eq:gauss_seidel} \theta^* &= \argmin_\theta J(\theta, \chi^*) \\ \chi^* &= \argmax_\chi J(\theta^*, \chi) \end{align} \end{subequations} Although these methods are not guaranteed to converge, it is known that if they do, then the convergence point $(\theta^*, \chi^*)$ is a Nash equilibrium~\cite{Facchinei2007}. A risk of applying such a simple alternating scheme is that the nonlinear optimization for both $\theta$ and $\chi$ can easily get caught in local minima. Such local minima not only reduce the performance of the optimized plan, but also increase the risk of ``overfitting'' to a particular value of $\chi^*$. This risk is particularly salient because the planner must commit to a choice of $\theta$ before the adversary has a final opportunity to choose $\chi$. To mitigate this risk and improve the robustness of our optimized plan, we extend a standard Gauss-Seidel method with two ideas from the machine learning and optimization literature. First, we take inspiration from the success of domain randomization in robust machine learning~\cite{tobin2017}: instead of optimizing $\theta$ with respect to a single fixed $\chi^*$, we can maintain a dataset $\mathcal{X}_N = \set{\chi_i}_{i=1,\ldots,N}$ and optimize the performance of $\theta$ across all of these samples: \begin{subequations} \begin{align}\label{eq:gauss_seidel_domain_randomization} \theta^* &= \argmin_\theta \mathbb{E}_{\mathcal{X}_N} \left[ J(\theta, \chi_i) \right]\\ \chi^* &= \argmax_\chi J(\theta^*, \chi) \end{align} \end{subequations} Incorporating domain randomization into the Gauss-Seidel method has the potential to improve the robustness of the resulting equilibria, but it is relatively sample inefficient; it may require a large number of random samples $\chi_i$. To address this sample inefficiency, we take inspiration from a second idea in the optimization and learning literature: learning from counterexamples~\cite{Chang2019}. The key insight here is that we can do better than simply randomly sampling $\chi_i$; we can use the values of $\chi^*$ found during successive iterations of the Gauss-Seidel process as high-quality counterexamples to guide the optimization of $\theta$. This insight results in our counterexample-guided Gauss-Seidel optimization method, which is outlined in pseudocode in Algorithm~\ref{alg:cg_gs}. Our algorithm proceeds as follows. We begin by initializing the dataset with $N_0$ i.i.d. examples $\chi_i$, then we alternate between solving the two optimization problems in~\eqref{eq:gauss_seidel_domain_randomization}. At each iteration, we add our current estimate of the adversary's best response $\chi^*$ to the dataset, and we stop either when the algorithm reaches a fixed point (the adversary's best response after solving~\eqref{eq:gauss_seidel_domain_randomization} is the same as the best response from the previous round) or when a maximum number of iterations is reached. As we show experimentally in Section~\ref{experiments}, this counterexample-guided optimization achieves a higher sample efficiency than simple domain randomization, in that it finds plans that are more robust to adversarial disturbance while considering a much smaller dataset. Although our use of nonlinear optimization means that our algorithm is not complete, we find empirically that it succeeds in finding a satisfactory plan in the large majority of cases. It is important to note that this algorithm is fundamentally enabled by the automatic differentiation approach detailed in Section~\ref{autodiff}; without access to the gradients of $J$ it would be much more difficult to solve the subproblems in lines~\ref{alg:opt_theta} and~\ref{alg:opt_chi} of Algorithm~\ref{alg:cg_gs}. Although some previous approaches obtain gradients of STL satisfaction with respect to $\theta$ using standard trajectory optimization formulations, as in~\cite{Pant2018}, we are not aware of any approaches that make use of gradients with respect to disturbance parameters. There has been some work on using counterexamples to guide mixed-integer planning~\cite{raman15}, but our experiments in the next section demonstrate that these mixed-integer programs are intractable for long horizon problems. Specifically, we find that solving even a single mixed-integer program can take more than an hour, so solving multiple programs to derive counterexamples is not a practical solution. In the next section, we demonstrate that our gradient-based counterexample-guided approach outperforms these existing approaches, not only finding more robust plans but requiring substantially less computation time to do so. \begin{algorithm} \caption{Counterexample-guided Gauss-Seidel method for solving robust planning problems}\label{alg:cg_gs} \DontPrintSemicolon \KwInput{Starting dataset size $N_0$\\\phantom{Input: } Maximum number of iterations $M$} \KwOutput{Optimized design parameters $\theta^*$\\\phantom{Output: } Dataset of counterexamples $\mathcal{X}_N$} $\mathcal{X}_N \gets $ $N_0$ examples $\chi_i \in \mathcal{X}$ sampled uniformly i.i.d.\; $\chi^*_{prev} \gets \varnothing$\; \For{$i \in \set{1, \ldots, M}$} { $\theta^* = \argmin_\theta \mathbb{E}_{\mathcal{X}_N} \left[ J(\theta, \chi_i) \right] \label{alg:opt_theta}$ \; $\chi^* = \argmax_\chi J(\theta^*, \chi)$ \label{alg:opt_chi} \; \If{$\chi^* = \chi^*_{prev}$}{\Break} $\chi^*_{prev} \gets \chi^*$\; Append $\chi^*$ to $\mathcal{X}_N$\; } \KwRet{$\theta^*$, $\mathcal{X}_N$} \end{algorithm} \section{Experiments}\label{experiments} We validate our approach by means of two case studies involving the satellite rendezvous problem posed in~\cite{Jewison2016}. We benchmark against state-of-the-art planning algorithms to show the robustness and scalability benefits of our approach. In this satellite rendezvous problem, the goal is to maneuver a chaser satellite to catch a target satellite. We can express this problem in the Clohessy-Wiltshire-Hill coordinate frame~\cite{Jewison2016}, which assumes that the target's orbit is circular and constructs a coordinate frame with the origin at the target, the $x$-axis pointing away from the Earth, the $y$-axis pointing along the target's orbit, and the $z$-axis pointing out of the orbital plane. In this frame, the chaser's dynamics are approximately linear, with positions $p_x$, $p_y$, $p_z$ and velocities $v_x$, $v_y$, $v_z$ varying according to controlled thrust in each direction $u_x$, $u_y$, $u_z$: \begin{align*} \mat{\dot{p}_x \\ \dot{p}_y \\ \dot{p}_z \\ \dot{v}_x \\ \dot{v}_y \\ \dot{v}_z} = \mat{ v_x \\ v_y \\ v_z \\ 3n^2 p_x + 2n v_y + u_x / m\\ -2n v_x + u_y / m\\ -n^2 p_z + u_z / m } \end{align*} $n = \sqrt{\mu / a^3}$ is the mean-motion of the target, determined by the Earth's gravitational constant $\mu = \SI{3.986e14}{m^3/s^2}$ and the target's altitude $a$ (i.e. the length of the semi-major orbital axis, \SI{353}{km} in low Earth orbit). $m = \SI{500}{kg}$ is the mass of the chaser satellite~\cite{Jewison2016}. In this setting, we construct STL specifications for two rendezvous missions: a simple low-speed rendezvous and a more complex loiter-then-rendezvous mission, illustrated in Fig.~\ref{fig:mission_specs}. The STL specifications for each mission, $\psi_1$ and $\psi_2$, are given formally as: \begin{align*} \psi_1 &= \psi_\text{reach target} \wedge \psi_\text{speed limit} \\ \psi_2 &= \psi_\text{reach target} \wedge \psi_\text{speed limit} \wedge \psi_\text{loiter} \\ \psi_\text{reach target} &= \eventually \pn{r \leq 0.1} \\ \psi_\text{speed limit} &= \pn{r \geq 2.0} \until\ \always \pn{v \leq 0.1} \\ \psi_\text{loiter} &= \eventually \always_{[0, T_{obs}]} \pn{2.0 \leq r \wedge r \leq 3.0} \end{align*} where $r = \sqrt{p_x^2 + p_y^2 + p_z^2}$ and $v = \sqrt{v_x^2 + v_y^2 + v_z^2}$. Informally, $\psi_1$ requires that ``the chaser eventually comes within \SI{0.1}{m} of the target and does not come within \SI{2}{m} of the target until its speed is less than \SI{0.1}{m/s}'', and $\psi_2$ additionally requires that ``the chaser eventually spends at least $T_{obs}$ seconds in the region between 2--\SI{3}{m} from the target.'' For each mission, the design parameters $\theta$ include both state/input waypoints along a planned trajectory and the feedback gains used to track that trajectory, and the exogenous parameters $\chi$ represent bounded uncertainty in the initial state of the chaser ($p_x(0), p_y(0) \in [10, 13]$, $p_z(0) \in [-3, 3]$, $v_x(0), v_y(0), v_z(0) \in [-1, 1]$). We use a \SI{200}{s}-long simulation with a \SI{2}{s} timestep for both missions, and $T_{obs} = \SI{10}{s}$. \begin{figure}[t] \centering \includegraphics[width=\linewidth]{figs/satellite_missions.png} \caption{Two satellite rendezvous missions used to test our framework. In the first mission, the chaser satellite must eventually reach the target while respecting a maximum speed constraint in the region immediately around the target. In the second mission, the chaser must still reach the target and obey the speed limit, but it must also loiter in an observation region for some minimum time before approaching. The first mission requires an STL formula with three predicates and three temporal operators, while the second mission requires five predicates and five temporal operators.} \label{fig:mission_specs} \end{figure} For each mission $i=1, 2$, we define a cost function as $J_i = \rho_i + \lambda I$, where $\rho_i = \rho(\psi_i, \xi(\theta, \chi), 0)$ is the STL robustness margin at the start of the trajectory, $I$ is the total impulse required to execute the maneuver (in Newton-seconds), and $\lambda = 5\times10^{-5}$. By applying our iterative counterexample-guided optimization strategy to this problem, we find the optimized trajectories for mission 1 and 2 shown in Figs.~\ref{fig:mission_1_traj} and~\ref{fig:mission_2_traj} along with the worst-case $\chi$. In these examples, we use $N_0=8$ initial examples and $M=10$ maximum rounds, but the algorithm converges in less than 10 rounds in all trials. In both missions, our approach reliably finds a solution that remains feasible despite worst-case variation in the exogenous parameters, achieving a positive STL robustness margin in $>90\%$ of trials in each case. Our counterexample-guided approach requires an average of \SI{53.7}{s} to solve mission 1 and \SI{194.2}{s} to solve mission 2 (averaged across 50 trials). \begin{figure}[t] \centering \includegraphics[width=0.9\linewidth]{figs/satellite_mission1_traj.png} \caption{The optimized trajectory found using our counterexample-guided optimization strategy for mission 1 (rendezvous with speed constraint). The chaser satellite only enters the speed-limit zone once it has slowed down sufficiently.} \label{fig:mission_1_traj} \end{figure} \begin{figure}[t] \centering \includegraphics[width=\linewidth]{figs/mission_1_comparison.png} \caption{Comparison of different STL planning methods on the first example mission, averaged over 50 random seeds. Left: the robustness margin $\rho(\psi_1)$ computed for the optimized design parameters and worst-case exogenous parameters. Right: the planning time required by each method. Our method (CG) achieves much higher robustness than all other methods (satisfying the STL specification despite adversarial perturbations in all but 3 instances) and runs twice as fast as the next-most-robust method.} \label{fig:mission_1_comparison} \end{figure} We can quantitatively compare our approach against two state of the art approaches: a mixed-integer STL planner based on that in~\cite{raman15} and~\cite{sadraddini15} and the nonlinear optimization approach in~\cite{Pant2018,Pantazides2022}. The mixed-integer planner (MIP) in~\cite{raman15} uses a model-predictive control formulation and proposes to add counterexamples after solving each instance of the mixed-integer program; however, we found that even a single instance could not be solved to optimality within 1 hour for either mission, and so we compare with the best solution found within a given period of time. Even though the size of the mixed-integer program in~\cite{raman15} grows linearly with the horizon of the problem, the complexity of solving the resulting MIP grows exponentially in the number of integer variables (these problems require between 2800--4500 integer variables when solved using Gurobi). Since it was not tractable to solve even once instance of the MIP, we were unable to use any MIP-generated counterexamples as proposed in~\cite{raman15}; instead, we take the best feasible solution found after \SI{500}{s} for the first mission and after \SI{1000}{s} for the second mission. We also compare with an extension of the nonlinear optimization from~\cite{Pant2018,Pantazides2022}, where we add domain randomization to the authors' existing trajectory optimization formulation, averaging the objective over either 32 or 64 different values of $\chi$. We note that these methods rely on a similar optimization approach as those proposed in~\cite{Leung2020}, but we re-implement the authors' method to ensure a fair comparison (our implementation makes use of just-in-time compilation to speed the optimization process, and so comparing with off-the-shelf implementations like \texttt{stlcg}~\cite{Leung2020} would not be fair). A comparison of our counterexample-guided approach (CG), nonlinear optimization with domain randomization (NLopt), and the mixed-integer planner (MIP) is shown in Fig.~\ref{fig:mission_1_comparison} for the first mission and Fig.~\ref{fig:mission_2_comparison} for the second mission. In all cases, we compare across 50 random trials, computing the time required to solve each instance and the robustness of the optimized plan when subject to adversarial disturbances. All experiments were run on a laptop computer with \SI{8}{GB} RAM and a \SI{1.8}{GHz} 8-core processor. We find that our method is consistently more robust than prior methods; in the first mission, it satisfies the STL specification in all but 3 trials, despite adversarial disturbances. For comparison, the next-best method (NLopt with domain randomization across 64 examples) failed to solve the first mission in 14 out of 50 trials and took more than twice as long on average to find a plan (\SI{114.3}{s} as opposed to \SI{53.7}{s} for our method). This advantage is due to the quality of the examples used during optimization; instead of 64 random samples, our method uses 8 initial random samples and between 1 and 4 counterexamples (median 2) representing worst-case variation in $\chi$, making our method much more sample-efficient. We also find that our method finds more robust solutions than the MIP method, since MIP cannot tractably consider variation in $\chi$ (the MIP method is also unable to find a feasible solution within \SI{500}{s} in 16 out of 50 trials). MIP's performance also suffers due to discretization error, since we were forced to discretize the continuous-time dynamics with relatively few knot points (one every \SI{2}{s}) to yield a tractable MIP optimization problem. Our method also performs well on the second mission planning problem: only our method consistently finds solutions that are robust to variation in $\chi$ (see Fig.~\ref{fig:mission_2_comparison}). Due to the increased complexity of this example, the MIP method finds a feasible solution within \SI{1000}{s} in only 16 out of 50 trials (the MIP encoding of this mission requires 7769 continuous variables, 2806 binary variables, and 1479 constraints), and the feasible solutions found within \SI{1000}{s} tend to be of poor quality. The second-most-robust method, NLopt with 64 random examples, takes more than twice as long as our method and fails to satisfy the STL specification in 17 out of 50 trials (compared to only 4 failures for our method). Our method required a median of 2 counterexamples in addition to the 8 initial examples to solve this planning problem (the slowest trial required 7 additional examples). These data demonstrate that our counterexample-guided approach to planning from STL specifications is faster, more sample efficient, and more robust to adversarial disturbances than state-of-the-art approaches. A software implementation of our method is available online at \url{https://github.com/MIT-REALM/architect}. \begin{figure}[t] \centering \includegraphics[width=\linewidth]{figs/satellite_mission2_traj.png} \caption{The optimized trajectory found using our counterexample-guided optimization strategy for mission 2 (loiter then rendezvous with speed constraint). The optimized plan satisfies the additional mission requirement of spending time in the observation region before approaching the target.} \label{fig:mission_2_traj} \end{figure} \begin{figure}[t] \centering \includegraphics[width=\linewidth]{figs/mission_2_comparison.png} \caption{Comparison of different STL planning methods on the second example mission, averaged over 50 random seeds. Left: the robustness margin $\rho(\psi_2)$ computed for the optimized design parameters and worst-case exogenous parameters. Right: time required by each method to find a plan. Our method (CG) finds much more robust plans, satisfying the specification in all but 4 instances compared to 17 failures for the next-best method (NLopt with 64 examples). Our method also runs more than twice as fast as the next-most-robust method.} \label{fig:mission_2_comparison} \end{figure} \subsection{Hardware Demonstration} We also validate our approach in hardware by solving the loiter-then-rendezvous mission for a Turtlebot 3 ground robot. We replace the satellite dynamics with nonlinear Dubins dynamics and plan a trajectory that satisfies $\psi = \psi_\text{reach target} \wedge \psi_\text{loiter}$ (we do not include the speed limit because the Turtlebot already has a relatively small maximum speed). Our counterexample-guided planner solves this problem in \SI{26.22}{s}, yielding the trajectory shown in Fig.~\ref{fig:hw}. A video of this demonstration is included in the supplementary materials. \begin{figure}[t] \centering \includegraphics[width=\linewidth]{figs/hw_mission_2.png} \caption{The trajectory found using our counterexample-guided planner successfully moves the robot through the observation zone (where it must spend at least \SI{10}{s}) and into the docking zone. Odometry data indicate that the planned trajectory achieves an STL robustness margin of $0.0255$.} \label{fig:hw} \end{figure} \section{Conclusion} In this paper, we introduce a novel framework for robust optimization-based planning from temporal logic specifications. We frame the robust planning problem as a sequential two-player game between the planner, which chooses a set of design parameters at planning time, and the environment, which picks disturbances adversarially in response to the planner's choice. We develop an iterative counterexample-guided algorithm to find plans that robustly satisfy temporal logic specifications despite worst-case disturbances from the environment. Our method, which relies on differentiable programming for simulation and evaluating the temporal logic specification, not only finds more robust plans than state-of-the-art methods but also runs substantially faster. We apply our method to two planning problems involving time horizons $>$\SI{100}{s} and STL specifications with multiple nested temporal operators, and we provide source code for our approach at \url{https://github.com/MIT-REALM/architect}. In future work, we hope to extend our framework to offer completeness guarantees by combining our counterexample-guided optimization with complete model checking and STL falsification methods, such as the Breach framework~\cite{donze10}. We also look forward to exploring applications of this framework to problems involving multiple agents, particularly for human-robot interaction, and to combining local gradient-based optimization with sampling based methods to solve more complex task-and-motion planning problems. \bibliographystyle{IEEEtran}
{'timestamp': '2022-03-07T02:05:11', 'yymm': '2203', 'arxiv_id': '2203.02038', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.02038'}
arxiv
\section{Introduction} \input{tables/overview} As machine learning models are increasingly deployed in real-world scenarios, it has motivated the development of interpretable machine learning (ML) as a research field with the goal of understanding ML models, performing model debugging, and using these insights to better inform the interaction between AI and humans in joint decision making~\cite{gilpin2018explaining,bhatt2020explainable,chen2022interpretable}. Recently, the promise of multimodal models for real-world representation learning in numerous applications such as multimedia~\cite{liang2021multibench,liang2018multimodal,1667983}, affective computing~\cite{liang2018ranking,PORIA201798}, robotics~\cite{kirchner2019embedded,lee2019making}, finance~\cite{doi:10.1177/0170840618765019}, dialogue~\cite{Pittermann2010}, human-computer interaction~\cite{dumas2009multimodal,obrenovic2004modeling}, and healthcare~\cite{xu2019multimodal} has invigorated research into multimodal machine learning, which brings unique challenges for both computational and theoretical research given the heterogeneity of various data sources and difficulty of capturing correspondences between modalities~\cite{baltruvsaitis2018multimodal}. Among one of these core challenges is \textit{interpretable multimodal learning} with the end goal of empowering various stakeholders by providing insights into multimodal learning, improving model design, or debugging models and datasets. Recent work in interpretable multimodal learning has therefore focused on constructing interpretable multimodal models via careful model design~\cite{tsai2020multimodal,zadeh2018multimodal,park2018multimodal} or performing post-hoc explanations of black-box multimodal models~\cite{goyal2016towards,chandrasekaran2018explanations}. However, existing works typically focus on building interpretable models using suitable inductive biases, such as designing multimodal routing networks~\cite{tsai2020multimodal}, graph-based fusion~\cite{zadeh2018multimodal}, or multimodal explanation networks to highlight visual importance~\cite{park2018multimodal}. Some of these approaches also require the collection of specialized datasets annotated for visual explanations as intermediate steps in training interpretable models~\cite{park2018multimodal}. On the other hand, with the trend towards large-scale modeling or pre-training as an alternative over individual modality-specific or task-specific models~\cite{visualbert,liang2021multibench}, it is increasingly important to design general-purpose approaches that (1) are able to generate post-hoc explanations for arbitrary black-box models, and (2) does not assume anything about the modality or classification task itself. As a step towards more fine-grained interpretations of general-purpose multimodal models across arbitrary tasks, we propose \textsc{DIME}, an interpretation method for black-box multimodal models. While existing work has been able to generate useful explanations to help humans understand model decision-making processes~\cite{chandrasekaran2018explanations}, they are often only performed at one step of the entire multimodal decision-making process. These singular steps typically include attributing feature importance~\cite{park2018multimodal,chandrasekaran2018explanations} or representation importance~\cite{tsai2020multimodal,zadeh2018multimodal}. The core idea in \textsc{DIME}\ is to provide more fine-grained interpretations by disentangling a multimodal model into unimodal contributions (\textbf{UC}) and multimodal interactions (\textbf{MI}). We show that this key insight enables more accurate and fine-grained analysis of multimodal models while maintaining generality across arbitrary modalities, model architectures~\cite{kamath2021mdetr,lxmert}, and tasks~\cite{balanced_vqa_v2,johnson2017clevr}. Through a comprehensive suite of experiments on both synthetic and real-world multimodal tasks, we show that \textsc{DIME}\ is able to accurately perform disentanglement and generate reliable explanations for both UC and MI. Using \textsc{DIME}, we are able to gain a deeper understanding of model behavior on challenging multimodal tasks. For example, on VQA 2.0~\cite{goyal2017making}, we successfully use \textsc{DIME}\ to determine whether the model uses correct multimodal interactions to answer the questions, as shown in Figure~\ref{intro}. By providing these model explanations to a human annotator, they are able to gain additional insights on model behavior and better determine whether UC, MI, or both are the dominant factor behind the model's predictions on individual datapoints. Furthermore, \textsc{DIME}\ presents a step towards debugging and improving these models by systematically revealing certain undesirable behaviors. \section{Related Work} Interpretable machine learning as a research field aims to further our understanding of AI models, empower various stakeholders to build trust in AI models, perform model debugging, and use these insights to better inform the interaction between AI and humans in joint decision making~\cite{gilpin2018explaining,bhatt2020explainable,chen2022interpretable}. We cover related concepts in interpreting unimodal models and multimodal models. \subsection{Interpreting Unimodal Models} Related work has studied approaches for better understanding unimodal models used for vision, language, and audio modalities. These approaches can be roughly categorized into interpretable ML as designing models which are understandable by design, and explainable ML which focuses on producing post-hoc explanations for black-box models~\cite{rudin2019stop}. In the former, methods such as Concept Bottleneck Models~\cite{koh2020concept} and fitting sparse linear layers~\cite{wong2021leveraging} or decision trees on top of deep feature representations~\cite{wan2020nbdt} have emerged as promising choices marrying the expressive power of deep features with the interpretable decision-making processes of linear models or decision trees. In the latter, approaches such as saliency maps~\cite{simonyan2013deep,smilkov2017smoothgrad}, using surrogate models to interpret local decision boundaries~\cite{lime}, feature visualizations~\cite{yosinski2015understanding,erhan2009visualizing}, and assigning semantic concepts~\cite{bau2017network} all aim to provide insight into model predictions for specific input instances. We refer the reader to~\citet{chen2022interpretable} for a survey and taxonomy of interpretable ML approaches, as well as~\citet{bhatt2020explainable} for an analysis of how interpretable and explainable ML tools can be used in the real world. \subsection{Interpreting Multimodal Models} Similar to the interpretation of unimodal models, recent work in interpretable multimodal learning can be categorized into two sections: (1) constructing interpretable multimodal models via careful model design~\cite{tsai2020multimodal,zadeh2018multimodal,park2018multimodal} or (2) performing post-hoc explanations of black-box multimodal models~\cite{goyal2016towards,chandrasekaran2018explanations}. In the former, multimodal routing networks~\cite{tsai2020multimodal}, graph-based fusion techniques~\cite{zadeh2018multimodal,liang2018computational}, multimodal explanation networks to highlight visual importance~\cite{park2018multimodal}, hard-attention~\cite{chen2017multimodal}, and neuro-symbolic reasoning methods~\cite{vedantam2019probabilistic,andreas2016neural} have emerged as strong design choices as a step towards more interpretable multimodal learning. These approaches individually focus on building interpretable components for either modality importance~\cite{park2018multimodal}, cross-modal interactions~\cite{tsai2020multimodal,zadeh2018multimodal,liang2018computational}, or the reasoning process on top of cross-modal interactions~\cite{vedantam2019probabilistic,andreas2016neural}. While these approaches provide reliable interpretations by virtue of model design, they are typically restricted to a certain set of modalities or tasks. On the other hand, we propose a more general approach that is able to generate post-hoc explanations for arbitrary black-box multimodal models, and does not assume anything about the modality or classification task itself. In the latter section on post-hoc explainability of black-box multimodal models, related work has similarly gravitated towards aiming to understand either modality importance~\cite{goyal2016towards,chandrasekaran2018explanations,kanehira2019multimodal} or cross-modal interactions in pretrained language and vision transformer models~\cite{frank2021vision,cao2020behind,parcalabescu2021seeing,li2020does}. Perhaps most related to our work is~\citet{wang2021m2lens} proposing M2Lens, an interactive visual analytics system to visualize and explain black-box multimodal models for sentiment analysis through both unimodal and multimodal contributions. Our approach further disentangles the two types of contributions, which allows us to generate visualizations on each and gain insight into which input features are involved in multimodal interactions. Our approach is also not restricted to sentiment analysis. \subsection{Representation Disentanglement} Related to our work is the idea of learning disentangled data representations - mutually independent latent variables that each explain a particular variation of the data~\cite{Bengio:2013:RLR:2498740.2498889,locatello2018challenging}. Disentangled representation learning has been shown to improve both generative and discriminative performance in multimodal tasks~\cite{tsai2018learning}. If the factors of variation are known, many methods learn latent attributes that individually control each variation of data by supervised training~\cite{karaletsos2015bayesian,reed2014learning,cheung2014discovering}. If the factors are partially known or unknown, deep generative models can be used to impose an isotropic Gaussian prior on the latent variables~\cite{vae2013,rubenstein2018latent,Higgins2016VAELB}, maximize the mutual information between a subset of latent variables and the data~\cite{chen2016infogan}, or to encourage the distribution of representations to be factorial and hence independent~\cite{pmlr-v80-kim18b}. Particularly related to our work is empirical multimodally-additive function projection (EMAP)~\cite{hessel2020emap}, an approach for disentangling the effects of unimodal (additive) contributions from cross-modal interactions in multimodal tasks. \subsection{Dataset and Model Biases} One core motivation for interpretable ML is to enable a better understanding of the model's decision-making process so as to check whether model behavior is as intended. Using these tools, researchers have uncovered several biases existing in machine learning models and datasets. These biases include undesirable associations captured either in the data or the model, which do not reflect decision-making as one would expect. For example, a line of work in visualizing and understanding multimodal models has uncovered unimodal biases in the language modality of VQA tasks~\cite{jabri2016revisiting,agrawal2016analyzing,anand2018blindfold,cadene2019rubi}, which then inspired follow-up datasets to elevate the importance of visual understanding through VQA 2.0~\cite{goyal2017making}. Similar visualizations also led to improved performance on image captioning tasks by relying less on gender biases and spurious correlations~\cite{hendricks2018women}. Our approach towards better visualizing and understanding multimodal models is also inspired by these insights, and we believe that our fine-grained and general approach will motivate future work towards removing biases from a wider range of datasets and models beyond the prototypical language and vision tasks. \section{Method: \textsc{DIME}} Our approach, \textsc{DIME}\ (short for \textsc{DIsentangled Multimodal Explanations}), is primarily based on disentangling a multimodal model into unimodal contributions (\textbf{UC}) and multimodal interactions (\textbf{MI}), before performing fine-grained visualizations on each disentangled factor. In this section, we introduce precise definitions of unimodal contributions and multimodal interactions, before explaining how disentanglement and interpretations are performed. \subsection{Unimodal Contributions and Multimodal Interactions} Unimodal contributions $(\textsc{UC})$ represent information gained by only looking at one of the modalities without interacting with any other modalities, while multimodal interactions $(\textsc{MI})$ are information gained from cross-referencing inputs from multiple modalities~\cite{hessel2020emap}. Multimodal models make decisions using a combination of information from both unimodal contributions and multimodal interactions. For example, in Figure~\ref{intro}, the model assigns a high likelihood to ``glass'' because (1) just by looking at the image, there are many glass objects (unimodal contributions) and (2) by cross-referencing with text, the model focuses on the glass table and assigns a high likelihood to ``glass'' (multimodal interaction). Therefore, to performed fine-grained interpretation in a multimodal model $M$, we first propose a new method to disentangle the model into two submodels: \begin{equation} M = \textsc{UC}(M) + \textsc{MI}(M), \end{equation} where $\textsc{UC}(M)$ represents the unimodal contributions within $M$ and $\textsc{MI}(M)$ represents the multimodal interactions within $M$. We can then run visualizations on each sub-model in order to generate human-interpretable visualizations of unimodal contributions and multimodal interactions (see Figure~\ref{fig:nonexistent} for an overview of \textsc{DIME}). To generate visual explanations, we choose LIME~\cite{lime}, a widely used interpretation method for black-box models. \begin{figure*} \vspace{0mm} \includegraphics[width=1.0\textwidth]{figs/mainpic.pdf} \caption{High level illustration of \textsc{DIME}: we disentangle the model $M$ into two: unimodal contributions (UC) and multimodal interactions (MI), before running visualizations on each sub-model (e.g., using LIME~\cite{lime}) in order to generate fine-grained human-interpretable visualizations of each.} \label{fig:nonexistent} \vspace{-3mm} \end{figure*} \subsection{Model Disentanglement} \label{sec:proof} Let $M$ be the multimodal model that we wish to disentangle into unimodal contributions and multimodal interactions. For simplicity, suppose $M$ takes in two modalities as input and produces pre-softmax logits on $C$ classes as output. Therefore, we can view $M$ as a function that maps two inputs $x_1,x_2$ from two modalities to a output logit vector $V$, i.e., $V = M(x_1,x_2)$. Our goal will be to disentangle the function $M$ into a sum of two functions, one representing unimodal contributions and one representing multimodal interactions. Formally, we would like to write $M$ as $M(x_1,x_2)=g_1(x_1)+g_2(x_2)+g_{12}(x_1,x_2)$, where $g_1$ and $g_2$ are unimodal contributions from the two input modalities, respectively, and $g_{12}$ represents multimodal interactions. By definition of multimodal interactions, we require that $\mathbb{E}_{x_1}g_{12}(x_1,x_2)=0$ for all $x_2$ and $\mathbb{E}_{x_2}g_{12}(x_1,x_2)=0$ for all $x_1$ so that $g_{12}$ contains no unimodal contribution. We will show that under this definition, for each $M$ there will be a unique $g_{12}$ that satisfies these rules. We will compute $g_1(x_1)+g_2(x_2)$ using a similar method to EMAP~\cite{hessel2020emap}. We define $\textsc{UC}(M)$ as \begin{equation} \textsc{UC}(M(x_1,x_2)) = \mathbb{E}_{x_1}(M(x_1,x_2)) + \mathbb{E}_{x_2}(M(x_1,x_2)) - \mathbb{E}_{x_1,x_2}(M(x_1,x_2)). \end{equation} \textbf{Theorem 1} below (equations 3-5, proof in Appendix) states that $\textsc{UC}(M)$ indeed represents $g_1+g_2$. \begin{eqnarray} && \textsc{UC}(M(x_1,x_2)) \\ &=& \mathbb{E}_{x_1}(M(x_1,x_2))+ \mathbb{E}_{x_2}(M(x_1,x_2)) - \mathbb{E}_{x_1,x_2}(M(x_1,x_2)) \\ &=& g_1(x_1)+g_2(x_2). \end{eqnarray} Thus, we can compute $g_{12}(x_1,x_2)$ by subtracting $\textsc{UC}(M(x_1,x_2))$ from $M(x_1,x_2)$, which we name $\textsc{MI}(M)$. Formally, \begin{eqnarray} && \textsc{MI}(M(x_1,x_2)) \\ &=& M(x_1,x_2) - \textsc{UC}(M(x_1,x_2)) \\ &=& g_{12}(x_1,x_2). \end{eqnarray} This also shows that $g_{12}$ can be uniquely determined. In practice, to compute $\textsc{UC}(M(x_1,x_2))$ and $\textsc{MI}(M(x_1,x_2))$, we use a sampling method similar to~\cite{hessel2020emap}, where we sample $N$ datapoints $x^{(i)}=(x^{(i)}_1,x^{(i)}_2)$ including the point we want to explain $x=(x_1,x_2)$ as one of them, and computing each expectation in $\textsc{UC}(M(x_1,x_2))$ by approximating \begin{align} \mathbb{E}_{x_1}(M(x_1,x_2)) &= \sum_{i \in [N]} M(x^{(i)}_1,x_2), \\ \mathbb{E}_{x_2}(M(x_1,x_2)) &= \sum_{i \in [N]} M(x_1,x^{(i)}_2), \\ \mathbb{E}_{x_1,x_2}(M(x_1,x_2)) &= \sum_{i \in [N]}\sum_{j \in [N]} M(x^{(i)}_1,x^{(j)}_2). \end{align} Figure~\ref{fig:illusdisent} illustrates this disentanglement process. \begin{figure} \centering \includegraphics[width=0.45\textwidth]{figs/disent.pdf} \caption{An illustration of the disentangling process of \textsc{DIME}. We disentangle a model into two: $\textsc{UC}(M) = g_1 + g_2$ and $\textsc{MI}(M) = g_{12}$, corresponding to unimodal contributions and multimodal interactions respectively.} \label{fig:illusdisent} \end{figure} However, to compute $\textsc{UC}(M(x_1,x_2))$ and $\textsc{MI}(M(x_1,x_2))$, we will need to run forward passes through the model a total of $N^2$ times. In section~\ref{sec:fast} we will show an algorithm that computes this more efficiently by amortizing across multiple datapoints. \subsection{Interpreting Disentanglement} Now that we have disentangled the model into two, we will generate human-interpretable explanations on each modality using LIME~\cite{lime}. LIME works by subdividing the input into distinct features, and then randomly perturbing the features $S$ times to see how the perturbations on the features affect the model output logits of a specific class $c$. LIME then fits a linear model mapping the perturbations on each feature to the logits of $c$. The linear model weights on each feature gives the explanation of that feature: if the weight is positive, it means that this feature supports the decision of class $c$; if the weight is negative, it means that this feature is against the decision of class $c$; the larger the weight's absolute value, the stronger the contribution is. Visually, the weights can also be used to generate a human-interpretable visualization: for images, each feature is typically a part of the image, so the parts with the highest absolute weights can be highlighted in green for positive and red for negative contributions. For text, each feature is typically a word, so the explanation can be summarized as a histogram of weights of each word (see Figure~\ref{fig:nonexistent} for an example). When running LIME on multimodal inputs, we run LIME on one modality at a time, treating the inputs to all other modalities as constant and only perturbing the inputs to that one modality. We denote the generated explanation on model $M$, datapoint $(x_1,x_2)$, and modality $i$ as $\textsc{LIME}_i(M(x_1,x_2))$. After disentanglement into unimodal contributions $\textsc{UC}(M(x_1,x_2))$ and multimodal interactions $\textsc{MI}(M(x_1,x_2))$, our approaches enables the generation of four fine-grained explanations: \begin{itemize} \item $\textsc{UC}_1 = \textsc{LIME}_1(\textsc{UC}(M(x_1,x_2)))$, the explanation of modality 1's unimodal contributions. \item $\textsc{UC}_2 = \textsc{LIME}_2(\textsc{UC}(M(x_1,x_2)))$, the explanation of modality 2's unimodal contributions. \item $\textsc{MI}_1 = \textsc{LIME}_1(\textsc{MI}(M(x_1,x_2)))$, the explanation of modality 1's contribution to multimodal interactions. \item $\textsc{MI}_2 = \textsc{LIME}_2(\textsc{MI}(M(x_1,x_2)))$, the explanation of modality 2's contribution to multimodal interactions. \end{itemize} \subsection{Improving Efficiency} \label{sec:fast} Since running LIME on a black box model usually requires running the model many times (equal to the LIME sample size $S$), it can be costly to treat $\textsc{UC}(M)$ or $\textsc{MI}(M)$ as black-box models and run LIME on then directly - running $\textsc{UC}(M)$ involves computing $\mathbb{E}_{x_1,x_2}(M(x_1,x_2))$ which requires running $N^2$ forward passes where $N$ is the number of samples used for EMAP, so the total procedure of running \textsc{DIME}\ on one datapoint can take $O(SN^2)$ runs of $M$. In order to make the process faster, we use the following algorithmic trick: we fix $N$ datapoints from the dataset, and then run $M$ on all $N^2$ combinations of the two modalities amongst the $N$ points, and store the resulting logits in a $N\times N\times C$ array $L$ (where $C$ is the number of classes in this task). When we want to run \textsc{DIME}\ on any one of those $N$ points (let's say the $i$th point), for each perturbed LIME sample (WLOG let's say we're running LIME on modality 1, so modality 1 is perturbed in the LIME sample), we make a deep copy of $L$ called $L'$, re-run $M$ on the combination of the perturbed modality 1 input and all $N$ modality 2 inputs, replace the values in the ith row of $L'$ with the results, and compute $\textsc{UC}(M)$ on this LIME sample with the updated table $L'$. Using this trick, after amortizing the one-time initial $O(N^2)$ runs of $M$, each followup \textsc{DIME}\ run on any of the $N$ points only takes $O(SN)$ runs of $M$. See details in Algorithm 1 in the Appendix. \section{Experiments} In this section, we will perform a set of experiments to fully evaluate the reliability and usefulness of \textsc{DIME}\ in interpreting multimodal models. We will be using 3 datasets: a synthetic dataset, CLEVR~\cite{johnson2017clevr}, and VQA 2.0~\cite{balanced_vqa_v2}, and with one corresponding state-of-the-art model for each: MLP, MDETR~\cite{kamath2021mdetr} and LXMERT~\cite{lxmert}. When dealing with datasets involving image and text modalities, we will refer to the two modalities as $(V,T)$ respectively (e.g., $\textsc{UC}_V$ would refer to the \textsc{DIME}\ explanation on image unimodal contribution). Our experiments are designed to illustrate the following takeaway messages of using \textsc{DIME}\ to analyze multimodal models: \begin{enumerate} \item Our method can reliably disentangle the model and generate accurate explanations for both UC and MI, correlating highly with their respective ground truths (section~\ref{rq1}). \item In more difficult tasks such as CLEVR and VQA, and with more complex models, \textsc{DIME}\ can still disentangle the model reliably. We show that changing the text input affects $\textsc{UC}_V$ (explanation on image unimodal contribution) little but affects $\textsc{MI}_V$ (explanation on multimodal interactions from the image side) significantly (section~\ref{rq1}). \item \textsc{DIME}\ gives additional insight into understanding multimodal model behavior by answering whether the model relies mostly on UC, MI, or both in making the prediction (section~\ref{rq2}). \item \textsc{DIME}\ also enables human users to debug and improve models by identifying which input features are used in MI and revealing undesirable behavior in models (section~\ref{rq3}). \end{enumerate} Following these results, we will discuss limitations and future works (section~\ref{limit}). \subsection{Setup} \subsubsection{Datasets} We will use three datasets: a synthetic dataset to enable controlled variations between unimodal and multimodal interactions, as well as two large-scale multimodal datasets: CLEVR, and VQA 2.0. The \textbf{synthetic dataset $D$} is designed to model a task that requires both unimodal (additive) contributions and multimodal interactions to solve correctly. According to prior work~\cite{hessel2020emap}, the dot product of two modalities requires non-additive cross-modal interaction, while the sum of two vectors is additive. Therefore, we design a synthetic dataset $D$ by randomly generating two $10$-dimensional vectors following $N(0,1)$ independently for each element, and then computing the sum of all elements in both vectors plus the dot product of the two vectors. If the result's absolute value is below $0.01$, we discard this point; otherwise, we assign a $0/1$ label based on the sign of the result. We generate $100,000$ points to form $D$ and divide it into train/valid/test splits by $8/1/1$ ratio. \textbf{CLEVR}~\cite{johnson2017clevr} is a diagnostic dataset designed for language and visual reasoning. The dataset consists of synthesized images of 3D shapes of various colors, sizes, and materials on a gray background, For each image, there are several questions about the shapes' attributes, positions, and numbers. This dataset has been widely used for diagnostic purposes to find model weaknesses. \textbf{VQA 2.0}~\cite{balanced_vqa_v2} is a dataset containing various questions on real-world images. It is designed to force multimodal interactions, especially incorporating the visual aspect, by sometimes having the same question with two different answers on two different images. This dataset is interesting because models have been shown to occasionally ``guess'' correct answers purely from unimodal contributions or with the wrong visual grounding~\cite{cadene2019rubi,anand2018blindfold}. \textsc{DIME}\ will enable us to study how often models rely on undesirable unimodal biases and further understand the model's decision-making process. \subsubsection{Models} For synthetic dataset $D$, we train a \textbf{4-layer MLP} (with input size $20$ and hidden layer sizes $100,200,10,2$ respectively) on $D$ that reaches $97.3\%$ accuracy on the test split. For CLEVR dataset, we will be using a pretrained \textbf{MDETR}~\cite{kamath2021mdetr} that achieves $99.7\%$ test accuracy. For VQA 2.0, we will be using pretrained \textbf{LXMERT}~\cite{lxmert}, one of the best models on the dataset, with a $72.5\%$ test accuracy. \subsection{Research Questions and Results} \input{tables/synth} \input{tables/relia} \subsubsection{\textbf{RQ1:} Can \textsc{DIME}\ reliably disentangle a model into unimodal contributions and multimodal interactions and generate accurate explanations for both UC and MI in practice?} \label{rq1} \ In section~\ref{sec:proof}, we have theoretically shown that \textsc{DIME}\ can disentangle a model into unimodal contributions and multimodal interactions. To show that this also holds in practice (when expectation computations are replaced by sampling), we will run \textsc{DIME}\ on our trained model $M$ using $1,000$ randomly selected datapoints in the test split of our synthetic dataset $D$, on label $1$ (i.e., that the sum of all elements of both vectors plus the dot-product of the two vectors are positive). For each point $(d_1,d_2)$ in $D$, since we are classifying whether the sum of all elements in $d_1$ and $d_2$ as well as the dot product of $d_1$ and $d_2$, the ground truth UC explanation on each modality will be $d_1$ and $d_2$ respectively, and the ground truth MI explanation will be element-wise product $d_1*d_2$. Therefore, for each generated explanation on input data $(d_1,d_2)$, we will compute the Pearson Correlation between the explanation weights of the $10$ features with the values of the $10$ features of $d_1$, the values of the $10$ features of $d_2$, and the $10$ features in the element-wise product of $d_1$ and $d_2$. In addition to \textsc{DIME}, we also run LIME under the same settings as an ablation and compute average correlations. The results are shown in Table~\ref{tab:synth}. We found that within each datapoint ($d_1$,$d_2$), there is a strong correlation between each \textsc{DIME}-generated unimodal explanation ($\textsc{UC}_1, \textsc{UC}_2$) and the corresponding ground truth UC explanation, but there is neither correlation between $\textsc{UC}_1$/$\textsc{UC}_2$ and ground truth UC explanation of a different modality, nor correlation between $\textsc{UC}_1$/$\textsc{UC}_2$ and ground truth multimodal interaction explanations. This shows that \textsc{DIME}-generated UC explanations indeed capture unimodal contributions only. Moreover, we found that both \textsc{DIME}-generated multimodal interaction explanations ($\textsc{MI}_1, \textsc{MI}_2$) indeed correlate with the ground truth MI explanation, but not with either ground truth UC explanation. This shows that \textsc{DIME}-generated multimodal interaction explanation indeed captures explanations on just the multimodal interactions (i.e., the dot-product), and not any of the unimodal contributions. Meanwhile, running the original LIME on either modality just gives an explanation that weakly correlates with ground truth unimodal contributions and multimodal interactions, so the original LIME without disentangling is unable to give an accurate explanation of either unimodal contributions or multimodal interactions. In addition to using a synthetic dataset, we show that \textsc{DIME}\ can also disentangle more complex models on multimodal tasks, such as MDETR on CLEVR and LXMERT on VQA (the latter model is far from perfect in performance). As a measure of disentanglement, we check how \textsc{DIME}-generated explanations would be different given the same image but different questions. From each dataset, we randomly select $100$ points and generate their \textsc{DIME}\ explanations on the correct label. Then, for each point, we swap out the question with another different question on the same image and generate their \textsc{DIME}\ explanations on the same label (i.e., correct label before the swap). We compute cosine distance between the explanation weights from $\textsc{UC}_V$ before/after the swap, as well as cosine distance between the weights from $\textsc{MI}_V$ before/after the swap, and report average cosine distances on each dataset in Table~\ref{tab:relia}. We can see that swapping text has almost no effect on $\textsc{UC}_V$ but affects $\textsc{MI}_V$ significantly. Therefore, \textsc{DIME}\ is able to correctly disentangle a model into unimodal contributions and multimodal interaction for more complex models and tasks. \subsubsection{\textbf{RQ2:} Can \textsc{DIME}\ help researchers gain additional insight in whether unimodal contributions or multimodal interactions are the dominant factors behind a model's prediction?} \label{rq2} \ Disentangling the model into UC and MI and generating visualizations for each should provide additional insights into whether UC or MI is the main factor in the model's prediction. In the following experiments, we show that \textsc{DIME}\ can uncover which factor is dominant in a model's prediction process both across all points in the dataset (``global'') and on each individual datapoint (``local''). \textbf{Global interpretation:} CLEVR dataset is designed to force multimodal interactions, and MDETR has a $99.7\%$ accuracy on CLEVR, so we expect that MDETR will be heavily reliant on multimodal interactions. To verify this, we run \textsc{DIME}\ on MDETR for $100$ randomly sampled datapoints from the validation split of CLEVR, and compute the average absolute weight of the top-5 features in \textsc{DIME}\ explanations. As shown in Table~\ref{tab:weight}, the $\textsc{MI}_V$ and $MV_T$ weights are indeed significantly larger than $\textsc{UC}_V$ and $\textsc{UC}_T$ weights. Note that unimodal text does still give some useful information in CLEVR, such as the answer type (yes/no, attribute, or number), so that explains why $\textsc{UC}_T$ still has a weight of about $60\%$ that of $\textsc{MI}_T$. The average weight for $\textsc{MI}_V$, however, is over $4$ times higher than $\textsc{UC}_V$. Therefore, using \textsc{DIME}, we confirmed that MDETR indeed relies mostly on multimodal interactions to solve the task. \input{tables/weight} \textbf{Local interpretation:} In most datasets and models, models will not be near-perfect, and they will have different dominating factors from datapoint to datapoint. In this case, a global analysis will not suffice, and it will be necessary to look into which factor contributes more to the model's prediction on individual datapoints. We perform the following experiment to show that \textsc{DIME}\ can help users determine whether a model makes a prediction on a datapoint where (1) unimodal text is dominant, (2) unimodal image is dominant, (3) multimodal interactions are dominant, and (4) both UC and MI have significant contributions to the answer. We will use LXMERT on VQA since LXMERT is not close to perfect and often relies on different factors when predicting different datapoints. We gave five human annotators (who have some background knowledge in machine learning but do not have any knowledge about \textsc{DIME}) the same set of $52$ datapoints from VQA, as well as the prediction from LXMERT. For each datapoint, each human annotator is first given the LIME explanations without disentanglement as a baseline, and they are asked to categorize this point into one of the four categories above, while also rating how confident they are on their decision on a scale from one (least confident) to five (most confident). The human annotators are then presented with \textsc{DIME}\ explanations, and again they are asked to categorize each point as well as rate their confidence. The results are shown in Table~\ref{tab:newanno}. We can see that human annotators have significantly higher average confidence scores when presented with \textsc{DIME}\ explanations as compared to the baseline. Moreover, \textsc{DIME}\ result shows significantly higher Krippendorff's alpha score~\cite{krippendorff2011computing}, which measures inter-annotator agreements, so annotators also tend to agree a lot more on their categorizations. Therefore, \textsc{DIME}\ is able to help researchers more confidently determine whether UC or MI (or both) is the dominant factor behind the model's prediction, and thus help researchers gain additional insight into model behavior. \input{tables/anno} \subsubsection{\textbf{RQ3}: Can \textsc{DIME}\ help us better assess the qualities of the model and gain insights on how to debug or improve model performance?} \label{rq3} \ When trying to debug or improve a model on a task involving challenging reasoning, such as VQA, one important question researchers often ask is: do we know if our model actually learns to do the task ``the intended way'' (i.e., go through the same logical reasoning process as a human would to perform the task)? How often does our model perform as intended? Therefore, we conduct the following experiment to show that \textsc{DIME}\ may help answer this question. We use \textsc{DIME}\ explanations to categorize the model's behavior on each datapoint into one of the following categories: When the model answers correctly, \begin{itemize} \item (1) The model fully identifies the necessary parts of the image to answer the question logically through MI. \item (2) The model only partially identifies the parts of the image that are necessary to answer the question logically through MI and got it right with help of unimodal contributions. \item (3) The model did not correctly identify any of the parts of the image that are necessary to answer the question logically through MI. It got it right purely by unimodal contributions or by chance. \end{itemize} And when the model answers incorrectly, \begin{itemize} \item (4) The model fully identifies the necessary parts of the image to answer the question logically through MI, but still gets the answer wrong because the model does not fully understand a concept or because the question is too difficult (even for a human being). \item (5) The model only partially identifies the parts of the image that are necessary to answer the question logically through MI, thus missing some of the key parts of the image resulting in an incorrect answer. \item (6) The model did not correctly identify any of the parts of the image that are necessary to answer the question logically through MI, and thus the model fails to answer the question correctly. \end{itemize} In Figure~\ref{fig:veryinterestingexamples}, we show examples of datapoints, model predictions, and explanations that were annotated into each of the above categories. As shown in the examples, in most cases, there will be enough evidence to categorize a datapoint just by looking at the multimodal interaction explanations from the image side ($\textsc{MI}_V$), but sometimes other \textsc{DIME}\ explanations (e.g., explanations of text interactions) will be needed to gain additional understanding of the model's decision-making process. \input{tables/vqa} The results of this human study are shown in Table~\ref{tab:vqa}. With \textsc{DIME}, we were able to categorize $118$ points with evidence, out of a total of $140$ points $(84\%)$. This shows that \textsc{DIME}\ is able to highlight which input features are aligned or recognized by MI. We observe that, even though the models can fully identify the correct parts of the image that are relevant to the questions half of the time $(69/118)$, there is still a significant portion of datapoints where the model correctly aligns text and image but relies on unimodal contributions instead. This highlights several shortcomings of the model's decision-making process despite answering the question correctly. Therefore, the information gained from performing \textsc{DIME}\ can help researchers identify weaknesses in their models and debug or improve these models accordingly. \begin{figure*} \vspace{2mm} \includegraphics[width=1.0\textwidth]{figs/newfig6.pdf} \caption{Here we present examples of using \textsc{DIME}\ to categorize and explain why LXMERT makes certain predictions on datapoints in VQA 2.0. We present one example from each category. In most cases, only looking at the multimodal interaction explanations from the image side ($\textsc{MI}_V$) is sufficient to explain and categorize the model, but in certain cases, additional information from $\textsc{UC}_V$, $\textsc{UC}_T$, or $\textsc{MI}_T$ is needed as well. \textsc{DIME}\ enables researchers to gain understanding of the model's decision-making process which presents a step towards debugging and improving these models.} \label{fig:veryinterestingexamples} \end{figure*} We also observe that the model is more likely to not be able to fully identify the correct regions of the image when the model makes the wrong prediction, which is expected. In addition, we also found the following interesting observations when looking at the \textsc{DIME}\ explanations of the $118$ points: \begin{itemize} \item LXMERT often relies too heavily on unimodal text contributions: for example, in a question involving ``car'', unimodal contributions in text will prompt the model to answer ``street'' even if the model is unable to find ``street'' in the image. Sometimes, even when the model is able to interactively identify the correct regions of the image, unimodal text contributions can still dominate over the multimodal interaction (such as the fourth example in Figure~\ref{fig:veryinterestingexamples}, where the model answered ``glove'' due to unimodal text contributions even though the model was able to interactively identify the bat). \item The model sometimes interactively identifies the wrong object that happens to share the same properties in question as the correct object (such as the third example in Figure~\ref{fig:veryinterestingexamples}, where instead of the dog's paws, the model identified the nearby cat which also happens to be white). This coincidence happens more often than we expected, as there are $8$ such cases amongst the $118$ examples $(7\%)$. \item When asked about the color of an object that has two colors, LXMERT will only pick out one of the colors. \textsc{DIME}\ analysis shows that this is often due to LXMERT only identifying subregions of the object in one color while ignoring other parts of the object that are in a different color. For example, in Figure~\ref{fig:hydrant}, the model thinks that the hydrant is not ``silver and red'' because it did not classify the red tip as part of the hydrant. \end{itemize} These additional observations may guide future research in improving LXMERT (and other similar models) or designing inductive biases to avoid these undesirable behaviors. \begin{figure} \centering \vspace{2mm} \includegraphics[width=0.44\textwidth]{figs/hydrant.pdf} \caption{In this example, the model was unable to answer correctly because it did not recognize the red part in the image as part of the hydrant. As shown by the $\textsc{MI}_V$ explanation, the model actually thought that the red part is ``against'' the answer ``silver and red'', which means the model thought the red region isn't a part of the hydrant.} \label{fig:hydrant} \end{figure} \subsection{Limitations and Future Directions} \label{limit} Despite the ability of \textsc{DIME}\ in interpreting and debugging multimodal models, there remain several directions for future work: \textbf{1. Models with discrete outputs:} Even though \textsc{DIME}\ is designed to work for any black-box classification models, it requires the model to produce a continuous logit for each answer choice. \textsc{DIME}\ does not work well on the Neural-Symbolic VQA model~\cite{Mao2019NeuroSymbolic} since it only produces one discrete output instead of a continuous logit. Even when we tried to convert its outputs to logits by assigning its answer a logit of 1 and all other answer choices a logit of $-1$, \textsc{DIME}\ often fails to produce any meaningful explanation since the perturbations are unable to change the discrete answer of the model, thus having no effect on the assigned logits. \textbf{2. Number of modalities:} In all experiments, \textsc{DIME}\ was applied to tasks with 2 modalities. Disentangling a model across even 3 modalities can be very costly, as we will need to run the model $N^3$ times to compute unimodal contributions. Another challenge lies in interpreting the multimodal interaction, which would consist of bi-modal interactions between each pair of modalities as well as tri-modal interactions across all 3 modalities. Future work should tackle these challenges and try to expand \textsc{DIME}\ for high-modality scenarios. \textbf{3. Diverse modalities:} Even though the disentangling method in \textsc{DIME}\ theoretically works on any modality, our experiments have focused on image+text datasets (except the synthetic dataset experiment). This is because LIME-generated visualized explanations are relatively intuitive on image and text; it can be much harder for a human annotator to look at the results of explanations on other modalities (such as time-series of vectors) and try to make sense of them. In the future, we would like to design additional experiments to show that \textsc{DIME}\ can also be used to gain additional insight on model behavior in tasks involving modalities other than image and text as well. \textbf{4. Using these insights to improve models:} Since \textsc{DIME}\ is able to reveal several hidden undesirable behaviors in multimodal models, future work should aim to propose targeted solutions to these highlighted biases as a step towards improving multimodal models. For example, according to insights gained on VQA in RQ3, LXMERT can be improved by encouraging less reliance on unimodal text contribution, where insights from~\citet{cadene2019rubi} (which studies this research question for non-pretrained models) could be useful. Furthermore, future work could also design new training objectives which penalize models that associate wrong objects with words in MI, despite getting the correct answer. \section{Conclusion} In conclusion, \textsc{DIME}\ presents a new way to help users understand multimodal models by disentanglement into unimodal contributions and multimodal interactions before generating visual explanations for each. \textsc{DIME}\ can generate accurate disentangled explanations, help researchers and developers gain a deeper understanding of model behavior, and presents a step towards debugging and improving these models. We hope that \textsc{DIME}\ inspires the design of multimodal models that are more trustworthy, reliable, and robust for real-world applications. \section*{Acknowledgements} This material is based upon work partially supported by the National Science Foundation (Awards \#1722822 and \#1750439) and National Institutes of Health (Awards \#R01MH125740, \#R01MH096951, and \#U01MH116925). PPL is partially supported by a Facebook PhD Fellowship and a Carnegie Mellon University's Center for Machine Learning and Health Fellowship. RS is partially supported by NSF IIS1763562 and ONR Grant N000141812861. Any opinions, findings, conclusions, or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation, National Institutes of Health, Facebook, Carnegie Mellon University's Center for Machine Learning and Health, or Office of Naval Research, and no official endorsement should be inferred. We are extremely grateful to Gunjan Chhablani, Martin Ma, Chaitanya Ahuja, Volkan Cirik, Peter Wu, Amir Zadeh, Alex Wilf, Victoria Lin, Dong Won Lee, and Torsten W\"{o}rtwein for helpful discussions and feedback on initial versions of this paper. Finally, we would also like to acknowledge NVIDIA's GPU support.
{'timestamp': '2022-03-07T02:03:21', 'yymm': '2203', 'arxiv_id': '2203.02013', 'language': 'en', 'url': 'https://arxiv.org/abs/2203.02013'}
arxiv
\section{Introduction} \label{introduction} Neural network pruning has become an essential tool to reduce the size of modern-day neural networks. Small-sized networks are important for faster inference and many real-world tasks, for example, deployment on edge devices. With scaling model parameters becoming a popular way to scale performance, model sizes are becoming huge and an increasing cost to the environment \cite{strubell2019energy}. Neural network compression and neural network pruning in particular, has therefore, seen a lot of new work in the last few years. This has also coincided with the insight by Han et al. in 2015 \cite{han2015learning}, that neural networks can be pruned to a significantly large extent without a drop in accuracy. New methods have utilized a myriad of pruning techniques consisting of gradient-based methods, sensitivity to or feedback from an objective function, distance or similarity measures, regularization-based techniques, amongst others. The state-of-the-art (SOTA) pruning techniques use complex rules like iterative pruning and re-growth of weight parameters using heuristics rules every few hundred iterations for DSR \cite{ICML-2019-MostafaW}. SM \cite{sparse_momentum} uses sparse momentum that uses exponentially smoothed gradients (momentum) to find layers and weights that reduce error and then redistribute the pruned weights across layers using the mean momentum magnitude of each layer. For each layer, sparse momentum grows the weights using the momentum magnitude of zero-valued weights. Another popular SOTA technique, RigL \cite{pmlr-v119-evci20a}, also works by iteratively pruning and re-growing weights every few iterations. They use either uniform or Erdos-Renyi-Kernel (ERK) for pruning connections and re-grow connections based on the highest magnitude gradients. Among the most recent techniques, DPF \cite{Lin2020Dynamic} uses dynamic allocation of the sparsity pattern and incorporates a feedback signal to re-activate prematurely pruned weights, while STR \cite{pmlr-v119-kusupati20a} utilises Soft Threshold Reparameterization and uses back-propagation to find sparsity ratios for each layer. Despite the high number of new pruning algorithms proposed, the tangible benefits of many of them are still questionable. For instance, recently it has been shown that many pruning at initialization (PAI) schemes do not perform as well as expected \cite{frankle2021pruning}. In that paper, it is shown through a number of experiments that these PAI schemes are actually no better than random pruning, which is one of the most naive pruning baselines with no complexity involved. Similarly, in this paper, we bring attention to the trend of proposing increasingly complex pruning algorithms and question whether such complexity is really required to achieve superior results. We benchmark popular state-of-the-art (SOTA) pruning techniques against a naive pruning baseline, namely, Global Magnitude Pruning (Global MP). Global MP ranks all the weights in a neural network by their magnitudes and then prunes off the smallest ones (Fig.~\ref{fig:workflow}). Thus, in its vanilla form, it is a very simple pruning technique and contrasts sharply with the rest of the algorithms in the literature in terms of complexity. Despite its simplicity, Global MP has not been comprehensively analyzed and evaluated in the literature. Although, some prior works have used Global MP as a baseline \cite{frankle2018lottery, NEURIPS2019_a4613e8d, blalock2020state, NEURIPS2020_46a4378f, Renda2020Comparing, lee2021layeradaptive}, they missed out on conducting rigorous experiments with it; for example, in settings of both gradual and one-shot pruning or comparing it with SOTA. Similarly, many SOTA papers do not use Global MP for benchmarking and miss out on capturing its remarkable performance \cite{pmlr-v119-evci20a, pmlr-v119-kusupati20a, Zhu2018ToPO, gale2019state, DNW}. We bridge this gap in evaluating the efficacy of Global MP under multiple experimental conditions and demonstrate its superior performance. In this paper, we show that naive Global MP surpasses the other pruning techniques and sets a new SOTA result for ImageNet experiments. This performance is also valid across different datasets, neural network models, and target sparsity levels. While achieving such performance, Global MP does not require any additional algorithm-specific hyper-parameters to be tuned. Unlike many pruning techniques in the literature, it is very straightforward to implement. We conduct experiments with Global MP in both one-shot and gradual settings, and find that Global MP in a gradual fashion helps to increase the FLOPs sparsity even further, without compromising accuracy. Aside to its benefits, we also shed light into a potential problem with Global MP, known as layer-collapse, whereby an entire layer is pruned away, leading to a drastic loss in accuracy. In fact, this is a long-standing issue for many pruning algorithms in the literature, but the fix for it in Global MP is rather simple through introducing a minimum threshold to retain a minimum number of weights in every layer, while it is likely to be more complicated in other algorithms. We conduct experiments on WRN-28-8, ResNet-32, ResNet-50, MobileNet-V1, and FastGRNN models, and on CIFAR-10, ImageNet, and HAR-2 datasets. We test Global MP for both unstructured and structured as well as one-shot and gradual settings, and share our findings. \begin{figure*}[!h] \centering \includegraphics[trim=0cm 5.5cm 0cm 8cm,clip,width=\textwidth]{Figures/GlobalMPv4.pdf} \caption{Illustration of how Global MP works. Global MP ranks all the weights in a network by their magnitudes and prunes off the smallest weights until the target sparsity is met. Light green weights refer to the smaller-magnitude weights which are pruned off. A pruned network consisting of larger-magnitude weights (dark green weights) is obtained after the process.} \label{fig:workflow} \end{figure*} \section{Related Work} \label{related_work} Compression of neural networks has become an important research area due to the rapid increase in size of neural networks \cite{brown2020language}, the need for fast inference \cite{camci2020deep}, application to real-world tasks \cite{9516010, 8818358, 8756206, Liu2021ARA, 8693518} and concerns about the carbon footprint of training large neural networks \cite{strubell2019energy}. Over the years, several compression techniques have emerged in the literature \cite{cheng2017survey, 9478787}, such as quantisation, factorisation, attention, knowledge distillation, architecture search and pruning \cite{almahairi2016dynamic,ashok2017n2n,i2016squeezenet,pham2018efficient}. Quantisation techniques which restrict the bitwidth of parameters \cite{Rastegari_2016,courbariaux2016binarized} and tensor factorisation and decomposition which aim to break large kernels into smaller components \cite{mathieu2013fast,gong2014compressing,lebedev2014speedingup,Masana_2017} are popular methods. However, they need to be optimised for specific architectures. Attention networks \cite{almahairi2016dynamic} have two separate networks to focus on only a small patch of the input image. Training smaller student networks in a process called knowledge distillation \cite{ashok2017n2n, 9461003} has also proved effective, although it can potentially require a large training budget. Architecture search techniques, such as new kernel design \cite{i2016squeezenet} or whole architecture design \cite{pmlr-v80-pham18a,Tan_2019} have also become popular. Nevertheless, the large search space size requires ample computational resources to do the architecture search. Different from all these approaches, we focus on pruning deep neural networks in this work. As compared to other categories, pruning is more general in nature and has shown strong performance \cite{gale2019state}. Many pruning techniques have been developed over the years, which use first or second order derivatives \cite{NIPS1989_250,NIPS1992_647}, gradient based methods \cite{lee2018snip, Wang2020Picking}, sensitivity to or feedback from some objective function \cite{Lin2020Dynamic, molchanov2016pruning, LIU2020Dynamic, jorge2021progressive, 9097925}, distance or similarity measures \cite{Srinivas_2015}, regularization-based techniques \cite{pmlr-v119-kusupati20a, ContinuousSparsification2020, wang2021neural, 9398648}, and magnitude-based criterion \cite{pmlr-v119-evci20a, lee2021layeradaptive, Zhu2018ToPO, Strom97sparseconnection, Park2020LookaheadAF}. A key trick has been discovered in \cite{han2015learning} to iteratively prune and retrain a network, thereby preserving high accuracy. Runtime Neural Pruning \cite{NIPS2017_6813} attempts to use reinforcement learning (RL) for compression by training an RL agent to select smaller sub-networks during inference. \cite{he2018amc} design the first approach using RL for pruning. However, RL training approaches typically require additional RL training budgets and careful RL action and state space design \cite{gupta2020learning, qlp}. Global Magnitude Pruning (Global MP) on the other hand works by ranking all the parameters in a network by their absolute magnitudes and then pruning the smallest ones. It is therefore, quite intuitive, logical and straightforward to implement. It is also not to be confused with methods utilizing Global Pruning but not conducting magnitude pruning, for example, SNIP \cite{lee2018snip}. Many methods can do Global Pruning but they cannot be called Global MP because they do not conduct magnitude-based pruning. Some prior works have utilised Global MP but have missed out on rigorously benchmarking it, for example in settings of both gradual and one-shot pruning, and have also not compared it to SOTA algorithms \cite{frankle2018lottery, NEURIPS2019_a4613e8d, blalock2020state, NEURIPS2020_46a4378f, Renda2020Comparing, lee2021layeradaptive}. Also, many SOTA algorithms miss out on benchmarking their algorithms against Global MP and hence are unable to capture its efficacy \cite{pmlr-v119-evci20a, pmlr-v119-kusupati20a, Zhu2018ToPO, gale2019state, DNW}. We conduct systematic experiments to bridge this gap and demonstrate its superior performance by evaluating its efficacy under multiple experimental conditions. \section{Method} \label{approach} In this section, we explain how Global MP works by describing its key components. We shed light into its practical details and implementation. We present a pseudocode to explain the algorithmic flow of Global MP (Algorithm~\ref{algo1} and Table~\ref{table:func_list}). We also introduce a simple thresholding mechanism, called \textit{Minimum Threshold (MT)}, to avoid the issue of layer-collapse at high sparsity levels. \subsection{Global Magnitude Pruning (Global MP)} \label{algo:gp} Global MP is a magnitude-based pruning approach, whereby weights larger than a certain threshold are kept, and weights smaller than the threshold are pruned across a neural network. The threshold is calculated based on the target sparsity rate and is not a hyper-parameter that needs to be tuned or learnt. Given a target sparsity rate $\kappa_{target}$, the threshold $t$ is simply calculated as the weight magnitude that serves as a separation point between the smallest $\kappa_{target}$ percent of weights and the rest, once all weights are sorted into an array based on their magnitude. Formally, for a calculated threshold $t$ and each individual weight $w$ in any layer, the new weight $w_{new}$ is defined as follows: \begin{equation} w_{new} = \begin{cases} 0 & |w| < t, \\ w & otherwise. \\ \end{cases} \end{equation} In Global MP, a single threshold is set for the entire network based on the target sparsity for the network. This is in contrast to layer-wise pruning, in which different threshold values have to be searched for each layer individually. In the case of uniform pruning on the other hand, a threshold for each layer needs to be calculated based on the sparsity target assigned to the layers uniformly across the network. In this aspect, Global MP is more efficient than layer-wise or uniform pruning because the threshold does not need to be searched or calculated for every layer individually. \subsection{Minimum Threshold (MT)} \label{algo:MT} The Minimum Threshold (MT) refers to the fixed number of weights that are preserved in every layer of the neural network post pruning. The MT is a scalar value that is fixed before the start of the pruning cycle. The weights in a layer are sorted by their magnitude and the largest MT number of weights are preserved. For instance, an MT of 500 implies that 500 of the largest weights in every layer need to be preserved post pruning. If a layer originally has a smaller number of weights than the MT number, then all the weights of that layer will be preserved. Therefore, MT is simple to apply and also computationally inexpensive. This corresponds to: \begin{equation} {\|W_l\|_0} \geq \begin{cases} \sigma & \text{if } m \geq \sigma_l, \\ m & \text{otherwise.} \\ \end{cases} \label{eq:MT} \end{equation} The term $W_l \in \mathbb{R}^{m}$ denotes the weight vector for layer $l$, $\sigma$ is the MT value in terms of the number of weights and ${\|W_l\|_0}$ indicates the number of non-zero elements in $W_l$. We explain in the below section how the actual pruning using MT is implemented. \begin{algorithm}[t!] \caption{Global MP} \label{algo1} \begin{algorithmic} \STATE{\textbf{Input:} $DNN_{init}$, pre-trained or untrained DNN} \STATE{\hspace{1.1cm}$\kappa_{target}$, target sparsity} \STATE{\hspace{1.1cm}$\sigma$, minimum threshold (MT)} \STATE{\hspace{1.1cm}$e_{total}$, total epochs} \STATE{\hspace{1.1cm}$isGradual$, gradual or one-shot} \STATE{\hspace{1.1cm}$isMT$, MT is applied or not} \STATE{\textbf{Output:} $DNN_{final}$, pruned and trained DNN} \vspace{0.35cm} \STATE{$e = 0$} \STATE{$DNN(w_e)$ = $DNN_{init}$} \WHILE{$e < e_{total}$} \IF{$\kappa_{DNN(w_e)} < \kappa_{target}$} \STATE{$t_e$ $\leftarrow$ $CalcThreshold(e, \kappa_{target}, isGradual)$} \IF{$isMT$} \STATE{$DNN(w_{e'}) \hspace{0.1cm} \leftarrow Mask(DNN(w_e), t_e)$} \STATE{$W \hspace{1.43cm} \leftarrow MTcheck(DNN(w_{e'}), \sigma)$} \STATE{$DNN(w_{e^+}) \leftarrow MTprune(DNN(w_{e'}), W)$} \ELSE \STATE{$DNN(w_{e^+}) \leftarrow Prune(DNN(w_e), t_e)$} \ENDIF \ELSE \STATE{$DNN(w_{e^+}) = DNN(w_e)$} \ENDIF \STATE{$DNN(w_{e^{++}}) \leftarrow BackProp(DNN(w_{e^+}))$} \STATE{$DNN(w_e) = DNN(w_{e^{++}})$} \STATE{$e = e+1$} \ENDWHILE \STATE{$DNN_{final}$ = $DNN(w_e)$} \end{algorithmic} \end{algorithm} \begin{table}[t!] \caption{Function explanations for Algorithm 1.} \label{table:func_list} \centering \begin{tabular}{rl} \hline\noalign{\smallskip} \textbf{Function} & \textbf{Explanation} \\ \noalign{\smallskip}\hline\noalign{\smallskip} \multirow{4}{*}{$CalcThreshold()$:} & Calculates the magnitude threshold below which \\ & the weights are to be pruned. Assigns all pruning \\ & budget in one epoch or distributes it to epochs \\ & based on $isGradual$. \\ \noalign{\smallskip} \multirow{2}{*}{$Mask()$:} & Identifies the weights to be pruned without \\ & actually pruning them. \\ \noalign{\smallskip} \multirow{3}{*}{$MTcheck()$:} & Checks the layers that violate the MT condition \\ & and returns a new mask by distributing \\ & the pruning budget among other layers. \\ \noalign{\smallskip} \multirow{2}{*}{$MTprune()$:} & Prunes based on the mask returned by \\ & $MTcheck()$. \\ \noalign{\smallskip} $Prune()$: & Prunes based on a threshold. \\ \noalign{\smallskip} $BackProp()$: & Conducts a single back-propagation for training. \\ \hline \vspace{-1cm} \end{tabular} \end{table} \subsection{The Pruning Workflow} The pruning pipeline for Global MP is specified in Algorithm \ref{algo1}. It consists of taking a starting model, pruning it until the desired sparsity target is met and training or fine-tuning it for the specified number of epochs. It supports both one-shot and gradual pruning settings as well as with or without MT. The users may choose any pruning setting as per their use-case. The procedure starts by first taking a pre-trained model for the case of one-shot pruning or untrained model for the case of gradual pruning. Next, the sparsity of the model is checked and if the sparsity is lower than the target sparsity, then the model is pruned using either vanilla Global MP or Global MP with MT, as per the choice of the user. Once, the model is pruned then it is trained for the case of gradual pruning or fine-tuned for the case of one-shot pruning. The above procedure repeats until the final epoch is reached. For the case of one-shot pruning, the later epochs are just used for doing fine-tuning as the pruning happens in one-go in the first epoch itself. This finishes the procedure and the final result is a pruned and trained (or fine-tuned) model. \section{Experiments} \label{Results} Below we describe experiments related to Global Magnitude Pruning (Global MP) compared to state-of-the-art (SOTA) pruning algorithms. We conduct experiments on well-known image classification datasets, such as CIFAR-10 and ImageNet. We also include a human activity recognition dataset (HAR-2) to demonstrate generalization to other domains. We report hyper-parameters and training-related information for all the experiments in supplementary materials (Section A). \subsection{Comparison with SOTA} We compare Global MP with various popular SOTA algorithms that are well known for pruning including SNIP \cite{lee2018snip}, SM \cite{sparse_momentum}, DSR \cite{ICML-2019-MostafaW}, DPF \cite{Lin2020Dynamic}, GMP \cite{Zhu2018ToPO}, DNW \cite{DNW}, RigL \cite{pmlr-v119-evci20a}, and STR \cite{pmlr-v119-kusupati20a}. These include a broad spectrum of methods involving iteratively pruning and re-growing weights every few iterations, pruning at initialization, using gradients and feedback signals for pruning and pruning using regularization. We report results from these algorithms whenever they report results for the specific dataset that is being experimented upon. We report performance on weight sparsity (i.e., the number of parameters pruned) vs. accuracy, the default metric reported by all pruning papers, for all our experiments. \subsubsection{CIFAR-10} \label{sota_cifar10} We conduct experiments to compare Global MP to SOTA pruning algorithms on the CIFAR-10 dataset, which features 60,000 tiny, 32$\times$32-sized RGB images with 10 classes. It is a commonly used dataset for benchmarking DNN pruning algorithms. We compare Global MP with various algorithms including SNIP \cite{lee2018snip}, SM \cite{sparse_momentum}, DSR \cite{ICML-2019-MostafaW}, and DPF \cite{Lin2020Dynamic}. We report results on two popular and widely pruned network architectures, namely, WideResNet-28-8 (WRN-28-8) and ResNet-32 \cite{DBLP:journals/corr/HeZRS15}. For both architectures, we start off with the original model having the same initial accuracy as the other algorithms to have a fair comparison. Table~\ref{table:wrn-28-8_cifar_10} includes the results for WRN-28-8 experiments. As can be seen, Global MP performs better than the rest of the competitors at 90\% and 95\% sparsity levels. At 97.5\% sparsity level, Global MP is the second-best algorithm with a very small margin after a strong competitor DPF, which takes the second-best place in other two target sparsity levels. As for ResNet-32, since it is a smaller network with less redundancy, we conduct experiments only up to 95\% sparsity. Table \ref{table:resnet32_cifar10} depicts these results. Similar to the results in WRN-28-8, Global MP and DPF take the first two places at both 90\% and 95\% sparsity levels, while margins are being very small in between. This is an indication of the capabilities of Global MP as compared to the other algorithms, while featuring no added complexity. \begin{table}[t!] \small \centering \begin{tabular}{p{1.5cm}p{2.1cm}p{1.1cm}p{1.1cm}} \toprule \multirow{1}{*}{Method} & Top-1 Acc & Params & Sparsity\\ \midrule WRN-28-8 & 96.06\% & 23.3M\ & 0.0\%\\ \midrule SNIP & $95.49 \pm 0.21\%$ & 2.33M\ & 90\%\\ SM & $95.67 \pm 0.14\%$ & 2.33M\ & 90\%\\ DSR & $95.81 \pm 0.10\%$ & 2.33M\ & 90\%\\ \underline{DPF} & $\underline{96.08 \pm 0.15\%}$ & 2.33M\ & 90\%\\ \textbf{Global MP} & $\textbf{96.30} \pm \textbf{0.03\%}$ & 2.33M & 90\%\\ \midrule SNIP & $94.93 \pm 0.13\%$ & 1.17M\ & 95\%\\ SM & $95.64 \pm 0.07\%$ & 1.17M\ & 95\%\\ DSR & $95.55 \pm 0.12\%$ & 1.17M\ & 95\%\\ \underline{DPF} & $\underline{95.98 \pm 0.10\%}$ & 1.17M\ & 95\%\\ \textbf{Global MP} & $\textbf{96.16} \pm \textbf{0.02\%}$ & 1.17M\ & 95\%\\ \midrule SNIP & $94.11 \pm 0.19\%$ & 0.58M\ & 97.5\%\\ SM & $95.31 \pm 0.20\%$ & 0.58M\ & 97.5\%\\ DSR & $95.11 \pm 0.07\%$ & 0.58M\ & 97.5\%\\ \textbf{DPF} & $\textbf{95.84} \pm \textbf{0.04\%}$ & 0.58M\ & 97.5\%\\ \underline{Global MP} & $\underline{95.68 \pm 0.08\%}$ & 0.58M\ & 97.5\%\\ \bottomrule \end{tabular} \vspace{3pt} \captionof{table}{Results of SOTA pruning algorithms on WideResNet-28-8 on CIFAR-10. Global MP outperforms or yields comparable performance to other algorithms.} \label{table:wrn-28-8_cifar_10} \end{table} \begin{table}[t!] \vspace{0pt} \small \centering \begin{tabular}{p{1.5cm}p{2.3cm}p{1.1cm}p{1.1cm}} \toprule \multirow{1}{*}{Method} & Top-1 Acc & Params. & Sparsity\\ \midrule ResNet-32 & 93.83 $\pm$ 0.12 \% & 0.46M\ & 0.00\%\\ \midrule SNIP & 90.40 $\pm$ 0.26\% & 0.046M\ & 90\%\\ SM & 91.54 $\pm$ 0.18\% & 0.046M\ & 90\%\\ DSR & 91.41 $\pm$ 0.23\% & 0.046M\ & 90\%\\ \underline{DPF} & \underline{92.42 $\pm$ 0.18\%} & 0.046M\ & 90\%\\ \textbf{Global MP} & $\textbf{92.67} \pm \textbf{0.03\%}$ & 0.046M\ & 90\%\\ \midrule SNIP & 87.23 $\pm$ 0.29\% & 0.023M\ & 95\%\\ SM & 88.68 $\pm$ 0.22\% & 0.023M\ & 95\%\\ DSR & 84.12 $\pm$ 0.32\% & 0.023M\ & 95\%\\ \textbf{DPF} & \textbf{90.94 $\pm$ 0.35\%} & 0.023M\ & 95\%\\ \underline{Global MP} & \underline{90.65 $\pm$ 0.13\%} & 0.023M\ & 95\%\\ \bottomrule \end{tabular} \vspace{3pt} \captionof{table}{Results of pruning algorithms on ResNet-32 on CIFAR-10. Global MP outperforms or yields comparable performance to other algorithms.} \label{table:resnet32_cifar10} \end{table} \subsubsection{ImageNet} \label{sota_imagenet} Following the favorable performance on CIFAR-10 dataset, we benchmark Global MP against other competitors in the literature over ImageNet dataset, also known as ILSVRC 2012 dataset. This is a highly compelling dataset as compared to CIFAR-10, featuring around 1.3 million RGB images with 1,000 classes. In the pruning context, it typically serves as an ultimate benchmark and has been utilized by many other papers during comparison. Using this dataset, we compare Global MP with SOTA algorithms like GMP \cite{Zhu2018ToPO}, DSR \cite{ICML-2019-MostafaW}, DNW \cite{DNW}, SM \cite{sparse_momentum}, RigL \cite{pmlr-v119-evci20a}, DPF \cite{Lin2020Dynamic} and STR \cite{pmlr-v119-kusupati20a}. The two network architectures that we use for this comparison are ResNet-50 and MobileNet-V1 \cite{howard2017mobilenets}, the two most popular architectures for benchmarking on ImageNet \cite{blalock2020state}. We again start from the same initial accuracy for the non-pruned models for all algorithms, either by matching the results in their original papers or reproducing their results whenever their code is available. The remarkable performance of Global MP becomes clearly visible in ResNet-50 over ImageNet experiments. As can be seen from Table~\ref{table:resnet50_imagenet}, Global MP outperforms all the other competitors in every weight sparsity level from 80\% to 98\%. The first two places at each of these target sparsity levels belong to either the gradual version or the one-shot version of Global MP. Different from CIFAR-10 results, the performance margins that Global MP surpasses the others are also fairly high in ImageNet experiments. For instance, Global MP (Gradual) yields about 2\% higher accuracy at 95\% target sparsity level, while this number goes up to about 5\% at 98\% target sparsity level. This is an important finding that such a simple algorithm like Global MP can highly outperform other competitors that incorporates very complex design choices or computationally demanding procedures. \begin{table}[t!] \small \centering \begin{tabular}[t]{p{3cm}p{0.9cm}p{0.8cm}p{1cm}p{0.8cm}} \toprule \multirow{1}{*}{Method} & Top-1 Acc & Params & Sparsity & FLOPs pruned\\ \midrule ResNet-50 & 77.0\% & 25.6M\ & 0.00\% & 0.0\%\\ \midrule GMP & 75.60\% & 5.12M\ & 80.00\% & 80.0\%\\ DSR*\#\ & 71.60\% & 5.12M\ & 80.00\% & 69.9\%\\ DNW & 76.00\% & 5.12M\ & 80.00\% & 80.0\%\\ SM & 74.90\% & 5.12M\ & 80.00\% & -\\ SM + ERK & 75.20\% & 5.12M\ & 80.00\% & 58.9\%\\ RigL* & 74.60\% & 5.12M\ & 80.00\% & 77.5\%\\ RigL + ERK & 75.10\% & 5.12M\ & 80.00\% & 58.9\%\\ DPF & 75.13\% & 5.12M\ & 80.00\% & 80.0\%\\ STR & 76.19\% & 5.22M\ & 79.55\% & 81.3\%\\ \textbf{Global MP (One-shot)} & \textbf{76.84\%} & 5.12M & 80.00\% & 72.4\%\\ \underline{Global MP (Gradual)} & \underline{76.12\%} & 5.12M & 80.00\% & 76.7\%\\ \midrule GMP & 73.91\% & 2.56M\ & 90.00\% & 90.0\%\\ DNW & 74.00\% & 2.56M\ & 90.00\% & 90.0\%\\ SM & 72.90\% & 2.56M\ & 90.00\% & 60.1\%\\ SM + ERK & 72.90\% & 2.56M\ & 90.00\% & 76.5\%\\ RigL* & 72.00\% & 2.56M\ & 90.00\% & 87.4\%\\ RigL + ERK & 73.00\% & 2.56M\ & 90.00\% & 76.5\%\\ DPF\# & 74.55\% & 4.45M\ & 82.60\% & 90.0\%\\ STR & 74.73\% & 3.14M\ & 87.70\% & 90.2\%\\ \textbf{Global MP (One-shot)} & \textbf{75.28\%} & 2.56M & 90.00\% & 82.8\%\\ \underline{Global MP (Gradual)} & \underline{74.83\%} & 2.56M & 90.00\% & 87.8\%\\ \midrule GMP & 70.59\% & 1.28M\ & 95.00\% & 95.0\%\\ DNW & 68.30\% & 1.28M\ & 95.00\% & 95.0\%\\ RigL* & 67.50\% & 1.28M\ & 95.00\% & 92.2\%\\ RigL + ERK & 70.00\% & 1.28M\ & 95.00\% & 85.3\%\\ STR & 70.97\% & 1.33M\ & 94.80\% & 95.6\%\\ STR & 70.40\% & 1.27M\ & 95.03\% & 96.1\%\\ STR & 70.23\% & 1.24M\ & 95.15\% & 96.0\%\\ \underline{Global MP (One-shot)} & \underline{71.56\%} & 1.20M & 95.30\% & 89.3\%\\ \textbf{Global MP (Gradual)} & \textbf{72.14\%} & 1.20M & 95.30\% & 93.1\%\\ \midrule GMP & 57.90\% & 0.51M\ & 98.00\% & 98.0\%\\ DNW & 58.20\% & 0.51M\ & 98.00\% & 98.0\%\\ STR & 61.46\% & 0.50M & 98.05\% & 98.2\%\\ \underline{Global MP (One-shot)} & \underline{61.80}\% & 0.50M & 98.05\% & 93.7\%\\ \textbf{Global MP (Gradual)} & \textbf{66.57}\% & 0.50M & 98.05\% & 96.2\%\\ \bottomrule \end{tabular} \vspace{3pt} \captionof{table}{Results on ResNet-50 on ImageNet. Global MP outperforms SOTA pruning algorithms at all sparsity levels. * and \# imply the first and the last layer are dense, respectively.} \label{table:resnet50_imagenet} \end{table} \begin{figure}[t!] \begin{minipage}[t]{0.49\textwidth} \centering \includegraphics[trim={0 0 0 1.3cm}, clip, width=\textwidth]{Figures/ResNet50_results.pdf} \caption{Global MP surpasses all the unstructured pruning baselines at all sparsity ratios on ResNet-50 over ImageNet, showcasing that it is state-of-the-art for weight sparsity.} \label{fig:resnet50_sparsity} \end{minipage} \end{figure} We also test another architecture on ImageNet, MobileNet-V1, which is a much smaller and more efficient architecture than ResNet-50. In this case, strong competitors are limited in the literature; only two of the aforementioned algorithms are able to present competitive results due to the fact that this architecture has less redundancy. We benchmark Global MP with two other competitors at two target sparsity levels: 75\% and 90\%. As can be seen in Table~\ref{table:mobilenetv1_imagenet}, Global MP outperforms SOTA algorithms by a margin of more than 2\% at 75\% sparsity, which is a significant result given how compact the MobileNet-V1 is. At 90\% sparsity on the other hand, the same compactness causes Global MP to over-prune certain layers in the network, which result in a significant accuracy drop. This is the above-mentioned problem of layer-collapse, and it is easily rectified when MT is introduced to Global MP. We use an MT value of 0.2\% which is determined using the same search procedure as any other hyper-parameter. The accuracy of Global MP at 90\% sparsity goes beyond SOTA again with such a simple fix, and the accuracy margin to the next competitor gets higher than 2\%. MT comes at the cost of a less FLOPs reduction, but it is useful especially for accuracy-critical applications where decreasing the size of the network is still important. All these findings clearly indicates that Global MP is a simple yet competitive pruning algorithm. \begin{table}[t!] \centering \small \begin{tabular}{p{3cm}p{0.9cm}p{0.8cm}p{1cm}p{0.8cm}} \toprule \multirow{1}{*}{Method} & Top-1 Acc & Params. & Sparsity & FLOPs pruned\\ \midrule MobileNet-V1 & 71.95\% & 4.21M\ & 0.00\% & 0.0\%\\ \midrule GMP & 67.70\% & 1.09M\ & 74.11\% & 71.4\%\\ \underline{STR} & \underline{68.35\%} & 1.04M\ & 75.28\% & 82.2\%\\ \textbf{Global MP} & \textbf{70.74\%} & 1.04M & 75.28\% & 68.9\%\\ \midrule GMP & 61.80\% & 0.46M\ & 89.03\% & 85.6\%\\ STR & 61.51\% & 0.44M\ & 89.62\% & 93.0\%\\ \underline{Global MP} & \underline{59.49\%} &0.42M\ & 90.00\% & 83.7\%\\ \textbf{Global MP with MT} & \textbf{63.94\%} & 0.42M & 90.00\% & 72.9\%\\ \bottomrule \end{tabular} \captionof{table}{Results of pruning algorithms on MobileNet-V1 on ImageNet. Global MP with MT surpasses SOTA algorithms on weight sparsity.} \label{table:mobilenetv1_imagenet} \end{table} \subsection{Generalizing to other domains and RNN architectures} \label{rnn} We experiment with Global MP on other domains and non-convolutional networks as well to measure the generalizability of the algorithm on different domains and network types. We experiment on a FastGRNN model \cite{Kusupati2018FastGRNNAF} on the HAR-2 Human Activity Recognition dataset \cite{HAR}. HAR-2 dataset is a binarized version of the 6-class Human Activity Recognition dataset. From the full-rank model with $r_W = 9$ and $r_U = 80$ as suggested on the STR paper \cite{pmlr-v119-kusupati20a}, we apply Global MP on the matrices $W_1$ and $W_2$. To do this, we find the weight mask by ranking the columns of $W_1$ and $W_2$ based on their absolute sum, then we prune the $9 - r_W^{new}$ lowest columns and $80 - r_U^{new}$ lowest columns from $W_1$ and $W_2$ respectively. In the end, we fine-tune this pruned model by retraining it with FastGRNN's trainer and applying the weight mask at every epoch. We test Global MP under different network configurations. We find that Global MP surpasses the other baselines on all the configurations (Table \ref{table:fastgrnn_har2}) and successfully prunes the model on a very different architecture and domain. \subsection{Mitigating Layer-Collapse} \label{high_sparsity} Layer-collapse is an issue that many pruning algorithms run into \cite{NEURIPS2020_46a4378f, Lee2020A, hayou2021robust} and occurs when an entire layer is pruned by the pruning algorithm, rendering the network untrainable. We investigate this phenomena and find that the performance of a pruning algorithm can be substantially affected by the architecture of the neural network being pruned, especially in the high sparsity domain. We conduct experiments on MobileNet-V2 and WRN-22-8 models over the CIFAR-10 dataset. We report results averaged over multiple runs where each run uses a different pre-trained model to provide more robustness. We first prune a WRN-22-8 model to 99.9\% sparsity. We find that at 99.9\% sparsity, the WRN is still able to get decent accuracy (Table \ref{table:highsparsity_wrn}). We then prune a MobileNet-V2 model to 98\% sparsity. For the MobileNet, however, accuracy drops to 10\% using only Global MP, and the model is not able to learn (Table \ref{table:highsparsity_mnet}). \begin{figure*}[h!] \centering \includegraphics[trim=3cm 2.7cm 12cm 2cm,clip,width=0.7\textwidth]{Figures/architectures.pdf} \caption{Difference in architectures between WRN and MobileNet. WRN does not have any prunable residual connections in the last layers (dotted lines) while MobileNet does. This leads to different pruning behaviors on the two architectures.} \vspace*{-0.3cm} \label{fig:highsparsity_archs} \end{figure*} \begin{figure*}[h!] \centering \includegraphics[trim=1.5cm 11cm 1.5cm 11cm,clip,width=\textwidth]{Figures/MobileNetv2-remaining_weights_93.89.pdf} \vspace*{-0.9cm} \caption{For MobileNet-V2 at 98\% sparsity, MT helps retain some weights in the heavily pruned layers (Layers 55, 56, and 57) and allows the model to learn successfully.} \vspace*{-0.3cm} \label{fig:highsparsity_mnet} \end{figure*} \begin{figure*}[h!] \centering \includegraphics[trim=1.5cm 11cm 1.5cm 11cm,clip,width=\textwidth]{Figures/MobileNetv2-remaining_weights_3runs_GP.pdf} \vspace*{-0.9cm} \caption{Layer-wise pruning results produced by Global MP on MobileNet-V2 model on CIFAR-10. Pruning is conducted on three different pre-trained models and the pruning results across the three runs are very stable.} \vspace*{-0.3cm} \label{fig:highsparsity_mnet_gp} \end{figure*} The reason for this wide discrepancy in learning behavior lies in the shortcut connections \cite{DBLP:journals/corr/HeZRS15}. Both WRN-22-8 and MobileNet-V2 use shortcut connections, however, their placement is different. Referring to Fig. \ref{fig:highsparsity_archs}, WRN uses identity shortcut connections from Layer 20 to Layer 23. This type of shortcut connections are simple identity mappings and do not require any extra parameters, and hence, they do not count towards the weights. However, MobileNet-V2 uses a convolutional shortcut mapping from Layer 52 to Layer 57 and hence, it adds to the model's weights, and thus, it is prunable layer for the pruning algorithm. Global MP completely prunes the two preceding layers before the last layer. However, because WRN uses identity mappings, it is still able to relay information to the last layer, and the model is still able to learn, whereas MobileNet-V2 faces catastrophic accuracy drop due to layer-collapse. Pruning algorithms can be susceptible to such catastrophic layer-collapse issues especially in the high sparsity domain. The MT rule can help overcome this issue. Retaining a small MT of 0.02\% was sufficient for the MobileNet-V2 model to avoid layer-collapse and learn successfully. We provide layer-wise weight snapshot for the model, before and after applying MT, to illustrate what MT does (Fig. \ref{fig:highsparsity_mnet}). Hence, retaining a small amount of weights can help in the learning dynamics of models in high sparsity settings. \begin{table}[t!] \centering \small \begin{tabular}{p{2.6cm}p{1.45cm}p{0.5cm}p{0.5cm}} \toprule \multirow{1}{*}{Method} & Top-1 Acc & $r_W$ & $r_U$\\ \midrule FastGRNN & 96.10\% & 9\ & 80\\ \midrule Vanilla Training & 94.06\% & 9\ & 8\\ \underline{STR} & \underline{95.76\%} & 9\ & 8\\ \textbf{Global MP} & \textbf{95.89}\% & 9 & 8\\ \midrule Vanilla Training & 93.15\% & 9\ & 7\\ \underline{STR} & \underline{95.62\%} & 9\ & 7\\ \textbf{Global MP} & \textbf{95.72}\% & 9 & 7\\ \midrule Vanilla Training & 94.88\% & 8\ & 7\\ \underline{STR} & \underline{95.59\%} & 8\ & 7\\ \textbf{Global MP} & \textbf{95.62}\% & 8 & 7\\ \bottomrule \end{tabular} \captionof{table}{Results on FastGRNN on HAR-2 dataset. Global MP outperforms other pruning algorithms.} \label{table:fastgrnn_har2} \end{table} \begin{table}[t!] \small \begin{tabular}{p{1.5cm}p{0.8cm}p{2.2cm}p{2.2cm}} \toprule \multirow{2}{*}{Method} & \multicolumn{2}{c}{WRN-22-8 on CIFAR-10} \\ \cmidrule(lr){2-4} & Sparsity & Starting Acc. & Pruned Acc.\\ \midrule \textbf{Global MP} & 99.9\% & $94.07\% \pm 0.05\%$ & $\textbf{67.68\%} \pm \textbf{0.78\%}$ \\ \bottomrule \end{tabular} \captionof{table}{Performance of Global MP on WideResNet-22-8 in the high sparsity regime at 99.9\% sparsity.} \label{table:highsparsity_wrn} \end{table} \begin{table}[t!] \small \centering \begin{tabular}{m{1.5cm}m{0.7cm}m{2.2cm}m{2.2cm}} \toprule \multirow{2}{*}{Method} & \multicolumn{2}{c}{MobileNet-V2 on CIFAR-10} \\ \cmidrule(lr){2-4} & Sparsity & Starting Acc. & Pruned Acc.\\ \midrule Global MP & 98.0\% & $94.15\%\pm0.23\%$ & $10\%$ \textit{(Unable to learn)} \\ \textbf{Global MP with MT} & 98.0\% & $94.15\% \pm 0.23\%$ & $\textbf{82.97\%} \pm \textbf{0.57\%}$\\ \bottomrule \end{tabular} \captionof{table}{Adding MT enables the MobileNet-V2 model to learn in the high sparsity regime.} \label{table:highsparsity_mnet} \end{table} \section{Discussion, Limitations and Future Work} We have seen that Global MP works very well and achieves superior performance on all the datasets and architectures tested. It can work as a one-shot pruning algorithm or as a gradual pruning algorithm. It is very stable and produces similar pruning results across multiple runs and pre-trained models (Fig. \ref{fig:highsparsity_mnet_gp}). It also surpasses SOTA algorithms on ResNet-50 over ImageNet and sets the new SOTA results across many sparsity levels. At the same time, Global MP has very low algorithmic complexity and arguably is one of the simplest pruning algorithms. It is simpler than many other pruning algorithms like custom loss based regularization, RL-based procedures, heuristics-based layerwise pruning ratios, etc. It just ranks weights based on their magnitude and removes the smallest ones. This raises a key question on whether complexity is really required for pruning and if complex pruning algorithms have tangible advantages over naive baselines. According to our results, the advantages seem to be narrow. The only advantages maybe that while Global MP gets competitive FLOPs performance, some algorithms may have higher FLOPs sparsity, though at the cost of accuracy. Therefore, practitioners may opt for another algorithm to get SOTA FLOPs performance if the accuracy loss incurred is reasonable for their application. A limitation of Global MP is that the theoretical foundations for it have not been well-established yet. While empirically it gets superior performance, we still do not understand mathematically why this is the case. A richer understanding of the dynamics of Global MP can enable researchers to build upon it and further improve its performance, and it is an area for future work. Another area for future work is jointly optimizing both weights and FLOPs during the pruning process. Currently, Global MP is used to reach a certain parameter sparsity, and FLOPs reduction comes as a by-product. In the future, FLOPs can also be added to the optimization function to jointly sparsify both parameters and FLOPs. This can lead to further gains in the FLOPs performance of Global MP. \section{Conclusions} \label{conclusion} In this work, we raised the question of whether utilizing complex and computationally demanding algorithms are really required to achieve superior DNN pruning results. This stemmed from the hike in the number of new pruning algorithms proposed in the recent years, each with a marginal performance increment, though with complicated procedures, which makes it hard for a practitioner to select the correct algorithm and the best set of algorithm-specific hyper-parameters for their application. We benchmarked these algorithms against a naive baseline, namely, Global MP, which does not incorporate any complex procedure or any hard-to-tune hyper-parameter. Despite its simplicity, we found that Global MP outperforms many SOTA pruning algorithms over multiple datasets such as CIFAR-10, ImageNet and HAR-2; with different network architectures such as ResNet-50 and MobileNet-V1; and at various sparsity levels from 50\% up to 99.9\%. We also presented a few variants of Global MP, i.e., one-shot and gradual, together with a new, complementary technique, MT. We demonstrated that through the selection of an appropriate variant of Global MP, the performance at different metrics, i.e., accuracy vs. weight sparsity or accuracy vs. FLOPs sparsity, can be maximized. While our results serves as an empirical proof that a naive pruning algorithm like Global MP can achieve SOTA results, it remains as a promising future research direction to shed light into theoretical aspects of how such performance is possible with Global MP. Another future direction includes extending the capabilities of Global MP, such as jointly optimizing both FLOPs and the number of weights. \section{Acknowledgement} This research is supported by the Agency for Science, Technology and Research (A*STAR) under its AME Programmatic Funds (Project No: A1892b0026 and A19E3b0099). Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not reflect the views of the A*STAR. \subsection{Hyper-parameters and Experimental Setup} \label{hyperparams} No data augmentation is done apart from standard data pre-processing. Difference in batch size for training and testing in some experiments is due to GPU RAM availability. Averaged results are reported over three runs. \begin{table*}[h] \vspace{-1cm} \centering \small \begin{tabular}{p{2cm}p{2cm}p{2cm}} \toprule \multicolumn{3}{c}{MT Values} \\ \cmidrule(lr){1-3} Experiment & Sparsity & MT Value\\ \midrule Table 4 & 90\% & 0.2\% \\ \midrule Table 7 & 98\% & 0.02\% \\ \bottomrule \end{tabular} \label{table:MT_values} \end{table*} \begin{table*}[hbt!] \vspace{-0.2cm} \centering \small \begin{tabular}{lccccccc} \toprule \multicolumn{8}{c}{\centering{Setup for Table 2}} \\ \cmidrule(lr){1-8} \multirow{2}{*}{Stage} & \multirow{2}{*}{Epochs} & Batch & \multirow{2}{*}{Momentum} & Weight & Initial & LR & \multirow{2}{*}{Nesterov}\\ & & Size & & Decay & LR & Scheduler & \\ \midrule Training & 200 & 128 & 0.875 & 5e-4 & 0.1 & Cosine & Yes\\ Finetuning (GP 90\%) & 200 & 128 & 0.9 & 0 & 0.0512 & Cosine & Yes\\ Finetuning (GP 95\%) & 200 & 128 & 0.9 & 2e-5 & 0.0256 & Cosine & Yes\\ Finetuning (GP 97.5\%) & 200 & 128 & 0.9 & 0 & 0.0128 & Cosine & Yes\\ \bottomrule \end{tabular} \end{table*} \begin{table*}[hbt!] \vspace{-0.1cm} \centering \small \begin{tabular}{lccccccc} \toprule \multicolumn{8}{c}{\centering{Setup for Table 3}} \\ \cmidrule(lr){1-8} \multirow{2}{*}{Stage} & \multirow{2}{*}{Epochs} & Batch & \multirow{2}{*}{Momentum} & Weight & Initial & LR & \multirow{2}{*}{Nesterov}\\ & & Size & & Decay & LR & Scheduler & \\ \midrule Training & 300 & 128 & 0.9 & 0.001 & 0.05 & Cosine & No\\ Finetuning (GP 90\%) & 300 & 128 & 0.9 & 0.001 & 0.01 & Cosine & No\\ Finetuning (GP 95\%) & 300 & 128 & 0.9 & 1e-5 & 0.01 & Cosine & No\\ \bottomrule \end{tabular} \end{table*} \begin{table*}[hbt!] \vspace{-0.1cm} \centering \small \begin{tabular}{lccccccc} \toprule \multicolumn{8}{c}{\centering{Setup for Table 4}} \\ \cmidrule(lr){1-8} \multirow{2}{*}{Stage} & \multirow{2}{*}{Epochs} & Batch & \multirow{2}{*}{Momentum} & Weight & Initial & LR & Label\\ & & Size & & Decay & LR & Scheduler & Smoothing \\ \midrule Training & 100 & 256 & 0.875 & 0.000031 & 0.256 & Cosine (warmup = 5) & 0.1\\ One-shot GP 80\% & 100 & 256 & 0.875 & 0.000023 & 0.0256 & Cosine (warmup = 5) & 0.1\\ Gradual GP 80\% & 100 & 256 & 0.875 & 0.000031 & 0.256 & Cosine (warmup = 5) & 0.1\\ One-shot GP 90\% & 100 & 256 & 0.875 & 0.000007 & 0.1024 & Cosine (no warmup) & 0.1\\ Gradual GP 90\% & 100 & 256 & 0.875 & 0.000031 & 0.256 & Cosine (warmup = 5) & 0.1\\ One-shot GP 95.3\% & 100 & 256 & 0.95 & 0.0 & 0.0512 & Cosine (no warmup) & 0.05\\ Gradual GP 95.3\% & 100 & 256 & 0.875 & 0.000031 & 0.256 & Cosine (warmup = 5) & 0.1\\ One-shot GP 98.05\% & 100 & 256 & 0.95 & 0.0 & 0.0512 & Cosine (no warmup) & 0.05\\ Gradual GP 98.05\% & 100 & 256 & 0.875 & 0.000031 & 0.256 & Cosine (warmup = 5) & 0.1\\ \bottomrule \end{tabular} \end{table*} \begin{table*}[hbt!] \vspace{-0.1cm} \centering \small \begin{tabular}{lccccccc} \toprule \multicolumn{8}{c}{\centering{Setup for Table 5}} \\ \cmidrule(lr){1-8} \multirow{2}{*}{Stage} & \multirow{2}{*}{Epochs} & Batch & \multirow{2}{*}{Momentum} & Weight & Initial & LR & Label\\ & & Size & & Decay & LR & Scheduler & Smoothing \\ \midrule Training & 100 & 256 & 0.875 & 3.1e-5 & 0.256 & Cosine (warmup=5) & 0.1\\ Finetuning (GP 75\%) & 120 & 256 & 0.875 & 1e-5 & 0.0512 & Cosine (no warmup) & 0.1\\ Finetuning (GP 90\%) & 120 & 256 & 0.875 & 1e-5 & 0.0256 & Cosine (no warmup) & 0.1\\ Finetuning (GP + MT 90\%) & 120 & 256 & 0.875 & 0 & 0.0512 & Cosine (no warmup) & 0.1\\ \bottomrule \end{tabular} \end{table*} \begin{table*}[hbt!] \vspace{-0.1cm} \centering \small \begin{tabular}{lccccc} \toprule \multicolumn{6}{c}{\centering{Setup for Table 6}} \\ \cmidrule(lr){1-6} Stage & Epochs & Batch Size & Initial LR & hd & Optimizer \\ \midrule Training & 300 & 100 & 0.0064 & 80 & Adam\\ Finetuning (GP 9,8) & 300 & 64 & 0.5 & 80 & Adam\\ Finetuning (GP 9,7) & 300 & 100 & 0.5 & 80 & Adam\\ Finetuning (GP 8,7) & 300 & 100 & 0.55 & 80 & Adam\\ \bottomrule \end{tabular} \end{table*} \begin{table*}[hbt!] \vspace{-0.1cm} \centering \small \begin{tabular}{lccccccc} \toprule \multicolumn{8}{c}{\centering{Setup for Table 7}} \\ \cmidrule(lr){1-8} \multirow{2}{*}{Stage} & \multirow{2}{*}{Epochs} & Batch & \multirow{2}{*}{Momentum} & Weight & Initial & LR & \multirow{2}{*}{Nesterov}\\ & & Size & & Decay & LR & Scheduler & \\ \midrule Training & 30 & 256 & 0.9 & 5e-4 & 0.1 & Step decay (Step size 25, gamma 0.1) & Yes\\ Finetuning (GP 99.9\%) & 80 & 64 & 0.9 & 5e-4 & 0.1 & Step decay (Step size 40, gamma 0.1) & Yes\\ \bottomrule \end{tabular} \end{table*} \begin{table*}[t!] \centering \small \begin{tabular}{lccccccc} \toprule \multicolumn{8}{c}{\centering{Setup for Table 8}} \\ \cmidrule(lr){1-8} \multirow{2}{*}{Stage} & \multirow{2}{*}{Epochs} & Batch & \multirow{2}{*}{Momentum} & Weight & Initial & LR & \multirow{2}{*}{Nesterov}\\ & & Size & & Decay & LR & Scheduler & \\ \midrule Training & 200 & 450 & 0.9 & 5e-4 & 0.1 & Step decay (Step size 25, gamma 0.56) & Yes\\ Finetuning (GP 98\%) & 200 & 64 & 0.9 & 5e-4 & 0.1 & Step decay (Step size 25, gamma 0.56) & Yes\\ Finetuning (GP + MT 98\%) & 200 & 64 & 0.9 & 5e-4 & 0.1 & Step decay (Step size 25, gamma 0.56) & Yes\\ \bottomrule \end{tabular} \end{table*}
{'timestamp': '2022-09-30T02:09:47', 'yymm': '2209', 'arxiv_id': '2209.14624', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14624'}
arxiv
\section{Introduction} A polyp is a grossly visible mass of epithelial cells that protrudes from the mucosal surface into the lumen of the intestine. Most colon polyps are harmless. However, some colon polyps can develop into colon cancer over time, which is fatal when found in its late stages. Hence, it is essential to have regular screenings. Colonoscopy is one of the most common techniques used to detect colon polyps. With the recent success of deep learning, various image segmentation methods have been employed to help oncologists save significant time. However, deep learning models often require a large amount of labeled data. In real-world scenarios, this can be difficult, especially for medical data. Producing a labeled medical dataset for training semantic segmentation models requires the laborious creation of pixel-level labels and annotators' expertise and medical knowledge in medical image diagnosis. Semi-supervised learning is a method that utilizes a massive amount of unlabeled data for training deep neural networks on actual tasks. This method is significant with medical image data since the cost of labeling the data is often high and requires much effort from many experts. Many studies applied semi-supervised learning on medical image data, such as pseudo labeling \cite{wang2022semi}, cross pseudo supervision \cite{zhang2022semi}, few-shot learning \cite{li2021few}, deep adversarial learning, and so on. These methods use both labeled and unlabeled data to train deep learning models for the semantic segmentation task. Most of them aim to generate high-quality pseudo labels and have more robust representations of the domain distribution of the data. Previous works \cite{araslanov2021self} have shown the effectiveness of the momentum network - a slow copy version of the training model by taking an exponential moving average. Empirical results show that the momentum network often produces more stable results than the original model trained directly through the back-propagation process. In current semi-supervised learning methods, pseudo label generation can be done online as in \cite{araslanov2021self} or offline as in \cite{yang2020fda, zou2019confidence}. The advantage of online pseudo labeling is that it is simple and easy to implement with only one training stage. In addition, this method will be effective when the pseudo label generation model is updated online to help enhance the quality of pseudo labels after each iteration. This paper combines online pseudo labeling and momentum networks to improve the quality of pseudo labels generated after each iteration. This method improves Dice Score by 3\% compared with offline pseudo labeling and outperforms supervised models in some out-of-domain datasets. Our main contributions in this paper are: \begin{itemize} \item We propose a novel training strategy for semi-supervised learning which combines online pseudo labeling and momentum networks for the polyp segmentation task. Our results on Dice Score are about 3\% better than the offline pseudo labeling method and outperform supervised models in some out-of-domain datasets. \item Comprehensive analysis of the effects of online pseudo labeling and momentum network on our results. \item To the best of our knowledge, this is the first study to combine online pseudo labeling and momentum network for polyp segmentation task. \end{itemize} The rest of this paper is organized as follows. Related work is presented in Section 2. The proposed method is presented in Section 3. Section 4 describes the datasets and details implementation methods. The experimental results are presented in Section 5. Finally, discussions and future research directions are presented in Section 6. \section{Related Work} \subsection{Semantic Segmentation} Semantic segmentation aims to classify images at the pixel level. Since the Fully Convolutional Neural Network was applied to semantic segmentation in the study of Long et al. \cite{long2015fully}, deep learning models have achieved remarkable results in this field. Currently, most segmentation models are designed based on the encoder-decoder architecture \cite{long2015fully}. A few studies also aim to build a specific model for polyp segmentation. HarDNet-MSEG \cite{huang2021hardnet} achieved high performance on the Kvasir-SEG dataset with processing speed up to 86 FPS. AG-ResUNet++ improved UNet++ with attention gates and ResNet backbone. Another study called Transfuse combined Transformer and CNN using BiFusion module \cite{zhang2021transfuse}. ColonFormer \cite{duc2022colonformer} used MiT backbone, Upper decoder, and residual axial reverse attention to further boost the polyp segmentation accuracy. NeoUNet \cite{ngoc2021neounet} and BlazeNeo \cite{an2022blazeneo} proposed effective encoder-decoder networks for polyp segmentation and neoplasm detection. Generally, research in changing model architecture is still a potential approach. However, this approach often requires a large amount of labeled data. Collecting dense pixel-level annotations for semantic segmentation is costly and difficult, especially for medical segmentation data. Therefore, applying an efficient learning method to help deal with the lack of data is critical for practical. \subsection{Semi supervised learning for semantic segmentation} One of the disadvantages of supervised learning is the requirement of massive amounts of labeled data. This problem becomes even more difficult with medical image data such as polyp segmentation because it requires effort from people with experience and expertise in imaging diagnostic. Semi-supervised learning solves this problem by combining labeled and unlabelled data during the training model. Several studies have applied semi-supervised learning to semantic segmentation problems, such as adversarial learning, consistency regularization, or pseudo-labeling \cite{feng2020semi}. General objective of semi-supervised learning is improving base model trained on dataset of $N$ labelled samples $D_{sup}=\left\{ (x_n, y_n) | n=1...N \right\}$ by utilizing a dataset of M unlabeled samples $D_{unsup}=\left\{ x_m | m=N+1...N+M \right\}$. In this paper, we focus on improving the quality of pseudo labels by combining the online pseudo labeling strategy with momentum networks. \subsection{Momentum Network} A momentum network is a slow copy version of weights of the original model during the training process through Exponential Moving Average (EMA). The update process can be done after each epoch or after a certain number of steps in the training process. $$\theta'_t=\alpha\theta'_{t-1} + (1 - \alpha)\theta_t$$ where $\theta'_t$ and $\theta_t$ are the weights of the momentum and original models, respectively, at the $t$-th step during the training process. The studies applying momentum network have shown experimentally that momentum network gives more stable accuracy than the original model \cite{araslanov2021self}. Accordingly, the momentum model can be considered an ensemble of several versions of the original model at different time steps during training. \subsection{Online vs. offline pseudo label generation} Pseudo-label generation methods can be divided into two types: online generation and offline generation. Online generation generates pseudo labels directly during the forwarding process \cite{sohn2020fixmatch}. The offline generation will generate pseudo labels once in each semi-supervised training, and pseudo labels will only change in the subsequent iterations \cite{iscen2019label, chen2020big}. The advantage of offline learning is that the quality of the pseudo label will not change in each iteration, and the more iterations we train, the better the quality of the pseudo label will be. However, offline pseudo label generation requires more complicated installation and computational costs than online pseudo label generation. The installation is straightforward with the online pseudo label generation method and only requires one-stage training with the student model. However, the online generation method demands a stable quality of the pseudo label during the label generation process. That needs the pseudo-label generation model to be smooth. We solve this problem by using a momentum network during training semi-supervised learning. \section{Proposed method} In this section, we present an online prototyping strategy that ensures the stability of fake label quality during prototyping with a combination of online pseudo labeling and momentum networks. Details of the available pipeline, loss function configurations as well as augmentation methods for each data type are also detailed in this section. \subsection{Overall pipeline} The overall architecture of the system is described in Fig.~\ref{fig:pipeline}. We still apply a two-stage strategy for semi-supervised training, where the teacher model is first trained on the labeled dataset. During the training process, both the original model and the slow copy version of the model updated by EMA (Momentum teacher network) are saved and served for student training. We perform the online pseudo label generation during the student training process using the momentum teacher model. At the same time, the weights of the original student model are updated for the momentum teacher and its student momentum version. Finally, the momentum student version will be used to predict the outcome after the training finishes. Details of each training step will be described in the sections below. \begin{figure*}[ht \centering \includegraphics[width=0.8\linewidth]{images/pipeline.png} \caption{Overview of online pseudo labeling with momentum network pipeline} \label{fig:pipeline} \end{figure*} \subsubsection{Teacher training} The training teacher model is performed on the entire labeled dataset. We use the Tversky loss function during training. Besides, we use the FPN architecture with the DenseNet169 backbone as the primary model for our experiment. The best momentum teacher network on the validation set will be used to generate pseudo labels during student training. \subsubsection{Student training} After having the momentum teacher model trained on the dataset labeled $D_{sup}$, we proceed to train the student model with the pseudo label generated from the momentum teacher model. The difference is that the weights of the momentum teacher model will also be updated during training after a certain number of training steps. This strategy helps the fake labels to be constantly updated and stable due to the nature of the momentum network. The detailed algorithm is presented in \textbf{Algorithm} \ref{algo:main_stategy}. \begin{algorithm} \caption{Online Pseudo Labeling with Momentum Teacher Algorithm} \label{algo:main_stategy} \textbf{Input}: Labeled images $D_{sup}$, Unlabeled images $D_{unsup}$, Trained momentum teacher $MT_0$ \\ \textbf{Output}: Best momentum student $MS_{best}$ trained with combination of supervised and unsupervised data \begin{algorithmic} \Procedure{OnlineLabelingMomentum}{} \For {$t=0$ to $n\_epochs$} \State \textbf{Step 1:} Generate pseudo labels of $D_{unsup}$ with $MT_t$ model. \State \textbf{Step 2:} Train student $S_t$ with combination of $D_{sup}$ and $D_{unsup}$ with generated pseudo labels. \State \textbf{Step 3:} Update momentum teacher $MT_{t}$ with $S_t$ weights via EMA. \State \textbf{Step 3:} Update momentum student $MS_{t}$ with $S_t$ weights via EMA. \State \textbf{Step 4:} Save the best models in validation set. \EndFor \EndProcedure \end{algorithmic} \end{algorithm} \subsection{Data Augmentation} \subsubsection{Weak Augmentation on labeled dataset} We choose two different data augmentation strategies for labeled and unlabelled data. We apply the weak or basic augmentation methods to the labeled dataset. For the weak augmentation, the training images are random flips with a probability of 0.5. \subsubsection{Strong Augmentation on unlabeled dataset} When applied to unlabeled data, noise has the essential benefit of enforcing invariance in the decision function on both labeled and unlabeled data. When the student is deliberately noised, it is trained to be consistent with the teacher that is not noised when it generates pseudo labels. We only use the input noise in our experiments via a strong augmentation method. We use the combination of ShiftScaleRotate, RGBShift, RandomBrightnessContrast, and RandomFlip with the probability of 0.5. \section{Dataset and Experiments Setup} \subsection{Dataset} To compare the method results, we use the same Polyp dataset as in the study of HardDet-MSEG \cite{huang2021hardnet}. This dataset includes 1450 endoscopic images of size $384 \times 288 \times 3$ corresponding to 1450 masks of size $384 \times 288 \times 1$. The mask is a binary image, the pixels have a value of 255 corresponding to the area containing the polyp, and the pixels in background areas have a value of 0. The training dataset includes 900 images in Kvasir-SEG and 550 in the CVC-ClinicDB. The test dataset includes 798 images synthesized from different data sets, which are the CVC-300 dataset, CVC-ClinicDB, CVC-ColonDB, ETIS- LaribPolypDB and Kvasir-SEG. Our experiment uses a 10\% dataset equivalent to 145 images as the validation dataset. The remaining total of 1305 images was used to scale the labeled and unlabeled datasets in each experiment. \subsection{Evaluation Metrics} \textbf{Mean IoU} and \textbf{Mean Dice} are used to evaluate the model and compare our experiments. There are defined as follows: \begin{raggedleft} \begin{tabular}{p{4cm}p{3.5cm}} $$mIoU = \frac{TP}{TP + FP + FN}$$ & $$mDice = \frac{2*TP}{2*TP + FP + FN}$$ \end{tabular} \end{raggedleft} \subsection{System configuration} Our experiments are conducted on a computer with Intel Core i5-7500 CPU @3.4GHz, 32GB of RAM, GPU GeForce GTX 1080 Ti, and 1TB SSD hard disk. The models are implemented with the PyTorch Lightning framework. \section{Result of Experiments} This section presents teacher training results on the labeled dataset and semi-supervised learning with offline and online pseudo-labeling. We use the base model and its momentum network for the above experiments to compare the results. We also divide the dataset with different ratios of labeled data to measure the effect of the amount of labeled data on our method. \subsection{Training teacher model in a supervised manner in labeled data} First, we train the model on the labeled set. Original model weights are optimized by Adam optimizer with back-propagation algorithms. The slow copy of the original model is updated simultaneously with the momentum ratio is 0.95. We save the best checkpoint of both models in the validation set during training as the final teacher model. Table \ref{tab:compare_teacher} shows the performance comparison between the original teacher model and its momentum network. We found that the momentum model gives better results than the original model. Therefore, we choose the momentum teacher model as the basis for the semi-supervised experiments presented in the following sections. \begin{table*}[h] \centering \caption{A comparison of the original teacher with the momentum model teacher in different ratios of labeled data} \def1.1{1.1} \begin{tabular}{|c|c|cc|cc|cc|cc|cc|cc|} \hline \textbf{Ratio of} & \textbf{Momentum} & \multicolumn{2}{c|}{\textbf{CVC-ClinicDB}} & \multicolumn{2}{c|}{\textbf{ETIS}} & \multicolumn{2}{c|}{\textbf{CVC-ColonDB}} & \multicolumn{2}{c|}{\textbf{CVC-300}} & \multicolumn{2}{c|}{\textbf{Kvarsir}} & \multicolumn{2}{c|}{\textbf{Average}} \\ \cline{3-14} \textbf{labeled data} & \textbf{teacher} & \textbf{mIoU} & \textbf{mDice} & \textbf{mIoU} & \textbf{mDice} & \textbf{mIoU} & \textbf{mDice} & \textbf{mIoU} & \textbf{mDice} & \textbf{mIoU} & \textbf{mDice} & \textbf{mIoU} & \textbf{mDice} \\ \hline \multirow{2}{*}{20\%} & - & 0.794 & 0.856 & 0.618 & 0.698 & 0.625 & 0.702 & 0.803 & 0.875 & 0.819 & 0.883 & 0.732 & 0.803 \\ & \checkmark & 0.792 & 0.854 & 0.616 & 0.699 & 0.616 & 0.693 & 0.800 & 0.875 & 0.820 & 0.884 & 0.730 & 0.801 \\ \hline \multirow{2}{*}{40\%} & - & 0.787 & 0.857 & 0.587 & 0.674 & 0.624 & 0.700 & 0.824 & 0.892 & 0.817 & 0.879 & 0.728 & 0.808 \\ & \checkmark & 0.803 & 0.868 & 0.616 & 0.694 & 0.642 & 0.716 & 0.831 & 0.898 & 0.819 & 0.876 & 0.743 & 0.811 \\ \hline \multirow{2}{*}{60\%} & - & 0.835 & 0.889 & 0.610 & 0.677 & 0.645 & 0.721 & 0.820 & 0.885 & 0.842 & 0.894 & 0.751 & 0.814 \\ & \checkmark & 0.850 & 0.902 & 0.620 & 0.685 & 0.663 & 0.741 & 0.839 & 0.904 & 0.847 & 0.898 & 0.764 & 0.826 \\ \hline \end{tabular} \label{tab:compare_teacher} \end{table*} \subsection{Training student with offline pseudo labeling with semi-supervised manner} We use the momentum teacher model for our semi-supervised learning experiments. The student model has the same architecture as the teacher model. In the offline pseudo labeling strategy, the pseudo labels will be generated directly from the momentum teacher model. The momentum teacher model did not change during training. That means the pseudo-labels for the same image will be the same in all training iterations. The student model kept the original and momentum versions as the teacher training on the labeled dataset. \subsection{Training student with online pseudo labeling with semi-supervised manner} Online pseudo labeling follows the same training strategy as offline labeling. The only difference is that the Teacher model will also be updated via EMA with the weights of the student model after each epoch. Since then, the pseudo label for an image is also continuously updated during model training. The online learning method combined with the momentum student model gives better results than offline learning. The results are shown in Table \ref{tab:compare_online_offline} and illustrated in Fig. \ref{fig:visualize_result}. \begin{table*}[h] \centering \caption{A comparison of the online pseudo labeling and offline pseudo labeling strategy for semi-supervised training} \def1.1{1.1} \resizebox{\textwidth}{!}{ \begin{tabular}{|c|c|c|cc|cc|cc|cc|cc|cc|} \hline \textbf{Ratio of} & \textbf{Online} & \textbf{Momentum} & \multicolumn{2}{c|}{\textbf{CVC-ClinicDB}} & \multicolumn{2}{c|}{\textbf{ETIS}} & \multicolumn{2}{c|}{\textbf{CVC-ColonDB}} & \multicolumn{2}{c|}{\textbf{CVC-300}} & \multicolumn{2}{c|}{\textbf{Kvarsir}} & \multicolumn{2}{c|}{\textbf{Average}} \\ \cline{4-15} \textbf{labeled data} & \textbf{pseudo-labels} & \textbf{student} & \textbf{mIoU} & \textbf{mDice} & \textbf{mIoU} & \textbf{mDice} & \textbf{mIoU} & \textbf{mDice} & \textbf{mIoU} & \textbf{mDice} & \textbf{mIoU} & \textbf{mDice} & \textbf{mIoU} & \textbf{mDice} \\ \hline \multirow{4}{*}{20\%} & - & - & 0.789 & 0.847 & 0.590 & 0.670 & 0.647 & 0.727 & 0.821 & 0.891 & 0.832 & 0.891 & 0.736 & 0.805 \\ & - & \checkmark & 0.830 & 0.887 & 0.676 & 0.754 & 0.676 & 0.755 & 0.828 & 0.897 & 0.843 & 0.897 & 0.770 & 0.838 \\ & \checkmark & - & 0.801 & 0.857 & 0.673 & 0.748 & 0.641 & 0.717 & 0.830 & 0.897 & 0.835 & 0.895 & 0.756 & 0.823 \\ & \checkmark & \checkmark & 0.816 & 0.870 & 0.701 & 0.772 & 0.669 & 0.742 & 0.836 & 0.903 & 0.856 & 0.911 & 0.778 & 0.841 \\ \hline \multirow{4}{*}{40\%} & - & - & 0.792 & 0.850 & 0.628 & 0.704 & 0.650 & 0.733 & 0.833 & 0.902 & 0.813 & 0.875 & 0.743 & 0.813 \\ & - & \checkmark & 0.825 & 0.882 & 0.673 & 0.749 & 0.671 & 0.745 & 0.824 & 0.894 & 0.837 & 0.893 & 0.766 & 0.833 \\ & \checkmark & - & 0.824 & 0.883 & 0.601 & 0.671 & 0.668 & 0.750 & 0.829 & 0.896 & 0.838 & 0.899 & 0.752 & 0.820 \\ & \checkmark & \checkmark & 0.825 & 0.882 & 0.702 & 0.777 & 0.689 & 0.768 & 0.825 & 0.895 & 0.850 & 0.908 & 0.778 & 0.846 \\ \hline \multirow{4}{*}{60\%} & - & - & 0.833 & 0.888 & 0.617 & 0.686 & 0.651 & 0.725 & 0.802 & 0.871 & 0.842 & 0.899 & 0.749 & 0.814 \\ & - & \checkmark & 0.856 & 0.905 & 0.700 & 0.773 & 0.685 & 0.763 & 0.839 & 0.904 & 0.865 & 0.915 & 0.789 & 0.852 \\ & \checkmark & - & 0.832 & 0.881 & 0.652 & 0.724 & 0.674 & 0.752 & 0.819 & 0.880 & 0.856 & 0.910 & 0.767 & 0.830 \\ & \checkmark & \checkmark & 0.855 & 0.901 & 0.694 & 0.772 & 0.701 & 0.777 & 0.833 & 0.898 & 0.865 & 0.916 & 0.790 & 0.853 \\ \hline \end{tabular} } \label{tab:compare_online_offline} \end{table*} \subsection{Comparison with some difference supervised methods} We evaluated our model’s performance with a benchmark consisting of the state-of-the-art models, namely UNet \cite{ronneberger2015u}, UNet++ \cite{zhou2019unet++}, SFA \cite{fang2019selective}, PraNet \cite{pranet}, MSNet \cite{zhao2021automatic} and Shallow Attention \cite{wei2021shallow}. Table \ref{tab:compare_with_supervised} shows our model’s performance results for mIoU and mDice metrics compared to the results of the benchmark studies. Our model outperformed UNet, UNet++, PraNet, SFA, and Shallow Attention on all datasets for Dice and IoU metrics with only using a maximum of 60\% of labeled data. We are only about 2\% mDice worse than MSNET on the CVC-ClinicDB set but much better on the rest of the datasets. In particular, our method gives better generalization. Our method outperforms all above-supervised methods when tested in out-of-distribution datasets such as ETIS-LabribPolypDB, CVC-300, and CVC-ColonDB. \begin{table*}[h] \centering \caption{A comparison of our method with state-of-the-art supervised models} \def1.1{1.1} \begin{tabular}{|c|c|cc|cc|cc|cc|cc|} \hline \multirow{2}{*}{\textbf{Methods}} & \textbf{Ratio of} & \multicolumn{2}{c|}{\textbf{CVC-ClinicDB}} & \multicolumn{2}{c|}{\textbf{ETIS}} & \multicolumn{2}{c|}{\textbf{CVC-ColonDB}} & \multicolumn{2}{c|}{\textbf{CVC-300}} & \multicolumn{2}{c|}{\textbf{Kvarsir}} \\ \cline{3-12} & \textbf{labeled data} & \textit{\textbf{mIOU}} & \textit{\textbf{mDice}} & \textit{\textbf{mIOU}} & \textit{\textbf{mDice}} & \textit{\textbf{mIOU}} & \textit{\textbf{mDice}} & \textit{\textbf{mIOU}} & \textit{\textbf{mDice}} & \textit{\textbf{mIOU}} & \textit{\textbf{mDice}} \\ \hline Unet \cite{ronneberger2015u} & 100\% & 0.755 & 0.823 & 0.335 & 0.398 & 0.444 & 0.512 & 0.627 & 0.710 & 0.746 & 0.818 \\ Unet++ \cite{zhou2019unet++} & 100\% & 0.729 & 0.794 & 0.344 & 0.401 & 0.410 & 0.483 & 0.624 & 0.707 & 0.743 & 0.821 \\ SFA \cite{fang2019selective} & 100\% & 0.607 & 0.700 & 0.217 & 0.297 & 0.347 & 0.469 & 0.329 & 0.467 & 0.611 & 0.723 \\ PraNet \cite{pranet} & 100\% & 0.849 & 0.899 & 0.567 & 0.628 & 0.640 & 0.709 & 0.797 & 0.871 & 0.840 & 0.898 \\ MSNET \cite{zhao2021automatic} & 100\% & \textbf{0.879} & \textbf{0.921} & 0.664 & 0.719 & 0.678 & 0.755 & 0.807 & 0.869 & 0.862 & 0.907 \\ Shallow Attention \cite{wei2021shallow} & 100\% & 0.859 & 0.916 & 0.654 & 0.750 & 0.670 & 0.753 & 0.815 & 0.888 & 0.847 & 0.904 \\ \hline \multirow{3}{*}{Ours} & 20\% & 0.816 & 0.870 & 0.702 & 0.777 & 0.669 & 0.743 & \textbf{0.836} & \textbf{0.904} & 0.856 & 0.912 \\ & 40\% & 0.825 & 0.883 & \textbf{0.702} & \textbf{0.777} & 0.690 & 0.757 & 0.825 & 0.895 & 0.850 & 0.909 \\ & 60\% & 0.855 & 0.902 & 0.694 & 0.772 & \textbf{0.701} & \textbf{0.767} & 0.833 & 0.899 & \textbf{0.865} & \textbf{0.916} \\ \hline \end{tabular} \label{tab:compare_with_supervised} \end{table*} \begin{figure*}[ht \centering \includegraphics[width=0.6\linewidth]{images/result_online.png} \caption{Qualitative result comparison between offline pseudo labeling and online pseudo labeling, with/without using momentum network. From left to right: input image in RGB format, ground truth, the output of teacher (momentum network) trained on the labeled dataset, the output of original student trained with offline pseudo labeling, the output of momentum network of original student trained with offline pseudo labeling, the output of original student trained with online pseudo labeling and the output of momentum network of original student trained with online pseudo labeling.} \label{fig:visualize_result} \end{figure*} \section{Conclusion and Future Works} This paper proposes a semi-supervised learning method that combines online pseudo label generation and momentum network. This method has been shown to generate pseudo labels without complicated settings. Our method achieves an average mDice of 85.33\% on a test set of 5 different data sets, CVC-300, CVC-ClinicDB, CVC-ColonDB, ETIS-LaribPolypDB, Kvasir-SEG. Especially, mDice on some datasets such as CVC-300, CVC-ColonDB, and ETIS-LaribPolypDB are outperformed with state-of-the-art supervised learning methods. This research is a promising direction in many practical applications because of the enormous amount of current and future unlabelled data, especially in support systems for diagnostics on medical images. We hope this research can promote the applications of semi-supervised learning in medical image segmentation problems in the future. \section*{Acknowledgement} This work is funded by Vingroup Innovation Foundation (VINIF) under project code VINIF.2020.DA17. This work is also partially supported by Sun-Asterisk Inc. We would like to thank our colleagues at Sun-Asterisk Inc for their advice and expertise. Without their support, this experiment would not have been accomplished. \printbibliography \end{document} }
{'timestamp': '2022-09-30T02:08:55', 'yymm': '2209', 'arxiv_id': '2209.14599', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14599'}
arxiv
\section{Introduction} We have developed biped robots with a passive dynamic walking mechanism. Bipedal walking is generated through the dynamic interactions among the body, neural system, and environment. McGeer~\cite{McGeer1990} developed a simple robot with passive legs attached to the hip and demonstrated stable walking while descending a slope without any energy input other than gravity. This suggested that passive locomotion plays a significant role in locomotion. Many studies have clarified the gait generation mechanism by using a simple compass model consisting of a body mass and two rigid bars as legs~\cite{Garcia1998,Goswami1998,Garcia2000,Collins2005,Obayashi2015,Okamoto2020}. In addition to completely passive models, models with controls derived from physiological studies to imitate the neural system have also been proposed~\cite{Rybak2006,Cappellini2006,Ivanenko2007}. For example, Aoi et al. \cite{Aoi2006,Aoi2007} applied control based on a central pattern generator (CPG), which involves a rhythm resetting (i.e., phase resetting) function of human neural systems, to the compass model, and revealed the mechanism through which stable limit cycles are generated. The dynamics of both the lower limbs and the upper body play an important role in walking. Therefore, many researchers have investigated the effect of the upper body on locomotion. For example, in modeling studies, a rigid upper body has been attached to simple models such as a compass model, and its effect on gait has been investigated~\cite{Wisse2004,Wisse2007,Collins2009,Ackerman2013,Ackerman2014,Honjo2013,Honjo2019}. Notably, the upper body is not a single rigid body but consists of multiple soft tissues. Therefore, many researchers have focused on the active or passive wobbling mass of the upper body, the flexible spine, and the pendulum-like oscillation of the arms~\cite{Rome2006,Arellano2014,Hanazawa2015, Hanazawa2019, Toda2020}. These studies showed that such elements compensated for the torque generated by legs, reduced the peak ground reaction force, increased the energy efficiency, and increased or decreased the stability. In our previous study, we showed that a passive wobbling mass connected to the upper body and oscillating in the vertical direction generates human-like time profiles of the ground reaction force while running using a simple model and a running biped robot~\cite{Kamimura2021}. While the vertical wobbling mass plays a significant role in running, as shown in our previous study, a horizontal wobbling mass is also expected to play an important role in walking. For example, the horizontal wobbling mass is assumed to affect acceleration and deceleration in the horizontal direction and thus impact the energy efficiency of gait. Moreover, the horizontal movement of the upper body is supposed to affect the stability. During walking, the zero moment point (ZMP) always exists inside the support polygon~\cite{Popovic2005}. If the ZMP moves outside the support polygon, the walker will fall down. The horizontal movement of the body is assumed to play a significant role in the dynamics of the ZMP. Therefore, in this study, we investigate the effect of the horizontal dynamics of the upper body on the walking performance in terms of the energy efficiency and stability. To clarify this effect, based on a compass model, we propose a simple walking model with a horizontally oscillating mass point (i.e., a wobbling mass). Furthermore, we discuss the relationship between our simple model and actual walking. \section{Model} \begin{figure} \centering \includegraphics[scale=1.0]{fig/model_hori.pdf} \caption{Compass model with elastically supported horizontal wobbling mass.} \label{fig:model} \end{figure} We proposed a model based on a compass model equipped with a wobbling mass, as shown in Fig.~\ref{fig:model}. The model consists of a hip, swing leg, stance leg, and wobbling mass. The legs have length $L$ and are connected at the hip. Each foot can detect the touchdown timing on the ground. The tip of the stance leg is constrained on the ground and it behaves as a frictionless pin joint. The body mass $m_1$ and leg mass $m_2$ are assumed to be concentrated at the hip and tip, respectively. The wobbling mass $m_3$ is connected to the hip through a prismatic spring $K$. It can move only in the horizontal direction, and its height always equals the hip height. The whole upper body mass is $M = m_1 + m_3$, where $m_3 = \alpha M$ and $m_1 = (1-\alpha)M$. The model is constrained on the $x$-$y$ plane, with the walking direction along the $x$-axis. The model has three degrees of freedom, $\theta_1$, $\theta_2$, and $X$, where $\theta_1$ is the angle of the stance leg with respect to the vertical direction, $\theta_2$ is the angle between the swing leg and the stance leg, and $X$ is the distance between the hip and the wobbling mass. In this model, $\theta_1$ and $X$ are not controlled directly, whereas $\theta_2$ is controlled by the actuator torque $U$. We derived the dimensionless governing equations using the characteristic length $L$ and characteristic time scale $\tau = \sqrt{L/g}$. The state variables of the model are defined as $q = [\theta_1,\theta_2,y]^\top$, where $x = X/L$. The dimensionless equations of motion for the swing phase are given by \begin{align} \mathcal{M}(q)\ddot{q} + h(q,\dot{q}) + v(q) = Q, \end{align} where $\mathcal{M}(q)$ is the inertia matrix, $h(q,\dot{q})$ is the Coriolis and centrifugal forces, $v(q)$ is the conservative force, and $Q = [0,u = U/MgL,0]^\top$ is the input torque. $\dot{*}$ and $\ddot{*}$ respectively indicate the first and second derivatives of variable $*$ with respect to $t/\tau$. The swing leg touches the ground when $2\theta_1 = \theta_2$ is satisfied, at which time the swing and stance legs are immediately switched. The impulsive force occurs at the tip and results in a discontinuous change in the velocities From the law of conservation of angular momentum, the relationship between the states immediately before and after touch down is given by \begin{align} [(q^+)^\top, (\dot{q}^+)^\top]^\top = H(q^-,\dot{q}^-), \end{align} where $*^-$ and $*^+$ indicate the states immediately before and after touchdown, respectively. The input torque $u$ is determined based on a rhythmic signal oscillator (CPG)~\cite{Aoi2006} \begin{align} u = -K_{\rm p}(\theta_2 - \theta_2^{\rm d}(\gamma,\phi)) - K_{\rm d}(\dot{\theta}_2 - \dot{\theta}_2^{\rm d}(\gamma,\phi)), \end{align} where the desired angle $\theta_2^{\rm d}(\gamma,\phi))$ is defined as \begin{align} \theta_2^{\rm d}(\gamma,\phi) = \gamma(1+ \cos \phi) - S, \end{align} where $\gamma$ and $\phi$ are respectively the amplitude and phase of the oscillator, which has constant angular velocity $\omega$. Further, $S$ is the stride angle. \subsection{Searching limit cycles} We defined the Poincar\'{e} section at the touchdown moment. A Poincar\'{e} map $P$ was defined as \begin{align} z_{n+1} = P(z_n), \end{align} where $z_n$ is the state variable at the $n$th intersection with the Poincar\'{e} section. For a periodic gait, $z^* = P(z^*)$ is satisfied, where $z^*$ is a fixed point on the Poincar\'{e} section. We numerically searched for fixed points for periodic walking by using the \texttt{fsolve} function in MATLAB. \subsection{Stability and risk of accidental falling} We used the eigenvalues of the linearized Poincar\'{e} map around the fixed point on the Poincar\'{e} section. The limit cycle is stable when all of the eigenvalues are inside the unit cycle in the complex plane (these magnitudes are less than 1). The ZMP is also an important measure to determine whether walking is stable or not. Because the moment is zero around the ZMP, the horizontal position $p$ of the ZMP is given by \begin{align} p = x_g - \frac{\ddot{x}_g}{g+\ddot{y}_g}y_g, \end{align} where $(x_g, y_g)$ are respectively the horizontal and vertical positions of the center of mass of the whole body, including the wobbling mass. Although our model does not have a support polygon because it has point tips, we used the distance $d$ between the ground point and the ZMP as a criterion of the risk of accidental falling while walking. \subsection{Energy efficiency} To evaluate the energy efficiency, we defined the cost of transport (CoT) as \begin{align} {\rm CoT} = \frac{W}{mg\bar{v}} \end{align} where $W$ is the work generated by the hip actuator during one stride, and $\bar{v}$ is the averaged horizontal velocity of the center of mass for one gait cycle. A smaller CoT indicates better energy efficiency because the actuator expends lesser energy in one stride. \section{Results} \subsection{Obtained solution groups} The periodic solutions obtained for various $k=KL/Mg$ and $\alpha$ values using the CPG frequency $\omega = 3$ are shown in Fig.~\ref{fig:soltuons_distribution}. The obtained solutions are divided into several qualitatively different discrete groups; these are denoted as solution groups A, B, C, D, and E according to the value ranges of $k$, as shown in Fig.~\ref{fig:soltuons_distribution}. Regardless of the $\omega$ value, the obtained solutions were classified into similar groups. \begin{figure} \centering \includegraphics[width=80mm]{fig/solutions_for_various_param.pdf} \caption{Distribution of limit cycles on $k$-$\alpha$ plane with $\omega = 3$. Blue and grey areas show stable and unstable limit cycles, respectively. No solution was found in the white area. Solutions exhibit qualitatively different behaviors and are accordingly classified into groups A, B, C, D, and E. Points a, b, and c indicate typical stable solutions, whose behaviors are shown in Fig.~\ref{fig:variables}.} \label{fig:soltuons_distribution} \end{figure} Figure~\ref{fig:variables} shows the behaviors of typical solutions of groups A, B, and C. The solutions exhibited qualitatively different behaviors, particularly in $x$ and $\dot{\theta}_1$. In the solutions of group A (Fig.~\ref{fig:variables}a), the position of the wobbling mass $x$ moves backward ($x < 0$) in the first half of the stance phase and forward ($x > 0$) in the second half. By contrast, in the solutions of group B (Fig.~\ref{fig:variables}b), $x$ moves forward in the first half of the stance phase and backward in the second half. In the solutions of group C (Fig.~\ref{fig:variables}c), $x$ oscillates two times during one gait cycle; this is regarded as a doubling of the oscillation of $x$ in the solutions of group B. Similarly, in the solutions of groups D and E, $x$ oscillates three and four times, respectively. Furthermore, $\dot{\theta}_1$ has one, two, and three peaks in the solutions of groups A, B, and C, respectively. The time responses of the state variables in limit cycles in the traditional compass model, which does not include a wobbling mass, applied with the same controller ($\omega = 3$) are shown in Fig.~\ref{fig:variables_compass}. The behavior of the solution is similar to that of the solutions of group A of the proposed model because $\dot{\theta}_1$ has only one peak in one gait cycle. The state variables $\theta_i, \dot{\theta}_i$ ($i = 1,2$) show approximately the same trajectory as that of the solutions of group A. No other qualitatively different solutions were obtained for the compass model without the wobbling mass. \begin{figure} \centering \includegraphics[width=80mm]{fig/variables.pdf} \caption{Time profiles of state variables of limit cycles of proposed model for three typical solutions a, b, and c in Fig.\ref{fig:soltuons_distribution}. (a) $k = 0.5$ (solution a), (b) $k = 6.5$ (solution b), and (c) $k = 22.5$ (solution c) for $\alpha = 0.3$ and $\omega = 3$.} \label{fig:variables} \end{figure} \begin{figure} \centering \includegraphics[width=80mm]{fig/variables_normalCompass.pdf} \caption{Time profiles of state variables of limit cycle of traditional compass model using same controller as that of the proposed model with $\omega = 3$.} \label{fig:variables_compass} \end{figure} \subsection{Walking performances} We evaluated the walking performances of the obtained solutions for various $k$, $\alpha$, and $\omega$ values. Figure~\ref{fig:eigenValues} shows the maximum eigenvalues of the obtained limit cycles for various parameters. In a single solution group, a smaller $k$ results in higher stability (Fig.~\ref{fig:soltuons_distribution}). Further, the solutions become unstable when $\alpha$ is too large. When $\omega$ is large, the range of stable $k$ widens. In comparison with the stability of the traditional compass model, the maximum eigenvalues of all solutions of the proposed model are larger (Fig.~\ref{fig:eigenValues}), indicating that the stability of the limit cycles is reduced by the effect of the wobbling mass. \begin{figure} \centering \includegraphics[width = 80mm]{fig/lambda_for_various_param_small.pdf} \caption{Maximum eigenvalues of obtained solutions for $\alpha = 0.25$ (left) and $\alpha = 0.5$ (right) for (a) $\omega = 2$ and (b) $\omega = 3$. A, B, C, and D indicate solution groups in Fig.~\ref{fig:soltuons_distribution}. Red and blue curves indicate stable and unstable solutions, respectively. Horizontal dashed lines indicate the maximum eigenvalue of the compass model without a wobbling mass.} \label{fig:eigenValues} \end{figure} Figure~\ref{fig:ZMP} shows the distance $d$ between the toe and ZMP for various parameters. $d$ is small for ($k,\alpha$), where the stability of the solutions is high (maximum eigenvalue is small). The minimum value of $d$ in the solutions of group A is larger than that in the solutions of groups B and C. Furthermore, $d$ is larger when $\alpha$ and $\omega$ are large. In the solutions of group A, $d$ is always larger than that of the traditional compass model. However, in some stable solutions of groups B and C at $\omega = 2$, $d$ is smaller than that of the traditional compass model. In addition, $d$ decreases rapidly with decreasing $k$. \begin{figure} \centering \includegraphics[scale=1.0]{fig/d_for_various_param_small.pdf} \caption{Distance $d$ between toe and ZMP of obtained solutions for $\alpha = 0.25$ (left) and $\alpha = 0.5$ (right) for (a) $\omega = 2$ and (b) $\omega = 3$. A, B, C, and D indicate solution groups in Fig.~\ref{fig:soltuons_distribution}. Red and blue curves indicate stable and unstable solutions, respectively. Horizontal dashed lines indicate $d$ of the compass model without a wobbling mass.} \label{fig:ZMP} \end{figure} Moreover, the time profiles of $d$ for three typical stable solutions in groups A, B, and C with $\alpha = 0.3$ and $\omega = 3$ are shown in Fig.~\ref{fig:time-d}. $d$ becomes positive in the first half of the stance phase and then slowly becomes negative. Although there is no qualitative difference in the time profiles of $d$ among the solution groups, the solution with $k = 0.5$, which is a solution of group A, exhibits the largest fluctuation. \begin{figure} \centering \includegraphics[width = 80mm]{fig/time-d.pdf} \caption{Time profiles of $d$ for $k = 0.5$ (red, solution a in Fig.~\ref{fig:soltuons_distribution}), $k = 5.5$ (green, solution b in Fig.~\ref{fig:soltuons_distribution}), and $k = 18.5$ (blue, solution c in Fig.~\ref{fig:soltuons_distribution}) for $\alpha = 0.3$, $\omega = 3$.} \label{fig:time-d} \end{figure} The CoT for various parameters is shown in Fig.~\ref{fig:CoT}. The smaller the CoT, the higher is the energy efficiency. The CoT is small for ($k,\alpha$), where the limit cycles show high stability. The minimum CoT value for solutions of group A is larger than that for solutions of groups B and C. Furthermore, for larger $\alpha$ and $\omega$, the CoT is larger, indicating that the energy efficiency is lower. Although the CoT of the proposed model is always larger than that of the compass model for solutions of group A, it is smaller than that of the compass model for some stable solutions of groups B and C. Further, the CoT decreases rapidly as $k$ decreases. \begin{figure} \centering \includegraphics[scale=1.0]{fig/CoT_for_various_param_small.pdf} \caption{Energy efficiency (CoT) of obtained solutions for $\alpha = 0.25$ (left) and $\alpha = 0.5$ (right) for (a) $\omega = 2$ and (b) $\omega = 3$. A, B, C, and D indicate solution groups in Fig.~\ref{fig:soltuons_distribution}. Red and blue curves indicate stable and unstable solutions, respectively. Horizontal dashed lines indicate the CoT of the compass model without a wobbling mass.} \label{fig:CoT} \end{figure} \section{Discussion} \subsection{Parameter dependency of the model} The obtained results revealed that the body spring constant $k$ plays an important role in determining the solution group of the proposed compass model equipped with a wobbling mass. Depending on the spring constant, the solutions were obtained as some discrete groups (A, B, C, D, and E). Solutions in different groups exhibit qualitatively different behaviors, particularly in the time profiles of the wobbling mass position $x$. In usual walking, the body receives a deceleration force from the ground in the first half of the stance phase and an acceleration force in the second half of the stance phase. In the solutions of group A, the wobbling mass moves backward in the first half of the stance phase and forward in the second half, as shown in Fig.~\ref{fig:variables}a. In other words, it decelerates the body in the first half of the stance phase and accelerates the body in the second half. By contrast, in the solutions of group B, the wobbling mass moves forward in the first half of the stance phase and backward in the second half, exerting force in a direction that cancels the acceleration/deceleration of the body. Therefore, the large change in acceleration and deceleration of the body is suppressed by the wobbling mass in the solutions of group B. The existence of solution groups is assumed to be associated with the natural frequencies of the body spring. The solutions of group C have double the oscillation of the body spring than the solutions of group B. When the spring constant is further increased, the solutions of groups D and E are seen to involve three- and four-fold oscillations, respectively. Because the solutions are distributed in the $k$-$\alpha$ plane with a repetitive structure, solutions with $n$-fold period are assumed to exist when the spring constant is further increased. Within a single group of solutions, a spring constant dependence was also observed. The smaller the spring constant and the more stable the solution, the better is the energy efficiency and the closer is the ZMP to the toes. When the solution is unstable, the actuator consumes a large amount of energy and undergoes large acceleration and deceleration, resulting in large ZMP fluctuations, poor energy efficiency, and poor stability. The mass ratio $\alpha$ was also shown to affect the walking performance. If $\alpha$ is too large or too small, few stable solutions are found, and the optimal value is approximately $0.4 < \alpha < 0.5$ (Fig.~\ref{fig:soltuons_distribution}). By contrast, the larger the $\alpha$ value, the larger is the distance $d$ between the ZMP and the toes and CoT (Figs.~\ref{fig:ZMP} and~\ref{fig:CoT}). The results indicate that $\alpha$ should not be too large when designing a robot with a wobbling mass. Furthermore, as the phase angular velocity $\omega$ of the CPG increases, stable solutions are obtained over a wider range of $k$ and $\alpha$ values (Fig.~\ref{fig:eigenValues}). However, CoT and $d$ also increase as $\omega$ increases (Figs.~\ref{fig:ZMP} and~\ref{fig:CoT}). Walking at a fast pace requires large amounts of energy, resulting in large acceleration, deceleration, and $d$. \subsection{Effect of wobbling mass} We obtained several qualitatively different solutions for the proposed model with a wobbling mass. The state variables in the limit cycles of solutions of group A showed a behavior similar to that of the traditional compass model (Figs.~\ref{fig:variables} and~\ref{fig:variables_compass}). By contrast, solutions of groups B and C exhibited behaviors different from those of the traditional compass model, with $\dot{\theta}_1$ having multiple peaks and the wobbling mass undergoing oscillations. This behavior arose owing to the effect of the body spring that supports the wobbling mass. Furthermore, solutions of groups B and C had lower stability but better energy efficiency and a shorter distance between the ZMP and toe position than those of the traditional compass model. The stability of a limit cycle is a measure of how quickly it converges when a perturbation is applied in the limit cycle. The distance between the ZMP and the toes is a measure of whether or not a walker falls. In solutions of groups B and C, the motion of the ZMP was suppressed by the motion of the wobbling mass. Therefore, the risk of accidental falling while walking is expected to be reduced by the wobbling mass. In addition, because the acceleration and deceleration of the body are suppressed to be small, the work exerted by the actuators is also small; this is thought to improve the energy efficiency. These results indicate that the solutions of groups B and C use the wobbling mass to increase the energy efficiency and reduce the risk of accidental falling while walking. \subsection{Relationship between model and actual walking} In this study, we investigated the effect of the dynamics of a horizontally wobbling mass on the walking performance. The results showed that passively oscillating elements of the upper body could reduce the risk of accidental falling and improve the energy efficiency. Therefore, the walking performance can be improved by attaching a horizontal wobbling mass to an actual walking biped robot. In human walking, the soft tissues of the upper body may behave as a wobbling mass. In the model solution, the displacement of the horizontal wobbling mass was approximately $|x| = 0.05$; in other words, this displacement was only approximately 5\% of the leg length. Because even such a small oscillation can affect the gait, soft tissues in humans may play the same role as the wobbling mass in our model. Furthermore, the results suggested the possibility of a passive walking assist device that oscillates back and forth. Some birds tend to swing their heads forward and backward while walking. Although birds reportedly perform such movements to stabilize their vision, it may have dynamic effects similar to those of the wobbling mass in the proposed model. These movements may also have the effect of increasing the efficiency and stability of gait. \section{Conclusion} This study proposes a compass model with a wobbling mass that oscillates in the horizontal direction to reveal the influence of the horizontal motion of the upper body on walking. We searched the limit cycles of the model and their stability, energy efficiency, and risk of falling were investigated. Several qualitatively different limit cycles were obtained depending mainly on the spring constant that supports the wobbling mass. Specific types of solutions reduced the risk of falling and improved the energy efficiency, although the stability was decreased compared to those of the traditional compass model. Such results were due to the wobbling mass moving in the opposite direction to the upper body, thereby preventing large changes in acceleration and deceleration while walking. The obtained results also suggest that humans can use the soft tissues of the upper body to improve the gait performance. \subsection{Limitations and future works} The proposed wobbling mass can move only in the horizontal direction. However, the human body has wobbling parts, including arms and internal organs, that can move like a pendulum or move vertically. Future works will aim to clarify the relationship between these different oscillating parts and the actual human body. We used a controller using a CPG for the proposed model, however, its effect of it has not been investigated except for the frequency. We would like to investigate the effect of the neural system on the body with a wobbling mass. Furthermore, the gait of the proposed model will be compared with that of humans, and changes in gait when the walking support device is actually attached to the human body will be investigated. Finally, the relationship with the gait of birds will be investigated, and the similarities and differences in the bipedal gait of humans and birds will be clarified. \section*{Acknowledgement} This work was supported in part by JSPS KAKENHI Grant Number JP21K14104 and JP22H01445. \small \bibliographystyle{IEEEtran}
{'timestamp': '2022-09-30T02:06:33', 'yymm': '2209', 'arxiv_id': '2209.14515', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14515'}
arxiv
\section{Introduction} \label{sec:intro} Different from full reference image quality assessment (IQA) (e.g. PSNR, SSIM), blind IQA computes quality directly from the distorted image without a clean image, which makes it suitable to user generated content, communication and other scenarios where clean sources are inaccessible. Traditional blind IQA approach relies on the regularity of natural scene statistics. Hand-crafted features \cite{mittal2012no} are designed to measure the distortion of image from natural ones. More recently, deep CNN based blind IQA approaches have shown promising results as learned features are more powerful \cite{kang2014convolutional}. And a typical inference of such IQA approach involves several steps: (1). a CNN backbone (e.g. VGG16) is applied to extract deep features from distorted images. (2). the deep features are spatially average pooled (SAP). (3). the averaged features are passed through a regression head (e.g. fully connected layers) to predict image quality. In some works, the CNN backbone is pretrained on other tasks (e.g. ImageNet) and finetuned with regression head \cite{talebi2018nima}\cite{su2020blindly}\cite{chen2021nested}. While for other works auxiliary tasks such as predicting residual or noise type are added \cite{kim2018deep}\cite{chen2021nested}. Despite variation in the training methods, the inference procedures are similar. \begin{figure}[thb] \includegraphics[width=8.5cm]{fig1.PNG} \label{fig:res} \caption{(a). CNN based full reference IQA, (b). CNN based blind IQA and (c). our proposed SMP approach.} \end{figure} Formally, denote distorted image as $x' \in R^{H \times W}$, the feature from CNN as $f(x) \in R^{C \times H' \times W'}$, then the output of spatially average pooling $SAP(f(x'))$ can be seen as spatial mean of feature map. And the pooled feature map is further processed by head $g$ to obtain the predicted quality $d(x')$. \begin{equation} d(x') = g(SAP(f(x'))) = \\ g(E[f(x')]) \label{eq:1} \end{equation} On the other hand, CNN based full-reference IQA methods also show promising results. As a representative method, LPIPS \cite{zhang2018perceptual} has been widely adopted as perceptual loss \cite{mentzer2020high}. Similar to blind IQA, LPIPS first computes the feature maps of reference image $x$ and distorted image $x'$ from a CNN $f$. Then the square difference of those feature maps are computed and spatially averaged. Finally, the averaged results are processed by head $g$ to predict the distance metric $d(x, x')$. \begin{equation} \begin{array}{l} d(x, x') = g(SAP((f(x) - f(x'))^2)) \\ \hspace{3.5em} = g(Var[f(x) - f(x')]) \end{array} \label{eq:2} \end{equation} Though both Eq.~\ref{eq:1} and Eq.~\ref{eq:2} adopt SAP over features, the statistics computed are different (See Fig. 1). For blind IQA, the SAP is used to compute $1^{st}$ moment (mean) of feature map. For LPIPS, by assuming the residual has $0$ mean, the SAP computes the $2^{nd}$ central moment (variance) of feature map difference. For long, variance has been an important part of texture feature \cite{haralick1979statistical,sajjadi2017enhancenet}. Higher moments (e.g. skewness, kurtosis) are also applied in texture analysis \cite{shaban2001improvement}. So a natural question to ask is, is spatial variance and other moments more representative than mean alone for image quality? In this paper, we propose spatial moment pooling (SMP) as an extension of SAP for blind IQA. Our approach of adding higher moments absorbs the arts of full reference IQA methods and texture features. To be specific, for each channel of feature map, those higher central moments (e.g. variance) are also computed and concatenated with $1^{st}$ moment. It can be seen as a generalization of SAP ($1^{st}$ moment). Moreover, we also propose a normalization approach to avoid numeric issue when back-propagating through higher order moments. Experimental results show that by simply replacing SAP with SMP, the performance of many deep CNN based IQA methods is significantly improved. Our method outperforms previous CNN approaches. \section{Related Works} \label{sec:rw} \subsection{Poolings and Deep CNN based blind IQA} Despite the pioneer of CNN based blind IQA \cite{kang2014convolutional} adopts min-max-pooling, the majority of subsequent works \cite{su2020blindly}\cite{chen2021nested}\cite{chadha2021deep}\cite{kim2016fully} adopts SAP (include global average pooling) as it has become popular in CNN. \cite{ying2020patches} adopts a mixture of SAP and ROI Pooling. \cite{talebi2018nima} and \cite{ke2021musiq} resize input images or patches to fixed size instead, and do not use pooling for final features. On the other hand, covariance pooling \cite{wang2020deep} has been shown effective for high level vision tasks. And the $i = 2$ moment is the diagonal elements of a covariance matrix. However, to the best of our knowledge, neither moment pooling with $i \ge 3$ nor moment pooling with $i \ge 2$ for CNN based blind IQA has been studied. \section{spatial Moment Pooling} \subsection{Background} First, we will conduct a brief review of moments, spatial average pooling (SAP) and its relationship to convolution. Given a random variable $X \in R$, the $i^{th}$ moment is defined as $E[X^i], i = {1, ..., n}$, and the $i^{th}$ central moment is defined as $E[(X - E[X])^i], i = {2, ..., n}$. When $i = 1$, the moment is the mean $\mu$ of $X$. When $i = 2$, the central moment is the variance $\sigma^2$ of $X$. When $i = 3$, the central moment is the unnormalized skewness of $X$, which is defined as $E[(\frac{X - E[X]}{\sigma})^3]$. When $i = 4$, the central moment is the unnormalized kurtosis of $X$, which is defined as $E[(\frac{X - E[X]}{\sigma})^4]$. In practice, higher order moments with $i > 4$ are less commonly used. On the other hand, given a feature map $f \in R^{C \times H \times W}$, the SAP is the operation of computing the $i = 1$ moment of values inside a pooling window to output the pooled feature map $f_{SAP} \in R^{C \times H' \times W'}$ (See Fig. 2). Identical to the standard convolution operation, the outputted $H'\times W'$ are determined by kernel size, stride, dilation and padding. In fact, for any pooling, the pooling window is the same as convolution windows given same settings. Besides, it can also be implemented as \textit{im2col}. The difference between pooling and convolution is after extracting windows to row vectors. In convolution, the extracted rows $r_i^T$ is dot produced with the flattened kernel. In SAP, the mean of $r_i^T$ is computed. This makes SAP a special form of convolution with box filter kernel. However, the spatial moment pooling-n in Section 3.2 can not be generalized by convolution when $n \ge 2$, since the $i \ge 2$ moments are non-linear and convolution is linear. \subsection{Spatial Moment Pooling-n / SMP(n)} \begin{figure}[htb] \includegraphics[width=8cm]{fig3.png} \label{fig:smp} \caption{a. spatial average pooling/SAP illustrated. b. spatial moment pooling-4/SMP(4) illustrated.} \end{figure} Similarly, we define the spatial moment pooling-n/SMP(n) as the operation of computing the $i = {1, ..., n}$ central moments of a pooling window, concatenating the moments in channel dimension and outputting the pooled feature map $f_{SMP} \in R^{nC \times H' \times W'}$ (See Fig. 2). The outputted spatial dimensions $H'\times W'$ are the same as SAP. However, the channel size increases from $C$ to $nC$. SMP(n) is a generalization of SAP. In fact, SMP(1) is exactly the same as SAP. To intuitively show why SMP(n) might represent image quality better, we provide a toy example in Fig. 3. Two $3 \times 3$ feature maps with same mean are shown. One is checkerboard pattern, and the other is solid color. Despite the same means, the $i>1$ central moments differ. \begin{figure}[htb] \includegraphics[width=8cm]{fig2.PNG} \label{fig:example} \caption{The $1^{st}$ moment, $2^{nd}, 3^{rd}, 4^{th}$ central moment of a $3 \times 3$ checkerboard feature map and solid color feature map.} \end{figure} \subsection{Numerical Difficulties and Normalization} Simply elevating SMP(n) to $n \ge 3$ cases can cause severe difficulties when optimizing the network with back-propagation. As shown in Tab.~\ref{tab:ablation}, the training fails and produces NaN results without proper normalization. So we propose to add layer normalization after $i \ge 3$ central moments (See Fig. 2). The rationale of normalizing only $i \ge 3$ is: (1) $SMP(n), n \le 2$ works well without normalization. (2). only the statistical skewness and kurtosis are normalized with $\sigma$, the $\mu$ and $\sigma$ themselves are defined as unnormalized. The reason why to choose layer normalization over others is purely empirical. The comparison of normalization methods is detailed in Section 4.2.2. In the following sections, SMP(n) with $n \ge 3$ implies that $i \ge 3$ moments are layer normalized if no normalization method is specified. \section{Experiments} \subsection{Experiment Setup} The SMP(n) is implemented in Pytorch 1.8, all the experiments are conducted on a computer equipped with Intel Xeon E5-2620 v4 and 8 Nivida TitanXp GPU. Basically, there are two types of datasets for blind IQA. One is large scale, natural datasets without reference images (such as Koniq-10k \cite{hosu2020koniq}). The other is small scale synthetic datasets with reference images and distortion information (such as LIVE \cite{sheikh2006statistical}). Usually the methods designed for small dataset use reference and distortion as auxiliary task, which makes them not applicable to large datasets. Consequently, the sota methods for large and small dataset are different. For large dataset, we choose Koniq-10k as dataset, and HyperIQA \cite{su2020blindly} as current CNN-based sota method. For small dataset we choose LIVE \cite{sheikh2006statistical} and CSIQ \cite{larson2010most} as dataset, and NemgIQA \cite{chen2021nested} as sota method. For ablation study we use Koniq-10k as dataset, and a variant of NIMA \cite{chadha2021deep}\cite{talebi2018nima} as base method. The dataset splits are the same as \cite{su2020blindly} and \cite{chen2021nested}. \subsection{Ablation Study} For baseline, we use an contemporary variant of classical NIMA \cite{talebi2018nima}. As proposed and described in \cite{chadha2021deep}, this variant incorporates the multi-scale spatial average feature maps. To simplify notations in the tables below, we denote this variant as NIMA. We only conduct experiments on VGG16 backbone, as the selection of CNN backbone selection is beyond scope of this paper. \begin{table}[ht] \centering \caption{Ablation study results.} \vspace{2mm} \label{tab:ablation} \begin{tabular}{lcc} \toprule & \multicolumn{2}{c}{Koniq-10k} \\ \cmidrule(l){2-3} & SRCC & PLCC \\ \midrule NIMA \cite{talebi2018nima}\cite{chadha2021deep} / NIMA-SMP(1) & 0.864 & 0.879 \\ NIMA-Vanilla-Large & 0.864 & 0.874 \\ NIMA-SMP(2) & 0.886 & 0.896 \\ NIMA-SMP(4)-w/o-Norm & NaN & NaN \\ NIMA-SMP(4)-BatchNorm & 0.880 & 0.892 \\ NIMA-SMP(4)-MaxNorm & 0.888 & 0.899 \\ NIMA-SMP(4)-LayerNorm & \textbf{0.890} & \textbf{0.900} \\ \bottomrule \end{tabular} \end{table} \subsubsection{Effects of spatial moment pooling} Tab.~\ref{tab:ablation} shows that NIMA-SMP(2) evidently improves both PLCC and SRCC over NIMA. NIMA-SMP(4)-LayerNorm outperforms SMP(2) despite the gain is not as significant as NIMA-SMP(2) over NIMA. Therefore, we stop at $n=4$ considering that the moments higher than $4^{th}$ are also uncommon in statistics. \subsubsection{Effects of high moments normalization} Simply expanding NIMA-SMP(2) to NIMA-SMP(4)-w/o-Norm brings optimization difficulties. After several iterations of training, the network produces constant results regardless of input images. And such constant output has $0$ variance, which further leads to NaN in PLCC and SRCC (See Tab.~\ref{tab:ablation}). Although the NaNs can be eliminated by introducing batch normalization to $3^{rd}, 4^{th}$ moments, it also brings performance decay. The NIMA-SMP(4)-BatchNorm is outperformed by NIMA-SMP(2), this confirms the observations that batch normalization negatively effects scale sensitive low level computer vision tasks \cite{yu2018wide}. Empirically, we find that max and layer normalization enable NIMA-SMP(4) to produce a reasonably superior performance over NIMA-SMP(2). Moreover, NIMA-GMP(4)-LayerNorm outperforms all other methods. \subsubsection{Effects of network parameter increment} The SMP's increment of parameters is of no significance. For NIMA-SMP(4)-LayerNorm, the parameter is increased by $0.20\%$ compared with NIMA. And for NIMA-SMP(2), the parameter increase is only $0.068\%$. Moreover, the increment of MACs is also minimal. The base model NIMA has a MAC of 635.23G Mac (multiply-accumulate) when input image size is 3x1920x1080. Replacing last pooling with SMP-(2) brings 1.02M extra Macs. And replacing last pooling with SMP-(4) brings 3.03M extra Macs. To fully verify the performance improvement comes from SMP instead of parameter increase, we build NIMA-Vanillia-Large with much wider and deeper regression head. NIMA-Vanillia-Large increases the parameter by as much as $14.74\%$. However, Tab.~\ref{tab:ablation} shows that the performance does not benefit from na\"ive model size increase. \subsection{Results on Large Dataset} \begin{table}[ht] \centering \caption{Results on Koniq-10K datasets. Blue and black numbers in bold represent the best and second best respectively. Reference methods' results are sourced from \cite{chen2021nested}\cite{ke2021musiq}.} \vspace{2mm} \label{tab:large} \begin{tabular}{lcc} \toprule & \multicolumn{2}{l}{Koniq-10K} \\ \cmidrule(l){2-3} & SRCC & PLCC \\ \midrule \multicolumn{3}{l}{\textit{DCNN based methods}} \\ BIECON \cite{kim2016fully} & 0.618 & 0.651 \\ PQR \cite{zeng2018blind} & 0.880 & 0.884 \\ SFA \cite{li2018has} & 0.856 & 0.872 \\ NIMA \cite{talebi2018nima} & 0.864 & 0.879 \\ DBCNN \cite{zhang2018blind} & 0.875 & 0.884 \\ HyperIQA \cite{su2020blindly} & 0.906 & 0.917 \\ \midrule \multicolumn{3}{l}{\textit{DCNN + SMP based methods}} \\ HyperIQA-SMP(2) & \textbf{0.909} & \textbf{0.924} \\ HyperIQA-SMP(4) & \textbf{0.909} & 0.922 \\ \midrule \multicolumn{3}{l}{\textit{Transformer based methods}} \\ MUSIQ-Singlescale & 0.905 & 0.919 \\ MUSIQ-Multiscale & \textcolor{blue}{\textbf{0.916}} & \textcolor{blue}{\textbf{0.928}} \\ \bottomrule \end{tabular} \end{table} For HyperIQA on large dataset, we replace the global average pooling in local distortion aware modules. Moreover, we set the learning rate to $1 \times 10^{-5}$. The other settings are identical to original HyperIQA \cite{su2020blindly}. Results in Tab.~\ref{tab:large} show that such modification effectively improves HyperIQA, and a new sota of deep CNN based approaches is made. Notably, our HyperIQA-SMP(2) and SMP(4) are superior to the transformer with single scale image patch input. Although the multi-scale transformer outperforms SMP methods, it is not quite fair to draw comparison as MUSIQ-Multiscale requires multi-scale image inputs. We also note that it is possible to train HyperIQA-SMP(n) with multi-scale image crops, but the effects of single-scale and multi-scale input is beyond the scope of this paper. \subsection{Results on Small Dataset} \begin{table}[h] \centering \caption{Results on LIVE and CSIQ datasets. Blue and black numbers in bold represent the best and second best respectively. Reference methods' results are sourced from \cite{chen2021nested}\cite{ke2021musiq}.} \vspace{2mm} \label{tab:my-table} \begin{tabular}{lcccc} \toprule & \multicolumn{2}{c}{LIVE} & \multicolumn{2}{c}{CSIQ} \\ \cmidrule(l){2-3} \cmidrule(l){4-5} & SRCC & PLCC & SRCC & PLCC \\ \midrule \multicolumn{5}{l}{\textit{DCNN based methods}} \\ BIECON \cite{kim2016fully} & 0.963 & 0.965 & 0.837 & 0.858 \\ PQR \cite{zeng2018blind} & 0.965 & 0.971 & 0.873 & 0.901 \\ SGDNet \cite{yang2019sgdnet} & 0.961 & 0.964 & 0.878 & 0.909 \\ HyperIQA \cite{su2020blindly} & 0.961 & 0.963 & 0.914 & 0.927 \\ NemgIQA \cite{chen2021nested} & 0.971 & 0.975 & 0.923 & 0.934 \\ \midrule \multicolumn{5}{l}{\textit{DCNN + SMP based methods}} \\ NemgIQA-SMP(1) & 0.972 & 0.978 & 0.921 & 0.937 \\ NemgIQA-SMP(2) & \textbf{0.973} & \textbf{0.980} & \textcolor{blue}{\textbf{0.929}} & \textbf{0.942} \\ NemgIQA-SMP(4) & \textcolor{blue}{\textbf{0.976}} & \textcolor{blue}{\textbf{0.982}} & \textbf{0.924} & \textcolor{blue}{\textbf{0.945}} \\ \bottomrule \end{tabular} \end{table} For NemgIQA on small dataset, it is not possible to directly replace last global average pooling with SMP. Unlike other works with regression performed after pooling, NemgIQA uses a single channel output point wise convolution as regression head followed by pooling. To make SMP usable, we swap the order of pooling and regression back. To be speficic, we change last layers to: point wise regression with output channels 4, pooling, and an affine layer to produce score. The other settings are the same as original NemgIQA \cite{chen2021nested}. Due to such modifications NemgIQA-SMP(1) is not strictly equivalent to original NemgIQA. However, experimental results show that this does not effects its performance. Moreover, the NemgIQA-SMP(2) and NemgIQA-SMP(4) significantly improve PLCC and SRCC compared to both original NemgIQA and NemgIQA-SMP(1), and achieve sota performance on LIVE and CSIQ datasets. \section{Conclusion} In this paper, we extend spatial average pooling (SAP) into spatial moment pooling (SMP) by adding higher order moments. Moreover, we propose an optimization friendly normalization trick that makes training of network with SMP stable. Experimental results show that replacing SAP with SMP significantly improves deep CNN-based blind IQA approaches. \bibliographystyle{IEEEbib}
{'timestamp': '2022-09-30T02:08:32', 'yymm': '2209', 'arxiv_id': '2209.14583', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14583'}
arxiv
\section{Introduction} The Weibull distribution, with probability density function \begin{align} \label{eqn:pdf} p(y | \bm{\theta}) = \left(\frac{k}{\lambda^k}\right) y^{k-1} \exp\left(-\left(\frac{y}{\lambda}\right)^k\right) , \end{align} where $\bm{\theta} = \{k,\lambda\}$ and $k>0$ is the shape parameter and $\lambda>0$ is the scale parameter, is a popular distribution in analysis of survival data. Given data ${\bf y} = (y_1, \ldots, y_n)^\prime$, a common approach to estimate Weibull parameters $\bm{\theta}$ is the method of maximum likelihood where the parameters are set to values that maximise the log-likelihood of the data \begin{equation} \label{eqn:complete:nll} \ell(\bm{\theta}) = -n \log \left(\frac{\lambda^k}{k}\right) + (k-1) \left(\sum_{i=1}^n \log y_i\right) - \sum_{i=1}^n \left(\frac{y_i}{\lambda}\right)^k \end{equation} In this setting, the maximum likelihood (ML) estimates of $k,\lambda$ are \begin{equation} \label{eqn:ml:k} \hat{\lambda}^{k}({\bf y}) = \frac{1}{n} \sum_{i=1}^n y_i^{k}, \end{equation} where $\hat{k}({\bf y})$ is defined implicitly \begin{equation} \label{eqn:ml:lambda} \frac{n}{k} + \sum_{i=1}^n \log y_i - \frac{n \sum_i y_i^k \log y_i}{\sum_i y_i^k} = 0 \end{equation} and must therefore be obtained by numerical optimisation. It is well known that the maximum likelihood estimate of the shape parameter $k$ is biased for small sample sizes. Ross~\cite{Ross94} derived a simple adjustment formula for the ML estimate of $k$ \begin{equation} \label{eqn:mle:kross} \hat{k}_{\rm R}({\bf y}) = \left(\frac{n-2}{n-0.68}\right) \hat{k}_{\rm ML}({\bf y}) , \end{equation} which aims to reduce the bias and later extended his approach to censored data~\cite{Ross96}. Hirose~\cite{Hirose99} proposed an alternative bias correction method for data with no censoring that was derived by fitting a non-linear function to simulation results. Teimouri and Nadarajah~\cite{TeimouriNadarajah13} develop improved maximum likelihood estimates for the Weibull distribution based on record statistics. In contrast, Yang and Xie~\cite{YangXie03} use the modified profile likelihood proposed by Cox and Reid~\cite{CoxReid87,CoxReid92} to derive an alternative maximum likelihood estimate of $k$ (MLC) from \begin{equation} \label{eqn:ml:yangxie} \frac{n-2}{k} + \sum_{i=1}^n \log y_i - \frac{n \sum_i y_i^k \log y_i}{\sum_i y_i^k} = 0. \end{equation} Using simulations, Yang and Xie showed that their estimate of $k$ is less biased than the ML estimate and more efficient than the estimate (\ref{eqn:mle:kross}) proposed by Ross. In a follow-up paper, Shen and Yang~\cite{ShenYang15} developed a profile maximum likelihood estimate of $k$ for complete and censored samples and showed that it outperforms MLC in simulations with complete data. \subsection{Type I Censored Data} In survival analysis, one commonly does not observe complete data and instead has joint realisations of the random variables $(Y = y, \Delta = \delta)$ where $Y = \min (T, c)$ and \begin{eqnarray*} \Delta &=& {\rm I}(T \leq c) = \begin{cases} 1, & \text{if } T \leq c \; ({\rm observed\; survival})\\ 0, & \text{if } T > c \; ({\rm observed\; censoring}) \end{cases} \end{eqnarray*} where the random variable $T$ denotes survival time and $c > 0$ is the fixed censoring time. The data comprises the survival time $T=t$ of an item if this is less than the corresponding censoring time $c$ (i.e., $T \leq c$); otherwise, we only know that the item survived beyond time $c$ (i.e., $T > c$). The log-likelihood of data $D = \{(y_1, \delta_1), \ldots, (y_n, \delta_n)\}$ under type I censoring is \begin{align} \ell(\bm{\theta}) &= d \log \left(\frac{k}{\lambda^k}\right) -\frac{1}{\lambda^k} \sum_{i=1}^n y_i^k + \sum_{i=1}^n \log y_i^{\delta_i (k-1)} \label{eqn:censored:nll} \end{align} where $d = \sum_{i=1}^n \delta_i$. The maximum likelihood (ML) estimates of $k,\lambda$ are \begin{equation} \hat{\lambda}^{k}({\bf y}) = \frac{1}{d} \sum_{i=1}^n y_i^{k}, \end{equation} where $\hat{k}({\bf y})$ is obtained from \begin{equation} \label{eqn:mle:censored:kscore} \frac{d}{k} + \sum_{i=1}^n \delta_i \log y_i - \frac{d \sum_i y_i^k \log y_i}{\sum_i y_i^k} = 0 \, . \end{equation} As with the case of complete data, the maximum likelihood estimate of $k$ with type I censored data has large bias in small samples and for large amounts of censoring. Based on the modified profile likelihood, Yang and Xie~\cite{YangXie03} propose an alternative estimate of $k$ \begin{equation} \label{eqn:ml:yangxie:censored} \frac{d-1}{k} + \sum_{i=1}^n \delta_i \log y_i - \frac{d \sum_i y_i^k \log y_i}{\sum_i y_i^k} = 0. \end{equation} We note that the above score function requires $d>1$ to yield a positive estimate for $k$. Yang and Xie demonstrate that the proposed estimate of $k$ is less biased and more efficient than the regular maximum likelihood estimate. Shen and Yang~\cite{ShenYang15} derived a new second- and third-order bias correction formula for the shape parameter of the Weibull distribution without censoring and with general right-censoring models. Although the new estimate is shown to be effective in correcting bias, it must be computed through bootstrap simulation. The same procedure was later extended to include Weibull regression with complete and general right censoring~\cite{ShenYang17}. More recently, Choi et al~\cite{ChoiEtAl20} examine a different problem of Weibull parameter overestimation caused by mass occurrences of (censored) events in the early time period and develop an expectation maximization (EM) algorithm to reduce bias. \section{A simple adjustment to maximum likelihood estimates to reduce estimation bias} In a landmark paper, Cox and Snell~\cite{CoxSnell68} derived an approximation to the finite sample bias of ML estimates for independent, but not necessarily identically distributed, data. Let $\bm{\theta} \in \mathbb{R}^p$, where $p > 0$ is the number of free parameters, which is $p=2$ in the case of the Weibull model. Cox and Snell showed that the bias for the $s$-th element of the ML estimate $\hat{\theta}_{\rm ML}$ can be written as \begin{equation} \left[ \text{Bias}(\hat{\theta}_{\rm ML}) \right]_{s} = \sum_{i=1}^p \sum_{j=1}^p \sum_{l=1}^p \kappa^{s,i} \kappa^{j,l} \left( \frac{1}{2} \kappa_{ijl} + \kappa_{ij,l}\right) + O(n^{-2}) \end{equation} for $s = 1,\ldots,p$, where the cumulants are \begin{align} \kappa_{ij} &= \mathbb{E}\left\{ \frac{\partial^2 \ell(\bm{\theta})}{\partial \theta_i \partial \theta_j} \right\}, \quad % \kappa_{ijl} = \mathbb{E}\left\{ \frac{\partial^3 \ell(\bm{\theta})}{\partial \theta_i \partial \theta_j \partial \theta_l} \right\}, \\ % \kappa_{ij,l} &= \mathbb{E}\left\{ \frac{\partial^2 \ell(\bm{\theta})}{\partial \theta_i \partial \theta_j} \frac{\partial \ell(\bm{\theta})}{\partial \theta_l}\right\}, \end{align} for $i,j = 1,\ldots, p$ and $\kappa^{i,j}$ is the $(i,j)$-th entry of the \emph{inverse} of the expected Fisher information matrix ${\bf K} = \{ -\kappa_{ij} \}$. Following Cordeiro and Klein~\cite{CordeiroKlein94}, we can compactly write this in matrix notation as \begin{equation} \label{eqn:CoxSnell} \text{Bias}(\hat{\theta}_{\rm ML}) = {\bf K}^{-1} {\bf A} \text{vec}({\bf K}^{-1}) + O(n^{-2}), \end{equation} where the matrix ${\bf A}$ is the $(p \times p^2)$ matrix given by \begin{align} \label{eq:Cordeiro:Klein:A} {\bf A} &= \left[ {\bf A}^{(1)} | {\bf A}^{(2)} | \cdots | {\bf A}^{(p)} \right], \quad {\bf A}^{(l)} = \{a_{ij}^{(l)} \} \\ \quad a_{ij}^{(l)} &= \kappa_{ij}^{(l)} - \frac{1}{2} \kappa_{ijl}, \quad \kappa_{ij}^{(l)} = \frac{\partial \kappa_{ij}}{ \partial \theta_l} \end{align} for $i,j,l = 1,\ldots, p$. The ML estimate with reduced bias $\bm{\tilde{\theta}}_{\rm ML}$ is then \begin{align} \nonumber \bm{\tilde{\theta}}_{\rm ML} &= \hat{\bm{\theta}}_{\rm ML} - \hat{\bf K}^{-1} \hat{\bf A} \text{vec}(\hat{\bf K}^{-1}), \\ \label{eqn:ml:bias:adjustment} &= \hat{\bm{\theta}}_{\rm ML} - \text{Bias}(\hat{\theta}_{\rm ML}) , \end{align} where $\hat{\bf K}$ and $\hat{\bf A}$ are evaluated at the usual maximum likelihood estimate $\hat{\bm{\theta}}_{\rm ML}$. A benefit of this bias approximation formula is that it can be computed even if the maximum likelihood estimate is not available in closed form. A similar approach to the above was used to derive bias-adjusted maximum likelihood estimates for the unit Weibull distribution~\cite{MenezesEtAl21} and the inverse Weibull distribution~\cite{MazucheliEtAl18} with complete data only. \begin{thm} \label{thm:jointpdf} The finite sample bias of the maximum likelihood estimate (\ref{eqn:ml:k}) for the Weibull distribution with complete data is \begin{align} \text{\rm Bias}(\hat{k}_{\rm ML}) &= k \left(\frac{18 \left(\pi ^2-2 \zeta (3)\right)}{n \pi ^4}\right) + O(n^{-2})\\ &\approx k \left(\frac{1.3795}{n}\right) \label{eqn:ml:k:adjusted} \end{align} where $\zeta(\cdot)$ is the Riemann zeta function and $\gamma \approx 0.5772$ is the Euler--Mascheroni constant. Maximum likelihood estimates of $k$ and $\lambda$ with reduced bias can be obtained from (\ref{eqn:ml:bias:adjustment}). \begin{proof} The proof involves the application of the Cordeiro and Klein~\cite{CordeiroKlein94} approach, given by (\ref{eqn:CoxSnell}) and (\ref{eq:Cordeiro:Klein:A}), to the Weibull distribution (\ref{eqn:pdf}). It is well known that expected Fisher information matrix for the Weibull distribution is \begin{align*} {\bf K} &= \left( \begin{array}{cc} \frac{\left(6 (\gamma -1)^2+\pi ^2\right) n}{6 k^2} & \frac{(\gamma -1) n}{\lambda } \\ \frac{(\gamma -1) n}{\lambda } & \frac{k^2 n}{\lambda ^2} \\ \end{array} \right), \\ {\bf K}^{-1} &= \left( \begin{array}{cc} \frac{6 k^2}{\pi ^2 n} & -\frac{6 (\gamma -1) \lambda }{\pi ^2 n} \\ -\frac{6 (\gamma -1) \lambda }{\pi ^2 n} & \frac{\left(6 (\gamma -1)^2+\pi ^2\right) \lambda ^2}{\pi ^2 k^2 n} \\ \end{array} \right) . \end{align*} By direct calculation, we can show that the matrix ${\bf A}$ is \begin{equation*} \left( \begin{array}{cccc} \frac{n \left(-12 \zeta (3)-3 \gamma \left(2 \gamma (\gamma -7)+\pi ^2+16\right)+7 \pi ^2+12\right)}{12 k^3} & -\frac{\left(6 \gamma (\gamma -4)+\pi ^2+12\right) n}{12 k \lambda } & -\frac{\left(6 \gamma (\gamma -4)+\pi ^2+12\right) n}{12 k \lambda } & \frac{(-\gamma k+3 k+\gamma -1) n}{2 \lambda ^2} \\ -\frac{\left(6 \gamma (\gamma -4)+\pi ^2+12\right) n}{12 k \lambda } & -\frac{(\gamma k+k+\gamma -1) n}{2 \lambda ^2} & \frac{(-\gamma k+3 k+\gamma -1) n}{2 \lambda ^2} & -\frac{(k-1) k^2 n}{2 \lambda ^3} \\ \end{array} \right) \end{equation*} Substituting ${\bf K}^{-1}$ and ${\bf A}$ into (\ref{eqn:CoxSnell}) and simplifying completes the proof. \end{proof} \end{thm} We observe that the maximum likelihood estimate of $k$ is biased upward for any finite $n$. An advantage of the proposed bias adjusted estimate is that it can readily be computed in any software that implements ML Weibull estimation. \begin{thm} \label{thm:typeI} The finite sample bias of the maximum likelihood estimate (\ref{eqn:ml:k}) for the Weibull distribution with type I censored data is \begin{align} \text{\rm Bias}(\hat{k}_{\rm ML}) &= k\left(\frac{f(p)}{n}\right) + O(n^{-2}) \end{align} where $f(p)$ is a somewhat lengthy and complicated function of the proportion of uncensored observations $p = 1-\exp(-\left(c/\lambda )\right)^k)$. A simple approximation to $f(p)$ based on rational functions is \begin{equation*} f(p) \approx \frac{-580.684 p^3+4690.74 p^2-20743.7 p+18830}{-17026.8 p^2+18804.5 p+1} \end{equation*} with the absolute approximation error being less than $0.003$ for all $0.05 \leq p \leq 0.95$. As with complete data, maximum likelihood estimate of $k$ with reduced bias can be obtained from (\ref{eqn:ml:bias:adjustment}). \end{thm} \begin{figure}[t] \begin{center} \includegraphics[width=6.0cm]{figs/bias_function.pdf} \end{center} \caption{Bias adjustment $f(p)$ for the maximum likelihood estimate of the Weibull distribution shape parameter $k$ of as a function of the proportion of uncensored observations $p=1-\exp(-(c/\lambda)^k)$. \label{fig:biasf}} \end{figure} The proof is straightforward involving the application of the Cordeiro and Klein~\cite{CordeiroKlein94} bias adjustment formulation to the Weibull distribution with type I censoring and is therefore omitted. Figure~\ref{fig:biasf} shows the bias adjustment $f(p)$ as a function of the proportion of uncensored observations $p$. As the proportion of uncensored observations $p \to 1$ (ie, no censoring), $f(p) \to (\approx) 1.3795$ as expected. Additionally, $f(p) \to \infty$ as the proportion of censored data is increased (ie, $p \to 0$). \subsection{Simulation} \label{eqn:sim} \begin{table*}[ht] \scriptsize \begin{center} \begin{tabular}{cccccccccccccccc} \toprule $n$ & $k^*$ & \multicolumn{4}{c}{Bias} & & \multicolumn{4}{c}{Mean Squared Error} & & \multicolumn{4}{c}{KL divergence}\\ & & ML & MLC & MLP & MMLE & ~ & ML & MLC & MLP & MMLE & ~ & ML & MLC & MLP & MMLE\\ \cmidrule{1-16} \multirow{4}{*}{10} & 0.5 & 0.085 & 0.008 & {\bf 0.001} & 0.004 & & 0.038 & 0.023 & {\bf 0.022} & 0.023 & & 0.268 & 0.169 & {\bf 0.164} & 0.165\\ & 1.0 & 0.170 & 0.017 & {\bf 0.002} & 0.009 & & 0.151 & 0.092 & {\bf 0.089} & 0.090 & & 0.272 & 0.169 & 0.164 & {\bf 0.158}\\ & 5.0 & 0.852 & 0.088 & {\bf 0.014} & 0.045 & & 3.775 & 2.305 & {\bf 2.241} & 2.268 & & 0.264 & 0.167 & 0.162 & {\bf 0.152}\\ & 10.0 & 1.701 & 0.172 & {\bf 0.026} & 0.087 & & 15.102 & 9.218 & {\bf 8.978} & 9.079 & & 0.266 & 0.168 & 0.164 & {\bf 0.153}\\ \vspace{-2mm} \\ \cmidrule{2-16} \vspace{-2mm} \\ \multirow{4}{*}{20} & 0.5 & 0.038 & 0.004 & {\bf 0.001} & 0.001 & & 0.012 & 0.009 & {\bf 0.009} & 0.009 & & 0.072 & 0.061 & {\bf 0.060} & 0.061\\ & 1.0 & 0.077 & 0.009 & {\bf 0.001} & 0.003 & & 0.048 & 0.037 & {\bf 0.037} & 0.037 & & 0.072 & 0.061 & 0.060 & {\bf 0.059}\\ & 5.0 & 0.382 & 0.042 & {\bf 0.004} & 0.011 & & 1.203 & 0.928 & {\bf 0.916} & 0.917 & & 0.072 & 0.061 & 0.060 & {\bf 0.058}\\ & 10.0 & 0.755 & 0.075 & {\bf 0.000} & 0.014 & & 4.769 & 3.686 & {\bf 3.636} & 3.639 & & 0.072 & 0.061 & 0.060 & {\bf 0.058}\\ \vspace{-2mm} \\ \cmidrule{2-16} \vspace{-2mm} \\ \multirow{4}{*}{40} & 0.5 & 0.014 & 0.002 & {\bf 0.000} & 0.000 & & 0.004 & 0.003 & 0.003 & {\bf 0.003} & & 0.023 & 0.022 & {\bf 0.022} & 0.022\\ & 1.0 & 0.029 & 0.003 & {\bf -0.000} & 0.000 & & 0.015 & 0.013 & 0.013 & {\bf 0.013} & & 0.023 & 0.021 & 0.021 & {\bf 0.021}\\ & 5.0 & 0.143 & 0.016 & {\bf 0.001} & 0.001 & & 0.367 & 0.329 & 0.328 & {\bf 0.327} & & 0.023 & 0.022 & 0.021 & {\bf 0.021}\\ & 10.0 & 0.290 & 0.036 & {\bf 0.005} & 0.006 & & 1.458 & 1.308 & 1.300 & {\bf 1.299} & & 0.023 & 0.022 & 0.022 & {\bf 0.021}\\ \vspace{-3mm} \\ \bottomrule \vspace{+1mm} \end{tabular} \caption{Bias, mean squared error and Kullback--Leibler (KL) divergence for maximum likelihood (ML), conditional maximum likelihood of Yang and Xie (MLC), profile maximum likelihood of Shen and Yang (MLP) and our bias-adjusted maximum likelihood (MMLE) estimates of $k^*$ computed over $10^5$ simulations runs with $\lambda^* = 1$.\label{tab:results:complete}} \end{center} \end{table*} We performed a simulation to examine the finite sample behaviour of the new bias-adjusted ML estimates of $k$ for both complete and type I censored data. \subsubsection{Complete data} For each run of the simulation, we generated $n$ data points from the model Weibull$(k^*, \lambda^* = 1)$ where $n = \{10, 20, 50\}$ and the shape parameter was set to $k^* \in \{0.5, 1, 5, 10\}$. Maximum likelihood estimates, our proposed bias-adjusted maximum likelihood estimates (MMLE), conditional maximum likelihood estimates (MLC) proposed by Yang and Xie~\cite{YangXie03}, and the profile maximum likelihood estimates of Shen and Yang (MLP)~\cite{ShenYang15} were then computed from the data. We used the second-order bias reduction of Shen and Yang as it was virtually indistinguishable from the third-order formula in our tests. We performed $10^5$ simulations for each combination of $(k^*, n)$ and recorded the average bias, mean squared error and Kullback--Leibler (KL) divergence~\cite{KullbackLeibler51} from the data generating model. In the case of the Weibull distribution, the KL divergence between the data generating model Weibull$(k_0, \lambda_0)$ and approximating model Weibull$(k_1, \lambda_1)$ is \begin{align*} {\rm KL}( k_0, \lambda_0 || k_1, \lambda_1) &= \left(\frac{\lambda_0 }{\lambda _1}\right)^{k_1} \left( \frac{k_1}{k_0} \right) \Gamma \left( \frac{k_1}{k_0} \right) + \left(\frac{k_1}{k_0}-1\right) \gamma \\ &+ \log \left(\frac{k_0}{k_1} \left(\frac{\lambda _1}{\lambda_0 }\right)^{k_1}\right)-1 . \end{align*} All simulation results are shown in Table~\ref{tab:results:complete}. All three bias-adjusted maximum likelihood estimates of $k$ result in a significant reduction in bias compared to the usual ML estimate. Compared to MLC, our estimate yields improved mean squared error and KL divergence, especially as $k$ increases. The profile maximum likelihood estimate has a slightly smaller bias than our estimate, while the mean squared error and the KL divergence for the two estimates are virtually identical. Unlike both the MLC and MLP estimates, our bias-adjusted maximum likelihood estimate of $k$ is simple to compute in software via existing Weibull ML estimation procedures and does not require the use of the parametric bootstrap. \subsubsection{Type I censored data} For each run of the simulation, we generated $n$ data points from the model Weibull$(k^*, \lambda^* = 1)$ where $n = \{10, 20, 50\}$ and the shape parameter was set to $k^* \in \{0.5, 1, 5, 10\}$. The proportion of uncensored observations was set to $p \in \{0.3, 0.5, 0.7, 0.9\}$. In addition to the bias and the mean squared error in estimating the shape parameter, we computed the Kullback--Leibler (KL) divergence~\cite{KullbackLeibler51} between the data generating model and each estimated model: the KL divergence between two Weibull models Weibull($k_0, \lambda_0$) and Weibull($k_1, \lambda_1$) is \begin{align*} \label{eqn:weibull:kl} {\rm KL}( k_0, \lambda_0 || k_1, \lambda_1) &= \exp(-\left(c/\lambda_0\right)^{k_0}) A_1 + \left(\frac{\lambda_0 }{\lambda _1}\right)^{k_1} A_2 \\ &+ \left(1-\frac{k_1}{k_0}\right) A_3 +\log \left(\frac{k_0}{k_1} \left(\frac{\lambda _1}{\lambda_0 }\right)^{k_1}\right)-1 , \end{align*} where \begin{align*} A_1 &= \log \left(\frac{k_1 }{k_0}c^{k_1-k_0} \lambda_0^{k_0} \lambda_1^{-k_1}\right)+\left(\frac{c}{\lambda _1}\right){}^{k_1}+1 ,\\ A_2 &= \Gamma \left(\frac{k_1}{k_0}+1\right)-\Gamma \left(\frac{k_1}{k_0}+1,\left(\frac{c}{\lambda }\right)^k\right) , \\ A_3 &= \text{Ei}\left(-\left(\frac{c}{\lambda_0 }\right)^{k_0}\right)-\gamma , \end{align*} and $\text{Ei}(\cdot)$ is the exponential integral function \begin{equation} \text{Ei}(z) = -\int_{-z}^\infty \frac{\exp(-t)}{t} \, dt . \end{equation} The newly proposed bias adjustment estimate of $k$ (MMLE) was again compared to the standard ML estimate, the conditional maximum likelihood estimate (MLC) proposed by Yang and Xie~\cite{YangXie03} and the profile maximum likelihood estimate (MLP) of Shen and Yang~\cite{ShenYang15}. The third-order profile maximum likelihood estimate had issues with numerical stability for small $n$ and large amounts of censoring sometimes resulting in a negative estimate of $k^*$, hence all the comparisons were made with the second-order variant. We restricted the experiments to exclude data sets where the number of uncensored observations $d (=\sum_i \delta_i) < 2$, as MLC may result in negative estimates of $k$ for $d < 2$. The results of these simulations, averaged over $10^5$ runs for each combination of $(n,p,k^*)$, are shown in Table~\ref{tab:results:censored}. We observe that our MMLE estimate of $k$ is more efficient and less biased than the standard ML of $k$ for all tested values of $(n,p,k^*)$. The conditional maximum likelihood estimate of $k$ is, in general, more biased and has higher mean squared error compared to the MLP and our MMLE estimates. In terms of bias reduction, the profile maximum likelihood estimate of $k$ is virtually identical to our MMLE for $n \geq 30$. For small sample sizes ($n = 20$) and higher levels of censoring ($p \leq 0.5$), the MMLE estimate appears superior to MLC and MLP in terms of bias, mean squared error and KL divergence. Additionally, our MMLE estimate is easily computed without the need for numerical simulation in any software that implements fitting of the Weibull distribution to complete and type I censored data. \begin{table*}[tbph] \scriptsize \begin{center} \begin{tabular}{ccccccccccccccccccccc} \toprule $n$ & $p$ & $k^*$ & \multicolumn{4}{c}{Bias} & & \multicolumn{4}{c}{Mean Squared Error} & & \multicolumn{4}{c}{KL Divergence} \\ & & & ML & MLC & MLP & MMLE & ~ & ML & MLC & MLP & MMLE & ~ & ML & MLC & MLP & MMLE \\ \multirow{16}{*}{20} & \multirow{4}{*}{ 0.3} & 0.5 & 0.115 & 0.021 & 0.004 & {\bf 0.002} & & 0.220 & 0.150 & 0.090 & {\bf 0.090} & & 0.070 & 0.060 & 0.062 & {\bf 0.053}\\ & & 1.0 & 0.228 & 0.040 & 0.005 & {\bf -0.001} & & 0.605 & 0.401 & 0.303 & {\bf 0.301} & & 0.070 & 0.060 & 0.061 & {\bf 0.053}\\ & & 5.0 & 1.156 & 0.214 & 0.033 & {\bf 0.008} & & 14.757 & 9.683 & 7.292 & {\bf 7.248} & & 0.070 & 0.061 & 0.061 & {\bf 0.053}\\ & & 10.0 & 2.251 & 0.374 & 0.058 & {\bf -0.007} & & 55.591 & 36.196 & 32.112 & {\bf 28.799} & & 0.070 & 0.062 & 0.061 & {\bf 0.054}\\ & \multirow{4}{*}{ 0.5} & 0.5 & 0.051 & {\bf 0.001} & 0.001 & -0.003 & & 0.037 & 0.028 & 0.028 & {\bf 0.028} & & 0.059 & 0.056 & 0.053 & {\bf 0.051}\\ & & 1.0 & 0.108 & 0.007 & 0.008 & {\bf 0.000} & & 0.144 & 0.109 & 0.110 & {\bf 0.108} & & 0.059 & 0.055 & 0.052 & {\bf 0.051}\\ & & 5.0 & 0.556 & 0.051 & 0.053 & {\bf 0.014} & & 3.672 & 2.785 & 2.785 & {\bf 2.738} & & 0.060 & 0.056 & 0.053 & {\bf 0.051}\\ & & 10.0 & 1.095 & 0.084 & 0.085 & {\bf 0.009} & & 15.172 & 11.561 & 11.571 & {\bf 11.377} & & 0.060 & 0.056 & 0.053 & {\bf 0.051}\\ & \multirow{4}{*}{ 0.7} & 0.5 & 0.034 & {\bf -0.002} & 0.003 & -0.003 & & 0.019 & {\bf 0.015} & 0.016 & 0.016 & & 0.056 & 0.054 & {\bf 0.051} & 0.051\\ & & 1.0 & 0.075 & 0.003 & 0.013 & {\bf 0.002} & & 0.081 & {\bf 0.065} & 0.068 & 0.066 & & 0.058 & 0.055 & {\bf 0.052} & 0.052\\ & & 5.0 & 0.381 & 0.023 & 0.075 & {\bf 0.017} & & 2.048 & {\bf 1.660} & 1.730 & 1.676 & & 0.058 & 0.055 & {\bf 0.052} & 0.052\\ & & 10.0 & 0.681 & {\bf -0.028} & 0.073 & -0.042 & & 7.474 & {\bf 6.122} & 6.363 & 6.181 & & 0.056 & 0.053 & {\bf 0.050} & 0.050\\ & \multirow{4}{*}{ 0.9} & 0.5 & 0.032 & {\bf 0.001} & 0.012 & 0.001 & & 0.013 & 0.011 & 0.012 & {\bf 0.011} & & 0.062 & 0.058 & 0.054 & {\bf 0.054}\\ & & 1.0 & 0.063 & {\bf 0.001} & 0.023 & 0.002 & & 0.051 & 0.042 & 0.045 & {\bf 0.042} & & 0.062 & 0.058 & 0.054 & {\bf 0.054}\\ & & 5.0 & 0.314 & {\bf 0.001} & 0.111 & 0.008 & & 1.320 & {\bf 1.082} & 1.165 & 1.083 & & 0.061 & 0.057 & 0.054 & {\bf 0.054}\\ & & 10.0 & 0.632 & {\bf 0.006} & 0.226 & 0.019 & & 5.306 & {\bf 4.346} & 4.680 & 4.349 & & 0.062 & 0.058 & 0.054 & {\bf 0.054}\\ \vspace{-2mm} \\ \cmidrule{2-17} \vspace{-2mm} \\ \multirow{16}{*}{20} & \multirow{4}{*}{ 0.3} & 0.5 & 0.114 & 0.020 & 0.003 & {\bf -0.000} & & 0.262 & 0.177 & 0.185 & {\bf 0.102} & & 0.070 & 0.061 & 0.061 & {\bf 0.053}\\ & & 1.0 & 0.231 & 0.042 & 0.006 & {\bf 0.001} & & 0.756 & 0.504 & 0.339 & {\bf 0.337} & & 0.071 & 0.061 & 0.062 & {\bf 0.053}\\ & & 5.0 & 1.149 & 0.207 & 0.036 & {\bf 0.002} & & 16.835 & 11.123 & 9.821 & {\bf 7.900} & & 0.070 & 0.061 & 0.061 & {\bf 0.053}\\ & & 10.0 & 2.312 & 0.427 & 0.108 & {\bf 0.014} & & 82.069 & 54.570 & 59.320 & {\bf 37.053} & & 0.070 & 0.062 & 0.061 & {\bf 0.053}\\ & \multirow{4}{*}{ 0.5} & 0.5 & 0.054 & 0.003 & 0.003 & {\bf -0.000} & & 0.037 & 0.028 & 0.028 & {\bf 0.028} & & 0.059 & 0.056 & 0.053 & {\bf 0.051}\\ & & 1.0 & 0.109 & 0.008 & 0.008 & {\bf 0.000} & & 0.151 & 0.115 & 0.114 & {\bf 0.112} & & 0.060 & 0.056 & 0.053 & {\bf 0.051}\\ & & 5.0 & 0.534 & 0.030 & 0.029 & {\bf -0.009} & & 3.720 & 2.843 & 2.826 & {\bf 2.780} & & 0.060 & 0.056 & 0.053 & {\bf 0.051}\\ & & 10.0 & 1.091 & 0.081 & 0.080 & {\bf 0.004} & & 15.178 & 11.578 & 11.507 & {\bf 11.321} & & 0.060 & 0.056 & 0.053 & {\bf 0.051}\\ & \multirow{4}{*}{ 0.7} & 0.5 & 0.036 & 0.001 & 0.006 & {\bf 0.000} & & 0.020 & {\bf 0.016} & 0.017 & 0.016 & & 0.057 & 0.055 & {\bf 0.051} & 0.052\\ & & 1.0 & 0.072 & 0.001 & 0.011 & {\bf -0.000} & & 0.078 & {\bf 0.064} & 0.067 & 0.065 & & 0.057 & 0.055 & {\bf 0.051} & 0.052\\ & & 5.0 & 0.366 & 0.009 & 0.061 & {\bf 0.003} & & 1.990 & {\bf 1.619} & 1.692 & 1.640 & & 0.058 & 0.055 & {\bf 0.052} & 0.052\\ & & 10.0 & 0.724 & 0.012 & 0.114 & {\bf -0.002} & & 7.781 & {\bf 6.334} & 6.608 & 6.408 & & 0.057 & 0.054 & {\bf 0.051} & 0.051\\ & \multirow{4}{*}{ 0.9} & 0.5 & 0.031 & {\bf 0.000} & 0.011 & 0.001 & & 0.013 & 0.011 & 0.012 & {\bf 0.011} & & 0.062 & 0.058 & 0.054 & {\bf 0.054}\\ & & 1.0 & 0.063 & {\bf 0.001} & 0.023 & 0.002 & & 0.053 & {\bf 0.043} & 0.047 & 0.043 & & 0.062 & 0.058 & 0.054 & {\bf 0.054}\\ & & 5.0 & 0.309 & -0.004 & 0.106 & {\bf 0.003} & & 1.298 & {\bf 1.066} & 1.146 & 1.066 & & 0.061 & 0.057 & 0.054 & {\bf 0.054}\\ & & 10.0 & 0.632 & {\bf 0.006} & 0.225 & 0.019 & & 5.283 & 4.332 & 4.662 & {\bf 4.332} & & 0.061 & 0.058 & 0.054 & {\bf 0.054}\\ \vspace{-2mm} \\ \cmidrule{2-17} \vspace{-2mm} \\ \multirow{16}{*}{30} & \multirow{4}{*}{ 0.3} & 0.5 & 0.065 & 0.007 & {\bf 0.001} & -0.001 & & 0.056 & 0.041 & 0.037 & {\bf 0.037} & & 0.042 & 0.038 & 0.038 & {\bf 0.034}\\ & & 1.0 & 0.133 & 0.016 & 0.004 & {\bf -0.000} & & 0.336 & 0.257 & 0.262 & {\bf 0.179} & & 0.042 & 0.039 & 0.038 & {\bf 0.034}\\ & & 5.0 & 0.653 & 0.068 & 0.009 & {\bf -0.009} & & 5.621 & 4.184 & 3.907 & {\bf 3.788} & & 0.041 & 0.038 & 0.038 & {\bf 0.034}\\ & & 10.0 & 1.334 & 0.161 & 0.045 & {\bf 0.008} & & 23.086 & 17.180 & 16.069 & {\bf 15.252} & & 0.042 & 0.038 & 0.038 & {\bf 0.034}\\ & \multirow{4}{*}{ 0.5} & 0.5 & 0.034 & 0.001 & 0.002 & {\bf -0.000} & & 0.020 & {\bf 0.017} & 0.017 & 0.017 & & 0.037 & 0.036 & 0.034 & {\bf 0.034}\\ & & 1.0 & 0.070 & 0.004 & 0.006 & {\bf 0.001} & & 0.081 & 0.067 & 0.068 & {\bf 0.067} & & 0.037 & 0.036 & 0.034 & {\bf 0.034}\\ & & 5.0 & 0.341 & 0.015 & 0.025 & {\bf 0.000} & & 2.019 & 1.680 & 1.698 & {\bf 1.679} & & 0.037 & 0.036 & 0.034 & {\bf 0.034}\\ & & 10.0 & 0.684 & 0.032 & 0.051 & {\bf 0.002} & & 8.095 & {\bf 6.732} & 6.815 & 6.740 & & 0.037 & 0.036 & 0.034 & {\bf 0.034}\\ & \multirow{4}{*}{ 0.7} & 0.5 & 0.024 & 0.001 & 0.004 & {\bf 0.000} & & 0.012 & {\bf 0.010} & 0.010 & 0.010 & & 0.036 & 0.035 & {\bf 0.034} & 0.034\\ & & 1.0 & 0.047 & 0.001 & 0.007 & {\bf 0.000} & & 0.046 & {\bf 0.040} & 0.041 & 0.041 & & 0.036 & 0.035 & {\bf 0.034} & 0.034\\ & & 5.0 & 0.235 & 0.004 & 0.038 & {\bf 0.001} & & 1.170 & {\bf 1.020} & 1.050 & 1.030 & & 0.036 & 0.035 & {\bf 0.034} & 0.034\\ & & 10.0 & 0.475 & 0.012 & 0.080 & {\bf 0.006} & & 4.662 & {\bf 4.058} & 4.179 & 4.096 & & 0.036 & 0.035 & {\bf 0.034} & 0.034\\ & \multirow{4}{*}{ 0.9} & 0.5 & 0.020 & -0.001 & 0.006 & {\bf -0.000} & & 0.008 & 0.007 & 0.007 & {\bf 0.007} & & 0.038 & 0.036 & 0.035 & {\bf 0.035}\\ & & 1.0 & 0.040 & {\bf -0.000} & 0.014 & 0.000 & & 0.031 & 0.027 & 0.029 & {\bf 0.027} & & 0.038 & 0.036 & 0.035 & {\bf 0.035}\\ & & 5.0 & 0.198 & -0.003 & 0.065 & {\bf -0.001} & & 0.778 & 0.684 & 0.716 & {\bf 0.684} & & 0.038 & 0.036 & 0.035 & {\bf 0.035}\\ & & 10.0 & 0.402 & {\bf -0.000} & 0.137 & 0.005 & & 3.133 & 2.750 & 2.881 & {\bf 2.748} & & 0.038 & 0.037 & 0.035 & {\bf 0.035}\\ \vspace{-2mm} \\ \cmidrule{2-17} \vspace{-2mm} \\ \multirow{16}{*}{40} & \multirow{4}{*}{ 0.3} & 0.5 & 0.047 & 0.004 & 0.002 & {\bf 0.001} & & 0.033 & 0.026 & 0.025 & {\bf 0.025} & & 0.029 & 0.028 & 0.027 & {\bf 0.025}\\ & & 1.0 & 0.094 & 0.009 & 0.004 & {\bf 0.001} & & 0.130 & 0.103 & 0.100 & {\bf 0.099} & & 0.029 & 0.028 & 0.027 & {\bf 0.025}\\ & & 5.0 & 0.465 & 0.039 & 0.014 & {\bf 0.001} & & 3.329 & 2.653 & 2.541 & {\bf 2.528} & & 0.029 & 0.028 & 0.028 & {\bf 0.025}\\ & & 10.0 & 0.937 & 0.084 & 0.035 & {\bf 0.009} & & 13.143 & 10.449 & 10.102 & {\bf 10.053} & & 0.029 & 0.028 & 0.027 & {\bf 0.025}\\ & \multirow{4}{*}{ 0.5} & 0.5 & 0.024 & {\bf 0.000} & 0.001 & -0.001 & & 0.014 & {\bf 0.012} & 0.012 & 0.012 & & 0.027 & 0.026 & 0.026 & {\bf 0.025}\\ & & 1.0 & 0.049 & 0.001 & 0.003 & {\bf -0.001} & & 0.055 & {\bf 0.048} & 0.048 & 0.048 & & 0.027 & 0.026 & 0.026 & {\bf 0.025}\\ & & 5.0 & 0.248 & 0.007 & 0.017 & {\bf -0.001} & & 1.382 & {\bf 1.204} & 1.217 & 1.208 & & 0.027 & 0.026 & 0.026 & {\bf 0.025}\\ & & 10.0 & 0.507 & 0.025 & 0.045 & {\bf 0.009} & & 5.550 & {\bf 4.826} & 4.882 & 4.842 & & 0.027 & 0.026 & 0.026 & {\bf 0.025}\\ & \multirow{4}{*}{ 0.7} & 0.5 & 0.018 & 0.001 & 0.003 & {\bf 0.000} & & 0.008 & {\bf 0.007} & 0.008 & 0.008 & & 0.027 & 0.026 & {\bf 0.025} & 0.025\\ & & 1.0 & 0.034 & {\bf -0.000} & 0.005 & -0.001 & & 0.033 & {\bf 0.030} & 0.030 & 0.030 & & 0.027 & 0.026 & {\bf 0.025} & 0.025\\ & & 5.0 & 0.180 & 0.008 & 0.033 & {\bf 0.006} & & 0.830 & {\bf 0.747} & 0.764 & 0.752 & & 0.027 & 0.026 & {\bf 0.025} & 0.025\\ & & 10.0 & 0.354 & 0.011 & 0.062 & {\bf 0.007} & & 3.306 & {\bf 2.977} & 3.043 & 2.998 & & 0.027 & 0.026 & {\bf 0.025} & 0.025\\ & \multirow{4}{*}{ 0.9} & 0.5 & 0.015 & {\bf 0.000} & 0.005 & 0.000 & & 0.006 & 0.005 & 0.005 & {\bf 0.005} & & 0.027 & 0.027 & 0.026 & {\bf 0.026}\\ & & 1.0 & 0.030 & {\bf 0.000} & 0.010 & 0.000 & & 0.022 & 0.020 & 0.021 & {\bf 0.020} & & 0.027 & 0.026 & 0.026 & {\bf 0.026}\\ & & 5.0 & 0.150 & {\bf 0.002} & 0.052 & 0.003 & & 0.558 & 0.505 & 0.523 & {\bf 0.505} & & 0.028 & 0.027 & 0.026 & {\bf 0.026}\\ & & 10.0 & 0.296 & {\bf -0.001} & 0.099 & 0.002 & & 2.222 & 2.017 & 2.085 & {\bf 2.015} & & 0.027 & 0.027 & 0.026 & {\bf 0.026}\\ \vspace{-3mm} \\ \bottomrule \vspace{+1mm} \end{tabular} \caption{Bias, mean squared error and Kullback--Leibler (KL) divergence for maximum likelihood (ML), conditional maximum likelihood of Yang and Xie (MLC), profile maximum likelihood of Shen and Yang (MLP) and our bias-adjusted maximum likelihood (MMLE) estimates of $k^*$ computed over $10^5$ simulations runs with $\lambda^* = 1$; $p$ denotes the proportion of uncensored observations. \label{tab:results:censored}} \end{center} \end{table*} \bibliographystyle{unsrtnat}
{'timestamp': '2022-09-30T02:08:02', 'yymm': '2209', 'arxiv_id': '2209.14567', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14567'}
arxiv
\section{Introduction} Regression analysis is a statistical method widely used in many research areas. It is often specified as the normal linear model, where coefficients are linear and the error term follows the normal distribution to simplify the analysis. This specification aims to approximate the state of nature and is often useful in prediction as well as discussing the causality. Among its specifications, variable selection is a central issue in the regression analysis. It is important to select an appropriate set of explanatory variables partly because of the cost of collecting variables. Many methods are proposed for the variable selection problem. In relation to the variable selection problem, this paper focuses on the superset model problem where the linear regression model selects a larger set of variables than the state of nature does (see the example provided in Section \ref{sec:Superset model problem}). The linear regression model tends to choose smaller set of variables when the state of nature is linear in variables due to its least squares loss. However, the nonlinear relationship is more likely and this case may lead to select a larger set of variables, which will be a deficiency of the linear regression model in terms of the data collection cost. To evaluate the superset model problem, this paper utilizes the Bayesian approach, which provides a measure of uncertainty in the form of the posterior probability, and proposes an alternative model that will select the true set of variables when the sample size is large. This paper is organized as follows. Section \ref{sec:Superset model problem} describes the superset model problem by providing an example. Bayes' Theorem is adopted to evaluate the problem in Section \ref{sec:Superset model probability} and two regression models for specification is explained in Section \ref{sec:Two regression models}. Section \ref{sec:Illustrative examples} illustrates the proposed method and discusses its robustness. \section{Superset model problem} \label{sec:Superset model problem} Suppose the continuous response $Y$ is associated with the set of explanatory variables $\bm{x}_{T}$. We are interested in its mean response conditional on $\bm{x}_{T}$. We often assume it to be linear in practice, although it is more likely to be nonlinear in reality. To this end, a regression model is specified as \begin{align*} Y = \phi (\bm{x}_{T}) + \epsilon, \end{align*} where $\epsilon$ is an additive error term with mean zero. The functional form $\phi (\cdot)$, the distribution of the error term, and the true set of explanatory variables $\bm{x}_{T}$ are all unknown. With this model, we make statistical inferences about the conditional mean response by estimating $\phi (\cdot)$ and the set of explanatory variables. Among problems about how this regression model should be specified, the variable selection problem focuses on the set of explanatory variables, based on the dataset $\{ y_{i}, \bm{x}_{i} \}_{i = 1}^{n}$. When the set of explanatory variables is known, the best fit is $E (Y \mid \bm{x}_{T})$ as an estimator of $\phi (\bm{x}_{T})$ when we use the squared loss. The linear regression model assumes $E (Y \mid \bm{x}_{T}) = \bm{x}_{T}^{\prime} \bm{\beta}$, where $\bm{\beta}$ is referred to as the regression coefficient vector. However, in general, $E (Y \mid \bm{x}_{T}) \neq \bm{x}_{T}^{\prime} \bm{\beta}$, contrary to the linearity assumption. For example, suppose \begin{align} E \left[ Y \mid x_{T} \right] = \alpha + \beta_{1} x_{T} + \beta_{2} x_{T}^{2}. \end{align} The linear regression with $(x_{T}, x_{U})$, where $x_{U} = x_{T}^{2}$, is better than the one with $x_{T}$, even though the latter selects the true explanatory variable. This is an example of the superset model problem. On the other hand, when $x_{U}^{\prime}$ is independent of $x_{T}$, $x_{U}^{\prime}$ should not be included in the regression to improve the fit. Above example suggests that the knowledge about association among variables is helpful to examine the superset model problem, and hence the variable selection problem. One approach is to estimate the conditional expectation without linearity and compare it with the one implied by the normal linear model. If they are different and the latter contains more explanatory variables, there exists the superset model problem. Because the dataset at hand is limited, it is difficult to determine whether the superset model problem exists or not. Rather, it is evaluated in a probability form, which is explained in the next section. \section{Superset model probability} \label{sec:Superset model probability} Suppose $\mathcal{M}^{\ast}$ is the set of explanatory variables in the state of nature, which is $\bm{x}_{T}$ when vectorized, and is known for a moment. The current dataset $\{ y_{i}, \bm{x}_{i} \}_{i = 1}^{n}$ is generated from this state of nature independently for each observation $i$ and is observed. Depending on a context, the normal linear model with $\mathcal{M}^{\ast}$ explanatory variables would be a choice if it approximates the state of nature well. In this case, we do not have the superset model problem. On the other hand, a normal linear model with a set of explanatory variables indexed by $\mathcal{M} (\neq \mathcal{M}^{\ast})$ is chosen independent of the state of nature in terms of, say, prediction, where the superset model problem arises when $\mathcal{M} \supset \mathcal{M}^{\ast}$. However, the state of nature is usually unknown and is inferred from the dataset. The uncertainty from inference is evaluated by the posterior probability over possible subsets of explanatory variables. This paper approximates it by assuming a flexible model (see Model \eqref{eq:alternative model} in Section \ref{sec:Two regression models}), which is denoted by $H_{0}$. Then, this posterior probability is calculated via Bayes' theorem, which is given by \begin{align} \Pr \left( \mathcal{M}^{\ast} \mid \{ y_{i}, \bm{x}_{i} \}_{i = 1}^{n}, H_{0} \right) = \frac{ \Pr \left( \{ Y_{i} \}_{i = 1}^{n} \mid \{ \bm{x}_{i} \}_{i = 1}^{n}, H_{0}, \mathcal{M}^{\ast} \right) \Pr \left( \mathcal{M}^{\ast}, H_{0} \right) }{ \sum_{ \tilde{\mathcal{M}} } \Pr \left( \{ Y_{i} \}_{i = 1}^{n} \mid \{ \bm{x}_{i} \}_{i = 1}^{n}, H_{0}, \tilde{\mathcal{M}} \right) \Pr \left( \tilde{\mathcal{M}}, H_{0} \right) }. \label{eq:conditional superset model probability} \end{align} The numerator is the cross product of the marginal likelihood and the prior belief about the set of explanatory variables. When the latter is uniform (which is assumed in the following empirical illustration), the posterior probability is proportional to the marginal likelihood under $H_{0}$. When uncertainty from inference about the normal linear model is evaluated from its posterior probability as well, the overall superset model probability is calculated as \begin{align} \sum_{ \mathcal{M} } \sum_{ \mathcal{M}^{\ast} } I \left( \mathcal{M} \supset \mathcal{M}^{\ast} \right) \Pr \left( \mathcal{M}^{\ast} \mid \{ y_{i}, \bm{x}_{i} \}_{i = 1}^{n}, H_{0} \right) \Pr \left( \mathcal{M} \mid \{ y_{i}, \bm{x}_{i} \}_{i = 1}^{n}, H_{1} \right), \label{eq:superset model probability} \end{align} where $H_{1}$ denotes the normal linear model (see Model \eqref{eq:normal linear regression model} in Section \ref{sec:Two regression models}). We note that the above expression is general enough to include variables (the response and explanatory variables) that are continuous or discrete. The next section specifies two regression models $H_{0}$ and $H_{1}$, where the response is assumed to be continuous for simplicity. \section{Two regression models} \label{sec:Two regression models} First, the linear regression model $H_{1}$ is specified as \begin{align} Y_{i} = \alpha + \bm{x}_{i}^{\prime} \bm{\beta} + \eta_{i}, \quad \eta_{i} \sim N \left( 0, \lambda^{2} \right), \label{eq:normal linear regression model} \end{align} where each of explanatory variables is standardized without loss of generality. To estimate model parameters $( \bm{\beta}, \lambda^{2} )$, the hyper-$g$ prior is assumed. Then, the marginal likelihood is analytically tractable (see \citet{miyawaki-maceachern-21} for example). Second, the model $H_{1}$ that is alternative to the normal linear regression model is specified as \begin{align} Y_{i} = \theta_{x} + \epsilon_{x}, \quad \epsilon_{x} \sim N \left( 0, \sigma_{x}^{2} \right), \label{eq:alternative model} \end{align} given $\bm{x}_{i} = \bm{x}$. The normal error assumption is made because we have no other knowledge on it. Further, it makes the conditional mean estimation simpler, in terms of the number of parameters as well as the computational burden. The main purpose of this semiparametric model is to estimate conditional means of $Y$ in a flexible manner, and to captures the association between $Y$ and $\bm{x}$ in the state of nature as the sample size increases, which can be viewed as as an extreme of the local constant estimation (see, e.g., \citet{fan-gijbels-03} for the local estimation). When the dataset is fixed, the covariate space becomes sparse as its dimension gets larger. Then, the marginal likelihood (hence, the superset model probability) under this alternative model is strongly dependent on the prior specification. To mitigate this influence, this paper takes the $m$-fold cross-validation approach, which is described in details below. The dataset is randomly divided into $m$ groups. One of them is used as the test set, while the remainings belong to the training set. Explanatory variables in the training set are standardized, and those in the test set are standardized by the mean and standard deviation of those in the training set. Let $\mathcal{D}_{0}$ and $\mathcal{D}_{1}$ be the sets of identification numbers of observations which belongs to the training and test sets. More precisely, $\mathcal{D}_{0} = \{ i \mid \text{the $i$-th observation is in the training set}, i = 1, \dots, n \}$ and $\mathcal{D}_{1} = \{ i \mid \text{the $i$-th observation is in the test set}, i = 1, \dots, n \}$. Given a choice of $\mathcal{D}_{0}$ and $\mathcal{D}_{1}$, we construct the prior and conditional marginal likelihood in the following manner. The prior for $\theta_{x}$ in the model \eqref{eq:alternative model} given $\bm{x}_{i} = \bm{x}$ and $i \in \mathcal{D}_{1}$ is assumed as \begin{align} \theta_{x} &\sim N \left( \hat{y}_{x}, t_{x}^{2} \right), \intertext{where $\hat{y}_{x} = \bar{y}_{0} + \bm{x}^{\prime} \hat{\bm{\beta}}$, $\bar{y}_{0}$ is the sample average of the response in $\mathcal{D}_{0}$,} \hat{\bm{\beta}} &= \left( \sum_{i \in \mathcal{D}_{0}} \bm{x}_{i} \bm{x}_{i}^{\prime} \right)^{-1} \sum_{i \in \mathcal{D}_{0}} \bm{x}_{i} y_{i}, \\ t_{x}^{2} &= s^{2} \left\{ \frac{1}{ | \mathcal{D}_{0} | } + \bm{x}^{\prime} \left( \sum_{i \in \mathcal{D}_{0}} \bm{x}_{i} \bm{x}_{i}^{\prime} \right)^{-1} \bm{x} \right\}, \\ \quad s^{2} &= \frac{1}{| \mathcal{D}_{0} | - k - 1} \sum_{i \in \mathcal{D}_{0}} \left( y_{i} - \bar{y}_{0} - \bm{x}_{i}^{\prime} \hat{\bm{\beta}} \right)^{2}. \end{align} When $\mathcal{A}$ is a set, $| \mathcal{A} |$ is the number of elements in the set. This prior is constructed from classical OLS estimates of mean and standard deviation of $Y_{i}$ at $\bm{x}_{i} = \bm{x}$. By using the prior that is obtained from the linear model and using the model that focuses on the local observation, we are able to combine local and global information. It is possible to use other estimates such as corresponding normal linear regression estimates under the hyper-g prior. However, to keep the methodology as simple as possible, we take the above prior specification. Then, we are able to derive the marginal likelihood conditional on the nuisance parameter $\sigma_{x}^{2}$ for each $\bm{x}_{i} = \bm{x}$ and $i \in \mathcal{D}_{1}$. Let $\mathcal{M}_{x} = \{ i \mid \bm{x}_{i} = \bm{x}, i \in \mathcal{D}_{1} \}$ and $n_{x} = | \mathcal{M}_{x} |$. Then, this conditional marginal likelihood is given by \begin{align*} &m^{\ast} \left( \{ Y_{i} \}_{i \in \mathcal{M}_{x} } \mid \{ \bm{x}_{i} \}_{i \in \mathcal{M}_{x} }, \sigma_{x}^{2}, \{ y_{i}, \bm{x}_{i} \}_{i \in \mathcal{D}_{0}} \right) \notag \\ &\hspace{100pt} = \frac{ \tau_{x} }{ \left( \sqrt{2 \pi} \sigma_{x} \right)^{n_{x}} t_{x} } \exp \left\{ -\frac{1}{2} \left( -\frac{\mu_{x}^{2}}{\tau_{x}^{2}} + \frac{ \sum_{i \in \mathcal{M}_{x}} y_{i}^{2} }{\sigma_{x}^{2}} + \frac{ \hat{y}_{x}^{2} }{ t_{x}^{2} } \right) \right\}, \\ &\mu_{x} = \tau_{x}^{2} \left( \frac{ \sum_{i \in \mathcal{M}_{x}} y_{i} }{\sigma_{x}^{2}} + \frac{\hat{y}_{x}}{t_{x}^{2}} \right), \quad \tau_{x}^{2} = \left( \frac{n_{x}}{\sigma_{x}^{2}} + \frac{1}{t_{x}^{2}} \right)^{-1}. \end{align*} The full Bayes analysis specifies a prior on the nuisance parameter $\sigma_{x}^{2}$ as well. However, because the data are sparse at $\bm{x}$, how we specify it affects the (unconditional) marginal likelihood much. To mitigate this problem, this paper takes the empirical Bayes approach. The marginal likelihood for each $\bm{x}_{i} = \bm{x}$ is the conditional marginal likelihood $m^{\ast} ( \{ Y_{i} \}_{i \in \mathcal{M}_{x} } \mid \{ \bm{x}_{i} \}_{i \in \mathcal{M}_{x} }, \sigma_{x}^{2}, \{ y_{i}, \bm{x}_{i} \}_{i \in \mathcal{D}_{0}} )$ maximized over $\sigma_{x}^{2}$. More precisely, \begin{align*} m \left( \{ Y_{i} \}_{i \in \mathcal{M}_{x} } \mid \{ \bm{x}_{i} \}_{i \in \mathcal{M}_{x} }, \{ y_{i}, \bm{x}_{i} \}_{i \in \mathcal{D}_{0}} \right) \equiv \max_{\sigma_{x}^{2}} m^{\ast} \left( \{ Y_{i} \}_{i \in \mathcal{M}_{x} } \mid \{ \bm{x}_{i} \}_{i \in \mathcal{M}_{x} }, \sigma_{x}^{2}, \{ y_{i}, \bm{x}_{i} \}_{i \in \mathcal{D}_{0}} \right). \end{align*} See the next section for this maximization in details. By multiplying it over all distinct $\bm{x}$ in $\mathcal{D}_{1}$ and taking the geometric mean, we have the marginal likelihood for $\mathcal{D}_{1}$ per one observation, which is given by \begin{align*} \left\{ \prod_{\bm{x}} m \left( \{ Y_{i} \}_{i \in \mathcal{M}_{x} } \mid \{ \bm{x}_{i} \}_{i \in \mathcal{M}_{x} }, \{ y_{i}, \bm{x}_{i} \}_{i \in \mathcal{D}_{0}} \right) \right\}^{1 / | \mathcal{D}_{1} |}. \end{align*} The geometric mean is to take care of different sample sizes in different test sets. Finally, we repeat above process until all $m$ groups are used as the test set and calculate above marginal likelihood for each test group selection. After averaging $m$ marginal likelihoods, we raise it to the power of $n$ to obtain the final marginal likelihood estimate for the model \eqref{eq:alternative model}. The robustness of this approach is of interest. The approach will be more useful if we know the upper and lower bounds of the superset model probability under $H_{0}$ when its specification changes. Two points are discussed regarding robustness. First, we consider the robustness to the number of folds in the cross-validation. In the following empirical analysis in Section \ref{sec:Illustrative examples}, we use the 10-fold cross-validation. When the number of folds changes from 2 to 15, we see the resulting probability does not change much with the diabetes dataset (see Figure \ref{fig:Superset model probability change as the number of folds increases.}). \begin{figure}[ht] \centering \includegraphics[width=12cm, clip, keepaspectratio]{robust_fold.pdf} \caption{Superset model probability change as the number of folds increases. (The dotted line indicates the 10-fold cross-validation, which will be used in Section \ref{sec:Illustrative examples})} \label{fig:Superset model probability change as the number of folds increases.} \end{figure} Second, it is important to check the robustness to the prior. One approach would be to use the $\epsilon$-contamination class prior (see Section 4.7.4 of \citet{berger-85}), and to show the sensitivity of the marginal likelihood, which will be our future analysis. \section{Maximize the marginal likelihood} \label{sec:Maximize the marginal likelihood} Letting \begin{align} \bar{y}_{x} &= \frac{1}{n_{x}} \sum_{i \in G_{x}} y_{i}, \\ s_{y}^{2} &= \frac{1}{n_{x}} \sum_{i \in G_{x}} \left( y_{i} - \bar{y}_{x} \right)^{2} = \frac{1}{n_{x}} \sum_{i \in G_{x}} y_{i}^{2} - \bar{y}_{x}^{2}, \end{align} the local marginal likelihood function is characterized by Theorem \ref{thm:maximization}. \begin{thm} The local marginal likelihood function has extremal values at positive solutions to the cubic equation \eqref{eq:cubic equation} given in the proof when $s_{y}^{2} > 0$; at 0 when $s_{y}^{2} = 0, t_{x}^{2} - ( \bar{y}_{x} - \hat{y}_{x} )^{2} \geq 0$; and at 0 and $- t_{x}^{2} + ( \bar{y}_{x} - \hat{y}_{x} )^{2}$ when $s_{y}^{2} = 0, t_{x}^{2} - ( \bar{y}_{x} - \hat{y}_{x} )^{2} < 0$. \label{thm:maximization} \end{thm} See Appendix \ref{sec:Proof of Theorem} for its proof. Table \ref{table:Local marginal likelihood function} summarizes the result. \begin{table} \centering \caption{Local marginal likelihood function} \label{table:Local marginal likelihood function} \begin{tabular}{lccc} \toprule & $\sigma_{x}^{2} \to 0$ & $0 < \sigma_{x}^{2} < \infty$ & $\sigma_{x}^{2} \to \infty$ \\ \midrule $s_{y}^{2} > 0$ & 0 & \multirow{2}{*}{See Lemma \ref{lem:extremal values}} & \multirow{2}{*}{0} \\ $s_{y}^{2} = 0$ & $\frac{1}{ \sqrt{2 \pi} t_{x}} \exp \left\{ -\frac{1}{2 t_{x}^{2}} \left( \bar{y}_{x} - \hat{y}_{x} \right)^{2} \right\}$ & & \\ \bottomrule \end{tabular} \end{table} By this theorem, we are able to set a value of $\sigma_{x}^{2}$ to maximize the marginal likelihood, instead of placing a prior on it. \section{Illustrative example} \label{sec:Illustrative examples} The diabetes data (see \citet{efron-etal-04}) are used to illustrate our method. This dataset contains 442 observations. For the analysis below, we use the logarithm of the diabetes progression measure as the response and use remaining 10 variables are used as exlanatory variables. The proposed method is applied, and the superset model probability for this dataset with 10-fold cross-validation is estimated to be 22.37\%. As discussed by \citet{maceachern-miyawaki-22}, the diabetes dataset seems to be collected from least two different sources. In particular, the precision of two explanatory variables (the blood pressure and fourth blood serum measurement) consists of a mix of finer and coarser observations. When the data are divided into two groups by this precision, \citet{maceachern-miyawaki-22} suggests these two datasets have different characteristics. This conclusion is also confirmed in terms of the superset model probability. When the dataset for observations with finer variables is used, it is 22.19\%. When, on the other hand, that for observations with coarser variables is used, it is 10.72\%. The superset model problem is more likely to occur with the former dataset than the latter one, which would be due to the difference in characteristics of these two datasets.
{'timestamp': '2022-09-30T02:07:41', 'yymm': '2209', 'arxiv_id': '2209.14555', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14555'}
arxiv
\section{Related Work} \label{sec:related} We give related works regarding direct volume rendering (DVR) of unstructured meshes, data-parallel rendering, and in~situ visualization. \subsection{Unstructured Volume Rendering} There are notable works proposed to render unstructured finite element meshes~\cite{nelson2006isosurface, Vo2007irun, marmitt2008cpuvolume, muigg2011interactivevol}. Two predominant strategies to render unstructured volumes are \emph{point-query sampling}, e.g.,~\cite{morrical2020rtxpointlocext} and \emph{ray-marching}~\cite{shirley1990rastertet}. In point-query sampling, zero-length rays are used to probe into an acceleration data structure, for example, a \emph{bounding volume hierarchy} (BVH), that was built over the elements to sample the volumetric data adaptively. These structures are traditionally used to find ray-particle collisions per frame for all pixels. Rathke et al.~\cite{rathke2015simd} propose a min/max BVH that speeds up the element look-up processes for samples and iso-surfaces. Wald et al.~\cite{wald2019rtxpointloc} use point location queries on tetrahedral meshes by utilizing NVIDIA's ray-tracing (RT) cores. This work is later extended by Morrical et al.~\cite{morrical2020rtxpointlocext} to include all unstructured elements. Due to the low number of samples taken per ray, these approaches can produce fast but noisy results, thus requiring many samples to be taken over time for a converged image. To further accelerate the process of convergence and sampling, empty space skipping~\cite{kruger2003accelerationgpu, hadwiger2018sparseleap} or adaptive sampling strategies~\cite{Wang2020noveladaptivesampling,szirmaykalos2011freeps} can be leveraged. The RTX hardware also can be exploited for empty space skipping and adaptive sampling~\cite{morrical2019spaceskip}. Standard ray-marching accumulates many samples while tracing rays without using external acceleration structures~\cite{marmitt2006fastraytet, weiler2003hardwarebased}. Usually, \emph{marching} is performed via visibility sorting or element connectivity. A well-known way to render tetrahedral meshes without connectivity information is by Shirley and Tuchmann~\cite{shirley1990rastertet}. Since visibility sorting tends to be very costly, several researchers turned their attention to connectivity storage, eliminating the need for sorting. Aman et al.~\cite{aman2021bth, aman2021compact} introduce a tetrahedra traversal algorithm that optimizes intersection tests by using 2D projection while still maintaining a connectivity list. However, most of these works are limited to pure tetrahedral meshes. Muigg et al.~\cite{muigg2011interactivevol} propose a ray-marching algorithm that can handle non-tetrahedral elements and non-convex bounding geometry by storing compact face-based connectivity lists and projecting vertices to a ray-centric coordinate system for intersections. When doing ray-marching, one also needs to find the first element where the ray first enters the volume; \cite{sahistan2021Shell} showed how this can be done with RTX hardware by building a BVH over the shell and tracing rays. Ray-marching techniques that utilize connectivity are particularly appealing to our purposes because many modern simulation systems already store connectivity data. Therefore they can be used to avoid worsening high memory pressure situations. \subsection{Data-parallel Rendering} Parallel approaches should be exploited to visualize massive simulation data sets with proper timings. There are various means to partition the workload and data among many compute nodes. Distributing data pieces (clusters) between nodes (i.e., data-parallel rendering or \emph{sort-last}) is a popular method employed by recent works~\cite{larsen2015raytracingdataparallel, castanie2006distributedsharedmemory}. Some works also propose an image-order partitioning (\emph{sort-first}) where work is distributed over pixel regions~\cite{brownlee2013imageparallel,biedert2018hwacceleratedmultitile}. There are also hybrid approaches~\cite{biedert2017taskbasedparallel, cao2019parallelvis}, which aim to address load-balancing issues by leveraging both perspectives. Sort-last algorithms allow for a static geometry assignment at the cost of exchanging intermediate images. Because of the static geometry assignment, sort-last is the most popular rendering algorithm on distributed memory systems. However, correctly and efficiently compositing intermediate images that generally overlap is challenging. Image-based compositors, such as IceT\cite{icet, moreland2011icet}, produce a single intermediate image per node, which is not suitable for clusters with non-convex domains. One of the recent works that tackle the sort-last compositing problem is by Grosset et al.~\cite{grosset2016imagecompositing}, which reduces delays and communications by implementing a spatiotemporally-aware compositor. Their approach uses ``chains'' that determine the blending order of each strip of the image. Usher et al.~\cite{usher2019distributedfb} introduce \textit{Distributed FrameBuffers}, a method that breaks the image processing operations into tiles of ranks with independent dependency trees. The Galaxy framework~\cite{abram2018galaxy} displays the idea of an asynchronous frame buffer, which leverages independent pixel updates sent from a server while allowing incremental refinements to the final image over time. Many recent works are proposed for optimizing workloads minimizing communication costs while generating images with the highest possible accuracy. Ma~\cite{liukwan1995parallelvolumedistributed} introduces a data-parallel unstructured volume rendering method with the ability to handle non-convex data boundaries properly. Similar to our shells (see \autoref{sec:shell-to-shell}), their technique makes use of a \emph{hierarchical data structure} that allows accessing the boundary faces and ray-casting operations from these faces. This work also describes how to do compositing in the correct order. However, unlike our deep compositing (\autoref{sec:deep-compositing}), they prefer sending smaller many messages between compute nodes during rendering. Some of these ideas are later extended to utilize asynchronous load balancing via object and image-order techniques~\cite{liukwan1997scalableparallelcell}. However, this work uses cell-projection techniques rather than ray-casting. Childs et al.~\cite{childs2006hybridmassive} layout a two-stage framework that first samples a $m \times n\times k$ view-aligned grid ---where m and n denote the pixel resolution and $k$ is the sample per pixel--- then composites these samples in the proper viewing order. In the sampling stage, first, they sample what they consider to be small-sized elements. Then, they distribute the large elements to processors, where they are sampled to balance the load. This work is later extended by Binyabib et al.~\cite{binyabib2019hybrid} by proposing a many-core hybrid scheme where they employ sampling over a similar view-aligned grid, but this scheme allows successive $k$ samples in the same pixel and node to be partially composited, reducing the memory footprint. Our deep compositing algorithm is an extension of the algorithms by Childs and Binyabib et al. in the regard that ours can also handle jagged cluster boundaries. However, the view-aligned grid-based sampling is infeasible for our purposes as, in theory, it will waste precious memory resources for large framebuffers. In theory, the 3D rasterization process required by Childs et al. will also be sensitive to overdraw when millions of elements fall within the same grid cell. Finally, both of these works' image-order load balancing method requires large elements to be either replicated or moved to some other nodes, thus requesting additional memory, which may not always be present given an in~situ scenario. We also acknowledge GPU architectures improve with new divergence handling methods and ray-tracing (RT) cores, so the adaptations we propose in this work are necessary. Unlike these prior works, our method is tailored for modern GPUs, which minimizes the costs of compositing and sorting operations. We also do not have to buffer every sample along the pixels since we ray-march through each segment to determine partial samples. Finally, unlike these works, our approach does not require re-distributing or replicating elements across nodes to render the data. \subsection{In~situ Visualization} File I/O has long been a bottleneck of high-performance computing. To overcome this hindrance, in~situ visualization couples computation and visualization together, thus, enabling the users to tap into a running simulation. In~situ visualization has many merits, such as examining the data, doing numerical queries, and generating graphical outputs while the simulation executes. Moreover, it allows verification so that the simulation may be stopped or modified, saving both time and computation resources~\cite{childs2020terminsitu}. We find our approach in line with in~situ applications because of our ability to generate correct images with little to no support from additional acceleration structures at interactive rates. There are notable in~situ applications used in industry~\cite{ayachit2015catalyst, kuhlen2011libsim} that render outputs generated by infrastructures like Strawman~\cite{Larsen2015strawman} or Ascent~\cite{larsen2017alpine}. In addition to standard systems, various recent algorithmic novelties have been proposed to handle time-varying data generated by the simulations. Yamoka et al.~\cite{yamaoka2019adaptivetimestepinsitu} illustrate a method that adapts the timestep sampling rate according to variations in the probability distribution function (PDF) estimation of the connected simulation. Aupy et al.~\cite{aupy2019highthroughputinsitu} give a model that allows them to analyze simulations, and then they use this model to formulate high-throughput scheduling. DeMarle and Bauer~\cite{demarle2021temporalinsitu} propose a temporal cache scheme that keeps much time-varying information produced from a running simulation, which can later be stored according to a pre-defined trigger. Marsaglia et al.~\cite{marsaglia2018explorativevis} introduce an error-bound in~situ compression scheme that allows saving complete spatiotemporal simulation data. Our proposed method only requires a couple of lightweight structures alongside what is already being kept in simulations. Furthermore, observing recent trends from these approaches, we see no major issues that stop our method from being used alongside current in~situ systems. \section{Problem Statement} \label{sec:problem} Modern simulation data is becoming more extensive and complex each day. With the unstructured volume data sets, like The Fun3D Mars Lander that contains many parts (i.e., \emph{clusters}) with non-convex boundaries (see \autoref{fig:overview} (b)), robust data-parallel solutions are needed. Moreover, the generation of such data sets require carefully tuned simulations. In~situ visualization can be utilized to verify the correctness of simulations by allowing visuals to be taken in simulation-time. However, due to the different requirements of the simulation and visualization algorithms, the volume rendering at interactive rates can be challenging. One major problem of such simulations is that the data distribution is generally unbalanced for visualization purposes. Due to time and memory costs, re-distributing the data does not offer a feasible option. Besides, allocating solely visualization-related acceleration structures over all elements may not be possible since nodes may not have enough space. The data-parallel rendering requires each partition to be on a separate computer node, where each node renders a portion of the final image. These portions are called \emph{fragments}, and in our approach, they are generated per \emph{ray segment}. Ray segments are defined between an entry and exit position of a \emph{shell} (faces defined by cluster boundaries), so for non-convex cluster boundaries, there might be more than one fragment since there might be more than one ray segment. Furthermore, these non-convex shells can be on different nodes and interleave each other, which makes the correct order compositing extremely difficult. \begin{figure*} \centering \resizebox{0.99\textwidth}{!}{ \textembeddedimg{drawings/shell-to-shell.pdf}{0.24\textwidth}{}{}{a}{black}\hfill \textembeddedimg{png/shellvis-10-56v2.png}{0.24\textwidth}{}{}{b}{white}\hfill \textembeddedimg{drawings/marching.pdf}{0.24\textwidth}{}{}{c}{black}\hfill \textembeddedimg{png/shellvisdvrsurf.png}{0.24\textwidth}{}{}{d}{black} } \caption{Overview of the volume integration process. (a) Shell-to-shell traversal for non-convex elements: rays with front-face culling are sent to find exit faces, and backward rays are cast from exit faces to find the entry faces over the shells. The blue and light blue clusters lie in the same MPI rank, but the yellow cluster is in another rank; hence, the shells of the two blue clusters are traced in order, but the yellow cluster's shells get traced in parallel. (b) The shells of the first 46 clusters of Small Lander. Each base color represents a different cluster's shell. (c) The ray-marching process is illustrated for the two blue clusters given in (a). (d) DVR of the same subset given in (b). } \label{fig:overview} \end{figure*} \section{Proposed Approach} \label{sec:method} We tackle the given problem by introducing a framework that supports interactive visualization of large, unstructured, and non-convexly partitioned volumetric data sets, animation of fixed topology data sets, and compatibility with the given data partitioning and the number of nodes in the simulations; i.e., native data, without re-partitioning or simplifications, and proper compositing even in the presence of non-convex data. Assuming that the data is natively pre-partitioned and distributed to different ranks, the proposed approach for rendering consists of four steps: \begin{enumerate} \item Each node generates connectivity information, shell-BVH, and XOR-compacted geometry representation required by our ray-marcher (\autoref{sec:data-preparation}). \item Rendering starts at each node by tracing two rays through each shell to create segments (\autoref{sec:shell-to-shell}). \autoref{fig:overview}~(a) illustrates the shell-to-shell traversal. \item Each node performs volume integration (cf.~\autoref{fig:overview}~(c)) via ray-marching, creating one RGBA-Z tuple; i.e., fragment per each segment, resulting in potentially multiple fragments for each pixel (\autoref{sec:integrate-segments}). \autoref{fig:overview} (d) depicts an integrated volume output using the shells from \autoref{fig:overview} (b). \item Finally, we apply a GPU-optimized ``deep compositing'' technique in which different ranks exchange their respective fragments and composite them in the proper order (\autoref{sec:deep-compositing}). \end{enumerate} In an offline rendering mode, each step is executed once in the given order; however, the last three steps are repeated repeatedly under interactive exploration. Besides, the first step's results can be cached for future use. \subsection{Data Preparation} \label{sec:data-preparation} We describe the connectivity information generation, shell-BVH construction and XOR-compacted geometry representation creation required by our ray-marcher. \subsubsection{Connectivity Generation} \label{sec:connectivity-gen} Our method needs to know the neighboring elements' indices to perform element marching. We generate the connectivity information by matching the element faces in the preprocessing step. We separate vertex and connectivity information and store the neighbor indices in an external buffer to keep the elements and neighbor indices aligned in memory. Although we picked this way of processing connectivity it should be noted that this buffer can be in any shape or form as long as one can access the next element from the current element using a face that is shared by both. Thus this part can be adapted to fit simulation or application's needs. \subsubsection{Per-Node Shell Generation} \label{sec:per-node-shell-gen} Our approach handles volumetric data that may contain convex and non-convex clusters. To this end, we identify boundary geometry for each cluster present per node by looking at elements which are missing a neighbour from the connectivity generation step. This boundary geometry comes in the form of triangles and quads, which we call \emph{shell-faces}. We utilize a method similar to the one described in Sahistan et al.~\cite{sahistan2021Shell}, where we identify each shell-face using connectivity. We mark the faces from elements with missing neighbors as shell-faces. We use triangles as provided and triangulate quadrilateral elements. We keep a list of triangle indices stored along the shell-BVH. We reserve four indices for each shell triangle: the first three are triangle indices, and the last one points to the volume element behind that triangle. The lower two bits of the fourth index signifies the element type (i.e., tetrahedron, pyramid, wedge, or hexahedron), and the remaining 30 bits is an index into the list of elements; this index is required to start marching. This encoding is similar to the BVH-node memory layout used by PBRT~\cite{pharr2021pbrtaccel}. We build our shell-BVH using OptiX~\cite{optix, wald2020owl} to exploit NVIDIA GPU's RTX cores for hardware-accelerated shell-to-shell traversal. \subsubsection{XOR-compaction} \label{sec:xor-comp} Our compaction scheme exploits the following property of exclusive-or (XOR) operations: $(a \oplus b) \oplus a = b$. We can generalize this property to $n$ numbers if we know the XOR of $n-1$ numbers. Let $X$ denote the XOR of $n$ terms and $Y$ denote the XOR of any subset with $n-1$ terms. Then, we can simply XOR $X$ and $Y$ to find the remaining term. We can exploit this idea on connected volume elements in a ray's path during ray-marching. Since we know that some of the vertices are shared between neighboring elements, previously calculated XOR fields can be employed to reduce index information per element. This compaction requires the first face to be known to start ray-marching since all the other steps depend on the information obtained from the previous step. To handle this initial case, we use our shell faces that we store explicitly. After that, each step utilizes the march state to access the previous step's information. For each element except hexahedra, we store a different XOR-compacted structure, illustrated in \autoref{fig:memorylayouts}. \begin{figure}[htbp] \begin{minipage}[t]{.22\columnwidth} {\small \begin{lstlisting}[language=c++] struct Tet{ uint vx; }; \end{lstlisting} } \end{minipage} \hfill \begin{minipage}[t]{.22\columnwidth} {\small \begin{lstlisting}[language=c++] struct Pyr{ uint dx; uint diag[2]; uint top; }; \end{lstlisting} } \end{minipage} \hfill \begin{minipage}[t]{.22\columnwidth} {\small \begin{lstlisting}[language=c++] struct Wed{ uint dx[2]; uint diag[2]; }; \end{lstlisting} } \end{minipage} \hfill \begin{minipage}[t]{.22\columnwidth} {\small \begin{lstlisting}[language=c++] struct Hex{ uint v[8]; }; \end{lstlisting} } \end{minipage} \begin{center} \fbox{% \includegraphics[width=0.28\columnwidth]{drawings/tet.pdf} } \fbox{% \includegraphics[width=0.28\columnwidth]{drawings/pyr.pdf} } \fbox{% \includegraphics[width=0.28\columnwidth]{drawings/wed.pdf} } \end{center} \caption{XOR-compacted memory layouts (top) and geometric illustrations of XOR calculations for \code{Tet}, \code{Pyr}, and \code{Wed} (bottom). \code{Hex} does not have a compaction scheme. \texttt{uint} stands for unsigned integer. The ``$\oplus$'' symbol indicates the XOR operation. The total sizes of each struct are 4, 16, 16, and 32 bytes for Tet, Pyr, Wed, and Hex, respectively. The vertices are in VTK~\cite{VTK} ordering.} \label{fig:memorylayouts} \end{figure} We apply the tetrahedron compaction method by Aman et al.~\cite{aman2021bth}. A tetrahedron shares three of its four vertices with any other neighboring element. For this reason, a single XOR field is enough to construct the unshared vertex. Given the entry face that contains vertex indices $v_0, v_1, v_3$ and a compacted tetrahedron with $vx = v_0 \oplus v_1 \oplus v_2 \oplus v_3$ one can XOR all four of the integers to get the missing vertex index $v_2$. For the 16 byte pyramid, we store one \code{dx} field that is the XOR of \nth{0} and \nth{2} vertex indices (according to VTK ordering), two vertex indices which happens to be the other diagonal of the quad (\nth{1} and \nth{3} vertices), and a top vertex index, which is always the \nth{4} vertex. During marching if the entry is from the quad face, the only missing index is the top vertex index, which is already explicitly stored. Otherwise, any triangle face should be composed of one of the explicitly stored diagonal vertices, the top vertex, and one vertex encoded in the \code{dx} field. Matching one of the vertices with one of the diagonal fields, we can decide which index to XOR with \code{dx}, thus obtaining one of the missing vertices. The other missing index for this case is the unmatched integer from \code{diag[2]}. Our 16 byte wedge structure is composed of two \code{dx} and two \code{diag} fields. \code{dx} fields contain two XORs: the first one is the XOR of \nth{2} and \nth{3} vertex indices; the second one is the XOR of \nth{1} and \nth{5} vertex indices. \code{diag} explicitly stores \nth{0} and \nth{4} vertex indices. Like pyramids, ray-marcher's wedge construction has two high-level cases. If the entry is from a triangular face, any triangle face should be composed of one of the explicitly stored diagonal vertices and two vertices encoded in the different \code{dx} fields. By matching one of the diagonal vertex indices to one of the diagonal fields, we can construct two missing vertices from \code{dx} fields. The other missing index for this case is the unmatched integer from \code{diag[2]}. If the ray enters from a quadrilateral, it must contain one or both of the indices stored in \code{diag}. By matching diagonal vertices, we can determine the entry quadrilateral. Then, we have two cases. The first case where two of the entry quadrilateral's indices match both of the indices is shown in \code{diag}. We can get the two missing indices by XOR'ing \code{dx} fields with unmatched indices of the entry quadrilateral separately. In the second case (either one of the diagonals match with one of the quadrilateral face indices), we can immediately get one of the missing vertices from unmatched \code{diag}. Finally, we can use one of the \code{dx} fields to get the other missing vertex. Hexahedra have the minimum shared vertices ratio (0.5) among all element types and demand that four vertices be obtained on entry. It is challenging to find an XOR-based hexahedra compaction scheme that reduces to the closest alignment of 16 bytes. Therefore, we store all hexahedra indices without compaction according to the VTK mesh ordering. \subsection{Per-Node Segment Generation via Shell Traversal} \label{sec:shell-to-shell} For each given shell-BVH per node, we initiate a step called \emph{shell-to-shell} traversal. This process is done for every ray per cluster and is fundamentally similar to~\cite{sahistan2021Shell}, which finds a \emph{segment} between entry and exit faces. \autoref{fig:overview} (a) illustrates this process, and the steps are as follows: \begin{enumerate} \item Trace the ray through the shell-BVH with front-face culling from the ray origin. \item If a ray hits a shell face, we then mark that face as the exit face and create a backward ray with the origin at the hit position. \item This backward ray is again traced using front-face culling to find an entry face. \item The found entry face contains four index values (\autoref{sec:per-node-shell-gen}), and the last one encodes the ID and the type of the element from where we start our ray-marcher (\autoref{sec:integrate-segments}). \end{enumerate} Some real-life data sets might have degenerate volume boundaries where instead of tightly interlocking, two neighboring faces might be intersecting or slightly apart. If we were to na\"{i}vely to find the closest hits for these degenerate boundaries, this would create incorrect ray segments, which might cause sampling and compositing errors ---casting two front-face culled rays to find an exit and entry point allows us to handle them robustly. Although we leverage the hardware acceleration of NVIDIA RTX GPUs in our work, this approach does not explicitly require the usage of OptiX/OWL frameworks or any specialized hardware. One can use any other framework or ray-tracing engine that supports these basic functionalities. \subsection{Per-Segment Volume Integration} \label{sec:integrate-segments} We use linear interpolation to sample elements at equidistant points in a segment. The coefficients to linear interpolation calculations are also utilized to check whether the current element contains the point that needs to be sampled. If not all of these coefficients are between 0 and 1, we keep marching until that becomes the case. When a sample is taken, a transfer function is used to look up its color and transparency, and then it is composited to that segment's color. Marching is terminated when a ray becomes opaque or the next sample position falls behind the exit face. Our marcher utilizes a method similar to ``Projected Tetrahedra''~\cite{shirley1990rastertet} to determine the exit face for a given element. We do not rasterize the elements directly to the screen, which is more in line with the methods described by Aman et al.~\cite{aman2021bth, aman2021compact} and Sahistan et al.~\cite{sahistan2021Shell}. However, we handle primitives other than tetrahedra as well. We employ XOR-based compaction schemes to reduce the memory footprint of the data while still allowing efficient traversal. Our compaction process reduces the vertex index storage per element, except hexahedra. We also address memory alignment with this scheme. We store connectivity information in a separate buffer to preserve memory alignment properties. Although reducing memory usage is usually helpful, this index removal may not be desirable for some in~situ scenarios; our marcher can perform without compaction. Ray-marching processes start from a cluster's shell that contains pbrt-style~\cite{pharr2021pbrtaccel} encoded element information. We can construct the first element behind the shell face using this information. After entering the shell, the connectivity buffer and compacted element information are enough to fetch and construct the next elements along the given ray segment. However, our compaction requires elements to be traversed in sequential order without skipping. When an element is reconstructed from XOR-compacted form, the vertices cannot be in any order because this introduces sampling artifacts. Therefore, our scheme not only re-obtains vertex indices but also consistently places them according to VTK mesh ordering for each element~\cite{VTK}. An exit face must be determined to select the next element on the ray segment. We project the element vertices to a ray-centric coordinate system to conduct 2D intersection tests to find the exit face. Finally, our method maintains a \emph{march state}, which book keeps the last intersected face type (triangle or quad), current element's type, index, and vertex indices for every marching step. Moreover, we follow a general rule while traversing the volume: placing the entry face indices into the same positions in the march state during marching. This rearrangement of the vertices allows us to ignore the entry face during exit face selection(since we now know which vertices belong to entry face). When the marcher leaps to another element, we update march state old entry face indices with exit face indices. Since each volume element is unique in terms of its geometry and face arrangement, it is hard to make a \emph{simple} algorithm that handles all possible combinations. For this reason, our element marching handles various elements in a case-by-case fashion. We handle tetrahedral elements similar to~\cite{sahistan2021Shell}. However, unlike Sahistan et al, we also allow intermediate points inside the elements to be sampled. We transform the vertices to the previously mentioned ray-centric coordinate system to determine the exit face for tetrahedral elements. After each vertex is transformed, we apply a maximum of two 2D left tests to determine the face containing point $(0,0)$. The exit face can again be found via 2D left tests when inside a pyramid. Due to the quad face that the pyramids have, we utilize the last intersected face type field stored in march state to simplify our left test cases. Using projected vertices, if the entry face is a quad face, we find the exit face among four triangles (similar to the tetrahedron case). Otherwise, we first check if the quad face contains the point $(0, 0)$, then test the remaining three triangles for the same condition. Finally, we update the last intersected face type accordingly. In terms of finding the exit face, wedges are similar to pyramids. It should be noted that wedges contain three quad faces; hence even if the intersected face type is a quad, the exit face might be another quad face. Like other element types, we ignore the entry face to avoid extra left tests. After the exit face is determined, we update intersected face type once more. Hexahedra are uniform like tetrahedra; however, they have more faces. Therefore finding the exit intersection requires the highest number of left tests. In the worst case, hexahedra need 13 left tests, whereas wedges, pyramids, and tetrahedra require 7, 5, and 2 left tests, respectively. \subsection{Deep Compositing} \label{sec:deep-compositing} The techniques described in the previous sections allow any rank to efficiently find, for a given ray, all the segments that overlap with that rank's part of the data (\autoref{sec:shell-to-shell}); and to efficiently integrate each of these segments (\autoref{sec:integrate-segments}). This integration step produces one RGB color and opacity value for each segment, plus the depth of the given segment. Borrowing terminology from triangle rasterization, we call each such tuple of color $C$, opacity $\alpha$, and depth $z$, a \emph{fragment} $F=({F_C,\;F_\alpha,\;F_z})$. Given all of a given pixel $P$'s fragments $F^{(P)}_{0},F^{(P)}_{1},\dots,F^{(P)}_{N^{(P)}}$, the correct final pixel color is the result of first sorting these fragments by their depth and compositing them usin $\widehat{O}(A,B)\;$/$\;\widehat{U}(A,B)$~\cite{OverOperator,Porter84}. The challenge is that any given pixel's fragments may get produced on many different ranks, requiring some merging of different ranks' results. Even worse, the irregular shape of the shells means that any ray can enter and leave the same shell multiple times at multiple distances, producing multiple---and in some cases, many---fragments for the same pixel. \autoref{fig:num-frags} illustrates the distribution of the average and the total number of fragments for a view of the Huge Lander for increasing rank counts. As it can be observed from the case where the rank count is 16 (cf.~\autoref{fig:num-frags-vis}), each pixel may have multiple fragments generated from multiple ranks. \begin{figure}[t] \centering \includegraphics[width=\columnwidth]{drawings/fragment_counts_plot.pdf} \caption{Box plots of average (left) and total (right) number of fragments generated by individual ranks while rendering the Huge Lander. We take averages over non-empty pixels where their opacity is greater than 0. The plots are for the rank counts of 16, 32, 48, 64, and 80. Scattered points signify individual ranks' average (left) and total (right) fragment counts at a given MPI size.} \label{fig:num-frags} \end{figure} \begin{figure}[tbp] \includegraphics[width=.50\columnwidth]{png/fragments16_v2.png} \hspace{-0.38em} \includegraphics[width=.50\columnwidth]{png/fragments16_combined_v2.png} \includegraphics[width=1.00\columnwidth]{png/fragments16_v2_colorbar.pdf} \caption{Heatmaps for the number of fragments for a view of the Huge Lander rendered with 16 MPI ranks (first box given in \autoref{fig:num-frags}): On the left, fragments for every 16 rank, and on the right, all heatmaps combined into one image.} \label{fig:num-frags-vis} \end{figure} The easiest approach to compositing this would be to first composite all ranks' fragments to a single fragment per pixel per rank and then use some optimized compositing library like IceT~\cite{moreland2011icet} to produce the final image. However, as neither $\widehat{O}$ nor $\widehat{U}$ are commutative, this will give wrong results every time a ray enters the same shell more than once. Fragments need to be composited in visibility order, considering that $N$ fragments along a ray are generally distributed unequally across the ranks. Let $\otimes$ denote compositing operation given any ray that produces two fragments $F^{(A)}_0$ and $F^{(A)}_1$ on the same rank must also have had at least one other fragment $F^{(B)}$ on at least one other rank. This requires compositing as $F^{(A)}_0 \otimes F^{(B)} \otimes F^{(A)}_1$, which in general is different from both $F^{(B)} \otimes (F^{(A)}_0 \otimes F^{(A)}_1)$ and $(F^{(A)}_0 \otimes F^{(A)}_1) \otimes F^{(B)}$. \subsubsection{Compositing with More than One Fragment/Pixel} To solve this compositing problem, we developed a new compositing framework that explicitly allows each rank to have multiple fragments per pixel. At an abstract level, our method expects each pixel to store one counter that specifies the number of fragments, $N$, plus an address (or offset) to a list of fragments, $F_0, \; \ldots\;, F_{N-1}$. Similar to parallel-direct-send~\cite{grosset2017todtree, favre2007directsend}, we then split the frame buffer into $R$ distinct \emph{regions} of pixels (where $R$ is the number of ranks); each rank will be responsible for receiving, compositing, and delivering the final composited results of one region of pixels. Compositing then works in the following steps: \def\compactstep#1{\par\medskip\noindent\textbf{#1}} \compactstep{1) Generating a contiguous send buffer.} Given each pixel's fragment lists, each rank computes a GPU-parallel prefix sum over all its fragment counts, which also yields the total number of fragments on this rank. We then allocate a single contiguous memory region for these fragments and compact the individual fragments into this buffer (using the prefix sum result as offsets). By design, this buffer will contain all fragments going to all other ranks in order. \compactstep{2) Exchanging per-pixel fragment counts ranges.} Given the assigned range of pixels, each rank computes which range of per-pixel counters it needs to send to any other rank. To this end, each rank allocates a per-rank counter buffer with size $R$ times the number of pixels in its region. Next, each rank computes the offsets to store the counters from other ranks. We then perform a collective \code{MPI\_Alltoallv} on these buffers, after which each rank has, for its assigned region of pixels, the fragment counts from every other rank. \compactstep{3) Exchanging Fragment Lists.} Having received all other ranks' per-pixel fragment counts for its range of pixels, each rank then performs a GPU prefix sum over those counters, the result of which can once again be seen as offsets into a compact buffer of all fragments for its range of pixels. Looking up the prefix sums at the correct offsets specifies how many fragments each rank will receive from any other rank and how many fragments it will receive altogether. We then allocate a receiving buffer of the required size, look up where each other rank's fragments will go in this buffer, and issue a second \code{MPI\_Alltoallv} that, in this case, collectively moves all fragments into the receive buffer of the rank assigned to that fragment's corresponding pixels. \compactstep{4) Local Compositing.} The result of the previous steps is that each rank now has two buffers containing all fragment lists for its assigned pixels. The first buffer ---\textit{fragment buffer}--- stores all fragments for that rank's pixels received from all other ranks, ordered by ranks and pixels within each rank. Given a specific MPI rank, this buffer stores all fragments for that rank's first pixel from rank 0, then all those for its second pixel from rank 0, and so on, followed by all fragments from rank 1, then all fragments from rank 2, and so on. The second buffer ---\textit{offset buffer}--- stores the results of prefix sum operations. It, by design, provides the offsets where the fragment lists start. For example, if $P$ is the number of pixels that this rank is responsible for, then the fragments from rank $r$ for pixel $j$ start at offset \code{offsets[r*P+j]}. Using this, we can now launch a CUDA kernel that, for each pixel $p$, looks up the $R$ different lists of fragments and composites them in the visibility order. \compactstep{5) Sending final results to master.} The output of the previous CUDA kernel is, on each rank, a fully composited RGBA value for each pixel in that rank's range of pixels. We send these to the master using a \code{MPI\_Send}; the master sets up $R$ matching \code{MPI\_Irecv}s, each of which uses the appropriate part of the final frame buffer as receive buffer. Once these are completed, the master has the final assembled frame buffer, and compositing is complete. This method is a natural extension of the parallel direct-send technique as described by Grosset et al.~\cite{grosset2017todtree} and Favre et al.~\cite{favre2007directsend}, with the main difference that we not only send one fragment per pixel but variable-sized lists of fragments. We term this method \emph{deep compositing} because it merged the concepts of image-based compositing with the orthogonal concept of \emph{deep frame buffers}~\cite{GershbeinHanrahan00}. \subsubsection{Fragment List Management} Though the compositing itself is easy to use from the host side, properly setting up the device-side inputs (fragment lists and counters) would require the renderer to handle what are akin to device-side dynamic memory allocations to manage those per-pixel variable-size fragment lists during rendering. To relieve the renderer of this low-level fragment list management, we also developed what we call a \emph{device interface} for this library, through which a renderer can simply \emph{write} new fragments into a pixel, with that interface then handling the proper storage of those fragments---which significantly simplifies the rendering code. \paragraph{Two-Pass, Flexible-length Fragment Lists} The main challenge for developing this interface was that we could not simply allocate more device memory during rendering, so we needed \emph{some} limit on how many fragments a renderer would be allowed to generate in any frame. We first developed a two-stage interface in which the renderer would be run twice: in the first stage, the interface would only count the fragments produced per pixel but not store any. After this stage, it would compute a prefix sum over those counters to allocate a big enough buffer, with the prefix sum values serving as offsets into this buffer. A second pass would then perform exactly the same rendering but store the fragments at the provided offsets. \paragraph{Single-Pass, Fixed-Length Fragment Lists} The two-pass method allows for arbitrary-sized fragment lists (up to device memory, obviously); but requires running at least the shell traversal twice, which may or may not be acceptable. We, therefore, also developed a second, single-pass device interface in which the renderer---upon initialization---specifies a maximum allowed number of fragments per pixel, which can then be used to pre-allocate lists to add fragments. Having a single pass is straightforward but requires some form of \emph{overflow}-handling if a render wants to submit fragments to a pixel whose list is already full. We currently implement two methods for this overflow handling: In the \emph{drop} method, we perform insertion sort into the existing list and simply drop the latest fragment. In \emph{merge}, we find the fragment with the lowest opacity and perform a \emph{over} compositing of this element onto the one in front of it (i.e., using the depth from the previous one), then insert the new fragment into the list. \subsubsection{Implementation Details} Though primarily developed for this particular application, we believe the method just described is also applicable to other, similar applications, and thus decided to implement this into a stand-alone \emph{deep compositing} library that the rest of our renderer then uses. The compositing itself uses MPI, for which in our application, we use a CUDA-aware version of OpenMPI 4.1. Using CUDA-aware MPI allows the compositing code to directly operate on device buffers, which means that the same library can work with both host and device-side renderers. We use CUDA for the device interface, with a simply host-side interface to initialize and trigger compositing. The bandwidth required for compositing is often a bottleneck in data-parallel parallel rendering, even with only a single fragment per pixel. One step we use to reduce bandwidth is that we allow the user to specify whether to use full \emph{float} precision for fragments (five floats total, for r, g, b, depth, and opacity); or to use a lower-precision encoding with 8-bit fixed-point for RGBA, and floats only for the depth value. The device interface in both cases is the same, but that interface encodes fragments as they get submitted. We also automatically discard fragments with zero opacity value, as these will not contribute to the image. Aside from the fragments, the per-pixel counters require a large bandwidth. To reduce that, we use specialized encodings with 2, 4, 8, or 32 bits for those counters, depending on the longest fragment list length. We use dedicated CUDA kernels for encoding and decoding the 32-bit counter arrays into this lower-precision representation before and after the \code{MPI\_Alltoallv} counter exchange; otherwise, perform the algorithm exactly as described above. \section{Experimental Results} \label{sec:evaluation} We conducted our experiments on Frontera RTX nodes of Texas Advanced Computing Center (TACC), where each of the 22 nodes had four NVIDIA Quadro RTX 5000 plugged into it. We utilize all four GPUs available per node for every data point of our experiments. \subsection{Evaluation of the Framework} We evaluate our rendering framework on Small Mars Lander and Huge Mars Lander data sets. \autoref{fig:teaser} show images of the Small Mars Lander rendered using our framework. Since Small Mars Lander has 72 clusters, we evaluate our framework using 72 GPUs distributed over 18 compute nodes where each cluster is loaded on a separate GPU. For Small Mars Lander, we achieve our peak performance using 72 GPUs yielding the average fps of 14.35. Since the TACC supercomputer does not have more than 22 RTX nodes, we could not test one cluster per GPU scenario for the Huge Mars Lander data set. Therefore, we scale up to a maximum GPU count of 88, yielding 9.83 fps. However, we observe our average peak performance of 10.25 fps for the Huge Mars Lander at 80 GPUs. Moreover, we evaluate our deep compositing scheme's correctness compared to a single fragment compositing technique. \autoref{fig:ice_t_diff} shows an image rendered by single fragment compositing and a heatmap that compares the difference between single fragment compositing and our deep compositing. The single fragment compositing method depicted is similar to the image-based single image per node compositing techniques such as IceT~\cite{moreland2011icet}. \begin{figure}[htbp] \begin{center} \includegraphics[width=0.44\columnwidth]{drawings/small_lander_frame19_ice_t.png} \includegraphics[width=0.44\columnwidth]{drawings/ice_t_diff.png} \includegraphics[height=0.44\columnwidth]{drawings/ice_t_diff_colorbar_vertical.pdf} \end{center} \caption{The left image is the rendering with single fragment compositing (similar to IceT \cite{moreland2011icet}). The right image is the heatmap showing the L2 difference between single fragment compositing and our deep compositing.} \label{fig:ice_t_diff} \end{figure} \subsection{Memory Overhead} We examine data distribution and memory footprints. \autoref{tab:element_shell_stats} displays the minimum, maximum and average counts per rank of volume elements and shell faces for our two data sets. The MPI sizes (rank counts) in the table are the sizes that experience the highest level of changes in terms of rendering times presented in \autoref{fig:timing_plots}. \autoref{fig:memory_plots} illustrates average memory footprints of our large data structures that may not be present in a simulation environment. Although connectivity information will likely be in most of the simulation systems, we wanted to include connectivity here for the sake of simulation systems like~\cite{ishii20194dtreebased}. \begin{table}[htbp] \centering \caption{Per rank statistics for selected MPI sizes for two test data sets. The first column gives the MPI size with a number and data set as ``small'' for Small Mars Lander and ``huge'' for Huge Mars Lander. Columns depict minimum, maximum, and average volume element counts and minimum, maximum, and average shell face counts per rank.} {\small \begin{tabular}{cccc|ccc} \hline \multicolumn{1}{c}{\multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}MPI Size\\ \& data set\end{tabular}}} & \multicolumn{3}{c|}{Elements} & \multicolumn{3}{c}{Shell} \\ \cline{2-7} \multicolumn{1}{c}{} & \multicolumn{1}{c}{min.} & \multicolumn{1}{c}{max.} & \multicolumn{1}{c|}{avg.} & \multicolumn{1}{c}{min.} & \multicolumn{1}{c}{max.} & \multicolumn{1}{c}{avg.} \\ \hline 4-small & 192.2 M & 203.4 M & 199.6 M & 14.4 M & 16.2 M & 15.2 M \\ 24-small & 30.8 M & 34.9 M & 33.3 M & 2.0 M & 2.9 M & 2.5 M \\ 40-small & 10.0 M & 23.3 M & 20.0 M & 0.8 M & 1.9 M & 1.5 M \\ 72-small & 9.9 M & 11.9 M & 11.1 M & 0.6 M & 1.1 M & 0.8 M \\ \hline 16-huge & 365.2 M & 414.6 M & 399.2 M & 21.4 M & 25.1 M & 23.0 M \\ 32-huge & 177.8 M & 213.8 M & 200.0 M & 10.3 M & 13.2 M & 11.5 M \\ 56-huge & 93.8 M & 121.0 M & 114.1 M & 5.4 M & 7.3 M & 6.6 M \\ 88-huge & 60.9 M & 85.1 M & 72.6 M & 3.3 M & 5.3 M & 4.2 M \\ \hline \end{tabular} } \label{tab:element_shell_stats} \end{table} \begin{figure*}[htbp] \begin{center} \fbox{% \begin{minipage}{.48\textwidth} \includegraphics[align=c, width=.40\columnwidth]{png/offlineViewer_frame18.png} \hfill \includegraphics[align=c, width=.58\columnwidth]{drawings/small_plot_stack.pdf} \end{minipage} }% \hfill \fbox{% \begin{minipage}{.48\textwidth} \includegraphics[align=c, width=.40\columnwidth]{png/Huge-offlineViewer_frame18.png} \hfill \includegraphics[align=c, width=.58\columnwidth]{drawings/huge_plot_stack.pdf} \end{minipage} }% \end{center} \caption{Results of the scalability benchmarks for Small Mars Lander (left) and Huge Mars Lander (right) on RTX nodes of the Frontera system on TACC. Integration process timings are stacked over compositing process timings for the given number of ranks to form total rendering times. } \label{fig:timing_plots} \end{figure*} \begin{figure}[htbp] \begin{center} \includegraphics[width=.495\columnwidth]{drawings/small_lander_plot_memory.pdf} \includegraphics[width=.495\columnwidth]{drawings/huge_lander_plot_memory.pdf} \end{center} \caption{Per rank average memory consumption of various buffers for increasing MPI sizes: Small Mars Lander (left) and Huge Mars Lander (right). Average memory usage of XOR-compacted elements is stacked over average shell-BVH size, which again is stacked over average connectivity buffer size, providing the total memory usage introduced by these data. We also include a line that indicates the per rank average memory usage without XOR-based compaction (size of Shell-BVH + connectivity buffer + non-compact elements).} \label{fig:memory_plots} \end{figure} \subsection{Scalability} To assess the scalability, we test our approach for increasing the number of ranks (MPI sizes). We also measure sub-process timings, specifically the segment integration and compositing times. We compute them by using \code{MPI\_Barrier}s before and after integration calls to synchronize the processes before starting and ending the timers. Since these barriers stall early terminating integration processes, it causes the total rendering time to increase. For this reason, we measure the total rendering time and integration time in different runs and derive the compositing time by subtracting the total time from the integration time. We calculate the timings reported in \autoref{fig:timing_plots} as follows: we take an average for 20 sequential timesteps of the selected scalar field over 30 runs. Then we take the mean of these 20 average values to form the data points for the given MPI sizes. \subsection{Fragment Distribution} Since it is crucial to assess workload distribution across compute nodes for both compositing and integration steps, we measure fragment counts generated by each GPU during ray segment generation. To this end, we present a box plot in \autoref{fig:num-frags}, which depicts the total and average fragment counts for specific MPI sizes on the Huge Mars Lander. We also visualize a series of ``heat images'' for the case where the rank count is equal to 16, which illustrates the fragments composited for a view of the Huge Mars Lander. Each small image shows given nodes generated fragment counts, and the final image accumulates them on top of each other. \section{Discussion} \label{sec:discussion} We evaluate our approach regarding memory consumption, rendering correctness, and scalability. Among the data we precompute and store, the connectivity information takes up the lion's share with ratios around $\approx62.72\%$ for our test cases. We expect this since our approach stores one integer for all faces of a given volume element. XOR-compacted volume elements are the second-largest structure with ratios around $\approx17.11\%$, closely followed by Shell-BVH sizes ($\approx12.74\%$) of the total memory consumption. We observe that the total memory footprint of XOR-compacted representations is $\approx72.49\%$ smaller than their uncompacted versions. The presented framework is memory-wise compatible with in~situ scenarios because many modern simulation systems already store connectivity information. Our XOR-compaction reduces the space required for geometry information, and our shell-BVH sizes stay relatively small despite the large counts of shell faces. We observe that simple image compositing is not an option for non-trivially partitioned data sets like we present. As the error metric in \autoref{fig:ice_t_diff} confirms, single image compositing gives inaccurate results. Moreover, we found our compositing process to create low overheads even with the GPU counts going up to 88. Although the communication cost for compositing created an increasing trend in terms of time, it never surpassed 22.68\% of the total rendering time, which is an indication that our deep compositing method is highly scalable and generates correctly composited images interactively (see~\autoref{fig:timing_plots}). Although the proposed ray-marcher is suitable for the use-cases described, any other ray-marcher that can adequately handle non-convex boundaries can be utilized. For instance, point-query sampling techniques that can leverage adaptive sampling or space skipping~\cite{morrical2019spaceskip,Wang2020noveladaptivesampling} may produce much faster results. However, such methods rely heavily on hierarchical data structures to sample the volume, which would create more additional memory overhead. One could claim point-query sampling techniques negate this memory over-head by not storing connectivity; however, as pointed out before, many simulation environments have that data out of the box. Furthermore, point-query sampling techniques usually produce a noisy image that requires some convergence time to be passed, whereas our marching method generates deterministic noise-free images. For these reasons, we consider our marching algorithm to be more pragmatic in the context of data-parallel rendering and deep compositing. Finally, examining data distributions from \autoref{tab:element_shell_stats}, we see that directly utilizing native partitioning of the data causes uneven load balancing for some MPI sizes. \autoref{fig:num-frags} reveals this phenomenon where the average number of fragments per rank distribution varies. The effects of this phenomenon can also be observed in \autoref{fig:num-frags-vis}, where ranks 1, 4, and 14 have significantly fewer fragments than the others. Even though native partitioning causes uneven workloads, our timing experiments (cf.~\autoref{fig:timing_plots}) display decent scalability with the increasing number of GPUs we utilized. We smoothly achieve interactive rates with both of our data sets. For the small Mars Lander that has 72 clusters, we benchmark \emph{14.35 fps} using 72 GPUs, and for the 552-cluster huge Mars Lander, we measure \emph{10.27 fps} using 80 GPUs. We also observe an ongoing downwards trend for the timings with the increasing number of GPUs, so it is worth mentioning that our application can achieve even higher frame rates given a more extensive hardware setup. Furthermore, it is clear from \autoref{fig:timing_plots} that dominating term of rendering times is volume integration via ray-marching. Nevertheless, we observe a sharp increase in integration performance at $n=24$ and $n=32$ for Small and Huge Mars Lander, respectively. At the same time, it is expected for an embarrassingly parallel ray-casting algorithm to get faster with the increasing number of ranks; it is also likely for a compositing algorithm to slow down due to communication costs. We observe little to no increase in timings with our deep compositing, where it nearly behaves like a constant. \section{Conclusions and Future Work} \label{sec:conclusion} We introduce a GPU-based direct volume visualization framework that allows correct and interactive rendering even for non-convexly partitioned data. Our framework presents a mixed element ray-marching algorithm to integrate ray segments along the viewing direction. We achieved memory savings by exploiting XOR-based compaction schemes on our finite element data structures. Furthermore, we illustrate a deep compositing algorithm that allows proper order compositing of the RGBA-Z values obtained across multiple compute nodes. Our framework scales well for increasing GPU counts while using native partitioning of non-convex data sets. We consider our framework suitable for both in~situ and post~hoc applications. Possible areas for further research are as follows. While we allow visualizations of multiple scalar fields and timesteps, we do not use double/triple buffering techniques that can hide the buffer loading times. Our implementation naively takes one scalar set on request (i.e., does not pre-fetch anything). In order to improve the time steps loading performance, buffering and pre-fetching the time steps in GPU and main memory can be employed \cite{shih2014out}. Moreover, currently, we assume that the topology of the volumetric data does not change through time, yet this may not be the case. Furthermore, our sampling method does not support bilinear elements since determining vertex index order after element construction is difficult for them using our XOR-compaction. Also, we would utilize another compaction scheme over connectivity information as other works do \cite{muigg2011interactivevol, aman2021compact}. Image-based partitioning may further increase our method's efficiency; however, it can get challenging with the in~situ emphasis. Finally, integrating our approach into existing frameworks is another future work, field testing our claims. \acknowledgments{ Intentionally omitted for review.} \balance \bibliographystyle{abbrv-doi}
{'timestamp': '2022-09-30T02:07:15', 'yymm': '2209', 'arxiv_id': '2209.14537', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14537'}
arxiv
\section{Introduction} \label{sec-int} Deep reinforcement learning (DRL) is a booming field of research in machine learning with diverse real-world applications \cite{ibarz2021}. In recent years, many \emph{model-free} DRL algorithms achieved cutting-edge performance in tackling various continuous reinforcement learning (RL) problems, including complex control tasks with high-dimensional state and action spaces \cite{liu2021}. These algorithms can effectively train \emph{deep neural networks} (DNNs) to precisely model high-quality control policies and are the central focus of this paper. Despite of widely reported success, a majority of existing \emph{actor-critic DRL algorithms}, such as DDPG \cite{lillicrap2015}, SAC \cite{haarnoja2018} and PPO \cite{schulman2017}, still suffer from some major limitations. Specifically, existing research works showed that the algorithm performance is highly sensitive to hyper-parameter settings and can vary substantially in different algorithm runs \cite{paine2020}. \emph{Ineffective exploration} is often considered as a major cause for the poor learning stability \cite{chan2019}, often resulting in overfitting and premature convergence to poor local optima \cite{kurutach2018}. Rather than relying on one learner (or DRL agent), an ensemble of base learners can be jointly utilized to boost exploration and stabilize the learning process \cite{osband2016deep,osband2017post}. For example, the \emph{ensemble deep deterministic policy gradient} (ED2) algorithm is a newly developed ensemble DRL method \cite{januszewski2021} that trains multiple DNN policies simultaneously using a shared \emph{experience replay buffer} (ERB), similar to several previously proposed parallel DRL algorithms \cite{barth2018,mnih2016asyn}. ED2 features a unique mixture of multiple well-studied tricks, including temporally-extended deep exploration, double Q-bias reduction, and target policy smoothing \cite{osband2016deep,osband2017post,van2016deep,fujimoto2018}. It was reported to outperform state-of-the-art ensemble DRL algorithms such as SUNRISE \cite{lee2021sunrise} on several difficult Mujoco benchmark control problems. As far as we know, most of the existing ensemble DRL algorithms are designed to train each base learner individually. For example, in ED2, every base learner trains its own DNN policy using its own critic, with the aim to improve its own performance without considering the impact of the trained policy on the ensemble. While sharing the same ERB, policy training is conducted largely independently by all base learners. This is shown to promote healthy exploration in \cite{januszewski2021}. However, there is no guarantee that the base learners will collaborate effectively such that the ensemble as a whole can achieve desirable performance. To address this limitation, we propose a new \emph{hierarchical approach} for training base learners in this paper. Specifically, we follow ED2 for \emph{low-level training} of DNN policies, which will be performed concurrently by all base learners. In the meantime, we construct a \emph{global critic}, which is trained constantly to predict the performance of the ensemble. Guided by the global critic, \emph{high-level training} of DNN policies will be performed regularly to strengthen cooperation among all the base learners. Since the ensemble is not used directly to collect state-transition samples from the learning environment, we must make sure that high-level training of the ensemble is not performed on \emph{out-of-distribution} data obtained by individual base learners. In view of this, it is important to encourage \emph{inter-learner parameter sharing} so that the DNN policy trained by one base learner can contribute directly to (or influence) the training of DNN policies by other base learners. For this purpose, we develop a new technique in this paper for high-level training of policies based on the \emph{multi-step integration methods} for solving \emph{ordinary differential equations} (ODEs) in \cite{scieur2017}. Our high-level policy training technique is theoretically justified as it guarantees stability for a wide range of optimization problems. Meanwhile, it can be shown analytically that the trained linear parametric policies (a special and important technique for policy approximation) of all base learners are expected to behave more consistently as the ensemble through high-level policy training, encouraging inter-learner collaboration and alleviating the data distribution issue. Driven by the hierarchical policy training method, we develop a new ensemble DRL algorithm called \emph{hierarchical ensemble deep deterministic policy gradient} (HED) in this paper. Experimental evaluation of HED has been conducted on a range of benchmark control problems, including the widely used Mujoco control tasks as well as the less popular and potentially more challenging PyBullet control problems. Our experiments clearly show that HED can outperform ED2, SUNRISE and several cutting-edge DRL algorithms on multiple benchmark problems. \iffalse The rest of this paper is organized as follows. We review the related research works in the recent literature in the subsequent section. Necessary technical background for developing the HED algorithm is presented next, followed by the detailed design of HED. The empirical performance of the new algorithm is further evaluated before the concluding remarks. \fi \section{Related Work} \label{sec-rw} Similar to ED2, HED trains an ensemble of policies using an \emph{off-policy} DRL algorithm to leverage on the algorithm's advantages in \emph{sample efficiency}. Recently, several off-policy DRL algorithms have been developed successfully for RL in continuous spaces, including DDPG \cite{lillicrap2015}, SAC \cite{haarnoja2018}, TD3 \cite{fujimoto2018}, and SOP \cite{wang2020}. These algorithms introduce a variety of tricks to stabilize the learning process. For example, TD3 extends the idea of double Q-network \cite{van2016deep} to a new double-Q bias reduction technique, which can effectively prevent over-optimistic training of DNN policies. In addition, empirical evidence showed that the learning process becomes more stable when the actor and critic in TD3 are trained with different frequencies or in different phases \cite{fujimoto2018,cobbe2021}. The base learners in our HED ensemble will adopt these tricks. The recent literature also provides some new tricks to stabilize learning. Specifically, various trust-region methods have been developed to prevent negative behavioral changes during policy training \cite{kurutach2018,schulman2015,shani2020,wu2017,schulman2017}. Meanwhile, entropy regularization techniques prohibit immature convergence of the trained policies and ensure prolonged profitable exploration \cite{chen2018,haarnoja2018}. However, these techniques are mainly applied to stochastic policies while we aim at learning an ensemble of deterministic policies. Previous research showed that deterministic policies can often be trained more efficiently than stochastic policies using the \emph{reparameterization trick} \cite{fujimoto2018,silver2014,baek2020}. The stability of a DRL algorithm depends critically on how the learner explores its environment. Besides the entropy regularization methods, curiosity metrics are popularly employed to encourage a learner to explore rarely visited states during RL \cite{reizinger2020,zhelo2018}. Meanwhile, many previous studies embraced the \emph{optimum in the face of uncertainty} (OFU) principle to design bonus rewards for actions with high potentials, thereby promoting exploration in promising areas of the learning environment \cite{bellemare2016}. One good example is the UCB exploration technique developed in \cite{chen2017ucb,lee2021sunrise}. However, in \cite{januszewski2021}, this technique was shown to be less effective than the bootstrap with random initialization trick adopted in ED2. Temporally-extended exploration on RL problems with continuous actions can also be achieved by adding a small amount of noise to DNN weights \cite{plappert2017}. This is directly related to the posterior sampling methods that are often used to select the best actions among a statistically plausible set of sampled actions \cite{osband2018}. Following the OFU principle, deep ensembles have been recently proposed to approximate Bayesian posteriors with high accuracy and efficiency \cite{lakshminarayanan2016}. They are subsequently used to approach deep exploration for reliable RL \cite{osband2016deep}. Several issues have been investigated under the context of ensemble DRL. For instance, the diversity of base learners is essential to the performance of the ensemble. To encourage diversity, either different DRL algorithms or the same algorithm with differed hyper-parameter settings have been adopted to train base learners \cite{huang2017,wiering2008}. Meanwhile, proper aggregation of the action outputs from all base learners in an ensemble poses another challenge. Typical approaches to tackle this issue include taking the mean action as the output of the ensemble and choosing the action with highest predicted cumulative rewards \cite{januszewski2021,chen2019}. As far as we know, few existing ensemble DRL algorithms in the literature have ever studied the important issue on how to effectively train all base learners to jointly improve the ensemble performance. This issue will be explored in-depth with the newly developed HED algorithm in this paper. \section{Background} \label{sec-back} An RL problem is modeled as a \emph{Markov Decision Process} (MDP) $(\mathcal{S},\mathcal{A},R,P,\gamma,p_0)$, where $\mathcal{S}$ and $\mathcal{A}$ refer respectively to the continuous multi-dimensional state space and action space. $P$ stands for the state-transition model that governs the probability of reaching any state $s_{t+1}\in\mathcal{S}$ at timestep $t+1$ upon performing any action $a_t\in\mathcal{A}$ in state $s_t\in\mathcal{S}$ at timestep $t$, with $t\in\mathbb{Z}^+$. Additionally, $\gamma\in[0,1)$ is the discount factor, $R$ is the reward function, and $p_0$ captures the initial state distribution. To solve any RL problem described above, we aim to learn an optimal \emph{deterministic ensemble policy} $\pi^e_*(s)$ that maps any state input $s\in\mathcal{S}$ to an action vector $a\in\mathcal{A}$ so as to maximize the \emph{cumulative rewards} defined below $$ \pi^e_*= \argmax_{\pi^e} J(\pi^e)=\argmax_{\pi^e}\mathbb{E}_{\tau\sim\pi^e} \left[ \sum_{t=1}^{\infty}\gamma^{t-1} R(s_t,a_t) \right], $$ where $\tau=[(s_t,a_t,r_t,s_{t+1})]_{t=1}^{\infty}$ contains a series of consecutive state-transition samples and is called a \emph{episode}, which can be obtained by following the ensemble policy $\pi^e$, and $r_t=R(s_t,a_t)$ is the immediate reward received at timestep $t$ in $\tau$. For an ensemble with $N$ base learners where each base learner $L_i$, $1\leq i\leq N$, maintains its own deterministic base policy $\pi^i$, the action output of $\pi^e$ is jointly determined by all the \emph{base policies} according to \begin{equation} \forall s\in\mathcal{S}, \pi^e(s)=\frac{1}{N}\sum_i^N \pi^i(s). \label{equ-pe} \end{equation} In order to train an ensemble to maximize the cumulative rewards, our baseline algorithm ED2 uses randomly selected base learners to sample a series of episodes $\{\tau_i\}$, which will be stored in the shared ERB. At regular time intervals, a mini-batch of state-transition samples will be retrieved from the ERB. Every base learner $L_i$ will then use the retrieved mini-batch to train its own actor $\pi^i$ and critic $Q^i$ individually. In other words, a base learner manages two separate DNNs, one models the deterministic policy $\pi^i$ and the other approximates the Q-function $Q^i$ of $\pi^i$. A base learner uses an existing actor-critic RL algorithm to train the two DNNs. In this paper, we choose TD3 for this purpose due to its proven effectiveness, high popularity and stable learning behavior \cite{fujimoto2018}. \section{Hierarchical Ensemble Deep Deterministic Policy Gradient} \label{sec-algo} The pseudo-code of the HED algorithm is presented in Algorithm \ref{alg-code}. HED follows many existing works including ED2 \cite{osband2016deep,januszewski2021} to achieve temporally-extended exploration through bootstrapping with random initialization of DNN policies. As clearly shown in \cite{januszewski2021}, this exploration technique is more effective than UCB and parameter randomization methods. Different from ED2 which completely eliminates the necessity of adding small random noises to the deterministic action outputs from the DNN policies, we keep a small level of action noise\footnote{The noise is sampled from the Normal distribution independently for each dimension of the action vector. The variance of the normal distribution is fixed at 0.01 during the learning process.} while using any chosen policy to explore the learning environment. We found empirically that this ensures coherent exploration, similar to \cite{osband2016deep}, while making the testing performance of the trained policies more stable. Different from ED2 and other ensemble algorithms for RL in continuous spaces, HED trains DNN policies at two separate levels. The low-level training of $\pi^i$ and $Q^i$ by each base learner $L_i$ is essentially the same as ED2 and TD3. Specifically, for any base learner $L_i$, $i\in\{1,\ldots,N\}$, $Q^i$ is trained by $L_i$ to minimize $MSE_i$ below \begin{equation} MSE_i=\frac{1}{|\mathcal{B}|} \sum_{(s,a,r,s')\in\mathcal{B}}\left(Q^i_{\phi_i}(s,a)-r-\gamma\min_{k=1,2}\hat{Q}^i_{k}(s',\pi^i(s')+\epsilon) \right)^2, \label{equ-mse} \end{equation} where $\phi_i$ represents the trainable parameters of the DNN that approximates $Q^i$. $\mathcal{B}$ is the random mini-batch retrieved from the ERB. $\hat{Q}^i_{k}$ with $k=1,2$ stands for the two target Q-networks of $L_i$ that together implement the double-Q bias reduction mechanism proposed in \cite{fujimoto2018}. Additionally, $\epsilon$ is a random noise sampled from a Normal distribution with zero mean and small variance\footnote{The variance for sampling $\epsilon$ is kept at a very small level of 0.01 in the experiments.}. Using the trained $Q^i$, the trainable parameters $\theta_i$ of the DNN that models policy $\pi^i$ is further updated by $L_i$ along the \emph{policy gradient} direction computed below \begin{equation} \nabla_{\theta_i}J(\pi^i_{\theta_i})=\frac{1}{|\mathcal{B}|}\sum_{s\in\mathcal{B}} \nabla_{a}Q^i(s,a)|_{a=\pi^i_{\theta_i}(s)}\nabla_{\theta_i}\pi^i_{\theta_i}(s). \label{equ-pg} \end{equation} Besides the above, HED constantly trains a separate high-level Q-function $Q^e$ to predict the performance of the ensemble policy $\pi^e$. Guided by the trained $Q^e$, high-level policy training is conducted regularly to update policy $\pi^i$ of all base learners so as to enhance their cooperation and performance. A new \emph{multi-step technique} is developed in HED to enable inter-learner parameter sharing during high-level policy training. To implement this technique, we keep track of a list of bootstrap policy parameters for the multi-step training process. More details can be found in the subsequent subsection. Theoretical justifications regarding the usefulness of the multi-step approach are also provided below. \begin{algorithm}[!ht] \begin{algorithmic} \STATE {\bf Input}: Ensemble size $N$; initial policy networks $\pi^i_{\theta_i}$ and Q-networks $Q^i_{\phi_i}$ for $i\in\{1,\ldots,N\}$; ERB; ensemble Q-network $Q^e_{\phi_e}$; target Q-networks for each base learner and the ensemble \STATE {\bf Output}: Trained ensemble policy $\pi^e$ \STATE {\bf While} the total number of sampled trajectories $<$ max number of trajectories: \STATE \ \ \ \ Randomly sample $i\in\{1,\ldots,N\}$ \STATE \ \ \ \ {\bf While} the current trajectory does not terminate: \STATE \ \ \ \ \ \ \ \ Use $\pi^i$ to perform the next action \STATE \ \ \ \ \ \ \ \ Store sampled state-transition in ERB \STATE \ \ \ \ \ \ \ \ Track number of steps sampled before critic training \STATE \ \ \ \ \ \ \ \ {\bf If} time for critic training: \STATE \ \ \ \ \ \ \ \ \ \ \ \ {\bf For} number of steps sampled: q\STATE \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Sample a mini-batch $\mathcal{B}$ from ERB \STATE \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Train $Q^i_{\phi_i}$ for $i\in\{1,\ldots,N\}$ using \eqref{equ-mse} \STATE \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Train $Q^e_{\phi_e}$ using \eqref{equ-e-mse} \STATE \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {\bf If} time for {\bf low-level} policy training: \STATE \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Train $\pi^i_{\theta_i}$ for $i\in\{1,\ldots,N\}$ using \eqref{equ-pg} \STATE \ \ \ \ \ \ \ \ {\bf If} time for {\bf high-level} policy training: \STATE \ \ \ \ \ \ \ \ \ \ \ \ Set bootstrap list $\{x_j\}_{j=0}^{2}$ for each base learner \STATE \ \ \ \ \ \ \ \ \ \ \ \ {\bf For} a fraction of sampled steps: \STATE \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Train $\pi^i_{\theta_i}$ for $i\in\{1,\ldots,N\}$ using \eqref{equ-mu-new} \STATE \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Append trained $\theta_i$ for $i\in\{1,\ldots,N\}$ to the bootstrap lists of each base \STATE \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ learner for the next step of high-level policy training \end{algorithmic} \caption{The pseudo-code of the HED algorithm.} \label{alg-code} \end{algorithm} \subsection{A multi-step technique for high-level policy training} \label{subsec-multipol} In addition to $Q^i$ for each base learner $L_i$, $i\in\{1,\ldots,N\}$, HED maintains a separate Q-network to approximate $Q^e$ of the ensemble policy $\pi^e$. Similar to \eqref{equ-mse}, HED trains this central Q-network towards minimizing $MSE_e$ below \begin{equation} MSE_e=\frac{1}{|\mathcal{B}|} \sum_{(s,a,r,s')\in\mathcal{B}}\left(Q^e_{\phi_e}(s,a)-r-\gamma\hat{Q}^e(s',\pi^e(s')) \right)^2, \label{equ-e-mse} \end{equation} with $\phi_e$ representing the trainable parameters of the central Q-network. $\hat{Q}^e$ stands for the corresponding target Q-network that stabilizes the training process. For simplicity, we do not add random noise $\epsilon$ in \eqref{equ-mse} to the action outputs produced by the ensemble policy $\pi^e$ in \eqref{equ-e-mse}. Furthermore, following \cite{van2016deep}, one target Q-network instead of two is adopted in \eqref{equ-e-mse} to facilitate the training of $Q^e$. Building on the trained $Q^e$, we can calculate the \emph{ensemble policy gradient} with respect to $\theta_i$ of every base learner $L_i$ as follows \begin{equation} \nabla_{\theta_i}J(\pi^e)= \frac{1}{|\mathcal{B}|}\sum_{s\in\mathcal{B}} \nabla_{a}Q^e(s,a)|_{a=\pi^e(s)}\nabla_{a_i}\pi^e(s)|_{a_i=\pi^i_{\theta_i}(s)}\nabla_{\theta_i}\pi^i_{\theta_i}(s), \label{equ-e-pg} \end{equation} with $$ \nabla_{a_i}\pi^e(s)|_{a_i=\pi^i_{\theta_i}(s)}=\frac{1}{N} I, $$ according to \eqref{equ-pe}. $I$ stands for the $m\times m$ identity matrix where $m$ is the dimension of the action vector. One straightforward approach for high-level policy training is to update $\theta_i$ of every base learner $L_i$ in the direction of \eqref{equ-e-pg}. However, using \eqref{equ-e-pg} alone may not encourage any base learner $L_i$ to behave consistently with the ensemble (see Proposition \ref{the-2}). Consequently, high-level training of the ensemble policy may be performed on the out-of-distribution state-transition samples collected by the base learners, affecting the training effectiveness. Furthermore, ensembles are used mainly for temporally-extended exploration in the literature. The learning activity of one base learner can only influence other base learners indirectly through the shared ERB. Base learners do not explicitly share their learned policy parameters in an ensemble to strengthen inter-learner cooperation and boost the learning process. To address this limitation, we propose to promote inter-learner parameter sharing during high-level policy training, in order to achieve a desirable balance between exploration and inter-learner cooperation. Specifically, in addition to \eqref{equ-e-pg}, we randomly select \emph{two base learners} $L_p$ and $L_q$ and use their policy parameters to guide the training of policy $\pi^i$ of any base learner $L_i$. In comparison to \emph{selecting one base learner}, this allows more base learners to have the opportunity to share their parameters with the base learner $L_i$ during policy training. It is also possible to recruit more than two base learners. However, in this case, it is mathematically challenging to derive stable learning rules for high-level policy training. Motivated by the above discussion, a search through the literature leads us to the linear multi-step integration methods recently analyzed in \cite{scieur2017}. Consider a simple \emph{gradient flow equation} below \begin{equation} x(0)=\theta_i^0, \frac{\partial x(t)}{\partial t}=g(x(t))=\nabla_{\theta_i}J(\pi^e)|_{\theta_i=x(t)}, \label{equ-gfe} \end{equation} where $\theta_i^0$ refers to the initial policy parameter of base learner $L_i$. If $J(\pi^e)$ is strongly concave and Lipschitz continuous, the solution of \eqref{equ-gfe} allows us to obtain the optimal policy parameters $\theta_i^*$ when $x(t)$ approaches to $\infty$. Since $J(\pi^e)$ is not strongly concave for most of real-world RL problems, $x(t)$ in practice may only converge to a locally optimal policy, which is common among majority of the policy gradient DRL algorithms. Therefore high-level training of policy $\pi^e$ and hence $\pi^i$ can be approached by numerically solving \eqref{equ-gfe}. This can be achieved through a linear $\mu$-step method shown below \begin{equation} x_{k+\mu}=-\sum_{j=0}^{\mu-1}\rho_j x_{k+j}+h\sum_{j=0}^{\mu-1}\sigma_j g(x_{k+j}), \forall k\geq 0, \label{equ-mu-step} \end{equation} where $\rho_j,\sigma_j\in\mathbb{R}$ are the pre-defined coefficients of the multi-step method and $h$ is the learning rate. Clearly, each new point $x_{k+\mu}$ produced by the $\mu$-step method is a function of the preceding $\mu$ points. In this paper, we specifically consider the case when $\mu=3$. Meanwhile, let \begin{equation} x_0=\theta_p,x_1=\theta_q,x_2=\theta_i \label{equ-boot-list} \end{equation} where $p$ and $q$ are the randomly generated indices of two base learners and $i$ is the index of the base learner whose policy $\pi^i$ is being trained by the $\mu$-step method. Through this way, the training of policy $\pi^i$ is influenced directly by base learners $L_p$ and $L_q$ through explicit inter-learner parameter sharing. $x_i (i\geq 3)$ in \eqref{equ-mu-step} represents the trained policy parameters of $\pi^i$ in subsequent training steps. Although \eqref{equ-mu-step} allows us to use $\nabla_{\theta_p}J(\pi^e)$ and $\nabla_{\theta_q}J(\pi^e)$ to train $\theta_i$, they do not seem necessary for inter-learner parameter sharing. To simplify \eqref{equ-mu-step}, we set $\sigma_0=\sigma_1=0$ and $\sigma_2=1$. Hence only $g(x_{k+2})$, which is the ensemble policy gradient with respect to policy $\pi^i$ in \eqref{equ-e-pg}, is used to train $\pi^i$. With this simplification, we derive the new learning rule for high-level policy training below \begin{equation} \begin{split} & x_{k+3}= -\rho_2 x_{k+2}-\rho_1 x_{k+1}-\rho_0 x_k+h\cdot \nabla_{\theta_i}J(\pi^e)|_{\theta_i=x_{k+2}}, \forall k\geq 0 \\ & x_0=\theta_p,x_1=\theta_q,x_2=\theta_i \end{split} \label{equ-mu-new} \end{equation} To implement \eqref{equ-mu-new} in HED, before high-level policy training, every base learner $L_i$ must set up a \emph{bootstrap list} of policy parameters $\{x_0=\theta_p,x_1=\theta_q,x_2=\theta_i\}$. After the $k$-th training step ($k\geq 0$) based on \eqref{equ-mu-new}, $L_i$ appends the trained $\theta_i$ as $x_{k+3}$ to the bootstrap list, which will be utilized to train $\pi^i$ in the subsequent training steps. Reliable use of \eqref{equ-mu-new} demands for careful parameter settings of $\rho_0$, $\rho_1$, $\rho_2$ and $h$. Relevant theoretical analysis is presented below. \subsection{Theoretical analysis of the multi-step policy training technique} \label{subsec-multithe} In this subsection, a theoretical analysis is performed first to determine suitable settings of $\rho_0$, $\rho_1$, $\rho_2$ and $h$ for stable high-level policy training through \eqref{equ-mu-new}. To make the analysis feasible, besides the strongly concave and Lipschitz continuous conditions, we further assume that \begin{equation} \nabla_{\theta_i}J(\pi^e)\approx -A(\theta_i-\theta_i^*) \label{equ-grad-linear} \end{equation} where $A$ is a positive definite matrix whose eigenvalues are bounded positive real numbers. $\theta_i^*$ stands for the global-optimal (or local-optimal) policy parameters. Many strongly concave functions satisfy this assumption \cite{scieur2017}. Meanwhile, the attraction basin of the local optimum of many multi-modal optimization problems often satisfies this assumption too. Using this assumption, we can derive Proposition \ref{the-1} below. \begin{proposition} Upon using \eqref{equ-mu-new} to numerically solve \eqref{equ-gfe}, the following conditions must be satisfied for $x_k$ to converge to $\theta_i^*$ as $k$ approaches to $\infty$: \begin{enumerate} \item $\rho_2=\rho_0-1$, $\rho_1=-2\rho_0$; \item $0<\rho_0<\frac{1}{2}$; \item $h$ is reasonably small such that $0\leq \lambda h < 2-4\rho_0$, where $\lambda$ can take any real value between the smallest and the largest eigenvalues of the positive definite matrix $A$ in \eqref{equ-grad-linear}. \end{enumerate} \label{the-1} \end{proposition} The proof of Proposition \ref{the-1} can be found in Appendix A. Proposition \ref{the-1} provides suitable parameter settings for \eqref{equ-mu-new} and justifies its stable use for high-level policy training. We next show that \eqref{equ-mu-new} is also expected to make base learners behave more consistently with the ensemble, without affecting the behavior of the trained ensemble, when $\rho_0$ is sufficiently small. Consider specifically that each base learner $L_i$ trains a linear parametric policy of the form: \begin{equation} \pi^i(s)=\Phi(s)^T\cdot \theta_i \label{equ-lin-pol} \end{equation} where $\Phi(s)$ represents the \emph{state feature vector} with respect to any input state $s$. For simplicity, we study the special case of scalar actions. However, the analysis can be easily extended to high-dimensional action spaces. Meanwhile, we use $Sin()$ and $Mul()$ to represent respectively the action output of a policy trained for one iteration on the same state $s$ by using either the single-step method or the multi-step method in \eqref{equ-mu-new}. The single-step method can be considered as a special case of the multi-step method with $\rho_2=-1$ and $\rho_0=\rho_1=0$. Using these notations, Proposition \ref{the-2} is presented below. \begin{proposition} When each base learner $L_i$, $i\in\{1,\ldots,N\}$, trains its linear parametric policy $\pi^i$ with policy parameters $\theta_i$ on any state $s\in\mathcal{S}$ and when $0<\rho_0<\frac{1}{3}$, \begin{enumerate} \item $Sin(\pi^e(s))=\mathbb{E}\left[ Mul(\pi^e(s)) \right]$; \item $\sum_{i\in\{1,\ldots,N\}}\mathbb{E}\left[ \left( Mul(\pi^i(s))-\mathbb{E}\left[ Mul(\pi^e(s)) \right] \right)^2 \right] \\ < \sum_{i\in\{1,\ldots,N\}}\left( Sin(\pi^i(s))-Sin(\pi^e(s)) \right)^2 \\ =\sum_{i\in\{1,\ldots,N\}}\left( \pi^i(s)-\pi^e(s) \right)^2$ \end{enumerate} where the expectations above are taken with respect to any randomly selected $p,q\in\{1,\ldots,N\}$ in \eqref{equ-boot-list}. \label{the-2} \end{proposition} Proposition \ref{the-2} indicates that multi-step training in \eqref{equ-mu-new} is expected to reduce the difference between the action output of any base learner and that of the ensemble. Meanwhile the amount of action changes applied to $\pi^e$ remains identical to the single-step method. Therefore, using the multi-step policy training method developed in this section helps to enhance consistent behaviors among all base learners of the ensemble. \begin{table*}[!ht] \caption{Final performance of all competing algorithms on 9 benchmark problems. The results are shown with mean cumulative rewards and standard deviation over 10 independent algorithm runs. For each run, the cumulative rewards are obtained by averaging over 50 independent testing episodes.} \centering \resizebox{1.0\textwidth}{!}{ \begin{tabular}{c||cccc|c} \hline & TD3 & SAC & ED2 & SUNRISE & HED \\ \hline Hopper-v0 (PyBullet) & 917.38$\pm$178.46 & 1365.47$\pm$281.3 & 2095.54$\pm$148.86 & 1976.86$\pm$311.24 & \textbf{2359.63$\pm$50.28} \\ InvertedDoublePendulum-v0 (PyBullet) & 4394.07$\pm$558.8 & 8664.3$\pm$187.83 & 8733.3$\pm$1490.51 & 8746.82$\pm$58.68 & \textbf{9351.56$\pm$13.65} \\ InvertedPendulum-v0 (PyBullet) & 484.08$\pm$49.64 & 937.33$\pm$8.0 & \textbf{999.51$\pm$1.0} & 933.58$\pm$9.03 & 995.96$\pm$7.56 \\ Reacher-v0 (PyBullet) & 8.42$\pm$1.07 & 17.43$\pm$0.66 & 15.36$\pm$2.24 & \textbf{17.65$\pm$0.44} & 17.35$\pm$0.82 \\ Hopper-v3 (Mujoco) & 1399.54$\pm$250.32 & 2369.61$\pm$906.85 & 3043.19$\pm$971.53 & 2913.56$\pm$475.48 & \textbf{3503.08$\pm$83.35} \\ Humanoid-v3 (Mujoco) & 458.77$\pm$116.08 & 1720.54$\pm$525.07 & 868.17$\pm$384.58 & 3614.89$\pm$1402.7 & \textbf{3925.81$\pm$1029.59} \\ LunarLanderContinuous-v2 & 254.98$\pm$17.86 & 254.03$\pm$27.52 & 268.37$\pm$6.9 & \textbf{278.76$\pm$2.34} & 278.23$\pm$3.51 \\ Swimmer-v3 (Mujoco) & 68.52$\pm$33.54 & 40.37$\pm$1.01 & 87.81$\pm$28.79 & 49.45$\pm$0.47 & \textbf{89.23$\pm$26.78} \\ Walker2D-v3 (Mujoco) & 1965.25$\pm$248.21 & 1503.35$\pm$818.87 & 3298.73$\pm$1282.64 & 3766.55$\pm$1063.0 & \textbf{4442.8$\pm$408.88} \\ \hline \end{tabular}} \label{tab:final_perf_comp} \end{table*} \begin{figure*}[!hbt] \begin{center} \subfloat[Hopper-v0 (PyBullet)]{\label{fig-hc}\includegraphics[width=0.33\linewidth]{exp/HopperPyBulletEnv-v0_SR.pdf}} \subfloat[InvertedDoublePendulum-v0 (PyBullet)]{\label{fig-idpPB}\includegraphics[width=0.33\linewidth]{exp/InvertedDoublePendulumPyBulletEnv-v0_SR.pdf}} \subfloat[InvertedPendulum-v0 (PyBullet)]{\label{fig-ipPB}\includegraphics[width=0.33\linewidth]{exp/InvertedPendulumPyBulletEnv-v0_SR.pdf}}\\ \subfloat[Reacher-v0 (PyBullet)]{\label{fig-reacher}\includegraphics[width=0.33\linewidth]{exp/ReacherPyBulletEnv-v0_SR.pdf}} \subfloat[Hopper-v3 (Mujoco)]{\label{fig-hopper}\includegraphics[width=0.33\linewidth]{exp/Hopper-v3_SR.pdf}} \subfloat[Humanoid-v3 (Mujoco)]{\label{fig-humanoid}\includegraphics[width=0.33\linewidth]{exp/Humanoid-v3_SR.pdf}}\\ \subfloat[LunarLanderContinuous-v2]{\label{fig-lunarLander}\includegraphics[width=0.33\linewidth]{exp/LunarLanderContinuous-v2_SR.pdf}} \subfloat[Swimmer-v3 (Mujoco)]{\label{fig-swimmer}\includegraphics[width=0.33\linewidth]{exp/Swimmer-v3_SR.pdf}} \subfloat[Walker2D-v3 (Mujoco)]{\label{fig-walker}\includegraphics[width=0.33\linewidth]{exp/Walker2d-v3_SR.pdf}}\\ \end{center} \caption{Learning curves of HED and four baseline algorithms (i.e., TD3, SAC, ED2 and SUNRISE) on 9 benchmark RL problems.} \label{fig:training_perf} \end{figure*} \section{Experiment} \label{sec-exp} This section presents the experimental evaluation of HED, in comparison to several state-of-the-art DRL algorithms. The experiment setup is discussed first. Detailed experiment results are further presented and analyzed. \subsection{Experiment setting} We implement HED based on the high-quality implementation of TD3 provided by the publicly available OpenAI Spinning Up repository~\cite{SpinningUp2018}. We also follow closely the hyper-parameter settings of TD3 recommended in \cite{fujimoto2018} to build each base learner of HED. Specifically, based on~\cite{schulman2017}, a fully connected MLP with two hidden layers of 64 ReLU units is adopted to model all policy networks and Q-networks. Similar to \cite{januszewski2021,lee2021sunrise}, HED employs $5$ base learners, i.e., $N=5$. Each base learner has its own policy network and Q-network. Meanwhile, HED maintains and trains a separate ensemble Q-network with the same network architecture design. Each base learner trains its Q-network and also conducts the low-level training of the policy network repeatedly whenever HED collects 50 consecutive state-transition samples from the learning environment. Meanwhile, high-level policy training as well as the training of the ensemble Q-network is performed immediately after HED samples a full episode. HED adopts a separate Adam optimizer with the fixed learning rate of $5\mathrm{e}{-4}$ to train each Q-network and policy network. Furthermore, $\rho_0$ in \eqref{equ-mu-new} is set to 0.0001 for the main experiment results reported in Figure \ref{fig:training_perf}. The mini-batch size $|\mathcal{B}|$ is set to 100, following existing research \cite{januszewski2021} without any fine-tuning. HED is compared against four state-of-the-art DRL algorithms, including two Ensemble DRL algorithms, i.e., ED2~\cite{januszewski2021} and SUNRISE \cite{lee2021sunrise}), and two widely used off-policy DRL algorithms, i.e., SAC \cite{haarnoja2018} and TD3 \cite{fujimoto2018}. We evaluate their performance on 9 challenging continuous control benchmark problems, including four PyBullet benchmark problems \cite{benelot2018} (i.e., Hopper-v0, InvertedDoublePendulum-v0, InvertedPendulum-v0, and Reacher-v0), four Mujoco control tasks (i.e., Hopper-v3, Humanoid-v3, Swimmer-v3, and Walker2D-v3), and LunarLanderContinuous-v2 provided by OpenAI Gym \cite{openai_gym} . In the literature, PyBullet benchmarks are often considered to be more challenging than Mujoco benchmarks. Hence we decide to evaluate the performance of HED on both PyBullet and Mujoco benchmarks. The maximum episode length for each benchmark is fixed to 1000 timesteps. Each algorithm is run independently with 10 random seeds on all benchmarks. Besides the hyper-parameter settings of HED highlighted above, detailed hyper-parameter settings of all the competing algorithms have been summarized in Appendix~C. \subsection{Experiment result} \subsubsection{Performance comparison:} We compare HED against four cutting-edge DRL algorithms on 9 benchmark problems. Table~\ref{tab:final_perf_comp} presents the average cumulative rewards obtained by the policy networks (or policy ensembles for ensemble DRL algorithms) trained by all the competing algorithms across the same number of sampled episodes with respect to each benchmark. As evidenced in the table, HED achieved consistently the best performance\footnote{HED significantly outperformed ED2 on most benchmark problems, thanks to its use of the proposed high-level policy training technique.} on most of the benchmark problems except InvertedPendulum, Reacher, and LunarLander. Meanwhile, on InvertedPendulum, Reacher, and LunarLander, HED achieved very competitive performance with at least 98\% of the maximum cumulative rewards reached by the highest performing competing algorithms. Furthermore, on some problems such as Hopper-v0 and Walker2D-v3, HED outperformed the lowest performing algorithm by up to 150\% and the algorithm with the second highest performance by up to 18\%. In addition to Table~\ref{tab:final_perf_comp}, we also compared the learning curves of all the competing algorithms in Figure \ref{fig:training_perf}. As demonstrated in this figure, by explicitly strengthening inter-learner collaboration, HED converges clearly faster and is more stable during the learning process than other competing algorithms. Specifically, on several benchmark problems, such as Hopper-v0, InvertedDoublePendulum-v0, and Hopper-v3, HED achieved significantly lower variations in learning performance across 10 independent runs. In comparison to other ensemble DRL algorithms, the learning curves of HED also appear to be smoother on several benchmark problems, such as Walker2D-v3, suggesting that HED can achieve highly competitive stability during learning. \subsubsection{Impact of $\rho_0$:} To investigate the performance impact of $\rho_0$, we tested 4 different settings of $\rho_0$, ranging from $5\mbox{e$-$}05$ to $0.01$, on the InvertedPendulum-v0 and Hopper-v0 problems (similar observations can be found on other benchmark problems and are omitted in this paper). The learning curves are plotted in Figure~\ref{fig:rho_impact}. It is witnessed in the figure that HED can convergence faster under suitable settings of $\rho_0$. However, the ``best'' $\rho_0$ varies on different benchmark problems. For example, $\rho_0=0.005$ (green curve) converges slightly faster than other settings on InvertedPendulum-v0 while $\rho_0=5e-05$ (blue curve) converges slightly faster on Hopper-v0. Nevertheless, the impact of different $\rho_0$ on the final performance appears to be small as long as $\rho_0$ is reasonably small according to Proposition \ref{the-1}. \begin{figure} \begin{center} \subfloat[InvertedPendulum-v0]{\label{fig-invertedPendulum-rho}\includegraphics[width=0.4\linewidth]{exp/rho_impact/InvertedPendulumPyBulletEnv-v0_rho.pdf}} \subfloat[Hopper-v0]{\label{fig-hp-rho}\includegraphics[width=0.4\linewidth]{exp/rho_impact/HopperPyBulletEnv-v0_rho.pdf}} \end{center} \caption{The impact of using different $\rho_0$ in \eqref{equ-mu-new} on the performance of HED. $\rho_1$ and $\rho_2$ in \eqref{equ-mu-new} depend directly on $\rho_0$ according to Proposition \ref{the-1}.} \label{fig:rho_impact} \end{figure} \subsubsection{Ablation study on high-level policy training techniques:} High-level policy training can be conducted repeatedly whenever HED obtains either a new sampled episode or a fixed number of consecutive state-transition samples (e.g., samples collected from 50 consecutive timesteps). To understand which approach is more effective, experimental comparisons have been conducted in Appendix D with detailed performance results. According to the experiment results in Appendix D, on a majority of benchmark problems, episodic learning can produce more stable learning behavior and also makes HED converge faster. We also compared HED with its variation that performs high-level policy training by using the single-step method in \eqref{equ-e-pg} instead of the multi-step method in \eqref{equ-mu-new}. Detailed experiment results can be found in Appendix E. Our experiment results confirm that multi-step training in \eqref{equ-mu-new} enables HED to achieve significantly higher performance and learning stability than using the conventional single-step training technique in \eqref{equ-e-pg}. Hence, by explicitly sharing learned policy parameters among base learners in an ensemble through \eqref{equ-mu-new}, HED can effectively enhance inter-learner collaboration and boost the learning process. \section{Conclusions} \label{sec-con} In this paper, we conducted in-depth study of ensemble DRL algorithms, which have achieved cutting-edge performance on many benchmark RL problems in the recent literature. Different from existing research works that rely mainly on each base learner of an ensemble to train its policy network individually, we developed a new HED algorithm to explore the potential of training all base learners in a hierarchical manner in order to promote inter-learner collaboration and improve the collective performance of an ensemble of trained base learners. Specifically, we adopted existing ensemble DRL algorithms such as ED2 to perform low-level policy training. Meanwhile, a new multi-step training technique was developed for high-level policy training in HED to facilitate direct inter-learner parameter sharing. Both theoretical and empirical analysis showed that the HED algorithm can achieve stable learning behavior. It also outperformed several state-of-the-art DRL algorithms on multiple benchmark RL problems. \section*{Appendix A} This appendix presents a proof of Proposition \ref{the-1}. According to \cite{scieur2017}, any multi-step integration methods including \eqref{equ-mu-new} must satisfy three conditions to ensure its stability. They together guarantee that $x_k$ can converge to $\theta_i^*$ as $k$ approaches to $\infty$. We check each condition one-by-one below to derive the main conclusions in Proposition \ref{the-1}. \vspace{0.2cm} \noindent \textbf{Consistency condition}: We can re-write \eqref{equ-mu-new} as below $$ x_{k+3}+\rho_2 x_{k+2}+\rho_1 x_{k+1}+\rho_0 x_k= h\cdot g(x_{k+2}). $$ Define the \emph{shift operator} $F$, which maps $Fx_k\rightarrow x_{k+1}$. Furthermore, with $g(x_k)$ being simplified to $g_k$, $F$ also maps $Fg_k\rightarrow g_{k+1}$. Using $F$, \eqref{equ-mu-new} can be further written as $$ \rho(F)x_k=h\sigma(F)g_k, \forall k\geq 0, $$ where $$ \rho(F)=F^3+\rho_2 F^2+\rho_1 F+\rho_0, \sigma(F)=F^2. $$ The consistency condition requires $$ \rho(1)=0, \rho'(1)=\sigma(1). $$ This implies that \begin{equation*} \begin{split} & 1+\rho_2+\rho_1+\rho_0=0, \\ & 3+2\rho_2+\rho_1=1. \end{split} \end{equation*} Solving the above equations leads to $$ \rho_1=-2\rho_0,\ \rho_2=\rho_0-1. $$ Hence, \eqref{equ-mu-new} becomes $$ x_{k+3}=(1-\rho_0)x_{k+2}+2\rho_0 x_{k+1} -\rho_0 x_k+h\cdot g(x_{k+2}). $$ \vspace{0.2cm} \noindent \textbf{Zero-stability condition}: This condition requires all roots of $\rho(F)$ to be in the unit disk. Any roots on the unit circle must be simple. In other words, $$ \left| Roots(\rho(F)) \right|\leq 1. $$ In fact, $\rho(F)$ has three roots. They are $$ 1, \frac{1}{2}\left(-\rho_0 \pm \sqrt{\rho_0(\rho_0+4)} \right). $$ It is easy to verify that when $0<\rho_0<\frac{1}{2}$, $$ \left| \frac{1}{2}\left(-\rho_0 - \sqrt{\rho_0(\rho_0+4)} \right) \right|<1. $$ Meanwhile, when $\rho_0>0$, $$ \left| \frac{1}{2}\left(-\rho_0 + \sqrt{\rho_0(\rho_0+4)} \right) \right|<1. $$ In summary, the zero-stability condition requires $$ 0<\rho_0<\frac{1}{2}. $$ \vspace{0.2cm} \noindent \textbf{Absolute stability condition}: Define \begin{equation*} \begin{split} \Pi_{\lambda h} & \overset{\Delta}{=}\rho(F)+\lambda h\sigma(F) \\ &=F^3+\rho_2 F^2+\rho_1 F+\rho_0+\lambda h F^2 \\ &=F^3+(\rho_0-1) F^2 - 2\rho_0 F+\rho_0 +\lambda h F^2 \\ &=F^3 + (\rho_0-1+\lambda h)F^2-2\rho_0 F+\rho_0. \end{split} \end{equation*} Further define $$ r_{max}=\max_{\lambda\in [L,U]} \max_{r\in Roots(\Pi_{\lambda h}(F))}|r|, $$ where $L$ and $U$ in this appendix refer respectively to the smallest and the largest positive eigenvalues of matrix $A$ in \eqref{equ-grad-linear}. The absolute stability condition requires \begin{equation} r_{max}<1. \label{equ-abs-con} \end{equation} Let \begin{equation*} \begin{split} & B=\rho_0-1+\lambda h, \\ & C=-2\rho_0, \\ & D=\rho_0. \end{split} \end{equation*} Subsequently, define \begin{equation*} \begin{split} & A_0=1-B+C-D=2-\lambda h-4\rho_0, \\ & A_1=3-B-C-3D=4-\lambda h -2\rho_0, \\ & A_2=3+B-C-3D=2+\lambda h, \\ & A_3=1+B+C+D=\lambda h. \end{split} \end{equation*} According to the Routh-Hurwitz criterion \cite{nise2020}, the following two conditions jointly guarantee \eqref{equ-abs-con}: \begin{equation*} \begin{split} A_1,A_2,A_3,A_4>0, \\ A_1 A_2 > A_0 A_3. \end{split} \end{equation*} Specifically, the first condition above gives rise to the following: $$ \lambda h >0,\ \lambda h+2\rho_0<4,\ \lambda h+4\rho_0<2. $$ Following the second condition above, we can deduce the below: $$ \lambda h>2-\frac{4}{\rho_0}. $$ Given that $\lambda h>0$, we have \begin{equation*} \begin{split} & \lambda h > \max\left\{ 0, 2-\frac{4}{\rho_0} \right\}, \\ & \lambda h < \min\left\{ 2-4\rho_0, 4-2\rho_0 \right\}. \end{split} \end{equation*} Since $0<\rho_0<\frac{1}{2}$, $$ 2-4\rho_0<4-2\rho_0,\ 2-\frac{4}{\rho_0}<0. $$ Consequently $$ 0<\lambda h<2-4\rho_0. $$ Clearly, with sufficiently small $h$, the above condition on absolute stability can be easily satisfied. Hence, we can use \eqref{equ-mu-new} to perform high-level policy training stably in the HED algorithm. \section*{Appendix B} This appendix presents a proof of Proposition \ref{the-2}. Considering any specific state $s\in\mathcal{S}$, let $$ \nabla_a Q^e(s,a)|_{a=\pi^e(s)}=C, $$ where $C$ is an arbitrary scalar constant, in line with the assumption of scalar actions. Using \eqref{equ-pe} and \eqref{equ-lin-pol}, the ensemble policy gradient with respect to policy parameters $\theta_i$ of policy $\pi^i$, $i\in[1,\ldots,N]$, is $$ \nabla_{\theta_i} J(\pi^e)=\frac{C\Phi(s)}{N}. $$ According to the multi-step learning rule in \eqref{equ-mu-new}, updating $\theta_i$ for one iteration gives the updated $\theta_i$ as $$ (1-\rho_0)\theta_i+2\rho_0\theta_q-\rho_0\theta_p+h\frac{C\Phi(s)}{N}. $$ Therefore, \begin{equation*} Mul(\pi^i(s))=(1-\rho_0)\pi^i(s)+2\rho_0\pi^q(s)-\rho_0\pi^p(s) +\frac{hC}{N}\Phi(s)^T\Phi(s). \end{equation*} Hence $$ \mathbb{E}\left[ Mul(\pi^i(s)) \right]=(1-\rho_0)\pi^i(s)+\rho_0\pi^e(s)+\frac{h C}{N}\Phi(s)^T\Phi(s), $$ $$ \mathbb{E}\left[ Mul(\pi^e(s)) \right]=\pi^e(s)+\frac{h C}{N}\Phi(s)^T\Phi(s). $$ In comparison, upon using the single-step method, the updated $\theta_i$ becomes $$ \theta_i+h\frac{C\Phi(s)}{N}. $$ Subsequently, $$ Sin(\pi^i(s))=\pi^i(s)+\frac{h C}{N}\Phi(s)^T\Phi(s), $$ $$ Sin(\pi^e(s))=\pi^e(s)+\frac{h C}{N}\Phi(s)^T\Phi(s). $$ Clearly, $$ Sin(\pi^e(s))=\mathbb{E}\left[ Mul(\pi^e(s)) \right]. $$ Hence, the expected action changes applied to $\pi^e(s)$ are identical, regardless of whether single-step or multi-step method is used for high-level policy training\footnote{We assume in Proposition \ref{the-2} that high-level policy training is performed for one iteration on a specific state $s$.}. Define $$ \Delta=\sum_{i\in[1,\ldots,N]}(\pi^i(s)-\pi^e(s)). $$ For the single-step method, after all base learners trained their respective policies for one iteration on state $s$, it is easy to verify that \begin{equation*} \begin{split} & \sum_{i\in[1,\ldots,N]}\left( Sin(\pi^i(s))-Sin(\pi^e(s)) \right)^2\\ =& \sum_{i\in[1,\ldots,N]}\left( \pi^i(s)-\pi^e(s) \right)^2\\ =& \Delta. \end{split} \end{equation*} Meanwhile, \begin{equation*} \begin{split} & \left( Mul(\pi^i(s))-\mathbb{E}\left[ Mul(\pi^e(s)) \right] \right)^2 \\ =&\left( (1-\rho_0) (\pi^i(s)-\pi^e(s)) + 2\rho_0 (\pi^q(s)-\pi^e(s)) -\rho_0(\pi^p(s)-\pi^e(s)) \right)^2\\ =&(1-\rho_0)^2(\pi^i(s)-\pi^e(s))^2+4\rho_0^2(\pi^q(s)-\pi^e(s))^2+\rho^2(\pi^p(s)-\pi^e(s))^2\\ &+4(1-\rho_0)\rho_0(\pi^i-\pi^e(s))(\pi^q(s)-\pi^e(s)) \\ &-2(1-\rho_0)\rho_0(\pi^i(s)-\pi^e(s))(\pi^p(s)-\pi^e(s))\\ &-4\rho_0^2(\pi^q(s)-\pi^e(s))(\pi^p(s)-\pi^e(s)). \end{split} \end{equation*} Since the base learner indices $p$ and $q$ are randomly and independently selected, $$ \mathbb{E}\left[(\pi^i(s)-\pi^e(s))(\pi^p(s)-\pi^e(s))\right]=0, $$ $$ \mathbb{E}\left[(\pi^i(s)-\pi^e(s))(\pi^q(s)-\pi^e(s))\right]=0, $$ $$ \mathbb{E}\left[(\pi^q(s)-\pi^e(s))(\pi^p(s)-\pi^e(s))\right]=0. $$ Therefore \begin{equation*} \begin{split} & \sum_{i\in[1,\ldots,N]} \mathbb{E}\left[ \left( Mul(\pi^i(s))-\mathbb{E}\left[ Mul(\pi^e(s)) \right] \right)^2 \right] \\ =&(1-\rho_0)^2\Delta+4\rho_0^2\Delta+\rho_0^2\Delta \\ =&(1-2\rho_0+6\rho_0^2)\Delta. \end{split} \end{equation*} When $0<\rho_0<\frac{1}{3}$, $$ 1-2\rho_0+6\rho_0^2<1. $$ As a result, \begin{equation*} \begin{split} &\sum_{i\in[1,\ldots,N]}\mathbb{E}\left[ \left( Mul(\pi^i(s))-\mathbb{E}\left[ Mul(\pi^e(s)) \right] \right)^2 \right] \\ <&\sum_{i\in[1,\ldots,N]}\left( Sin(\pi^i(s))-Sin(\pi^e(s)) \right)^2. \end{split} \end{equation*} \section*{Appendix C} Table~\ref{tab:hyper-para} provides detailed hyper-parameter settings of all competing algorithms. Our hyper-parameter settings follow strictly the recommended settings in \cite{fujimoto2018,haarnoja2018,januszewski2021,lee2021sunrise}. \begin{table}[htb!] \caption{Hyper-parameter settings of competing algorithms.} \label{tab:hyper-para} \centering \resizebox{0.7\linewidth}{!}{ \begin{tabular}{l||llll} \hline Hyper-parameter & TD3 & SAC & ED2 & SUNRISE \\ \hline Num. episodes & 2500 & 2500 & 2500 & 3000 \\ Episode length & 1000 & 1000 & 1000 & 1000 \\ Minibatch size & 100 & 100 & 100 & 256 \\ Adam learning rate & 5e-4 & 3e-4 & 5e-4 & 3e-4 \\ Discount ($\gamma$) & 0.99 & 0.99 & 0.99 & 0.99 \\ GAE parameter ($\lambda$) & 0.995 & 0.995 & 0.995 & 0.995 \\ Replay buffer size & 1e6 & 1e6 & 1e6 & 1e6 \\ Update interval & 50 & 50 & 50 & 50 \\ Ensemble size & - & - & 5 & 5 \\ \hline \end{tabular}} \end{table} All experiments were run using a cluster of Linux computing nodes. Each node is equipped with 16 GB memory. The CPU specification is provided in Table~\ref{tab:cpu-para}. Each experiment was run in a Python virtual environment managed by Anaconda with Python packages specified in Table~\ref{tab:python-lib}. \begin{table}[htb!] \caption{CPU specification.} \label{tab:cpu-para} \centering \resizebox{0.6\linewidth}{!}{ \begin{tabular}{ll} \hline Architecture & x86\_64 \\ CPU op-mode(s) & 32-bit, 64-bit \\ CPU(s) & 16 \\ CPU family & 6 \\ Thread(s) per core & 2 \\ CPU max MHz & 4900.0000 \\ CPU min MHz & 800.0000 \\ Model name & 11th Gen Intel(R) Core(TM)\\ & i7-11700 @ 2.50GHz \\ \hline \end{tabular} } \end{table} \begin{table}[htb!] \caption{Python packages.} \label{tab:python-lib} \centering \begin{tabular}{ll} \hline Package name &Version \\ \hline cython &0.29.25 \\ gym &0.21.0 \\ keras &2.7.0 \\ mujoco-py &2.1.2.14 \\ numpy &1.21.4 \\ pybulletgym &0.1 \\ python &3.7.11 \\ scipy &1.7.3 \\ tensorflow &2.7.0 \\ \hline \end{tabular} \end{table} \begin{figure*}[!hbt] \begin{center} \subfloat[Hopper-v0 (PyBullet)]{\label{fig-hc-eq9}\includegraphics[width=0.33\linewidth]{exp/when2train_HighLevelPolicy/HopperPyBulletEnv-v0_when2HLtrain.pdf}} \subfloat[InvertedDoublePendulum-v0 (PyBullet)]{\label{fig-idpPB-when2HLtrain}\includegraphics[width=0.33\linewidth]{exp/when2train_HighLevelPolicy/InvertedDoublePendulumPyBulletEnv-v0_when2HLtrain.pdf}} \subfloat[InvertedPendulum-v0 (PyBullet)]{\label{fig-ipPB-when2HLtrain}\includegraphics[width=0.33\linewidth]{exp/when2train_HighLevelPolicy/InvertedPendulumPyBulletEnv-v0_when2HLtrain.pdf}}\\ \subfloat[Reacher-v0 (PyBullet)]{\label{fig-reacher-when2HLtrain}\includegraphics[width=0.33\linewidth]{exp/when2train_HighLevelPolicy/ReacherPyBulletEnv-v0_when2HLtrain.pdf}} \subfloat[Hopper-v3 (Mujoco)]{\label{fig-hopper-when2HLtrain}\includegraphics[width=0.33\linewidth]{exp/when2train_HighLevelPolicy/Hopper-v3_when2HLtrain.pdf}} \subfloat[Walker2D-v3 (Mujoco)]{\label{fig-walkerPB-when2HLtrain}\includegraphics[width=0.33\linewidth]{exp/when2train_HighLevelPolicy/Walker2d-v3_when2HLtrain.pdf}}\\ \end{center} \caption{Learning curves of HED with respect to two high-level policy training approaches. The method that conducts high-level policy training after every 50 timesteps is denoted as \emph{Fixed timestep}. The method that conducts high-level policy training at the end of each sampled episode is denoted as \emph{Each episode}.} \label{fig:when2HLtrain_impact} \end{figure*} \begin{figure*}[!hbt] \begin{center} \subfloat[Hopper-v0 (PyBullet)]{\label{fig-hc-eq9}\includegraphics[width=0.33\linewidth]{exp/eq9_impact/HopperPyBulletEnv-v0_EQ9.pdf}} \subfloat[InvertedDoublePendulum-v0 (PyBullet)]{\label{fig-idpPB-eq9}\includegraphics[width=0.33\linewidth]{exp/eq9_impact/InvertedDoublePendulumPyBulletEnv-v0_EQ9.pdf}} \subfloat[InvertedPendulum-v0 (PyBullet)]{\label{fig-ipPB-eq9}\includegraphics[width=0.33\linewidth]{exp/eq9_impact/InvertedPendulumPyBulletEnv-v0_EQ9.pdf}}\\ \subfloat[Reacher-v0 (PyBullet)]{\label{fig-reacher-eq9}\includegraphics[width=0.33\linewidth]{exp/eq9_impact/ReacherPyBulletEnv-v0_EQ9.pdf}} \subfloat[Hopper-v3 (Mujoco)]{\label{fig-hopper-eq9}\includegraphics[width=0.33\linewidth]{exp/eq9_impact/Hopper-v3_EQ9.pdf}} \subfloat[Walker2D-v3 (Mujoco)]{\label{fig-walkerPB-eq9}\includegraphics[width=0.33\linewidth]{exp/eq9_impact/Walker2d-v3_EQ9.pdf}}\\ \end{center} \caption{Learning curves of HED using the single-step high-level policy training technique in \eqref{equ-e-pg} vs. the proposed multi-step high-level policy training technique in \eqref{equ-mu-new}.} \label{fig:eq9_impact} \end{figure*} \section*{Appendix D} In this appendix, we study the effectiveness of conducting high-level policy training after HED obtains a full sampled episode. Figure~\ref{fig:when2HLtrain_impact} shows the performance comparison of HED with two different training frequencies: every 50 consecutive timesteps vs. every episode. It can be noticed that, on a majority benchmark problems (i.e., 5 out of 6), performing high-level policy training after every episode (orange curve) can significantly improve the HED algorithm in terms of both the final performance and convergence speed. For example, as shown in Figure~\ref{fig:when2HLtrain_impact}(e), the orange curve reaches 3500 after 1500 episodes while the blue curve converges to a lower cumulative reward (approx. 3000) after 2000 episodes. We also notice that episodic policy training is more robust to the randomness in the environment and less sensitive to the initialization of neural network weights. For example, in Figure~\ref{fig:when2HLtrain_impact}(e), episodic policy training produces a smaller confident interval (orange shaded area) compared to the fixed timestep training (blue shaded area) over 10 independent algorithm runs. Similar results can also be observed from Figures~\ref{fig:when2HLtrain_impact}(a) and (f). Note that in each algorithm run, both policy networks and Q-networks are initialized with different weights. The environment initial states also vary. \section*{Appendix E} This appendix investigates the effectiveness of multi-step policy training by using \eqref{equ-mu-new}. Specifically, we compare the performance of HED against its variant, which performs single-step high-level policy training by using \eqref{equ-e-pg}, on 6 problems that include both PyBullet and Mujoco benchmarks. As shown in Figure~\ref{fig:eq9_impact}, with the help of \eqref{equ-mu-new}, significant performance improvement can be observed (orange curve) on most benchmark problems. In particular, HED behaves more stably during the learning process. For example, in Figure~\ref{fig:eq9_impact}(c), the cumulative rewards obtained by the policy trained using~\eqref{equ-mu-new} (orange curve) remain stable at 1000 after 300 episodes. In comparison, the blue curve stays below 1000 and fluctuates between 800 and 1000 over the entire learning period. Similar trends can also be noticed in Figure~\ref{fig:eq9_impact}(b). The proposed multi-step policy training technique achieves clearly higher cumulative rewards. In the Hopper environment shown in Figure~\ref{fig:eq9_impact}(e), the orange curve outperforms the blue curve by up to 75\% after 2500 training episodes. Moreover, the orange curve converges to 3500 while the blue curve remains below 2000. The significant improvement in cumulative rewards can also be witnessed in Figure~\ref{fig:eq9_impact}(a) and (f). The shaded areas in Figure~\ref{fig:eq9_impact}(e) and (f) also show that the multi-step training technique is less sensitive to the environment randomness and neural network weight initialization, compared to using the conventional single-step training method in \eqref{equ-e-pg}. Hence, our experiment results confirm the importance of inter-learner collaboration. By enabling base learners in an ensemble to explicitly share their learned policy parameters, HED can achieve high learning stability and effectively boost the learning process. \bibliographystyle{IEEEtran} \section{Introduction} \label{sec-int} Deep reinforcement learning (DRL) is a booming field of research in machine learning with diverse real-world applications \cite{ibarz2021}. In recent years, many \emph{model-free} DRL algorithms achieved cutting-edge performance in tackling various continuous reinforcement learning (RL) problems, including complex control tasks with high-dimensional state and action spaces \cite{liu2021}. These algorithms can effectively train \emph{deep neural networks} (DNNs) to precisely model high-quality control policies and are the central focus of this paper. Despite of widely reported success, a majority of existing \emph{actor-critic DRL algorithms}, such as DDPG \cite{lillicrap2015}, SAC \cite{haarnoja2018} and PPO \cite{schulman2017}, still suffer from some major limitations. Specifically, existing research works showed that the algorithm performance is highly sensitive to hyper-parameter settings and can vary substantially in different algorithm runs \cite{paine2020}. \emph{Ineffective exploration} is often considered as a major cause for the poor learning stability \cite{chan2019}, often resulting in overfitting and premature convergence to poor local optima \cite{kurutach2018}. Rather than relying on one learner (or DRL agent), an ensemble of base learners can be jointly utilized to boost exploration and stabilize the learning process \cite{osband2016deep,osband2017post}. For example, the \emph{ensemble deep deterministic policy gradient} (ED2) algorithm is a newly developed ensemble DRL method \cite{januszewski2021} that trains multiple DNN policies simultaneously using a shared \emph{experience replay buffer} (ERB), similar to several previously proposed parallel DRL algorithms \cite{barth2018,mnih2016asyn}. ED2 features a unique mixture of multiple well-studied tricks, including temporally-extended deep exploration, double Q-bias reduction, and target policy smoothing \cite{osband2016deep,osband2017post,van2016deep,fujimoto2018}. It was reported to outperform state-of-the-art ensemble DRL algorithms such as SUNRISE \cite{lee2021sunrise} on several difficult Mujoco benchmark control problems. As far as we know, most of the existing ensemble DRL algorithms are designed to train each base learner individually. For example, in ED2, every base learner trains its own DNN policy using its own critic, with the aim to improve its own performance without considering the impact of the trained policy on the ensemble. While sharing the same ERB, policy training is conducted largely independently by all base learners. This is shown to promote healthy exploration in \cite{januszewski2021}. However, there is no guarantee that the base learners will collaborate effectively such that the ensemble as a whole can achieve desirable performance. To address this limitation, we propose a new \emph{hierarchical approach} for training base learners in this paper. Specifically, we follow ED2 for \emph{low-level training} of DNN policies, which will be performed concurrently by all base learners. In the meantime, we construct a \emph{global critic}, which is trained constantly to predict the performance of the ensemble. Guided by the global critic, \emph{high-level training} of DNN policies will be performed regularly to strengthen cooperation among all the base learners. Since the ensemble is not used directly to collect state-transition samples from the learning environment, we must make sure that high-level training of the ensemble is not performed on \emph{out-of-distribution} data obtained by individual base learners. In view of this, it is important to encourage \emph{inter-learner parameter sharing} so that the DNN policy trained by one base learner can contribute directly to (or influence) the training of DNN policies by other base learners. For this purpose, we develop a new technique in this paper for high-level training of policies based on the \emph{multi-step integration methods} for solving \emph{ordinary differential equations} (ODEs) in \cite{scieur2017}. Our high-level policy training technique is theoretically justified as it guarantees stability for a wide range of optimization problems. Meanwhile, it can be shown analytically that the trained linear parametric policies (a special and important technique for policy approximation) of all base learners are expected to behave more consistently as the ensemble through high-level policy training, encouraging inter-learner collaboration and alleviating the data distribution issue. Driven by the hierarchical policy training method, we develop a new ensemble DRL algorithm called \emph{hierarchical ensemble deep deterministic policy gradient} (HED) in this paper. Experimental evaluation of HED has been conducted on a range of benchmark control problems, including the widely used Mujoco control tasks as well as the less popular and potentially more challenging PyBullet control problems. Our experiments clearly show that HED can outperform ED2, SUNRISE and several cutting-edge DRL algorithms on multiple benchmark problems. \iffalse The rest of this paper is organized as follows. We review the related research works in the recent literature in the subsequent section. Necessary technical background for developing the HED algorithm is presented next, followed by the detailed design of HED. The empirical performance of the new algorithm is further evaluated before the concluding remarks. \fi \section{Related Work} \label{sec-rw} Similar to ED2, HED trains an ensemble of policies using an \emph{off-policy} DRL algorithm to leverage on the algorithm's advantages in \emph{sample efficiency}. Recently, several off-policy DRL algorithms have been developed successfully for RL in continuous spaces, including DDPG \cite{lillicrap2015}, SAC \cite{haarnoja2018}, TD3 \cite{fujimoto2018}, and SOP \cite{wang2020}. These algorithms introduce a variety of tricks to stabilize the learning process. For example, TD3 extends the idea of double Q-network \cite{van2016deep} to a new double-Q bias reduction technique, which can effectively prevent over-optimistic training of DNN policies. In addition, empirical evidence showed that the learning process becomes more stable when the actor and critic in TD3 are trained with different frequencies or in different phases \cite{fujimoto2018,cobbe2021}. The base learners in our HED ensemble will adopt these tricks. The recent literature also provides some new tricks to stabilize learning. Specifically, various trust-region methods have been developed to prevent negative behavioral changes during policy training \cite{kurutach2018,schulman2015,shani2020,wu2017,schulman2017}. Meanwhile, entropy regularization techniques prohibit immature convergence of the trained policies and ensure prolonged profitable exploration \cite{chen2018,haarnoja2018}. However, these techniques are mainly applied to stochastic policies while we aim at learning an ensemble of deterministic policies. Previous research showed that deterministic policies can often be trained more efficiently than stochastic policies using the \emph{reparameterization trick} \cite{fujimoto2018,silver2014,baek2020}. The stability of a DRL algorithm depends critically on how the learner explores its environment. Besides the entropy regularization methods, curiosity metrics are popularly employed to encourage a learner to explore rarely visited states during RL \cite{reizinger2020,zhelo2018}. Meanwhile, many previous studies embraced the \emph{optimum in the face of uncertainty} (OFU) principle to design bonus rewards for actions with high potentials, thereby promoting exploration in promising areas of the learning environment \cite{bellemare2016}. One good example is the UCB exploration technique developed in \cite{chen2017ucb,lee2021sunrise}. However, in \cite{januszewski2021}, this technique was shown to be less effective than the bootstrap with random initialization trick adopted in ED2. Temporally-extended exploration on RL problems with continuous actions can also be achieved by adding a small amount of noise to DNN weights \cite{plappert2017}. This is directly related to the posterior sampling methods that are often used to select the best actions among a statistically plausible set of sampled actions \cite{osband2018}. Following the OFU principle, deep ensembles have been recently proposed to approximate Bayesian posteriors with high accuracy and efficiency \cite{lakshminarayanan2016}. They are subsequently used to approach deep exploration for reliable RL \cite{osband2016deep}. Several issues have been investigated under the context of ensemble DRL. For instance, the diversity of base learners is essential to the performance of the ensemble. To encourage diversity, either different DRL algorithms or the same algorithm with differed hyper-parameter settings have been adopted to train base learners \cite{huang2017,wiering2008}. Meanwhile, proper aggregation of the action outputs from all base learners in an ensemble poses another challenge. Typical approaches to tackle this issue include taking the mean action as the output of the ensemble and choosing the action with highest predicted cumulative rewards \cite{januszewski2021,chen2019}. As far as we know, few existing ensemble DRL algorithms in the literature have ever studied the important issue on how to effectively train all base learners to jointly improve the ensemble performance. This issue will be explored in-depth with the newly developed HED algorithm in this paper. \section{Background} \label{sec-back} An RL problem is modeled as a \emph{Markov Decision Process} (MDP) $(\mathcal{S},\mathcal{A},R,P,\gamma,p_0)$, where $\mathcal{S}$ and $\mathcal{A}$ refer respectively to the continuous multi-dimensional state space and action space. $P$ stands for the state-transition model that governs the probability of reaching any state $s_{t+1}\in\mathcal{S}$ at timestep $t+1$ upon performing any action $a_t\in\mathcal{A}$ in state $s_t\in\mathcal{S}$ at timestep $t$, with $t\in\mathbb{Z}^+$. Additionally, $\gamma\in[0,1)$ is the discount factor, $R$ is the reward function, and $p_0$ captures the initial state distribution. To solve any RL problem described above, we aim to learn an optimal \emph{deterministic ensemble policy} $\pi^e_*(s)$ that maps any state input $s\in\mathcal{S}$ to an action vector $a\in\mathcal{A}$ so as to maximize the \emph{cumulative rewards} defined below $$ \pi^e_*= \argmax_{\pi^e} J(\pi^e)=\argmax_{\pi^e}\mathbb{E}_{\tau\sim\pi^e} \left[ \sum_{t=1}^{\infty}\gamma^{t-1} R(s_t,a_t) \right], $$ where $\tau=[(s_t,a_t,r_t,s_{t+1})]_{t=1}^{\infty}$ contains a series of consecutive state-transition samples and is called a \emph{episode}, which can be obtained by following the ensemble policy $\pi^e$, and $r_t=R(s_t,a_t)$ is the immediate reward received at timestep $t$ in $\tau$. For an ensemble with $N$ base learners where each base learner $L_i$, $1\leq i\leq N$, maintains its own deterministic base policy $\pi^i$, the action output of $\pi^e$ is jointly determined by all the \emph{base policies} according to \begin{equation} \forall s\in\mathcal{S}, \pi^e(s)=\frac{1}{N}\sum_i^N \pi^i(s). \label{equ-pe} \end{equation} In order to train an ensemble to maximize the cumulative rewards, our baseline algorithm ED2 uses randomly selected base learners to sample a series of episodes $\{\tau_i\}$, which will be stored in the shared ERB. At regular time intervals, a mini-batch of state-transition samples will be retrieved from the ERB. Every base learner $L_i$ will then use the retrieved mini-batch to train its own actor $\pi^i$ and critic $Q^i$ individually. In other words, a base learner manages two separate DNNs, one models the deterministic policy $\pi^i$ and the other approximates the Q-function $Q^i$ of $\pi^i$. A base learner uses an existing actor-critic RL algorithm to train the two DNNs. In this paper, we choose TD3 for this purpose due to its proven effectiveness, high popularity and stable learning behavior \cite{fujimoto2018}. \section{Hierarchical Ensemble Deep Deterministic Policy Gradient} \label{sec-algo} The pseudo-code of the HED algorithm is presented in Algorithm \ref{alg-code}. HED follows many existing works including ED2 \cite{osband2016deep,januszewski2021} to achieve temporally-extended exploration through bootstrapping with random initialization of DNN policies. As clearly shown in \cite{januszewski2021}, this exploration technique is more effective than UCB and parameter randomization methods. Different from ED2 which completely eliminates the necessity of adding small random noises to the deterministic action outputs from the DNN policies, we keep a small level of action noise\footnote{The noise is sampled from the Normal distribution independently for each dimension of the action vector. The variance of the normal distribution is fixed at 0.01 during the learning process.} while using any chosen policy to explore the learning environment. We found empirically that this ensures coherent exploration, similar to \cite{osband2016deep}, while making the testing performance of the trained policies more stable. Different from ED2 and other ensemble algorithms for RL in continuous spaces, HED trains DNN policies at two separate levels. The low-level training of $\pi^i$ and $Q^i$ by each base learner $L_i$ is essentially the same as ED2 and TD3. Specifically, for any base learner $L_i$, $i\in\{1,\ldots,N\}$, $Q^i$ is trained by $L_i$ to minimize $MSE_i$ below \begin{equation} MSE_i=\frac{1}{|\mathcal{B}|} \sum_{(s,a,r,s')\in\mathcal{B}}\left(Q^i_{\phi_i}(s,a)-r-\gamma\min_{k=1,2}\hat{Q}^i_{k}(s',\pi^i(s')+\epsilon) \right)^2, \label{equ-mse} \end{equation} where $\phi_i$ represents the trainable parameters of the DNN that approximates $Q^i$. $\mathcal{B}$ is the random mini-batch retrieved from the ERB. $\hat{Q}^i_{k}$ with $k=1,2$ stands for the two target Q-networks of $L_i$ that together implement the double-Q bias reduction mechanism proposed in \cite{fujimoto2018}. Additionally, $\epsilon$ is a random noise sampled from a Normal distribution with zero mean and small variance\footnote{The variance for sampling $\epsilon$ is kept at a very small level of 0.01 in the experiments.}. Using the trained $Q^i$, the trainable parameters $\theta_i$ of the DNN that models policy $\pi^i$ is further updated by $L_i$ along the \emph{policy gradient} direction computed below \begin{equation} \nabla_{\theta_i}J(\pi^i_{\theta_i})=\frac{1}{|\mathcal{B}|}\sum_{s\in\mathcal{B}} \nabla_{a}Q^i(s,a)|_{a=\pi^i_{\theta_i}(s)}\nabla_{\theta_i}\pi^i_{\theta_i}(s). \label{equ-pg} \end{equation} Besides the above, HED constantly trains a separate high-level Q-function $Q^e$ to predict the performance of the ensemble policy $\pi^e$. Guided by the trained $Q^e$, high-level policy training is conducted regularly to update policy $\pi^i$ of all base learners so as to enhance their cooperation and performance. A new \emph{multi-step technique} is developed in HED to enable inter-learner parameter sharing during high-level policy training. To implement this technique, we keep track of a list of bootstrap policy parameters for the multi-step training process. More details can be found in the subsequent subsection. Theoretical justifications regarding the usefulness of the multi-step approach are also provided below. \begin{algorithm}[!ht] \begin{algorithmic} \STATE {\bf Input}: Ensemble size $N$; initial policy networks $\pi^i_{\theta_i}$ and Q-networks $Q^i_{\phi_i}$ for $i\in\{1,\ldots,N\}$; ERB; ensemble Q-network $Q^e_{\phi_e}$; target Q-networks for each base learner and the ensemble \STATE {\bf Output}: Trained ensemble policy $\pi^e$ \STATE {\bf While} the total number of sampled trajectories $<$ max number of trajectories: \STATE \ \ \ \ Randomly sample $i\in\{1,\ldots,N\}$ \STATE \ \ \ \ {\bf While} the current trajectory does not terminate: \STATE \ \ \ \ \ \ \ \ Use $\pi^i$ to perform the next action \STATE \ \ \ \ \ \ \ \ Store sampled state-transition in ERB \STATE \ \ \ \ \ \ \ \ Track number of steps sampled before critic training \STATE \ \ \ \ \ \ \ \ {\bf If} time for critic training: \STATE \ \ \ \ \ \ \ \ \ \ \ \ {\bf For} number of steps sampled: q\STATE \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Sample a mini-batch $\mathcal{B}$ from ERB \STATE \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Train $Q^i_{\phi_i}$ for $i\in\{1,\ldots,N\}$ using \eqref{equ-mse} \STATE \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Train $Q^e_{\phi_e}$ using \eqref{equ-e-mse} \STATE \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {\bf If} time for {\bf low-level} policy training: \STATE \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Train $\pi^i_{\theta_i}$ for $i\in\{1,\ldots,N\}$ using \eqref{equ-pg} \STATE \ \ \ \ \ \ \ \ {\bf If} time for {\bf high-level} policy training: \STATE \ \ \ \ \ \ \ \ \ \ \ \ Set bootstrap list $\{x_j\}_{j=0}^{2}$ for each base learner \STATE \ \ \ \ \ \ \ \ \ \ \ \ {\bf For} a fraction of sampled steps: \STATE \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Train $\pi^i_{\theta_i}$ for $i\in\{1,\ldots,N\}$ using \eqref{equ-mu-new} \STATE \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Append trained $\theta_i$ for $i\in\{1,\ldots,N\}$ to the bootstrap lists of each base \STATE \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ learner for the next step of high-level policy training \end{algorithmic} \caption{The pseudo-code of the HED algorithm.} \label{alg-code} \end{algorithm} \subsection{A multi-step technique for high-level policy training} \label{subsec-multipol} In addition to $Q^i$ for each base learner $L_i$, $i\in\{1,\ldots,N\}$, HED maintains a separate Q-network to approximate $Q^e$ of the ensemble policy $\pi^e$. Similar to \eqref{equ-mse}, HED trains this central Q-network towards minimizing $MSE_e$ below \begin{equation} MSE_e=\frac{1}{|\mathcal{B}|} \sum_{(s,a,r,s')\in\mathcal{B}}\left(Q^e_{\phi_e}(s,a)-r-\gamma\hat{Q}^e(s',\pi^e(s')) \right)^2, \label{equ-e-mse} \end{equation} with $\phi_e$ representing the trainable parameters of the central Q-network. $\hat{Q}^e$ stands for the corresponding target Q-network that stabilizes the training process. For simplicity, we do not add random noise $\epsilon$ in \eqref{equ-mse} to the action outputs produced by the ensemble policy $\pi^e$ in \eqref{equ-e-mse}. Furthermore, following \cite{van2016deep}, one target Q-network instead of two is adopted in \eqref{equ-e-mse} to facilitate the training of $Q^e$. Building on the trained $Q^e$, we can calculate the \emph{ensemble policy gradient} with respect to $\theta_i$ of every base learner $L_i$ as follows \begin{equation} \nabla_{\theta_i}J(\pi^e)= \frac{1}{|\mathcal{B}|}\sum_{s\in\mathcal{B}} \nabla_{a}Q^e(s,a)|_{a=\pi^e(s)}\nabla_{a_i}\pi^e(s)|_{a_i=\pi^i_{\theta_i}(s)}\nabla_{\theta_i}\pi^i_{\theta_i}(s), \label{equ-e-pg} \end{equation} with $$ \nabla_{a_i}\pi^e(s)|_{a_i=\pi^i_{\theta_i}(s)}=\frac{1}{N} I, $$ according to \eqref{equ-pe}. $I$ stands for the $m\times m$ identity matrix where $m$ is the dimension of the action vector. One straightforward approach for high-level policy training is to update $\theta_i$ of every base learner $L_i$ in the direction of \eqref{equ-e-pg}. However, using \eqref{equ-e-pg} alone may not encourage any base learner $L_i$ to behave consistently with the ensemble (see Proposition \ref{the-2}). Consequently, high-level training of the ensemble policy may be performed on the out-of-distribution state-transition samples collected by the base learners, affecting the training effectiveness. Furthermore, ensembles are used mainly for temporally-extended exploration in the literature. The learning activity of one base learner can only influence other base learners indirectly through the shared ERB. Base learners do not explicitly share their learned policy parameters in an ensemble to strengthen inter-learner cooperation and boost the learning process. To address this limitation, we propose to promote inter-learner parameter sharing during high-level policy training, in order to achieve a desirable balance between exploration and inter-learner cooperation. Specifically, in addition to \eqref{equ-e-pg}, we randomly select \emph{two base learners} $L_p$ and $L_q$ and use their policy parameters to guide the training of policy $\pi^i$ of any base learner $L_i$. In comparison to \emph{selecting one base learner}, this allows more base learners to have the opportunity to share their parameters with the base learner $L_i$ during policy training. It is also possible to recruit more than two base learners. However, in this case, it is mathematically challenging to derive stable learning rules for high-level policy training. Motivated by the above discussion, a search through the literature leads us to the linear multi-step integration methods recently analyzed in \cite{scieur2017}. Consider a simple \emph{gradient flow equation} below \begin{equation} x(0)=\theta_i^0, \frac{\partial x(t)}{\partial t}=g(x(t))=\nabla_{\theta_i}J(\pi^e)|_{\theta_i=x(t)}, \label{equ-gfe} \end{equation} where $\theta_i^0$ refers to the initial policy parameter of base learner $L_i$. If $J(\pi^e)$ is strongly concave and Lipschitz continuous, the solution of \eqref{equ-gfe} allows us to obtain the optimal policy parameters $\theta_i^*$ when $x(t)$ approaches to $\infty$. Since $J(\pi^e)$ is not strongly concave for most of real-world RL problems, $x(t)$ in practice may only converge to a locally optimal policy, which is common among majority of the policy gradient DRL algorithms. Therefore high-level training of policy $\pi^e$ and hence $\pi^i$ can be approached by numerically solving \eqref{equ-gfe}. This can be achieved through a linear $\mu$-step method shown below \begin{equation} x_{k+\mu}=-\sum_{j=0}^{\mu-1}\rho_j x_{k+j}+h\sum_{j=0}^{\mu-1}\sigma_j g(x_{k+j}), \forall k\geq 0, \label{equ-mu-step} \end{equation} where $\rho_j,\sigma_j\in\mathbb{R}$ are the pre-defined coefficients of the multi-step method and $h$ is the learning rate. Clearly, each new point $x_{k+\mu}$ produced by the $\mu$-step method is a function of the preceding $\mu$ points. In this paper, we specifically consider the case when $\mu=3$. Meanwhile, let \begin{equation} x_0=\theta_p,x_1=\theta_q,x_2=\theta_i \label{equ-boot-list} \end{equation} where $p$ and $q$ are the randomly generated indices of two base learners and $i$ is the index of the base learner whose policy $\pi^i$ is being trained by the $\mu$-step method. Through this way, the training of policy $\pi^i$ is influenced directly by base learners $L_p$ and $L_q$ through explicit inter-learner parameter sharing. $x_i (i\geq 3)$ in \eqref{equ-mu-step} represents the trained policy parameters of $\pi^i$ in subsequent training steps. Although \eqref{equ-mu-step} allows us to use $\nabla_{\theta_p}J(\pi^e)$ and $\nabla_{\theta_q}J(\pi^e)$ to train $\theta_i$, they do not seem necessary for inter-learner parameter sharing. To simplify \eqref{equ-mu-step}, we set $\sigma_0=\sigma_1=0$ and $\sigma_2=1$. Hence only $g(x_{k+2})$, which is the ensemble policy gradient with respect to policy $\pi^i$ in \eqref{equ-e-pg}, is used to train $\pi^i$. With this simplification, we derive the new learning rule for high-level policy training below \begin{equation} \begin{split} & x_{k+3}= -\rho_2 x_{k+2}-\rho_1 x_{k+1}-\rho_0 x_k+h\cdot \nabla_{\theta_i}J(\pi^e)|_{\theta_i=x_{k+2}}, \forall k\geq 0 \\ & x_0=\theta_p,x_1=\theta_q,x_2=\theta_i \end{split} \label{equ-mu-new} \end{equation} To implement \eqref{equ-mu-new} in HED, before high-level policy training, every base learner $L_i$ must set up a \emph{bootstrap list} of policy parameters $\{x_0=\theta_p,x_1=\theta_q,x_2=\theta_i\}$. After the $k$-th training step ($k\geq 0$) based on \eqref{equ-mu-new}, $L_i$ appends the trained $\theta_i$ as $x_{k+3}$ to the bootstrap list, which will be utilized to train $\pi^i$ in the subsequent training steps. Reliable use of \eqref{equ-mu-new} demands for careful parameter settings of $\rho_0$, $\rho_1$, $\rho_2$ and $h$. Relevant theoretical analysis is presented below. \subsection{Theoretical analysis of the multi-step policy training technique} \label{subsec-multithe} In this subsection, a theoretical analysis is performed first to determine suitable settings of $\rho_0$, $\rho_1$, $\rho_2$ and $h$ for stable high-level policy training through \eqref{equ-mu-new}. To make the analysis feasible, besides the strongly concave and Lipschitz continuous conditions, we further assume that \begin{equation} \nabla_{\theta_i}J(\pi^e)\approx -A(\theta_i-\theta_i^*) \label{equ-grad-linear} \end{equation} where $A$ is a positive definite matrix whose eigenvalues are bounded positive real numbers. $\theta_i^*$ stands for the global-optimal (or local-optimal) policy parameters. Many strongly concave functions satisfy this assumption \cite{scieur2017}. Meanwhile, the attraction basin of the local optimum of many multi-modal optimization problems often satisfies this assumption too. Using this assumption, we can derive Proposition \ref{the-1} below. \begin{proposition} Upon using \eqref{equ-mu-new} to numerically solve \eqref{equ-gfe}, the following conditions must be satisfied for $x_k$ to converge to $\theta_i^*$ as $k$ approaches to $\infty$: \begin{enumerate} \item $\rho_2=\rho_0-1$, $\rho_1=-2\rho_0$; \item $0<\rho_0<\frac{1}{2}$; \item $h$ is reasonably small such that $0\leq \lambda h < 2-4\rho_0$, where $\lambda$ can take any real value between the smallest and the largest eigenvalues of the positive definite matrix $A$ in \eqref{equ-grad-linear}. \end{enumerate} \label{the-1} \end{proposition} The proof of Proposition \ref{the-1} can be found in Appendix A. Proposition \ref{the-1} provides suitable parameter settings for \eqref{equ-mu-new} and justifies its stable use for high-level policy training. We next show that \eqref{equ-mu-new} is also expected to make base learners behave more consistently with the ensemble, without affecting the behavior of the trained ensemble, when $\rho_0$ is sufficiently small. Consider specifically that each base learner $L_i$ trains a linear parametric policy of the form: \begin{equation} \pi^i(s)=\Phi(s)^T\cdot \theta_i \label{equ-lin-pol} \end{equation} where $\Phi(s)$ represents the \emph{state feature vector} with respect to any input state $s$. For simplicity, we study the special case of scalar actions. However, the analysis can be easily extended to high-dimensional action spaces. Meanwhile, we use $Sin()$ and $Mul()$ to represent respectively the action output of a policy trained for one iteration on the same state $s$ by using either the single-step method or the multi-step method in \eqref{equ-mu-new}. The single-step method can be considered as a special case of the multi-step method with $\rho_2=-1$ and $\rho_0=\rho_1=0$. Using these notations, Proposition \ref{the-2} is presented below. \begin{proposition} When each base learner $L_i$, $i\in\{1,\ldots,N\}$, trains its linear parametric policy $\pi^i$ with policy parameters $\theta_i$ on any state $s\in\mathcal{S}$ and when $0<\rho_0<\frac{1}{3}$, \begin{enumerate} \item $Sin(\pi^e(s))=\mathbb{E}\left[ Mul(\pi^e(s)) \right]$; \item $\sum_{i\in\{1,\ldots,N\}}\mathbb{E}\left[ \left( Mul(\pi^i(s))-\mathbb{E}\left[ Mul(\pi^e(s)) \right] \right)^2 \right] \\ < \sum_{i\in\{1,\ldots,N\}}\left( Sin(\pi^i(s))-Sin(\pi^e(s)) \right)^2 \\ =\sum_{i\in\{1,\ldots,N\}}\left( \pi^i(s)-\pi^e(s) \right)^2$ \end{enumerate} where the expectations above are taken with respect to any randomly selected $p,q\in\{1,\ldots,N\}$ in \eqref{equ-boot-list}. \label{the-2} \end{proposition} Proposition \ref{the-2} indicates that multi-step training in \eqref{equ-mu-new} is expected to reduce the difference between the action output of any base learner and that of the ensemble. Meanwhile the amount of action changes applied to $\pi^e$ remains identical to the single-step method. Therefore, using the multi-step policy training method developed in this section helps to enhance consistent behaviors among all base learners of the ensemble. \begin{table*}[!ht] \caption{Final performance of all competing algorithms on 9 benchmark problems. The results are shown with mean cumulative rewards and standard deviation over 10 independent algorithm runs. For each run, the cumulative rewards are obtained by averaging over 50 independent testing episodes.} \centering \resizebox{1.0\textwidth}{!}{ \begin{tabular}{c||cccc|c} \hline & TD3 & SAC & ED2 & SUNRISE & HED \\ \hline Hopper-v0 (PyBullet) & 917.38$\pm$178.46 & 1365.47$\pm$281.3 & 2095.54$\pm$148.86 & 1976.86$\pm$311.24 & \textbf{2359.63$\pm$50.28} \\ InvertedDoublePendulum-v0 (PyBullet) & 4394.07$\pm$558.8 & 8664.3$\pm$187.83 & 8733.3$\pm$1490.51 & 8746.82$\pm$58.68 & \textbf{9351.56$\pm$13.65} \\ InvertedPendulum-v0 (PyBullet) & 484.08$\pm$49.64 & 937.33$\pm$8.0 & \textbf{999.51$\pm$1.0} & 933.58$\pm$9.03 & 995.96$\pm$7.56 \\ Reacher-v0 (PyBullet) & 8.42$\pm$1.07 & 17.43$\pm$0.66 & 15.36$\pm$2.24 & \textbf{17.65$\pm$0.44} & 17.35$\pm$0.82 \\ Hopper-v3 (Mujoco) & 1399.54$\pm$250.32 & 2369.61$\pm$906.85 & 3043.19$\pm$971.53 & 2913.56$\pm$475.48 & \textbf{3503.08$\pm$83.35} \\ Humanoid-v3 (Mujoco) & 458.77$\pm$116.08 & 1720.54$\pm$525.07 & 868.17$\pm$384.58 & 3614.89$\pm$1402.7 & \textbf{3925.81$\pm$1029.59} \\ LunarLanderContinuous-v2 & 254.98$\pm$17.86 & 254.03$\pm$27.52 & 268.37$\pm$6.9 & \textbf{278.76$\pm$2.34} & 278.23$\pm$3.51 \\ Swimmer-v3 (Mujoco) & 68.52$\pm$33.54 & 40.37$\pm$1.01 & 87.81$\pm$28.79 & 49.45$\pm$0.47 & \textbf{89.23$\pm$26.78} \\ Walker2D-v3 (Mujoco) & 1965.25$\pm$248.21 & 1503.35$\pm$818.87 & 3298.73$\pm$1282.64 & 3766.55$\pm$1063.0 & \textbf{4442.8$\pm$408.88} \\ \hline \end{tabular}} \label{tab:final_perf_comp} \end{table*} \begin{figure*}[!hbt] \begin{center} \subfloat[Hopper-v0 (PyBullet)]{\label{fig-hc}\includegraphics[width=0.33\linewidth]{exp/HopperPyBulletEnv-v0_SR.pdf}} \subfloat[InvertedDoublePendulum-v0 (PyBullet)]{\label{fig-idpPB}\includegraphics[width=0.33\linewidth]{exp/InvertedDoublePendulumPyBulletEnv-v0_SR.pdf}} \subfloat[InvertedPendulum-v0 (PyBullet)]{\label{fig-ipPB}\includegraphics[width=0.33\linewidth]{exp/InvertedPendulumPyBulletEnv-v0_SR.pdf}}\\ \subfloat[Reacher-v0 (PyBullet)]{\label{fig-reacher}\includegraphics[width=0.33\linewidth]{exp/ReacherPyBulletEnv-v0_SR.pdf}} \subfloat[Hopper-v3 (Mujoco)]{\label{fig-hopper}\includegraphics[width=0.33\linewidth]{exp/Hopper-v3_SR.pdf}} \subfloat[Humanoid-v3 (Mujoco)]{\label{fig-humanoid}\includegraphics[width=0.33\linewidth]{exp/Humanoid-v3_SR.pdf}}\\ \subfloat[LunarLanderContinuous-v2]{\label{fig-lunarLander}\includegraphics[width=0.33\linewidth]{exp/LunarLanderContinuous-v2_SR.pdf}} \subfloat[Swimmer-v3 (Mujoco)]{\label{fig-swimmer}\includegraphics[width=0.33\linewidth]{exp/Swimmer-v3_SR.pdf}} \subfloat[Walker2D-v3 (Mujoco)]{\label{fig-walker}\includegraphics[width=0.33\linewidth]{exp/Walker2d-v3_SR.pdf}}\\ \end{center} \caption{Learning curves of HED and four baseline algorithms (i.e., TD3, SAC, ED2 and SUNRISE) on 9 benchmark RL problems.} \label{fig:training_perf} \end{figure*} \section{Experiment} \label{sec-exp} This section presents the experimental evaluation of HED, in comparison to several state-of-the-art DRL algorithms. The experiment setup is discussed first. Detailed experiment results are further presented and analyzed. \subsection{Experiment setting} We implement HED based on the high-quality implementation of TD3 provided by the publicly available OpenAI Spinning Up repository~\cite{SpinningUp2018}. We also follow closely the hyper-parameter settings of TD3 recommended in \cite{fujimoto2018} to build each base learner of HED. Specifically, based on~\cite{schulman2017}, a fully connected MLP with two hidden layers of 64 ReLU units is adopted to model all policy networks and Q-networks. Similar to \cite{januszewski2021,lee2021sunrise}, HED employs $5$ base learners, i.e., $N=5$. Each base learner has its own policy network and Q-network. Meanwhile, HED maintains and trains a separate ensemble Q-network with the same network architecture design. Each base learner trains its Q-network and also conducts the low-level training of the policy network repeatedly whenever HED collects 50 consecutive state-transition samples from the learning environment. Meanwhile, high-level policy training as well as the training of the ensemble Q-network is performed immediately after HED samples a full episode. HED adopts a separate Adam optimizer with the fixed learning rate of $5\mathrm{e}{-4}$ to train each Q-network and policy network. Furthermore, $\rho_0$ in \eqref{equ-mu-new} is set to 0.0001 for the main experiment results reported in Figure \ref{fig:training_perf}. The mini-batch size $|\mathcal{B}|$ is set to 100, following existing research \cite{januszewski2021} without any fine-tuning. HED is compared against four state-of-the-art DRL algorithms, including two Ensemble DRL algorithms, i.e., ED2~\cite{januszewski2021} and SUNRISE \cite{lee2021sunrise}), and two widely used off-policy DRL algorithms, i.e., SAC \cite{haarnoja2018} and TD3 \cite{fujimoto2018}. We evaluate their performance on 9 challenging continuous control benchmark problems, including four PyBullet benchmark problems \cite{benelot2018} (i.e., Hopper-v0, InvertedDoublePendulum-v0, InvertedPendulum-v0, and Reacher-v0), four Mujoco control tasks (i.e., Hopper-v3, Humanoid-v3, Swimmer-v3, and Walker2D-v3), and LunarLanderContinuous-v2 provided by OpenAI Gym \cite{openai_gym} . In the literature, PyBullet benchmarks are often considered to be more challenging than Mujoco benchmarks. Hence we decide to evaluate the performance of HED on both PyBullet and Mujoco benchmarks. The maximum episode length for each benchmark is fixed to 1000 timesteps. Each algorithm is run independently with 10 random seeds on all benchmarks. Besides the hyper-parameter settings of HED highlighted above, detailed hyper-parameter settings of all the competing algorithms have been summarized in Appendix~C. \subsection{Experiment result} \subsubsection{Performance comparison:} We compare HED against four cutting-edge DRL algorithms on 9 benchmark problems. Table~\ref{tab:final_perf_comp} presents the average cumulative rewards obtained by the policy networks (or policy ensembles for ensemble DRL algorithms) trained by all the competing algorithms across the same number of sampled episodes with respect to each benchmark. As evidenced in the table, HED achieved consistently the best performance\footnote{HED significantly outperformed ED2 on most benchmark problems, thanks to its use of the proposed high-level policy training technique.} on most of the benchmark problems except InvertedPendulum, Reacher, and LunarLander. Meanwhile, on InvertedPendulum, Reacher, and LunarLander, HED achieved very competitive performance with at least 98\% of the maximum cumulative rewards reached by the highest performing competing algorithms. Furthermore, on some problems such as Hopper-v0 and Walker2D-v3, HED outperformed the lowest performing algorithm by up to 150\% and the algorithm with the second highest performance by up to 18\%. In addition to Table~\ref{tab:final_perf_comp}, we also compared the learning curves of all the competing algorithms in Figure \ref{fig:training_perf}. As demonstrated in this figure, by explicitly strengthening inter-learner collaboration, HED converges clearly faster and is more stable during the learning process than other competing algorithms. Specifically, on several benchmark problems, such as Hopper-v0, InvertedDoublePendulum-v0, and Hopper-v3, HED achieved significantly lower variations in learning performance across 10 independent runs. In comparison to other ensemble DRL algorithms, the learning curves of HED also appear to be smoother on several benchmark problems, such as Walker2D-v3, suggesting that HED can achieve highly competitive stability during learning. \subsubsection{Impact of $\rho_0$:} To investigate the performance impact of $\rho_0$, we tested 4 different settings of $\rho_0$, ranging from $5\mbox{e$-$}05$ to $0.01$, on the InvertedPendulum-v0 and Hopper-v0 problems (similar observations can be found on other benchmark problems and are omitted in this paper). The learning curves are plotted in Figure~\ref{fig:rho_impact}. It is witnessed in the figure that HED can convergence faster under suitable settings of $\rho_0$. However, the ``best'' $\rho_0$ varies on different benchmark problems. For example, $\rho_0=0.005$ (green curve) converges slightly faster than other settings on InvertedPendulum-v0 while $\rho_0=5e-05$ (blue curve) converges slightly faster on Hopper-v0. Nevertheless, the impact of different $\rho_0$ on the final performance appears to be small as long as $\rho_0$ is reasonably small according to Proposition \ref{the-1}. \begin{figure} \begin{center} \subfloat[InvertedPendulum-v0]{\label{fig-invertedPendulum-rho}\includegraphics[width=0.4\linewidth]{exp/rho_impact/InvertedPendulumPyBulletEnv-v0_rho.pdf}} \subfloat[Hopper-v0]{\label{fig-hp-rho}\includegraphics[width=0.4\linewidth]{exp/rho_impact/HopperPyBulletEnv-v0_rho.pdf}} \end{center} \caption{The impact of using different $\rho_0$ in \eqref{equ-mu-new} on the performance of HED. $\rho_1$ and $\rho_2$ in \eqref{equ-mu-new} depend directly on $\rho_0$ according to Proposition \ref{the-1}.} \label{fig:rho_impact} \end{figure} \subsubsection{Ablation study on high-level policy training techniques:} High-level policy training can be conducted repeatedly whenever HED obtains either a new sampled episode or a fixed number of consecutive state-transition samples (e.g., samples collected from 50 consecutive timesteps). To understand which approach is more effective, experimental comparisons have been conducted in Appendix D with detailed performance results. According to the experiment results in Appendix D, on a majority of benchmark problems, episodic learning can produce more stable learning behavior and also makes HED converge faster. We also compared HED with its variation that performs high-level policy training by using the single-step method in \eqref{equ-e-pg} instead of the multi-step method in \eqref{equ-mu-new}. Detailed experiment results can be found in Appendix E. Our experiment results confirm that multi-step training in \eqref{equ-mu-new} enables HED to achieve significantly higher performance and learning stability than using the conventional single-step training technique in \eqref{equ-e-pg}. Hence, by explicitly sharing learned policy parameters among base learners in an ensemble through \eqref{equ-mu-new}, HED can effectively enhance inter-learner collaboration and boost the learning process. \section{Conclusions} \label{sec-con} In this paper, we conducted in-depth study of ensemble DRL algorithms, which have achieved cutting-edge performance on many benchmark RL problems in the recent literature. Different from existing research works that rely mainly on each base learner of an ensemble to train its policy network individually, we developed a new HED algorithm to explore the potential of training all base learners in a hierarchical manner in order to promote inter-learner collaboration and improve the collective performance of an ensemble of trained base learners. Specifically, we adopted existing ensemble DRL algorithms such as ED2 to perform low-level policy training. Meanwhile, a new multi-step training technique was developed for high-level policy training in HED to facilitate direct inter-learner parameter sharing. Both theoretical and empirical analysis showed that the HED algorithm can achieve stable learning behavior. It also outperformed several state-of-the-art DRL algorithms on multiple benchmark RL problems. \section*{Appendix A} This appendix presents a proof of Proposition \ref{the-1}. According to \cite{scieur2017}, any multi-step integration methods including \eqref{equ-mu-new} must satisfy three conditions to ensure its stability. They together guarantee that $x_k$ can converge to $\theta_i^*$ as $k$ approaches to $\infty$. We check each condition one-by-one below to derive the main conclusions in Proposition \ref{the-1}. \vspace{0.2cm} \noindent \textbf{Consistency condition}: We can re-write \eqref{equ-mu-new} as below $$ x_{k+3}+\rho_2 x_{k+2}+\rho_1 x_{k+1}+\rho_0 x_k= h\cdot g(x_{k+2}). $$ Define the \emph{shift operator} $F$, which maps $Fx_k\rightarrow x_{k+1}$. Furthermore, with $g(x_k)$ being simplified to $g_k$, $F$ also maps $Fg_k\rightarrow g_{k+1}$. Using $F$, \eqref{equ-mu-new} can be further written as $$ \rho(F)x_k=h\sigma(F)g_k, \forall k\geq 0, $$ where $$ \rho(F)=F^3+\rho_2 F^2+\rho_1 F+\rho_0, \sigma(F)=F^2. $$ The consistency condition requires $$ \rho(1)=0, \rho'(1)=\sigma(1). $$ This implies that \begin{equation*} \begin{split} & 1+\rho_2+\rho_1+\rho_0=0, \\ & 3+2\rho_2+\rho_1=1. \end{split} \end{equation*} Solving the above equations leads to $$ \rho_1=-2\rho_0,\ \rho_2=\rho_0-1. $$ Hence, \eqref{equ-mu-new} becomes $$ x_{k+3}=(1-\rho_0)x_{k+2}+2\rho_0 x_{k+1} -\rho_0 x_k+h\cdot g(x_{k+2}). $$ \vspace{0.2cm} \noindent \textbf{Zero-stability condition}: This condition requires all roots of $\rho(F)$ to be in the unit disk. Any roots on the unit circle must be simple. In other words, $$ \left| Roots(\rho(F)) \right|\leq 1. $$ In fact, $\rho(F)$ has three roots. They are $$ 1, \frac{1}{2}\left(-\rho_0 \pm \sqrt{\rho_0(\rho_0+4)} \right). $$ It is easy to verify that when $0<\rho_0<\frac{1}{2}$, $$ \left| \frac{1}{2}\left(-\rho_0 - \sqrt{\rho_0(\rho_0+4)} \right) \right|<1. $$ Meanwhile, when $\rho_0>0$, $$ \left| \frac{1}{2}\left(-\rho_0 + \sqrt{\rho_0(\rho_0+4)} \right) \right|<1. $$ In summary, the zero-stability condition requires $$ 0<\rho_0<\frac{1}{2}. $$ \vspace{0.2cm} \noindent \textbf{Absolute stability condition}: Define \begin{equation*} \begin{split} \Pi_{\lambda h} & \overset{\Delta}{=}\rho(F)+\lambda h\sigma(F) \\ &=F^3+\rho_2 F^2+\rho_1 F+\rho_0+\lambda h F^2 \\ &=F^3+(\rho_0-1) F^2 - 2\rho_0 F+\rho_0 +\lambda h F^2 \\ &=F^3 + (\rho_0-1+\lambda h)F^2-2\rho_0 F+\rho_0. \end{split} \end{equation*} Further define $$ r_{max}=\max_{\lambda\in [L,U]} \max_{r\in Roots(\Pi_{\lambda h}(F))}|r|, $$ where $L$ and $U$ in this appendix refer respectively to the smallest and the largest positive eigenvalues of matrix $A$ in \eqref{equ-grad-linear}. The absolute stability condition requires \begin{equation} r_{max}<1. \label{equ-abs-con} \end{equation} Let \begin{equation*} \begin{split} & B=\rho_0-1+\lambda h, \\ & C=-2\rho_0, \\ & D=\rho_0. \end{split} \end{equation*} Subsequently, define \begin{equation*} \begin{split} & A_0=1-B+C-D=2-\lambda h-4\rho_0, \\ & A_1=3-B-C-3D=4-\lambda h -2\rho_0, \\ & A_2=3+B-C-3D=2+\lambda h, \\ & A_3=1+B+C+D=\lambda h. \end{split} \end{equation*} According to the Routh-Hurwitz criterion \cite{nise2020}, the following two conditions jointly guarantee \eqref{equ-abs-con}: \begin{equation*} \begin{split} A_1,A_2,A_3,A_4>0, \\ A_1 A_2 > A_0 A_3. \end{split} \end{equation*} Specifically, the first condition above gives rise to the following: $$ \lambda h >0,\ \lambda h+2\rho_0<4,\ \lambda h+4\rho_0<2. $$ Following the second condition above, we can deduce the below: $$ \lambda h>2-\frac{4}{\rho_0}. $$ Given that $\lambda h>0$, we have \begin{equation*} \begin{split} & \lambda h > \max\left\{ 0, 2-\frac{4}{\rho_0} \right\}, \\ & \lambda h < \min\left\{ 2-4\rho_0, 4-2\rho_0 \right\}. \end{split} \end{equation*} Since $0<\rho_0<\frac{1}{2}$, $$ 2-4\rho_0<4-2\rho_0,\ 2-\frac{4}{\rho_0}<0. $$ Consequently $$ 0<\lambda h<2-4\rho_0. $$ Clearly, with sufficiently small $h$, the above condition on absolute stability can be easily satisfied. Hence, we can use \eqref{equ-mu-new} to perform high-level policy training stably in the HED algorithm. \section*{Appendix B} This appendix presents a proof of Proposition \ref{the-2}. Considering any specific state $s\in\mathcal{S}$, let $$ \nabla_a Q^e(s,a)|_{a=\pi^e(s)}=C, $$ where $C$ is an arbitrary scalar constant, in line with the assumption of scalar actions. Using \eqref{equ-pe} and \eqref{equ-lin-pol}, the ensemble policy gradient with respect to policy parameters $\theta_i$ of policy $\pi^i$, $i\in[1,\ldots,N]$, is $$ \nabla_{\theta_i} J(\pi^e)=\frac{C\Phi(s)}{N}. $$ According to the multi-step learning rule in \eqref{equ-mu-new}, updating $\theta_i$ for one iteration gives the updated $\theta_i$ as $$ (1-\rho_0)\theta_i+2\rho_0\theta_q-\rho_0\theta_p+h\frac{C\Phi(s)}{N}. $$ Therefore, \begin{equation*} Mul(\pi^i(s))=(1-\rho_0)\pi^i(s)+2\rho_0\pi^q(s)-\rho_0\pi^p(s) +\frac{hC}{N}\Phi(s)^T\Phi(s). \end{equation*} Hence $$ \mathbb{E}\left[ Mul(\pi^i(s)) \right]=(1-\rho_0)\pi^i(s)+\rho_0\pi^e(s)+\frac{h C}{N}\Phi(s)^T\Phi(s), $$ $$ \mathbb{E}\left[ Mul(\pi^e(s)) \right]=\pi^e(s)+\frac{h C}{N}\Phi(s)^T\Phi(s). $$ In comparison, upon using the single-step method, the updated $\theta_i$ becomes $$ \theta_i+h\frac{C\Phi(s)}{N}. $$ Subsequently, $$ Sin(\pi^i(s))=\pi^i(s)+\frac{h C}{N}\Phi(s)^T\Phi(s), $$ $$ Sin(\pi^e(s))=\pi^e(s)+\frac{h C}{N}\Phi(s)^T\Phi(s). $$ Clearly, $$ Sin(\pi^e(s))=\mathbb{E}\left[ Mul(\pi^e(s)) \right]. $$ Hence, the expected action changes applied to $\pi^e(s)$ are identical, regardless of whether single-step or multi-step method is used for high-level policy training\footnote{We assume in Proposition \ref{the-2} that high-level policy training is performed for one iteration on a specific state $s$.}. Define $$ \Delta=\sum_{i\in[1,\ldots,N]}(\pi^i(s)-\pi^e(s)). $$ For the single-step method, after all base learners trained their respective policies for one iteration on state $s$, it is easy to verify that \begin{equation*} \begin{split} & \sum_{i\in[1,\ldots,N]}\left( Sin(\pi^i(s))-Sin(\pi^e(s)) \right)^2\\ =& \sum_{i\in[1,\ldots,N]}\left( \pi^i(s)-\pi^e(s) \right)^2\\ =& \Delta. \end{split} \end{equation*} Meanwhile, \begin{equation*} \begin{split} & \left( Mul(\pi^i(s))-\mathbb{E}\left[ Mul(\pi^e(s)) \right] \right)^2 \\ =&\left( (1-\rho_0) (\pi^i(s)-\pi^e(s)) + 2\rho_0 (\pi^q(s)-\pi^e(s)) -\rho_0(\pi^p(s)-\pi^e(s)) \right)^2\\ =&(1-\rho_0)^2(\pi^i(s)-\pi^e(s))^2+4\rho_0^2(\pi^q(s)-\pi^e(s))^2+\rho^2(\pi^p(s)-\pi^e(s))^2\\ &+4(1-\rho_0)\rho_0(\pi^i-\pi^e(s))(\pi^q(s)-\pi^e(s)) \\ &-2(1-\rho_0)\rho_0(\pi^i(s)-\pi^e(s))(\pi^p(s)-\pi^e(s))\\ &-4\rho_0^2(\pi^q(s)-\pi^e(s))(\pi^p(s)-\pi^e(s)). \end{split} \end{equation*} Since the base learner indices $p$ and $q$ are randomly and independently selected, $$ \mathbb{E}\left[(\pi^i(s)-\pi^e(s))(\pi^p(s)-\pi^e(s))\right]=0, $$ $$ \mathbb{E}\left[(\pi^i(s)-\pi^e(s))(\pi^q(s)-\pi^e(s))\right]=0, $$ $$ \mathbb{E}\left[(\pi^q(s)-\pi^e(s))(\pi^p(s)-\pi^e(s))\right]=0. $$ Therefore \begin{equation*} \begin{split} & \sum_{i\in[1,\ldots,N]} \mathbb{E}\left[ \left( Mul(\pi^i(s))-\mathbb{E}\left[ Mul(\pi^e(s)) \right] \right)^2 \right] \\ =&(1-\rho_0)^2\Delta+4\rho_0^2\Delta+\rho_0^2\Delta \\ =&(1-2\rho_0+6\rho_0^2)\Delta. \end{split} \end{equation*} When $0<\rho_0<\frac{1}{3}$, $$ 1-2\rho_0+6\rho_0^2<1. $$ As a result, \begin{equation*} \begin{split} &\sum_{i\in[1,\ldots,N]}\mathbb{E}\left[ \left( Mul(\pi^i(s))-\mathbb{E}\left[ Mul(\pi^e(s)) \right] \right)^2 \right] \\ <&\sum_{i\in[1,\ldots,N]}\left( Sin(\pi^i(s))-Sin(\pi^e(s)) \right)^2. \end{split} \end{equation*} \section*{Appendix C} Table~\ref{tab:hyper-para} provides detailed hyper-parameter settings of all competing algorithms. Our hyper-parameter settings follow strictly the recommended settings in \cite{fujimoto2018,haarnoja2018,januszewski2021,lee2021sunrise}. \begin{table}[htb!] \caption{Hyper-parameter settings of competing algorithms.} \label{tab:hyper-para} \centering \resizebox{0.7\linewidth}{!}{ \begin{tabular}{l||llll} \hline Hyper-parameter & TD3 & SAC & ED2 & SUNRISE \\ \hline Num. episodes & 2500 & 2500 & 2500 & 3000 \\ Episode length & 1000 & 1000 & 1000 & 1000 \\ Minibatch size & 100 & 100 & 100 & 256 \\ Adam learning rate & 5e-4 & 3e-4 & 5e-4 & 3e-4 \\ Discount ($\gamma$) & 0.99 & 0.99 & 0.99 & 0.99 \\ GAE parameter ($\lambda$) & 0.995 & 0.995 & 0.995 & 0.995 \\ Replay buffer size & 1e6 & 1e6 & 1e6 & 1e6 \\ Update interval & 50 & 50 & 50 & 50 \\ Ensemble size & - & - & 5 & 5 \\ \hline \end{tabular}} \end{table} All experiments were run using a cluster of Linux computing nodes. Each node is equipped with 16 GB memory. The CPU specification is provided in Table~\ref{tab:cpu-para}. Each experiment was run in a Python virtual environment managed by Anaconda with Python packages specified in Table~\ref{tab:python-lib}. \begin{table}[htb!] \caption{CPU specification.} \label{tab:cpu-para} \centering \resizebox{0.6\linewidth}{!}{ \begin{tabular}{ll} \hline Architecture & x86\_64 \\ CPU op-mode(s) & 32-bit, 64-bit \\ CPU(s) & 16 \\ CPU family & 6 \\ Thread(s) per core & 2 \\ CPU max MHz & 4900.0000 \\ CPU min MHz & 800.0000 \\ Model name & 11th Gen Intel(R) Core(TM)\\ & i7-11700 @ 2.50GHz \\ \hline \end{tabular} } \end{table} \begin{table}[htb!] \caption{Python packages.} \label{tab:python-lib} \centering \begin{tabular}{ll} \hline Package name &Version \\ \hline cython &0.29.25 \\ gym &0.21.0 \\ keras &2.7.0 \\ mujoco-py &2.1.2.14 \\ numpy &1.21.4 \\ pybulletgym &0.1 \\ python &3.7.11 \\ scipy &1.7.3 \\ tensorflow &2.7.0 \\ \hline \end{tabular} \end{table} \begin{figure*}[!hbt] \begin{center} \subfloat[Hopper-v0 (PyBullet)]{\label{fig-hc-eq9}\includegraphics[width=0.33\linewidth]{exp/when2train_HighLevelPolicy/HopperPyBulletEnv-v0_when2HLtrain.pdf}} \subfloat[InvertedDoublePendulum-v0 (PyBullet)]{\label{fig-idpPB-when2HLtrain}\includegraphics[width=0.33\linewidth]{exp/when2train_HighLevelPolicy/InvertedDoublePendulumPyBulletEnv-v0_when2HLtrain.pdf}} \subfloat[InvertedPendulum-v0 (PyBullet)]{\label{fig-ipPB-when2HLtrain}\includegraphics[width=0.33\linewidth]{exp/when2train_HighLevelPolicy/InvertedPendulumPyBulletEnv-v0_when2HLtrain.pdf}}\\ \subfloat[Reacher-v0 (PyBullet)]{\label{fig-reacher-when2HLtrain}\includegraphics[width=0.33\linewidth]{exp/when2train_HighLevelPolicy/ReacherPyBulletEnv-v0_when2HLtrain.pdf}} \subfloat[Hopper-v3 (Mujoco)]{\label{fig-hopper-when2HLtrain}\includegraphics[width=0.33\linewidth]{exp/when2train_HighLevelPolicy/Hopper-v3_when2HLtrain.pdf}} \subfloat[Walker2D-v3 (Mujoco)]{\label{fig-walkerPB-when2HLtrain}\includegraphics[width=0.33\linewidth]{exp/when2train_HighLevelPolicy/Walker2d-v3_when2HLtrain.pdf}}\\ \end{center} \caption{Learning curves of HED with respect to two high-level policy training approaches. The method that conducts high-level policy training after every 50 timesteps is denoted as \emph{Fixed timestep}. The method that conducts high-level policy training at the end of each sampled episode is denoted as \emph{Each episode}.} \label{fig:when2HLtrain_impact} \end{figure*} \begin{figure*}[!hbt] \begin{center} \subfloat[Hopper-v0 (PyBullet)]{\label{fig-hc-eq9}\includegraphics[width=0.33\linewidth]{exp/eq9_impact/HopperPyBulletEnv-v0_EQ9.pdf}} \subfloat[InvertedDoublePendulum-v0 (PyBullet)]{\label{fig-idpPB-eq9}\includegraphics[width=0.33\linewidth]{exp/eq9_impact/InvertedDoublePendulumPyBulletEnv-v0_EQ9.pdf}} \subfloat[InvertedPendulum-v0 (PyBullet)]{\label{fig-ipPB-eq9}\includegraphics[width=0.33\linewidth]{exp/eq9_impact/InvertedPendulumPyBulletEnv-v0_EQ9.pdf}}\\ \subfloat[Reacher-v0 (PyBullet)]{\label{fig-reacher-eq9}\includegraphics[width=0.33\linewidth]{exp/eq9_impact/ReacherPyBulletEnv-v0_EQ9.pdf}} \subfloat[Hopper-v3 (Mujoco)]{\label{fig-hopper-eq9}\includegraphics[width=0.33\linewidth]{exp/eq9_impact/Hopper-v3_EQ9.pdf}} \subfloat[Walker2D-v3 (Mujoco)]{\label{fig-walkerPB-eq9}\includegraphics[width=0.33\linewidth]{exp/eq9_impact/Walker2d-v3_EQ9.pdf}}\\ \end{center} \caption{Learning curves of HED using the single-step high-level policy training technique in \eqref{equ-e-pg} vs. the proposed multi-step high-level policy training technique in \eqref{equ-mu-new}.} \label{fig:eq9_impact} \end{figure*} \section*{Appendix D} In this appendix, we study the effectiveness of conducting high-level policy training after HED obtains a full sampled episode. Figure~\ref{fig:when2HLtrain_impact} shows the performance comparison of HED with two different training frequencies: every 50 consecutive timesteps vs. every episode. It can be noticed that, on a majority benchmark problems (i.e., 5 out of 6), performing high-level policy training after every episode (orange curve) can significantly improve the HED algorithm in terms of both the final performance and convergence speed. For example, as shown in Figure~\ref{fig:when2HLtrain_impact}(e), the orange curve reaches 3500 after 1500 episodes while the blue curve converges to a lower cumulative reward (approx. 3000) after 2000 episodes. We also notice that episodic policy training is more robust to the randomness in the environment and less sensitive to the initialization of neural network weights. For example, in Figure~\ref{fig:when2HLtrain_impact}(e), episodic policy training produces a smaller confident interval (orange shaded area) compared to the fixed timestep training (blue shaded area) over 10 independent algorithm runs. Similar results can also be observed from Figures~\ref{fig:when2HLtrain_impact}(a) and (f). Note that in each algorithm run, both policy networks and Q-networks are initialized with different weights. The environment initial states also vary. \section*{Appendix E} This appendix investigates the effectiveness of multi-step policy training by using \eqref{equ-mu-new}. Specifically, we compare the performance of HED against its variant, which performs single-step high-level policy training by using \eqref{equ-e-pg}, on 6 problems that include both PyBullet and Mujoco benchmarks. As shown in Figure~\ref{fig:eq9_impact}, with the help of \eqref{equ-mu-new}, significant performance improvement can be observed (orange curve) on most benchmark problems. In particular, HED behaves more stably during the learning process. For example, in Figure~\ref{fig:eq9_impact}(c), the cumulative rewards obtained by the policy trained using~\eqref{equ-mu-new} (orange curve) remain stable at 1000 after 300 episodes. In comparison, the blue curve stays below 1000 and fluctuates between 800 and 1000 over the entire learning period. Similar trends can also be noticed in Figure~\ref{fig:eq9_impact}(b). The proposed multi-step policy training technique achieves clearly higher cumulative rewards. In the Hopper environment shown in Figure~\ref{fig:eq9_impact}(e), the orange curve outperforms the blue curve by up to 75\% after 2500 training episodes. Moreover, the orange curve converges to 3500 while the blue curve remains below 2000. The significant improvement in cumulative rewards can also be witnessed in Figure~\ref{fig:eq9_impact}(a) and (f). The shaded areas in Figure~\ref{fig:eq9_impact}(e) and (f) also show that the multi-step training technique is less sensitive to the environment randomness and neural network weight initialization, compared to using the conventional single-step training method in \eqref{equ-e-pg}. Hence, our experiment results confirm the importance of inter-learner collaboration. By enabling base learners in an ensemble to explicitly share their learned policy parameters, HED can achieve high learning stability and effectively boost the learning process. \bibliographystyle{IEEEtran}
{'timestamp': '2022-09-30T02:05:37', 'yymm': '2209', 'arxiv_id': '2209.14488', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14488'}
arxiv
\section{Introduction} Recently, bit allocation for Neural Video Compression (NVC) has drawn growing attention thanks to its great potential in boosting compression performance. Due to the frame reference structure in video coding, it is sub-optimal to use the same R-D (Rate-Distortion) trade-off parameter $\lambda$ for all frames. In bit allocation task, bitrate is allocated to different frames/regions to minimize R-D cost $R+\lambda D$, where $R$ is total bitrate, $D$ is total distortion, and $\lambda$ is the Lagrangian multiplier controlling R-D trade-off. \citet{li2022rate} are the pioneer of bit allocation for NVC, who improve the empirical R-D (Rate-Distortion) model from traditional video codec \citep{li2014lambda,li2016lambda} and solve the per-frame Lagrangian multiplier $\lambda$. Other concurrent works adopt simple heuristics for coarse bit allocation \citep{cetin2022flexible,hu2022coarse}. Most recently, BAO (Bit Allocation using Optimization) \citep{bao2022} proposes to formulate bit allocation as semi-amortized variational inference (SAVI) \citep{kim2018semi,marino2018iterative} and solves it by gradient-based optimization. Specifically, it directly optimizes the variational posterior parameter to be quantized and encoded by gradient ascent, aiming at maximizing the minus overall R-D cost, which is also the evident lowerbound (ELBO). BAO does not rely on any empirical R-D model and thus outperforms previous work. Further, BAO shows its optimality by proving its equivalence to bit allocation with precise R-D model. In this paper, we first show that BAO \citep{bao2022} is in fact, sub-optimal due to its implementation. Specifically, we find that it abuses SAVI \citep{kim2018semi,marino2018iterative} on latent with non-factorized variational posterior, which brings incorrect gradient signal during optimization. To solve this problem, we first extend SAVI to non-factorized latent by back-propagating through gradient ascent \citep{domke2012generic}. Then based on that, we correct the sub-optimal bit allocation in BAO to produce true optimal bit allocation for NVC. Furthermore, we propose a computational feasible approximation to such correct but intractable bit allocation method. And we show that our approximation outperforms the incorrect bit allocation (BAO) in terms of R-D performance and bitrate error, and performs better than all other bit allocation methods. To summarize, our contributions are as follows: \begin{itemize} \item We demonstrate that a previously claimed optimal bit allocation method is actually sub-optimal. We find that its sub-optimality comes from the improper application of SAVI to non-factorized latent. \item We present the correct way to conduct SAVI on non-factorized latent by recursively applying back-propagation through gradient ascent. Based on this, we derive the corrected optimal bit allocation algorithm for NVC. \item Furthermore, we propose a computational efficient approximation of the optimal bit allocation to make it feasible. Our proposed approach improves the R-D performance and bitrate error over the incorrect bit allocation (BAO), and outperforms all other bit allocation methods for NVC. \end{itemize} \section{Preliminaries} \subsection{Neural Video Compression} The input of NVC is a GoP (Group of Picture) $\bm{x}_{1:T}$, where $\bm{x}_i\in R^{H\times W}$ is the $i^{th}$ frame with $H\times W$ pixels, and $T$ is the number of frame inside the GoP. Most of the works in NVC follow a latent variable model with temporal autoregressive relationship \citep{yang2020hierarchical}. Specifically, to encode $\bm{x}_i$, we first extract the motion latent $\bm{w}_i=f^{w}_{\phi}(\bm{x}_i,\bm{x}'_i)$ from current frame $\bm{x}_i$ and previous reconstructed frame $\bm{x}'_{i-1}$, where $f^{w}_{\phi}(\cdot)$ is the motion encoder parameterized by $\phi$\footnote{Following previous works in deep generative modeling \citep{kingma2013auto,kim2018semi}, we denote all parameters related to encoder as $\phi$, and all parameters related to decoder and prior as $\theta$.}. Then, we encode the quantized latent $\bmt{w}_i=\lfloor\bm{w}_i\rceil$ with the probability mass function (pmf) estimator $P_{\theta}(\bmt{w}_i|\bmt{w}_{<i},\bmt{y}_{<i})$ parameterized by $\theta$, where $\lfloor\cdot\rceil$ is the rounding. Then, we obtain the residual latent $\bm{y}_i=f_{\phi}^y(\bm{x},\bm{x}',\bmt{w})$, where $f_{\phi}^y(\cdot)$ is the residual encoder. Then, similar to how we treat $\bm{w}_i$, we encode the quantized latent $\bmt{y}_i=\lfloor\bm{y}_i\rceil$ with pmf $P_{\theta}(\bmt{y}_i|\bmt{w}_{\le i},\bmt{y}_{<i})$. Finally, we obtain the reconstructed frame $\bm{x}'_i=g^{x}_{\theta}(\bm{x}'_{i-1},\bmt{w}_i,\bmt{y}_i)$, where $g^{x}_{\theta}(\cdot)$ is the decoder parameterized by $\theta$. As only the motion latent $\bmt{w}_i$ and residual latent $\bmt{y}_i$ exist in the bitstream, the above process can be simplified as Eq.~\ref{eq:enc} and Eq.~\ref{eq:dec}, where $f_{\phi}(\cdot)$ is the generalized encoder and $g_{\theta}(\cdot)$ is the generalized decoder. The target of NVC is to minimize the per-frame R-D cost $R_i+\lambda_i D_i$ (Eq.~\ref{eq:rd}), where $R_i$ is the bitrate, $D_i$ is the distortion and $\lambda_i$ is the Lagrangian multiplier controlling R-D trade-off. The bitrate $R_i$ and distortion $D_i$ is computed as Eq.~\ref{eq:dec}, where $d(\cdot,\cdot)$ is the distortion metric. And $\lambda_i D_i$ can be further interpreted as the data likelihood term $-\log p_{\theta}(\bm{x}_i|\bmt{w}_{\le i},\bmt{y}_{\le i})$ so long as we treat $\lambda_i D_i$ as the energy function of a Gibbs distribution \citep{minnen2018joint}. Specifically, when $d(\cdot,\cdot)$ is MSE, we can interpret $\lambda_iD_i=-\log p_{\theta}(\bm{x}_i|\bmt{w}_{\le i},\bmt{y}_{\le i})+const$, where $p_{\theta}(\bm{x}_i|\bmt{w}_{\le i},\bmt{y}_{\le i})$ is a Gaussian distribution $\mathcal{N}(\bm{\hat{x}}_i,1/2\lambda_i I)$. \begin{align} \bm{w}_i = f_{\phi}(\bm{x}_i, \bmt{w}_{<i},\bmt{y}_{<i}),\bm{y}_i = f_{\phi}(\bm{x}_i, \bmt{w}_{\le i}, \bmt{y}_{<i})&\textrm{, where } \bmt{w}_i=\lfloor\bm{w}_i\rceil\textrm{, }\bmt{y}_i=\lfloor\bm{y}_i\rceil \label{eq:enc}\\ R_i=\log P_{\theta}(\bmt{w}_i,\bmt{y}_i|\bmt{w}_{<i},\bmt{y}_{<i})\textrm{, }D_i=d&(\bm{x}_i,g_{\theta}(\bmt{w}_{\le i},\bmt{y}_{\le i})) \label{eq:dec}\\ \max -(R_i + \lambda_i D_i&) \label{eq:rd} \end{align} On the other hand, NVC is also closely related to Variational Autoencoder (VAE) \citep{kingma2013auto}. As the rounding $\lfloor\cdot\rceil$ is not differentiable, \citet{balle2016end,Theis17} propose to relax it by additive uniform noise (AUN), and replace $\bmt{w}_i=\lfloor\bm{w}_i\rceil$, $\bmt{y}_i=\lfloor\bm{y}_i\rceil$ with $\bmt{w}_i=\bm{w}_i+\mathcal{U}(-0.5,0.5)$, $\bmt{y}_i=\bm{y}_i+\mathcal{U}(-0.5,0.5)$. Under such formulation, the above encoding-decoding process becomes a VAE on graphic model $\bmt{w}_{\le i}, \bmt{y}_{\le i} \rightarrow \bm{x}_i$ with variational posterior as Eq.~\ref{eq:q}, where $\bm{w}_i,\bm{y}_i$ plays the role of variational posterior parameter. Then, minimizing the overall R-D cost (Eq.~\ref{eq:rd}) is equivalent to maximizing the evident lowerbound (ELBO) (Eq.~\ref{eq:elbo}). \begin{align} \hspace{-0.5em}q_{\phi}(\bmt{w}_i|\bm{x}_i, \bmt{w}_{<i}, \bmt{y}_{<i}) = \mathcal{U}(\bm{w}_i-0.5,\bm{w}_i+0.5), q_{\phi}(\bmt{y}_i&|\bm{x}_i, \bmt{w}_{\le i}, \bmt{y}_{<i}) = \mathcal{U}(\bm{y}_i-0.5,\bm{y}_i+0.5) \label{eq:q}\\ -(R_i + \lambda_i D_i) = \mathbb{E}_{q_{\phi}}[\underbrace{\log P_{\theta}(\bmt{w}_i,\bmt{y}_i|\bmt{w}_{<i},\bmt{y}_{<i})}_{-R_i}&+\underbrace{\log p_{\theta}(\bm{x}_i|\bmt{w}_{\le i},\bmt{y}_{\le i})}_{-\lambda_i D_i}\underbrace{\cancel{-\log q_{\phi}}}_{\textrm{bits-back bitrate: 0}}] \label{eq:elbo} \end{align} \subsection{Bit Allocation for Neural Video Compression} \label{sec:bgba} It is well known to video coding community that using the same R-D trade-off parameter $\lambda_i$ to optimize R-D cost in Eq.~\ref{eq:rd} for all $T$ frames inside a GoP is suboptimal \citep{li2014lambda,li2016lambda}. This sub-optimality comes from the frame reference structure and is explained in detail by \citet{li2022rate, bao2022}. The target of bit allocation is to maximize the minus of overall R-D cost (ELBO) $\mathcal{L}$ as Eq.~\ref{eq:l0} given the overall R-D trade-off parameter $\lambda_0$, instead of maximizing $\mathcal{L}_i$ of each frame $i$ separately. The pioneer work of bit allocation in NVC \citep{li2022rate} follows bit allocation for traditional video codec \citep{li2016lambda}. Specifically, it adopts empirical models to approximate the relationship of the rate dependency $\partial R_{i+1}/\partial R_{i}$ and distortion dependency $\partial D_{i+1}/\partial D_{i}$ between frames. Then it takes those models into Eq.~\ref{eq:l0} to solve $\lambda_{1:T}^*$ explicitly as Eq.~\ref{eq:rd1}.\textit{left}. However, its performance heavily relies on the accuracy of empirical models. \begin{align} &\max \mathcal{L} = \sum_{i=1}^{T} \mathcal{L}_{i}\textrm{, where } \mathcal{L}_i = -(R_i + \lambda_0 D_i)\label{eq:l0}\\ \lambda^{*}_{1:T} \leftarrow \arg \max_{\lambda_{1:T}}& \mathcal{L} (\lambda_{1:T})\textrm{, versus } \bm{w}^{*}_{1:T},\bm{y}^{*}_{1:T} \leftarrow \arg \max_{\bm{w}_{1:T},\bm{y}_{1:T}} \mathcal{L}(\bm{w}_{1:T},\bm{y}_{1:T}) \label{eq:rd1} \end{align} On the other hand, BAO \citep{bao2022} does not solve $\lambda_{1:T}^{*}$ explicitly. Instead, it adopts SAVI \citep{kim2018semi,marino2018iterative} to achieve implicit bit allocation. To be specific, it initializes the variational posterior parameter $\bm{w}_{1:T}^0, \bm{y}_{1:T}^0$ from fully amortized variational inference (FAVI) as Eq.~\ref{eq:enc}. Then, it optimizes $\bm{w}_{1:T},\bm{y}_{1:T}$ via gradient ascent to maximize $\mathcal{L}$ as Eq.~\ref{eq:rd1}.\textit{right}. During this procedure, no empirical model is required. BAO further proofs that optimizing Eq.~\ref{eq:rd1}.\textit{right} is equivalent to optimizing Eq.~\ref{eq:rd1}.\textit{left} with precise rate and distortion dependency model $\partial R_{i+1}/\partial R_i,\partial D_{i+1}/\partial D_i$ (See Thm.~1, Thm.~2 in \citet{bao2022}). Thus, BAO claims that it is optimal assuming gradient ascent achieves global maximum. However, in next section, we show that BAO \citep{bao2022} is in fact suboptimal due to its implementation. \section{Why BAO is Sup-optimal} \label{sec:baosub} BAO \citep{bao2022} achieves the SAVI \citep{kim2018semi,marino2018iterative} target in Eq.~\ref{eq:rd1}.\textit{right} by gradient-based optimization. More specifically, its update rule is described as Eq.~\ref{eq:fa_gradw} and Eq.~\ref{eq:fa_grady}, where $K$ is the total number of gradient ascent steps, and $\bm{w}_i^k,\bm{y}_i^k$ is the posterior parameter $\bm{w}_i,\bm{y}_i$ after $k$ steps of gradient ascent. In the original paper of BAO, the authors also find that directly optimizing $\bm{w}_i,\bm{y}_i$ simultaneously by Eq.~\ref{eq:fa_gradw} and Eq.~\ref{eq:fa_grady} performs worse than optimizing $\bm{y}_i$ alone using Eq.~\ref{eq:fa_grady}, but they have not offered any explanation. It is obvious that optimizing $\bm{y}_i$ alone is sub-optimal. However, it is not obvious why jointly optimizing $\bm{w}_i, \bm{y}_i$ with Eq.~\ref{eq:fa_gradw} and Eq.~\ref{eq:fa_grady} fails. \begin{align} \bm{w}^{k+1}_i \leftarrow \bm{w}^k_i + \alpha\frac{ d\mathcal{L}(\bm{w}^k_{1:T},\bm{y}^k_{1:T})}{d \bm{w}^k_i}\textrm{, where }\frac{d \mathcal{L}(\bm{w}^k_{1:T},\bm{y}^k_{1:T})}{d \bm{w}^k_i}=\sum_{j=i}^{T}\frac{\partial \mathcal{L}_{j}(\bm{w}^k_{1:j},\bm{y}^k_{1:j})}{\partial \bm{w}^k_i}\label{eq:fa_gradw}\\ \bm{y}^{k+1}_i \leftarrow \bm{y}^k_i + \alpha\frac{d \mathcal{L}(\bm{w}^k_{1:T},\bm{y}^k_{1:T})}{d \bm{y}^k_i}\textrm{, where }\frac{d \mathcal{L}(\bm{w}^k_{1:T},\bm{y}^k_{1:T})}{d \bm{y}^k_i}=\sum_{j=i}^{T}\frac{\partial \mathcal{L}_{j}(\bm{w}^k_{1:j},\bm{y}^k_{1:j})}{\partial\bm{y}^k_i} \label{eq:fa_grady} \end{align} In fact, the update rule in Eq.~\ref{eq:fa_gradw} and Eq.~\ref{eq:fa_grady} is exactly the SAVI \citep{kim2018semi,marino2018iterative} when $\bm{w}_i,\bm{y}_i$ fully factorizes (e.g. the full factorization used in mean-field \citep{blei2017variational}). However, in NVC the $\bm{w}_i,\bm{y}_i$ has complicated auto-regressive relationships (See Eq.~\ref{eq:enc} and Fig.~\ref{fig:grad}.(a)). Abusing SAVI on non-factorized latent causes gradient error in two aspects: (1). The total derivative $d \mathcal{L}/d\bm{w}_i,d \mathcal{L}/d\bm{y}_i$ is incomplete. (2). The total derivative $d \mathcal{L}/d\bm{w}_i,d \mathcal{L}/d\bm{y}_i$ and partial derivative $\partial \mathcal{L}_j/\partial\bm{w}_i,\partial\mathcal{L}_j/\partial\bm{y}_i$ is evaluated at wrong value. In next two sections, we elaborate those two issues with $\bm{w}_i$ related equations in main text and $\bm{y}_i$ related equations in Appendix.~\ref{app:cf}. \begin{figure}[thb] \centering \includegraphics[width=\linewidth]{fig_grad.PNG} \caption{(a). The gradient structure of NVC without SAVI. (b). After $k$ step of SAVI/gradient ascent, the gradient structure of NVC is broken. (c). The proposed approach using back-propagating through gradient ascent. We mark the difference between (b) and (c) in red.} \label{fig:grad} \end{figure} \subsection{Incomplete Total derivative evaluation} \label{sec:itde} According to the latent generation procedure described by Eq.~\ref{eq:enc} and Eq.~\ref{eq:dec}, we draw the computational graph to describe the latent dependency as Fig.~\ref{fig:grad}.(a). Based on that, we expand the total derivative $d\mathcal{L}/d\bm{w}_i,d\mathcal{L}/d\bm{y}_i$ as Eq.~\ref{eq:incwg} and Eq.~\ref{eq:incyg}. \begin{align} \frac{d \mathcal{L}(\bm{w}_{1:T},\bm{y}_{1:T})}{d \bm{w}_i}=&\sum_{j=i}^{T}\frac{d \mathcal{L}_j(\bm{w}_{1:j},\bm{y}_{1:j})}{d \bm{w}_i}\notag\\ \frac{d \mathcal{L}_j(\bm{w}_{1:j},\bm{y}_{1:j})}{d \bm{w}_i}=&\underbrace{\sum_{l=i+1}^{j}\frac{\partial \bm{w}_l}{\partial\bm{w}_i}\frac{d \mathcal{L}_{j}(\bm{w}_{1:j},\bm{y}_{1:j})}{d \bm{w}_l}+\sum_{l=i}^{j}\frac{\partial \bm{y}_l}{\partial\bm{w}_i}\frac{d \mathcal{L}_{j}(\bm{w}_{1:j},\bm{y}_{1:j})}{d \bm{y}_l}}_{\textrm{ignored by BAO}}+\underbrace{\frac{\partial \mathcal{L}_j(\bm{w}_{1:j},\bm{y}_{1:j})}{\partial \bm{w}_i}}_{\textrm{considered by BAO}}\label{eq:incwg} \end{align} As shown in Eq.~\ref{eq:fa_gradw}, Eq.~\ref{eq:fa_grady} and Fig.~\ref{fig:grad}.(b), BAO \citep{bao2022} treats the total derivative $d\mathcal{L}/d\bm{w}_i,d\mathcal{L}/d\bm{y}_i$ as the sum of the frame level partial derivative $\partial \mathcal{L}_j/\partial\bm{w}_i,\partial \mathcal{L}_j/\partial\bm{y}_i$, which is the direct contribution of frame $i^{th}$ latent $\bm{w}_i,\bm{y}_i$ to $j^{th}$ frame's R-D cost $\mathcal{L}_j$ (as marked in Eq.~\ref{eq:incwg} and Eq.~\ref{eq:incyg}). This incomplete evaluation of gradient signal brings sub-optimality. Further, it is not possible to correct BAO by simply including other parts of gradient into consideration. As BAO jointly updates all the latent $\bm{w}_{1:T},\bm{y}_{1:T}$, the relationship of Eq.~\ref{eq:dec} only holds for the initial latent parameters $\bm{w}_{1:T}^0,\bm{y}_{1:T}^0$ produced by FAVI. And this important relationship is broken for parameters $\bm{w}_{1:T}^k,\bm{y}_{1:T}^k$ after $k\ge1$ steps of update. \subsection{Incorrect Value to Evaluate Gradient} \label{sec:ipde} As shown in Eq.~\ref{eq:fa_gradw} and Eq.~\ref{eq:fa_grady}, BAO \citep{bao2022} simultaneously updates all the posterior parameter $\bm{w}_{1:T},\bm{y}_{1:T}$ with gradient evaluated at the same gradient ascent step $\bm{w}_{1:T}^k,\bm{y}_{1:T}^k$. However, as we show later in Sec.~\ref{sec:savi2} and Fig.~\ref{fig:grad}.(c), this is sub-optimal as all the descendant latent $\bm{w}_{>i},\bm{y}_{\ge i}$ of $\bm{w}_i$ should already complete all $K$ steps of gradient ascent before the gradient of $\bm{w}_i$ is evaluated. Moreover, $\bm{w}_{>i},\bm{y}_{\ge i}$ should be initialized by FAVI using precedents latent. Similar rule applies to $\bm{y}_i$. Specifically, the correct value to evaluate the gradient is as Eq.~\ref{eq:incygw} and Eq.~\ref{eq:incygy}, where $\bm{w}_i^{k_i}$ denotes the latent $\bm{w}_i$ after $k_i$ steps of update, and $\bm{y}_i^{k'_j}$ denotes the latent $\bm{y}_i$ after $k'_i$ steps of update. \begin{align} \bm{w}^{k_i+1}_i \leftarrow \bm{w}^{k_i}_i + \alpha\frac{ d\mathcal{L}(\bm{w}_1^{k_1},...,\bm{w}_i^{k_i},\bm{w}^K_{>i},\bm{y}_1^{k'_1},...,\bm{y}_{i-1}^{k'_{i-1}},\bm{y}^K_{\ge i})}{d \bm{w}^{k_i}_i},\notag\\\textrm{where }\bm{w}_{>i}^0,\bm{y}_{\ge i}^0=f(\bm{x},\bm{w}_1^{k_1},...,\bm{w}_i^{k_i},\bm{y}_1^{k'_1},...,\bm{y}_{i-1}^{k'_{i-1}})\label{eq:incygw} \end{align} Similar to the incomplete total derivative evaluation, this problem does not have a simple solution. In next section, we show how to correct both of the above-mentioned issues by recursively applying back-propagating through gradient ascent \citep{domke2012generic}. \section{Correcting the Sub-optimal Bit Allocation} \label{sec:cba} In this section, we first extend the generic SAVI \citet{kim2018semi,marino2018iterative} to 2-level non-factorized latent. Then we further extend this result to latent with any dependency that can be described by a DAG (Directed Acyclic Graph). And finally, we correct the sub-optimal bit allocation by applying the result in DAG latent to NVC. \subsection{SAVI on 2-level non-factorized latent} \label{sec:savi2} In this section, we extend the SAVI on 1-level latent \citep{kim2018semi} to 2-level non-factorized latent. We denote $\bm{x}$ as evidence, $\bm{w}$ as the variational posterior parameter of the first level latent $\bmt{w}$, $\bm{y}$ as the variational posterior parameter of the second level latent $\bmt{y}$, and the ELBO to maximize as $\mathcal{L}(\bm{w},\bm{y})$. The posterior $q(\bmt{w},\bmt{y}|\bm{x})$ factorizes as $q(\bmt{w}|\bm{x})q(\bmt{y}|\bmt{w},\bm{x})$, which means that $\bm{y}$ depends on $\bm{w}$. Given $\bm{w}$ is fixed, we can directly follow \citet{kim2018semi,marino2018iterative} to optimize $\bm{y}$ to maximize ELBO by SAVI. However, it requires some tricks to optimize $\bm{w}$. \begin{minipage}[t]{.42\textwidth} % \vspace{0pt} \IncMargin{1.0em} \begin{algorithm}[H] \DontPrintSemicolon \caption{SAVI on 2-level Latent}\label{alg:solve-2} \textbf{procedure} solve-2-level($\bm{x},\bm{w}^{k}$)\; $\quad$initialize $\bm{w}^0\leftarrow f(\bm{x})$ from FAVI\; $\quad$\textbf{for} $k=0,...,K-1$ \textbf{do}\; $\quad\quad \frac{d\mathcal{L}(\bm{w}^k,\bm{y}^K)}{d\bm{w}^k}=\textrm{grad-2-level}(\bm{x},\bm{w}^k)$\; $\quad\quad \bm{w}^{k+1}\leftarrow\bm{w}^k+\alpha\frac{d\mathcal{L}(\bm{w}^k,\bm{y}^K)}{d\bm{w}^k}$\; $\quad$\textbf{return} $\bm{w}^{K},\bm{y}^K$\; \BlankLine \textbf{procedure} grad-2-level($\bm{x},\bm{w}^{k}$)\; $\quad\bm{y}^0\leftarrow f(\bm{x},\bm{w}^{k})$ from FAVI\; $\quad$\textbf{for} $k'=0,...,K-1$ \textbf{do}\; $\quad\quad \bm{y}^{k'+1}\leftarrow\bm{y}^{k'}+\alpha\frac{d\mathcal{L}(\bm{w}^{k},\bm{y}^{k'})}{d\bm{y}^{k'}}$\; $\quad\overleftarrow{\bm{w}}\leftarrow\frac{\partial \mathcal{L}(\bm{w}^{k},\bm{y}^K)}{\partial \bm{w}^{k}}$\; $\quad\overleftarrow{\bm{y}^K}\leftarrow\frac{d\mathcal{L}(\bm{w}^{k},\bm{y}^K)}{d\bm{y}^K}$\; $\quad$\textbf{for} $k'=K-1,...,0$ \textbf{do}\; $\quad\quad\overleftarrow{\bm{w}}\leftarrow\overleftarrow{\bm{w}}+\alpha\frac{\partial^2 \mathcal{L}(\bm{w}^{k},\bm{y}^{k'})}{\partial \bm{w}^{k}\partial\bm{y}^{k'}}\overleftarrow{\bm{y}^{k'+1}}$\; $\quad\quad\overleftarrow{\bm{y}^{k'}}\leftarrow\overleftarrow{\bm{y}^{k'}}+\alpha\frac{\partial^2 \mathcal{L}(\bm{w}^{k},\bm{y}^{k'})}{\partial \bm{y}^{k'}\partial\bm{y}^{k'}}\overleftarrow{\bm{y}^{k'+1}}$\; $\quad\overleftarrow{\bm{w}}=\overleftarrow{\bm{w}}+\frac{\partial \bm{y}^0}{\partial\bm{w}^k}\overleftarrow{\bm{y}^{0}}$\; $\quad$\textbf{return} $\frac{d\mathcal{L}(\bm{w}^k,\bm{y}^K)}{d\bm{w}^k}=\overleftarrow{\bm{w}}$\; \end{algorithm} \end{minipage} \begin{minipage}[t]{.58\textwidth} % \vspace{0pt} \IncMargin{1.0em} \begin{algorithm}[H] \DontPrintSemicolon \caption{SAVI on DAG Latent}\label{alg:solve-dag} \textbf{procedure} solve-dag($\bm{x}$)\; $\quad$sort $\bm{y}_1,...,\bm{y}_N$ in topological order\; $\quad$\textbf{for} $\bm{y}_j$ with parent $\mathcal{P}(\bm{y}_j)=\varnothing$\; $\quad\quad$ add $\bm{y}_j$ to fake node $\bm{y}_0$'s children $\mathcal{C}(\bm{y}_0)$\; $\quad$grad-dag($\bm{x},\bm{y}_0^0$)\; $\quad$\textbf{return} $\bm{y}_1^K,...,\bm{y}_N^K$\; \BlankLine \textbf{procedure} grad-dag($\bm{x},\bm{y}_0^{k_0},...,\bm{y}_i^{k_i}$)\; $\quad$\textbf{for} $\bm{y}_{j}\in\mathcal{C}(\bm{y}_i)$ in topological order \textbf{do}\; $\quad\quad$ $\bm{y}_{j}^0\leftarrow f(\bm{x},\bm{y}_0^{k_0},...,\bm{y}_{<j}^{k_{<j}})$ from FAVI\; $\quad\quad$ \textbf{for} $k_j=0,...,K-1$ \textbf{do}\; $\quad\quad\quad \frac{d\mathcal{L}(\bm{y}_0^{k_0},...,\bm{y}_j^{k_j},\bm{y}_{>j}^K)}{d\bm{y}_{j}^{k_j}} \leftarrow \textrm{grad-dag}(\bm{x},\bm{y}_0^{k_0},...,\bm{y}_j^{k_j})$\; $\quad\quad\quad\bm{y}_{j}^{k_j+1}\leftarrow\bm{y}_{j}^{k_j}+ \alpha\frac{d\mathcal{L}(\bm{y}_0^{k_0},...,\bm{y}_j^{k_j},\bm{y}_{>j}^K)}{d\bm{y}_{j}^{k_j}}$\; $\quad\overleftarrow{\bm{y}_i}\leftarrow \frac{\partial\mathcal{L}(\bm{y}_0^{k_0},...,\bm{y}_i^{k_i},\bm{y}_{>i}^K)}{\partial \bm{y}_i^{k_i}}$\; $\quad$\textbf{for} $\bm{y}_{j}\in\mathcal{C}(\bm{y}_i)$ \textbf{do}\; $\quad\quad\overleftarrow{\bm{y}_j}\leftarrow\bm{0},\overleftarrow{\bm{y}_{j}^K}\leftarrow\frac{d \mathcal{L}(\bm{y}_0^{k_0},...,\bm{y}_i^{k_i},\bm{y}_{>i}^K)}{d\bm{y}_{j}^K}$\; $\quad\quad$\textbf{for} $k_j=K-1,...,0$ \textbf{do}\; $\quad\quad\quad\overleftarrow{\bm{y}_j}\leftarrow\overleftarrow{\bm{y}_j}+\alpha \frac{\partial^2 \mathcal{L}(\bm{y}_0^{k_0},...,\bm{y}_j^{k_j},\bm{y}_{>j}^K)}{\partial\bm{y}_i^{k_i}\partial\bm{y}_{j}^{k_j}}\overleftarrow{\bm{y}_{j}^{k_j+1}}$\; $\quad\quad\quad\overleftarrow{\bm{y}_j^{k_j}}\leftarrow\overleftarrow{\bm{y}_j^{k_j+1}}+\alpha \frac{\partial^2 \mathcal{L}(\bm{y}_0^{k_0},...,\bm{y}_j^{k_j},\bm{y}_{>j}^K)}{\partial\bm{y}_j^{k_j}\partial\bm{y}_{j}^{k_j}}\overleftarrow{\bm{y}_{j}^{k_j+1}}$\; $\quad\quad\overleftarrow{\bm{y}_i}\leftarrow \overleftarrow{\bm{y}_i} + \overleftarrow{\bm{y}_j}+\frac{\partial \bm{y}_j^0}{\partial \bm{y_i^{k_i}}}\overleftarrow{\bm{y}_j^{0}}$\; $\quad$\textbf{return}$\frac{d\mathcal{L}(\bm{y}_0^{k_0},...,\bm{y}_i^{k_i},\bm{y}_{>i}^K)}{d \bm{y}_i^{k_i}}=\overleftarrow{\bm{y}_i}$\; \end{algorithm} \end{minipage} The intuition is, we do not want to find a $\bm{w}$ that maximizes $\mathcal{L}(\bm{w},\bm{y})$ given a fixed $\bm{y}$ (or we have the gradient issue described in Sec.~\ref{sec:baosub}). Instead, we want to find a $\bm{w}$, whose $\max_{\bm{y}}\mathcal{L}(\bm{w},\bm{y})$ is maximum. This translates to the optimization problem as Eq.~\ref{eq:opt2}. In fact, Eq.~\ref{eq:opt2} is a variant of setup in back-propagating through gradient ascent \citep{samuel2009learning,domke2012generic}. The difference is, our $\bm{w}$ also contributes directly to optimization target $\mathcal{L}(\bm{w},\bm{y})$. From this perspective, Eq.~\ref{eq:opt2} is more closely connected to \citet{kim2018semi}, if we treat $\bm{w}$ as the model parameter and $\bm{y}$ as latent. \begin{align} \bm{w}\leftarrow \arg \max_{\bm{w}} \mathcal{L}(\bm{w},\bm{y}^*(\bm{w}))\textrm{, where } \bm{y}^*(\bm{w})\leftarrow \arg\max_{\bm{y}} \mathcal{L}(\bm{w},\bm{y}) \label{eq:opt2} \end{align} And as SAVI on 1-level latent \citep{kim2018semi,marino2018iterative}, we need to solve Eq.~\ref{eq:opt2} using gradient ascent. Specifically, denote $\alpha$ as step size (learning rate), $K$ as the total gradient ascent steps, $\bm{w}^k$ as the $\bm{w}$ after $k$ step update, $\bm{y}^{k'}$ as the $\bm{y}$ after $k'$ step update, and $f(.)$ as FAVI procedure generating initial posterior parameters $\bm{w}^0,\bm{y}^0$, the optimization problem as Eq.~\ref{eq:opt2} translates into the update rule as Eq.~\ref{eq:opt2grad}. Eq.~\ref{eq:opt2grad} is the guidance for designing optimization algorithm, and it also explains why the gradient of BAO \citep{bao2022} is evaluated at wrong value (See Sec.~\ref{sec:ipde}). \begin{align} \bm{w}^{k+1}\leftarrow \bm{w}^{k}+\alpha\frac{d\mathcal{L}(\bm{w}^k,\bm{y}^{K})}{d\bm{w}^k}, \bm{y}^{k'+1}\leftarrow \bm{y}^{k'}+\alpha\frac{d\mathcal{L}(\bm{w}^k,\bm{y}^{k'})}{d\bm{y}^{k'}}\textrm{, where } \bm{y}^0 = f(\bm{x},\bm{w}^k)\label{eq:opt2grad} \end{align} To solve Eq.~\ref{eq:opt2grad}, we note that although $d\mathcal{L}(\bm{w}^k,\bm{y}^{k'})/d\bm{y}^{k'}$ is directly computed, $d\mathcal{L}(\bm{w}^k,\bm{y}^{K})/d\bm{w}^{k}$ is not straightforward. Resorting to previous works \citep{samuel2009learning,domke2012generic} in implicit differentiation and extending the results in \citet{kim2018semi} from model parameters to variational posterior parameters, we implement Eq.~\ref{eq:opt2grad} as Alg.~\ref{alg:solve-2}. Specifically, we first initialize $\bm{w}^0$ from FAVI. Then we conduct gradient ascent on $\bm{w}$ with gradient $d\mathcal{L}(\bm{w}^k,\bm{y}^K)/d\bm{w}^{k}$ computed from the procedure grad-2-level($\bm{x},\bm{w}^k$). And inside grad-2-level($\bm{x},\bm{w}^k$), $\bm{y}$ is also updated by gradient ascent, the above procedure corresponds to Eq.~\ref{eq:opt2grad}. The key of Alg.~\ref{alg:solve-2} is the evaluation of gradient $d\mathcal{L}(\bm{w}^k,\bm{y}^K)/d\bm{w}^{k}$. Formally, we have: \begin{theorem} \label{th:2l} After \textup{grad-2-level($\bm{x},\bm{w}^k$)} of Alg.~\ref{alg:solve-2} executes, we have the return value $d \mathcal{L}(\bm{w}^k,\bm{y}^K)/d\bm{w}^k=\overleftarrow{\bm{w}}$. (See proof in Appendix.~\ref{app:pf}.) \end{theorem} \subsection{SAVI on DAG-defined Non-factorized Latent} \label{sec:savidag} In this section, we extend the result from previous section to SAVI on general non-factorized latent with dependency described by any DAG. This DAG is the computational graph during network inference, and it is also the directed graphical model (DGM) \citep{koller2009probabilistic} defining the factorization of latent variables during inference. This is the general case covering all dependency that can be described by DGM. This extension is necessary to perform SAVI on latent with complicated dependency (e.g. bit allocation of NVC). Similar to the 2-level latent setup, we consider performing SAVI on $N$ variational posterior parameter $\bm{y}_1,...,\bm{y}_N$ with their dependency defined by a computational graph $\mathcal{G}$, i.e., their corresponding latent variable $\bmt{y}_1,...,\bmt{y}_N$'s posterior distribution factorizes as $\mathcal{G}$. Specifically, we denote $\bm{y}_j\in\mathcal{C}(\bm{y}_i),\bm{y}_i\in\mathcal{P}(\bm{y}_j)$ if an edge exists from $\bm{y}_i$ to $\bm{y}_j$. This indicates that $\bmt{y}_j$ conditions on $\bmt{y}_i$. Without loss of generality, we assume $\bm{y}_1,...,\bm{y}_N$ is sorted in topological order. This means that if $\bm{y}_j\in\mathcal{C}(\bm{y}_i),\bm{y}_i\in\mathcal{P}(\bm{y}_j)$, then $i<j$. Each latent is optimized by $K$-step gradient ascent, and $\bm{y}_i^{k_i}$ denotes the latent $\bm{y}_i$ after $k_i$ steps of update. Then, similar to 2-level latent, we have the update rule as Eq.~\ref{eq:optdaggrad}: \begin{align} \bm{y}^{k_i+1}_i\leftarrow \bm{y}^{k_i}_i+\alpha\frac{d\mathcal{L}(\bm{y}_1^{k_1},...,\bm{y}_i^{k_i},\bm{y}_{>i}^K)}{d\bm{y}^{k_i}}\textrm{, where }\bm{y}_{>i}^0 = f(\bm{x},\bm{y}_1^{k_1},...,\bm{y}_i^{k_i}) \label{eq:optdaggrad} \end{align} , which can be translated into Alg.~\ref{alg:solve-dag}. Specifically, we first sort the latent in topological order. Then, we add a fake latent $\bm{y}_0$ to the front of all $\bm{y}$s. Its children are all the $\bm{y}s$ with 0 in-degree. Then, we can solve the SAVI on $\bm{y}_1,...,\bm{y}_N$ using gradient ascent by executing the procedure grad-dag($\bm{x},\bm{y}_0^{k_0},...,\bm{y}_i^{k_i}$) in Alg.~\ref{alg:solve-dag} recursively. Inside procedure grad-dag($\bm{x},\bm{y}_0^{k_0},...,\bm{y}_i^{k_i}$), the gradient to update $\bm{y}_i$ relies on the convergence of its children $\bm{y}_{j}\in\mathcal{C}(\bm{y}_i)$, which is implemented by the recursive depth-first search (DFS) in line 11. And upon the completion of procedure grad-dag($\bm{x},\bm{y}_0^0$), all the latent converges to $\bm{y}_1^K,...,\bm{y}_N^K$. Similar to the 2-level latent case, the key of Alg.~\ref{alg:solve-dag} is the evaluation of gradient $d\mathcal{L}(\bm{y}_0^{k_0},...,\bm{y}_i^{k_i},\bm{y}_{>i}^K)/d \bm{y}_i^{k_i}$. Formally, we have: \begin{theorem} \label{th:dag} After the procedure \textup{grad-dag($\bm{x},\bm{y}_0^{k_0},...,\bm{y}_i^{k_i}$)} in Alg.~\ref{alg:solve-dag} executes, we have the return value $d\mathcal{L}(\bm{y}_0^{k_0},...,\bm{y}_i^{k_i},\bm{y}_{>i}^K)/d \bm{y}_i^{k_i}=\overleftarrow{\bm{y}_i}$. (See proof in Appendix.~\ref{app:pf}.) \end{theorem} To better understand how Alg.~\ref{alg:solve-dag} works, we provide a detailed example in Fig.~\ref{fig:eg} of Appendix.~\ref{app:eg}. \subsection{Correcting the Sub-optimal Bit Allocation using SAVI on DAG} \label{sec:savinvc} With the result in previous section, correcting BAO \citep{bao2022} seems to be trivial. We only need to sort the latent in topological order as $\bm{w}_1,\bm{y}_1,...,\bm{w}_T,\bm{y}_T$, and run Alg.~\ref{alg:solve-dag} to obtain the optimized latent parameters $\bm{w}_1^K,\bm{y}_1^K,...,\bm{w}_T^K,\bm{y}_T^K$. And the gradient $d\mathcal{L}(\bm{y}_0^{k_0},...,\bm{y}_i^{k_i},\bm{y}_{>i}^K)/d \bm{y}_i^{k_i}$ computed in Alg.~\ref{alg:solve-dag} resolves the issue of BAO described in Sec.~\ref{sec:itde} and Sec.~\ref{sec:ipde}. However, an evident problem is the temporal complexity. Given the latent number $N$ and gradient ascent step number $K$, Alg.~\ref{alg:solve-dag} has temporal complexity of $\Theta(K^N)$. NVC with GoP size $10$ has approximately $N=20$ latent, and the SAVI on NVC \citep{bao2022} takes around $K=2000$ step to converge. For bit allocation, the complexity of Alg.~\ref{alg:solve-dag} is $\approx 2000^{20}$, which is intractable. On the other hand, BAO's complexity is reasonable ($\Theta(KN)\approx4\times10^{4}$). Thus, in next section, we provide a feasible approximation to such intractable corrected bit allocation. \subsection{Feasible Approximation to the Corrected Bit Allocation} \label{sec:approx} In order to solve problem with practical size such as bit allocation on NVC, we provide an approximation to the SAVI \citep{kim2018semi,marino2018iterative} on DAG described in Sec.~\ref{sec:savidag}. The general idea is that, when being applied to bit allocation of NVC, the accurate SAVI on DAG (Alg.~\ref{alg:solve-dag}) satisfies both requirement on gradient signal described in Sec.~\ref{sec:itde} and Sec.~\ref{sec:ipde}. We can not make it tractable without breaking them. Thus, we break one of them and achieve a reasonable complexity, while maintain a superior performance compared with BAO \citep{bao2022}. We consider the approximation in Eq.~\ref{eq:approx} which breaks the requirement for gradient evaluation in Sec.~\ref{sec:ipde}. Based on Eq.~\ref{eq:approx} and the requirement in Sec.~\ref{sec:itde}, we design an approximation of accurate SAVI as Alg.~\ref{alg:solve-adag}. When being applied to bit allocation in NVC, it satisfies the gradient requirement in Sec.~\ref{sec:itde} while maintaining a temporal complexity of $\Theta(KN)$ as BAO. \begin{align} \frac{d\mathcal{L}(\bm{y}_0^{k_0},...,\bm{y}_i^{k_i},\bm{y}_{>i}^K)}{d \bm{y}_i^{k_i}}\approx\frac{d\mathcal{L}(\bm{y}_0^{k_0},...,\bm{y}_i^{k_i},\bm{y}_{>i}^0)}{d \bm{y}_i^{k_i}} \label{eq:approx} \end{align} Specifically, with the approximation in Eq.~\ref{eq:approx}, the recurrent gradient computation in Alg.~\ref{alg:solve-dag} becomes unnecessary as the right hand side of Eq.~\ref{eq:approx} does not require $\bm{y}_{>i}^K$. However, to maintain the dependency of latent described in Sec.~\ref{sec:itde}, as Alg.~\ref{alg:solve-dag}, we still need to ensure that the children node $\bm{y}_{j}\in \mathcal{C}(\bm{y}_i)$ are re-initialized by FAVI every-time when $\bm{y}_i$ is updated. Therefore, a reasonable approach is to traverse the graph in topological order. We keep the children node $\bm{y}_j$ untouched until all its parent node $\bm{y}_i\in\mathcal{P}(\bm{y}_j)$'s gradient ascent is completed and $\bm{y}_i^K$ is known. And the resulting approximate SAVI algorithm is as Alg.~\ref{alg:solve-adag}. When applied to bit allocation, it satisfies the gradient requirement in Sec.~\ref{sec:itde}, and as BAO, its temporal complexity is $\Theta(KN)$. \begin{minipage}[t]{.44\textwidth} % \vspace{0pt} \IncMargin{1.0em} \begin{algorithm}[H] \DontPrintSemicolon \caption{BAO on DAG Latent}\label{alg:solve-bao} \textbf{procedure} solve-bao($\bm{x}$)\; $\quad\bm{y}_1^0,...,\bm{y}_N^0\leftarrow f(\bm{x})$ from FAVI\; $\quad$\textbf{for} $k =0,...,K-1$ \textbf{do}\; $\quad\quad$ \textbf{for} $i=1,...,N$ \textbf{do}\; $\quad\quad\quad \bm{y}_i^{k+1}\leftarrow\bm{y}_i^k+\alpha\frac{\partial\mathcal{L}(\bm{y}_1^k,...,\bm{y}_N^k)}{\partial\bm{y}_i^k}$\; $\quad$\textbf{return} $y_1^K,...,y_N^K$\; \end{algorithm} \end{minipage} \begin{minipage}[t]{.55\textwidth} % \vspace{0pt} \IncMargin{1.0em} \begin{algorithm}[H] \DontPrintSemicolon \caption{Approximate SAVI on DAG latent}\label{alg:solve-adag} \textbf{procedure} solve-approx-dag($\bm{x}$)\; $\quad$sort $\bm{y}_1,...,\bm{y}_N$ in topological order\; $\quad$\textbf{for} $i=1,...,N$ \textbf{do}\; $\quad\quad \bm{y}_i^0,...,\bm{y}_N^0\leftarrow f(\bm{x},\bm{y}_{<i}^K)$ from FAVI\; $\quad\quad$ \textbf{for} $k=0,...,K-1$ \textbf{do}\; $\quad\quad\quad\frac{d\mathcal{L}(\bm{y}_{<i}^K,\bm{y}_i^k,\bm{y}_{>i}^K)}{d\bm{y}_i^k}\approx\frac{d\mathcal{L}(\bm{y}_{<i}^K,\bm{y}_i^k,\bm{y}_{>i}^0)}{d\bm{y}_i^k}$\; $\quad\quad\quad \bm{y}_i^{k+1}\leftarrow\bm{y}_i^k+\alpha\frac{d\mathcal{L}(\bm{y}_{<i}^K,\bm{y}_i^k,\bm{y}_{>i}^K)}{d\bm{y}_i^k}$\; $\quad$\textbf{return} $y_1^K,...,y_N^K$\; \end{algorithm} \end{minipage} % To better understand BAO \citep{bao2022} in SAVI context, we rewrite it by general SAVI notation instead of NVC notation in Alg.~\ref{alg:solve-bao}. We highlight the difference between BAO (Alg.~\ref{alg:solve-bao}) \citep{bao2022}, the accurate SAVI on DAG latent (Alg.~\ref{alg:solve-dag}) and the approximate SAVI on DAG latent (Alg.~\ref{alg:solve-adag}) from several aspects: \begin{itemize} \item \textbf{Graph Traversal Order}: BAO performs gradient ascent on $\bm{y}_{1:T}$ all together. The accurate SAVI only updates $\bm{y}_i$ when $\bm{y}_{>i}$'s update is complete and $\bm{y}_{>i}^K$ is known. The approximate SAVI only updates $\bm{y}_i$ when $\bm{y}_{<i}$'s update is complete and $\bm{y}_{<i}^K$ is known. \item \textbf{Gradient Correctness}: When being applied to bit allocation in NVC, BAO violates the gradient rule in Sec.~\ref{sec:itde} and Sec.~\ref{sec:ipde}, accurate SAVI satisfies both rules, approximate SAVI satisfies Sec.~\ref{sec:itde} and violates Sec.~\ref{sec:ipde}. \item \textbf{Temporal Complexity}: With the latent number $N$ and steps of gradient ascent $K$, the complexity of BAO is $\Theta(KN)$, the complexity of accurate SAVI is $\Theta(K^N)$ and the complexity of approximate SAVI is $\Theta(KN)$. \end{itemize} Then we can simply apply Alg.~\ref{alg:solve-adag} to bit allocation in NVC to obtain a feasible approximation of the corrected optimal bit allocation. And in Sec.~\ref{sec:rd}, we empirically show that our approximation improves the R-D performance over BAO \citep{bao2022} with even smaller number of updates. \section{Related Work: Bit Allocation \& SAVI for Neural Compression} \citet{li2022rate} are the pioneer of bit allocation for NVC and their work is elaborated in Sec.~\ref{sec:bgba}. Other recent works that consider bit allocation for NVC only adopt simple heuristic such as inserting $1$ high quality frame per $4$ frames \citep{hu2022coarse,cetin2022flexible}. On the other hand, OEU \citep{lu2020content} is also recognised as frame-level bit allocation while its performance is inferior than BAO \citep{bao2022}. BAO is the most recent work with best R-D performance. It is elaborated in Sec.~\ref{sec:bgba} and Sec.~\ref{sec:baosub}, and corrected in the previous section. Semi-Amortized Variational Inference (SAVI) is proposed by \citet{kim2018semi,marino2018iterative}. The idea is that works following \citet{kingma2013auto} use fully amortized inference parameter $\phi$ for all data, which leads to the amortization gap \citep{cremer2018inference}. SAVI reduces this gap by optimizing the variational posterior parameter after initializing it with inference network. It adopts back-propagating through gradient ascent \citep{domke2012generic} to evaluate the gradient of model parameters. We adopt a similar method to extend SAVI to non-factorized latent. When applying SAVI to practical neural codec, researchers abandon the nested model parameter update for efficiency. Prior works \citep{djelouah2019content,yang2020improving,zhao2021universal,ce2022} adopt SAVI to boost R-D performance and achieve variable bitrate in image compression. And BAO \citep{bao2022} is the first to consider SAVI for bit allocation. \section{Experiments} \subsection{Experimental Settings} We implement our approach in PyTorch 1.9 with CUDA 11.2, and run the experiments on NVIDIA(R) A100 GPU. Most of the other settings are intentionally kept the same as BAO \citep{bao2022}. Specifically, we adopt HEVC Common Testing Condition (CTC) \citep{bossen2013common} and UVG dataset \citep{mercat2020uvg}. And we measure the R-D performance in Bjontegaard-Bitrate (BD-BR) and BD-PSNR \citep{bjontegaard2001calculation}. For baseline NVC \citep{lu2019dvc,li2021deep}, we adopt the official pre-trained models. And we select target $\lambda_0=\{256,512,1024,2048\}$. For gradient ascent, we adopt Adam \citep{kingma2014adam} optimizer with $lr=1\times10^{-3}$. We set the gradient ascent step $K=2000$ for the first frame and $K=400$ for other frames. More details are presented in Appendix.~\ref{app:impl}. \subsection{Quantitative Results} \label{sec:rd} As shown in Tab.~\ref{tab:bdbr}, our method consistently improves the R-D performance in terms of BD-BR over BAO \citep{bao2022} on both baseline methods and all datasets. Moreover, this improvement is especially significant (more than 10\% in BD-BR) when the baseline is DCVC \citep{li2021deep}. And both BAO and our proposed correction significantly outperform other approaches. It is also noteworthy that with our bit allocation, DVC (the SOTA method in 2019) already outperforms DCVC (the SOTA method in 2021) by large margin (See the red solid line and black dash line in Fig.~\ref{fig:bdbrd}). \begin{minipage}{\textwidth} \vspace{7pt} \begin{minipage}[t]{0.7\textwidth} \vspace{0pt} \centering \begin{small} \begin{tabular}{@{}llllll@{}} \toprule & \multicolumn{5}{c}{BD-BR (\%) $\downarrow$} \\ \cmidrule(rr){2-6} Method & Class B & Class C & Class D & Class E & UVG \\ \midrule \multicolumn{3}{@{}l@{}}{\textit{DVC \citep{lu2019dvc} as Baseline} } & & & \\ \citet{li2016lambda}$^1$ & 20.21 & 17.13 & 13.71 & 10.32 & 16.69 \\ \citet{li2022rate}$^1$ & -6.80 & -2.96 & 0.48 & -6.85 & -4.12 \\ OEU \citep{lu2020content}$^2$ & -13.57 & -11.29 & -18.97 & -12.43 & -13.78 \\ BAO \citep{bao2022}$^2$ & -28.55 & -26.82 & -25.37 & -32.54 & -27.68 \\ Proposed & -32.10 & -31.71 & -35.86 & -32.93 & -30.92 \\ \midrule \multicolumn{3}{@{}l@{}}{\textit{DCVC \citep{li2021deep} as Baseline} } & & & \\ OEU \citep{lu2020content}$^2$ & -10.75 & -14.34 & -16.30 & -7.15 & -16.07 \\ BAO \citep{bao2022}$^2$ & -20.59 & -19.69 & -20.60 & -23.33 & -25.22 \\ Proposed & -32.89 & -33.10 & -32.01 & -36.88 & -39.66 \\\bottomrule \end{tabular} \end{small} \captionof{table}{The BD-BR of our approach compared with others. $^1$ comes from \citet{li2022rate}. $^2$ comes from \citet{bao2022}.} \label{tab:bdbr} \end{minipage} \hfill \begin{minipage}[t]{0.295\textwidth} \vspace{0pt} \centering \includegraphics[width=\textwidth]{fig_rd_d_small.PNG} \captionof{figure}{The R-D curve on HEVC Class D.} \label{fig:bdbrd} \end{minipage} \end{minipage} Other than R-D performance, the bitrate error of our approach is also significantly smaller than BAO \citep{bao2022} (See Tab.~\ref{tab:bderr}). The bitrate error is measured as the relative bitrate difference before and after bit allocation. The smaller it is, the easier it is to achieve the desired bitrate accurately. For complexity, our approach only performs $920$ steps of gradient ascent per-frame, while BAO requires $2000$ steps. See more quantitative results (BD-PSNR \& R-D curves) in Appendix.~\ref{app:quant}. \subsection{Ablation Study, Analysis \& Qualitative Results } Tab.~\ref{tab:abl} shows that for BAO \citep{bao2022}, jointly optimizing $\bm{w}_{1:T},\bm{y}_{1:T}$ performs worse than optimizing $\bm{y}_{1:T}$ or $\bm{w}_{1:T}$ alone. This counter-intuitive phenomena comes from its incorrect estimation of gradient signal. For the proposed approach that corrects this, jointly optimizing $\bm{w}_{1:T},\bm{y}_{1:T}$ performs better than optimizing $\bm{y}_{1:T}$ or $\bm{w}_{1:T}$ alone, which is aligned with our intuition. \begin{minipage}{\textwidth} \vspace{7pt} \begin{minipage}[t]{0.68\textwidth} \vspace{0pt} \centering \begin{small} \begin{tabular}{@{}llllll@{}} \toprule & \multicolumn{5}{c}{Bitrate-Error (\%) $\downarrow$} \\ \cmidrule(rr){2-6} Method & Class B & Class C & Class D & Class E & UVG \\ \midrule \multicolumn{3}{@{}l@{}}{\textit{DVC \citep{lu2019dvc} as Baseline} } & & & \\ BAO \citep{bao2022}$^2$ & 8.41 & 12.86 & 21.39 & 5.94 & 3.73 \\ Proposed & 3.16 & 4.27 & 1.81 & 6.14 & 1.73 \\ \midrule \multicolumn{3}{@{}l@{}}{\textit{DCVC \citep{li2021deep} as Baseline} } & & & \\ BAO \citep{bao2022}$^2$ & 25.67 & 23.90 & 23.74 & 24.88 & 21.86 \\ Proposed & 4.27 & 7.29 & 5.73 & 8.03 & 3.06 \\\bottomrule \end{tabular} \end{small} \captionof{table}{The bitrate error of our approach compared with BAO.} \label{tab:bderr} \end{minipage} \hfill \begin{minipage}[t]{0.30\textwidth} \vspace{0pt} \centering \begin{small} \begin{tabular}{@{}ll@{}} \toprule Method & BD-BR (\%) $\downarrow$\\ \midrule BAO ($\bm{y}$) & -25.37 \\ BAO ($\bm{w}$) & -22.24 \\ BAO ($\bm{y},\bm{w}$) & -14.76 \\ Proposed ($\bm{y}$) & -32.60 \\ Proposed ($\bm{w}$) & -31.56 \\ Proposed ($\bm{y},\bm{w}$) & -35.86 \\ \bottomrule \end{tabular} \end{small} \captionof{table}{Ablation study with HEVC Class D and DVC \citep{lu2019dvc}.} \label{tab:abl} \end{minipage} \end{minipage} To better understand why our method works, we present the R-D cost, distortion and rate versus frame/latent index for different methods in Fig.~\ref{fig:anamain}: \textit{top-left} shows that the R-D cost of our approach consistently decreases according to SAVI stage. Moreover, it outperforms BAO after $4^{th}$ frame; \textit{top-right} shows that for each frame the R-D cost of our method is lower than BAO; \textit{bottom-left} shows that the distortion part of R-D cost of our approach is approximately the same as BAO. While \textit{bottom-right} shows that the advantage of our approach over BAO lies in the bitrate. More specifically, BAO increases the bitrate of $\bm{y}_i$s after SAVI, while our correction decreases it. See more analysis in Appendix.~\ref{app:ana} and qualitative results in Appendix.~\ref{app:qual}. \begin{figure}[h] \centering \includegraphics[width=\linewidth]{fig_ana_main.PNG} \caption{\textit{top-left}. R-D cost vs. SAVI stage. \textit{top-right}. R-D cost vs. frame index. \textit{bottom-left}. PSNR vs. frame index. \textit{bottom-right}. bpp vs. latent index. See enlarged-version in Appendix.~\ref{app:ana}.} \label{fig:anamain} \end{figure} \section{Discussion \& Conclusion} Despite our correction is already more efficient than original BAO \citep{bao2022}, its encoding speed remains far from real-time. Thus, it is limited to scenarios where R-D performance matters much more than encoding time (e.g. video on demand). See more discussion in Appendix.~\ref{app:disc}. To conclude, we show that a previous bit allocation method for NVC is sub-optimal as it abuses SAVI on non-factorized latent. Then, we propose the correct SAVI on general non-factorized latent by back-propagating through gradient ascent, and we further propose a feasible approximation to make it practical for bit allocation. Experimental results show that our correction significantly improves the R-D performance. \subsubsection*{Ethics Statement} Improving the R-D performance of NVC has positive social value, in terms of reducing carbon emission by saving the resources required to transfer and store videos. Moreover, unlike traditional codecs such as H.266 \citep{bross2021developments}, neural video codec does not require dedicated hardware. Instead, it can be deployed with general neural accelerators. Improving the R-D performance of NVC prompts the practical deployment of video codecs that are independent of dedicated hardware, and lowers the hardware-barrier of playing multi-media contents. \subsubsection*{Reproducibility Statement} For theoretical results, both of the two theorems are followed by proof in Appendix.~\ref{app:pf}. For a relatively complicated novel algorithm (Alg.~\ref{alg:solve-dag}), we provide an illustration of the step by step execution procedure in Appendix.~\ref{app:eg}. For experiment, both of the two datasets are publicly accessible. In Appendix.~\ref{app:impl}, we provide more implementation details including all the hyper-parameters. Moreover, we provide our source code for reproducing the empirical results in supplementary material.
{'timestamp': '2022-09-30T02:08:11', 'yymm': '2209', 'arxiv_id': '2209.14575', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14575'}
arxiv
\section{Introduction} We consider the following sparse optimization problem: \begin{equation}\label{eq:optimizationproblem} (\text{P}): \quad \begin{array}{l} \min f(\mathbf{x},\Xi):=\frac{1}{N}\sum_{i=1}^{N}f^{(i)}(\mathbf{x}, \xi^{(i)}) \\ \text{s.t. } \mathbf{x} \in C_s \end{array} \end{equation} where $f^{(i)}: \mathbb{R}^n\times \Xi \rightarrow \mathbb{R}$ for $i=1,\dots, N$, $\Xi=\{\xi^{(1)}, \dots, \xi^{(N)}\}$, and $C_s=\{\mathbf{x} \in \mathbb{R}^n \mid \|\mathbf{x}\|_0 \leq s\}$ (sparsity constraint) is the union of finitely many subspaces whose dimension is less than or equal to the sparsity level $s$ such that $1 \leq s<n$. The importance of the Problem (P) is due to the fact that finding a sparse network whose accuracy is on a par with a dense network amounts to solving a bi-level, constrained, stochastic, nonconvex, and non-smooth sparse optimization problem \cite{damadi2022amenable}. Thus finding efficient algorithms that solve Problem (P) can be beneficial for addressing compression of deep neural networks. Among algorithms for solving sparse optimization the Iterative Hard Thresholding (IHT) algorithm has been a very successful one due to the simplicity of its implementation. The IHT algorithm not only has been practically efficient, but also shows theoretical promising results. It was originally devised for solving compressed sensing problems in 2008 \cite{blumensath2008iterative,blumensath2009iterative}. Since then, a large body of literature has been studying it from different perspectives. For example, \cite{beck2013sparsity,lu2014iterative, Lu2015OptimizationOS,pan2017convergent,zhou2021global} consider convergence of iterations, \cite{jain2014iterative, liu2020between} study the limit of the objective function value sequence, \cite{liu2017dual,zhu2018lagrange} address duality, \cite{zhou2020subspace, zhao2021lagrange} extend it to Newton's-type IHT, \cite{blumensath2012accelerated,khanna2018iht,vu2019accelerating,wu2020accelerated} address accelerated IHT, and \cite{wang2019fast, bahmani2013greedy} solve logistic regression problem using the IHT algorithm. Recently \cite{damadi2022gradient} introduced the concepts of HT-unstable stationary points (saddle points in the sense of sparse optimization) and showed the escapability property of the HT-unstable stationary points as one of the crucial properties of the IHT algorithm. Also, they showed Q-linearly convergence of the IHT algorithm towards strictly HT-stable stationary points. However, these desirable properties, requires to compute the batch (full) gradient at each iteration which is computationally expensive or impractical with current GPUs. On the other hand, almost all training for deep neural networks are done using the mini-batch stochastic gradient which is a combination of the stochastic approximation \cite{robbins1951stochastic} implemented by the backpropagation algorithm \cite{rumelhart1986learning}. By taking the mini-batch stochastic approximation, we consider solving Problem (P) using the mini-batch Stochastic Iterative Hard Thresholding algorithm outlined in Algorithm \ref{alg:siht}. Similar to practice where the mini-batch size is fixed beforehand, we fix the mini-batch size at the beginning which is different from previous work \cite{zhou2018efficient} in this area. Also, for showing our theoretical results we directly use the mini-batch stochastic gradient and derive our theoretical results which is different from previous works \cite{chen2016accelerated, li2016nonconvex} where the batch (full) gradient is used to show the theoretical results. As opposed to other works where restricted strong convexity is necessary for deriving convergence results \cite{liang2020effective, zhou2018efficient}, here the only assumption we make is the restricted strong smoothness on the objective function not on each individual one. Also, we assume that the objective function is a bounded below function which is the case for objective functions used in machine learning applications. Similar to practice where the mini-batch size is fixed beforehand, we fix the mini-batch size at the beginning which is different from previous works \cite{zhou2018efficient}. \subsection*{Summary of Contributions} By considering the mini-batch SIHT Algorithm \ref{alg:siht} for Problem (P), we develop the following results: \begin{itemize} \item We establish a new critical sparse stochastic gradient descent property of the hard thresholding (HT) operator that has not been found in the literature. \item For a given step-size $0 <\gamma < \frac{1}{L_s}$, we find a lower bound on the size of the mini-batch that guarantees the expected descent of the objective value function after hardthresholding. \item Using the sparse stochastic gradient descent property we show that the sequence generated by the mini-batch SIHT algorithm is supermartingale and converges with probability one. \item We show that for a certain class of functions in Problem (P) where $f(\mathbf{x},\xi^{i}):=f^{(i)}(\mathbf{V}_{i\bullet}\mathbf{x})$ $f^{(i)}: \mathbb{R}^n \rightarrow \mathbb{R}$, the sum of norm squared of individual gradients restricted to a set of some elements $\mathcal{J}$, i.e., $\sum_{i=1}^N \|\nabla_{\mathcal{J}} f^{(i)}\|_2^2$, evaluated at every point is proportionate to the norm of the batch gradient $\|\nabla_{\mathcal{J}} f\|_2^2$ where the proportionality constant only depends on the data. Moreover, dependency of the proportionality constant on the data is restricted to the set of $\mathcal{J}$ not the entire data. \end{itemize} \input{siht} \section{Related work} In order improve computational efficiency of the IHT algorithm, algorithms based on stochastic hard thresholding try to use the finite-sum structure of problem (P) \cite{nguyen2017linear, li2016nonconvex, shen2017tight}. The StoIHT algorithm is introduced in \cite{nguyen2017linear} where at each iteration a random element from the sum in Problem (P) is drawn and the associated gradient is calculated. Basically, the gradient is approximated by a mini-batch stochastic gradient with size one. The StoIHT algorithm defines a sparse subspace and then projects the updated vector into that. To show the theoretical results in \cite{nguyen2017linear}, the restricted strong smoothness condition for each individual function in Problem (P) is required as well as the restricted strong convexity for the objective function. In addition, the StoIHT algorithm needs the restricted condition number be to 4/3 which is hard to meet in practice. The stochastic variance reduced gradient hard thresholding (SVRG-HT) algorithm \cite{li2016nonconvex, shen2017tight} tries to mitigate the variance with a cost of calculating the (batch) full gradient at some stages. This information of the batch gradient is the key for reducing the variance. Similar to the StoIHT algorithm, the SVRG-HT algorithm requires the restricted strong smoothness condition for each individual function in Problem (P) as well as the restricted strong convexity for the objective function. The Accelerated Stochastic Block Coordinate Gradient Descent with Hard Thresholding (ASBCDHT) algorithm in \cite{chen2016accelerated} is a randomized version of the StoIHT algorithm which suffers the drawbacks of the StoIHT algorithm, i.e., calculating the full gradient and requirement of the restricted strong conditions. The Hybrid Stochastic Gradient Hard Thresholding (HSG-HT) algorithm in \cite{zhou2018efficient} is a variant of stochastic IHT algorithms that uses a mini-batch stochastic gradient at each step. However, from the theoretical perspective, the size of a mini-batch has to increase as the algorithm progresses. This makes the algorithm almost deterministic in calculating the gradient and defeats the purpose of using the mini-batch stochastic gradient. The stochastically controlled stochastic gradients (SCSG-HT) algorithm in \cite{liang2020effective} uses mini-batch stochastic gradients with large batch size as opposed to the SVRG-HT and the ASBCDHT algorithms to reduce the variance with less computation, i.e., not calculating the batch gradient at some steps. We present the mini-batch stochastic IHT algorithm and show that the stochastic sequence of the function value is a supermartingale sequence and it converges with probability one. To show our result, we assume the objective function has the restricted strong smoothness property and is bounded below which is the case for objective functions used machine learning applications. Also, to the best of our knowledge, in the regime of sparse optimization, this is the first time in the literature that it is shown that the sequence of the stochastic function values converges with probability one by fixing the mini-batch size for all steps. \section{Definitions} We provide some definitions that will be used throughout the paper. \begin{definition}[Restricted Strong Smoothness (RSS)]\label{def:rss} A differentiable function $f: \mathbb{R}^n \to \mathbb{R}$ is said to be restricted strongly smooth with modulus $L_s>0$ or is $L_s$-RSS if \begin{equation}\label{eq:rss} f(\mathbf{y}) \leq f(\mathbf{x}) + \langle \nabla f(\mathbf{x}) , \mathbf{y}-\mathbf{x} \rangle + \frac{L_{s}}{2}\|\mathbf{y}-\mathbf{x}\|_2^2 \quad \forall \mathbf{x},\mathbf{y} \in \mathbb{R}^n \text{ such that } \|\mathbf{x}\|_0 \leq s,\|\mathbf{y}\|_0\leq s. \end{equation} \end{definition} \begin{definition} [The HT operator] \label{def:hardthresholding} The HT operator $H_s(\cdot)$ denotes the orthogonal projection onto multiple subspaces of $\mathbb{R}^n$ with dimension $1 \leq s<n$, that is, \begin{equation}\label{eq:hardthreshold} H_s(\mathbf{x}) \in \arg\min_{\|\mathbf{z}\|_0\leq s }\|\mathbf{z}-\mathbf{x}\|_2. \end{equation} \end{definition} \begin{claim}\label{claim:tops} The HT operator keeps the $s$ largest entries of its input in absolute values. \end{claim} For a vector $\mathbf{x} \in \mathbb{R}^n$, $\mathcal{I}^{\mathbf{x}}_s \subset \{1,\dots, n\}$ denotes the set of indices corresponding to the first $s$ largest elements of $\mathbf{x}$ in absolute values. For example $H_2([1,-3,1]^{\top})$ is either $[0,-3,1]^{\top}$ or $[1,-3,0]^{\top}$ where $\mathcal{I}^{\mathbf{y}}_2=\{2,3\}$ and $\mathcal{I}^{\mathbf{y}}_2=\{1,2\}$, respectively. Therefore, the output of it may not be unique. This clearly shows why HTO is not a convex operator and why there is an inclusion in (\ref{eq:hardthreshold}) not an inequality. \begin{definition}[Convergence with probability one] A random sequence $(\mathbf{x}^k \in \mathbb{R}^n)$ in a sample space $\Omega$ converges to a random variable $\mathbf{x}^*$ with probability one if $$\mathbb{P}\Big[\omega \in \Omega: \displaystyle{\lim_{k \to \infty}}\|\mathbf{x}^k(\omega) - \mathbf{x}^*\|\Big]=0.$$ \end{definition} \section{Results} We consider solving Problem (\ref{eq:optimizationproblem}) using the mini-batch SIHT Algorithm \ref{alg:siht} and develop results that guarantee the convergence of the sequence of function values generated by the SIHT Algorithm. To do so, we present our results in two separate subsections. The first part provides stochastic results characterizing expectation of functions involving the sample average of given vectors. Then, in the subsequent subsection we use the aforementioned results to show Theorem \ref{theorem:stochasticdescent} which establishes a stochastic gradient result that is the foundation for the convergence of the function value sequence. \subsection{Stochastic results for sample average} In this subsection, we consider a sample average whose elements are drawn uniformly and without replacement. Then, we prove Lemma \ref{lemma:expectionofsampleaverage} that calculates the expected value of the norm squared of the sample average based on the covariance matrix of a random vector whose elements are Bernoulli random variable determining elements of the sample average. Next, in Corollary \ref{cor:distancetomean} using Lemma \ref{lemma:expectionofsampleaverage} we calculate the expected value of the squared distance between the sample average and the overall average. This result is extended in Theorem \ref{theorem:distancetoeach} where the expected value is calculated so that one is able to find the mentioned expectation based on each individual vector and the overall average. We start with the following well-known lemma. \begin{lemma}[\cite{mathai1992quadratic}]\label{lemma:randomquadratic} Let $\mathbf{\Lambda} \in \mathbb{R}^{n \times n}$ be a deterministic matrix and $\bm{\xi} \in \mathbb{R}^n$ be a random vector that is distributed according to some probability distribution $\mathcal{P}$. Then, \begin{equation}\label{eq:randomquadratic} \mathbb{E}_{\bm{\xi}}\Big[ \bm{\xi}^{\top} \mathbf{\Lambda} \bm{\xi} \Big] =\text{trace}(\mathbf{\Lambda} \text{Cov}(\bm{\xi})) + \mathbb{E}_{\bm{\xi}}^{\top}\Big[\bm{\xi}\Big]\mathbf{\Lambda} \mathbb{E}_{\bm{\xi}}\Big[\bm{\xi}\Big]. \end{equation} \end{lemma} To invoke the above lemma, notice that one can define a random vector whose elements are Bernoulli random variables determining whether the associated vector is in the sample average or not. Thus we prove the following lemma. \begin{lemma}\label{lemma:expectionofsampleaverage} Let $\mathbf{g}^{(1)}, \dots, \mathbf{g}^{(N)} \in \mathbb{R}^n$ be $N$ deterministic vectors and $\text{B} \subseteq \{1, \dots, N\}$ be a random set. Let $\bar{\mathbf{g}}:=\frac{1}{N}\sum_{i=1}^N \mathbf{g}^{(i)}$, $\mathcal{G}(\text{B}):=\frac{1}{|\text{B}|}\sum_{i \in \text{B}} \mathbf{g}^{(i)}$, $\mathbf{G}:=\Big[ \mathbf{g}^{(1)} \quad \dots \quad \mathbf{g}^{(N)} \Big] \in \mathbb{R}^{n \times N}$, and $\mathbf{z}(\text{B})=[z_1(\text{B}), \dots, z_N(\text{B})]^{\top}$ where $z_i(\text{B})$ is a Bernoulli random variable such that $z_i(\text{B})=1$ if $i \in \text{B}$ otherwise $z_i(\text{B})=0$ for $i=1, \dots, N$. Assume $\mathbb{E}_{\text{B}}\big[ \mathcal{G}(\text{B}) \big]=\bar{\mathbf{g}}$, then for any random set $\text{B}$ with fixed size $|\text{B}|$, the following holds: \begin{equation}\label{eq:expectionofsampleaverage} \mathbb{E}_{\text{B}}\big[ \| \mathcal{G}(\text{B})\|^2 \big] = \frac{1}{|\text{B}|^2}\text{trace}\Big(\mathbf{G}^{\top}\mathbf{G} \text{Cov}\big(Z(\text{B})\big)\Big) + \| \bar{\mathbf{g}}\|^2. \end{equation} \end{lemma} Once the above result is established, it is straightforward to show the following by observing the fact that the sample average is an unbiased estimator of the overall average, i.e., $\mathbb{E}_{\text{B}}\big[ \mathcal{G}(\text{B}) \big]=\bar{\mathbf{g}}$. \begin{corollary}\label{cor:distancetomean} Assume all the assumptions in Lemma \ref{cor:distancetomean} hold. Then for any random set $\text{B}$ with fixed size $|\text{B}|$, the following holds: \begin{equation}\label{eq:distancetomean} \mathbb{E}_{\text{B}}\big[ \| \mathcal{G}(\text{B}) - \bar{\mathbf{g}}\|^2 \big] = \frac{1}{|\text{B}|^2}\text{trace}\Big(\mathbf{G}^{\top}\mathbf{G} \text{Cov}\big(Z(\text{B})\big)\Big) \end{equation} \end{corollary} Finally, we use the above results to prove the following which calculates the expected squared distance between the sample average and the overall average based on individual vectors and the overall average. The following result is critical because later we will see that Equation (\ref{eq:distancetoeach}) connects the mini-batch stochastic gradient, the batch gradient, and individual gradients in Problem (P). \begin{theorem}\label{theorem:distancetoeach} Assume all the assumptions in Lemma \ref{cor:distancetomean} hold. If elements of the random set $\text{B}$ are drawn uniformly and without replacement, then \begin{equation}\label{eq:distancetoeach} \mathbb{E}_{\text{B}}\big[ \| \mathcal{G}(\text{B}) - \bar{\mathbf{g}}\|^2 \big] = \frac{N-|\text{B}|}{|\text{B}|N(N-1)} \Big( \sum_{i=1}^N \|\mathbf{g}^{(i)}\|_2^2 - N \|\bar{\mathbf{g}}\|^2\Big) = \frac{N-|\text{B}|}{|\text{B}|N} \frac{1}{N-1} \sum_{i=1}^N \|\mathbf{g}^{(i)}-\bar{\mathbf{g}}\|_2^2. \end{equation} \end{theorem} \subsection{Stochastic results for Hard Thresholding operator} The goal of this subsection is to show the random sequence $\big(f(\mathbf{x}^k)_{k \geq 1}\big)$ generated by the mini-batch SIHT algorithm converges with probability one. To show this we prove that the random sequence of the function value is a supermartingale sequence so the expected value of the function value sequence is decreasing. To achieve our goal, we prove the following lemma that provides an upper bound on the function value evaluated at a thresholded vector. Notice that the following result does not require the input be an updated vector by the gradient. \begin{lemma}\label{lemma:rsswithdelta} Let $f: \mathbb{R}^n \rightarrow \mathbb{R}$ be in $C^1$ and $L s$-RSS. Then for a fixed $\mathbf{x} \in C_s$ with any $\mathcal{I}_s^{\mathbf{x}}$, any $0 < \gamma \leq \frac{1}{L_s}$, and any given vector $\mathbf{g} \in \mathbb{R}^n$, either of the following holds for any $\mathbf{y} \in H_s(\mathbf{x}-\gamma \mathbf{g})$ with any $\mathcal{I}_s^{\mathbf{y}}$: \begin{equation} f(\mathbf{y}) \leq f(\mathbf{x}) - \frac{\gamma}{2}(1-L_s\gamma) \| \mathbf{g}_{\mathcal{I}_s^{\mathbf{y}}}\|^2_2 - \frac{\gamma}{2} \| \mathbf{g}_{\mathcal{I}_s^{\mathbf{x}} }\|^2_2 + \gamma \langle \mathbf{\delta}_{\mathcal{I}_s^{\mathbf{y}}}, \mathbf{g}_{\mathcal{I}_s^{\mathbf{y}}} \rangle + \gamma \langle \mathbf{\delta} _{\mathcal{I}\backslash \mathcal{I}_s^{\mathbf{y}}}, \mathbf{x}_{\mathcal{I}\backslash \mathcal{I}_s^{\mathbf{y}}} \rangle \label{eq:rsswithdeltaxandy} \end{equation} where $\mathcal{I} = \mathcal{I}_s^{\mathbf{x}} \cup \mathcal{I}_s^{\mathbf{y}}$ and $\mathbf{\delta}=\mathbf{g} - \nabla f(\mathbf{x})$. \end{lemma} Observe that in the above lemma the vector $\mathbf{g}$ can be any vector in $\mathbb{R}^n$. It need not be the gradient nor the mini-batch gradient. However, in the following lemma we prove that if $\mathbf{g}$ is designated to be an unbiased stochastic approximation of the gradient at an arbitrary point, then the following result holds. \begin{lemma}\label{lemma:unbiasedapproximation} Let $f: \mathbb{R}^n \rightarrow \mathbb{R}$ be in $C^1$ and $L s$-RSS. Assume $\mathbf{g}(\mathbf{x}, \omega)$ be an unbiased stochastic approximation of the gradient at $\mathbf{x} \in \mathbb{R}^n$ where $\omega \sim D$ for some distribution $D$, i.e., $\mathbb{E}_{\omega}[\mathbf{g}(\mathbf{x}, \omega)]=\nabla f(\mathbf{x})$. Then for a fixed $\mathbf{x} \in C_s$ with any $\mathcal{I}_s^{\mathbf{x}}$ and $0 < \gamma \leq \frac{1}{L_s}$, either of the following holds for any $\mathbf{y}(\omega) \in H_s(\mathbf{x}-\gamma \mathbf{g}(\mathbf{x}, \omega))$ with any $\mathcal{I}_s^{\mathbf{y}(\omega)}$: \begin{equation} \mathbb{E}_{\omega}[ f(\mathbb{Y}(\omega)) ] \leq f(\mathbf{x}) - \frac{\gamma}{2}(1-L_s\gamma) \mathbb{E}_{\omega}[ \| \mathbf{g}_{\mathcal{I}_s^{\mathbb{Y}(\omega)}}(\mathbf{x}, \omega)\|^2_2 ] - \frac{\gamma}{2} \| \nabla_{\mathcal{I}_s^{\mathbf{x}}} f(\mathbf{x})\|^2_2 + \gamma \mathbb{E}_{\omega}[ \|\mathbf{\delta}_{\mathcal{I}_s^{\mathbb{Y}(\omega)}}(\omega)\|_2^2 ] \label{eq:unbiasedwithxandy} \end{equation} where $\mathcal{I}(\omega) = \mathcal{I}_s^{\mathbf{x}} \cup \mathcal{I}_s^{\mathbb{Y}(\omega)}$ and $\mathbf{\delta}(\omega)=\mathbf{g}(\mathbf{x}, \omega) - \nabla f(\mathbf{x})$. \end{lemma} The following Theorem is the climax of our technical results because it establishes a stochastic gradient descent property for the expectation of the function value. Later we will see how Inequality (\ref{eq:generalminibatch}) is used in Theorem \ref{theorem:stochasticdescent} to show the sequence of the function values generated by the mini-batch SIHT is a supermartingale sequence. \begin{theorem}\label{theorem:sparseminibatch} Let $f^{(i)}: \mathbb{R}^n\times \Xi \rightarrow \mathbb{R}$ be in $C^1$ \footnote{The class consisting of all differentiable functions whose derivative is continuous.} for $i=1,\dots, N$ and $\Xi=\{\xi^{(1)}, \dots, \xi^{(N)}\}$ be a given set such that $f(\mathbf{x},\Xi)=\frac{1}{N}\sum_{i=1}^{N}f^{(i)}(\mathbf{x}, \xi^{(i)})$ be an $L_s$-RSS function. Assume there exists a $c>0$ \footnote{In Remark \ref{remark:1}, we explain why such a $c$ always exist for widespread objective functions in machine learning applications} such that \begin{equation}\label{eq:expectationindividualvsgradient} \mathbb{E}_{\mathcal{J}} \Big [\sum_{i=1}^N \|\nabla_{\mathcal{J}} f^{(i)}(\mathbf{x}, \xi^{(i)})\|_2^2 \Big ]\leq c \mathbb{E}_{\mathcal{J}} \Big [\|\nabla_{\mathcal{J}} f(\mathbf{x},\Xi)\|_2^2 \Big ] \end{equation} for all $\mathbf{x} \in \mathbb{R}^n$ and any random index set $\mathcal{J} \subseteq \{1, \dots, n\}$ with $|\mathcal{J}| \leq s$. Let $\mathcal{G}(\mathbf{x}, \Xi, B)=\frac{1}{|B|}\sum_{i \in B}\nabla f^{(i)}(\mathbf{x},\xi^{(i)})$ be the mini-batch stochastic gradient at any $\mathbf{x}\in \mathbb{R}^n$ where $B \subseteq \{1, \dots, N\}$ be a random set whose elements are drawn randomly and uniformly from $\{1, \dots, N\}$ without replacement and its size is $|B|$. For a fixed $0<\gamma < \frac{1}{L_s}$, assume the size of $B$ is fixed such that $|B| \geq N/\Big(1+\frac{1-L_s\gamma}{1+L_s\gamma}\frac{N-1}{\frac{c}{N}-1}\Big)$ and let $\zeta := \frac{N-|\text{B}|}{|B|(N-1)}$ for $N \geq 2$. Then for a fixed $\mathbf{x} \in C_s$ with any $\mathcal{I}_s^{\mathbf{x}}$ the following holds for any $\mathbb{Y}(B) \in H_s(\mathbf{x}-\gamma \mathbf{g}(\mathbf{x}, \Xi, B))$ with any $\mathcal{I}_s^{\mathbb{Y}(B)}$: \begin{equation}\label{eq:generalminibatch} \begin{aligned} \mathbb{E}_{B} \Big [ f(\mathbb{Y}(B),\Xi) \Big ] &\leq f(\mathbf{x}, \Xi) - \frac{\gamma}{2} \| \nabla_{\mathcal{I}_s^{\mathbf{x}}} f(\mathbf{x})\|^2_2 \\ &- \frac{\gamma}{2}(1+L_s\gamma)\zeta \Big( 1- \frac{c}{N} +\frac{1-L_s\gamma}{1+L_s\gamma}\frac{1}{\zeta} \Big) \mathbb{E}_{\mathcal{I}_s^{\mathbb{Y}(B)}}\Big[ \|\nabla_{\mathcal{I}_s^{\mathbb{Y}(B)}} f(\mathbf{x}, \Xi)\|^2 \Big] \end{aligned} \end{equation} where $1- \frac{c}{N} +\frac{1-L_s\gamma}{1+L_s\gamma}\frac{1}{\zeta} \geq 0$. \end{theorem} A crucial assumption for proving the results in Theorem (\ref{eq:generalminibatch}) is the assumption made in Inequality (\ref{eq:expectationindividualvsgradient}). In the following Claim we show that for a certain class of functions $c>0$ always exists and it does not depend on the function. We will prove that for these special classes of functions the value of $c$ only depends on the data. \begin{claim}\label{claim:individualvsgradient} Let the given set $\Xi$ in Problem (P) be defined such that $\Xi:=\{\mathbf{V}_{1\bullet}, \dots, \mathbf{V}_{N\bullet}\}$ where each $\mathbf{V}_{i\bullet}$ is the $i$-th row of a given matrix $\mathbf{V} \in \mathbb{R}^{N \times n}$. Then the objective function in Problem (P) can be defined as $f(\mathbf{x},\Xi):=\frac{1}{N}\sum_{i=1}^{N}f^{(i)}(\mathbf{V}_{i\bullet}\mathbf{x})$ $f^{(i)}: \mathbb{R}^n\times \Xi \rightarrow \mathbb{R}$ and the following holds: \begin{equation}\label{eq:individualvsgradient} \sum_{i=1}^N \|\nabla_{\mathcal{J}} f^{(i)}(\mathbf{V}_{i\bullet}\mathbf{x})\|_2^2 \leq \frac{N^2}{ \sigma_{min}^2(\mathbf{V}\mathbf{I}^{\top}_{\mathcal{J}\bullet}\mathbf{I}_{\mathcal{J}\bullet}\mathbf{V}^{\top}) } \Big( \max_{r=1, \dots, N} \Big\{ \|(\mathbf{V}_{r\bullet}^{\top})_{\mathcal{J}}\|_2^2 \Big\} \Big) \| \nabla_{\mathcal{J}} f(\mathbf{x},\mathbf{V})\|_2^2 \end{equation} where $\mathcal{J} \subseteq \{1, \dots, n\}$ with $|\mathcal{J}| \leq s$, $\mathbf{I}_{\mathcal{J}\bullet} \in \mathbb{R}^{|\mathcal{J}| \times n}$ is a restriction of the Identity matrix whose rows are associated with indices in $\mathcal{J}$, $\mathbf{V}\mathbf{I}^{\top}_{\mathcal{J}\bullet}\mathbf{I}_{\mathcal{J}\bullet}=\sum_{i=1}^{|\mathcal{J}|} \mathbf{V}_{\bullet i}\mathbf{V}_{\bullet i}^{\top}$, $\sigma_{min}(\cdot)$ is the smallest singular value, $\mathbf{V}_{\bullet i}$ is the $i$-th column of $\mathbf{V}$, and $(\cdot)\mathcal{J}$ is a vector restricted to indices in $\mathcal{J}$. \end{claim} \begin{remark}\label{remark:1} The above claim shows that for a class of functions $f(\mathbf{x},\Xi):=\frac{1}{N}\sum_{i=1}^{N}f^{(i)}(\mathbf{V}_{i\bullet}\mathbf{x})$ the constant $c>0$ in Theorem \ref{theorem:stochasticdescent} always exists and it does not depend on the value of $\mathbf{x}$ or its gradient whether it is batch (full) gradient or individual one. For an example of functions belonging to this class one can think of the mean square error loss used for linear regression as follows: $$ f(\mathbf{x}, \mathbf{V})=\frac{1}{N}\|\mathbf{V}\mathbf{x}-\mathbf{y}\|^2=\frac{1}{N}\sum_{i=1}^N(\mathbf{V}_{i\bullet}\mathbf{x}-y_i)^2 $$ where $\mathbf{V} \in \mathbb{R}^{N\times n}$, $\mathbf{V}_{i\bullet}$ is the $i$-th row of $\mathbf{V}$, $\mathbf{x} \in \mathbb{R}^n$ is the optimization variable, and $\mathbf{y} \in \mathbb{R}^N$ is the target. Also, the logistic regression loss (binary cross entropy) is a function for which $c>0$ in Inequality (\ref{eq:individualvsgradient}) always exists since it can be written as follows: $$ f(\mathbf{x}, \mathbf{V})=\frac{1}{N} \sum_{i=1}^{N}\Big( -y^{(i)}(\mathbf{V}_{i\bullet}\mathbf{x})+\log\big(1+e^{\mathbf{V}_{i\bullet}\mathbf{x}}\big)\Big) $$ where $\mathbf{V} \in \mathbb{R}^{N\times n}$ whose last column is all one, $\mathbf{V}_{i\bullet}$ is the $i$-th row of $\mathbf{V}$, $\mathbb{R}^n\ni \mathbf{x}=[\mathbf{w}, b]^{\top}$ such that $\mathbf{w} \in \mathbb{R}^{n-1}$ and $b \in \mathbb{R}$ are the optimization variables, and $y^{(i)} \in \{0, 1\}$ for $i=1, \dots, N$. \end{remark} Now we can provide a result showing that by fixing a sparse point, one can use the stochastic mini-batch gradient with a fixed mini-batch size determined in Theorem \ref{theorem:stochasticdescent} and decrease the function value in expectation. \begin{theorem}\label{theorem:stochasticdescent} Assume all the assumptions in Theorem \ref{theorem:sparseminibatch} hold. Then for a fixed $\mathbf{x} \in C_s$ with any $\mathcal{I}_s^{\mathbf{x}}$ the following holds for any $\mathbb{Y}(B) \in H_s(\mathbf{x}-\gamma \mathcal{G}(\mathbf{x}, \Xi, B))$: \begin{equation}\label{eq:generalminibatchwithx} \mathbb{E}_{B} \Big [ f(\mathbb{Y}(B),\Xi) \bigg\vert \mathbf{x} \Big ] \leq f(\mathbf{x}, \Xi) - \frac{\gamma}{2} \| \nabla_{\mathcal{I}_s^{\mathbf{x}}} f(\mathbf{x})\|^2_2 . \end{equation} \end{theorem} The above result is the analogue result to \cite[Corollary 1]{damadi2022gradient}. \begin{theorem}\label{theorem:functionconvergence} Assume all the assumptions in Theorem \ref{theorem:sparseminibatch} hold. Let $f$ be a bounded below differential function and $\big(\mathbb{X}^k \bigg\vert \mathbb{X}^{k-1})_{k\geq 0}$ be the stochastic IHT sequence. Then, $\Big(f(\mathbb{X}^{k}, \Xi, B) \bigg\vert \mathbb{X}^{k} \Big)_{k\geq 1}$ is a supermartingale sequence and converges to a random variable $f^*$ with probability one. \end{theorem} \section{Conclusion} We showed the stochastic sequence generated by the mini-batch stochastic IHT is a supermartingale sequence converging with probability one. To show this result we used the stochastic gradient descent property that we derived where we utilized the property of the mini-batch stochastic gradient as the sample sum of a finite sum. \newpage
{'timestamp': '2022-09-30T02:07:13', 'yymm': '2209', 'arxiv_id': '2209.14536', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14536'}
arxiv
\section{Introduction} Real-time object detection algorithms are getting a lot of attention in academia and industry for the broad set of applications that employ them, including autonomous driving and factory automation~\cite{its1,its5,its6,its7,its8}. Among those algorithms, the multi-object detection algorithm is widely used. The fundamental ideas of the algorithm mentioned above consist of two procedures; (i) \textit{bounding box} and \textit{confidence} are used for determining whether objects exist or not; then (ii) the concept of \textit{class probability map} is used for the classification of the detected objects~\cite{yolo}. The multi-object detection algorithms are based on convolutional neural networks (CNN). Nowadays, sophisticated algorithms are proposed to improve the accuracy of the network, such as YOLOv4 and DyHead~\cite{ YOLOv4, DyHead}. However, there is a tradeoff between inference time and accuracy. The object detection algorithm with many convolution layers performs better than others while increasing the computation time. In contrast, the simple network that requires less computation is suitable for real-time object detection applications while sacrificing specific detection accuracy. For autonomous driving applications, the major learning-based system research topic, it is necessary to ensure the system can use and relate to the driving environment. The driver can record the environment in a real-time video composed of continuous image arrivals. To use the continuous image arrivals, \textit{optical flow} is one of the best ways to model and process sequential continuous image arrivals~\cite{opticalflow}. There are two types of optical flow; (i) One is a sparse optical flow that presents a partial motion of pixels. (ii) The other is a dense optical flow that indicates the full motion of pixels. Dense optical flow has higher accuracy than sparse optical flow, while the speed is lower. In the recent decade, the neural network application on calculating dense optical flow (\textit{e.g.}, FlowNet) emerges to obtain a dense flow map with guarantying high accuracy and low speed~\cite{flownet}. This network is a CNN-based neural network that receives two consecutive images of a video as an input and returns the information of pixel displacement as an output. The optical flow estimation networks (OFEN), similar to object detection, have a tradeoff between the computation time (\textit{i.e.}, delay) and accuracy. Motivated by the \textit{``continuity"} property of videos in the object detection research domain, this paper investigates object detection and optical flow consolidation for the driving environment. As shown in Fig.~\ref{fig:flo_description}(a)--(c), we empirically find that leveraging optical flow can be a solution for improving the existing object detection networks (ODN). However, applying an optical flow on object detection directly is challenging due to following reasons. First, the driving environment is generally uncertain, \textit{e.g.}, the vehicle can be unexpectedly driving or stopping. Second, the driver state is time-varying. If the observer is static, the moving object is detected by optical flow. On the other hand, and according to Fig. \ref{fig:flo_description}(c), \textit{i.e.}, if the observer is moving, the moving objects may appear static when moving in the same direction. Additionally, we consider the computing capacities corresponding to object detection in the driving environment. The received images are time-varying. Thus, the number of objects in the changes every moment. However, the number of objects is proportional to the inference time of an object detection network~\cite{num_object}. In light of the issues above, we propose a novel real-time object detection model called \textit{Hybrid} by leveraging optical flow. Then, we design a self-configurable stabilized framework with Lyapunov optimization considering computational overheads \cite{book2010sno}. Our framework aims to guarantee time-average object detection performance maximization by deciding whether to use optical flow considering computation time (delay) based on the driving environment. \BfPara{Contributions} The key contributions of the proposed algorithm in this paper are as follows. \begin{itemize} \item We first propose a fusion of object detection and optical flow. We further suggest a novel flow map processing algorithm (see \textbf{Algorithm~\ref{alg:confidencemask}}), which is suitable for a time-varying driving environment. \item We propose a novel self-configurable framework for autonomous driving. Our architecture provides a time-average sequential optimal decision-making under the tradeoff between performance and delay. Furthermore, one of the main advantages of the Lyapunov optimization-based algorithm is low-complexity operation (see \textbf{Algorithm~\ref{alg:dpp2}}). Thus, our proposed algorithm is suitable for real-time computation in a fast-moving autonomous driving environment. \end{itemize} \BfPara{Organization} The rest of this paper is organized as follows. Sec.~\ref{sec:2} proposes a stabilized real-time object detection adaptation algorithm for autonomous driving. Sec.~\ref{sec:3} evaluates the performance of the proposed algorithm. Sec.~\ref{sec:4} concludes this paper and presents future research directions. The notations used in this paper are listed in Table~\ref{tab:notation}. \begin{figure}[t!] \centering \setlength{\tabcolsep}{2pt} \renewcommand{\arraystretch}{0.2} \begin{tabular}{cc} \includegraphics[page=1, width=0.45\linewidth]{fig1a.png} & \includegraphics[page=1, width=0.45\linewidth]{fig1b.png} \tabularnewline \tabularnewline \footnotesize (a) Input image & \footnotesize (b) Dense optical flow field \tabularnewline \tabularnewline \includegraphics[page=1, width=0.45\linewidth]{fig1c.png} & \includegraphics[page=1, width=0.45\linewidth]{fig1d.png} \tabularnewline \tabularnewline \footnotesize (c) Flow map & \footnotesize (d) The processed flow map \textbf{(Ours)} \end{tabular} \footnotesize \caption{A snapshot of optical flow in an actual driving environment.} \label{fig:flo_description} \end{figure} \begin{table}[t!] \caption{List of Notations} \label{tab:notation} \centering \footnotesize \begin{tabular}{c|l} \toprule[1pt] \textbf{Symbol} & \textbf{Description}\\\midrule[1pt] $K$ & The number of bounding boxes.\\ $\mathbf{F}_{M,N}$ & $M \times N$-sized flow map.\\ $\mathbf{B}_{M,N,K}$ & $K$ bounding boxes of size $M \times N$.\\ $Q$ & A queue-backlog.\\ $a[t]$ & An arrival process at time $t$.\\ $H$ & A hybrid model leveraging optical flow.\\ $T$ & An object detection model.\\ $\alpha[t]$ & A detection model, $\forall \alpha[t] \in \mathcal{A} \equiv \{H,T\}$.\\ $b(\alpha[t])$ & A service process with $\alpha[t]$ at time $t$.\\ $P(\alpha[t])$ & The object detection accuracy.\\ \bottomrule[1pt] \end{tabular} \end{table} \begin{figure*}[t!] \includegraphics[width=1.0\linewidth]{fig2.pdf} \caption{The system model consists of two components, \textit{i.e.}, (1) \textit{Hybrid model}, which utilizes optical flow estimation in object detection model, and (2) \textit{Model selection} which is based on Lyapunov optimization. Our proposed method determines whether the model uses optical flow estimation and flow map processing or not.} \label{fig:systemmodel} \end{figure*} \section{Stabilized Real-Time Object Detection for Autonomous Driving Applications}\label{sec:2} This section introduces our proposed stabilized real-time object detection for autonomous driving, consisting of two parts, \textit{i.e.,} the Hybrid model in Sec.~\ref{sec:2-1} and model selection in Sec.~\ref{sec:2-2}. Fig.~\ref{fig:systemmodel} briefly illustrates our proposed framework. \subsection{Hybrid Model}\label{sec:2-1} \subsubsection{Object Detection \& Optical Flow Estimation in the Nutshell} We present the object detection and optical flow estimation in the nutshell. ODN takes an image as an input and returns bounding boxes $\mathbf{B}_{M,N,K}$ where the component represents confidence score $c_{i,j,k} \in [0, 1]$: $\forall i \in \mathbb{N}[1,M]$, $\forall j \in \mathbb{N}[1,N]$, $\forall k \in \mathbb{N}[1,K]$. Among all bounding boxes, the highest scored bounding box of which the confidence score exceeds the confidence threshold, is regarded as the object detected~\cite{yolo}. As shown in Fig.~\ref{fig:flo_description}(a), the dense optical flow field is obtained by calculating pixel displacement of two consecutive images via OFEN. As shown in Fig.~\ref{fig:flo_description}(b), The flow map $\mathbf{F}_{M, N}$ indicates the magnitude of dense optical flow field, which is a matrix with the size of $ M \times N $ written as follows: \begin{equation} \mathbf{F}_{M,N} = \begin{pmatrix} e_{1,1} & e_{1,2} & \cdots & e_{1,N} \\ \vdots & \vdots & \ddots & \vdots \\ e_{M,1} & e_{M,2} & \cdots & e_{M,N} \end{pmatrix}, \end{equation} where $e_{i,j}$ stands for the magnitude of pixel motion of position $(i,j)$. Note that each element $e_{i,j}$ has a real value where $\forall e_{i,j} \in (-\infty, + \infty)$: $\forall i \in \mathbb{N}[1, M]$ and $\forall j \in \mathbb{N}[1, N]$. \subsubsection{Observation from Optical Flow According to Fig.~\ref{fig:flo_description}(c), the flow map has a linear increase/decrease pattern in each object (\textit{e.g.,} car or truck) and its background. Our initial insight is that if flow map and confidence are used as an additional condition for determining the existence of an object, we will be able to perform better than the \textit{de facto} ODN. Suppose that the confidence value of ODN is small, but there is an object detected in the flow map. If so, lowering the confidence threshold for the cell makes it possible to detect objects that ODN cannot detect. To enhance the performance of ODN, we design \textit{Hybrid}, which is the combination of optical flow and object detection. We elaborate on utilizing flow map into object detection next. \subsubsection{Flow Map Processing} This subsection introduces the flow map processing algorithm to apply the Hybrid to the road driving environment. All elements of $\mathbf{F}_{M,N}$ are in $(-\infty, + \infty)$, thus $\mathbf{F}_{M,N}$ should be min-max normalized. \begin{equation} \label{eq:normalize} \mathbf{F}_{M,N} \leftarrow \{ \mathbf{F}_{M,N} - e_{\min}\cdot\textbf{1}_{M,N} \}, \end{equation} where $\textbf{1}_{M,N}$ stands for $M\times N$-sized matrix of ones, and $e_{\min}$ denotes the minimum value of $\forall e_{i,j}$. The closer the values at both ends, \textit{i.e.}, $e_{\max}, e_{\min}$, the more dynamic pixel information is present, and the central value is static pixel information. As $e_{i,j}$ approaches the maximum value of $\mathbf{F}_{M,N}$, $e_{\max}$, or the minimum of $\mathbf{F}_{M,N}$, $e_{\min}$, dynamic pixel information exists. As it approaches the median value of $\mathbf{F}_{M,N}$, $e_{\mathrm{median}}$, static pixel information exists. This behavior is expressed as follows: \begin{equation} \label{eq:normalize2} \mathbf{F}_{M,N} \leftarrow |\mathbf{F}_{M,N} - e_{\mathrm{median}} \cdot\textbf{1}_{M,N} | \end{equation} After this procedure, the information of the moving pixel comes out closer to $e_{\max}$, and the information of the static pixel comes out closer to $e_{\min}$. Since the purpose of this algorithm is to consider only the moving pixel information, we present the process of removing the static pixel information; \begin{eqnarray} \mathbf{F}_{M,N} &\leftarrow& \frac{1}{1+\mathrm{exp}(-\mathbf{F}_{M,N})}. \label{eq:classify} \end{eqnarray} Then, flatten $\mathbf{F}_{M,N}$ to $\mathbf{f}_{MN}$, and duplicate $\mathbf{f_{MN}}$ as much as the number of bounding boxes $K$. Eventually, the vectorized flow map denoted as $\mathbf{f}_{MNK}$, is applied to the confidence threshold as follows: \begin{equation} \label{eq:vectorized_cth} \textbf{c}_{th} = \frac{c_{th} }{1+\mathrm{exp}\left(2\cdot \mathbf{f}_{MNK} \right)} \end{equation} where $\textbf{c}_{th}$, and $c_{th}$ stand for the vectorized confidence threshold, and the scalar confidence threshold, respectively. Finally, leveraging $\textbf{c}_{th}$ as a criterion for object detection, ODN utilizes optical flow. \begin{algorithm}[t!] \caption{Flow Map Processing} \label{alg:confidencemask} \small \begin{algorithmic}[1] \Statex $\hspace{-1.5em}\textbf{Input:}$ $\mathbf{F}_{M,N}$ // $M \times N$ flow map matrix \Statex $\hspace{-1.5em}\textbf{Output:}$ $\textbf{c}_{th}$ // ${M \times N \times K}$-sized confidence threshold vector \For{$\forall e_{i,j}$ in $\mathbf{F}_{M,N}$} \State $e_{i,j} \leftarrow e_{i,j}-\min(\mathbf{F}_{M,N})$; \EndFor \For{$\forall e_{i,j}$ in $\mathbf{F}_{M,N}$} \State $e_{i,j} \leftarrow |e_{i,j}-\textsf{median}(\mathbf{F}_{M,N})|$; \EndFor \For{$\forall e_{i,j}$ in $\mathbf{F}_{M,N}$} \State $e_{i,j} \leftarrow \textsf{sigmoid}(e_{i,j})$; // Equation 4 \EndFor \State Flatten $\mathbf{F}_{M,N}$ into vector $\mathbf{f}_{MN}$; \State Replicate $\mathbf{f}_{MN}$ $K$ times, then make $\mathbf{f}_{MNK}$; \State $\textbf{c}_{th} \leftarrow \frac{c_{th}}{1+\mathrm{exp} (2 \cdot \mathbf{f}_{MNK})}$; \end{algorithmic} \end{algorithm} The pseudo-code of the proposed flow map processing algorithm is presented in \textbf{Algorithm~\ref{alg:confidencemask}}. From (line 1) to (line 3), the elements of flow map $\mathbf{F}_{M,N}$ are normalized. From (line 4) to (line 9), the component of the static object in $\mathbf{F}_{M,N}$ is diminished. In (line 10), $\mathbf{F}_{M,N}$ is scaled to $\mathbf{F}_{S,S}$ using the bicubic interpolation~\cite{bicubic}. From (line 11) to (line 12), the processed flow is converted to the same size as the output size of YOLOv3-tiny. From (line 13) to (line 14), the process of making vectorized confidence threshold $\textbf{c}_{th}$ is expressed using \eqref{eq:vectorized_cth}. The computational complexity of \textbf{Algorithm~\ref{alg:confidencemask}} is $O(MN)$ for flow map with the size $M\times N$. \subsection{Lyapunov Optimization-based Model Selection}\label{sec:2-2} In the driving environment, a driving state and a stationary state exist. If the optical flow is used while driving, a Hybrid can improve the performance. However, when the optical flow is used in the stationary state, the pixel displacement does not exist, and the time to calculate it is wasted. Also, in the case of many objects, for example, there is the possibility of being pushed out in real-time suitability because the computation amount increases proportionally. In other words, Hybrid and ODN have a tradeoff between the computation time (\textit{i.e.}, delay) and object detection accuracy. Therefore, the Lyapunov optimization framework is designed to increase the system's stability by observing the queues and performance of the two networks and making the right decision. \subsubsection{Lyapunov Optimization Framework} This section introduces our proposed Lyapunov optimization framework, aiming at time-average detection performance maximization subject to system stability. We can design a time-average optimization framework considering stability by stabilizing the drift. In this case, and according to the Lyapunov optimization framework, the delay can be modeled by queue, where Lyapunov drifts can then again model the queue dynamics. By observing the queue-backlog and performance of every frame, the framework can use the Lyapunov optimization to select the next step deep learning object detection model, which is a sequential time-average optimal decision-making. The queue dynamics in the system $Q[t]$ are characterized as follows: \begin{equation} Q[t+1] \triangleq \max\{Q[t]+a[t]-b(\alpha[t]),0\}, \label{eq:queue} \end{equation} where $Q[t]$ is a queue-backlog size at time $t$ where $Q[0] = 0$ and $a[t]$ is an arrival process at $Q[t]$ at $t$. This arrival process is the received video streams in the system (i.i.d. random events). In \eqref{eq:queue}, $b(\alpha[t])$ is a service process at $Q[t]$ when our model selection decision is $\alpha[t]$ at $t$. With the Hybrid, the processing of $Q[t]$ will be relatively smaller compared to the case where ODN is used. The computational cost for ODN and Hybrid is used as the weights, as follows: \begin{equation} b(\alpha [t])= \begin{cases} w_1 , & \mbox{if }\alpha[t]=H \\ w_2 , & \mbox{if }\alpha[t]=T \end{cases}, \end{equation} where $H$ stands for the Hybrid and $T$ stands for ODN, respectively. Here, $a[t]$ is modeled as the ratio of fps per cycle to default fps: \begin{equation} a[t] = w_{fps} \cdot p[t] , \end{equation} where $p[t]$ and $w_{fps}$ stand for the time per cycle of the network and default fps, respectively. In addition, the object detection accuracy is defined based on the total number of objects detected, the number found correctly, the number found incorrectly, the number of overlapping objects, and the ratio of truly detected~\cite{performance}. Thus, the performance of the detection model is at time-step $t$ is modeled as follows: \begin{equation} P(\alpha [t])= \begin{cases} w_p \cdot \textsf{num}_H(\textsf{object}), & \mbox{if }\alpha[t]=H \\ \textsf{num}_T(\textsf{object}), & \mbox{if }\alpha[t]=T \end{cases}, \label{eq:exp2} \end{equation} where $w_p$, and $\textsf{num}_{(\cdot)}(\textsf{object})$ stand for the detection accuracy ratio of $H$ and $T$, and the number of detected object, respectively. In our reference system model, the model that processes video streams fast, whereas the object detection accuracy is relatively low, should be used if $Q[t]$ is near overflow. On the other hand, the model which processes video streams with high object detection accuracy while taking more time should be used if $Q[t]$ is near zero. Eventually, we can observe the tradeoff between our objective (\textit{i.e.}, object detection accuracy) and stability. This paper designs an object detection model selection algorithm for the time-average detection accuracy maximization while guaranteeing queue stability. The mathematical program for maximizing the time-average object detection accuracy, \textit{i.e.}, $P(\alpha[t])$, is as follows: \begin{eqnarray} \max: & & \lim_{t\rightarrow\infty}\sum_{\tau=0}^{t-1} P(\alpha[\tau]), \label{eq:opt} \\ \text{subject to} & & \lim_{t\rightarrow\infty}\frac{1}{t}\sum_{\tau=0}^{t-1} Q[\tau]<\infty \text{ (queue stability)}. \end{eqnarray} According to this tradeoff, the Lyapunov optimization theory-based drift-plus-penalty (DPP) algorithm~\cite{tvt2019minseok,ton2016joongheon,tmc2019jonghoe} maximizes the time-average utility subject to queue stability. Here, the Lyapunov function is defined as \begin{equation} L(Q[t]) \triangleq \frac{1}{2}Q^2[t] \end{equation} and $\Delta(.)$, the conditional quadratic Lyapunov function, is defined as \begin{equation} \mathbb{E}[L(Q[t+1])-L(Q[t])| Q[t]] \end{equation} also called the drift on $t$. According to \cite{book2010sno}, this dynamic policy is designed to achieve queue stability by minimizing an upper bound on DPP (\textit{i.e.}, minimizing the negative value of $P(\alpha[t])$), which is given by \begin{equation} \Delta(Q[t]) + V \mathbb{E} \Big[ -P(\alpha[t]) \Big], \end{equation} where $V$ is a tradeoff coefficient. The upper bound on the drift of the Lyapunov function at $t$ is derived as follows: \begin{align} &L(Q[t+1]) - L(Q[t]) = \frac{1}{2}\Big( Q([t+1]^2 - Q[t]^2 \Big) \\ &~\leq \frac{1}{2} \Big( a[t]^2 + b(\alpha[t])^2 \Big) + Q[t] (a[t] - b(\alpha[t])). \end{align} Therefore, the upper bound of the conditional Lyapunov drift can be derived as follows: \begin{align} \Delta(Q(t)) &= \mathbb{E}[L(Q[t+1]) - L(Q[t]) | Q[t]] \nonumber \\ &\leq C + \mathbb{E}\Big[ Q[t](a[t] - b(\alpha[t]) \Big| Q[t] \Big], \end{align} where $C$ is a constant given by \begin{equation} \frac{1}{2}\mathbb{E}\Big[ a[t]^2 + b(\alpha[t])^2 \Big| Q[t] \Big] \leq C, \end{equation} which assumes that the arrival and departure process rates are upper bounded. Due to the fact that $C$ is a constant and the arrival process $a[t]$ is not controllable, minimizing the upper bound on DPP becomes \begin{equation} V \mathbb{E}\Big[ -P(\alpha[t]) \Big] - \mathbb{E}\Big[ Q[t]\cdot b(\alpha[t]) \Big]. \end{equation} Thus, the time-average maximization problem can be re-formulated as \begin{equation} V \mathbb{E}\Big[ P(\alpha[t]) \Big] + \mathbb{E}\Big[ Q[t]\cdot b(\alpha[t]) \Big]. \end{equation} \begin{algorithm}[t] \caption{Stabilized Detection Accuracy Maximization} \label{alg:dpp2} \small \begin{algorithmic}[1] \Statex $\hspace{-1.5em}\textbf{Initialize:}$ $t\leftarrow 0$; $Q[t]\leftarrow 0$; \Statex $\hspace{-1.5em}\textbf{Decision Action:}$ $\forall \alpha[t]\in\mathcal{A}\equiv\{H,T\}$ \Statex $\hspace{-1.5em}\textbf{Stabilized Object Detection Accuracy Maximization:}$ \While{$t\leq T$} // $T$: operation time \State Observe $Q[t]$; \State $\mathcal{T}^{*} \leftarrow \infty$; \For{$\alpha[t]\in \mathcal{A}$} \State $\mathcal{T} \leftarrow V\cdot P(\alpha[t]) + Q[t]b(\alpha[t])$; \If {$\mathcal{T} \leq \mathcal{T}^{*}$} \State $\mathcal{T}^{*}\leftarrow\mathcal{T}$; \State $\alpha^{*}[t]\leftarrow \alpha[t]$; \EndIf \EndFor \EndWhile \end{algorithmic} \end{algorithm} Here, the concept of the maximization of the expectation is used; therefore, this result can be maximized by an algorithm that observes the current queue state $Q[t]$ and determines $\alpha[t]$ at every slot $t$, as follows: \begin{equation} \boxed{ \alpha^{*}[t+1]\leftarrow \arg\max_{\alpha[t]\in\mathcal{A}} \left[ V\cdot P(\alpha[t]) + Q[t]b(\alpha[t]) \right]} \label{eq:lyapunov-final} \end{equation} where $\mathcal{A}\equiv\{H,T\}$ is the set of all possible object detection models, $\alpha^{*}[t]$ is the optimal object detection model selection decision at $t$, and $V$ is the tradeoff coefficient between the processing accuracy and queue stability. To verify whether the \eqref{eq:lyapunov-final} works correctly or not, we provide the following two cases. \begin{itemize} \item \textit{Case 1:} Suppose that $Q[t]\approx \infty$. Then, \eqref{eq:lyapunov-final} tries to maximize $b(\alpha[t])$, thus the processing should be accelerated for satisfying the queue stability, and the object detection model at $t$ ($\alpha[t]$) is selected, which is the fastest one. \item \textit{Case 2:} Suppose that $Q[t] =0$. Then, \eqref{eq:lyapunov-final} tries to maximize $P(\alpha[t])$, thus the algorithm pursues the performance accuracy improvements, and the object detection model at $t$ ($\alpha[t]$) is selected, which is the most accurate one. \end{itemize} \subsubsection{Pseudo-Code and Complexity}\label{sec:2-2B} The pseudo-code of the proposed object detection model selection algorithm is presented in \textbf{Algorithm~\ref{alg:dpp2}}. All variables and parameters are initialized from (line 1) to (line 3). The algorithm works in each unit time as shown in (line 4). In (line 5), the current queue-backlog $Q[t]$ is observed to be used in \eqref{eq:lyapunov-final}. From (line 7) to (line 12), the main computation procedure for \eqref{eq:lyapunov-final} is described. Because our proposed algorithm solves a closed-form equation with the number of decision actions, \textit{i.e.}, the number of elements in $\mathcal{A}$, the run-time computational complexity is only $O(N)$. Thus, it is clear that our algorithm guarantees a low computational complexity. \section{Performance Evaluation}\label{sec:3} This section presents the implementation of Hybrid (refer to Sec.~\ref{sec:3-1}) and the performance of the proposed model selection (refer to Sec.~\ref{sec:3-2}), respectively. Note that the experiment settings are presented in Table~\ref{tab:settings}. Due to the real-time issue, we adopt YOLOv3-tiny and FlowNet2-S as the real-time ODN and OFEN, respectively. The demo video is available in~\cite{youtube}. \subsection{Implementation of Hybrid}\label{sec:3-1} \begin{table}[t!] \footnotesize \centering \caption{Experiment setting.} \label{tab:settings} \begin{tabular}{c|r} \toprule[1pt] \textbf{Specitications} & \textbf{Settings}\\\midrule \multicolumn{1}{l|}{Dataset} & nuScenes-mini~\cite{nuscenes}, 4K Driving~\cite{dataset} \\\midrule \multicolumn{1}{l|}{OS} & Windows 10 Pro \\\midrule \multicolumn{1}{l|}{Processor (CPU \& GPU)} & Intel Xeon E5-2638, Nvidia RTX 2080Ti\\\midrule \multicolumn{1}{l|}{Dev. environment} & Python 3.6, Pytorch 1.4, OpenCV 4.2\\\midrule \multicolumn{1}{l|}{Object detection networks} & YOLOv3/v3-tiny/v4/v7 pretrained \\ & with COCO data\\\midrule \multicolumn{1}{l|}{Optical flow } & FlowNet2/2C/2S pretrained\\ \multicolumn{1}{l|}{estimation networks} & with KITTI data\\ \midrule \multicolumn{1}{l|}{Lyapunov coefficient ($V$)} & 90\\ \midrule \multicolumn{1}{l|}{Confidence threshold ($c_{th}$)} & 0.5 \\ \midrule \multicolumn{1}{l|}{NMS threshold} & 0.2 \\ \midrule \multicolumn{1}{l|}{Weights ($w_1, w_2, w_{fps},w_p$)} & (3.64, 2.41, 30.0, 1.005)\\ \bottomrule[1pt] \end{tabular} \end{table} \begin{table}[t!] \footnotesize \centering \caption{Performance of Hybrid with various models and nuScenes-mini dataset (mAP50).} \label{tab:performance-general} \begin{tabular}{@{}l|cccc@{}} \toprule[1pt] \centering \hspace{1em}\textbf{ODN/OFEN} & w/o. OFEN & FlowNet2S & FlowNet2C & FlowNet2\\\midrule \multicolumn{1}{l|}{YOLOv3-tiny~\cite{yolov3}} & 2.40 & 2.45 & 2.42 & 2.47 \\ \multicolumn{1}{l|}{YOLOv3~\cite{yolov3}} & 13.65 & 13.66 & 13.66 & 14.20 \\ \multicolumn{1}{l|}{YOLOv4~\cite{YOLOv4}} & 15.62 & 15.65 & 15.66 & 16.07 \\ \multicolumn{1}{l|}{YOLOv7~\cite{YOLOv7}} & 14.45 & 14.48 & 14.47 & 14.54 \\ \bottomrule[1pt] \end{tabular} \end{table} We propose three main experiments to verify the performance of Hybrid. First, we investigate the impact of flow map on various ODNs with a public driving dataset (\textit{i.e.}, nuScenes-mini \cite{nuscenes}). Second, we investigate the performance of Hybrid with high-resolution driving dataset (\textit{i.e.}, Youtube 4K driving~\cite{dataset}) by comparing the performance of the real-time ODN (\textit{i.e.,} YOLOv3-tiny) and more complex ODN (\textit{i.e.,} YOLOv3). Finally, we conduct an ablation study of optical flow estimation. We measure the time taken for one cycle and the number of detected objects per image for performance evaluation.\\ \BfPara{Impact of flow map on detector networks} We conduct the performance evaluation to investigate the overall performance. In this paper, we adopt nuScenes-mini dataset for evaluation with various real-time ODN models, \textit{e.g.}, YOLOv3, YOLOv4, YOLOv5, and YOLOv7. In addition, we use various optical flow estimation networks, \textit{e.g.}, FlowNet2, FlowNet2C, and FlowNet2S. All ODN networks and OFEN networks are pretrained with COCO dataset and KITTI dataset, respectively. The overall performance is presented in Tab.~\ref{tab:performance-general}. As shown in Tab.~\ref{tab:performance-general}, all OFEN improve ODN networks. Especially, Hybrid composed of YOLOv3 and FlowNet2 achieves 4.02\% performance gain (\textit{i.e.}, 0.55\% mAP50 score) compared to YOLOv3 only. The state-of-the-art YOLOv7 shows the least performance gain 0.6\% (\textit{i.e.}, 0.09\% mAP50 score). In addition, more complex OFEN (\textit{i.e.}, FlowNet2) shows the highest performance gain, the lightest OFEN (\textit{i.e.}, FlowNet2S) shows the lowest performance gain. In summary, our flow map processing algorithm enhances the performance of various ODNs in the driving environment without training/fine-tuning ODNs nor OFENs.\\ \BfPara{Feasibility study of Hybrid} To figure out the feasibility of Hybrid concerning object detection, we test three models (\textit{i.e.}, Hybrid, YOLOv3-tiny, and YOLOv3) with a road driving dataset which consists of 27k frames~\cite{dataset}. We measure the inference time and number of objects per image. Fig.~\ref{fig:performance} shows the result in the GPU setting. We find a tradeoff between inference time (\textit{i.e.,} delay) and the number of the detected object (\textit{i.e.,} performance). In addition, the total number of detected objects is 46.3k for real-time ODN, 72.9k for Hybrid, and 164k for complex ODN, respectively. On average, the inference time in both GPU and CPU settings is high in the order of complex ODN, Hybrid, and real-time ODN as shown in Table~\ref{tab:inf_time}. All three models satisfy real-time in the GPU setting, whereas only the complex ODN does not in the CPU setting. In summary, the Hybrid significantly outperforms two comparison models in the mobile platforms where GPU is incapable.\\ \BfPara{Ablation study of optical flow estimation} To verify the accuracy of the Hybrid model, we design the experiment with humans observing and recording the results of two models (Hybrid and ODN). The road driving dataset, consisting of 2k frames, is used in the corresponding experiment~\cite{dataset}. We set the performance evaluation criteria for the total number of objects detected, the number found correctly, the number found incorrectly, the number of overlapping objects, and the ratio of truly detected. The only difference is whether the simulation leverages optical flow estimation. Tab.~\ref{tab:my_label} shows the performance evaluation results of the ablation study. The total number of detected objects is $1.64$x higher in Hybrid than ODN. Among them, the number of correctly detected objects is $1.596$x more for Hybrid than ODN. The ratio of detecting the same object overlapping is $8.82$\% for Hybrid and $3.12$\% for ODN. The percentage of falsely detecting objects is $6.77$\% for ODN and $3.42$\% for Hybrid, which is lower in Hybrid. In the total number of detected objects, compared to the number of objects excluding overlapping objects, the number of objects accurately detected is $93.22$\% for ODN and $96.24$\% for Hybrid, showing the superiority in the accuracy of $3.02$\% for Hybrid.\\ \begin{figure}[t!] \centering \setlength{\tabcolsep}{2pt} \renewcommand{\arraystretch}{0.2} \centering \includegraphics[page=1, width=\columnwidth]{fig3.pdf} \begin{tabular}{cc} \includegraphics[page=1, width=0.5\columnwidth]{fig3a.pdf} & \includegraphics[page=1, width=0.5\columnwidth]{fig3b.pdf} \\ \\ \\ \small (a) CDF of the inference time & \small (b) CDF of the number of objects\\ \end{tabular} \caption{The three models' cumulative density functions ($y$-axis values) depend on the inference time and the number of objects in the GPU setting.} \label{fig:performance} \end{figure} \begin{table}[t!] \footnotesize \centering \caption{The inference time of three models with various settings.} \label{tab:inf_time} \begin{tabular}{c|c|c|c} \toprule[1pt] \textbf{Settings} & \textbf{Hybrid} & \textbf{Real-time ODN} & \textbf{Complex ODN}\\\midrule \multicolumn{1}{c|}{GPU} & 83\,ms & 55\,ms & 102\,ms \\ \multicolumn{1}{c|}{CPU} &133\,ms & 67\,ms & 562\,ms \\ \bottomrule[1pt] \end{tabular} \end{table} \begin{table}[t!] \footnotesize \centering \caption{The performance comparison between two models for the number of the detected object.} \label{tab:my_label} \begin{tabular}{c|c|c} \toprule[1pt] \textbf{Metric} & \textbf{ODN} & \textbf{Hybrid (Ours)}\\\midrule \multicolumn{1}{l|}{Total object} & 4,603 & 7,562\\ \multicolumn{1}{l|}{Correctly Detected} & 4,157 & 6,636\\ \multicolumn{1}{l|}{Falsely Detected} & 312 & 259\\ \multicolumn{1}{l|}{Overlapped Detected} & 144 & 667\\ \multicolumn{1}{l|}{True Positive Rate(\%)} & 93.22 & 96.24\\ \bottomrule[1pt] \end{tabular} \end{table} \subsection{Implementation of Model Selection}\label{sec:3-2} \begin{figure}[t] \centering \setlength{\tabcolsep}{2pt} \renewcommand{\arraystretch}{0.2} \begin{tabular}{cc} \multicolumn{2}{c}{\includegraphics[page=1, width=0.5\textwidth]{fig4.pdf}}\\ \includegraphics[page=1,width=0.24\textwidth]{fig4a.pdf} & \includegraphics[page=1,width=0.24\textwidth]{fig4b.pdf} \\ \\ \small (a) Queue-backlog & \small (b) Accuracy on average \end{tabular} \caption{The results of \textit{model selection} } \label{fig:performance2} \end{figure} \begin{table}[t!] \footnotesize \centering \caption{The configuration of the Comp3 framework} \label{tab:comp3} \begin{tabular}{l|r} \toprule[1pt] \textbf{Element} & \textbf{Detail}\\\midrule[1pt] \multicolumn{1}{l|}{\multirow{2}{*}{State}} & $s_t=\{Q[t], a[t-1], b(\alpha[t-1]), b(\alpha[t]), $\\ & $P(\alpha[t]),~w_1,~w_2,~w_{fps},~w_p,~V\}$\\\midrule \multicolumn{1}{l|}{Action} & $a_t\in\mathcal{A}\equiv\{H,T\}$\\\midrule \multicolumn{1}{l|}{Reward} & $r_t = V\cdot P(\alpha[t])+Q[t]b(\alpha[t])$ \\\midrule \multicolumn{1}{l|}{Optimization method} & REINFORCE \cite{sutton1999policy} \\ \midrule \multicolumn{1}{l|}{Optimizer} & Adam optimizer \\ \midrule \multicolumn{1}{l|}{Learning rate} & 0.0002 \\ \midrule & 3 fully connected layers with ReLU function\\ \multicolumn{1}{l|}{\multirow{1}{*}{Neural Network}} & \multicolumn{1}{l}{~~- 1st layer: $10\times 128$ + ReLU} \\ \multicolumn{1}{l|}{\multirow{1}{*}{Architecture}} & \multicolumn{1}{l}{~~- 2nd layer: $128\times 128$ + ReLU}\\ & \multicolumn{1}{l}{~~- 3rd layer: $128\times 2$ + ReLU}\\\bottomrule[1pt] \end{tabular \end{table} We investigate the performance to verify the Lyapunov optimization framework, which chooses between ODN and the Hybrid in a finite time (\textit{e.g.}, 100 seconds) depending on the amount of queue-backlog (\textit{i.e.}, delay). For comparison with the proposed framework, we adopt three comparison frameworks, \textit{i.e.}, the policy with selecting only ODN, or only the Hybrid and the deep reinforcement learning (DRL)-based policy, which are denoted as `Comp1', `Comp2', and `Comp3', respectively. To configure Comp3, we design the state, action, reward, optimization methods, and neural network architecture depicted in Table~\ref{tab:comp3}. Note that Comp3 is the state-of-the-art stochastic controlling method. \BfPara{Numerical result of model selection} Fig.~\ref{fig:performance2} shows the result of the network in which Hybrid and ODN observe the queue and thereby select a model. In the cases of model selection based on the proposed model selection and Comp3 on the mobile platform, it is confirmed that neither transient stability nor queue overflow occurs. In contrast, transient stability occurs in Comp1. In addition, queue overflow occurs in Comp2. Thus, our proposed framework and Comp3 outperform Comp1 and Comp2, corresponding to the queue stability (see Fig.~\ref{fig:performance2}(a)) and average accuracy (see Fig.~\ref{fig:performance2}(b)). \BfPara{Computing cost for model selection} Comp3 consumes $35,582$\,FLOPS for every model selection regarding computing cost. Furthermore, Comp3 requires additional computing costs for training the policy. However, the computing cost of every model selection requires only $12$\,FLOPS for the proposed framework, whereas no computing cost is necessary for Comp1, Comp2. The proposed framework is most suitable for model selection for the real-time service and among all frameworks. Consequently, we corroborate that the proposed model selection framework guarantees time-average performance maximization and queue stability, which requires very low-computational cost for model selection. \section{Conclusions and Future Work}\label{sec:4} In this paper, we confirm the improved performance of ODN in the road driving environment by utilizing optical flow estimation via OFEN and flow map processing. The flow map processing algorithm can be applied to all ODNs that utilize bounding box detection. A Lyapunov optimization-based model selection framework is also constructed to select a model under autonomous driving environments' constraints automatically. In addition, it is known to be time-average optimal subject to system/queue stability. As a result of observing the queue-backlog, it is confirmed that the time-average performance maximization can be achieved, as theoretically expected. As future research directions, real-world experimental study results in an actual driving environment are meant to verify the novelty of this algorithm in practice. \bibliographystyle{IEEEtran} \balance
{'timestamp': '2022-09-30T02:06:58', 'yymm': '2209', 'arxiv_id': '2209.14525', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14525'}
arxiv
\section{Introduction} \label{sec:intro} In online teaching, it is important for educators to record written contents to make the lectures engaging. Two popular techniques for recording are: \textit{(A)} utilizing an overhead camera which is straightforward, and \textit{(B)} using a graphics tablet or tab~\cite{Tab2021}, i.e. \textit{Intuos}\footnote{\texttt{www.wacom.com/en-us/products/pen-tablets}}. These tabs are becoming popular, but many teacher find it difficult as they are expensive~\cite{linda_2018}, and many lack abilities to use such instruments. Besides, most general-purpose graphics tabs have no built-in screen; hence, users must maintain \textit{hand-eye synchronization}~\cite{santos_2020}, which can be displeasing. Excessive use of these gadgets might lead to illness, like \textit{musculoskeletal}. ~\cite{Xu2020}. Tablets with integrated touch displays are even more expensive. In this paper, we present an alternative to graphics tab which is affordable yet providing its essential features. Our goal is to combine the old-fashioned pen-paper technique with the modern computer-based recording technology. Our solution avoids huge budget, and does not necessitate hand-eye synchronization. It needs only a \textbf{laptop}, a \textbf{pen}, and \textbf{paper}; and we name it ``\textit{{Do-It-Yourself Graphics Tab}}'', or ``\textit{{DIY Graphics Tab}}''. Fig.~\ref{fig:teaser} presents an overview \textit{DIY Graphics Tab}. To configure, user places a paper in front of a laptop and tilts its lid so that the webcam can capture the area containing the paper $\bigl[$\protect\includegraphics[scale=.19]{crc1.png}{$^{\large (a, b)}\bigr]$}. We found that, a tilting angle around $45$ degrees \textit{w.r.t} the base is adequate. Our system then processes the frame, and only contents are rendered on screen---as if it were taken from a ``bird's eye" view $\bigl[$\protect\includegraphics[scale=.19]{crc1.png}{$^{\large (d)}\bigr]$}. Our system takes care of the obstacles, such as---occlusion by hand, random movement of paper, background, lighting conditions, and perspective distortion due to the angular view.\\ Few works were done on capturing lectures and analyzing the contents, i.e., \cite{Davila2021, UralaKota2019, kota2018automated, davila2017whiteboard, lee2017robust, Yeh2014, Wienecke2003}, but they focused on whiteboard. Research that inclines mostly with our domain is \textit{WebcamPaperPen}~\cite{webcamPP2014}. In terms of ease of use and simplicity in configuration, our work outperforms \textit{WPP} (Table~\ref{tab:compare}). \begin{table}[h] \centering \begin{tabular}{lll} \textit{\textbf{\small Negative features}} & \textit{\textbf{\small WPP}} & \textit{\textbf{\small DIYGT}} \\ \hline \vspace{-1mm} \begin{tabular}[c]{@{}l@{}}\small Requires manual detection? \end{tabular} & {\cmark} & \begin{tabular}[c]{@{}l@{}}{\xmark}\end{tabular} \\ \vspace{-1mm} \begin{tabular}[c]{@{}l@{}}\small Requires extra equipment?\end{tabular} & \begin{tabular}[c]{@{}l@{}}{\cmark}\end{tabular} & \xmark \\ \vspace{-1mm} \begin{tabular}[c]{@{}l@{}}\small Requires steadiness?\end{tabular} & \cmark & \xmark \\ \vspace{-1mm} \begin{tabular}[c]{@{}l@{}}\small Requires specific type of pen?\end{tabular} & \begin{tabular}[c]{@{}l@{}}{\cmark}\end{tabular} & \xmark \\ \vspace{-1mm} \small Restriction on handedness? & \begin{tabular}[c]{@{}l@{}}{\cmark}\end{tabular} & \xmark \\ \vspace{-1mm} \small Requires eye-hand sync? & \begin{tabular}[c]{@{}l@{}}{\cmark}\end{tabular} & \begin{tabular}[c]{@{}l@{}} {\xmark}\end{tabular} \\ \begin{tabular}[c]{@{}l@{}}\small Requires prior experience?\end{tabular} & \cmark & \xmark \\ \hline \end{tabular} \caption{A comparison between \textit{WPP}~\cite{webcamPP2014} and ours.} \vspace{-11mm} \label{tab:compare} \end{table} \section{Implementation} Fig.~\ref{fig:teaser}\protect\includegraphics[scale=.19]{crc2.png} shows our pipeline. After a frame is captured $\bigl[$\protect\includegraphics[scale=.19]{crc2.png}{$^{\large (a)}\bigr]$}, it goes through several stages, which are explained below. $\bigl[$\protect\includegraphics[scale=.19]{crc2.png}{$^{\large (b, c)}\bigr]$}\textbf{:} To extract paper region, we developed a dataset of images of papers in different positions and lighting, and occlusions. Coordinates of a paper corners are stored as a convex hull of a quadrilateral mask. We trained \textit{Mask-RCNN}~\cite{he2017mask} model using our dataset and performed segmentation. $\bigl[$\protect\includegraphics[scale=.19]{crc2.png}{$^{\large (d, e)}\bigr]$}\textbf{:} Segmentation provided a mask covering paper. We extracted the largest contour of mask to detect corners. $\bigl[$\protect\includegraphics[scale=.19]{crc2.png}{$^{\large (f)}\bigr]$}\textbf{:} The \textit{$4$-point perspective transformation} \cite{rosebrock_2014, articleIPM, DBLP:journals/corr/abs-1812-00913} is applied on the corners to unwarp the paper region. $\bigl[$\protect\includegraphics[scale=.19]{crc2.png}{$^{\large (g)}\bigr]$}\textbf{:} We applied adaptive thresholding~\cite{nina2011recursive} followed by morphological operations and connected component analysis~\cite{dougherty2003hands} to avoid palm, fingers and noises.\\ To make the system robust, user needs to specify his/her handedness. For a left-handed person our system simply flips the frame in segmentation phase along the axis. Fig.~\ref{fig:res} shows more result. Materials and demos are available \href{https://imruljubair.github.io/project/project-page.html#tab}{{\color{blue}here}}. \section{Evaluation} We performed a survey on $29$ educators from university level, inviting them to use \textit{DIY Graphics Tab} for recording their lectures. We divide them into $3$ groups depending on their technical backgrounds on computer, which are---\textit{ {\textbf{\color{red}fTB}:}} teachers with no or very few technical background. \textit{\textbf{\color{blue}TB$-$GT}:} Teachers with technical background with no previous experience of using graphics tablet. \textit{\textbf{\color{gray}TB$+$GT}:} Teachers with technical background and also has previous experience of using graphics tablet. We asked participants to utilize our method and grade it on a scale of \textcircled{\small 1} to \textcircled{\small 5} (\textit{very poor} to \textit{excellent})~\cite{likert1932technique, mcleod_1970}. We found $44.4\%$ of \textit{\textbf{\color{gray}TB$+$GT}} gave \textcircled{\small 4}. Our method received \textcircled{\small 5} from a majority ($57.1\%$) of \textit{\textbf{\color{blue}TB$-$GT}}. Almost $77\%$ of our target users, \textit{\textbf{\color{red}fTB}}, gave highest score. The average rating is $4.44$. The lid must be slanted in our system which rise concerns as the screen becomes non-visible to instructors. But we are motivated from overhead camera configuration---where the user primarily concentrates on desk. However, we conducted a poll to assess if the tilting may be a problem. We observe that around $72\%$ of teachers are comfortable with it. They think the non-visible screen is not a major concern as long as they can save the costs of graphic tabs. We also collected a questionnaire-based evaluation from testers to determine the cost-effectiveness of our \textit{DIY Graphics Tab}. To maintain our evaluation on the same ground, we mostly use the questions from \textit{WebcamPaperPen}~\cite{webcamPP2014, mastersthesis}. The user responses are listed below. We observed a majority of users believed that using a graphical tab is highly expensive and found our technology to be cost efficient. \begin{itemize} \item \small{It replaces graphics tab perfectly for lecture recording ($31.03\%$)}. \item \small{The actual graphics tab is better but it is too expensive, I would rather use it ($41.38\%$).} \item \small{After a certain period I would get tired of it and would buy a proper graphics tab to improve my content ($20.69\%$).} \item \small{It does not fit my lecture recording ($6.9\%$).} \end{itemize} \begin{figure}[t] \vspace{-4mm} \includegraphics[width=0.4\textwidth]{Presentation2.jpg} \caption{Result of \textit{DIY Graphics Tab}.} \label{fig:res} \vspace{-4mm} \end{figure} \section{Conclusion} In this paper, we introduced \textit{DIY Graphics Tab} as a substitute for graphic tab using pen--paper and webcam. We used \textit{Mask-RCNN} to obtain the region of paper image and applied perspective transformation to achieve top-down view. Our system has shortcomings that demand futher research, e.g., flickering, haziness. etc. We plan to enrich dataset and use advanced segmentation techniques, e.g., \textit{YOLACT}~\cite{bolya2019yolact, yolactplus}. We also like to convert our system into a real-time application. \newpage \newpage \bibliographystyle{ACM-Reference-Format}
{'timestamp': '2022-09-30T02:08:39', 'yymm': '2209', 'arxiv_id': '2209.14586', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14586'}
arxiv
\section{Introduction} Ultra-reliable and low-latency communication (URLLC) is one of the generic applications required to be covered in the fifth-generation (5G) \cite{durisi2016toward,bennis2018ultrareliable,zhang2021ris}. As a result, it has been attracted significant interests since it enables several innovative usages, especially in industrial production, such as remote heavy industrial machines operation and factory automation \cite{simsek20165g,liu2018tractable}. However, compared with conventional communication systems, the achievable rate under URLLC is quite different since short blocklength is adopted to shorten the latency such that the classical Shannon-sense capacity no longer holds. Specifically, the URLLC rate is a complicated function of the transmission power, the precoding vector, the bandwidth, the transmission time, and the decoding error probability \cite{polyanskiy2010channel}. Indeed, guaranteeing URLLC represents unique challenges to resource allocation design due to the non-convexity introduced by the finite blocklength. In the literature, much attention has been devoted to designing effective resource allocation algorithms that support URLLC \cite{she2018joint,nasir2020resource,he2021beamforming}. However, the systems considered in these works are all cellular networks and their performance is known to be limited by severe inter-cell interference. Cell-free massive multiple-input multiple-output (MIMO) architecture is a new promising solution to overcome the issue discussed above \cite{zhang2021local,zhang2021improving,zheng2022cell,9737367}. It reaps the advantages of massive MIMO and network MIMO, since massive distributed access points (APs) facilitate coherent signal transmission to serve all the users without any cell boundaries \cite{bjornson2019making,ngo2017cell,zhang2020prospective}. However, current literature focuses on the resource allocation in cell-free massive MIMO systems for URLLC is still limited. For example, in \cite{nasir2021cell}, the authors applied the path-following algorithm (PFA) for optimizing the power allocation with a special class of conjugate beamforming to maximize the users' minimum URLLC rate and the energy efficiency. However, an adaptive and optimized precoding design at the APs is generally more effective that the fixed one. Besides, in \cite{lancho2022cell}, the upper bounds of the uplink and downlink decoding error probabilities (DEPs) were derived by using the saddlepoint method to support URLLC. While the closed-form expression of DEP can characterize the performance, it is generally intractable for the the design of cooperatively efficient resource allocation. As such, there is an emerging need for designing the precoding with the performance metric of the URLLC rate. Motivated by the above discussion, the PFA-based precoding design for maximizing the users' minimum URLLC rate is studied in this correspondence. First, a PFA-based centralized precoding design is proposed which generates a sequence of feasible points and converges to a locally optimal solution of the design optimization problem. Second, we propose a decentralized PFA-based precoding design by dividing the APs into several non-overlapping cooperative clusters in which the APs only share the data and instantaneous channel state information (CSI) in each cluster to design the precoding vectors to reduce the computational complexity. Simulation results show that compared with the centralized precoding, the decentralized PFA precoding can achieve 80\% of the 95\%-likely URLLC rate and 89\% of the average URLLC rate with only 12\% of the computational complexity of the counterpart. We also investigate the impact of the precoding schemes, the length of transmission duration, and the size of the AP cluster on the URLLC rate via extensive simulations. \section{System Model} We consider a cell-free massive MIMO system, which consists of $L$ APs and $K$ single-antenna users that are distributed arbitrarily over a large area. We assume that each AP is equipped with $N$ antennas. Moreover, all the APs are connected with each other and a central processing unit (CPU) via dedicated fronthaul links with sufficient capacity. All APs serve all users on the same time-frequency resource through time division duplex (TDD) operation \cite{9743355}. The channel coefficient between AP $l$ and user $k$, ${{\bf{h}}_{kl}} \in {{\mathbb{C}}^{N \times 1}}$, is assumed to follow a correlated Rayleigh fading distribution. We adopt a classic block fading model for modeling the channels such that ${{\bf{h}}_{kl}}$ remains constant in $t$ channel uses of the time-frequency blocks and experience an independent realization in every block. Note that the channel coefficients can be acquired at the APs by existing channel estimation algorithms \cite{bjornson2017massive} and this is beyond the scope of this work as we aim to optimize the precoding for URLLC. Therefore, we assume that perfect CSI is available at the APs. In the downlink payload data transmission phase, the received signal at user $k$ can be expressed as ${y_k} =\sum\limits_{l = 1}^L {\bf{h}}_{kl}^H{{\bf{w}}_{kl}}{s_k} + \sum\limits_{l = 1}^L {{\bf{h}}_{kl}^H} \sum\limits_{i \ne k}^K {{\bf{w}}_{il}}{s_i} + {n_k}$, where ${s_i} \sim {{\cal N}_{\mathbb{C}}}\left( {0,1} \right)$ at AP $l$, ${{\bf{w}}_{il}} \in {{\mathbb{C}}^{N \times 1}}$ is the precoding vector for user $i$ at AP $l$, and ${n_k} \sim {{\cal N}_{\mathbb{C}}}\left( {0,{\sigma ^2}} \right)$ represents the thermal noise at user $k$. Then, the corresponding effective signal-to-interference-plus-noise ratio (SINR) is given as \begin{equation} {\varphi _k} = \frac{{{{\left| {{\bf{ h}}_k^H{{\bf{w}}_k}} \right|}^2}}}{{\sum\limits_{i \ne k}^K {{{\left| {{\bf{ h}}_k^H{{\bf{w}}_i}} \right|}^2}} + {\sigma ^2}}}, \end{equation} where ${{\bf{h}}_k} = {\left[ {{\bf{h}}_{k1}^H, \cdots ,{\bf{h}}_{kL}^H} \right]^H} \in {{\mathbb{C}}^{LN \times 1}}$ and ${{\bf{w}}_i} = {\left[ {{\bf{w}}_{i1}^H, \cdots ,{\bf{w}}_{iL}^H} \right]^H} \in {{\mathbb{C}}^{LN \times 1}}$. By treating the inter-user interference ${\bf{h}}_{kl}^H\sum\limits_{i \ne k}^K {{{\bf{w}}_{il}}{s_i}}$ as Gaussian noise, where $p_{il}^{{\rm{dl}}} \buildrel \Delta \over = {\left\| {{{\bf{w}}_{il}}} \right\|^2}$ is the power allocated to user $i$ at AP $l$, the achievable rate in nats/sec/Hz for user $k$ for the case of sufficiently long blocklength is given by the Shannon rate function ${{\tilde R}_k}= \ln \left( {1 + {\varphi _k}} \right)$, and the achievable URLLC rate in nats/sec/Hz for user $k$ can be approximated as \cite[eq. (30)]{nasir2020resource} \begin{equation}\label{URLLC Rate} {R_k} = \ln \left( {1 + {\varphi _k}} \right) - \sqrt {\frac{1}{{tB}} \times {V_k}} \times {Q^{ - 1}}\left( {\epsilon} \right), \end{equation} where $t$ is the transmission duration, $B$ is the communication bandwidth, ${V_k}$ is the channel dispersion \cite{nasir2020resource} which can be expressed as ${V_k} = 1 - \frac{1}{{{{\left( {1 + {\varphi _k}} \right)}^2}}}$, ${Q^{ - 1}}\left( \cdot \right)$ is the inverse of the Gaussian Q-function, i.e., $Q\left( x \right) = \int_x^\infty {\frac{1}{{\sqrt {2\pi } }}\exp \left( { - {t^2}/2} \right)} dt$, and ${\epsilon}$ is the decoding error probability. Note that (\ref{URLLC Rate}) is the normal approximation when the channel ${{\bf{h}}_k}$ is assumed to be quasi-static and deterministic over the transmission duration $t$. The subtrahend in (\ref{URLLC Rate}) captures the rate penalty due to the finite block length, $tB$. \section{Max-min Rate Based Precoding Design}\label{Design} \subsection{Centralized Precoding Design} In the centralized precoding design, the optimization of the precoding vectors takes place at the CPU, where the estimate of the global instantaneous CSI ${{{\bf{h}}}_{kl}},\forall k \in \left\{ {1, \cdots ,K} \right\},\forall l \in \left\{ {1, \cdots ,L} \right\}$, available. The centralized max-min URLLC rate optimization problem can be expressed as \begin{align} &\mathop {\max }\limits_{\bf{w}} \mathop {\min }\limits_{k = 1, \cdots ,K} \left\{ {{R_k}\left( {\bf{w}} \right)} \right\}\label{P1}\tag{3a}\\ &{\rm{s.}}{\rm{t.}}\;\;\;\;\;\;\sum\limits_{k = 1}^K {{{\left\| {{{\bf{w}}_{kl}}} \right\|}^2}} \le {p_{\max }},\forall l,\label{3b}\tag{3b} \end{align} where ${\bf{w}} = \left\{ {{{\bf{w}}_{kl}}:k = 1, \cdots ,K,l = 1, \cdots ,L} \right\}$ and ${p_{\max }}$ is the maximum power at each AP. The problem (\ref{P1}) is non-convex due to the URLLC rate function ${R_k}\left( {\bf{w}} \right)$. With the help of \cite{nasir2020resource}, we apply the PFA to develop a concave lower bound for ${R_k}\left( {\bf{w}} \right)$. Without loss of generality, the URLLC rate expression for user $k$ can be rewritten as ${R_k}\left( {\bf{w}} \right) = {f_k}\left( {\bf{w}} \right) - a{g_k}\left( {\bf{w}} \right)$, where $a = {Q^{ - 1}}\left( {\epsilon } \right)/\sqrt {t{ B}}$, ${f_k}\left( {\bf{w}} \right) = \ln \left( {1 + {\varphi _k}\left( {\bf{w}} \right)} \right)$, and ${g_k}\left( {\bf{w}} \right) = \sqrt {1 - 1/{{\left( {1 + {\varphi _k}\left( {\bf{w}} \right)} \right)}^2}}$. Now, we aim to establish a convex lower bound for ${f_k}\left( {\bf{w}} \right)$ and a concave upper bound for ${g_k}\left( {\bf{w}} \right)$. Let ${{\bf{w}}^{\left( n \right)}}$ be a feasible point for (\ref{P1}) that is computed from the $\left( {n - 1} \right)$th iteration of the iterative PFA. \subsubsection{Lower bounding for ${f_k}\left( {\bf{w}} \right)$} According to \cite{nasir2020resource}, the following inequality holds for all ${\bf{x}} \in {{\mathbb{C}}^{{M_1}}},{\bf{y}} \in {{\mathbb{C}}^{{M_2}}}$ and ${\bf{\bar x}} \in {{\mathbb{C}}^{{M_1}}},{\bf{\bar y}} \in {{\mathbb{C}}^{{M_2}}}$ \begin{align}\label{I1}\tag{4} \ln\! \left( \!\!{1\!\! +\! \frac{{{{\left\| {\bf{x}} \right\|}^2}}}{{{{\left\| {\bf{y}} \right\|}^2} \!\!+\! {\sigma ^2}}}}\!\! \right) \!\!\ge\!\! a\!\! -\! \frac{{{{\left\| {{\bf{\bar x}}} \right\|}^2}}}{{2{\cal R}\!\!\left\{ {{{{\bf{\bar x}}}^H}{\bf{x}}} \right\} \!\!- \! {{\left\| {{\bf{\bar x}}} \right\|}^2}}}\!-\! b{\left\| {\bf{x}} \right\|^2} \!\!-\! c{\left\| {\bf{y}} \right\|^2}. \end{align} Applying the inequality in (\ref{I1}) for $x = {\bf{h}}_k^H{{\bf{w}}_k}$, $y = {{\cal L}_k}\left( {\bf{w}} \right)$, $\bar x = {\bf{h}}_k^H{\bf{w}}_k^{\left( n \right)}$, $\bar y = {{\cal L}_k}\left( {{{\bf{w}}^{\left( n \right)}}} \right)$, where ${{\cal L}_k}\left( {\bf{w}} \right)$ arranges ${\bf{h}}_k^H{{\bf{w}}_i},i \ne k$ into a vector of dimension $K-1$, we obtain \begin{align}\label{f_n} {f_k}\left( {\bf{w}} \right) &\ge \bar a_k^{\left( n \right)} - \frac{{{{\left| {{\bf{h}}_k^H{\bf{w}}_k^{\left( n \right)}} \right|}^2}}}{{2{\cal R}\left\{ {{{\left( {{\bf{w}}_k^{\left( n \right)}} \right)}^H}{{{\bf{h}}}_k}{\bf{h}}_k^H{{\bf{w}}_k}} \right\} - {{\left| {{\bf{h}}_k^H{\bf{w}}_k^{\left( n \right)}} \right|}^2}}}\notag\\ &- \!\bar b_k^{\left( n \right)}{\left| {{\bf{h}}_k^H{{\bf{w}}_k}} \right|^2} \!-\! \bar c_k^{\left( n \right)}\sum\limits_{i \ne k} {{{\left| {{\bf{h}}_k^H{{\bf{w}}_i}} \right|}^2}} \!\buildrel \Delta \over = \!f_k^{\left( n \right)}\left( {\bf{w}} \right)\tag{5}, \end{align} with the constraint of \begin{equation}\label{trust region}\tag{6} 2{\cal R}\left\{ {{{\left( {{\bf{w}}_k^{\left( n \right)}} \right)}^H}{{{\bf{h}}}_k}{\bf{h}}_k^H{{\bf{w}}_k}} \right\} - {\left| {{\bf{h}}_k^H{\bf{w}}_k^{\left( n \right)}} \right|^2} > 0, \end{equation} where $\bar a_k^{\left( n \right)} \!=\! {f_k}\left( {{{\bf{w}}^{\left( n \right)}}} \right) \!+\! 2 \!-\! \frac{{{{\left| {{\bf{h}}_k^H{\bf{w}}_k^{\left( n \right)}} \right|}^2}}}{{\beta _k^{\left( n \right)}}}\frac{{\sigma ^2}}{{\alpha _k^{\left( n \right)}}}$, $0 \!< \!\bar b_k^{\left( n \right)} \!=\! \frac{{\bar a_k^{\left( n \right)}}}{{\beta _k^{\left( n \right)}{{\left| {{\bf{h}}_k^H{\bf{w}}_k^{\left( n \right)}} \right|}^2}}}$, $0 \!<\! \bar c_k^{\left( n \right)} \!= \!\frac{{{{\left| {{\bf{h}}_k^H{\bf{w}}_k^{\left( n \right)}} \right|}^2}}}{{\beta _k^{\left( n \right)}\alpha _k^{\left( n \right)}}}$, $\alpha _k^{\left( n \right)} \!\buildrel \Delta \over =\! \sum\limits_{i \ne k} \!{{{\left| {{\bf{h}}_k^H{\bf{w}}_i^{\left( n \right)}} \right|}^2}} \!+\! {{\sigma ^2}}$, and $\beta _k^{\left( n \right)} \!\buildrel \Delta \over = \! \sum\limits_{i = 1}^K {{{\left| {{\bf{h}}_k^H{\bf{w}}_i^{\left( n \right)}} \right|}^2}} \!+\! {{\sigma ^2}}$. According to \cite{nasir2020resource}, the function $f_k^{\left( n \right)}\left( {\bf{w}} \right)$ is concave over the trust region (\ref{trust region}) and achieves the same value as ${f_k}\left( {\bf{w}} \right)$ at ${{{\bf{w}}^{\left( n \right)}}}$, $f_k^{\left( n \right)}\left( {{{\bf{w}}^{\left( n \right)}}} \right) = {f_k}\left( {{{\bf{w}}^{\left( n \right)}}} \right)$. \subsubsection{Upper bounding for ${g_k}\left( {\bf{w}} \right)$} Since the function $f\left( x \right) = \sqrt x$ is concave on $x > 0$, the following inequality for all $x > 0$ and $\bar x > 0$ holds true \begin{align}\label{I2}\tag{7} \sqrt x \!=\! f\left( x \right)\le f\left( {\bar x} \right) \!+\! {\left. {\frac{{\partial \!f\!\left( x \right)}}{{\partial x}}} \right|_{x = \bar x}}\left( {x \!-\! \bar x} \right)\!=\! \frac{{\sqrt {\bar x} }}{2} \!+ \!\frac{x}{{2\sqrt {\bar x} }}, \end{align} where $\frac{{\partial f\left( x \right)}}{{\partial x}}$ refers to the partial derivative of the function $f\left( x \right)\le f\left( {\bar x} \right)$ with respect to $x$. Applying the inequality in (\ref{I2}) for $x = 1 - 1/{\left( {1 + {\varphi _k}\left( {\bf{w}} \right)} \right)^2}$ and $\bar x = 1 - 1/{\left( {1 + {\varphi _k}\left( {{{\bf{w}}^{\left( n \right)}}} \right)} \right)^2}$ and using \begin{align}\label{I3} &{{{{\left( {\sum\limits_{i \ne k} {{{\left| {{\bf{h}}_k^H{{\bf{w}}_i}} \right|}^2}} + {{\sigma ^2}}} \right)}^2}}}/{{{{\left( {\sum\limits_{i = 1}^K {{{\left| {{\bf{h}}_k^H{{\bf{w}}_i}} \right|}^2}} + {{\sigma ^2}}} \right)}^2}}}\notag\\ &\ge\!\!\! \frac{{4\alpha _k^{\left( n \right)}}}{{{{\left( {\beta _k^{\left( n \right)}} \right)}^2}}}\!\!\left( \!{\sum\limits_{i \ne k}\! {\left(\! {2{\cal R}\!\left\{ \!{{{\left( \! {{\bf{h}}_k^H{\bf{w}}_i^{\left( n \right)}} \!\right)}^*}{\bf{h}}_k^H{{\bf{w}}_i}} \right\} \!\!-\! {{\left| {{\bf{h}}_k^H{\bf{w}}_i^{\left( n \right)}} \!\right|}^2}} \!\right)} } { + {{\sigma ^2}}} \!\!\right)\notag\\ &-\!\! \frac{{2{{\left( \!{\alpha _k^{\left( n \right)}} \!\right)}^2}}}{{{{\left(\! {\beta _k^{\left( n \right)}} \!\right)}^3}}}\!\!\left( \!{\sum\limits_{i = 1}^K \!{{{\left| {{\bf{h}}_k^H{{\bf{w}}_i}} \right|}^2}} \!\! +\! {{\sigma ^2}}} \!\!\right)\!-\! \frac{{{{\left( \!{\sum\limits_{i \ne k}\! {{{\left| {{\bf{h}}_k^H{{\bf{w}}_i}} \right|}^2}} \!\!+\! {{\sigma ^2}}} \!\!\right)}^2}}}{{{{\left( {\beta _k^{\left( n \right)}} \right)}^2}}}\tag{8}, \end{align} with the constraints of \begin{align} &\sum\limits_{i = 1}^K {{{\left| {{\bf{h}}_k^H{{\bf{w}}_i}} \right|}^2}} + {{\sigma ^2}} \le 2\beta _k^{\left( n \right)},\label{cons_g1}\tag{9}\\ &\frac{1}{{{{\left( {\beta _k^{\left( n \right)}} \right)}^2}}}\left( {\sum\limits_{i = 1}^K {{{\left| {{\bf{h}}_k^H{{\bf{w}}_i}} \right|}^2}} + {{\sigma ^2}}} \right)\le \!\! \frac{2}{{\alpha _k^{\left( n \right)}}}\notag\\ &\;{\times}\!\!\left( \! {\sum\limits_{i \ne k}\! {\left( {2{\cal R}\!\left\{ {{{\left( {{\bf{h}}_k^H{\bf{w}}_i^{\left( n \right)}} \! \right)}^*}{\bf{h}}_k^H{{\bf{w}}_i}} \!\right\}} \right.} } {\left. { \!\!-\! {{\left| {{\bf{h}}_k^H{\bf{w}}_i^{\left( n \right)}} \right|}^2}} \right) \!\!+\! \!{{\sigma ^2}}} \right),\label{cons_g2}\tag{10} \end{align} we have \begin{align}\label{g_n} {g_k}\left( {\bf{w}} \right) &\le d_k^{\left( n \right)} - \frac{{4\alpha _k^{\left( n \right)}e_k^{\left( n \right)}}}{{{{\left( {\beta _k^{\left( n \right)}} \right)}^2}}}\left( {\sum\limits_{i \ne k} {\left( {2{\cal R}\left\{ {{{\left( {{\bf{h}}_k^H{\bf{w}}_i^{\left( n \right)}} \right)}^*}{\bf{h}}_k^H{{\bf{w}}_i}} \right\}} \right.} } \right. \notag\\ &\left.{\left. { - \!{{\left| {{\bf{h}}_k^H{\bf{w}}_i^{\left( n \right)}} \right|}^2}} \right) \!\!+\! {{\sigma ^2}}} \!\right)\!\! + \!\! \frac{{2{{\left( \!{\alpha _k^{\left( n \right)}} \!\right)}^2}e_k^{\left( n \right)}}}{{{{\left( {\beta _k^{\left( n \right)}} \right)}^3}}}\!\!\left( \!{\sum\limits_{i = 1}^K \!{{{\left| {{\bf{h}}_k^H{{\bf{w}}_i}} \right|}^2}} \!\! +\!\! {{\sigma ^2}}} \!\! \right)\notag\\ &+\frac{{{{\left( {\sum\limits_{i \ne k} {{{\left| {{\bf{h}}_k^H{{\bf{w}}_i}} \right|}^2}} + {{\sigma ^2}}} \right)}^2}e_k^{\left( n \right)}}}{{{{\left( {\beta _k^{\left( n \right)}} \right)}^2}}}\buildrel \Delta \over = g_k^{\left( n \right)}\left( {\bf{w}} \right)\tag{11}, \end{align} where $0 \!< \!d_k^{\left( n \right)} \!= \!\frac{{\sqrt {1 \!-\! 1/{{\left( {1 \!+\! {\varphi _k}\left( {{{\bf{w}}^{\left( n \right)}}} \right)} \right)}^2}} }}{2} \!+\! \frac{1}{{2\sqrt {1 \!-\! 1/{{\left( {1 \!+\! {\varphi _k}\left( {{{\bf{w}}^{\left( n \right)}}} \right)} \right)}^2}} }}$, and $0 < e_k^{\left( n \right)} = \frac{1}{{2\sqrt {1 - 1/{{\left( {1 + {\varphi _k}\left( {{{\bf{w}}^{\left( n \right)}}} \right)} \right)}^2}} }}$. The function $g_k^{\left( n \right)}\left( {\bf{w}} \right)$ is convex and achieves the same value as ${g_k}\left( {\bf{w}} \right)$ at ${{\bf{w}}^{\left( n \right)}}$, $g_k^{\left( n \right)}\left( {{{\bf{w}}^{\left( n \right)}}} \right) = {g_k}\left( {{{\bf{w}}^{\left( n \right)}}} \right)$. \subsubsection{Concave Lower bound for ${R_k}\left( {\bf{w}} \right)$} By applying (\ref{f_n}) and (\ref{g_n}), we have ${R_k}\left( {\bf{w}} \right) \ge f_k^{\left( n \right)}\left( {\bf{w}} \right) - ag_k^{\left( n \right)}\left( {\bf{w}} \right) \buildrel \Delta \over = R_k^{\left( n \right)}\left( {\bf{w}} \right)$, under the trust region constrained by (\ref{trust region}), (\ref{cons_g1}), and (\ref{cons_g2}). The function $R_k^{\left( n \right)}\left( {\bf{w}} \right)$ is concave and matches with the function ${R_k}\left( {\bf{w}} \right)$ at ${{\bf{w}}^{\left( n \right)}}$: \begin{equation}\label{R_n}\tag{12} {R_k}\left( {{{\bf{w}}^{\left( n \right)}}} \right) = R_k^{\left( n \right)}\left( {{{\bf{w}}^{\left( n \right)}}} \right). \end{equation} At the $n$th iteration, we solve the following convex problem with the computational complexity ${\cal O}\left( {{{\left( {LNK} \right)}^3}\left( {2K + 1} \right)} \right)$ to generate the next feasible point ${\bf{w}}^{\left( {n+1} \right)}$: \begin{equation}\label{P2}\tag{13} \mathop {\max }\limits_{\bf{w}} \mathop {\min }\limits_{k = 1, \cdots ,K} \left\{ {R_k^{\left( n \right)}\left( {\bf{w}} \right)} \right\} \;\;\;{\rm{s.}}{\rm{t.}}\;\;\;\text{(\ref{3b}),\;(\ref{trust region}),\;(\ref{cons_g1}),\;(\ref{cons_g2})}. \end{equation} According to (\ref{f_n}) and (\ref{g_n}), we can conclude that $\mathop {\min }\limits_{k = 1, \cdots ,K} {R_k}\left( {{{\bf{w}}^{\left( {n + 1} \right)}}} \right) \ge \mathop {\min }\limits_{k = 1, \cdots ,K} {R_k}\left( {{{\bf{w}}^{\left( n \right)}}} \right),\;\forall n$, which guarantees the monotonicity in convergence. According to \cite{nasir2020resource,nasir2021cell,xing2020matrix1,xing2020matrix2}, it is important to have a proper initial point ${{\bf{w}}^{\left( 0 \right)}}$ with the positive URLLC rate. Thus, we start from any random point ${{\bf{w}}^{\left( 0 \right)}}$ satisfying the convex power constraint $\sum\limits_{k = 1}^K {{{\left| {{{\bf{w}}_{kl}}} \right|}^2}} \le K,\forall l$ and (\ref{trust region}), and then iterate \begin{equation}\label{Shannon}\tag{14} \mathop {\max }\limits_{\bf{w}} \mathop {\min }\limits_{k = 1, \cdots ,K} f_k^{\left( n \right)}\left( {\bf{w}} \right) \;\;\;{\rm{s.}}{\rm{t.}}\;\;\;\text{(\ref{3b})}, \end{equation} The solution obtained by these iterations can be adopted as the feasible initial point ${{\bf{w}}^{\left( 0 \right)}}$. Finally, Algorithm 1 provides the pseudo-code for the applied path-following procedure. \begin{algorithm}[t] \caption{Path-Following Algorithm for Solving Problem (\ref{P1})} \begin{algorithmic}[1] \State \textbf{Initialization}: Iterate the convex problem (\ref{Shannon}) until the convergence to obtain an initial point ${{\bf{w}}^{\left( 0 \right)}}$. Set $n=0$. \State Using (\ref{f_n}) to obtain a concave lower bound for ${f_k}\left( {\bf{w}} \right)$ with constraint (\ref{trust region}). \State Using (\ref{g_n}) to obtain a convex upper bound for ${g_k}\left( {\bf{w}} \right)$ with constraints (\ref{cons_g1}) and (\ref{cons_g2}). \State Using (\ref{R_n}) to obtain a concave lower bound for ${R_k}\left( {\bf{w}} \right)$ under the trust region constrained by (\ref{trust region}), (\ref{cons_g1}), and (\ref{cons_g2}). \State \textbf{Repeat until (\ref{P1}) converges} : Solve the convex problem (\ref{P2}) to generate ${\bf{w}}^{\left( {n+1} \right)}$. \end{algorithmic} \end{algorithm} \subsection{Decentralized Precoding Design} The previously proposed centralized precoding design requires all the APs to upload the instantaneous CSI to the CPU, which put a significant burden on the fronthaul signaling. Besides, the computational complexity of the centralized precoding design can be exceedingly high for a huge number of antennas. As such, there is a desire for designing the precoding in a decentralized manner which only requires local instantaneous CSI at the APs. In practice, the APs can be divided into several non-overlapping cooperation clusters in which the APs in the same cluster shares both the data and the instantaneous CSI to design the precoding vectors. The APs in different clusters only have the knowledge of the statistical CSI, such as the mean and the variance. Note that although APs are divided into clusters, each user is served by all the APs instead of the APs in the cluster which the user resides in. Assume each cluster contains $M$ APs, therefore, there are $L/M$ clusters in the network. As stated before, each AP can obtain the instantaneous CSI of the APs in the same cluster and the statistical CSI of the APs in different clusters. Therefore, the virtual SINR of user $k$ in cluster ${\cal{L}}$ for designing the precoding vector can be expressed as \begin{equation}\label{VSINR-1}\tag{15} \varphi _{k{\cal L}}^{\rm{V}}\left( {{{\bf{w}}_{k{\cal L}}}} \right)\! \! = \!\!\frac{{{{\left| {\sum\limits_{l \in {\cal L}} {{\bf{h}}_{kl}^H{{\bf{w}}_{kl}}} + \sum\limits_{\bar l \notin {\cal L}} {{\mathbb{E}}\left\{ {{\bf{h}}_{k\bar l}^H} \right\}{{\bf{w}}_{k\bar l}}} } \right|}^2}}}{{\sum\limits_{i \ne k}^K {{{\left| {\sum\limits_{l \in {\cal L}} {{\bf{h}}_{kl}^H{{\bf{w}}_{il}}} + \sum\limits_{\bar l \notin {\cal L}} {{\mathbb{E}}\left\{ {{\bf{h}}_{k\bar l}^H} \right\}{{\bf{w}}_{i\bar l}}} } \right|}^2}} \!+ \!{\sigma ^2}}}. \end{equation} Since we consider Rayleigh fading channels, we have ${\mathbb{E}}\left\{ {{\bf{h}}_{k\bar l}^H}\right\} = {\bf{0}}$. Therefore, (\ref{VSINR-1}) can be written as \begin{equation}\label{VSINR-2}\tag{16} \varphi _{k{\cal L}}^{\rm{V}}\left( {{{\bf{w}}_{k{\cal L}}}} \right) = \frac{{{{\left| {\sum\limits_{l \in {\cal L}} {{\bf{h}}_{kl}^H{{\bf{w}}_{kl}}} } \right|}^2}}}{{\sum\limits_{i \ne k}^K {{{\left| {\sum\limits_{l \in {\cal L}} {{\bf{h}}_{kl}^H{{\bf{w}}_{il}}} } \right|}^2}} + {{\sigma ^2}}}}. \end{equation} The decentralized max-min URLLC rate optimization problem can be expressed as \begin{align}\label{P_distributed} &\mathop {\max }\limits_{{\bf{w}}_{\cal L}^{\rm{V}}} \mathop {\min }\limits_{k = 1, \cdots ,K} R_{k{\cal L}}^{\rm{V}}\left( {{\bf{w}}_{\cal L}^{\rm{V}}} \right)\notag\\ &\;{\rm{s.}}{\rm{t.}}\;\;\;\;\;\sum\limits_{k = 1}^K {{{\left| {{{\bf{w}}_{k{\cal L}}}} \right|}^2}} \le {p_{\max}},\forall l \in {\cal L},\tag{17} \end{align} where ${\bf{w}}_{\cal L}^{\rm{V}}$ represents the precoding vectors designed for all the users by APs in cluster ${\cal{L}}$ according to (\ref{VSINR-2}), and $R_{k{\cal L}}^{\rm{V}}\left( {{\bf{w}}_{k{\cal L}}^{\rm{V}}} \right) = \ln \!\left( {1 + \varphi _{k{\cal L}}^{\rm{V}}\left( {{\bf{w}}_{k{\cal L}}^{\rm{V}}} \right)} \right) - \sqrt {\frac{1}{{tB}} \times V_{k{\cal L}}^{\rm{V}}} \times{Q^{ - 1}}\left( \epsilon \right)$, $V_{k{\cal L}}^{\rm{V}} = 1 - \frac{1}{{{{\left( {1 + \varphi _{k{\cal L}}^{\rm{V}}\left( {{\bf{w}}_{k{\cal L}}^{\rm{V}}} \right)} \right)}^2}}}$. The problem (\ref{P_distributed}) can be solved in a similar approach as the one for (\ref{P1}). When the problem (\ref{P_distributed}) has been solved for all the clusters, we can obtain the precoding vector for user $k$ by \begin{equation}\label{w}\tag{18} {{\bf{w}}_k} = {\left[ {{{\left( {{\bf{w}}_{k1}^{\rm{V}}} \right)}^H}, \cdots ,{{\left( {{\bf{w}}_{k\left( {L/M} \right)}^{\rm{V}}} \right)}^H}} \right]^H}. \end{equation} Then, the URLLC rate of user $k$ can be obtained by computing (\ref{URLLC Rate}) using the precoding vector obtained from (\ref{w}). The computational complexity for each iteration in decentralized precoding design is ${\cal O}\left( {{{\left( {\left( {\frac{L}{M}} \right)NK} \right)}^3}\left( {2K + 1} \right)} \right)$. Compared with the centralized precoding, the computational complexity decreased by $M^3$. \section{Numerical Results} In this section, we evaluate the performance of the proposed PFA precoding design for the centralized and the decentralized fashion and investigate the impact of the precoding schemes, the length of transmission duration $t$, the number of antennas equipped at each AP $N$, and the size of the AP cluster $M$ on the URLLC rate. We first describe our adopted simulation parameters. We adopt the similar parameters setting as in \cite{ngo2017cell} as the basis to establish our simulation system model. $L$ APs and $K$ users are deployed in a rectangular area of $96\times48$ $\text{m}^{2}$. In particular, the APs are deployed on a rectangle grid. The area is wrapped around at the edges to avoid the boundary effects \cite{ngo2017cell}. The horizontal spacing between APs are $24$ m, and the vertical spacing is $12$ m. The $K$ users are deployed randomly. We adopt a similar propagation model as in \cite{bjornson2019making}. Besides, we set $L = 16$, $\tau_p = 3$, and $\epsilon = 10^{-5}$. Note that in all the figures, the achievable rates are calculated in bits/s/Hz. \begin{figure}[t!] \centering \includegraphics[width=3in]{centralized_MMSE_vs_PFA.eps} \caption{CDF of the achievable rate achieved by the centralized PFA precoding and the duality-based MMSE precoding with $t = 0.05$ ms, $B = 1$ MHz, $K = 6$, and $N = 4$.} \label{fig_centralized_MMSE_vs_PFA} \end{figure} Fig. \ref{fig_centralized_MMSE_vs_PFA} shows the cumulative distribution functions (CDFs) of the achievable rate per user achieved by the proposed PFA centralized precoding and the duality-based MMSE precoding with $t = 0.05$ ms, $B = 1$ MHz, $K = 6$, and $N = 4$ which is given by \begin{equation}\label{MMSE}\tag{19} {{\bf{w}}_k} = \frac{{{{\bf{v}}_k}}}{\left\| {{{\bf{v}}_{kl}}} \right\|},\;\;\; {{\bf{v}}_k} = p{\left( {\sum\limits_{i = 1}^K p {{{\bf{h}}}_i}{\bf{h}}_i^H + {\sigma ^2}{{\bf{I}}_{LN}}} \right)^{ - 1}}{{{\bf{h}}}_k}, \end{equation} where $p$ is the transmit power intend for each user at each AP. It can be observed that the proposed PFA centralized precoding scheme performs very well. The achievable rate per user distribution with the proposed PFA centralized precoding almost uniformly outperforms the duality-based MMSE precoding, and the former is more steeper. Specifically, applying the PFA centralized precoding leads to 32\% improvement in terms of average URLLC rate and 65\% improvement in terms of 95\%-likely URLLC rate. Note that the duality-based MMSE precoding in (\ref{MMSE}) is only a heuristic solution utilizing the uplink-downlink duality and cannot effectively minimize the MSE ${\mathbb{E}}\left\{ {\left. {{{\left| {{y_k} - {s_k}} \right|}^2}} \right|{{{\bf{h}}}_{kl}}} \right\}$. Moreover, compared with the PFA centralized precoding, the duality-based MMSE precoding has a lower computational complexity since it only requires $\frac{{{N^2}{L^2}K + NLK}}{2} + \frac{{{N^3}{L^3} - NL}}{3} + {N^2}{L^2}$ complex-valued multiplications. Besides, as expected, the performance of Shannon rate serves as a performance upper bound of the URLLC rate at the expense of infinitely long code length. \begin{figure}[t!] \centering \includegraphics[width=3in]{T_revise.eps} \caption{Optimized 95\%-likely achievable rate versus the transmission time $t$ with $N = 4$ and $B = 1$ MHz.} \label{fig_T} \end{figure} Fig. \ref{fig_T} plots the optimized 95\%-likely achievable rate by Algorithm 1 versus the transmission time $t$ with $N = 4$ and $B = 1$ MHz . As expected, the URLLC rate increases along with the transmission time $t$ according to the expression of the URLLC rate. Note that the Shannon rate is fixed since it is computed assuming a sufficient long blocklength, e.g., $t \to \infty$. Besides, when the number of user increases from 6 to 15, we can observe that the achievable rate decreases since there are more users competing for limited resources that reduces the flexibility of the resource allocation for effective beamforming. The performance gap between the Shannon rate and URLLC rate is also reduced with the increasing number of users as the performance of these two scheme is limited by the user with the weakest channel gain. \begin{figure}[t!] \centering \includegraphics[width=3in]{URLLC_revise.eps} \caption{CDF of the URLLC rate achieved by the PFA precoding in the centralized and decentralized way with $t = 0.05$ ms and $N = 4$.} \label{fig_URLLC} \end{figure} Fig. \ref{fig_URLLC} shows the performance of the PFA precoding in the centralized and decentralized fashion in terms of the URLLC rate. The curve ``C-PFA'' represents the URLLC rate computed using the centralized PFA precoding design. Also, the curve ``D-4-cluster'', ``D-2-cluster'', and ``D-16-cluster'' stand for the performance of the decentralized PFA precoding design with 4 APs, 8 APs, and 1 AP in each cluster, respectively. The first observation from Fig. \ref{fig_URLLC} is that compared with the centralized PFA precoding, the 95\%-likely URLLC rate with the decentralized PFA precoding is generally lower. This is because when the decentralized PFA precoding is adopted, only the instantaneous CSI within the cluster and the statistical CSI outside the cluster are used for optimization in each cluster. As there is a mismatch between the statistical CSI and the instantaneous CSI, the optimization for the decentralized setting is less effective for the utilization of the system resources. Besides, the performance of the 2-cluster decentralized PFA precoding outperforms the centralized PFA precoding for the strong users. The reason is that the performance of the centralized PFA precoding is always limited by the worst-case users, since substantial resources are allocated to equalize all the SINRs, while the decentralized PFA precoding benefits from being more scalable. Compared with the 2-cluster decentralized PFA precoding, when adopting the 4-cluster or 16-cluster decentralized PFA precoding, the mismatch between the statistical CSI and the instantaneous CSI is pronounced, so the performance is the worse. Specifically, compared with the centralized precoding, the 95\%-likely URLLC rate is reduced from 16.73 bits/s/Hz to 13.25 bits/s/Hz with the 2-cluster decentralized PFA precoding and to 8.95 bits/s/Hz with the 4-cluster decentralized PFA precoding. Moreover, when the fully distributed 16-cluster decentralized PFA precoding is adopted, the 95\%-likely URLLC rate is only 0.17 bits/s/Hz. However, since the computational complexity is also reduced, the performance loss of adopting the 2-cluster decentralized PFA precoding instead of the centralized precoding is tolerable. In particular, the 2-cluster decentralized PFA precoding achieves 80\% of the 95\%-likely URLLC rate, 89\% of the average URLLC rate, and 12\% of the computational complexity of the centralized precoding. The second observation is that the CDF of users' URLLC rate is not as steep as the counterpart when the decentralized PFA precoding design is adopted. The reason is that the optimization target of each cluster contains virtual SINR rather than the actual SINR, leading to under utilisation of system resources. \section{Conclusion} In this correspondence, we considered the precoding design in the cell-free massive MIMO system for URLLC in the centralized and decentralized fashion. PFA was designed for maximizing the users' minimum URLLC rate and its performance was evaluated with different settings of the transmission time, the number of antennas per AP, and the size of the AP cluster. Simulation results showed that the centralized PFA precoding design can effectively improve the performance of 95\%-likely achievable rate and the decentralized PFA precoding with a reasonable setting can approach the performance of the former but with low computational complexity. In the future, we will jointly optimize the precoding vector, the cluster formation, and the number of APs in each cluster in a distributed fashion for URLLC. \bibliographystyle{IEEEtran}
{'timestamp': '2022-09-30T02:06:07', 'yymm': '2209', 'arxiv_id': '2209.14504', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14504'}
arxiv
\section{Introduction} \label{sec:introduction} Recent work on GPT-2~\citep{gpt2} and GPT-3~\citep{gpt3} have shown that large language models possess few-shot learning capabilities and zero-shot instruction following capabilities, despite only being pre-trained with a self-supervised causal language modeling objective (which is to predict the next token). An arbitrary task can be converted into a natural language task specification, often called a \textit{prompt}. Prompting a task in this way makes its format similar to the language modeling objective used to pre-train large language models. In the zero-shot setting, this prompt contains just the task with instructions, whereas in the few-shot setting, the prompt contains both the task and several example demonstrations. When a language model is tasked to generate text to complete this prompt, it can perform the task in the process. The broader paradigm of reframing all tasks as text generation is known as \textit{prompt-based learning}. In the few-shot setting, the learning that occurs from examples provided in a given prompt (the context) is known as \textit{in-context learning} \citep{promptingsurvey}. In the zero-shot setting, models perform \textit{instruction following} \citep{instructgpt}, with their performance guided through natural language instructions provided in the prompt. Emergent prompt-based learning capabilities have mainly been demonstrated for unidirectional language models. Bidirectional language models have stronger learned representations \citep{bert,xlm,t5}; however, they have not been able to broadly demonstrate the same few-shot in-context learning capabilities or zero-shot instruction following capabilities due to the incompatibility bidirectional denoising pre-training objectives have with the prompting paradigm. Instead, they typically require fine-tuning. Bidirectional models are not able to generate long, fluent completions to prompts since they are usually only trained to output single tokens or short spans of text to in-fill masked tokens during pre-training. We discuss this more in-depth in Section \ref{sec:directionality}. Today, language model architects are faced with a difficult choice between unidirectional or bidirectional models. The authors of GPT-3 lay out this design dilemma in \citet{gpt3}: \begin{displayquote} \small{``GPT-3 has several structural and algorithmic limitations ... as a result our experiments do not include any bidirectional architectures or other training objectives such as denoising ... our design decision comes at the cost of potentially worse performance on tasks which empirically benefit from bidirectionality ... making a bidirectional model at the scale of GPT-3, and/or trying to make bidirectional models work with few- or zero-shot learning, is a promising direction for future research, and could help achieve the `best of both worlds'.''} \end{displayquote} \fewshotfigure In this paper, we directly address this dilemma. We contribute a new technique, \textsc{Sap} (\textbf{S}equential \textbf{A}utoregressive \textbf{P}rompting), that enables bidirectional language models to take advantage of prompting and allows them to perform at the level of unidirectional models in few- or zero-shot learning without fine-tuning. \textsc{Sap} iteratively prompts bidirectional models, concatenating previous generations back into the prompt, to produce longer generations from models that were only pre-trained to output short, mask-infill spans. We acknowledge efficiency concerns in Section \ref{sec:conclusion} and we discuss the importance and impact of \textsc{Sap} and its results to the field regardless of those concerns. Using the machine translation task as an in-depth case study, we empirically demonstrate mT5~\citep{xue-etal-2021-mt5}, a bidirectional language model, used with \textsc{Sap} outperforms its unidirectional counterparts, GPT-3 and XGLM~\citep{gpt3,xglm} in both the few-shot and zero-shot settings, while utilizing approximately 50\% fewer parameters. We then examine \textsc{Sap}'s effectiveness on other tasks such as question answering and summarization, demonstrating that bidirectional models can be prompted for tasks beyond machine translation. Our work hints at the possibility of more efficient and performant few-shot learners through pre-trained language models that incorporate bidirectionality. We discuss this impact and outline future research directions to this end in Section \ref{sec:conclusion}. In summary, our key contributions are: \begin{enumerate} \item{We introduce \textsc{Sap}, a technique that enables bidirectional language models to work with few-shot and zero-shot prompt-based learning at a level that exceeds unidirectional models. Our results demonstrate in-context learning and instruction following are emergent properties of a broader class of language models, rather than only unidirectional models, addressing a long-standing challenge in language model design and use.} \item{We perform an in-depth study of the effectiveness of a bidirectional language model, mT5, with \textsc{Sap} on the machine translation task. Evaluating over 14 language pairs, despite using approximately 50\% fewer parameters than GPT-3 and XGLM, we find \textsc{Sap} with mT5 has improved average few-shot and zero-shot performance over all language pairs, and especially has improved performance on individual low-resource language pairs. } \item{We propose a range of improvements---filtering, prompt ensembling, and English-centric bootstrapping---to the unsupervised machine translation procedure outlined by \citet{gpt3unsupervised} to better adapt the bootstrapping process for unsupervised low-resource machine translation.} \item{We assess \textsc{Sap}'s performance on the tasks of question answering and summarization, and we find the technique enables few-shot in-context learning and zero-shot instruction following capabilities of bidirectional models in tasks beyond machine translation.} \end{enumerate} \section{Related Work} \subsection{Unidirectional and Bidirectional Language Models} \label{sec:directionality} Transformer-based language models \citep{attention} can be broadly categorized into bidirectional and unidirectional models. Bidirectional models are models that use a denoising pre-training objective (such as masked language modeling), allowing them to utilize \textit{bidirectional} context when learning language representations. Unidirectional language models are models with a causal---or a left-to-right---language modeling objective (such as next token prediction), restricting them to be \textit{unidirectional} when learning representations \citep{promptingsurvey}. The T5 family of models, such as T5 v1.1 and mT5, and BART-style models \citep{bart} are bidirectional, while GPT-style models, such as GPT-2, GPT-3, and XGLM are unidirectional. Usually, but not always, bidirectional models are paired with an encoder-decoder architecture, while unidirectional models are paired with a decoder-only architecture \citep{bert, t5,xue-etal-2021-mt5,gpt2,gpt3,xglm,bigsciencearchobjective}. BERT-style models are an example of an exception. BERT-style models are bidirectional, but they cannot be easily utilized for prompting and text generation since they are encoder-only \citep{bertspeak}. Of the available bidirectional models, T5 models are the only models with a long enough sequence length (unlimited with their relative position embeddings) to support many in-context prompt examples and with a large enough number of parameters to be effective zero-shot and few-shot performers \citep{gpt2,gpt3,scaling}. See Appendix \ref{sec:survey} for a survey of popular open source language models. Aside from sequence length and model size, BART is not purely trained on the span denoising objective \textsc{Sap} exploits, but is also trained on many other corruption objectives like ``Sentence Permutation.'' For this reason, we utilize the T5 models for experiments and leave the exploration of the generalization of \textsc{Sap} to other models, that could become available later, as future work. \citet{bert} and \citet{t5} have both shown that after transfer learning, bidirectional denoising pre-training objectives such as BERT's masked language modeling and T5's random span corruption outperform causal language modeling on downstream tasks. \citet{gpt3} concedes this to be a potential source of weakness for the GPT-3 model on certain tasks where bidirectionality is important. Despite the advantages of denoising objectives, prompting and in-context learning capabilities have not been broadly demonstrated for bidirectional language models like T5, disqualifying them when few-shot in-context learning and zero-shot instruction following is desired. \citet{lester-etal-2021-power} explains this may be because: \begin{displayquote} \small{``...a T5 model pre-trained exclusively on span corruption, such as T5.1.1, has never seen truly natural input text (free of sentinel tokens), nor has it ever been asked to predict truly natural targets''} \end{displayquote} In other words: when pre-trained on their denoising objectives, language models like T5 that utilize bidirectionality are only conditioned to output a single token or short spans of tokens (the in-fill of the mask) rather than full and complete sentences; this inhibits their ability to generate arbitrary-length natural responses to a variety of prompts. Despite the stronger learned representations of bidirectional models, their shortcomings in prompt-based learning motivate \citet{gpt3} and \citet{xglm} to explicitly choose unidirectional models over bidirectional models for GPT-3 and XGLM. \subsection{Prompting Bidirectional Language Models} \label{sec:priortechniques} Unlike prior approaches to incorporate prompt-based learning capabilities into bidirectional models, our technique, \textsc{Sap}, neither requires fine-tuning, weight updates, nor supervised instruction-tuning datasets. It demonstrates that bidirectional language models develop \textit{innate} few-shot learning capabilities with in-context learning and zero-shot instruction following capabilities. \paragraph{Cloze-style prompts} \citet{cloze} and \citet{cloze2} find that bidirectional models such as RoBERTa and ALBERT \citep{roberta,albert} can be ``prompted'' with cloze-style phrases. They propose a few-shot training paradigm called \textsc{Pet} where the model's predicted mask in-fill, called a ``verbalizer,'' is used to label fine-tuning examples for the model. These verbalizers are only a single word or a few words, e.g. ``yes'', ``no'', ``amazing'', ``worse''. \citet{electrazero} follow a similar technique, but with the ELECTRA model \citep{electra}. These works primarily demonstrate zero-shot effectiveness on classification tasks such as sentiment analysis, rather than more challenging generation tasks such as machine translation or question answering. Furthermore, they still require fine-tuning for effective few-shot learning, a major limitation that does not achieve the prompt-based in-context learning or instruction following abilities of unidirectional models such as GPT-3. \paragraph{LM-adaptation} \citet{lester-etal-2021-power} finds some success with prompting the T5 v1.1 models after continued pre-training on the unidirectional prefix-LM objective described in \citet{t5}. The resulting model, T5 v1.1 LM-adapted (T5+LM), is described as a late-stage adaptation to a unidirectional objective. Adaptation requires performing weight updates, and given that representations learned by the original denoising objective have been shown to be superior \citep{t5}, we hypothesize that such an adaptation could degrade the quality of the learned representations. \paragraph{Prompt-tuning} \citet{lester-etal-2021-power} and \citet{prefixtuning} find by fine-tuning only a portion of the parameters in an otherwise frozen pre-trained bidirectional language model, a ``soft prompt'' can be discovered through backpropagation. Soft prompts are prompts discovered in the embedding space of the model and are not grounded in natural language. As a form of parameter-efficient fine-tuning \citep{parameff}, this approach requires training the prompt embeddings and benefits from initialization from LM-adaptation, both of which require performing weight updates. The nature of soft prompts lacking grounding in natural language makes their use and flexibility limited, a stark difference from the instruction following capabilities of unidirectional models \citep{promptingsurvey}. \paragraph{Instruction-tuning} Language models can be fine-tuned on a supervised dataset consisting of natural language prompts and their respective target completions \citep{flan,t0,instructgpt,metalicl}. This ``instruction-tuning'' technique allows these models to improve performance on instruction following and therefore exhibit few-shot and zero-shot capabilities through prompting. The T0 model in particular is an instruction-tuned version of the T5+LM model~\citep{lester-etal-2021-power}, augmenting it with prompting capabilities. While instruction-tuning likely bolsters the instruction following performance of a model, we hypothesize that by instruction-tuning, the T0 model is to some degree surfacing the innate prompting ability that the bidirectional model already has. We provide evidence towards this hypothesis by demonstrating that bidirectional models can be prompted without instruction-tuning. \subsection{Unsupervised Machine Translation through Prompting} GPT-2~\citep{gpt2} and GPT-3~\citep{gpt3} have shown it is possible to perform few-shot machine translation and unsupervised zero-shot machine translation with large language models using prompting and in-context learning. The XGLM model~\citep{xglm} trains a similar architecture to GPT-3 on a diverse multilingual corpus, resulting in improvements on few-shot, low-resource machine translation. \citet{gpt3unsupervised} introduce bootstrapping and self-amplification techniques to further improve unsupervised zero-shot performance on machine translation. \firstwordablationtable \section{Few-shot Machine Translation} \label{sec:few-shot} To motivate our method for enabling few-shot in-context learning in bidirectional language models, we first focus on applying $\text{mT5}_\text{3.7B}$ (mT5-XL) \citep{xue-etal-2021-mt5} to the machine translation task as an in-depth case study since this task benefits greatly from bidirectionality \citep{xlm,xglm}. We largely follow the procedure of \citet{xglm}, except with mT5 and \textsc{Sap}. mT5 is a massively multilingual bidirectional model trained on random span corruption, a variant of masked language modeling. We demonstrate that with \textsc{Sap}, mT5 can perform few-shot machine translation using prompting and in-context examples with no fine-tuning. We first formulate a prompt format that utilizes its random span masking scheme to complete the translation task, such as: \\[.5em]\centerline{\fbox{\begin{minipage}{15.5em} \small{ Translate Spanish to English.\\ Spanish: El clima es soleado.\textcolor{gray}{</s>}\\ English: The weather is sunny.\textcolor{gray}{</s>}\\ Spanish: Mi perro es un cachorro.\textcolor{gray}{</s>}\\ English: My dog is a puppy.\textcolor{gray}{</s>}\\ Spanish: Los árboles son importantes.\textcolor{gray}{</s>}\\ English: \textcolor{red}{<X>} } \end{minipage}}} \subsection{Sequential Autoregressive Prompting (\textsc{Sap}) Technique} By requiring mT5 to in-fill \textcolor{red}{<X>}\footnote{We use the first sentinel token from the mT5 vocabulary as our mask token.}, we are effectively asking it to translate the Spanish sentence. However, due to the limitations of the denoising pre-training objective on prompting (described in Section \ref{sec:directionality}), we observe mT5 often outputs a partial translation of the beginning of the source sentence, rather than the full translation. To overcome this, we prompt mT5 $T$ times until the model generates a stop token \textcolor{gray}{</s>}\footnote{We repurpose the 100th sentinel token from the mT5 vocabulary as our stop token.}, resulting in a longer translation. At each time step of iteration, we keep the first word generated (using the space character as delimiter) and concatenate it into the last line of the prompt to use in the next time step. This iterative prompting enables us to extract longer generations. Formally, we denote the generation at each time step $t$ as $G_t$. We denote the first word generated at each time step as $F_t$, where $F_t = \texttt{SPLIT}(G_t, \texttt{" "})\texttt{[0]}$. We update the prompt at each time step $P_t$ to include the cumulative generation from all previous time steps concatenated in the last line of the prompt. The prompt used at each time step $P_t$ is as follows: \\[.5em]\centerline{\fbox{\begin{minipage}{15.5em} \small{ Translate Spanish to English.\\ Spanish: El clima es soleado.\textcolor{gray}{</s>}\\ English: The weather is sunny.\textcolor{gray}{</s>}\\ Spanish: Mi perro es un cachorro.\textcolor{gray}{</s>}\\ English: My dog is a puppy.\textcolor{gray}{</s>}\\ Spanish: Los árboles son importantes.\textcolor{gray}{</s>}\\ English: \texttt{CONCAT}($F_0$, \ldots, $F_{t-1})$ \textcolor{red}{<X>} } \end{minipage}}}\\[.5em] In Table \ref{table:firstword-ablation}, we also consider sequential prompting---concatenating the entire generation $G_t$ instead of just the first word of the generation $F_t$---but find that it produces significantly inferior results as low-quality tokens are generated after the first word. By conditioning the model to generate the next word in the translation based on previous words generated, this technique resembles autoregression. mT5 is already autoregressive, but it is autoregressive only at the decoder level. Adding previously generated words back into the prompt allows them to pass through the encoder layers as well. For this reason, we call this technique \textsc{Sap} (\textbf{S}equential \textbf{A}utoregressive \textbf{P}rompting). To provide a signal to stop generation, we add our stop token at the end of each example in the prompt. We stop prompting after the model generates a stop token.\footnote{We also implement a basic post-processing step to strip any generated text after a repeated sequence of three or more tokens following settings available in common decoding implementations \citep{transformers}.} The overall process is graphically depicted, with stop tokens omitted, in Figure \ref{fig:fewshot}. \subsection{Results} \label{sec:fewshot-results} Following \citet{xglm}, we evaluate our technique on 14 languages from the FLORES-101 dataset \citep{flores101} that span high-resource and low-resource languages\footnote{HR: English (en), German (de), French (fr), Catalan (ca), Finish (fi), Russian (ru), Bulgarian (bg), Chinese (zh); LR: Korean (ko), Arabic (ar), Swahili (sw), Hindi (hi), Malayalam (my), Tamil (ta)}. We evaluate SentencePiece BLEU (spBLEU) \citep{flores101} in every direction, leading to an evaluation over 182 language pairs in total. Abbreviated results can be found in Table \ref{table:fewshot-flores-results-abbrev}, and the matrix of full results can be found in Appendix \ref{sec:flores-results}. Examples generations can be found in Appendix \ref{sec:examplegenerations}. On an average spBLEU score over all 182 pairs, our model matches the performance of the unidirectional XGLM and GPT-3 models---with approximately 50\% fewer parameters and 16x fewer examples. Notably, our technique has significant improved performance on language pairs with at least one low-resource language, while trailing only slightly on high-resource pairs. \bootstrapfigure \section{Unsupervised Zero-shot Machine Translation} \label{sec:zero-shot} To extend our in-depth case study on the machine translation task, we now perform fully unsupervised zero-shot machine translation with \textsc{Sap} and mT5 following the procedure of \citet{gpt3unsupervised}, which uses a self-amplification technique to boost performance. A comparison of zero-shot performance without self-amplification can be found in Appendix \ref{sec:selfamp-ablation}. We ultimately will replace the examples in the few-shot prompt with synthetic parallel examples. These synthetic parallel examples are bootstrapped in a completely unsupervised fashion using a zero-shot translation prompt with no examples. The zero-shot prompt format looks like: \\[.5em]\centerline{\fbox{\begin{minipage}{15.5em} \small{ Translate Spanish to English.\\ Spanish: Los árboles son importantes.\textcolor{gray}{</s>}\\ English: \textcolor{red}{<X>} } \end{minipage}}}\\[.5em] We adapt the bootstrap process of \citet{gpt3unsupervised} to retrieve these synthetic parallel examples. The process, as depicted in Figure \ref{fig:bootstrap}, consists of three steps: \begin{itemize}[leftmargin=*] \item[] \textbf{Step 1 (sampling)}: Generate synthetic parallel examples using a zero-shot translation prompt (with no examples) to translate sentences from a monolingual source language corpus. \item[] \textbf{Step 2 (filtering)}: Filter out low-quality synthetic examples to keep only high-quality synthetic examples using an unsupervised scoring technique (discussed in Section \ref{sec:mt5score}). \item[] \textbf{Step 3 (self-amplification)}: Translate any source language sentence desired using these synthetic parallel examples in the few-shot prompt. \end{itemize} We iteratively run multiple rounds of this bootstrap by repeating step 2 and step 3 to form a better few-shot prompt. The few-shot prompt after self-amplification is used to translate more source language sentences. These are then filtered using the scoring technique used in step 2 and so on. In our experiments, we run four bootstrapping rounds and sample 100 source language sentences from the training dataset in each round. Note that none of the target language parallel sentences from the training dataset are used in this zero-shot setting; following \citet{gpt3unsupervised}, only the source language sentences are used. \subsection{Filtering Down to High-quality Translations} \label{sec:mt5score} The filtering step of the bootstrap requires an unsupervised scoring method for assessing the quality of translations. We first use \texttt{{langdetect}}\footnote{\url{https://pypi.org/project/langdetect/}}, a language identifier, as a simple rule-based filter to ensure the generated text is in the desired target language. We then score the remaining generated translations against their corresponding original sentence in the source language. For this unsupervised multilingual similarity metric, we utilize the BERTScore~\citep{bertscore} algorithm with $\text{mT5}_{\text{300M}}$ (mT5-small)\footnote{The BERTScore Python library~\citep{bertscore} directly supports using mT5 instead of BERT.}, dubbing it ``mT5Score''. We ablate the use of mT5Score as a filter in Appendix \ref{sec:mt5score-ablation}. We take the top two synthetic parallel examples with the highest mT5Score in the filtering step and use those as synthetic few-shot examples in the prompt in the self-amplification step. \subsection{Translating with an Ensemble of Prompts} Because the two examples used in the prompt can greatly affect the quality of the generated translations, some prompts containing low-quality synthetic examples may cause poor translations for certain sentences. To combat this and reduce variation in performance, we keep the top $N$ synthetic examples instead of two synthetic examples. We use these to form $\frac{N}{2}$ different few-shot prompts with two synthetic parallel examples each. Each sentence in the test set is then translated with these $\frac{N}{2}$ different prompts to produce $\frac{N}{2}$ translations. The best translation of the $\frac{N}{2}$ translations is chosen in a fully unsupervised manner with mT5Score, as done in the filtering step of the bootstrap. We find this ensembling technique helps make unsupervised zero-shot performance competitive with few-shot performance. Experiments varying the number of prompts in the ensemble can be found in Appendix \ref{sec:promptensemble-ablation}. Unless otherwise stated, we use a 4 prompt ensemble in this paper: $\frac{N}{2} = 4$. In sum, we sample and zero-shot translate 100 sentences from a monolingual corpus, keep the top eight synthetic parallel examples scored by mT5Score, and use them to form four few-shot prompts, each of which has two synthetic examples. \fewshotfloresresultstableabbrev \subsection{English-centric Bootstrapping} \label{sec:englishcentric} While \citet{gpt3unsupervised} only performed a bootstrap on English-French and French-English pairs, we perform bootstrapping on some language pairs which may contain at least one low-resource language or non-English language. It has been found that multilingual language models perform best in English, due to imbalance of languages in the pre-training corpus where English has the highest amount of data \citep{xglm}. Therefore, when running the bootstrap on various language pairs, we modify the bootstrap to favor generating English, or pivot through English when neither the source nor target language is English. Ablation experiments can be found in Appendix \ref{sec:englishcentric-ablation}. We outline examples of our modified English-centric bootstrapping process for various language pairs in Appendix \ref{sec:englishcentric-examples}. \subsection{Results} We report results with the same method used for our few-shot evaluation. Abbreviated results can be found in Table \ref{table:fewshot-flores-results-abbrev} and the matrix of full results can be found in Appendix \ref{sec:flores-results}. In this unsupervised setting, we find our zero-shot results exceed our 2-shot results; furthermore, they significantly exceed the performance of the XGLM and GPT-3 results reported in \citet{xglm} on an average spBLEU score over all 182 pairs (+1.0 spBLEU). Again, we note strong performance on language pairs that contain one or more low-resource languages. Intuitively, we can explain the zero-shot performance surpassing the few-shot performance through our use of prompt ensembling in the zero-shot setting. As prompt ensembling utilizes four prompts with two synthetic parallel examples each, it essentially uses eight synthetic examples, instead of just two real examples in the few-shot setting. Our synthetic examples are nearly as high-quality as real examples (similar to the findings of \citet{gpt3unsupervised}) as demonstrated by Appendix \ref{sec:promptensemble-ablation}. Prompt ensembling not only reduces performance variation if low-quality synthetic examples are selected during the bootstrap, but it also boosts performance beyond the few-shot setting as demonstrated by Table \ref{table:firstword-ablation} and the Appendix \ref{sec:promptensemble-ablation} experiments (Russian-English 26.9 $\rightarrow$ 27.9 spBLEU). In Appendix \ref{sec:zeroshot-results}, we also evaluate on WMT14~\citep{wmt14} to compare with the results reported in \citet{gpt3unsupervised} using $\text{GPT-3}_\text{175B}$. \section {Other Language Generation Tasks} \label{sec:other-tasks} We next demonstrate that bidirectional models have a generalized ability, beyond machine translation, to be prompted for arbitrary tasks. We evaluate their performance on question answering and summarization language generation tasks. Example generations can be found in Appendix \ref{sec:examplegenerations}. \subsection{Question Answering} We compare the zero-shot question answering performance of mT5 against XGLM on the XQuAD dataset \citep{xquad}, a multilingual question answering dataset, in Table \ref{table:xquad}. We find mT5 with \textsc{Sap} outperforms XGLM significantly (+1.7 EM, +12.3 F1). In Table \ref{table:squad}, we also compare against T5+LM~\citep{lester-etal-2021-power}. As T5+LM is English-only, we compare using the English-only SQuAD v1.1 dataset \citep{squad}. We still utilize the multilingual mT5 with \textsc{Sap} due to observations that the English-only T5 v1.1 model does not perform as well as mT5 in prompt-based learning\footnote{We discuss this observation in more detail in Appendix \ref{sec:t5v11observation}.}. \textsc{Sap} achieves +6.7 EM and +5.6 F1 over T5+LM. \textsc{Sap}, as an iterative technique, is useful for producing long generations from a bidirectional model for tasks such as machine translation. We find, however, it still has utility on tasks like question answering where answer generations are shorter spans of text. We ablate utilizing \textsc{Sap} with mT5 against the simple approach of prompting mT5 once and using the mask in-fill generated on SQuAD v1.1. In the few-shot (16-shot) setting, we find that utilizing \textsc{Sap} still markedly improves performance (+12.5 EM, +5.5 F1) even on short-form generation tasks like question answering. \xquadtable \squadandsummarizationtable \subsection{Summarization} We next perform summarization on the CNN/Daily Mail dataset \citep{cnndailymail,cnndailymail2,cnndailymail3} as another long-form text generation task. We compare mT5 with T5+LM and ablate the usage of \textsc{Sap} once again in Table \ref{table:summarization}. In the few-shot setting, we find a significant lead against T5+LM (+7.1 ROUGE-L). Of that +7.1 ROUGE-L boost, the ablation of our usage of \textsc{Sap} finds the technique itself is responsible for a large component of the boost (+5.3). \section {Conclusion and Future Directions} \label{sec:conclusion} We demonstrate \textsc{Sap} with the bidirectional mT5 model enables few-shot and zero-shot machine translation and zero-shot multilingual question answering, outperforming unidirectional models despite using far fewer parameters and examples. Our results suggest that the bidirectional representations learned by models such as mT5 contribute to this improved performance. Still, we concede that our results do not conclusively prove bidirectionality explains the difference in performance. Beyond bidirectionality and pre-training objectives, mT5, XGLM, and GPT-3 further differ in architecture, pre-training corpus, and hyperparameters. A complete ablation experiment would be computationally expensive, and we leave this as future work. The main limitation of \textsc{Sap} lies in its computational efficiency, discussed further in Appendix \ref{sec:limitations} along with potential mitigations. Importantly, these results demonstrate bidirectional models possess few-shot in-context learning and zero-shot instruction following capabilities innately, without the post-hoc modifications required by prior work. Our results finally contribute strong evidence towards the strength and efficiency of bidirectional pre-training objectives and motivate further research into bidirectional architectures, pre-training objectives, and language models designed and optimized for prompting and few-shot learning. We hypothesize these future bidirectional training schemes could yield an approach that overcomes the efficiency limitations of \textsc{Sap}, while maintaining the performance and parameter size reduction benefits. Concurrent recent work that compares or mixes unidirectional and bidirectional pre-training objectives \citep{bigsciencearchobjective,unifying,alexatm} already provide some early evidence towards this hypothesis.
{'timestamp': '2022-09-30T02:06:00', 'yymm': '2209', 'arxiv_id': '2209.14500', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14500'}
arxiv
\section{Introduction} \label{section:intro} In recent years, deep neural networks (DNNs) have grown in size from 3,246 trainable parameters in 1989 (LeNet \cite{LetNet}) to tens of millions of parameters (AlexNet \cite{AlexNet}, ResNet \cite{he2015resnet}). This has led to a massive increase in networks' ability to capture complex patterns from input data. However, this has also led to the risk of overfitting training data. As an extreme case, Zhang et al. \cite{Overfitting} showed that any sufficiently large network can memorize the labels for instances in a dataset, even if they are randomly assigned. This effect is more pronounced when there is insufficient training data for a network or the labels associated with the data are noisy. The latter case is common when training data and their annotations are automatically crawled from the Internet. Conceptually, an instance of training data could have two types of features: \begin{itemize} \item \emph{Class-wise Discriminative Features}: These are features that are useful for determining the class that each sample belongs to. For example, a picture of a cat may be identified as such by the presence of whiskers. \item \emph{Identity-wise Discriminative Features}: These are features that are useful for determining precisely which sample is which. For example, the length and number of whiskers would help to identify a specific cat. \end{itemize} A deep neural network can use both features to perform empirical risk minimization. However, the second type of feature is less likely to generalise well to unseen data. Relying on it could cause overfitting. Motivated by the above insight, this paper proposes a method to encourage the learning of Class-wise Features whilst discouraging the learning of Identity-wise Features. Intuitively, this leads to classifiers only using those features that are both discriminative across classes and common within each class. We do this by assigning each sample a unique ID and training a network that can classify samples whilst failing to determine the individual identity of each sample. This proposed process is performed adversarially in a manner akin to the DANN method \cite{ganin2015domainadversarial, ganin2015unsupervised} in domain adaptation. DANN maintains a domain classifier that can identify the domain of the input data while adversarially learning features that can reduce the discriminative power of the domain classifier. In our case, we essentially treat each individual sample as its own domain. In order to perform adversarial training, it was necessary to implement a gradient reversal layer (GRL) as described by Ganin et al. \cite{ganin2015domainadversarial}. However, proper adversarial training requires a balance between the regular backpropagation of the classification task and the reversed backpropagation of the sample identification task. This requires careful fine-tuning. While it is possible to discover a training schedule that maintains this balance, it is tricky and subject to error. We therefore also propose a method called Dynamic Gradient Reversal (DGR), which requires no tuning. Experimentation shows that DGR can be used anywhere a GRL is used. We further explore two use cases for ASIF. The first one is to improve the generalisation performance of a deep neural network when training with a small amount of data. The second one is to increase the resilience against inaccurately labelled training data. In the second case, we show that the proposed method can be directly applied as a regularization approach or can be used to identify the incorrect class labels. In short, the main contributions of this paper are: \begin{itemize} \item A technique to reduce the tendency for large networks to overfit to specific samples in the training data. \item A training method that maintains or improves accuracy while reducing the number of class-variant features to the absolute minimum. \item A gradient reversal algorithm that can be used anywhere a DANN-style Gradient Reversal Layer is used. \end{itemize} The source code behind these experiments is available at \url{https://github.com/avichapman/identity-feature-suppression}. The rest of the paper is organised as follows. In Sect. \ref{RelatedWorks}, we provide further background in the problem area. We then describe the methodology behind our approach in Sect. \ref{Method}. In Sect. \ref{Experiments}, we describe the experiments performed to explore the characteristics of ASIF. Finally, in Sect. \ref{Conclusions} we summarise our results and suggest fruitful directions for future work. \section{Related Works} \label{RelatedWorks} \subsection{Domain Adaptation} Domain Adaptation is a family of techniques for learning a task on data from one domain and applying that task to another domain \cite{Wilson2020Survey}. Pan and Yang \cite{PanSurvey2010} define a 'domain' as consisting of a feature space and a marginal probability distribution of the features across the population. Domain Adaptation works on the assumption that the feature space stays the same. That is, the things about a data sample that can be measured never change. For example, in any given country it is possible to measure the probability of a pregnancy resulting in fraternal twins. However, the marginal probability distribution between domains can vary widely. Applied to the aforementioned example, this would mean that the probability of fraternal twins in one country may be very different from that same measurement in another country. Several recent works \cite{Dredze2009MultidomainLB, joshi-etal-2012-multi, hassan2018unsupervised} have attempted to take advantage of data across all domains to learn to predict within a single domain. Sebag et al. \cite{schoenauersebag2019multidomain} attempted to use adversarial learning to learn the distributions of the various domains in the training set. Wilson, Doppa and Cook \cite{Wilson2020} proposed a method called Convolutional deep Domain Adaptation model for Time Series data (CoDATS), which took advantage of adversarial learning to encourage a feature extractor network to learn features that were domain invariant. The CoDATS network consisted of three parts: a feature extractor, a classifier and a domain predictor. The classifier was trained against labelled data for a source domain. At the same time, the domain predictor was trained to predict whether a given sample belonged to the source domain or a target domain. They used a gradient reversal layer (DGR) to create an adversarial relationship between the two tasks. The DGR worked by passing a feature vector through untouched when feeding forward and reversing the gradient when backpropagating. Using this technique, Wilson et al. were able to demonstrate superior classification on the target domain, despite the network having never seen labels for the target domain. However, this technique is limited in that it requires each domain to have a label, which doesn't work in blurry edge cases or when the target domain is unknown at training time. \subsection{Learning from Noisy Labels} \label{section:RelatedWorksNoisyLabels} In real life datasets, perfect label accuracy is unrealistic. Human annotators make errors due to fatigue and other considerations. Moreover, labels are often obtained through means such as Amazon's Mechanical Turk or as pseudo-labels generated via semi-supervised means. Referred to as \emph{noisy labels}, these inaccurate labels can have a deleterious effect on training accuracy. Zhang et al. \cite{DBLP:journals/corr/ZhangBHRV16} demonstrated that a sufficiently complex DNN could learn a dataset with an arbitrarily high level of label noise. This overfitting behaviour negatively affects performance when evaluated on test data. Fr\'enay and Verleysen \cite{FrenayLabelNoiseSurvey} divided label noise into two types: \emph{Instance-independent} and \emph{Instance-dependent}. \emph{Instance-independent} label noise is characterised by the lack of a probabilistic relationship between a label being wrong and the underlying features of a given sample. In the literature, this is often further sub-divided into Symmetric and Asymmetric noise. \begin{itemize} \item Symmetric noisy labels are modelled by randomly changing label values from their true class to some other class with a certain probability. \item Asymmetric label noise is modelled by randomly changing the labels for samples of certain classes to a similar class with a given probability. An example of this would be changing 'cars' to 'trucks' in the CIFAR10 dataset. This is slightly more realistic. \end{itemize} \emph{Instance-dependent} label noise, on the other hand, varies with the particular characteristics of each sample. This mirrors reality, in that more ambiguous samples are more likely to be misclassified. Chen et al. \cite{Chen2021InstanceDependentNoise} described a method for producing realistic instance-dependent noise. Their method involved training a DNN on a dataset for a certain number of epochs and recording the associated loss of each sample. The samples with the highest averaged loss were deemed to be the most counter-intuitive samples and therefore the most likely to be mislabelled in real life. While this does not work as an online means of determining misclassification likelihood, it is more than sufficient when the training data is known beforehand. DNNs tend to learn general classification rules first before proceeding to memorise individual samples in a dataset. This means that early in training, a sample's classification loss can be used as an indication of whether the sample's label is incorrect. A large loss may indicate a label is wrong. This is often referred to as the \emph{small-loss trick}. Han et al. \cite{Han2018CoTeaching}, Jiang et al. \cite{Jiang2018Mentornet} and Yu et al. \cite{Yu2019Disagreement} all utilise the small-loss trick to detect noisy labels. A popular method for combating overfitting to noisy labels is to change the rate at which DNNs learn instance-specific cases by modifying the loss function. This means that samples with an abnormally high loss (and thus likely to be wrongly labelled) are ignored or have reduced affect on the training outcome. Zhang et al. \cite{GCE} proposed the Generalised Cross Entropy loss, which bridged the gap between Cross Entropy loss and the MAE/unhinged loss. Menon et al. \cite{PHUber} went further and proposed a partially Huberised Cross Entropy loss, which utilized gradient clipping to arrive at a more robust training solution. Both of these methods are included for comparison in this paper. \section{Method} \label{Method} This section describes the proposed ASIF training method in further detail. \subsection{Notations and Definitions} The following notation will be used in this paper: \begin{itemize} \item $N$: The total number of samples being trained on. \item $C$: The total number of classes in the dataset. \item $N_c$: The total number of samples of a given class. \item $B$: The total number of samples in each mini-batch. \item $\eta$: The amount of label noise, 0-1. \item $\mathscr{L}_{\text{id}_c}$: The identification task loss associated with class $c$. \item $\mathscr{L}_\text{cls}$: The classification task loss. \item $\Psi$: The Feature Extractor. \item $F_\Psi$: The dimension of the feature vector output from $\Psi$. \item $h_I$: The Identifier module. \item $h_C$: The Classifier module. \end{itemize} \subsection{Method Description} As discussed in Section \ref{section:intro}, ASIF attempts to overcome the problem of networks overfitting to specific instances in the training data. To that end, it attempts to select \emph{Class-wise Features} while suppressing \emph{Identity-wise Features}. Recall that the former are features useful in classifying a sample into one of several classes, while the latter features are useful in determining the identity of a specific sample. ASIF attempts to perform both tasks: \emph{Classification} and \emph{Identification}. \emph{Classification} divides the dataset into $C$ classes and attempts to determine the class that each sample belongs to. Similarly, \emph{Identification} divides the dataset into $N$ 'identities' (one for each sample) and attempts to ascertain the identity of each and every sample. The module contains global parameters as well as parameters that are tuned for each class to perform identification amongst the individual samples within that class. A gradient reversal layer exists to encourage the network to fail in its \emph{Identification} task. \subsection{Network Structure} \begin{figure*} \centering \includegraphics[width=\textwidth]{asif_model_horizontal.png} \caption{Architecture of our proposed ASIF network. \emph{(a)} A shared Feature Extractor $\Psi$ extracts features for use by all downstream tasks. A Classifier module $h_C$ performs the \emph{Classification} task, while an Identifier module $h_I$ performs the \emph{Identification} task. \emph{(b)} The Identifier module contains shared parameters that are trained on all samples, as well as dedicated parameters for each class of samples producing $C$ outputs, one for each class. There is a Dynamic Gradient Reversal (DGR) layer between the shared and per-class parameters.} \label{fig:asif_model} \end{figure*} As Figure \ref{fig:asif_model} indicates, the ASIF network consists of several components: \subsubsection{Feature Extractor} The Feature Extractor ($\Psi$) can be any off-the-shelf network. For the purposes of the experiments we've done as part of this paper, we used ResNet18 \cite{he2015resnet}. For ease of base-lining, we used the ResNet18 implementation provided as part of Nishi et al.'s \cite{Nishi2021Augmentation} work. The output of the feature extractor is a feature vector $\Psi(x)$, where $\Psi(x) \in \mathbf{R}^{F_\Psi}$. This is passed to a linear layer $h_C$, the 'Classifier' in Figure \ref{fig:asif_model}(a), to extract logits for use with the \emph{Classification} task. The logits are combined with the classification label using a Cross Entropy loss ($\mathscr{L}_\text{cls}$). Note that the loss applied here can be varied. Investigation of other losses for the Classification task is left to future work. \subsubsection{Identification Module} The Identification Module $h_I$ attempts to identify individual samples. It has $C$ outputs, one for each class, where $h_{I_c}(\Psi(x)) \in \mathbf{R}^{N_c}$. As shown in Figure \ref{fig:asif_model}(b), the module is divided into three parts: a 'public' part whose parameters are trained on all samples regardless of label, a DGR, and $C$ sets of private parameters that are only trained on samples with the matching label. Each set of private parameters $1..C$ outputs one of the outputs $h_{I_c}(\Psi(x))$. By sharing as many parameters as possible between the classes, we allow for a network that more easily scales to a larger number of classes. The 'public' section of the Identifier consists of two linear layers with a Batch Normalization, ReLU and dropout in between. The 'private' section has a Batch Normalization, ReLU, dropout and final linear layer for each class. All hyperparameters, such as dropout levels, were manually optimised using cross-validation. Each mini-batch output from the Identifier is filtered down to just the batch members from its class and a Cross-Entropy Loss ($\mathscr{L}_\text{id}$) is applied. The losses are then averaged in proportion to each class' share of the mini batch and combined with the classification loss. This structure allows the ASIF network to optimise: \begin{equation} \label{eqn:asif_loss} \min_{\Psi, h_C}\max_{\{{h_I}_c\}}\mathbb{E}[h_C(\Psi(x))] \\ + \lambda_\text{id}\mathbb{E}[\frac{1}{C}\sum\limits_{c=1}^{C} {h_I}_c(\Psi(x))], \end{equation} where ${h_I}_c$ denotes the Identifier output for class $c$. It also includes a coefficient $\lambda_\text{id}$ for the Identifier losses. The values used in the experiments can be found in the appendix. \subsubsection{Dynamic Gradient Reversal Layers} Similar to DANN \cite{ganin2015domainadversarial}, we reverse the gradient during backpropagation from the \emph{Identification} task. To review, DANN contains a Gradient Reversal Layer (GRL) which, on feeding forward has the value $R(x) = x$. However, when backpropagating it has the value $\frac{\partial R}{\partial x} = -\lambda I$, where $I$ is the identity matrix and $\lambda$ is a hyperparameter. The value of $\lambda$ is set according to a schedule tuned to ensure a proper balance is maintained between the competing tasks. Unfortunately, choosing an incorrect value for $\lambda$ leads to the \emph{Identification} task becoming confidently wrong. To overcome this limitation, this paper proposes a Dynamic Gradient Reversal (DGR) scheme. Unlike DANN, our method does not require a tune-able hyper-parameter. Moreover, our experiment shows that DGR alleviates overfitting better when compared with DANN-like gradient reversal layers, as shown in Figure \ref{fig:dgr_vs_dann}. \begin{figure} \centering \includegraphics[width=3.2in]{dgr_vs_dann.png} \caption{Classification loss, training and test accuracy versus training epoch when training with Symmetrical 80\% noise and CIFAR10. The use of Dynamic Gradient Reversal (DGR) leads to reduced overfitting, as indicated by the classification loss not dropping as fast. Also note that the DGR training and test accuracies remain in lockstep, while the DANN accuracies diverge during later training.} \label{fig:dgr_vs_dann} \end{figure} \begin{algorithm} \caption{Dynamic Gradient Reversal}\label{alg:dgr} \begin{algorithmic} \State $\hat{\mathscr{L}_\text{id}} \gets log(N_c)$ \State $\lambda \gets 1.0$ \While{Still Training} \State Perform \emph{Identification Task} \State Backpropagate using $\lambda$ \State Record $\mathscr{L}_\text{id}$ \State $\lambda \gets \frac{\mathscr{L}_\text{id} - \hat{\mathscr{L}_\text{id}}}{\hat{\mathscr{L}_\text{id}}}$ \EndWhile \end{algorithmic} \end{algorithm} Formally, Dynamic Gradient Reversal (DGR) is designed to maintain the \emph{Identification Task} in a state of maximum uncertainty. This is done by establishing a baseline ideal loss ($\hat{\mathscr{L}_\text{id}}$) corresponding to maximum entropy in the identity logits as shown in Equation \ref{eqn:max_uncertainty}: \begin{equation} \label{eqn:max_uncertainty} \hat{\mathscr{L}_\text{id}} = -\sum_{I=1}^{N_c} \frac{1}{N_c} log(\frac{1}{N_c}) = log(N_c). \end{equation} Then we automatically choose $\lambda$ by comparing the current $\mathscr{L}_\text{id}$ and $\hat{\mathscr{L}_\text{id}}$. The detailed process of calculating $\lambda$ is described in Algorithm \ref{alg:dgr}. The algorithm has the same computational cost as DANN, since the tuning of the $\lambda$ value is done using the loss, which is computed anyway. \subsection{Noisy Label Detection} One of the challenges of obtaining real-life data is the difficulty of creating accurate labels. It is typical to use a large human workforce and/or some degree of automation (for example, scraping the Internet) to acquire the labels. Inaccurate (or 'noisy') labels often become associated with the training data. This can lead to reduced accuracy in trained networks. To detect noisy labels, the \emph{small-loss trick} \cite{Han2018CoTeaching, Jiang2018Mentornet, Yu2019Disagreement} can be applied, which is described above in Section \ref{section:RelatedWorksNoisyLabels}. DNNs learn general cases first and high losses indicate tricky cases or bad labels. Given ASIF's regularising effect during training, the feature extractor will take much longer to overfit to the edge cases. We thus theorise that the small-loss trick applied to the Classification Task's loss $\mathscr{L}_\text{cls}$, would be far more robust when trained with ASIF than without. \section{Experiments} \label{Experiments} In this section, we evaluate the performance of ASIF using reduced training sets and noisy labels. We also delve into the characteristics of ASIF. Experiments were run using both the CIFAR10 and Fashion-MNIST \cite{FashionMNIST} datasets. All training techniques are judged based on their macro F1 scores when classifying on the test set. The CIFAR10 dataset contains 50,000 small 32x32 sample images, split evenly across ten classes. It contains a further 10,000 images for evaluation - 1000 per class. The Fashion-MNIST dataset contains 60,000 small 28x28 grayscale images of fashion products, split evenly across ten classes. It contains a further 10,000 images for evaluation. To serve as a point of comparison, all experimental configurations were also run with several other methods. In these non-ASIF cases, the Identifier module was removed from the network. Three different losses were applied to the output logits from the Classifier: \begin{itemize} \item CE: Cross-Entropy. This is the same as used in the ASIF experiments. \item GCE: Generalised Cross-Entropy \cite{GCE} \item PHuber: partially Huberised Cross-Entropy \cite{PHUber} \end{itemize} \subsection{Reduced Training Sets} \label{ReducedTrainingSets} To investigate ASIF's ability to resist overfitting with small training sets, we designed an experiment which trained the network on the CIFAR10 dataset with various numbers of samples per class. The inputs to all techniques were the same, with standard regularisation applied, but no data augmentation. Runs were conducted with $N$ = [10k, 20k, 30k, 40k, all]. Each configuration was run three times and their macro F1 scores across the test set averaged. \begin{table}[] \centering \begin{tabular}{||c c c c c||} \hline $N$ & CE & GCE & PHuber & ASIF \\ [0.ex] \hline\hline 10k & 69.1 \textpm \, 1.2 & 64.8 \textpm \, 2.4 & 73.2 \textpm \, 0.6 & \textbf{74.2 \textpm \, 0.2} \\ \hline 20k & 74.0 \textpm \, 0.5 & 72.6 \textpm \, 1.1 & 79.4 \textpm \, 0.0 & \textbf{80.2 \textpm \, 0.1} \\ \hline 30k & 78.7 \textpm \, 0.4 & 75.6 \textpm \, 0.7 & 82.1 \textpm \, 0.1 & \textbf{83.6 \textpm \, 0.3} \\ \hline 40k & 81.5 \textpm \, 0.7 & 80.6 \textpm \, 0.1 & 83.4 \textpm \, 0.1 & \textbf{85.5 \textpm \, 0.3} \\ \hline 50k & 84.3 \textpm \, 0.6 & 83.0 \textpm \, 0.4 & 83.9 \textpm \, 0.4 & \textbf{86.8 \textpm \, 0.4} \\ [1ex] \hline \end{tabular} \caption{Macro F1 Scores when training on reduced training sets on CIFAR10.} \label{tab:small_set_cifar10_results} \end{table} We discovered that ASIF has a marked advantage over its competitors in this domain. Table \ref{tab:small_set_cifar10_results} summarises the results for CIFAR10. Fashion-MNIST results can be found in Table \ref{tab:small_set_fashion_mnist_results} in the appendix. \subsection{Training with Label Noise} To test ASIF in the presence of label noise, we intentionally modified the labels in the datasets. Two types of label noise were investigated. The first was Symmetrical instance-invariant noise, as described by Zhang et al. \cite{DBLP:journals/corr/ZhangBHRV16} and by Zhang and Sabuncu \cite{DBLP:journals/corr/abs-1805-07836}. To apply this sort of noise, a percentage of the dataset corresponding to the desired noise level $\eta$ were selected for label modification. Symmetrical instance-invariant noise is not realistic, since labelling errors are more likely to happen with ambiguous samples than with obviously distinct ones. We used the technique described by Chen et al. \cite{Chen2021InstanceDependentNoise} to produce realistic instance-dependent noise. Their process produced a list of samples and associated average losses. We ranked the samples by descending loss and selected the top $N \times \eta$ samples. Those samples then had their labels randomly swapped. Having trained ASIF against six values of $\eta$ and two different noise techniques, we have been able to show superior performance in the very high noise domain around 70\%-90\% noise. Figure \ref{fig:inst_noise_vs_accuracy_improvement} clearly illustrates ASIF's accuracy advantage in that area with CIFAR10. \begin{figure} \centering \includegraphics[width=3.2in]{sym_noise_vs_accuracy_improvement.png} \caption{CIFAR10 results. ASIF confers a clear accuracy improvement over the baseline training method (Cross Entropy) with noisy labels, especially in the high-noise end of the range. GCE and PHuber training results are included for comparison.} \label{fig:inst_noise_vs_accuracy_improvement} \end{figure} In the easier scenario of Symmetric Instance-Invariant noise, PHuber is still competitive with ASIF. However, even in those cases, ASIF beats CE and GCE by a wide margin. Please see Tables \ref{tab:noise_cifar10_inst} and \ref{tab:noise_cifar10_sym} for CIFAR10 full results. ASIF's corresponding performance with Fashion-MNIST can be found in Tables \ref{tab:noise_fashion_mnist_sym} and \ref{tab:noise_fashion_mnist_inst} the appendix. \begin{table}[] \centering \begin{tabular}{||c c c c c||} \hline $\eta$ & CE & GCE & PHuber & ASIF \\ [0.ex] \hline\hline 0 & 84.3 \textpm \, 0.6 & 83.0 \textpm \, 0.4 & 83.9 \textpm \, 0.4 & \textbf{86.8 \textpm \, 0.4} \\ \hline 0.2 & 79.5 \textpm \, 0.5 & 79.1 \textpm \, 0.1 & 80.5 \textpm \, 0.3 & \textbf{81.5 \textpm \, 0.0} \\ \hline 0.4 & 70.4 \textpm \, 0.3 & 70.5 \textpm \, 0.1 & \textbf{74.2 \textpm \, 0.4} & 73.1 \textpm \, 0.6 \\ \hline 0.6 & 59.2 \textpm \, 0.7 & 58.4 \textpm \, 0.3 & \textbf{65.7 \textpm \, 0.1} & 65.6 \textpm \, 1.9 \\ \hline 0.7 & 52.8 \textpm \, 1.0 & 50.9 \textpm \, 0.6 & 44.1 \textpm \, 0.6 & \textbf{61.6 \textpm \, 0.9} \\ \hline 0.8 & 45.3 \textpm \, 1.4 & 42.4 \textpm \, 0.5 & 34.0 \textpm \, 0.2 & \textbf{53.5 \textpm \, 1.0} \\ \hline 0.9 & 38.2 \textpm \, 0.5 & 31.5 \textpm \, 0.9 & 27.4 \textpm \, 2.3 & \textbf{41.8 \textpm \, 1.3} \\ [1ex] \hline \end{tabular} \caption{Macro F1 Scores with Instance-Dependent Noisy Labels on CIFAR10.} \label{tab:noise_cifar10_inst} \end{table} \begin{table}[] \centering \begin{tabular}{||c c c c c||} \hline $\eta$ & CE & GCE & PHuber & ASIF \\ [0.ex] \hline\hline 0 & 84.3 \textpm \, 0.6 & 83.0 \textpm \, 0.4 & 83.9 \textpm \, 0.4 & \textbf{86.8 \textpm \, 0.4} \\ \hline 0.2 & 65.5 \textpm \, 0.5 & 75.1 \textpm \, 0.4 & \textbf{81.8 \textpm \, 0.1} & 77.6 \textpm \, 0.7 \\ \hline 0.4 & 49.0 \textpm \, 2.3 & 60.3 \textpm \, 1.1 & \textbf{78.6 \textpm \, 0.8} & 72.0 \textpm \, 0.4 \\ \hline 0.6 & 41.0 \textpm \, 1.1 & 48.3 \textpm \, 1.3 & \textbf{73.5 \textpm \, 0.3} & 63.3 \textpm \, 1.9 \\ \hline 0.7 & 29.7 \textpm \, 1.1 & 40.8 \textpm \, 0.5 & \textbf{67.3 \textpm \, 1.3} & 55.6 \textpm \, 0.5 \\ \hline 0.8 & 21.4 \textpm \, 0.7 & 29.3 \textpm \, 0.9 & \textbf{53.6 \textpm \, 4.4} & 43.1 \textpm \, 2.4 \\ \hline 0.9 & 5.0 \textpm \, 2.9 & 16.6 \textpm \, 0.5 & 17.7 \textpm \, 3.1 & \textbf{27.3 \textpm \, 2.6} \\ [1ex] \hline \end{tabular} \caption{Macro F1 Scores with Symmetric Instance-Invariant Noisy Labels on CIFAR10.} \label{tab:noise_cifar10_sym} \end{table} \subsection{Detecting Incorrect Labels} In addition to showing that ASIF confers an advantage when training in the face of noisy labels, we can also show that ASIF can help to detect which samples have bad labels. To do so, periodically through the training we recorded the associated $\mathscr{L}_\text{cls}$ values for each sample and then ranked them by descending value. The top $N \times \eta$ samples were selected as 'probably false'. These samples' labels were then compared with the true labels to determine the dirty label picking balanced accuracy. Our results indicate that utilising ASIF to pick out bad labels can confer as much as a 10\% advantage over the baseline CE loss. This is a significant improvement over both GCE and PHuber. In the easier scenario of Symmetric Instance-Invariant noise, ASIF shows a detection advantage of as much as 13\% over CE. Please see Tables \ref{tab:label_picking_cifar10_inst} and \ref{tab:label_picking_cifar10_sym} for full results. \begin{table}[] \centering \begin{tabular}{||c c c c c||} \hline $\eta$ & CE & GCE & PHuber & ASIF \\ [0.ex] \hline\hline 0.2 & 64.2 \textpm \, 0.8 & 65.0 \textpm \, 1.0 & 67.6 \textpm \, 1.1 & \textbf{70.0 \textpm \, 1.6} \\ \hline 0.4 & 73.4 \textpm \, 0.5 & 70.5 \textpm \, 1.4 & 72.6 \textpm \, 5.0 & \textbf{78.0 \textpm \, 1.6} \\ \hline 0.6 & 73.2 \textpm \, 1.6 & 67.7 \textpm \, 0.5 & 74.5 \textpm \, 0.6 & \textbf{79.7 \textpm \, 3.3} \\ \hline 0.7 & 69.7 \textpm \, 1.6 & 66.2 \textpm \, 1.1 & 64.5 \textpm \, 3.1 & \textbf{79.6 \textpm \, 2.0} \\ \hline 0.8 & 65.9 \textpm \, 0.7 & 60.7 \textpm \, 0.7 & 62.9 \textpm \, 3.6 & \textbf{71.2 \textpm \, 1.2} \\ \hline 0.9 & 58.1 \textpm \, 2.0 & 58.3 \textpm \, 0.9 & 61.1 \textpm \, 0.6 & \textbf{61.9 \textpm \, 3.0} \\ [1ex] \hline \end{tabular} \caption{F1 Score of Instance-Dependent Noisy Label Detection on CIFAR10} \label{tab:label_picking_cifar10_inst} \end{table} \begin{table}[] \centering \begin{tabular}{||c c c c c||} \hline $\eta$ & CE & GCE & PHuber & ASIF \\ [0.ex] \hline\hline 0.2 & 79.1 \textpm \, 3.1 & \textbf{86.7 \textpm \, 0.6} & 82.0 \textpm \, 2.0 & 85.6 \textpm \, 0.7 \\ \hline 0.4 & 75.9 \textpm \, 0.2 & 83.7 \textpm \, 0.3 & 84.6 \textpm \, 0.5 & \textbf{86.2 \textpm \, 1.3} \\ \hline 0.6 & 73.3 \textpm \, 0.9 & 77.6 \textpm \, 1.1 & 83.1 \textpm \, 1.4 & \textbf{84.1 \textpm \, 0.4} \\ \hline 0.7 & 67.1 \textpm \, 1.6 & 73.2 \textpm \, 1.1 & \textbf{79.7 \textpm \, 3.2} & 79.5 \textpm \, 1.3 \\ \hline 0.8 & 60.7 \textpm \, 0.4 & 65.7 \textpm \, 0.7 & 71.7 \textpm \, 0.6 & \textbf{73.2 \textpm \, 2.0} \\ \hline 0.9 & 52.2 \textpm \, 2.2 & 54.8 \textpm \, 0.9 & 59.4 \textpm \, 2.0 & \textbf{62.9 \textpm \, 0.9} \\ [1ex] \hline \end{tabular} \caption{F1 Score of Symmetric Instance-Invariant Noisy Label Detection on CIFAR10} \label{tab:label_picking_cifar10_sym} \end{table} \subsection{Analysis of the Features Learned With ASIF} \label{FeatureAnalysis} We conducted an analysis to gain a better understanding of the effect ASIF has on the features learned. First, we address the degree to which ASIF inhibits memorisation of features. The theory behind ASIF is that we penalise the learning of features that can be used to identify specific instances of data, while allowing the learning of features that are necessary to differentiate between classes of data. We tested this by training a single layer classifier on the feature vectors obtained from the frozen pre-trained feature extractor $\Psi(x)$ until performance stopped improving. The goal was correctly identifying each individual sample. If ASIF performed as theorised, the best loss obtained would be worse for ASIF than it would be for the baseline. The results, shown in Table \ref{tab:feature_vector_ids_losses}, confirm this supposition. \begin{table}[] \centering \begin{tabular}{||c c c||} \hline Dataset & CE & ASIF \\ [0.ex] \hline\hline CIFAR10 & 0.005 \textpm \, 0.008 & 0.782 \textpm \, 0.159 \\ \hline Fashion-MNIST & 1.059 \textpm \, 0.332 & 8.307 \textpm \, 0.202 \\ [1ex] \hline \end{tabular} \caption{Loss Obtained identifying feature vectors} \label{tab:feature_vector_ids_losses} \end{table} Second, we turn our attention to feature dis-entanglement. There is a tension behind the two goals of class discrimination and instance discrimination, since features can be used toward both ends. We hypothesize that the result of this struggle would be that only the fewest, most useful features would be selected for classification. This would act to dis-entangle class-wise and identity-wise features, with class-variant features confined to a small subspace and the rest of the features showing no significant statistical differences between classes. We set out to investigate the distribution of the features selected by ASIF. To do so, we performed an experiment. We trained a fresh linear classifier $h$ on the feature vectors obtained from the frozen pre-trained feature extractor $\Psi(x)$. We then used the absolute value of the linear weights $h_\Theta$ to ascertain which feature dimensions were least important to the classification and removed those from the vectors, before retraining another fresh classifier on the resulting vectors. We performed this process repeatedly, reducing the vector size with each iteration until the resulting vectors had only five dimensions. With each iteration, we recorded the best classification accuracy obtained. Figure \ref{fig:clustering_accuracy_vs_features} shows the results obtained from this experiment. In all cases, the majority of the features played no important role in classification. However, as the least important features continued to be removed, the Cross Entropy baseline became the first to show a reduced accuracy when there were around 55 feature dimensions remaining. \begin{figure} \centering \includegraphics[width=3.2in]{clustering_experiment_accuracy.png} \caption{The accuracy obtained when training a single-layer classifier on the output of feature extractors trained with Cross Entropy Loss (Red) and ASIF (Blue) using between 1 and 100 of the most important features.} \label{fig:clustering_accuracy_vs_features} \end{figure} ASIF, on the other hand, does not seriously lose accuracy until we are down to the ten most important feature dimensions. This feature compression is desirable as it has been linked to generalization \cite{tishby2015deep, shwartzziv2017opening}. \section{Conclusions and Future Work} \label{Conclusions} We have introduced ASIF, which differentiates between Class-wise and Identity-wise Discriminative Features, promoting the former whilst suppressing the latter. Through experimentation, we have shown that ASIF has a regularising effect that can reduce overfitting to individual samples and increase robustness against label noise. We have shown that ASIF can result in accuracies that are better than standard training results, especially in the high-noise domain. Moreover, we have also proposed the DGR method which allows for a gradient reversal layer without tune-able hyper-parameters. We have shown that the use of ASIF results in the selection of far fewer class-variant features. This feature of ASIF-trained feature extractors has great potential for use in Data Privacy and Anonymization applications, or anywhere else that autoencoders are useful. Moreover, when training on the full dataset, the selected features are likely to be domain invariant and lead to much better generalisation. Extending the Identification task to the unsupervised realm may encourage more domain invariant feature selection and seems like a fruitful direction for future research. ASIF has limitations when it comes to scaling up. Because its Identifier module has a linear layer that specifies individual instances in a fixed dataset, the size of that dataset has a practical upper limit. Because each class has its own set of weights, this memory constraint also places a limit on the number of classes trained. Moreover, while suppressing identity features has been shown to be helpful in the settings laid out in this paper, they are crucial in certain other tasks - such as face recognition. This limits ASIF's applicability in some areas. Despite these limitations, differentiating between Class-wise and Identity-wise Features is nonetheless a novel approach. \section*{Acknowledgment} This work was supported with supercomputing resources provided by the Phoenix HPC service at the University of Adelaide. \section{CIFAR10 ASIF Configurations} \label{appendix:cifar10_asif_config} Table \ref{tab:cifar10_asif_experiment_configs} shows the configurations used to produce the CIFAR10 ASIF results. \begin{table}[] \centering \begin{tabular}{||c c c c c||} \hline Noise & $\eta$ & N & LR & $\lambda_\text{if}$ \\ [0.ex] \hline\hline Instance & 0.2 & 50k & 0.0001 & 0.01 \\ \hline Instance & 0.4 & 50k & 0.0001 & 0.1 \\ \hline Instance & 0.6 & 50k & 0.0001 & 0.1 \\ \hline Instance & 0.7 & 50k & 0.0001 & 0.1 \\ \hline Instance & 0.8 & 50k & 0.0001 & 0.1 \\ \hline Instance & 0.9 & 50k & 0.0001 & 0.1 \\ \hline Symmetric & 0.2 & 50k & 0.0001 & 10.0 \\ \hline Symmetric & 0.4 & 50k & 0.0001 & 100.0 \\ \hline Symmetric & 0.6 & 50k & 0.0001 & 1.0 \\ \hline Symmetric & 0.7 & 50k & 0.0001 & 1.0 \\ \hline Symmetric & 0.8 & 50k & 0.001 & 1.0 \\ \hline Symmetric & 0.9 & 50k & 0.001 & 10.0 \\ \hline None & 0 & 10k & 0.001 & 1.0 \\ \hline None & 0 & 20k & 0.0001 & 1.0 \\ \hline None & 0 & 30k & 0.0001 & 1.0 \\ \hline None & 0 & 40k & 0.0001 & 1.0 \\ \hline None & 0 & 50K & 0.001 & 1.0 \\ [1ex] \hline \end{tabular} \caption{CIFAR10 ASIF Experimental Configurations.} \label{tab:cifar10_asif_experiment_configs} \end{table} \section{Fashion-MNIST ASIF Configurations} \label{appendix:cifar10_fashion_mnist_config} Table \ref{tab:fashion_mnist_asif_experiment_configs} shows the configurations used to produce the Fashion-MNIST ASIF results. \begin{table}[] \centering \begin{tabular}{||c c c c c||} \hline Noise & $\eta$ & N & LR & $\lambda_\text{if}$ \\ [0.ex] \hline\hline Instance & 0.2 & 60k & 0.001 & 0.001 \\ \hline Instance & 0.4 & 60k & 0.0001 & 0.1 \\ \hline Instance & 0.6 & 60k & 0.001 & 0.001 \\ \hline Instance & 0.7 & 60k & 0.001 & 0.001 \\ \hline Instance & 0.8 & 60k & 0.001 & 1.0 \\ \hline Instance & 0.9 & 60k & 0.001 & 0.001 \\ \hline Symmetric & 0.2 & 60k & 0.0001 & 0.001 \\ \hline Symmetric & 0.4 & 60k & 0.001 & 0.001 \\ \hline Symmetric & 0.6 & 60k & 0.001 & 0.001 \\ \hline Symmetric & 0.7 & 60k & 0.001 & 1.0 \\ \hline Symmetric & 0.8 & 60k & 0.0001 & 10.0 \\ \hline Symmetric & 0.9 & 60k & 0.0001 & 0.1 \\ \hline None & 0 & 10k & 0.001 & 0.001 \\ \hline None & 0 & 20k & 0.001 & 0.001 \\ \hline None & 0 & 30k & 0.001 & 0.001 \\ \hline None & 0 & 40k & 0.001 & 0.001 \\ \hline None & 0 & 60K & 0.001 & 0.01 \\ [1ex] \hline \end{tabular} \caption{Fashion-MNIST ASIF Experimental Configurations.} \label{tab:fashion_mnist_asif_experiment_configs} \end{table} \section{Fashion-MNIST Detailed Results} \label{appendix:fashion_mnist_detailed_results} Experiments run on CIFAR10 were also performed on the Fashion-MNIST dataset to test repeatability of the results. Unlike in the case of CIFAR10, tests were only run on Cross Entropy and ASIF, not on GCE or PHuber. Results are shown here: \begin{itemize} \item Reduced Datasets: Table \ref{tab:small_set_fashion_mnist_results} \item Symmetrical Instance-Invariant Noise: Table \ref{tab:noise_fashion_mnist_sym} \item Instance-Dependent Noise: Table \ref{tab:noise_fashion_mnist_inst} \end{itemize} \begin{table}[] \centering \begin{tabular}{||c c c||} \hline $N$ & CE & ASIF \\ [0.ex] \hline\hline 10k & 89.1 \textpm \, 0.2 & \textbf{89.6 \textpm \, 0.1} \\ \hline 20k & 90.5 \textpm \, 0.1 & \textbf{91.2 \textpm \, 0.3} \\ \hline 30k & 91.4 \textpm \, 0.1 & \textbf{91.9 \textpm \, 0.1} \\ \hline 40k & 92.0 \textpm \, 0.1 & \textbf{92.5 \textpm \, 0.3} \\ \hline 60k & 93.0 \textpm \, 0.0 & \textbf{93.1 \textpm \, 0.2} \\ [1ex] \hline \end{tabular} \caption{Macro F1 scores when training on reduced training sets on Fashion-MNIST.} \label{tab:small_set_fashion_mnist_results} \end{table} \begin{table}[] \centering \begin{tabular}{||c c c||} \hline $\eta$ & CE & ASIF \\ [0.ex] \hline\hline 0 & 93.0 \textpm \, 0.0 & \textbf{93.1 \textpm \, 0.2} \\ \hline 0.2 & 88.1 \textpm \, 0.0 & \textbf{90.3 \textpm \, 0.4} \\ \hline 0.4 & 83.7 \textpm \, 0.1 & \textbf{88.8 \textpm \, 1.1} \\ \hline 0.6 & 74.9 \textpm \, 1.1 & \textbf{86.9 \textpm \, 0.8} \\ \hline 0.7 & 66.7 \textpm \, 2.2 & \textbf{85.3 \textpm \, 0.8} \\ \hline 0.8 & 57.3 \textpm \, 4.8 & \textbf{81.4 \textpm \, 2.3} \\ \hline 0.9 & 19.4 \textpm \, 3.5 & \textbf{73.2 \textpm \, 0.4} \\ [1ex] \hline \end{tabular} \caption{Macro F1 Scores when training on Fashion-MNIST with Symmetric Instance-Invariant Noisy Labels.} \label{tab:noise_fashion_mnist_sym} \end{table} \begin{table}[] \centering \begin{tabular}{||c c c||} \hline $\eta$ & CE & ASIF \\ [0.ex] \hline\hline 0 & 93.0 \textpm \, 0.0 & \textbf{93.1 \textpm \, 0.2} \\ \hline 0.2 & \textbf{85.6 \textpm \, 0.2} & 82.5 \textpm \, 4.3 \\ \hline 0.4 & \textbf{74.7 \textpm \, 0.6} & 72.4 \textpm \, 1.9 \\ \hline 0.6 & 53.4 \textpm \, 0.6 & \textbf{58.3 \textpm \, 1.5} \\ \hline 0.7 & 43.1 \textpm \, 1.0 & \textbf{44.8 \textpm \, 1.6} \\ \hline 0.8 & 30.5 \textpm \, 0.6 & \textbf{34.3 \textpm \, 0.8} \\ \hline 0.9 & 21.4 \textpm \, 1.6 & \textbf{24.7 \textpm \, 2.4} \\ [1ex] \hline \end{tabular} \caption{Macro F1 Scores when training on Fashion-MNIST with Instance-Dependent Noisy Labels.} \label{tab:noise_fashion_mnist_inst} \end{table} \end{document}
{'timestamp': '2022-10-04T02:12:24', 'yymm': '2209', 'arxiv_id': '2209.14553', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14553'}
arxiv
\section{Preliminary} \section{Introduction} \IEEEPARstart{R}{ecent} advances within the Smart Grid (SG) paradigm are geared towards the incorporation of several Internet of Things (IoT) based devices and advanced computing technologies to ensure reliability, flexibility and efficiency of critical power systems \cite{Lamnatou_Chemisana_Cristofari_2022}. With the prevalence of Artificial Intelligence (AI), the enormous amount of highly granular power-related data generated by such intelligent devices enable energy service providers to improve load forecasts, maximize financial gains, devise effective demand management and other grid operation strategies, etc \cite{Sakhnini_Karimipour_Dehghantanha_Parizi_Srivastava_2021}. Besides, consumers can experience better quality of service through personalization of the power system applications and tools \cite{9478223}. However, present data analytics solutions for SGs primarily emphasize on centralized and decentralized approaches that require the direct sharing of data and/or learning models to dedicated central servers \cite{9381850} . In such cases, the sharing of fine-grained load consumption profiles collected from individual smart meters to central data servers imposes several privacy concerns to energy data owners \cite{husnoo2021false, reda2021taxonomy}. For instance, several studies \cite{10.1145/1878431.1878446, 10.1145/2528282.2528295} have highlighted that simple analysis of load consumption patterns recorded by smart meters can reveal household occupancy rates, the presence of people within a house, and sleep/wake-up time of residents, without any prior knowledge. Indeed, higher resolution of smart meter data leads to higher granularity in information and allows third parties to infer more sensitive information about households. In such a scenario, Federated Learning (FL) emerges as a viable privacy-preserving distributed computing alternative which transfers computation to energy data owners and allows the training of a global model through collaboration of devices without requiring the migration of data to a central repository for model training \cite{9084352}. Typically, edge devices in an energy system network iteratively train a local model and update the resulting parameters to a central aggregator which accumulates and processes the parameters and then sends back the updated parameters to the edge devices. The communication rounds continue until successful convergence of the model. In spite of the privacy preservation benefits due to the omission of raw data sharing requirements, FL is also efficient in terms of communication resource usage and has higher scalability \cite{9084352}. Recently, FL has gained much attention from researchers to explore its potential benefits within several smart grid domains, namely short-term load forecasting \cite{husnoo2022fedrep, 9148937}, energy theft detection \cite{9531953}, to name a few. Nevertheless, despite its promising privacy-preserving potentials, recent literature has revealed that FL may fail to provide sufficient privacy guarantees in certain circumstances. For example, researchers have discovered that they are able to reconstruct the original raw data from the sharing of gradients of the model during iterations \cite{iDLG}. Furthermore, due to the distributed nature of FL, it is vulnerable to Byzantine faults/attacks whereby the client nodes behave arbitrarily which may be a result of adversarial manipulations or software/hardware faults \cite{FLTrust}. Therefore, it is imperative to design FL mechanisms that are fault-tolerant to such behaviours, provide good generalisation performance and are communication efficient. Consequently, we investigate this research gap in the field of smart grids by contributing to the following: \begin{enumerate}[leftmargin=*] \item Inspired by the idea of gradient quantization, we develop a state-of-the-art privacy-preserving federated learning-based framework that leverages the SIGNSGD algorithm to improve the robustness of FL strategies for residential short-term load forecasting against Byzantine attacks. \item Specifically, in this paper, we highlighted three key data integrity attacks against short term load forecasting FL models. We design the data integrity threat models and their counter measures. \item We further extend the proposed framework towards a privacy-preserving SIGNSGD-based FL approach whereby the clients locally perturb their trained parameters by adding noise prior to uploading to the server for aggregation to prevent parameter information leakage and ensure privacy preservation more effectively. \item We conduct comprehensive case studies and extensive empirical evaluations to verify the effectiveness of our proposed scheme using a real Australian energy consumption dataset obtained from Ausgrid Network. \end{enumerate} \noindent The rest of this paper is structured as follows. Section \ref{sect:prelim} provides some background information in relation to our conceptual framework. Section \ref{sect:probdef} covers the problem definition section where we discuss some popular adversarial byzantine threat models on FL. In Section \ref{propmethod}, we describe our proposed FL architecture followed by Section \ref{Results} which focusses on the evaluation and comparison of our proposed framework under several scenarios. Finally, Section \ref{Conclusion} concludes this manuscript and provides some potential future directions for research. \section{Related Works} Typically, byzantine threats on federated learning scenarios consist of updating arbitrary model parameters from the clients to the server in the aim of impacting the convergence of the model \cite{BarossoFedThreatSurvey}. More specifically, byzantine attacks are typically untargeted threats during which adversarial clients either train their local models on corrupted datasets or fabricate random model updates. Inherently, byzantine threats are usually less stealthy and can be detected through close analysis of the global model performance \cite{9220780}. To address byzantine resiliency in FL, a number of works have been proposed in recent literature. Throughout this section, we briefly summarize the main studies undertaken in regards to byzantine resiliency in FL. A common approach to byzantine-resiliency in FL is to employ aggregation operators which are based on statistically robust estimators. For instance, the authors in \cite{FLTrust, 10.1145/3154503, 9029245} leveraged the use of Byzantine-robust aggregation rules by comparing the local updates of clients and filtering out statistical outliers prior to global model updates. Furthermore, Blanchard et al. \cite{10.5555/3294771.3294783} proposed a computationally expensive \textit{Krum} algorithm which performs gradient update selection and has the least sum of distances from the nearest gradient updates during each iteration. In addition, \cite{pmlr} introduced \textit{Bulyan} as an extension of Krum to recursively find subset of nodes using Krum and eventually perform an element-wise pruned mean on the updates to exclude the high magnitude values. Similarly, a handful of other byzantine-robust aggregation operators \cite{distChen, RSALi, pmlr_v80_yin18a, 9153949,PillutlaAggregation, GonzalezByzantine, ShuhaoResidual} have been proposed in existing literature to mitigate the vulnerability of FL to byzantine attacks. Another interesting study in \cite{9669031} utilized a mixed-strategy game-theoretic approach between the server and the clients whereby each client can either update good or corrupted model parameters while the server can either choose to accept or discard them. By employing the Nash Equilibrium property, the clients' updates were selected based on their probability of providing the correct updates. In addition to the design of byzantine-robust operators, several other defence strategies have been employed through anomaly detection \cite{ShiqiDefending, 9054676, 8975792}, pre-processing methods \cite{https://doi.org/10.48550/arxiv.2004.04986}, etc. However, while much work has been carried out to mitigate the threats of FL, little to no work has been carried out on secure, privacy-preserving and fault-tolerant FL frameworks for residential short-term electrical load forecasting to the best of our knowledge. \section{Preliminary} \label{sect:prelim} Throughout this section, we will discuss some preliminary and related background knowledge on FL and Differential Privacy (DP). Furthermore, within this section, we shall discuss a conventional FL set-up for short term load forecasting which will be used as a baseline during the evaluation of our proposed scheme. \subsection{Federated Learning} For the past couple of decades, Artificial Intelligence (AI) has transformed every walk of life and proven its benefits within several fields. However, one of the biggest real-world challenge faced by AI is the design of high-performing models due to natural data fragmentation coupled with security and privacy enforcement. Eventually, to alleviate this issue, \cite{Fedpap} introduced a fundamentally novel learning technique known as \textit{Federated Learning} which enables the collaborative decentralised training of machine learning models without the physical migration of raw data as depicted in Fig. \ref{fig:fedillus}. \begin{figure}[!h] \centering \includegraphics[width=7cm]{Federated_Learning_illustration.png} \caption{An illustration of the steps involved in FL.} \label{fig:fedillus} \end{figure} Suppose we have $N$ clients and each client $C_i$ holds a local training dataset $D_i$ where $i \in {1,2,...,N}$. An active $C_i$, participating in in the local training, aims to collaboratively learn the weights $w_i$ of the shared global model such that a certain empirical loss $L_i$ is minimized. Therefore, we can formulate the optimization problem solved by multiple data owners as $w^* = \underset{w_i}{\mathrm{arg\ min}} \displaystyle \sum_{i=1}^N L_{i} (w_{i})$. Specifically, each communication round proceeds as shown in Fig. \ref{fig:fedillus} through the following steps: (1) The central server sends a unanimous global model $w$ to the active FL clients. (2) Each client trains the local model by using its own local dataset $D_i$ in order to solve the optimization problem $\underset{w_i}{\mathrm{min}}\ L_i(D_i, w_i)$. (3) Each client updates its local model parameters to the central server. (4) The server computes the global model update by aggregating the parameters received from the local models such that. (5) Lastly, the server sends back the updated parameters to the local models. This iterative process is continued until convergence of the global model. Furthermore, there are two baseline approaches to train models in a FL set-up namely Federated Averaging (Fed-Avg) and Federated Stochastic Gradient Descent (Fed-SGD). Generally, Fed-SGD \cite{pmlr-v119-malinovskiy20a} averages the locally computed gradient at every step of the learning phase while Fed-Avg \cite{9488877} averages local model updates when all the clients have completed training their models. However, as mentioned before, regardless of the approach used, FL is prone to several privacy and security threats, which have been discussed as following. \subsection{Differential Privacy} \label{sect:diffpriv} Due to the several drawbacks of data anonymization techniques such as loss of data utility, risks of re-identification, etc., Differential Privacy (DP) emerged as a formal framework that enables the quantification of the preservation of individual privacy within a statistical database during the release of useful aggregate information \cite{9594795}. Therefore, we formally define some related concepts in relation to DP as in the following: \noindent \textbf{Definition 1}: A randomized algorithmic mechanism $M: X \longrightarrow R$ with domain $X$ and range $R$ satisfies ($\epsilon$, $\delta$)-differential privacy if for all measurable sets $S \subseteq R$ and if for any two adjacent inputs $D$, $D' \in X$, the following holds: $Pr[M(D) \in S] \leq exp(\epsilon) \times Pr[M(D') \in S] + \delta$. Here $Pr$ denotes probability \cite{9594795}. \noindent \textbf{Definition 2}: The privacy loss $L$ of a randomized algorithmic mechanism $M: X \longrightarrow R$ for any result $v \in R$ and for any two data samples $D$, $D' \in X$ is expressed as: $L(v, D, D') = log \dfrac{Pr[M(D) = v]}{Pr[M(D') = v]}$ \cite{9594795}. One of the most popular noise addition mechanisms for DP is the Gaussian Mechanism. A given noise distribution $n \sim N(0, \sigma^2)$ preserves ($\epsilon$,$\delta$)-DP where $N$ is a Gaussian distribution with 0 mean and variance $\sigma$, such that the noise scale is $\sigma \geq c\Delta s/\epsilon$ and the constant $c \geq \sqrt{2ln(1.25/\delta)}$ for $\epsilon \in (0,1)$ where $\Delta s$ is the sensitivity of the real-valued function. However, it is important to note that choosing the right amount of noise is a significant challenge that still lingers within research. \subsection{Federated Load Forecasting with Fed-SGD (Benchmark)} During Fed-SGD, a distributed stochastic gradient descent algorithm is applied within a federated environment to jointly train the global model. As shown in Algorithm \ref{FedSGDalgo}, during each communication round, each client $k$ computes the gradient $g_k$ by initially optimizing the loss of the local model using their local dataset $D_{k}$. The local gradients $g_k$ is then sent to the control centre whereby they are aggregated and the new gradient updates are pushed back to the local models. Eventually, the whole process is continued until convergence. \begin{algorithm} \textbf{Input}: learning rate $\eta$, each client $k$, local data $D_{k}$. Control centre initializes and distributes unanimous model $m_0$ and encrypted parameter initialization $||\hat{m}_0||$ to all clients $N$. \For{each communication round $T_{cl} = 1,2,..., t$}{ \For{each client $k \in N$}{ Compute gradient $g_k$ by training model on local dataset $D_k$. Send to Control Centre. \textbf{end} } Control Centre aggregates the local gradient updates as $g$. Control centre pushes updated gradients back to the local models. \textbf{end} } \caption{Short-term Load Forecasting with Fed-SGD.} \label{FedSGDalgo} \end{algorithm} \section{Problem Definition \& Adversarial Models} \label{sect:probdef} Federated learning enables promising privacy-preserving data analytics for smart grids by pushing model training to devices, thus requiring no direct data sharing \cite{9084352}. Nonetheless, recent literature has revealed its failure to sufficiently guarantee privacy preservation due to update leakage \cite{bhowmick2019protection}, deep leakage\cite{geng2022general}, byzantine attacks \cite{247652}, etc. Throughout this paper, we aim to address byzantine threats in relation to federated learning for electrical load forecasting. Before we present our proposed defense strategy, in this section, we consider three types of byzantine threat models on federated load forecasting as in the following: \begin{enumerate}[leftmargin=*] \item \textbf{Threat Model 1} \textit{(Local Data Poisoning)}: We consider the scenario where a subset of the total number clients $k$ to be malicious or are controlled by a malicious attacker. Malicious clients may be injected to the federated learning framework through the addition of adversarially-controlled smart metering devices. The goal of the adversary is to manipulate the learnt parameters such that the global model $M$ has high indiscriminate errors, thus implying that the attack objective is: $Attack(D_{k} \cup D_{k}', m_{t}^k) = max \displaystyle \sum_{i=1}1[f(x_{i}'; m_{t}^k ) = t_{i}'] $, where $m_{t}^k$ represents the updated model. Each malicious client is able to stealthily alter their local training sample, $D_k$ but is unable to access and manipulate the data of other participants or the model learning process. Let $D_k = \{(x_i, t_i)|i = 1,...,n\}$ denote the pristine local training dataset with $n$ samples where $x_i$ is the time instance and $y_i$ is the corresponding electrical load consumed. Each malicious client $k$ modifies their dataset $D_k$ such that the trigger $v$ is inserted into $x_i$ whereby $x_{i}' = x_i + v, t_i$. The sign $+$ denotes the addition of the poison trigger $v$ to $x$ such that the poisoned dataset $D_{k}' = \{(x_{i}', t_{i}'|i = 1,...,n\}$. The poisoned dataset $D_{k}'$ is then used for model training. The adversary's goal is to ensure the degradation of forecasts of the auxiliary data by the global model. \item \textbf{Threat Model 2} \textit{(Model Leakage \& Poisoning)}: In this scenario, we assume that the adversary can arbitrarily manipulate the local models sent from the clients to the central aggregator for illicit purposes but cannot observe the training data of other honest clients. Similarly, during this type of threat, the ultimate adversarial goal is to manipulate the learnt global model such that it has a high error rate indiscriminately for testing examples. Such attacks directly negatively impact the usability of the model and will eventually lead to denial-of-service attacks. \item \textbf{Threat Model 3} \textit{(Colluding attack)}: Lastly, we consider the cross-device scenario whereby multiple malicious clients are present during the federated training iteration. The adversaries intentionally collude with each other during a single iteration by sending the same update. i.e., each of the attackers send the same learnt update during some of the training iterations such that the goal of this threat model relies upon the manipulation of the learnt global model to induce high error rates. \end{enumerate} \section{Proposed Method} \label{propmethod} Within this section, we propose a new FL framework to circumvent the aforementioned byzantine threats on FL for short-term load forecasting. The key idea lies in sharing just the sign of the gradients to preserve privacy. We present the our developed solution as in the following: \subsection{System Model Overview} \begin{figure} \centering \includegraphics[width=8cm]{DP-Fed.png} \caption{An illustration of proposed approach.} \label{fig:proposedapp} \end{figure} As previously discussed, the objective of this study is to design a robust and privacy-preserving FL framework for residential short-term load forecasting. As shown in Fig \ref{fig:proposedapp}, our proposed method consists of three components as discussed. \begin{enumerate}[leftmargin=*] \item \textit{Electrical Appliances}: Whenever someone within a household uses one of the electrical appliances, the load consumption is collected by the smart meter \item \textit{Smart Meter}: Each customer has a smart meter that is connected a Home Area Network. Each smart meter collects energy load consumption profiles. The data collected is locally stored on the HAN of the consumer such that local models can be trained using their own dataset. \item \textit{Control Centre}: The control centre is responsible for broadcasting a learning model and default model parameters, aggregation of parameters after training and finally broadcasting the updated model parameters. \end{enumerate} \subsection{Algorithm Design} Within a conventional federated learning setting with $N$ clients, at round $t$, a selected client $k \in N$ performs local gradient descent iterations $T_{gd}$ using a common broadcasted local model $m_{t-1}$ on its local training sample $D_{k}$ such that a new updated model $m_{t}^k$ is obtained. Each client $k$ then sends its updated parameters $\Delta m_{t}^k = m_{t}^k - m_{t-1}^k$ to the central orchestrator which in turn aggregates model updates from all $N$ clients $\forall k \in N$ such that $m_{t} = m_{t-1} + \sum_{k \in N} \dfrac{|D_{k}|}{\sum_{j} |D_{j}|} \Delta m_{t}^k$. The model training continues until convergence and is subsequently terminated after a set number of rounds $T_{cl}$. \begin{algorithm} \textbf{Input}: learning rate $\eta$, each client $k$ local data $D_{k}$. Control centre distributes unanimous model $m_{0}$ and encrypted parameter initialization $||\hat{m_{0}}||$ to all clients $N$. \For{each communication round, $T_{cl} =1,..., t$}{ \For{each client $k$}{ Compute the gradient $g_{k}= m_{t}^k - m_{t-1}^k$ by training on local dataset $D_k$. Obtain sign vector $sign(\Delta m_{t}^k)$ from $g_k.$ Perturb $sign(\Delta m_{t}^k)$ with a random Gaussian noise $\zeta_{k}$ such that $\sum_{k \in N} sign(\Delta m_{t}^k) + \zeta_{k}$ satisfies differential privacy. Encrypt $sign(\Delta m_{t}^k) + \zeta_{k}$ into $E_{k}[sign(\Delta m_{t}^k) + \zeta_{k}]$ and send to control centre. \textbf{end} } Control Centre aggregates encrypted updates $\sum_{k} E_{N_{k}} (sign(\Delta m_{t}^k) + \zeta_{k})$. Control Centre pushes $sign(g_N)$ to all clients, $N$. \textbf{end} } \caption{Proposed Framework} \label{proposedalgo} \end{algorithm} However, in the context of smart grids, conventional federated learning settings pose several privacy risks as earlier discussed. Therefore, we propose a novel privacy-preserving federated learning framework for electrical load forecasting through model weight quantization as in \cite{jin2021stochasticsign}. Specifically, as shown in Algorithm \ref{proposedalgo} and Figure \ref{fig:proposedapp}, a selected client $k$ initially computes the gradient update $g_{k} = m_{t}^k - m_{t-1}^k$ from which it obtains the sign vector $sign(\Delta m_{t}^k) = sign(m_{t}^k - m_{t-1}^k)$ where $sign(\Delta m_{t}^k)$: $\mathbb{R}^n \longrightarrow {-1,1}^n$. A random Gaussian noise $\zeta_{k}$ is then added to perturb $sign(\Delta m_{t}^k)$ such that $\sum_{k \in N} sign(\Delta m_{t}^k) + \zeta_{k}$ satisfies differential privacy. Furthermore, to prevent an adversary from learning $sign(\Delta m_{t}^k) + \zeta_{k}$ accurately in circumstances where $N$ is large, each client $k$ updates the encrypted results $E_{k}[sign(\Delta m_{t}^k) + \zeta_{k}]$ to the central aggregator. The orchestrator in turn sums all the encrypted model updates from $N$ such that $\sum_{k} E_{N_{k}} (sign(\Delta m_{t}^k) + \zeta_{k})$. This aggregation follows the selection of the median of all $N$ clients signs at every position of the update vector. The model training continues until convergence and is subsequently terminated after a set number of rounds $T_{cl}$. \subsection{Convergence Analysis} In the following, we will present a formal analysis of the SIGNSGN approach through the use of refined assumptions derived from conventional SGD assumptions. \noindent\textbf{Assumption 1} \textit{(Lower Bound)}: Given an objective/loss function $f$, at any point $x$, $f(x) \geq f^(x^*)$, where $f^(x^*)$ represents the objective value and $x^*$ represents the global minima of f(x). This standard assumption is indeed necessary to ensure the convergence to a stationary point. \noindent\textbf{Assumption 2} \textit{(Smoothness)}: Given an objective/loss function $f$, the gradient of $f$ (derivative of the function with respect to $x$) when evaluated on any coordinate $(x, y)$ can be represented as $g(x)$. Then, for $\forall x, y$ and for some non-negative constant $L_{i}$, we require that $|f(y) - [f(x) + g(x)^T (y-x)]| \leq \frac{1}{2} \sum_{i}L_{i}(y_{i} - x_{i})^2$. This assumption is an extension of the Lipschitz Continuity condition which is essential to guarantee that the loss $l$ of $f$ is smooth and convergence of gradient descent algorithms. \noindent\textbf{Assumption 3} \textit{(Variance Bound)}: Upon receiving the query $ x \in \mathbb{R}^n$, the stochastic gradient oracle results in an independent, unbiased estimate $\hat{g}$ that has bounded variance per coordinate $\mathbb{E}[\hat{g}(x)] = g(x)$, $\mathbb{E}[(\hat{g}(x)_{i} - g(x)_{i})^2 \leq \sigma{i}^2 $ where $\sigma{i}^2$ is the uniform variance bound. The classical convergence analysis of SGD is carried out under the assumption that the norm of the stochastic gradient is uniformly bounded. While this might hold for some loss functions, bounded variance may be violated where $f$ is strongly convex as $x \longrightarrow \infty$. However, this assumption is necessary to grasp the fundamental properties of stochastic optimisation algorithms. \noindent\textbf{Assumption 4} \textit{(Gradient Noise)}: At any given point $x$, each component of the stochastic gradient vector, $\hat{g}(x)$, must have a unimodal distribution that is also symmetric about the mean. This assumption ensures that the addition of extra noise for the purpose of differential privacy does not skew the distribution and decrease utility. Under these assumptions, we have the following result: \noindent \textbf{Theorem 1} \textit{(Non-convex convergence rate of SIGNSGD)}: Run algorithm 1 for $K$ iterations under Assumptions 1 to 3. Set the learning rate as $\delta_k = \dfrac{1}{\sqrt{||L||_1 K}}$ where $n_k = K$. Let $N$ be the cumulative number of stochastic gradient calls up to step $K$, i.e. $N = O(K^2)$. Then we have $\mathbb{E}[\dfrac{1}{K} \displaystyle \sum_{k = 0}^{K-1}||g_k||_1 ]^2 \leq \dfrac{1}{\sqrt{N}}[\sqrt{||L||_1 } (f_0 - f_* \dfrac{1}{2}) + 2||\sigma||_1]$. \section{Simulation \& Results} \label{Results} In this section, we provide the results of the experimental evaluations of our proposed approach. We first introduce the dataset used and the settings shared by all experiments. Next, the performance of the proposed approach is presented and compared throughout different scenarios. Lastly, we discuss the overall results. \subsection{Experimental Setup} This research was conducted using \textit{Solar Home Electricity Data} from Eastern Australia's largest electricity distributor, Ausgrid. The dataset composes of half-hourly electricity consumption data of 300 de-identified customers which is measured using gross meters during the period starting 1\textsuperscript{st} July 2012 to 30\textsuperscript{th} June 2013. We initially filter the data based on General Consumption (GC) category. It is then converted to the suitable time-series format. It is then split into test (30\%) and train (70\%) subsets. Every experiment carried out have the following general configurations. There is a set number of clients (10 clients) each holds a local subset of the data and there is a server which helps to coordinate the FL scenario. The model performance is evaluated using three metrics: \textit{Mean Squared Error (MSE)}, \textit{Root Mean Squared Error (RMSE)} and lastly, \textit{Mean Absolute Percentage Error (MAPE)}. \subsection{Comparison with Baseline (No Attack)} Throughout this section, we present the experimental results to compare the performance of the proposed approach against the conventional Fed-SGD approach. As shown in Fig. \ref{fig:trainloss}(a), it can be seen that the Fed-SGD reaches convergence after the 47\textsuperscript{th} communication round while the proposed approach converges after the 40\textsuperscript{th} communication round. \begin{figure}[!h] \centering \subfloat[\centering Convergence of Federated LSTM-CNN model ]{{\includegraphics[width=4cm]{FedSGDvsProposed.png} }}% \qquad \subfloat[\centering MAPE (\%) per client ]{{\includegraphics[width=3.9cm]{ComparisonMAPEprop.png} }}% \caption{Comparison between Fed-SGD and proposed approach.}% \label{fig:trainloss} \end{figure} \begin{table}[!h] \caption{Evaluation of Fed-SGD with several models \label{CompaGedSGD}} \begin{tabular}{|l|l|l|l|l|l|} \hline \textbf{Metric} & \textbf{RNN} & \textbf{GRU} & \textbf{LSTM} & \textbf{CNN} & \textbf{LSTM-CNN} \\ \hline \textbf{MSE} & 0.2657 & 0.1973 & 0.1634 & 0.2567 & 0.1583 \\ \hline \textbf{RMSE} & 0.5346 & 0.4042 & 0.3463 & 0.5243 & 0.3008 \\ \hline \textbf{MAPE (\%)} & 16.4 & 10.9 & 11.0 & 12.8 & 9.7 \\ \hline \end{tabular} \end{table} \begin{table}[!h] \caption{Evaluation of proposed method with several models \label{CompaSignSGDModel}} \begin{tabular}{|l|l|l|l|l|l|} \hline \multicolumn{1}{|l|}{\textbf{Metric}} & \multicolumn{1}{l|}{\textbf{RNN}} & \multicolumn{1}{l|}{\textbf{GRU}} & \multicolumn{1}{l|}{\textbf{LSTM}} & \multicolumn{1}{l|}{\textbf{CNN}} & \multicolumn{1}{l|}{\textbf{LSTM-CNN}} \\ \hline \multicolumn{1}{|l|}{\textbf{MSE}} & \multicolumn{1}{l|}{0.2662} & \multicolumn{1}{l|}{0.1864} & \multicolumn{1}{l|}{0.1803} & \multicolumn{1}{l|}{0.2456} & \multicolumn{1}{l|}{0.1437} \\ \hline \multicolumn{1}{|l|}{\textbf{RMSE}} & \multicolumn{1}{l|}{0.5432} & \multicolumn{1}{l|}{0.4127} & \multicolumn{1}{l|}{0.3890} & \multicolumn{1}{l|}{0.5329} & \multicolumn{1}{l|}{0.3243} \\ \hline \multicolumn{1}{|l|}{\textbf{MAPE (\%)}} & \multicolumn{1}{l|}{15.9} & \multicolumn{1}{l|}{11.1} & \multicolumn{1}{l|}{10.8} & \multicolumn{1}{l|}{13.6} & \multicolumn{1}{l|}{9.7} \\ \hline \end{tabular} \end{table} \begin{table*}[!ht] \centering \caption{Evaluation of proposed FL framework against Threat Model 1 \& 2 \label{EvaluationFLThreat}} \begin{tabular}{cc|cc|cc|} \cline{3-6} \multicolumn{2}{l|}{\textbf{}} & \multicolumn{2}{c|}{\textbf{Fed-SGD}} & \multicolumn{2}{c|}{\textbf{Proposed Solution}} \\ \hline \multicolumn{1}{|c|}{\textbf{\begin{tabular}[c]{@{}c@{}}\% of Compromised\\ Clients\end{tabular}}} & \textbf{Metric} & \multicolumn{1}{c|}{\textbf{Threat Model 1}} & \textbf{Threat Model 2} & \multicolumn{1}{l|}{\textbf{Threat Model 1}} & \multicolumn{1}{l|}{\textbf{Threat Model 2}} \\ \hline \multicolumn{1}{|c|}{\multirow{3}{*}{\textbf{10}}} & \textbf{MSE} & \multicolumn{1}{c|}{0.2910} & 0.3134 & \multicolumn{1}{c|}{0.1621} & 0.1532 \\ \cline{2-6} \multicolumn{1}{|c|}{} & \textbf{RMSE} & \multicolumn{1}{c|}{0.4732} & 0.5490 & \multicolumn{1}{c|}{0.3251} & 0.3029 \\ \cline{2-6} \multicolumn{1}{|c|}{} & \textbf{MAPE (\%)} & \multicolumn{1}{c|}{18.2} & 20.1 & \multicolumn{1}{c|}{10.1} & 9.9 \\ \hline \multicolumn{1}{|c|}{\multirow{3}{*}{\textbf{20}}} & \textbf{MSE} & \multicolumn{1}{c|}{0.4180} & 0.4519 & \multicolumn{1}{c|}{0.1835} & 0.1642 \\ \cline{2-6} \multicolumn{1}{|c|}{} & \textbf{RMSE} & \multicolumn{1}{c|}{0.7893} & 0.9201 & \multicolumn{1}{c|}{0.3502} & 0.3129 \\ \cline{2-6} \multicolumn{1}{|c|}{} & \textbf{MAPE (\%)} & \multicolumn{1}{c|}{25.7} & 27.1 & \multicolumn{1}{c|}{12.2} & 10.8 \\ \hline \multicolumn{1}{|c|}{\multirow{3}{*}{\textbf{30}}} & \textbf{MSE} & \multicolumn{1}{c|}{0.7319} & 0.8192 & \multicolumn{1}{c|}{0.2678} & 0.2134 \\ \cline{2-6} \multicolumn{1}{|c|}{} & \textbf{RMSE} & \multicolumn{1}{c|}{1.2398} & 1.4576 & \multicolumn{1}{c|}{0.4249} & 0.3965 \\ \cline{2-6} \multicolumn{1}{|c|}{} & \textbf{MAPE (\%)} & \multicolumn{1}{c|}{38.9} & 42.2 & \multicolumn{1}{c|}{17.3} & 14.1 \\ \hline \end{tabular} \end{table*} \begin{table}[] \caption{Evaluation of proposed FL framework against Threat Model 3\label{EvaluationFLThreat3}} \begin{tabular}{|c|c|c|c|} \hline \multicolumn{1}{|l|}{\textbf{\% of Comp. Clients}} & \multicolumn{1}{l|}{{ \textbf{Metric}}} & \multicolumn{1}{l|}{{\textbf{Fed-SGD}}} & \multicolumn{1}{l|}{{\textbf{Proposed Solution}}} \\ \hline & \textbf{MSE} & 0.3103 & 0.1732 \\ \cline{2-4} & \textbf{RMSE} & 0.5321 & 0.3324 \\ \cline{2-4} \multirow{-3}{*}{\textbf{20}} & \textbf{MAPE (\%)} & 19.3 & 11.2 \\ \hline & \textbf{MSE} & 0.5231 & 0.2034 \\ \cline{2-4} & \textbf{RMSE} & 0.8743 & 0.3958 \\ \cline{2-4} \multirow{-3}{*}{\textbf{30}} & \textbf{MAPE (\%)} & 34.0 & 14.0 \\ \hline & \textbf{MSE} & 0.7793 & 0.2901 \\ \cline{2-4} & \textbf{RMSE} & 1.2343 & 0.4302 \\ \cline{2-4} \multirow{-3}{*}{\textbf{40}} & \textbf{MAPE (\%)} & 39.5 & 16.4 \\ \hline \end{tabular} \end{table} \begin{table}[] \centering \caption{Evaluation of proposed FL framework under different Privacy Budgets \label{threat3}} \begin{tabular}{|c|c|c|c|} \hline \textbf{$\epsilon$-Budget} & \textbf{Metric} & \textbf{Fed-SGD} & \multicolumn{1}{l|}{\textbf{Proposed Solution}} \\ \hline \multirow{3}{*}{\textbf{0.01}} & \textbf{MSE} & 0.1583 & 0.1437 \\ \cline{2-4} & \textbf{RMSE} & 0.3 & 0.3243 \\ \cline{2-4} & \textbf{MAPE (\%)} & 9.7 & 9.7 \\ \hline \multirow{3}{*}{\textbf{0.1}} & \textbf{MSE} & 0.4320 & 0.1645 \\ \cline{2-4} & \textbf{RMSE} & 0.8173 & 0.3192 \\ \cline{2-4} & \textbf{MAPE (\%)} & 26.4 & 10.5 \\ \hline \end{tabular} \end{table} \begin{figure*}[!h] \centering \subfloat[\centering Impact of Threat Model 1 ]{{\includegraphics[width=5cm]{Attack1FedSGD.png} }}% \subfloat[\centering Impact of Threat Model 2 ]{{\includegraphics[width=5cm]{ImpactT2FedSGD.png} }}% \subfloat[\centering Impact of Threat Model 3 ]{{\includegraphics[width=5cm]{ImpactofEPonFedSGD.png} }}% \caption{Impact of Attacks on Fed-SGD}% \label{fig:impactFedSGD} \end{figure*} \begin{figure*}[!h] \centering \subfloat[\centering Impact of Threat Model 1 ]{{\includegraphics[width=5cm]{Threat1Mitig.png} }}% \subfloat[\centering Impact of Threat Model 2 ]{{\includegraphics[width=5cm]{Threat2Mitig.png} }}% \subfloat[\centering Impact of Threat Model 3 ]{{\includegraphics[width=5cm]{Threat3Mitig.png} }}% \caption{Mitigating threat models using our proposed method}% \label{fig:impactSIGNSGD} \end{figure*} As our proposed solution converges faster that the traditional Fed-SGD one, we can conclude that the proposed approach provides a fast algorithmic convergence. Furthermore, we use the three aforementioned evaluation metrics to compare and contrast the performance of the proposed solution against Fed-SGD with several models as presented in Table \ref{CompaGedSGD} and Table \ref{CompaSignSGDModel}. The experimental results reveal that the the proposed framework reaches similar performance as compared to the Fed-SGD approach. Similarly, in Fig. \ref{fig:trainloss}(b), the MAPE per active household within the FL set ups are contrasted which shows that our proposed approach reaches relatively similar performance as compared to the Fed-SGD. More specifically, after the comparison, we can deduce that our proposed framework reaches good generalization performance for short-term load forecasting within acceptable error ranges. Moreover, after comparing the proposed framework based on models as presented in Table \ref{CompaSignSGDModel}, it can be deduced that LSTM-CNN model shows the best overall forecasting performance with an average MAPE of 9.7\% in both the conventional Fed-SGD and the proposed FL framework. \subsection{Impact on attacks on proposed framework} In this section, we evaluate the robustness of our proposed FL framework against the adversarial threat models as described in Section \ref{sect:probdef}. To discuss the impact of Byzantine Attacks on the standard Fed-SGD and our proposed approach, we further divide the results into the two following sections: \subsubsection{Impact of attacks on Fed-SGD} After evaluating the impact of the three byzantine threat models as in Section \ref{sect:probdef}, we present the results within this section. In Table \ref{EvaluationFLThreat}, we evaluated the performance of Fed-SGD under Threat Model 1 \& 2 respectively. For both threat models, there is a direct relationship between the percentage of compromised active FL clients and the mean error of the FedSGD FL model, that is, once the percentage of compromised clients increases, the mean error of the FL model decreases. Specifically, for threat models 1 \& 2, at 10\% of compromised clients, the MAPE of the FL model is 18.2\% and 20.1\% respectively, thereby following an upward trend such that at 30\% of compromised, the MAPE of the FL model reaches around 38.9\% and 42.2\% respectively. It is worth noting that once a third of the clients are compromised/malicious, there is almost around an average of 40\% difference between the actual value and the forecasted value. On the other hand, Table \ref{EvaluationFLThreat3} investigates the impact of the colluding attack on the Fed-SGD setup. Similarly, the the number of compromised clients is directly proportional to the mean error of the FL model. As the number of colluding adversaries increases, the mean error of the FL model also increases. Furthermore, based on Fig. \ref{fig:impactFedSGD}(a) and Fig. \ref{fig:impactFedSGD}(b), we can note that as the percentage of compromised clients increase, the FL model loss starts to diverge after a certain number of communication rounds due to threat models 1 \& 2. Similarly, based on Fig. \ref{fig:impactFedSGD}(c), as the number of colluding adversaries increases, the FL model loss starts to diverge after a certain number of communication rounds. \subsubsection{Impact of proposed FL framework on attacks} Within the previous section, we discussed the impact of attacks on the standard Fed-SGD setup. However, throughout this one, we will discuss the impact of our proposed solution on mitigating the threat models presented in Section \ref{sect:probdef}. As presented in Table \ref{EvaluationFLThreat}, when our proposed solution is under attack by threat models 1 \& 2, at 10\% of compromised clients, the mean error of the FL model stayed relatively similar to the MAPE of the model prior to any attacks. Gradually, with increasing percentage of compromised clients, it can be seen that there is a slight increase in the MAPE. Specifically, from 20\% to 30\% of compromised clients, the MAPE is 5.1\% and 3.3\% for threat models 1 \& 2 respectively. However, the small increase in the mean error of the FL model is still within acceptable ranges. Similarly, based on Table \ref{EvaluationFLThreat3}, it is evident that there is a very slight increase (within acceptable error ranges) in the MAPE value as the number of compromised clients increases. Furthermore, based on Fig. \ref{fig:impactSIGNSGD}, we notice that the under all percentages of compromised clients, our proposed model is optimized such that it converges after a certain number of communication rounds/iterations. Therefore, we can eventually conclude that our proposed approach effectively mitigates byzantine attacks. \subsection{Results Discussion} With increasing concerns and regulation enforcement in regards to security and privacy within the smart grid paradigm, it is crucial to develop privacy-preserving and robust short term load forecasting solutions. FL, whilst still being in its infant stage, requires further improvements under different circumstances. Therefore, throughout this study, we investigate Byzantine attacks in relation to federated short term load forecasting. Furthermore, we propose and design a robust defense solution to mitigate those threats. From Table \ref{CompaGedSGD} and \ref{CompaSignSGDModel} above, it can be seen that our proposed approach reaches comparable forecasting performance as FedSGD when there are no attacks. Similarly, when compared to several other time-series forecasting models, our proposed approach matches that of Fed-SGD. More specifically, we achieved the best overall performance of our proposed approach using the LSTM-CNN model with a MAPE of 9.7\% for both FL setups. Therefore, we selected LSTM-CNN as the principal model to evaluate our proposed approach under the three threat models as discussed in Section \ref{sect:probdef}. Based on the experimental results presented in Tables \ref{EvaluationFLThreat} and \ref{EvaluationFLThreat3} as well as the Figs. \ref{fig:impactFedSGD} and \ref{fig:impactSIGNSGD}, under the conventional Fed-SGD approach, we notice an overall degradation in the performance of the model with increasing intensity of attacks. For instance, an increase in the percentage of compromised clients results an upward shift in the mean error of the model. On the flip side, we notice that our proposed approach can withstand such attacks with minimal impact on the mean error of the FL model. This leads us to conclude that it is indeed a resilient and privacy-preserving FL set-up for residential short-term load forecasting. \section{Conclusion} \label{Conclusion} The rapid adoption of FL within the smart grid ecosystem has spiked the interest of researchers to address its security and privacy issues. Byzantine attack mitigation plays a crucial role in securing and enhancing the robustness of FL for short-term load forecasting. Therefore, throughout this manuscript, we propose a state-of-the-art FL-based approach that leverages the notions of gradient quantization and differential privacy to overcome this challenge. Furthermore, we empirically demonstrate that our proposed solution effectively mitigate popular byzantine threats and provides relatively similar performance as compared to standard FL setups. Finally, the next steps in this research are to: (1) design and evaluate our proposed FL framework against stronger byzantine attacks, and, (2) take into consideration the existence of distributed energy resources to improve the grid model. \bibliographystyle{IEEEtran}
{'timestamp': '2022-09-30T02:07:20', 'yymm': '2209', 'arxiv_id': '2209.14547', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14547'}
arxiv
\section{Introduction} Developing machines equipped with mathematical reasoning capabilities is one of the long-standing goals of artificial intelligence. Solving math word problems (MWPs) is a well-defined task to diagnose the ability of intelligent systems to perform numerical reasoning and problem-solving as humans. A surge of datasets has been proposed to facilitate the research in this domain \citep{upadhyay2017annotating,amini2019mathqa,miao2020diverse,cobbe2021training}. However, most existing MWP datasets focus on textual math word problems only. Tables, widely distributed in different documents such as invoices, health records, and financial reports, contain rich structured information different from unstructured text. Solving math word problems in such a tabular context is much more challenging than existing MWP benchmarks since the system needs to make cell selections and align heterogeneous information before performing further numerical reasoning. \begin{figure}[t!] \centering \vspace{-5mm} \includegraphics[width=1.0\textwidth]{figures/fig_dataset.pdf} \caption{Two examples from the \textsc{TabMWP}\xspace dataset. The example above is a \textit{free-text} problem with a numerical answer; the example below is a \textit{multi-choice} problem with a textual answer.} \vspace{-5mm} \label{fig:dataset} \end{figure} To fill this gap, we propose \text{Tab}ular \text{M}ath \text{W}ord \text{P}roblems (\textsc{TabMWP}\xspace{}), a new large-scale dataset that contains 38,431 math word problems with tabular context, taken from grade-level math curricula. There are two question types: \textit{free-text} questions in which the answer is an integer or decimal number, and \textit{multi-choice} questions where the answer is a text span chosen from option candidates. Different from existing MWP datasets, each problem in \textsc{TabMWP}\xspace{} is accompanied by a tabular context, which is represented in three formats: an image, a semi-structured text, and a structured table. Each problem is also annotated with a detailed solution that reveals the multi-step reasoning steps to ensure full explainability. To solve problems in \textsc{TabMWP}\xspace, a system requires multi-hop mathematical reasoning over heterogeneous information by looking up table cells given textual clues and conducting multi-step operations to predict the final answer. Take the problem above in Figure \ref{fig:dataset} as an example. To answer the question ``\textit{how much will she spend (if Tracy buys three kinds of beads)}?'', we first need to look up the corresponding three rows in the given table, calculate the individual cost for each kind of bead, and finally sum three costs up to get the answer of 31.44. Inspired the success of the large pre-trained language model GPT-3 \citep{chen2020big} in solving math word problems \citep{wei2022chain,wang2022self}, we first build a strong baseline using few-shot GPT-3 on \textsc{TabMWP}\xspace{}. A few in-context examples are randomly selected from the training set, along with the test example, and are constructed as a prompt for GPT-3 to predict the answer. However, recent studies have shown that this type of few-shot learning can be highly unstable across different selections of in-context examples \citep{zhao2021calibrate, liu2022makes, lu2022fantastically}. It could be worse on \textsc{TabMWP}\xspace{} since its problems are distributed across multiple question types and diverse table layouts. \cite{liu2022makes} try to address this issue by retrieving semantically similar examples. However, this method might not work well on \textsc{TabMWP}\xspace{} because it is not capable of measuring the similarity of structured information, such as the number of cells in tables. To alleviate this challenge, we further propose a novel approach that can learn to select in-context examples from a small amount of training data via policy gradient for prompt learning, termed \textsc{PromptPG}\xspace. As illustrated in Figure \ref{fig:model}, an agent learns to find optimal in-context examples from a candidate pool, with the goal of maximizing the prediction rewards on given training examples when interacting with the GPT-3 environment. A policy network defines the strategy of how to select the in-context examples given the current training example. The policy network is built on top of the language model BERT \citep{devlin2018bert} with fixed parameters, followed by a one-layer linear neural network with learnable parameters. The learnable parameters are updated following the policy gradient strategy \citep{sutton1998introduction}. Unlike random selection \citep{wei2022chain,wang2022self}, brute-force search, or retrieval-based selection \citep{liu2022makes}, \textsc{PromptPG}\xspace learns to construct the prompt dynamically given the candidate pool when interacting with the GPT-3 API. We implement two state-of-the-art methods as baselines, i.e., UnifiedQA \citep{khashabi2020unifiedqa} on general question answering and TAPEX \citep{liu2022tapex} on tabular question answering. Both are implemented in pre-trained and fine-tuned settings. Experimental results show that our model \textsc{PromptPG}\xspace can achieve an overall accuracy of 68.23\% on \textsc{TabMWP}\xspace, which greatly surpasses previous methods by a large margin of up to 5.31\%. Further analysis demonstrates that \textsc{PromptPG}\xspace can select better in-context examples compared with a wide range of existing selection strategies and reduce the prediction variance significantly compared to random selection. The main contributions of our work are as follows: (a) We present a new large-scale dataset, \textsc{TabMWP}\xspace, the first dataset for math word problems with tabular context; (b) We propose a novel approach, \textsc{PromptPG}\xspace, which learns the prompt dynamically via policy gradient to select in-context examples for few-shot GPT-3. To the best of our knowledge, it is the first work that applies reinforcement learning to select in-context examples for the few-shot GPT-3 model; (c) Experimental results show that \textsc{PromptPG}\xspace achieves an improvement of up to 5.31\% on \textsc{TabMWP}\xspace over existing methods, with reduced selection instability compared to random selection. \begin{figure}[t!] \centering \vspace{-5mm} \includegraphics[width=0.9\textwidth]{figures/fig1_model.pdf} \caption{Our proposed \textsc{PromptPG}\xspace is able to learn to select performing in-context examples via policy gradient when interacting with the GPT-3 API without any manually designed heuristics.} \vspace{-3mm} \label{fig:model} \end{figure} \section{The \textsc{TabMWP}\xspace Dataset} \subsection{Task Formulation} A tabular math word problem $p$ is represented as a pair ($t$, $q$), where $t$ is a table context and $q$ is a question. The table $t$ could be represented in a visual format as an image, semi-structured text, or a structured database. In this work, we focus on the semi-structured format as the table context for simplicity. The table $t$ features complicated layouts and formats: it contains multiple rows and columns, and each cell can be a string of text, a string of a number, or a mix of them. Depending on the question and answer types, the question $q$ may be accompanied by multiple-choice options $c=\{c_1, c_2, \dots, c_n\}$ or a unit $u$. Given a semi-structured tabular context $t$ and an unstructured question text $q$, the task is to generate the answer $a$, which is either numerical only text for a \textit{free-text} question, or a text span from given options for a \textit{multiple-choice} question. \subsection{Dataset Construction} \textbf{Data collection.} We construct \textsc{TabMWP}\xspace{} based on openly available content and more details are provided in Appendix \ref{appx:dataset}. Only math word problems that are accompanied by a tabular context and a detailed solution are collected. We develop a script to extract the tabular context, the question, options that apply, the correct answer, and the solution for each problem. These elements can be precisely identified using HTML tags. For each table, we take a screenshot and store its raw text. \textbf{Data preprocessing.} To make \textsc{TabMWP}\xspace{} compatible with various baselines, we represent the tabular context as three formats: an image, \textit{semi-structured} text, and a \textit{structured} spreadsheet. The semi-structured format is created by converting the raw table text into a flattened token sequence, with each row separated by a newline character `\texttt{$\backslash$n}' and each column separated by `\texttt{$\mid$}'. The semi-structured text is further transformed to the structured format, which can be easily retrieved and executed by SQL-based methods \citep{liu2022tapex} using packages like \texttt{pandas}. For clarity, the table title is separated from the raw table. Examples of three formats are shown in Appendix \ref{appx:dataset}. For better quantitative evaluation, we formalize the \textsc{TabMWP}\xspace{} problems as two question types: (a) \textit{free-text} questions, where the answer is numerical text only and the unit text is separately extracted; and (b) \textit{multi-choice} questions, the answer of which is the text span from choice options. The order of choice options is shuffled to alleviate distribution bias. Redundant information in solutions is removed, and some solutions are manually rewritten to be more human-readable. Finally, problems with the same table, question, and answer text are regarded as redundant and thus removed. We further conduct quality control to ensure data quality, which is discussed in Appendix \ref{appx:dataset}. \subsection{Dataset Statistics} \begin{wraptable}{r}{0.42\textwidth} \vspace{-3mm} \centering \renewcommand\tabcolsep{1.5pt} \small \begin{tabular}{lr} \toprule \textbf{Statistic} & \textbf{Number} \\ \midrule Total questions & 38,431 \\ ~~* \textit{free-text} questions & 28,719 \\ ~~* \textit{multi-choice} questions & 9,712 \\ \midrule \# of different questions & 28,876 \\ \# of different answers & 6,153 \\ \# of different solutions & 35,442 \\ \midrule \# of different tables & 37,644 \\ \# of tables with a title & 23,259 \\ \midrule \# of table cells (Average/Max) & 12.9 / 54 \\ \# of table rows (Average/Max) & 5.9 / 11 \\ \# of table columns (Average/Max) & 2.2 / 6 \\ \midrule Question length (Average/Max) & 22.1 / 92 \\ Answer length (Average/Max) & 1.1 / 27 \\ Solution length (Average/Max) & 49.5 / 350 \\ \bottomrule \end{tabular} \captionof{table}{Key statistics for \textsc{TabMWP}\xspace{}.} \vspace{-5mm} \label{tab:statistics} \end{wraptable} \textbf{Key statistics.} The \textsc{TabMWP}\xspace dataset contains 38,431 tabular math word problems, which are partitioned with 6:2:2 into the training, development, and test splits, corresponding to 23,059, 7,686, and 7,686 problems. Their main statistics are shown in Table \ref{tab:statistics}. 74.7\% of the questions in \textsc{TabMWP}\xspace belong to \textit{free-text} questions, while 25.3\% are \textit{multi-choice} questions. There are 28,876 different questions, 6,153 different answers, and 35,442 different solutions, indicating that \textsc{TabMWP}\xspace has a rich diversity in the problem distribution. The questions have an average of 22.1 words in length and solutions of 49.5, showing that they have lexical richness. One distinct characteristic of \textsc{TabMWP}\xspace is that each problem is accompanied by a tabular context, without which the problem would be unsolvable. There are 37,644 different tables in total, and 60.5\% of the tables have a title. The table has an average of 5.9 rows and 2.2 columns, which results in an average of 12.9 cells and a maximum of 54 cells. These statistics suggest that tables in \textsc{TabMWP}\xspace distribute diversely across semantics and layouts. \textbf{Comparison to existing datasets.} As shown in Table \ref{tab:datasets}, \textsc{TabMWP}\xspace differs from related datasets in various aspects: (1) \textsc{TabMWP}\xspace is the first dataset to study math word problems over tabular context on open domains and is the largest in terms of data size; (2) Problems in \textsc{TabMWP}\xspace are annotated with the tabular context, unlike previous MWP datasets in the first segment; (3) Different from Table QA datasets like FinQA, TAT-QA, and MultiHiertt, a lack of either mathematical reasoning or the tabular context renders the problems in \textsc{TabMWP}\xspace unanswerable; (4) There are two question types in \textsc{TabMWP}\xspace, and the answer could be a text span, an integer number, or a decimal number; (5) Each problem is annotated with natural language solutions to reveal multi-hop reasoning steps. \begin{figure}[th!] \centering \renewcommand\tabcolsep{4.0pt} \resizebox{1.0\linewidth}{!}{ \begin{tabular}{p{2.8cm}rrcccccccccc} \toprule \multirow{3}{*}{Dataset} & \multirow{3}{*}{Size} & \multirow{3}{*}{\#Table} & \multirow{2}{*}{Need} & \multirow{2}{*}{Need} & \multicolumn{2}{c}{Table Type} & \multicolumn{2}{c}{Question Type} & \multicolumn{3}{c}{Answer Type} & \multirow{2}{*}{Solution} \\ \cmidrule(lr){6-7} \cmidrule(lr){8-9} \cmidrule(lr){10-12} & & & Math? & Table? & Domain & Format & Free-text & MC & Text & Integer & Decimal & Type \\ \midrule Dolphin18K \citeyearpar{huang2016well} & 831 & \textcolor{red!50!black}{\ding{55}}~~~ & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{green!50!black}{\ding{51}} & formula \\ DRAW-1K \citeyearpar{upadhyay2017annotating} & 1,000 & \textcolor{red!50!black}{\ding{55}}~~~ & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{green!50!black}{\ding{51}} & formula \\ Math23K \citeyearpar{wang2017deep} & 23,162 & \textcolor{red!50!black}{\ding{55}}~~~ & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{green!50!black}{\ding{51}} & formula \\ MathQA \citeyearpar{amini2019mathqa} & 37,297 & \textcolor{red!50!black}{\ding{55}}~~~ & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{green!50!black}{\ding{51}} & formula \\ ASDiv \citeyearpar{miao2020diverse} & 2,305 & \textcolor{red!50!black}{\ding{55}}~~~ & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{green!50!black}{\ding{51}} & formula \\ SVAMP \citeyearpar{patel2021nlp} & 1,000 & \textcolor{red!50!black}{\ding{55}}~~~ & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & formula \\ GSM8K \citeyearpar{cobbe2021training} & 8,792 & \textcolor{red!50!black}{\ding{55}}~~~ & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & text \\ IconQA \citeyearpar{lu2021iconqa} & \underline{107,439} & \textcolor{red!50!black}{\ding{55}}~~~ & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} \\ \midrule FinQA \citeyearpar{chen2021finqa} & 8,281 & 2,766 & \textcolor{green!50!black}{\ding{51}} & 76.6\% & finance & text & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{green!50!black}{\ding{51}} & program \\ TAT-QA \citeyearpar{zhu2021tat} & 16,552 & 2,747 & 50.0\% & \textcolor{green!50!black}{\ding{51}} & finance & text & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} \\ MultiHiertt \citeyearpar{zhao2022multihiertt} & 10,440 & 9,843 & \textcolor{green!50!black}{\ding{51}} & 89.8\% & finance & text & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{red!50!black}{\ding{55}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{red!50!black}{\ding{55}} \\ \midrule \textbf{\textsc{TabMWP}\xspace{} (ours)} & \textbf{38,431} & \textbf{37,644} & \textcolor{green!50!black}{\ding{51}} & \textcolor{green!50!black}{\ding{51}} & \textbf{open} & \textbf{text*} & \textcolor{green!50!black}{\ding{51}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{green!50!black}{\ding{51}} & \textcolor{green!50!black}{\ding{51}} & \textbf{text}\\ \bottomrule \end{tabular} } \captionof{table}{A comparison of MWP and Table QA datasets that require numerical reasoning. \textit{text*}: each table in \textsc{TabMWP}\xspace{} is accompanied by an image format.} \vspace{-2mm} \label{tab:datasets} \end{figure} \section{Methods} \subsection{Few-shot GPT-3 for \textsc{TabMWP}\xspace{}} Provided with a few in-context examples of math word problems as the context, GPT-3 can generate the answer for a test problem, and show impressive performance across different MWP datasets \citep{wei2022chain,wang2022self}. Inspired by its success, we first build a strong baseline using few-shot GPT-3 on our \textsc{TabMWP}\xspace{} dataset. Specifically, a few training examples, along with the test example $p_i$, are provided to GPT-3 for the answer prediction. Each training example consists of a table context $t$, a question $q$, options $c$ that apply, and an answer $a$. To make the few-shot GPT-3 model workable on \textsc{TabMWP}\xspace{}, we utilize the semi-structured format as the tabular context. Following \cite{wei2022chain}, a solution $s$ can be augmented in front of the answer $a$ to reveal the multi-step reasoning process, which is able to boost the prediction performance. \subsection{Dynamic Prompting via Policy Gradient} The in-context examples can be randomly \citep{wei2022chain, wang2022self} or retrieval-based selected \citep{liu2022makes} from the training set. Recent research, however, has shown that few-shot GPT-3 can be highly unstable across different selections of in-context examples and permutations of those examples \citep{zhao2021calibrate, liu2022makes, lu2022fantastically}. This instability may be more severe on \textsc{TabMWP}\xspace{}, where examples are more distinct because they include both unstructured questions of various types and semi-structured tables in various layouts. To alleviate this issue, we aim to propose a novel approach that can learn to select performing in-context examples using a policy gradient strategy, without brute-force searching or manually designed heuristics. Formally, given a \textsc{TabMWP}\xspace{} problem $p_i$, we want the agent to find $K$ in-context examples $e_i = \{e_i^1, e_i^2,...,e_i^K\}$ from a candidate pool $E_{\text{cand}}$, and generate the answer $\hat{a}_i$, maximizing a reward $r_i = R(\hat{a}_i | p_i)$. The in-context examples are selected according to a policy \begin{equation} e_i^k \sim \pi_{\theta}(e_i|p_i), ~e_i^k \in E_{\text{cand}}, e_i^k ~\text{are independent for} ~k=\{1,2,...,K\}, \end{equation} where $\theta$ are the policy's parameters. The answer is generated through: $\hat{a}_i = \text{GPT-3}(e_i, p_i)$ using the selected examples and the given problem as the input prompt. The reward is then computed by evaluating the generated answer $\hat{a}_i$ with respect to the ground truth answer $a_i$: \begin{equation} r_i = R(\hat{a}_i | p_i) = \textsc{Eval}(\hat{a}_i, a_i), ~r_i \in \{-1, 1\}. \end{equation} The function $\textsc{Eval}()$ returns a reward of $1$ if the generated answer aligned with the label and $-1$ otherwise. Our goal is to maximize the expected reward of the generated answer under the policy $\mathbb{E}_{e_i \sim \pi_{\theta}(e_i|p_i)}[R(\text{GPT-3}(e_i,p_i))]$. We optimize the reward with respect to the parameters of the policy network using the Policy Gradient method~\citep{sutton1998introduction}. The expected reward cannot be computed in closed form, so we compute an unbiased estimation with Monte Carlo Sampling, \begin{equation} \mathbb{E}_{e_i \sim \pi_{\theta}(e_i|p_i)}\left[R(\text{GPT-3}(e_i,p_i))\right] \approx \frac{1}{N}\sum_{i=1}^{N}R(\text{GPT-3}(e_i,p_i)), ~e_i \sim \pi_{\theta}(e_i|p_i), \end{equation} where $N$ is the size of each batch yielded from our training problem set $P_{\text{train}}$. In this work, we experiment using the REINFORCE policy gradient algorithm~\citep{williams1992simple}: \begin{equation} \fontsize{9.5pt}{\baselineskip}\selectfont \begin{aligned} \nabla \mathbb{E}_{e_i \sim \pi_{\theta}(e_i|p_i)}\left[R(\text{GPT-3}(e_i,p_i))\right] &= \mathbb{E}_{e_i \sim \pi_{\theta}(e_i|p_i)} \nabla_{\theta}\log(\pi_{\theta}(e_i|p_i))R(\text{GPT-3}(e_i,p_i)) \\ &\approx \frac{1}{N}\sum_{i=1}^N\nabla_{\theta}\log(\pi_{\theta}(e_i|p_i))R(\text{GPT-3}(e_i,p_i)), ~e_i \sim \pi_{\theta}(e_i|p_i). \end{aligned} \end{equation} Intuitively, if the predicted answer is correct, we update the policy so that the probability of selecting the same prompts gets higher. Otherwise, we update the policy to reduce the probability of selecting such less matched examples. The learning process is summarized in Algorithm \ref{alg:policy} in the appendix. To get the contextualized representation of the given problem and candidate examples, we use the BERT~\citep{devlin2018bert} \texttt{[CLS]} token representation as the problem encoding. We add a small linear layer on top of the BERT final pooling layer. That allows our model to learn both the semantic similarity that the pre-trained BERT model provides and the hidden logical similarity shared among the math problems. During training, the parameters of BERT are fixed and only the appended linear layer is updated, i.e., $\theta$ is composed of the learnable parameters $\mathbf{W}$ and $\mathbf{b}$: \begin{equation} \begin{aligned} \mathbf{h}(e_i) &= \mathbf{W}(\textsc{BERT}(e_i)) + \mathbf{b}, \\ \mathbf{h}(p_i) &= \mathbf{W}(\textsc{BERT}(p_i)) + \mathbf{b}, \\ \pi_{\theta}(e_i|p_i) &= \frac{\exp{[\mathbf{h}(e_i) \cdot \mathbf{h}(p_i)}]}{\sum_{e_i' \in E_{\text{cand}}} \exp{[\mathbf{h}(e_i') \cdot \mathbf{h}(p_i)}]}. \end{aligned} \end{equation} \section{Experiments} \subsection{Experimental Settings} \textbf{Baselines.} We first develop two large language models, UnifiedQA \citep{khashabi2020unifiedqa} and TAPEX \citep{liu2022tapex}, in both pre-trained and fine-tuned settings, as strong baselines on \textsc{TabMWP}\xspace. Different model sizes are included to examine the performance across different model capacities. We further implement the zero-shot GPT-3 model, the few-shot GPT-3 model, and their chain-of-thought (CoT) reasoning variants \citep{wei2022chain}. We also study the heuristic guess baseline and human performance to analyze the lower and upper bounds on \textsc{TabMWP}\xspace, respectively. \textbf{Evaluation metric.} The answer part is extracted from the GPT-3 generation using manually designed regular regressions. To evaluate the baselines and our method, we utilize the accuracy metric to determine if the generated answer is correct given the ground truth answer. For \textit{free-text} problems where the answer is set as a number, we normalize the prediction and the label to decimal numbers with two-digit precision and check if their values are equivalent. For \textit{multi-choice} problems, we choose the most similar one from options to the generated answer following \cite{khashabi2020unifiedqa}. \textbf{Implementation details.} Fine-tuned UnifiedQA and TAPEX baselines are trained on the train split and evaluated on the test split. Few-shot GPT-3 and few-shot-CoT GPT-3 randomly select two in-context examples from the training data to build the prompt. Our \textsc{PromptPG}\xspace is built on top of few-shot GPT-3 with a different selection strategy: (a) in the training stage, the agent learns to select two examples from 20 candidates and is evaluated on 160 training examples to calculate the reward; (b) in the test stage, the agent with an optimal policy chooses two examples from 20 candidates for each test example. The candidates are randomly selected from the training set. Experiments for two few-shot GPT-3 baselines and our \textsc{PromptPG}\xspace are repeated three times, and the average accuracy is reported in Table \ref{tab:results}. More implementation details can be found in Appendix \ref{appx:details}. \subsection{Experimental Results} Table~\ref{tab:results} demonstrates the results of different baselines and our method on the \textsc{TabMWP}\xspace{} dataset. Benefiting from pre-training on the tabular corpus, the TAPEX baseline performs better on average than UnifiedQA with a similar model size, which is only pre-trained on unstructured textual data. Increasing the model size can improve the prediction accuracy for both UnifiedQA and TAPEX. Fine-tuned on \textsc{TabMWP}\xspace{}, the baseline models can significantly improve the prediction performance on the average and all aggregated accuracy metrics. \begin{figure}[t!] \centering \renewcommand\tabcolsep{3.9pt} \renewcommand1.5{1.1} \resizebox{1.0\linewidth}{!}{ \begin{tabular}{lcccccccccccl} \toprule \multirow{3}{*}{\textbf{Method}} & \multirow{2}{*}{\textbf{Training}} & \multirow{2}{*}{\textbf{Selection}} & \multicolumn{2}{c}{\textbf{Question Types}} & \multicolumn{5}{c}{\textbf{Answer Types}} & \multicolumn{2}{c}{\textbf{Grades}} & \multirow{3}{*}{\textbf{~Avg.}} \\ \cmidrule(lr){4-5} \cmidrule(lr){6-10} \cmidrule(lr){11-12} & \textbf{Data} & \textbf{Strategy} & FREE & MC & INT & DEC & EXTR & BOOL & OTH & 1-6 & 7-8 & \\ \midrule \rowcolor[rgb]{0.93,0.93,0.93} \multicolumn{13}{l}{\textit{Heuristic Baselines}} \\ Heuristic guess & - & - & 6.71 & 39.81 & 8.37 & 0.26 & 30.80 & 51.22 & 26.67 & 17.55 & 12.27 & 15.29 \\ Human performance & - & - & \underline{84.61} & \underline{93.32} & \underline{84.95} & \underline{83.29} & \underline{97.18} & \underline{88.69} & \underline{96.20} & \underline{94.27} & \underline{81.28} & \underline{90.22} \\ \rowcolor[rgb]{0.93,0.93,0.93} \multicolumn{13}{l}{\textit{pre-trained Baselines}} \\ UnifiedQA$_{\textsc{Small}}$ & - & - & 1.18 & 43.62 & 1.37 & 0.43 & 38.70 & 49.78 & 37.14 & 15.57 & 7.65 & 12.18 \\ UnifiedQA$_{\textsc{Base}}$ & - & - & 4.60 & 43.02 & 5.28 & 1.97 & 37.08 & 50.11 & 38.10 & 17.14 & 11.11 & 14.56 \\ UnifiedQA$_{\textsc{Large}}$ & - & - & 4.48 & \underline{48.80} & 5.19 & 1.72 & \underline{48.33} & \underline{50.33} & \underline{40.00} & 19.78 & 10.87 & 15.96 \\ TAPEX$_{\textsc{Base}}$ & - & - & 7.32 & 39.76 & 8.68 & \underline{2.06} & 35.06 & 47.11 & 20.95 & 18.67 & 11.81 & 15.73 \\ TAPEX$_{\textsc{Large}}$ & - & - & \underline{8.80} & 46.59 & \underline{10.62} & 1.72 & 46.91 & 48.11 & 30.48 & \underline{22.65} & \underline{13.18} & \underline{18.59} \\ \rowcolor[rgb]{0.93,0.93,0.93} \multicolumn{13}{l}{\textit{fine-tuned Baselines}} \\ UnifiedQA$_{\textsc{Small}}$ & 7,686 & - & 22.27 & 51.31 & 27.27 & 2.83 & 52.28 & 48.11 & 69.52 & 35.85 & 21.71 & 29.79 \\ UnifiedQA$_{\textsc{Base}}$ & 7,686 & - & 34.02 & 70.68 & 40.74 & 7.90 & 84.09 & 55.67 & 73.33 & 53.31 & 30.46 & 43.52 \\ UnifiedQA$_{\textsc{Large}}$ & 7,686 & - & 48.67 & \underline{82.18} & 55.97 & \underline{20.26} & 94.63 & \underline{68.89} & \underline{79.05} & 65.92 & 45.92 & 57.35 \\ TAPEX$_{\textsc{Base}}$ & 7,686 & - & 39.59 & 73.09 & 46.85 & 11.33 & 84.19 & 61.33 & 69.52 & 56.70 & 37.02 & 48.27 \\ TAPEX$_{\textsc{Large}}$ & 7,686 & - & \underline{51.00} & 80.02 & \underline{59.92} & 16.31 & \textbf{95.34} & 64.00 & 73.33 & \underline{67.11} & \underline{47.07} & \underline{58.52} \\ \rowcolor[rgb]{0.93,0.93,0.93} \multicolumn{13}{l}{\textit{Prompting Baselines w/ GPT-3}} \\ Zero-shot & - & - & 53.57 & 66.67 & 55.55 & 45.84 & 78.22 & 55.44 & 54.29 & 63.37 & 48.41 & 56.96 \\ Zero-shot-CoT & - & - & 54.36 & 66.92 & 55.82 & 48.67 & \underline{78.82} & 55.67 & 51.43 & 63.62 & 49.59 & 57.61 \\ Few-shot (2-shot) & 2 & Random & 54.69 & 64.11 & 58.36 & 40.40 & 75.95 & 52.41 & 53.02 & 63.10 & 49.16 & 57.13 \\ Few-shot-CoT (2-shot) & 2 & Random & \underline{60.76} & \underline{69.09} & \underline{60.04} & \underline{63.58} & 76.49 & \underline{61.19} & \textbf{67.30} & \underline{68.62} & \underline{55.31} & \underline{62.92} \\ \rowcolor[rgb]{0.93,0.93,0.93} \multicolumn{13}{l}{\textit{\textbf{\textsc{PromptPG}\xspace w/ GPT-3 (Ours)}}} \\ Few-shot-CoT (2-shot) & 160+20 & Dynamic & \textbf{66.17} & \textbf{74.11} & \textbf{64.12} & \textbf{74.16} & 76.19 & \textbf{72.81} & 65.71 & \textbf{71.20} & \textbf{64.27} & \textbf{68.23}$_{5.31\uparrow}$ \\ \bottomrule \end{tabular} } \captionof{table}{Evaluation results of various baselines and our method on \textsc{TabMWP}\xspace{}. Training Data: number of used training data; Selection Strategy: strategy of selecting in-context examples for few-shot GPT-3; FREE: \textit{free-text} questions; MC: \textit{multi-choice} questions; INT: integer answers; DEC: decimal answers; EXTR: extractive text answers; BOOL: Boolean text answers; OTH: other text answers.} \vspace{-2mm} \label{tab:results} \end{figure} Without any example provided to GPT-3, zero-shot GPT-3 achieves a comparable accuracy as the best fine-tuned baselines UnifiedQA$_{\textsc{Large}}$ and TAPEX$_{\textsc{Large}}$, showing its surprisingly good generalization ability on \textsc{TabMWP}\xspace. Provided with two randomly sampled in-context examples as the prompt, few-shot GPT-3 gets an improvement of 0.17\%. Generating the multi-step solution before the answer, the few-shot-CoT GPT-3 model reports the best performance among all of these baseline models, with an accuracy of 62.92\%. Unlike few-shot-CoT GPT-3 randomly selecting the in-context examples, our proposed \textsc{PromptPG}\xspace learns to select performing examples with the help of policy gradient. \textsc{PromptPG}\xspace establishes a state-of-the-art performance on the \textsc{TabMWP}\xspace{} dataset: it surpasses the best baseline few-shot-CoT GPT-3 by 5.31\% on average. \textsc{PromptPG}\xspace shows its consistent advantages on two question types, two grade groups, and most of the answer types. \textbf{Heuristic guess and human performance.} The accuracy of \textit{multi-choice} questions by heuristic guess is 39.81\%, which aligns with the fact that there are 2.88 options on average. The accuracy for \textit{free-text} questions is considerably low since the inputs of \textsc{TabMWP}\xspace problems do not have direct clues for the answers. Humans outperform all benchmarks consistently across question types, answer types, and grade groups, with a 21.99\% average accuracy advantage over our best performing \textsc{PromptPG}\xspace. This gap is to be filled by future research on semi-structured mathematical reasoning. \textbf{Problem types and difficulty.} Among all the baselines, we find it is easier for models to answer \textit{multi-choice} questions than \textit{free-text} questions. Questions with the boolean (BOOL) and other (OTH) answer types tend to have lower accuracy scores than the extractive (EXTR) answer type, because the former ones need the abilities of fact verification and language understanding on diverse options, respectively. It is also not surprising for us to find that all the models perform worse on problems in grades 7-8 than in a lower-level group of 1-6. \subsection{Ablation Study} Here, we will study how different factors have an effect on the performances of baselines and our method on \textsc{TabMWP}\xspace{}. Experiments are conducted on 1,000 development examples. \textbf{Blind study of the dataset.} We evaluate the information gain of each component of the \textsc{TabMWP}\xspace problems by removing it from model inputs. To eliminate the impact and variance caused by example selection, the study is conducted using the zero-shot GPT-3 model. As shown in Table \ref{tab:blind}, there is a dramatic decline when either the tabular context (T) or the question text (Q) is missing from the inputs. For example, T$\rightarrow$A and Q$\rightarrow$A only attain an average accuracy of 6.10\% and 7.00\%, respectively, and their accuracies are near to zero on the \textit{multi-choice} questions. Taking both tabular and textual data as inputs (TQ$\rightarrow$A), the model significantly beats the heuristic guess. With the complete input information (TQ(C)$\rightarrow$A), the full model achieves the best performance. The blind study shows that our \textsc{TabMWP}\xspace{} is robust and reliable in distribution, and all input components are indispensable parts that provide necessary information for answering the questions. \begin{figure}[h!] \centering \small \renewcommand\tabcolsep{4.0pt} \resizebox{1.0\linewidth}{!}{ \begin{tabular}{lcccccccccccc} \toprule \textbf{Model} & \textbf{Format} & FREE & MC & INT & DEC & EXTR & BOOL & OTH & 1-6 & 7-8 & \textbf{Avg.} \\ \midrule Heuristic guess & TQ(C)$\rightarrow$A & 7.31 & 40.36 & 9.20 & 0.00 & 34.44 & 47.32 & 50.00 & 17.99 & 13.96 & 16.40 \\ \midrule Zero-shot GPT-3 & T$\rightarrow$A & 8.28 & 0.36 & 10.24 & 0.67 & 0.66 & 0.00 & 0.00 & 9.41 & 1.02 & 6.10 \\ Zero-shot GPT-3 & Q$\rightarrow$A & 9.24 & 1.09 & 10.94 & 2.68 & 1.32 & 0.89 & 0.00 & 10.23 & 2.03 & 7.00 \\ Zero-shot GPT-3 & T(C)$\rightarrow$A & 8.28 & 41.82 & 10.24 & 0.67 & 36.42 & 50.89 & 25.00 & 23.60 & 8.12 & 17.50 \\ Zero-shot GPT-3 & Q(C)$\rightarrow$A & 9.10 & 33.09 & 10.94 & 2.01 & 25.17 & 44.64 & 25.00 & 21.29 & 7.11 & 15.70 \\ Zero-shot GPT-3 & TQ$\rightarrow$A & 55.31 & 68.36 & 56.60 & 50.34 & 79.47 & 54.46 & 58.33 & 66.34 & 47.46 & 58.90 \\ Zero-shot GPT-3 (full model) & TQ(C)$\rightarrow$A & 54.76 & 72.00 & 56.42 & 48.32 & 76.82 & 66.07 & 66.67 & 67.00 & 47.97 & 59.50 \\ \bottomrule \end{tabular} } \captionof{table}{Blind studies on \textsc{TabMWP}\xspace{}. T: tabular context; Q: question; C: choice options; A: answer.} \label{tab:blind} \end{figure} \begin{figure}[ht] \begin{minipage}{0.48\textwidth} \vspace{-2mm} \centering \includegraphics[width=0.85\textwidth]{figures/fig_acc_diff_train_num.pdf} \caption*{(a) Accuracy w.r.t. different numbers of training examples, given 20 candidate examples.} \end{minipage} \hfill \begin{minipage}{0.48\textwidth} \centering \includegraphics[width=0.85\textwidth]{figures/fig_acc_diff_cand_num_font16.pdf} \caption*{(b) Accuracy w.r.t. different numbers of candidates, given 80 and 160 training examples.} \end{minipage} \vspace{-2mm} \caption{Accuracy w.r.t. different numbers of training and candidate examples. Experiments are conducted on 1,000 development instances, and each setting is repeated with four random seeds.} \vspace{-2mm} \label{fig:ablation} \end{figure} \textbf{Number of training examples.} We study the effect of different numbers of training examples on our dynamic prompt learning in Figure~\ref{fig:ablation} (a). With more training examples, the prediction accuracy first gradually increases to a peak of around 160 training examples. After that, the accuracy goes down with a growing variance. We reckon it is because the policy gradient algorithm can benefit from the scaling-up training data but fails to exploit more examples efficiently. \textbf{Number of candidate examples.} In Figure~\ref{fig:ablation} (b), we investigate how different numbers of candidate examples can affect policy learning performance. With the increasing candidate number, it is observed that the prediction accuracy will first go up and then go down after a threshold, given 80 or 160 training examples. It is probably because when the candidate pool is too small, the policy gradient algorithm has a limited action space to explore enough problem types. In contrast, too many candidates could make the algorithm hard to learn an optimal policy in a large search space. \begin{wraptable}{r}{0.44\textwidth} \vspace{-3.0mm} \centering \fontsize{9.0pt}{\baselineskip}\selectfont \renewcommand\tabcolsep{3.0pt} \renewcommand1.5{0.88} \begin{tabular}{lc} \toprule \textbf{Selection strategy} & \textbf{Acc. (\%)} \\ \midrule Same question type & 66.2 $\pm$ 0.60 \\ Same answer type & 67.9 $\pm$ 0.38 \\ Same grade level & 67.9 $\pm$ 1.87 \\ \midrule Most complex (\# of table cells) & 64.0 $\pm$ 0.42 \\ Most complex (\# of ques. words) & 68.2 $\pm$ 0.26 \\ \midrule Random selection & 65.2 $\pm$ 4.01 \\ Nearest neighbor & 68.2 $\pm$ 0.29 \\ \midrule \textbf{\textsc{PromptPG}\xspace (Ours}) & \textbf{70.9 $\pm$ 1.27}\\ \bottomrule \end{tabular} \vspace{-2mm} \caption{Evaluation results w.r.t. different strategies for selecting in-context examples.} \label{tab:selection} \vspace{-2mm} \end{wraptable} \textbf{Different selection strategies.} In Table~\ref{tab:selection}, we compare the proposed \textsc{PromptPG}\xspace with random selection and other heuristic-based example selection strategies for the few-shot-CoT GPT-3 model. Compared to random selection, selecting the same question or answer type of examples helps the model to take the task-relevant examples as the prompt, thus improving the accuracy and reducing the variance. Choosing the most complex examples does not boost the prediction performance consistently. The most semantically similar examples, as a kind of nearest neighbor search of the test example, help construct the performing and stable prompt for GPT-3. \textsc{PromptPG}\xspace shows its effectiveness in selecting optimal in-context examples over other strategies and largely reduces the instability caused by randomness. \subsection{Case Study} We conduct the case study in Appendix \ref{appx:case_study}. We visualize the two in-context examples selected by strategies of our \textsc{PromptPG}\xspace, nearest neighbor search, and random selection, in Figure \ref{fig:selected_exp_promptpg}, \ref{fig:selected_exp_nearest}, and \ref{fig:selected_exp_random}, respectively. The nearest neighbor search strategy selects the ``superficially'' similar examples to the test example. Instead, \textsc{PromptPG}\xspace tends to select examples that have multiple reasoning steps in the solution and similar abilities in mathematical reasoning, which results in higher prediction accuracy. Successful examples in Figure \ref{fig:accurate_1} - \ref{fig:accurate_5} show that \textsc{PromptPG}\xspace is able to generate reasonable reasoning steps to predict correct answers for a wide range of \textsc{TabMWP}\xspace problems. Failure examples in Figure \ref{fig:wrong_1} - \ref{fig:wrong_6} suggest that \textsc{PromptPG}\xspace has limitations when solving problems provided with complex tabular contexts or requiring a high-level ability of mathematical reasoning. \section{Related Work} \subsection{Math Word Problems} The task of solving Math Word Problems (MWPs) is to predict the answer given a natural language description of a math problem. There have been great efforts in developing datasets for MWPs, including Dolphin18K \citep{huang2016well}, DRAW-1K \citep{upadhyay2017annotating}, Math23K \citep{wang2017deep}, MathQA \citep{amini2019mathqa}, ASDiv \citep{miao2020diverse}, and SVAMP \citep{patel2021nlp}. However, these datasets only involve the textual modality, and most are limited to a small data scale. Some recent datasets like DVQA \citep{kafle2018dvqa}, Geometry3K \citep{lu2021inter} and IconQA \citep{lu2021iconqa} introduce math problems with diagrams as the visual context, where the system needs to perform mathematical reasoning over multi-modal information. To the best of our knowledge, our dataset \textsc{TabMWP}\xspace is the first dataset that requires mathematical reasoning over heterogeneous information from both the textual question and the tabular context. To solve MWPs, one popular line of previous methods is to generate the intermediate expressions and execute them to get the final answers \citep{huang2017learning,roy2017unit,amini2019mathqa}. Inspired by the recent progress achieved by GPT-3 in solving MWPs \citep{wei2022chain,wang2022self,kojima2022large}, we evaluate \textsc{TabMWP}\xspace using GPT-3 models in zero-shot and few-shot learning manners. \subsection{Table QA Datasets} Table Question Answering (Table QA) refers to the task of answering questions about tabular data. Numerous datasets have been developed for Table QA. For example, TabMCQ \citep{jauhar2016tabmcq} is an early dataset collected from grade exams. Datasets like WTQ \citep{pasupat2015compositional}, WikiSQL \citep{zhong2017seq2sql}, and SQA \citep{iyyer2017search} contain semi-structured tables from Wikipedia, while Spider \citep{yu2018spider} collects structured tables sourced from databases. Recent work aims at introducing datasets that require multi-hop reasoning between the textual and tabular data: HybridQA \citep{chen2020hybridqa}, OTTQA \citep{chen2020open}, MultiModalQA \citep{talmor2020multimodalqa}, AIT-QA \citep{katsis2021ait}, and FeTaQA \citep{nan2022fetaqa}. Datasets most related to our \textsc{TabMWP}\xspace{} dataset are FinQA \citep{chen2021finqa}, TAT-QA \citep{zhu2021tat}, and MultiHiertt \citep{zhao2022multihiertt} because they need numerical reasoning on financial reports with tabular data. Note that 77.6\% of questions in TAT-QA can be solvable without mathematical reasoning and 50.0\% of questions in FinQA are not table-must to be answered. In contrast, our proposed \textsc{TabMWP}\xspace collects questions where both mathematical reasoning and tabular context are necessary. \subsection{Prompt Learning for Language Models} Large pre-trained language models, such as GPT-3 \citep{chen2020big}, have shown their remarkable ability of few-shot learning on a wide range of downstream tasks \citep{houlsby2019parameter,brown2020language,lu2022learn}. Given a few in-context examples as demonstrations, GPT-3 can generalize to unseen test examples without parameter updating. For example, \cite{wei2022chain} randomly select different in-context examples from the training set and formulate their corresponding prompt with a test sample. However, recent studies show that few-shot GPT-3 highly depends on the selection of in-context examples and could be unstable, varying from the near chance to near state-of-the-art performance \citep{zhao2021calibrate,liu2022makes}. To mitigate the volatility of selecting in-context examples, \cite{lu2022fantastically} propose retrieving relevant examples that are semantically similar to the test sample. Other possible strategies could be using brute-force permutation search or relying on manually designed heuristics like choosing the most complex examples. Inspired by reinforcement learning's ability to search for an optimal action policy, we propose applying the policy gradient strategy \citep{sutton1998introduction} to learn to select in-context examples more efficiently and stably without designing human-designed heuristics. \section{Conclusion} In this paper, we propose \textsc{TabMWP}\xspace{}, the first large-scale dataset for math word problems in tabular contexts. \textsc{TabMWP}\xspace{} contains 38,431 open-domain problems with two question types and three answer types, and each problem is annotated with a multi-step solution. We evaluate \textsc{TabMWP}\xspace{} using state-of-the-art QA and TableQA methods in both pre-trained and fine-tuned settings, as well as the large pre-trained language model GPT-3. We further propose a novel approach, \textsc{PromptPG}\xspace, for few-shot GPT-3, which utilizes policy gradient to learn to select in-context examples from the training data and construct the performing prompt for the test example. Experimental results show that \textsc{PromptPG}\xspace outperforms existing strong baselines by a large margin of 5.31\% and reduces the accuracy volatility compared to random selection. To the best of our knowledge, it is the first work that applies reinforcement learning to select in-context examples for the few-shot GPT-3 model. \section{Acknowledge} We would like to thank Zhou Yu and Jiuxiang Gu for insightful discussions on dataset collection. We thank Chenhao Mu and Yao Fu for constructive suggestions in developing baselines and experiments. The work does not relate to Liang Qiu's position at Amazon Alexa. \section{Submission of conference papers to ICLR 2023} ICLR requires electronic submissions, processed by \url{https://openreview.net/}. See ICLR's website for more instructions. If your paper is ultimately accepted, the statement {\tt {\textbackslash}iclrfinalcopy} should be inserted to adjust the format to the camera ready requirements. The format for the submissions is a variant of the NeurIPS format. Please read carefully the instructions below, and follow them faithfully. \subsection{Style} Papers to be submitted to ICLR 2023 must be prepared according to the instructions presented here. Authors are required to use the ICLR \LaTeX{} style files obtainable at the ICLR website. Please make sure you use the current files and not previous versions. Tweaking the style files may be grounds for rejection. \subsection{Retrieval of style files} The style files for ICLR and other conference information are available online at: \begin{center} \url{http://www.iclr.cc/} \end{center} The file \verb+iclr2023_conference.pdf+ contains these instructions and illustrates the various formatting requirements your ICLR paper must satisfy. Submissions must be made using \LaTeX{} and the style files \verb+iclr2023_conference.sty+ and \verb+iclr2023_conference.bst+ (to be used with \LaTeX{}2e). The file \verb+iclr2023_conference.tex+ may be used as a ``shell'' for writing your paper. All you have to do is replace the author, title, abstract, and text of the paper with your own. The formatting instructions contained in these style files are summarized in sections \ref{gen_inst}, \ref{headings}, and \ref{others} below. \section{General formatting instructions} \label{gen_inst} The text must be confined within a rectangle 5.5~inches (33~picas) wide and 9~inches (54~picas) long. The left margin is 1.5~inch (9~picas). Use 10~point type with a vertical spacing of 11~points. Times New Roman is the preferred typeface throughout. Paragraphs are separated by 1/2~line space, with no indentation. Paper title is 17~point, in small caps and left-aligned. All pages should start at 1~inch (6~picas) from the top of the page. Authors' names are set in boldface, and each name is placed above its corresponding address. The lead author's name is to be listed first, and the co-authors' names are set to follow. Authors sharing the same address can be on the same line. Please pay special attention to the instructions in section \ref{others} regarding figures, tables, acknowledgments, and references. There will be a strict upper limit of 9 pages for the main text of the initial submission, with unlimited additional pages for citations. \section{Headings: first level} \label{headings} First level headings are in small caps, flush left and in point size 12. One line space before the first level heading and 1/2~line space after the first level heading. \subsection{Headings: second level} Second level headings are in small caps, flush left and in point size 10. One line space before the second level heading and 1/2~line space after the second level heading. \subsubsection{Headings: third level} Third level headings are in small caps, flush left and in point size 10. One line space before the third level heading and 1/2~line space after the third level heading. \section{Citations, figures, tables, references} \label{others} These instructions apply to everyone, regardless of the formatter being used. \subsection{Citations within the text} Citations within the text should be based on the \texttt{natbib} package and include the authors' last names and year (with the ``et~al.'' construct for more than two authors). When the authors or the publication are included in the sentence, the citation should not be in parenthesis using \verb|\citet{}| (as in ``See \citet{Hinton06} for more information.''). Otherwise, the citation should be in parenthesis using \verb|\citep{}| (as in ``Deep learning shows promise to make progress towards AI~\citep{Bengio+chapter2007}.''). The corresponding references are to be listed in alphabetical order of authors, in the \textsc{References} section. As to the format of the references themselves, any style is acceptable as long as it is used consistently. \subsection{Footnotes} Indicate footnotes with a number\footnote{Sample of the first footnote} in the text. Place the footnotes at the bottom of the page on which they appear. Precede the footnote with a horizontal rule of 2~inches (12~picas).\footnote{Sample of the second footnote} \subsection{Figures} All artwork must be neat, clean, and legible. Lines should be dark enough for purposes of reproduction; art work should not be hand-drawn. The figure number and caption always appear after the figure. Place one line space before the figure caption, and one line space after the figure. The figure caption is lower case (except for first word and proper nouns); figures are numbered consecutively. Make sure the figure caption does not get separated from the figure. Leave sufficient space to avoid splitting the figure and figure caption. You may use color figures. However, it is best for the figure captions and the paper body to make sense if the paper is printed either in black/white or in color. \begin{figure}[h] \begin{center} \fbox{\rule[-.5cm]{0cm}{4cm} \rule[-.5cm]{4cm}{0cm}} \end{center} \caption{Sample figure caption.} \end{figure} \subsection{Tables} All tables must be centered, neat, clean and legible. Do not use hand-drawn tables. The table number and title always appear before the table. See Table~\ref{sample-table}. Place one line space before the table title, one line space after the table title, and one line space after the table. The table title must be lower case (except for first word and proper nouns); tables are numbered consecutively. \begin{table}[t] \caption{Sample table title} \label{sample-table} \begin{center} \begin{tabular}{ll} \multicolumn{1}{c}{\bf PART} &\multicolumn{1}{c}{\bf DESCRIPTION} \\ \hline \\ Dendrite &Input terminal \\ Axon &Output terminal \\ Soma &Cell body (contains cell nucleus) \\ \end{tabular} \end{center} \end{table} \section{Default Notation} In an attempt to encourage standardized notation, we have included the notation file from the textbook, \textit{Deep Learning} \cite{goodfellow2016deep} available at \url{https://github.com/goodfeli/dlbook_notation/}. Use of this style is not required and can be disabled by commenting out \texttt{math\_commands.tex}. \centerline{\bf Numbers and Arrays} \bgroup \def1.5{1.5} \begin{tabular}{p{1in}p{3.25in}} $\displaystyle a$ & A scalar (integer or real)\\ $\displaystyle {\bm{a}}$ & A vector\\ $\displaystyle {\bm{A}}$ & A matrix\\ $\displaystyle {\tens{A}}$ & A tensor\\ $\displaystyle {\bm{I}}_n$ & Identity matrix with $n$ rows and $n$ columns\\ $\displaystyle {\bm{I}}$ & Identity matrix with dimensionality implied by context\\ $\displaystyle {\bm{e}}^{(i)}$ & Standard basis vector $[0,\dots,0,1,0,\dots,0]$ with a 1 at position $i$\\ $\displaystyle \text{diag}({\bm{a}})$ & A square, diagonal matrix with diagonal entries given by ${\bm{a}}$\\ $\displaystyle {\textnormal{a}}$ & A scalar random variable\\ $\displaystyle {\mathbf{a}}$ & A vector-valued random variable\\ $\displaystyle {\mathbf{A}}$ & A matrix-valued random variable\\ \end{tabular} \egroup \vspace{0.25cm} \centerline{\bf Sets and Graphs} \bgroup \def1.5{1.5} \begin{tabular}{p{1.25in}p{3.25in}} $\displaystyle {\mathbb{A}}$ & A set\\ $\displaystyle \mathbb{R}$ & The set of real numbers \\ $\displaystyle \{0, 1\}$ & The set containing 0 and 1 \\ $\displaystyle \{0, 1, \dots, n \}$ & The set of all integers between $0$ and $n$\\ $\displaystyle [a, b]$ & The real interval including $a$ and $b$\\ $\displaystyle (a, b]$ & The real interval excluding $a$ but including $b$\\ $\displaystyle {\mathbb{A}} \backslash {\mathbb{B}}$ & Set subtraction, i.e., the set containing the elements of ${\mathbb{A}}$ that are not in ${\mathbb{B}}$\\ $\displaystyle {\mathcal{G}}$ & A graph\\ $\displaystyle \parents_{\mathcal{G}}({\textnormal{x}}_i)$ & The parents of ${\textnormal{x}}_i$ in ${\mathcal{G}}$ \end{tabular} \vspace{0.25cm} \centerline{\bf Indexing} \bgroup \def1.5{1.5} \begin{tabular}{p{1.25in}p{3.25in}} $\displaystyle {a}_i$ & Element $i$ of vector ${\bm{a}}$, with indexing starting at 1 \\ $\displaystyle {a}_{-i}$ & All elements of vector ${\bm{a}}$ except for element $i$ \\ $\displaystyle {A}_{i,j}$ & Element $i, j$ of matrix ${\bm{A}}$ \\ $\displaystyle {\bm{A}}_{i, :}$ & Row $i$ of matrix ${\bm{A}}$ \\ $\displaystyle {\bm{A}}_{:, i}$ & Column $i$ of matrix ${\bm{A}}$ \\ $\displaystyle {\etens{A}}_{i, j, k}$ & Element $(i, j, k)$ of a 3-D tensor ${\tens{A}}$\\ $\displaystyle {\tens{A}}_{:, :, i}$ & 2-D slice of a 3-D tensor\\ $\displaystyle {\textnormal{a}}_i$ & Element $i$ of the random vector ${\mathbf{a}}$ \\ \end{tabular} \egroup \vspace{0.25cm} \centerline{\bf Calculus} \bgroup \def1.5{1.5} \begin{tabular}{p{1.25in}p{3.25in}} $\displaystyle\frac{d y} {d x}$ & Derivative of $y$ with respect to $x$\\ [2ex] $\displaystyle \frac{\partial y} {\partial x} $ & Partial derivative of $y$ with respect to $x$ \\ $\displaystyle \nabla_{\bm{x}} y $ & Gradient of $y$ with respect to ${\bm{x}}$ \\ $\displaystyle \nabla_{\bm{X}} y $ & Matrix derivatives of $y$ with respect to ${\bm{X}}$ \\ $\displaystyle \nabla_{\tens{X}} y $ & Tensor containing derivatives of $y$ with respect to ${\tens{X}}$ \\ $\displaystyle \frac{\partial f}{\partial {\bm{x}}} $ & Jacobian matrix ${\bm{J}} \in \mathbb{R}^{m\times n}$ of $f: \mathbb{R}^n \rightarrow \mathbb{R}^m$\\ $\displaystyle \nabla_{\bm{x}}^2 f({\bm{x}})\text{ or }{\bm{H}}( f)({\bm{x}})$ & The Hessian matrix of $f$ at input point ${\bm{x}}$\\ $\displaystyle \int f({\bm{x}}) d{\bm{x}} $ & Definite integral over the entire domain of ${\bm{x}}$ \\ $\displaystyle \int_{\mathbb{S}} f({\bm{x}}) d{\bm{x}}$ & Definite integral with respect to ${\bm{x}}$ over the set ${\mathbb{S}}$ \\ \end{tabular} \egroup \vspace{0.25cm} \centerline{\bf Probability and Information Theory} \bgroup \def1.5{1.5} \begin{tabular}{p{1.25in}p{3.25in}} $\displaystyle P({\textnormal{a}})$ & A probability distribution over a discrete variable\\ $\displaystyle p({\textnormal{a}})$ & A probability distribution over a continuous variable, or over a variable whose type has not been specified\\ $\displaystyle {\textnormal{a}} \sim P$ & Random variable ${\textnormal{a}}$ has distribution $P$\\% so thing on left of \sim should always be a random variable, with name beginning with \r $\displaystyle \mathbb{E}_{{\textnormal{x}}\sim P} [ f(x) ]\text{ or } \mathbb{E} f(x)$ & Expectation of $f(x)$ with respect to $P({\textnormal{x}})$ \\ $\displaystyle \mathrm{Var}(f(x)) $ & Variance of $f(x)$ under $P({\textnormal{x}})$ \\ $\displaystyle \mathrm{Cov}(f(x),g(x)) $ & Covariance of $f(x)$ and $g(x)$ under $P({\textnormal{x}})$\\ $\displaystyle H({\textnormal{x}}) $ & Shannon entropy of the random variable ${\textnormal{x}}$\\ $\displaystyle D_{\mathrm{KL}} ( P \Vert Q ) $ & Kullback-Leibler divergence of P and Q \\ $\displaystyle \mathcal{N} ( {\bm{x}} ; {\bm{\mu}} , {\bm{\Sigma}})$ & Gaussian distribution % over ${\bm{x}}$ with mean ${\bm{\mu}}$ and covariance ${\bm{\Sigma}}$ \\ \end{tabular} \egroup \vspace{0.25cm} \centerline{\bf Functions} \bgroup \def1.5{1.5} \begin{tabular}{p{1.25in}p{3.25in}} $\displaystyle f: {\mathbb{A}} \rightarrow {\mathbb{B}}$ & The function $f$ with domain ${\mathbb{A}}$ and range ${\mathbb{B}}$\\ $\displaystyle f \circ g $ & Composition of the functions $f$ and $g$ \\ $\displaystyle f({\bm{x}} ; {\bm{\theta}}) $ & A function of ${\bm{x}}$ parametrized by ${\bm{\theta}}$. (Sometimes we write $f({\bm{x}})$ and omit the argument ${\bm{\theta}}$ to lighten notation) \\ $\displaystyle \log x$ & Natural logarithm of $x$ \\ $\displaystyle \sigma(x)$ & Logistic sigmoid, $\displaystyle \frac{1} {1 + \exp(-x)}$ \\ $\displaystyle \zeta(x)$ & Softplus, $\log(1 + \exp(x))$ \\ $\displaystyle || {\bm{x}} ||_p $ & $L^p$ norm of ${\bm{x}}$ \\ $\displaystyle || {\bm{x}} || $ & $L^2$ norm of ${\bm{x}}$ \\ $\displaystyle x^+$ & Positive part of $x$, i.e., $\max(0,x)$\\ $\displaystyle \bm{1}_\mathrm{condition}$ & is 1 if the condition is true, 0 otherwise\\ \end{tabular} \egroup \vspace{0.25cm} \section{Final instructions} Do not change any aspects of the formatting parameters in the style files. In particular, do not modify the width or length of the rectangle the text should fit into, and do not change font sizes (except perhaps in the \textsc{References} section; see below). Please note that pages should be numbered. \section{Preparing PostScript or PDF files} Please prepare PostScript or PDF files with paper size ``US Letter'', and not, for example, ``A4''. The -t letter option on dvips will produce US Letter files. Consider directly generating PDF files using \verb+pdflatex+ (especially if you are a MiKTeX user). PDF figures must be substituted for EPS figures, however. Otherwise, please generate your PostScript and PDF files with the following commands: \begin{verbatim} dvips mypaper.dvi -t letter -Ppdf -G0 -o mypaper.ps ps2pdf mypaper.ps mypaper.pdf \end{verbatim} \subsection{Margins in LaTeX} Most of the margin problems come from figures positioned by hand using \verb+\special+ or other commands. We suggest using the command \verb+\includegraphics+ from the graphicx package. Always specify the figure width as a multiple of the line width as in the example below using .eps graphics \begin{verbatim} \usepackage[dvips]{graphicx} ... \includegraphics[width=0.8\linewidth]{myfile.eps} \end{verbatim} or \begin{verbatim} \usepackage[pdftex]{graphicx} ... \includegraphics[width=0.8\linewidth]{myfile.pdf} \end{verbatim} for .pdf graphics. See section~4.4 in the graphics bundle documentation (\url{http://www.ctan.org/tex-archive/macros/latex/required/graphics/grfguide.ps}) A number of width problems arise when LaTeX cannot properly hyphenate a line. Please give LaTeX hyphenation hints using the \verb+\-+ command. \subsubsection*{Author Contributions} If you'd like to, you may include a section for author contributions as is done in many journals. This is optional and at the discretion of the authors. \subsubsection*{Acknowledgments} Use unnumbered third level headings for the acknowledgments. All acknowledgments, including those to funding agencies, go at the end of the paper.
{'timestamp': '2022-09-30T02:09:24', 'yymm': '2209', 'arxiv_id': '2209.14610', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14610'}
arxiv
\section{Proofs} \printProofs \end{document} \section{Background of Optimal Transport} \label{sec:ot} This section introduces the background of optimal transport (OT), including both the static and dynamic formulations. Of special importance is the dynamic formulation, which is closely related to the rectified flow approach. The readers can find systematic introductions to OT in a collection of excellent textbooks \cite{villani2021topics, figalli2021invitation, ambrosio2021lectures, peyre2019computational, ollivier2014optimal, santambrogio2015optimal, villani2009optimal}. \paragraph{Static formulations} The optimal transport problem was first formulated by Gaspard Monge in 1781 when he studied the problem of how to redistribute mass, e.g., a pile of soil, with minimal effort. Monge's problem can be formulated as \bbb \label{equ:m} \inf_{T} \e{c(T(X_0)- X_0)} ~~~~s.t.~~~~ \law(T(X_0))=\tg_1, ~~~ \law(X_0)=\tg_0, \eee where we minimize the $c$-transport cost in the set of deterministic couplings $(X_0,X_1)$ that satisfy $X_1 = T(X_0)$ for a transport mapping $T\colon \RR^d\to \RR^d$. The Monge–Kantorovich (MK) problem in \eqref{equ:mk} is the relaxation of \eqref{equ:m} to the set of all (deterministic and stochastic) couplings of $\tgg$. The two problems are equivalent when the optimum of \eqref{equ:mk} is achieved by a deterministic coupling, which is guaranteed if $\tg_0$ is an absolutely continuous measure on $\RR^d$. A key feature of the MK problem is that it is a linear programming w.r.t. the law of the coupling $(X_0,X_1)$, and yields a dual problem of form: % \bbb \label{equ:dmk} \sup_{\mu, \nu} \tg_1(\mu) - \tg_0(\nu) ~~s.t.~~ \mu(x_1) - \nu(x_0)\leq c(x_1-x_0),~~~~\forall (x_0,x_1), \eee where we write $\tg_1(\mu) \defeq \int \mu(x) \d \tg_1(x)$, and $\mu,\nu$ are optimized in all functions from $\RR^d$ to $\RR$. For any coupling $(X_0,X_1)$ of $\tgg$, and $(\mu,\nu)$ satisfying the constraint in \eqref{equ:dmk}, it is easy to see that \bbb \label{equ:dualderive} \E[c(X_1-X_0)] \geq \E[\mu(X_1) - \nu(X_0)] = \tg_1(\mu) - \tg_0(\nu). \eee As the left side of \eqref{equ:dualderive} only depends on $(X_0,X_1)$ and the right side only on $(\mu,\nu)$, one can show that $(X_0,X_1)$ is $c$-optimal and $(\mu,\nu)$ solves \eqref{equ:dmk} iff $\mu(X_0) + \nu(X_1) = c(X_1-X_0)$ holds with probability one, which provides a basic optimality criterion. % Many existing OT algorithms are developed by exploiting the primal dual relation of \eqref{equ:mk} and \eqref{equ:dmk} (see e.g., \cite{korotin2022neural}), but have the drawback of yielding minimax problems that are challenging to solve in practice. % If $c$ is strictly convex, the % optimal transport map of \eqref{equ:m} is unique (almost surely) and yields a form of \bb % T(x)=x + \dd c^*(\dd \nu(x)), ~~~~ \ee where $c^*$ is the convex conjugate function of $c$, and $\nu$ is an optimal solution of \eqref{equ:dmk}, which is $c$-convex in that $\nu(x) = \sup_{y}\left \{ -c(y-x) + \mu(y)\right \}$ with $\mu$ the associated solution. In the canonical case of quadratic cost $c(x) = \frac{1}{2}\norm{x}^2$, we can write $T(x) = \dd \phi(x)$, where $\phi(x) \defeq \frac{1}{2}\norm{x}^2 + \nu(x)$ is a convex function. \paragraph{Dynamic formulations} Both the MK and Monge problems can be equivalently framed in dynamic ways as finding continuous-time processes that transfer $\tg_0$ to $\tg_1$. Let $\{x_t \colon t\in[0,1]\}$ be a smooth path connecting $x_0$ and $x_1$, whose time derivative is denoted as $\dot x_t$. For convex $c$, by Jensen's inequality, we can represent the cost $c(x_1-x_0)$ in an integral form: $$ c({x_1 - x_0}) = c\left (\int_0^1 \dot x_t \dt \right) = \inf_{x} \int_0^1 c({\dot x_t}) \dt, $$ where the infimum is attained when $x_t$ is the linear interpolation (geodesic) path: $x_t = t x_1 + (1-t)x_0$. Hence, the MK optimal transport problem \eqref{equ:mk} is equivalent to \bbb \label{equ:qt} \inf_{\vv X} \E\left [ \int_0^1 c(\dot X_t) \dt \right ] ~~~~~s.t.~~~~ \law(X_0) = \tg_0, ~~\law(X_1) = \tg_1, \eee where we optimize in the set of time-differentiable % stochastic processes $\vv X = \{X_t \colon t\in[0,1]\}$. The optimum of \eqref{equ:qt} is attained by $X_t = t X_1 + (1-t)X_0$ when $(X_0,X_1)$ is a $c$-optimal coupling of \eqref{equ:mk}, which is known as the \emph{displacement interpolation} \citep{mccann1997convexity}. We call the objective function in \eqref{equ:qt} the path-wise $c$-transport cost. The Monge problem can also be framed in a dynamic way. Assume the transport map $T$ can be induced by an ODE model $\d X_t = v_t(X_t)\dt $ such that $X_1 = T(X_0)$. Then the Monge problem is equivalent to % \bbb \label{equ:cm} \inf_{v,\traj X} \E\left [ \int _0^1 c({v_t(X_t)}) \dt \right] ~~~~~s.t.~~~~~ \d X_t = v_t(X_t)\dt ,~~~~~ \law(X_0) = \tg_0, ~~~~~ \law(X_1) = \tg_1, \eee which is equivalent to restricting $\vv X$ in \eqref{equ:qt} to the set of processes that can be induced by ODEs. Assume that $X_t$ following $\d X_t = v_t(X_t)\dt $ yields a density function $\varrho_t$. Then it is well known that $\varrho_t$ satisfies the continuity equation: % $$ \dot \varrho_t + \div(v_t\varrho_t) = 0. $$ Hence, we can rewrite \eqref{equ:cm} into an optimization problem on $(v, \varrho)$, yielding the celebrated \emph{{\bbformula} formula} \cite{benamou2000computational}: \bbb \label{equ:bb} \inf_{v, \varrho} \int_0^1 \int c(v_t(x)) \varrho_t(x)\d x \dt ~~~~s.t.~~~~ \dot \varrho_t + \div(v_t \varrho_t) = 0,~~~~\rho_0 = \d\tg_0/\dx, ~~~~\rho_1 = \d \tg_1/\dx, \eee where $\d \pi_i/\d x$ denotes the density function of $\tg_i$. The key idea of \eqref{equ:cm} and \eqref{equ:bb} is to restrict the optimization of \eqref{equ:qt} to the set of deterministic processed induced by ODEs, which significantly reduces the search space. Intuitively, Jensen's inequality $\E[c(Z)]\geq c(\E[Z])$ shows that we should be able to reduce the expected cost of a stochastic process by ``marginalizing'' out the randomness. In fact, we will show that, for a differentiable stochastic process $\vv X$, % its ($c$-)rectified flow yields no larger path-wise $c$-transport cost in \eqref{equ:qt} than $\vv X$ (see Lemma~\ref{thm:rectdual} and Theorem~\ref{thm:optmultimarg}). However, all the dynamic formulations above are still highly challenging to solve in practice. We will show that $c$-rectified flow can be viewed as a special coordinate descent like approach to solving \eqref{equ:qt} (Section~\ref{sec:crectifyOptView}). % \section{Introduction} The Monge–Kantorovich (MK) optimal transport (OT) problem concerns finding an optimal coupling between two distributions $\tg_0,\tg_1$: % \bbb \label{equ:mk} \inf_{(X_0,X_1)} % \E[c(X_1 - X_0)],~~~~s.t.~~~~ \law(X_0)=\tg_0,~~ \law(X_1) = \tg_1, \eee where we seek to find (the law of) an optimal coupling $(X_0,X_1)$ of $\tg_0$ and $\tg_1$, for which marginal laws of $X_0,X_1$ equal $\tg_0,\tg_1$, respectively, to minimize $\E[c(X_1-X_0)]$, called the $c$-transport cost, for a cost function $c$. Theories, algorithms, and applications of optimal transport have attracted a vast literature; see, for example, the monographs of \cite{villani2021topics, villani2009optimal, ambrosio2021lectures, santambrogio2015optimal, peyre2019computational} for overviews. % Notably, OT has been growing into a popular and powerful technique in machine learning, for key tasks such as learning generative models, transfer learning, and approximate inference \citep[e.g.,][]{peyre2019computational, arjovsky2017wasserstein, solomon2014wasserstein, el2012bayesian, courty2014domain, marzouk2016introduction}. The OT problem should be treated differently depending on whether $\tg_0,\tg_1$ are discrete or continuous measures. In this work, we focus on the continuous case when $\tg_0,\tg_1$ are high dimensional absolutely continuous measures on $\RR^d$ that are observed through empirical observations, a setting called data-driven OT in \cite{trigila2016data}. A well known result in OT \citep[e.g.,][]{villani2009optimal} shows that, if $\tg_0$ is continuous, the optimization in \eqref{equ:mk} can be restricted to the set of deterministic couplings satisfying $X_1 = T(X_0)$ for some continuous transport mapping $T\colon \RR^d\to\RR^d$, which is often approximated in practice with deep neural networks % \citep[e.g.,][]{makkuva2020optimal, korotin2021neural, korotin2022neural, huang2020convex}. However, continuous OT remains highly challenging computationally. One major difficulty is to handle the coupling constraints of $\law(X_0) = \tg_0$ and $\law(X_1)=\tg_1$, which are infinite dimensional when $\tgg$ are continuous. As a result, \eqref{equ:mk} can not be solved as a ``clean" unconstrained optimization problem. There are essentially two types of approaches to solving \eqref{equ:mk} in the literature. One uses Lagrange duality to turn \eqref{equ:mk} into a certain minimax game, and the other one approximates the constraint with an integral (often entropic-like) penalty function. However, the minimax approaches suffer from convergence and instability issues and are difficult to solve in practice, while the regularization approach can not effectively enforce the infinite-dimensional coupling constraints. \paragraph{This work} We present a different approach to continuous OT that re-frames \eqref{equ:mk} into a sequence of simple unconstrained nonlinear least squares optimization problems, which monotonically reduce the transport cost of a coupling while automatically preserving the marginal constraints. Different from the minimax and regularization approaches that enforce the constraints from outside, our method is an \emph{interior} approach which starts from a valid coupling (typically the naive independent coupling), and traverses inside the constraint set to decrease the transport cost. Such an interior approach is non-trivial and has not been realized before, because there exists no obvious unconstrained parameterization of the set of couplings of $\tgg$. % Our method is made possible by leveraging \emph{rectified flow} \cite{rectified}, a recent approach to constructing (non-optimal) transport maps for generative modeling and domain transfer. What makes rectified flow special is that it provides a simple procedure that turns a given coupling into a new one that obeys the same marginal laws, while yielding no worse transport cost w.r.t. \emph{all} convex functions $c$ simultaneously. Despite this attractive property, as pointed out in \cite{rectified}, rectified flow can not be used to optimize any fixed cost $c$, as it is essentially a special \emph{multi-objective} optimization procedure that targets no specific cost. Our method is a variant of rectified flow that targets a user-specified cost function $c$ and hence yields a new approach to the OT problem \eqref{equ:mk}. \paragraph{Rectified flow} We provide a high-level overview of the rectified flow of \cite{rectified} and the main results of this work. For a given coupling $(X_0,X_1)$ of $\tgg$, the \emph{rectified flow} induced by $(X_0,X_1)$ is the time-differentiable process $\vv Z = \{Z_t \colon t\in[0,1]\}$ over an artificial notion of time $t\in[0,1]$, that solves the following ordinary differential equation (ODE): \bbb \label{equ:ztflow_0} \d \Z_t = v^X_t(\Z_t) \dt,~~~~t\in[0,1],~~~~\text{starting from~~~~} \Z_0 = X_0, && % \eee where $v^X\colon \RR^d \times [0,1]\to \RR^d$ is a time-dependent velocity field defined as the solution of \bbb \label{equ:opt0} \inf_v \int_0^1 \e{ \norm{X_1-X_0 - v(X_t, t)}^2 } \dt, && X_t = t X_1 + (1-t)X_0, \eee and $X_t$ is the linear interpolation between $X_0$ and $X_1$. Eq~\eqref{equ:opt0} is a least squares regression problem of predicting the line direction of $(X_1-X_0)$ from every space-time point $(X_t, t)$ on the linear interpolation path, yielding a solution of % $$ v^X_t(z) = \E\left [X_1-X_0~|~ X_t=z \right ], $$ which is the average of direction $(X_1-X_0)$ for all lines that pass point $X_t = z$ at time $t$. The (conditional) expectations $\E[\cdot]$ above are w.r.t. the randomness of $(X_0,X_1)$. We assume that the solution of \eqref{equ:ztflow_0} exists and is unique, and hence $v^X_t(z)$ is assumed to exist at least on the trajectories of the ODE. The start-end pair $(Z_0,Z_1)$ induced by $\vv Z$ is called the \emph{rectified coupling} of $(X_0,X_1)$, and we denote it by $(Z_0,Z_1)=\mixupmap((X_0,X_1))$. % In practice, the expectation $\E[\cdot]$ is approximated by empirical observations of $(X_0, X_1)$, and $v$ is approximated by a parametric family, such as deep neural networks. In this case, the optimization in Eq~\eqref{equ:opt0} can be solved conveniently with off-the-shelf stochastic optimizers such as stochastic gradient descent (SGD), without resorting to minimax algorithms or expensive inner loops. % This makes rectified flow attractive for deep learning applications as these considered in \cite{rectified}. The importance of $(\Z_0,\Z_1) = \map((X_0,X_1))$ is justified by two key properties: 1) \emph{$(\Z_0,\Z_1)$ shares the same marginal laws as $(X_0,X_1)$ and is hence a valid coupling of $\tgg$; } 2) \emph{$(\Z_0,\Z_1)$ yields no larger convex transport costs than $(X_0,X_1)$, that is, $\E[c(\Z_1-\Z_0)] \leq \E[c(X_1-X_0)]$, for \emph{every} convex function $c\colon\RR^d\to \RR$.} Hence, it is natural to recursively apply the $\map$ mapping, that is, $(Z_0^{k+1}, Z_1^{k+1}) = \map((Z^k_0,Z_1^k))$ starting from $ (Z_0^0, Z_1^0) = (X_0, X_1)$, yielding a sequence of couplings that is monotonically non-increasing in terms of all convex transport costs. % The initialization can be taken to be the independent coupling $(Z_0^0,Z_1^0) \sim \tg_0\times \tg_1$, or any other couplings that can be constructed from marginal (unpaired) observations of $\tgg$. In practice, each step of $\map$ is empirically approximated by first drawing samples of $(Z_0^k, Z_1^k)$ from the ODE with drift $v^k$, and then constructing the next flow $v^{k+1}$ from the optimization in \eqref{equ:opt0}. Although this process accumulates errors, it was shown that one or two iterations are sufficient for practical applications \citep{rectified}. Note that the $\map$ procedure is ``cost-agnostic" in that it does not dependent on any specific cost $c$. Although the recursive $\map$ update is monotonically non-increasing on the transport cost for all convex $c$, it does not necessarily converge to the optimal coupling for any pre-specified $c$, as the update would stop whenever two cost functions are conflicting with each other. In \cite{rectified}, a coupling $(X_0,X_1)$ is called \emph{straight} if it is a fixed point of $\map$, that is, $(X_0,X_1) = \map((X_0,X_1))$. It was shown that rectifiable couplings that are optimal w.r.t. a convex $c$ must be straight, but the opposite is not true in general. One exception is the one dimension case ($d=1$), for which all convex functions $c$ (whose $c$-optimal coupling exists) share a common optimal coupling that is also straight. But this does not hold when $d\geq 2$. % \paragraph{$c$-Rectified flow} In this work, we modify the $\map$ procedure so that it can be used to solve \eqref{equ:mk} given a user-specified cost function $c$. We show that this can be done easily by properly restricting the optimization domain of $v$ and modifying the loss function in \eqref{equ:opt0}. The case of quadratic loss $c(x) = \frac{1}{2}\norm{x}^2$ is particularly simple, for which we simply need to restrict the $v$ to be a gradient field $v_t = \dd f_t$ in the optimization of \eqref{equ:opt0}. For more general convex $c$, we need to restrict $v$ to have a form of $v_t(x) = \dd c^*(\dd f_t(x))$, with $f$ minimizing the following loss function: \bbb\label{equ:minvc} \inf_{f} \int_0^1 \e{ c^*(\dd f( X_t)) - (X_1-X_0) \tt \dd f(X_t) + c(X_1-X_0) }\dt, % \eee where $c^*$ denotes the conjugate function of $c$. Obviously when $c(x)=\frac{1}{2}\norm{x}^2$, \eqref{equ:minvc} reduces to \eqref{equ:opt0} with $v = \dd f$. The loss function in \eqref{equ:minvc} is closely related to \emph{Bregman divergence} \citep[e.g.,][]{banerjee2005clustering} and the so-called \emph{matching loss} \citep[e.g.,][]{auer1995exponentially}. We call $\vv Z =\{Z_t\colon t\in[0,1]\}$ that follows $\d Z_t = \dd c^*(\dd f_t(Z_t)) \dt $ with $Z_0 = X_0$ and $f$ solving \eqref{equ:minvc} the $c$-rectified flow of $(X_0,X_1)$, and the corresponding $(Z_0,Z_1)$ the $c$-rectified coupling of $(X_0,X_1)$, denoted as $(Z_0,Z_1) = \crectify((X_0,X_1))$. Similar to the original rectified coupling, the $c$-rectified coupling $(Z_0,Z_1)$ also share the same marginal laws as $(X_0,X_1)$ and hence is a coupling of $\tgg$. In addition, $(Z_0,Z_1)$ yields no larger transport cost than $(X_0,X_1)$ w.r.t. $c$, that is, $\E[c(Z_1-Z_0)] \leq \E[c(X_1-X_0)]$. But this only holds for the specific $c$ that is used to define the flow, rather than all convex functions like $\rectify$. More importantly, recursively performing $\crectify$ allows us to find $c$-optimal couplings that solve the OT problem \eqref{equ:mk}. Under mild conditions, we have \bb (X_0,X_1) = \crectify((X_0,X_1)) &&\iff && \text{$(X_0,X_1)$ is $c$-optimal in \eqref{equ:mk}} &&\iff && \ell^*_{X,c} = 0, \ee where $\ell^*_{X,c}$ denotes the minimum value of the loss function in \eqref{equ:minvc}, which provides a criterion of $c$-optimality of a given coupling without solving the OT problem. Moreover, when following the recursive update $(Z_0^{k+1},Z_1^{k+1}) = \crectify((Z_0^{k}, Z_1^{k}))$, the $\ell^*_{Z^k,c} $ is guaranteed to decay to zero with $\min_{k\leq K} \ell^*_{Z^k,c} = \bigO{1/K}$. \input{texfiles/OT_background} \section{Rectified Flow: An Optimization-Based View} \label{sec:rectopt} We introduce rectified flow of \cite{rectified} from an optimization-based perspective: we show that rectified flow can be viewed as the solution of a special constrained dynamic optimization problem, which allows us to gain more understanding of rectified flow and motivates the development of $c$-rectified flow. Following \cite{rectified}, for a time-differentiable stochastic process $\vv X = \{X_t \colon t\in[0,1]\}$, % its expected velocity field $v^\X$ is defined as \bbb \label{equ:gvxzte} v^{\vv X}_t(z) = \E[\dot X_t ~|~X_t =z]. \eee where $\dot X_t$ denotes the time derivative of $X_t$. Obviously, $v^{\vv X}$ is the solution of \bbb \label{equ:infvLx} \inf_{v}\left\{ L_{\vv X}(v) \defeq \int_0^1 \e{\norm{\dot X_t - v_t(X_t)}^2}\dt \right \}, \eee where the optimization is on the set of all measurable velocity fields $v\colon \RR^d \to \RR^d$. The importance of $v^{\vv X}$ lies on the fact that it characterizes the time-evolution of the marginal laws $\rho_t \defeq \law(X_t)$ of $\vv X$, through the continuity equation in the distributional sense: \bbb \label{equ:conddeq} \partial_t \rho_t + \div (v^{\vv X}_t \rho_t)=0,~~~~ \rho_0 = \law(X_0),~~~~ t\in[0,1]. \eee Precisely, Equation~\eqref{equ:conddeq} should be interpreted by its weak and integral form: \bbb \label{equ:weakconddeq} \rho_t(h) - \rho_0(h) - \int_0^t \rho_t(\dd h \tt v^\X_s) \d s =0, ~~~~ \rho_0=\law(X_0), ~~~~{\forall h \in \Cc},~~~~ t\in[0,1], \eee where {$\rho_t(h)\defeq \int h(x) \d \rho_t(x)$} and $\Cc$ denotes the set of continuously differentiable functions on $\RR^d$ with compact support. Hence, if the solution of Eq~\eqref{equ:conddeq}-\eqref{equ:weakconddeq} is unique, then the marginal laws $\{\law(X_t)\}_t$ of $\vv X$ are uniquely determined by $v^\X$ and the initial $\law(X_0)$. We define the rectified flow of $\vv X$, denoted by $\vv Z = \rectflow(\vv X)$, as the ODE driven by $v^{\vv X}$: \bbb \label{equ:zofvx} \d Z_t = v_t^{\vv X}(Z_t) \dt,~~~~ Z_0 = X_0, ~~~~ t\in[0,1]. \eee Moreover, the rectified flow of a coupling $(X_0,X_1)$ is defined as the rectified flow of $\vv X$ when $\vv X$ is the linear interpolation of $(X_0,X_1)$. \begin{mydef} A stochastic process $\vv X$ is called rectifiable if $v^\vv X$ exists and is locally bounded, and Equation~\eqref{equ:zofvx} has an unique solution. A coupling $(X_0,X_1)$ is called rectifiable if its linear interpolation process $\vv X$, following $X_t = t X_1 +(1-t) X_0 $, is rectifiable. In this case, we call $\vv Z= \rectflow(\vv X)$ the rectified flow of $(X_0,X_1)$, and write it (with an abuse of notation) as $\vv Z = \rectflow((X_0,X_1))$. The corresponding $(Z_0,Z_1)$ is called the rectified coupling of $(X_0,X_1)$, denoted as $(Z_0,Z_1) = \map((X_0,X_1))$. \end{mydef} By the definition in \eqref{equ:zofvx}, we have $v^{\vv Z} =v^\X$, and hence the marginal laws $\law(Z_t)$ of $\vv Z$ are governed by the same continuity equation \eqref{equ:conddeq}-\eqref{equ:weakconddeq}, which is a well known fact. As shown in \citep{kurtz2011equivalence}, Equation~\eqref{equ:zofvx} has an unique solution iff Equation~\eqref{equ:weakconddeq} has an unique solution, which implies that $\vv Z$ and $\vv X$ share the same marginal laws. We also assumed that the solution of \eqref{equ:infvLx} is unique; if not, results in the paper hold for all solutions of \eqref{equ:infvLx}. \begin{thm}[Theorem~\nn{3.3} of \cite{rectified}] Assume that $\vv X$ is rectifiable. We have% \bb \vv Z = \rectflow(\vv X) &&\Rightarrow&& v^{\vv X} = v^{\vv Z} &&\Rightarrow&& \law(X_t) = \law(Z_t), ~~\forall t\in[0,1]. \ee \end{thm} Hence, rectified flow turns a rectifiable % stochastic process into a flow while preserving the marginal laws. \paragraph{A {optimization} view of rectified flow} We show that the rectified flow $\vv Z$ of $\vv X$ achieves the minimum of the path-wise $c$-transport cost % in the set of time-differentiable stochastic processes whose expected velocity field equals $v^\X$. This explains that the property of non-increasing convex transport costs of rectified flow/coupling. \begin{lem} \label{thm:rectdual} The rectified flow $\vv Z = \rectflow(\vv X_t)$ in \eqref{equ:zofvx} attains the minimum of \bbb \label{equ:pathopt} \inf_{\vv Y} \left\{ F_c(\vv Y) \defeq \int_0^1 \e{ c(\dot Y_t) } \dt , ~~~~s.t.~~~~ v^{\vv Y} = v^\X \right\}, \eee which holds for \emph{any} convex functions $c\colon \RR^d\to \RR$. \end{lem} \begin{proof} For any stochastic process $\vv Y$ with $v^{\vv X}_t(z) = v^{\vv Y}_t(z) = \E[\dot Y_t | Y_t=z] $, we have \bb F_c(\vv Y) & = \int_0^1\E[c(\dot Y_t)] \dt \\ & \geq\int_0^1 \E[c(\E[\dot Y_t|Y_t])] \dt \ant{Jensen's inequality} \\ & = \int_0^1 \E[c(v^{\vv Y}(Y_t))] \dt \\ & = \int_0^1 \E[c(v^{\vv X}(X_t))] \dt \ant{$v^\X=v^\Y$, and hence $\law(X_t)=\law(Y_t)$} \\ & = \int_0^1 \E[c(v^{\vv X}(Z_t))] \dt \ant{$\law(X_t) = \law(Z_t)$} \\ & = \int_0^1 \E[c(\dot Z_t)\dt = \vv F_c(\vv Z). \ee \end{proof} Lemma~\ref{thm:rectdual} suggests that the rectified flow decreases the path-wise $c$-transport cost: $F_c(\vv Z) \leq F_c(\vv X)$, for all convex $c$. Note that $\e{c(Z_1-Z_0)}\leq F_c(\vv Z) $ by Jensen's inequality, and $\e{c(X_1-X_0)} = F_c(\vv X)$ if $\vv X$ is the linear interpolation of $(X_0,X_1)$. Hence, in this case, we have % $$ \E[c(Z_1-Z_0)] \leq F_c(\vv Z) \leq F_c(\vv X) = \E[c(X_1-X_0)], $$ which yields a proof of Theorem~3.2 of \cite{rectified} that the rectified coupling $(Z_0,Z_1)$ yields no larger convex transport costs than $(X_0,X_1)$. % \paragraph{A primal-dual relation} Let us generalize the least squares loss $L_\X(v)$ in \eqref{equ:infvLx} to a a Bregman divergence based loss: \bb \tilde L_{\X,c}(v) \defeq \int_0^1 \e{\bcb{\dot X_t; ~ v_t(X_t)}}\dt, && \bc(x;y) = c(x) - c(y) - (x-y)\tt \dd c(y), \ee where $\bc(\cdot;\cdot)$ is the Bregman divergence w.r.t. $c$. The least squares loss $L_\X $ is recovered with $c(x) = \frac{1}{2} \norm{x}^2$. Rectified flow can be alternatively implemented by minimizing $\tilde L_{\X,c}$ with a differentiable strictly convex $c$, as in this case the minimum of $\tilde L_{\X,c}$ is also attended by $v^\X(z) = \E[\dot X_t|X_t=z]$. The $c$-rectified flow is obtained if we minimize $\tilde L_{\X,c}$ with $v$ restricted to be a form of $v = \dd c^*\circ \dd f_t$. See more in Section~\ref{sec:crectify}. In the following, we show that the optimization in \eqref{equ:pathopt} can be viewed as the dual problem \eqref{equ:gvxzte}. \begin{thm} For % any differentiable convex function $c$, and {rectifiable process $\vv X$}, we have $$ \tilde \ell^*_{\vv \X,c} \defeq \inf_{v} \tilde L_{\vv X,c} (v) = \sup_{\vv Y}\left\{ F_c(\vv X) - F_c(\vv Y) ~~ s.t.~~ v^\Y=v^\X \right \}, % $$ and the optima above are achieved when $v = v^{\X}$ and $\vv Y = \rectflow(\vv X)$. \end{thm} \begin{proof} Let $\var_c(\dot X_t~|~X_t )\defeq \E[c(\dot X_t) - c(\E [\dot X_t|X_t])~|~X_t] $. For any $v$, we have \bb \tilde L_{\X,c}(v) &= \int_0^1 \E[c(\dot X_t) - c(v(X_t)) - (\dot X_t - v(X_t)) \dd c(v(X_t))] \dt \\ & = \int_0^1 \E[c(\dot X_t) - c(v(X_t)) - (v^\X(X_t) - v(X_t)) \dd c(v(X_t)) ] \dt \ant{$v^\X(X_t)=\E[\dot X_t |X_t]$} \\ & \geq \int_0^1 \E[c(\dot X_t) - c(v^\X(X_t)) ] \dt \ant{$c(v^\X) \geq c(v) + (v^\X-v) \dd c(v)$} \\ & = \int_0^1 \var_c(\dot X_t~|~X_t) \dt , \ee The inequality is tight when $v = v^\X$, which attains the minimum of $\tilde L_{\X,c}$. Write $ R_{\vv X,c}(\vv Y) = F_c(\vv X) - F_c(\vv Y)$. We know that $\vv Z = \map(\vv X)$ attains the maximum of $R_{\vv X,c}(\vv Y)$ subject to $v^{\vv Y} = v^{\vv X}$ by Lemma~\ref{thm:rectdual}. In addition, \bb R_{\vv X, c}(\vv Z) & = \int_0^1 \E[c(\dot X_t) - c(\dot Z_t) ] \dt \\ & = \int_0^1 \E[c(\dot X_t) - c(v^\X_t(Z_t)])] \dt \\ & = \int_0^1 \E[c(\dot X_t) - c(v^\X_t(X_t)])] \dt \ant{$\law(Z_t)=\law(X_t),\forall t $}\\ & = \int_0^1 \E[c(\dot X_t) - c(\E[\dot X_t|X_t])] \dt \\ % & = \int_0^1 \E[\var_c(\dot X_t~|~X_t)] \dt. % \ee This concludes the proof. % \end{proof} \paragraph{Straight couplings} The $\tilde \ell^*_{\vv X,c}=\int_0^1\var_c(\dot X_t|X_t)\dt $ above provides a measure of how much the different paths of $\X $ intersect with each other. If $c$ is strictly convex and $\tilde \ell^*_{\vv X,c} = 0$, we have $\dot X_t = \E[\dot X_t|X_t]$ almost surely, meaning that there exist no two paths that go across a point along two different directions. In this case, $\vv X$ is a fixed point of $\rectflow(\cdot)$, that is, $\vv X = \vv Z = \map(\vv X)$, because we have $\d X_t =\dot X_t \d t = \E[\dot X_t |X_t] \dt = v^\X(X_t ) \dt $, which is the same Equation \eqref{equ:zofvx} that defines $\vv Z$. Similarly, if $\vv X $ is the linear interpolation of the coupling $(X_0,X_1)$, then $\tilde \ell^*_{\X,c} =0$ with strictly convex $c$ if and only if $(X_0,X_1)$ is a fixed point of the $\map$ mapping, that is, $(X_0,X_1) = \map((X_0,X_1))$, following \cite{rectified}. Such couplings are called \emph{straight}, or \emph{fully rectified} in \cite{rectified}. Obtaining straight couplings is useful for learning fast ODE models because the trajectories of the associated rectified flow $\vv Z$ are straight lines and hence can be calculated in closed form without iterative numerical solvers. See \cite{rectified} for more discussion. % Moreover, \cite{rectified} showed that rectifiable $c$-optimal couplings must be straight. In the one dimensional case ($d=1$), the straight coupling, if it exists, is unique and attains the minimum of $\E[c(X_1-X_0)]$ for all convex functions for which $c$-optimal coupling exists. For higher dimensions ($d\geq 2$), however, straight couplings are not unique, and the specific straight coupling obtained at the convergence of the recursive $\map$ update (i.e. $(Z_0^{k+1},Z_1^{k+1})=\map((Z_0^{k},Z_1^{k}))$) is implicitly determined by the initial coupling $(Z_0^0,Z_1^0)$, and is not expected to be optimal w.r.t. any pre-fixed $c$. The following counter example shows a somewhat stronger negative result: there exist straight couplings that are not optimal w.r.t. all second order differentiable convex functions with invertible Hessian matrices. \begin{theoremEnd}[proof at the end, no link to proof]{exa} \label{exa:toycounterexp} Take $\tg_0 = \tg_1 = \normal(0,I)$. Hence, for $c(x)=\norm{x}^p$ with $p>0$, the $c$-optimal mapping is the trivial identity coupling $(X_0,X_0)$ with $X_0\sim \tg_0$. However, consider the coupling $(X_0,AX_0)$, where $A$ is a non-identity and non-reflecting rotation matrix (namely $A\tt A=I$, $\det(A)=1$, $A \neq I$ and $A$ does not have $\lambda =-1$ as an eigenvalue). Then $ (X_0, A X_0)$ is a straight coupling of $\tg_0$ and $\tg_1$, but it is not $c$-optimal for all second order differentiable convex function $c$ whose Hessian matrix is invertible everywhere. {See Appendix for the proof.} It is the rotation transform that makes $(X_0,AX_0)$ sub-optimal, which is removed in the proposed $c$-rectified flow in Section~\ref{sec:crectify} via a Helmholtz like decomposition. \end{theoremEnd} \begin{proofEnd} i) The fact that $A\tt A =I$ and $\tg_0=\tg_1=\normal(0,I)$ ensures that $AX_0\sim \tg_1$ and hence $(X_0, A X_0)$ is a coupling of $\tg_0$ and $\tg_1$. Let $X_t = t A X_0 + (1-t) X_0$ be the linear interpolation of the coupling. Related, we have $\dot X_t = A X_0 - X_0 $. Canceling $X_0$ yields that \bbb \label{dotxAIcexample} \dot X_t = (A-I) (t A + (1-t)I)^{-1}X_t, \eee where we use the fact that $t A + (1-t)I$ is convertible for $t\in[0,1]$, which we prove as follows: if $t A + (1-t)I$ is not invertible, then $A$ must have $\lambda =-\frac{1-t}{t}$ as one of its eigenvalues; but as a rotation matrix, all eigenvalues of $A$ must have a norm of $1$, which means that we must have $t=0.5$ and $\lambda = -1$. This, however, is excluded by the assumption that $A$ is non-reflecting (and hence $\lambda \neq -1$). Equation~\eqref{dotxAIcexample} shows that $\dot X_t$ is uniquely determined by $X_t$. Hence, we have $\int_0^1 \e{\var(\dot X_t|X_t) } \dt = 0$, which implies that $(X_0,AX_0)$ is a straight coupling by Theorem~\nn{3.6} of \cite{rectified}. 2) Let $c$ be a second order differentiable convex function whose Hessian matrix $\dd^2 c(x)$ is invertible everywhere. Let $c^*$ be the convex conjugate of $c$, then $c^*$ is also second order differentiable and $\dd c(\dd c^*(x)) = x$, and $\dd^2 c^*(x) = \dd^2 c(x)^{-1}.$ If $(X_0,A X_0)$ is a $c$-optimal coupling, there must exists a function $ \phi\colon \RR^d\to \RR$, such that \bbb \label{equ:axcstartphix} A x = x + \dd c^*(\dd \phi(x)),~~\forall x, \eee where $c^*$ is the convex conjugate of $c$. Equation~\eqref{equ:axcstartphix} is equivalent to $\dd c(Ax - x) = \dd \phi(x)$, which means that $\dd \phi $ is continuously differentiable. Taking gradient on both sides of \eqref{equ:axcstartphix} gives \bbb \label{equ:aihxbx} A -I = H_x B_x, &&& H_x = \dd^2 c^*(\dd\phi(x)),~~~~ B_x = \dd^2 \phi(x), \eee where $H_x, B_x$ are both symmetric and $H_x$ is positive definite, and hence Then $H_x B_x$ is a diagonalizable (all its eigenvalues are real) by Lemma~\ref{thm:diagmat}. However, $A-I$ is not diagonalizable because $A$ must have complex eigenvalues as a non-reflecting, non-identity rotation matrix. Hence, \eqref{equ:aihxbx} can not hold. \begin{lem}\label{thm:diagmat} Assume that $A,B$ are two real symmetric matrices and $A$ is positive definite. Then $AB$ is diagonalizable (on the real domain), that is, there exists an invertible matrix $P$, such that $P^{-1} AB P$ is a diagonal matrix. \end{lem} \begin{proof} This is a standard result in linear algebra. Because $A$ is positive definite, there exists an invertible symmetric matrix $C$, such that $CC = A.$ Then, $AB = CCB$, and it is similar to $CBC^{-1}$, which is symmetric and hence diagonalizable. \end{proof} \end{proofEnd} \section{Differentiable Processes with Equivalent Marginal Laws} \label{sec:marginal0} The marginal preserving property of rectified flow is due to the property of $v^{\vv Z} = v^\X$ by construction. However, we show in this section that $v^{\vv X} = v^{\vv Z}$ is only a sufficient condition: two differentiable processes $\vv X$ and $\vv Z$ can have the same marginal laws even if $r\defeq v^\X -v^{\vv\Z} \neq 0$. This is because $r $, as illustrated in Example~\ref{exa:toycounterexp}, can be a rotation-only vector field (in a generalized sense shown below) that introduces rotation components into the dynamics without modifying the marginal distributions. Therefore, the constraint of $v^{\vv Y}=v^\X$ in the optimization problem \eqref{equ:pathopt} may be too restrictive. A natural relaxation of \eqref{equ:pathopt} would be \bbb \label{equ:pathoptmlaw} \inf_{\vv Y} \left\{ F_c(\vv Y) \defeq \e{ \int_0^1 c(\dot Y_t) \dt} , ~~~~s.t.~~~~ \law(Y_t) = \law(X_t),~~\forall t\in[0,1]\right\}, \eee which yields a dynamic OT problem with % a continuum of marginal constraints. In Section~\ref{sec:crectify}, we show that the solution of \eqref{equ:pathoptmlaw} yields our $c$-rectified flow that solve the OT problem at the fixed point. Solving \eqref{equ:pathoptmlaw} allows us to remove the rotational components of $v^\X$, which is what what renders rectified flow non-optimal. In this section, we first characterize the necessary and sufficient condition for having equivalent marginal laws. \begin{mydef} A time-dependent vector field $r \colon \RR^d\times [0,1]\to \RR^d$ is said to be $\X$-marginal-preserving if \bbb \label{equ:edhxrt0} \int_0^t\E[\dd h(X_t) \tt r_t(X_t) ] =0,~~~\forall t\in[0,1], ~~~~ h \in \Cc. \eee \end{mydef} Equation~\eqref{equ:edhxrt0} is equivalent to saying that $\E[\dd h(X_t) \tt r_t(X_t) ] =0$ holds almost surely assuming that $t$ is a random variable following $\uniform([0,1])$ (i.e., $t$-almost surely). Let $\rho_t = \law(X_t)$ and it yields a density function $\varrho_t$. Using integration by parts, we have $$ 0= \E[\dd h(X_t) \tt r_t(X_t) ] = \int \dd h(x) \tt r_t(x)\varrho_t(x) \d x = - \int h(x) \div(r_t(x) \varrho_t(x)) \d x, ~~~~\forall h \in \Cc, $$ which gives $\div(r_t \varrho_t)=0$. This says that $r_t \varrho_t$ is a rotation-only (or divergence-free) vector field in the classical sense. \begin{lem}\label{thm:marginalrot} Let $\vv X$ and $\vv Y$ be two stochastic processes with the same initial distributions $\law(X_0) = \law(Y_0)$. Assume that $\vv X$ is rectifiable, and $v^{\vv Y}_t(z):=\E[\dot Y_t |Y_t = z]$ exists and is locally bounded. % Then $\X$ and $\Y$ share the same marginal laws at all time, that is, $\law(X_t) = \law(Y_t)$, $\forall t\in[0,1],$ if and only if $v^\X - v^\Y$ is $\vv Y$-marginal-preserving. % \end{lem} \begin{proof} Taking any $h$ in $\Cc$, % we have for $t\in[0,1]$ \bb \E[h(X_t)] - \E[h(X_0)] & = \int_0^t \E[\dd h(X_s)\tt \dot X_s ] \d s \\ & =\int_0^t \E[\dd h(X_s)\tt v^\X_s(X_s)] \d s \ant{$v^\X_s(X_s) = \E[\dot X_s |X_s]$} . \ee This suggests that the marginal law $\rho_t\defeq \law(X_t)$ satisfies \bbb \label{equ:tgth0} \rho_t(h) - \rho_ 0 (h) - \int_0^t \rho_s (\dd h \tt v^\X_s) \d s =0, ~~~ \forall h \in \Cc , \eee where we define $\rho_t (h) = \int h(x) \d \rho_t(x)$. Equation~\eqref{equ:tgth0} is formally written as the continuity equation: \bbb \label{equ:contieq0} \dot \rho_t + \div (g_t^\X \rho_t) = 0. \eee Similarly, $\tilde\rho_t\defeq \law(Y_t)$ satisfies \bbb \label{equ:tgtph0} \tilde\rho_t(h) - \tilde\rho_ 0 (h) - \int_0^t \tilde\rho_s (\dd h \tt v^\Y_s) \d s =0, ~~~ \forall h, \eee If $v_t^\X - v_t^\Y$ is $\law(Y_t)$-preserving for $\forall t\in[0,1]$, we have \bb \E[h(Y_t)] - \E[h(Y_0)] & =\int_0^t \E[\dd h(Y_s)\tt \dot Y_s] \d s \\ & = \int_0^t \E[\dd h(Y_s)\tt v^\Y_s(Y_s)] \d s \\ % & = \int_0^t \E[\dd h(Y_s)\tt v^\X_s(Y_s)] \d s + \int_0^t \E[\dd h(Y_s) \tt (v^\Y_s(Y_s) - v^\X_s(Y_s))] \d s \\ & =\int_0^t \E[\dd h(Y_s) \tt v^\X_s(Y_s)] \d s \ant{$v^\X-v^\Y$ is $\vv Y$-preserving}, \ee which suggests that $\tilde\rho_t \defeq \law(Y_t)$ solves the same continuity equation \eqref{equ:contieq0}, starting from the same initialization as $\law(X_0) = \law(Y_0)$. Hence, we have $\rho_t = \tilde\rho_t$ if the solution of \eqref{equ:contieq0} is unique, which is equivalent to the uniqueness of the solution of $\d Z_t = \vofX_t(Z_t)$ in \eqref{equ:zofvx} following Corollary 1.3 of \cite{kurtz2011equivalence}. On the other hand, if $\rho_t = \law(X_t) = \law (Y_t) = \tilde\rho_t$, following \eqref{equ:tgth0} and \eqref{equ:tgtph0}, we have for any $h \in \Cc$, \bb 0 & = \int_0^t \tilde\rho_t (\dd h\tt v^{\X}_s) - \tilde\rho_t(\dd h\tt v^{\Y}_s) \d s = \int_0^t \dd h(Y_s) \tt (v^\X(Y_s) -v^\Y(Y_s))\d s, \ee which is the definition of $\vv Y$-marginal-preserving following \eqref{equ:edhxrt0}. \end{proof} \section{$c$-Rectified Flow} % \label{sec:crectify} We introduce $c$-rectified flow, a $c$-dependent variant of rectified flow that guarantees to minimize the $c$-transport cost when applied recursively. This section is organized as follows: Section~\ref{sec:crectifyDefine} defines and discusses the $c$-rectified flow of a differentiable stochastic process $\vv X$, which we show yields the solution of the infinite-marginal OT problem~\eqref{equ:pathoptmlaw}. Section~\ref{sec:crectifyCoupling} considers the $c$-rectified flow of a coupling $(X_0,X_1)$, which we show is non-increasing on the $c$-transport cost. Section~\ref{sec:crectifyFixed} proves that the fixed points of $\crectify$ are $c$-optimal. Section~\ref{sec:crectifyOptView} interprets $c$-rectified flow as an alternating direction descent method for the dynamic OT problem \eqref{equ:qt}, and a majorize-minimization (MM) algorithm for the static OT problem \eqref{equ:mk}. Section~\ref{sec:hj} discusses a key lemma relating $c$-optimal couplings and its associated displacement interpolation with Hamilton-Jacobi equation. \subsection{$c$-Rectified Flow of Time-Differentiable Processes $\vv X$} \label{sec:crectifyDefine} For a {convex} cost function $c\colon \RR^d\to \RR$ and a time-differentiable process $\vv X$, the $c$-rectified flow of $\vv X$, denoted as $\vv Z = \crectflow(\vv X)$, is defined as the solution of \bbb \label{equ:zgxft} \d \Z_t =g^{\X,c}_t(\Z_t) \dt,~~~~ \Z_0 = X_0,~~~~\text{with}~~~~ g^{\X,c}_t(z) = \dd c^*(\dd f^{\X,c}_t(z)), ~~~~ t\in[0,1], \eee where $c^*(x) \defeq \sup_{y}\{ x\tt y - c(y)\}$ is the convex conjugate of $c$, and $f^{\X,c}\colon \RR^d\times [0,1] \to \RR$ is the optimal solution of \bbb \label{equ:bregloss} \inf_{f} \left\{ L_{\X,c} (f) \defeq \int_0^1 \E\left [ \mcb{\dot X_t;~ \dd f_t( X_t)} \right ] \dt \right\}, \eee where $\mc~ \colon \RR^d\times \RR^d\to [0,+\infty)$ is a loss function defined as % $$ \mcb{x;y} = c(x) - x\tt y + c^*(y). $$ Note that we have $\mcb{x;y}\geq 0$ for $\forall x,y$ following the definition of the conjugate $c^*$ (or the Fenchel-Young inequality). Losses of form $\mcb{x;y}$ {is equivalent to the so called \emph{matching loss} proposed for learning generalized linear models \cite{auer1995exponentially}.} % Compared with the original rectified flow, the difference of $c$-rectified flow is i) restricting the velocity field to a form of $g_t = \dd c^*\circ \dd f_t$, and ii) replacing the quadratic objective function to the matching loss. These two changes combined yield a Helmholtz like decomposition of $v^\X$ as we show below, allowing us to remove the ``{rotation-only}" component of $v^\X$ % and obtain $c$-optimal couplings at fixed points. \paragraph{Bregman divergence, Helmholtz decomposition, marginal preserving} We can equivalently write \eqref{equ:bregloss} using Bergman divergence associated with $c$, that is, % $$\bcb{x;y}\defeq c(x)-c(y)- \nabla c(y)\tt (x-y).$$ Then it is easy to see that $\mcb{x;y} = \bcb{x; \dd c^*(y)}$, by using the fact that $\dd c(\dd c^*(y)) = y$ and $c^*(y) = y \tt \dd c^*(y) - c(\dd c^*(y))$. Hence, $\mc$ and $\bc$ are equivalent up to the monotonic transform $\dd c^*$ on $y$. The minimum $\bcb{x;y}=0$ is achieved when $y = x$, while $\mcb{x;y}=0$ is achieved when $\dd c^*(y)=x$. Therefore, \eqref{equ:bregloss} is equivalent to \bbb \label{equ:bregloss2} \inf_{f} \int_0^1 \E\left [ \bcb{\dot X_t;~ g_t( X_t))} \right ] \dt , && \text{with~~~~} g_t = \dd c^*\circ \dd f_t. \eee Moreover, the generalized Pythagorean theorem of Bregman divergence (e.g., \citep{banerjee2005clustering}) gives \bbb \label{equ:pythabreg} \e{\bcb{\dot X_t; ~~ g_t}~|~ X_t} = \bcb{\e{\dot X_t|X_t};~~ g_t} + \e{\bcb{\dot X_t; ~~ \e{\dot X_t|X_t}}}. \eee Because $v^\X(X_t)= \e{\dot X_t|X_t}$ and the last term of \eqref{equ:pythabreg} is independent with $g_t$ , we can further reframe \eqref{equ:bregloss} into % \bbb \label{equ:bregvloss} \min_{f} \int_0^1 \E \left [ \bcb{v^\X_t( X_t); ~~ g_t(X_t))} \right ] \dt, && \text{with~~~~} g_t = \dd c^*\circ \dd f_t, \eee which can be viewed as projecting the expected velocity $v^\X_t$ to the set of functions of form $g_t = \dd c^*\circ \dd f_t$, w.r.t. the Bregman divergence. This yields an orthogonal decomposition of $v_t^\X$: \bbb \label{equ:helm} v^{\X}_t = \dd c^*\circ \dd f^{\X,c}_t + r^{\X,c}_t, \eee where $r^{\X,c}_t = v^{\X,c}_t - \dd c^*\circ \dd f^{\X,c}_t$ is the residual term. The key result below shows that $r^{\X,c}$ is $\X$-marginal-preserving, which ensures that the $c$-rectified flow preserves the marginals of $\X$. \begin{mydef} We say that $\vv X$ is $c$-rectifiable if $v^\X$ exists, the minimum of \eqref{equ:bregloss} exists and is attained by a locally bounded function $f^{\vv X, c}$, and % the solution of % Equation~\eqref{equ:zgxft} exists and is unique. % \end{mydef} \begin{thm}\label{thm:marginalgood} Assume that $\X$ is $c$-rectifiable, and $c^*\defeq \sup_y \{x\tt y - c(y)\}$ and $c^*\in\Cone$. We have i) $v^\X- g^{\X, c}$ is $\X$-marginal-preserving. ii) $\vv Z = \crectify(\vv X)$ preserves the marginal laws of $\vv X$, that is, $\law(Z_t) =\law(X_t)$, $\forall t\in[0,1]$. \end{thm} \begin{proof} i) By $v^\X_t(z) = \E[\dot X_t|X_t=z]$, the loss function in \eqref{equ:bregloss} is equivalent to % \bb L_{\X,c}(f) & = \int_0^1 \e{c^*(\dd f_t(X_t)) - \E[\dot X_t~|~X_t ] \tt \dd f_t(X_t ) + c(\dot X_t) } \dt \\ & = \int_0^1 \e{c^*(\dd f_t(X_t)) - v^\X_t(X_t) \tt \dd f_t(X_t) + c(\dot X_t)} \dt. \ee By Euler-Lagrange equation, we have $$ \int_0^1 \e{(\dd c^*(\dd f_s^{\X,s}(X_s) ) - v^\X(X_s))\tt \dd g_s(X_s) } \d s = 0, ~~~~ \forall g: ~g_s\in \Cc. $$ Taking $g_s = h$ if $s<t$ and $g_s = 0 $ if $s>t$ yields that $r^{\X,c}(x) =\dd c^*(\dd f_s^{\X,c}(X_s) ) - v^\X(X_s)$ is $\vv X$-marginal-preserving following \eqref{equ:edhxrt0}. ii) Note that $\vv Z$ is rectifiable if $\vv X$ is $c$-rectifiable. % Applying Lemma~\ref{thm:marginalrot} yields the result. % \end{proof} For the quadratic cost $c(x) = c^*(x) = \frac{1}{2} \norm{x}^2$, the $\dd c^*$ is the identity mapping, and \eqref{equ:helm} reduces to the {\helm} decomposition, which represents a velocity field into the sum of a gradient field and a divergence-free field. Hence, \eqref{equ:helm} yields a generalization of {\helm} decomposition, in which a monotonic transform $\dd c^*$ is applied on the gradient field component. We call \eqref{equ:helm} a \emph{Bregman {\helm} decomposition}. \paragraph{Remark: score matching} In some special cases, $v^\X$ may already be a gradient field, and hence the rectified flow and $c$-rectified flow coincide for $c(x) = \frac{1}{2} \norm{x}^2$. One example of this is when $X_t = \alpha_t X_1 + \beta_t \xi$ for some time-differentiable functions $\alpha_t$ and $\beta_t$, and $\xi \sim \normal(0,I)$, satisfying $\alpha_1 = 1, \beta_1 = 0$, and $X_0 = \alpha_0 X_1 + \beta_0 \xi$. In this case, one can show that \bb v_t^\X(z) = \E[\dot \alpha_t X_1+\dot \beta_t X_0~|~X_t=z] = \dd f_t(z), &&\text{with} && f_t(z) = \eta_t\log \varrho_t(z) + \frac{\zeta_t}{2} \norm{z}^2, \ee where $\varrho_t$ is the density function of $X_t$ with $\varrho_t(z) \propto \int \phi \left ( \frac{z -\alpha_t x_1}{\beta_t}\right ) \d \tg_1(x_1)$ and $\phi(z) = \exp(-\norm{z}^2/2)$, % and $\eta_t = \beta_t^2 (\dot \alpha_t/\alpha_t - \dot \beta_t /\beta_t)$ and $\zeta_t = \dot \alpha_t /\alpha_t$. This case covers the probability flow ODEs \citep{song2020score} and denoising diffusion implicit models (DDIM) \citep{song2020denoising} with different choices of $\alpha_t$ and $\beta_t$ % as suggested in \cite{rectified}. When $\zeta_t = 0$, as the case of \cite{song2019generative}, $v_t^\X$ is proportional to $\dd\log \rho_t,$ the \emph{score function} of $\varrho_t$, and the least squares loss $L_\X(v)$ in \eqref{equ:infvLx} reduces to a time-integrated \emph{score matching} loss \citep{hyvarinen2005estimation, vincent2011connection}. However, $v_t^\X$ is generally not a score function or gradient function, especially in complicate cases when the coupling $(X_0,X_1)$ is induced from the previous rectified flow as we iteratively apply the rectification procedure. In these cases, it is necessary to impose the gradient form as we do in $c$-rectified flow. % \paragraph{$c$-Rectified flow solves Problem~\eqref{equ:pathoptmlaw}} We are ready to show that the $c$-rectified flow solves the optimization problem in \eqref{equ:pathoptmlaw}. Further, \eqref{equ:bregloss} forms a dual problem of \eqref{equ:pathoptmlaw}. % \begin{thm}\label{thm:optmultimarg} Under the conditions in Theorem~\ref{thm:marginalgood}, we have i) $\vv Z = \crectify(\vv X)$ attains the minimum of \eqref{equ:pathoptmlaw}. ii) Problem \eqref{equ:pathoptmlaw} and \eqref{equ:bregloss} has a strong duality: $$ \inf_f L_{\X,c}(f) = \sup_{\vv Y} \left \{F_c(\vv X) - F_c(\vv Y) \colon \law(Y_t) =\law(X_t), ~\forall t\in[0,1] \right \}. $$ As the optima above are achieved by $f^{\X,c}$ and $\vv Z$, we have $L_{\X,c}(f^{\X,c}) = F_c(\vv X) - F_c(\vv Z).$ \end{thm} \begin{proof} Write $R_{\X,c}( \vv Y) = F_c(\vv X) - F_c(\vv Y)$. First, we show that $ L_{\X,c}(f) \geq R_{\X,c}(\Y)$ % for any $f$ and $\vv Y$ that satisfies $\law(Y_t) = \law(X_t)$, $\forall t$: \bb & R_{\X,c}(\vv Y) \\ & = \E\left [ \int_0^1 c(\dot X_t) - c(\dot Y_t) \dt \right] \\ & \overset{(1)}{\leq} \E\left [ \int_0^1 c(\dot X_t) + c^*(\dd f_t(Y_t)) - \dot Y_t \tt \dd f_t(Y_t) \dt \right] \ant{Fenchel-Young inequality: $c(y)\geq x\tt y - c^*(x)$}\\ & = \E\left [ \int_0^1 c(\dot X_t) + c^*(\dd f_t(Y_t)) - v^\Y_t(Y_t) \tt \dd f_t(Y_t) \dt \right] \!\!\!\!\!\!\! \ant{$v^\Y_t(Y_t) =\E[\dot Y_t|Y_t]$}\\ & = \E\left [ \int_0^1 c(\dot X_t) + c^*(\dd f_t(X_t)) - v^\Y_t(X_t) \tt \dd f_t(X_t) \dt \right] \!\!\!\!\!\!\! \ant{$\law(X_t) = \law(Y_t)$} \\ & = \E\left [ \int_0^1 c(\dot X_t) + c^*(\dd f_t(X_t)) - v^\X_t(X_t) \tt \dd f_t(X_t) \dt \right] \!\!\!\!\!\!\!\ant{$v^\X-v^\Y$ is $\vv X$-marginal-preserving }\\ % & = L_{\X,c}(f). \ee Moreover, if we take $\vv Y = \vv \Z$ and $f = f^{\X,c}$, then the inequality in $\overset{(1)}{\leq}$ is tight because $\dot Z_t = \dd c^*(\dd f_t(Y_t))$ holds $t$-almost surely. Therefore, $R_{\X,c}(\vv Z) = L_{\X,c}(f^{\X,c}) \geq R^{\X, c} (Y) $, which suggests that $\vv Z$ attains the maximum of $R_{\X,c}$ (under the marginal constraints) and the strong duality holds. \end{proof} \subsection{$c$-Rectified Flow of Coupling $(X_0,X_1)$} \label{sec:crectifyCoupling} Similar to the case of rectified flow, the $c$-rectified flow/coupling of a coupling $(X_0,X_1)$ is defined as the $c$-rectified flow/coupling of its linear interpolation process. In the following, we show that the $c$-rectified coupling of a coupling % yields no larger {$c$-transport cost}. % \begin{mydef}\label{def:lincp} Let $\vv X$ be the linear interpolation of coupling $(X_0,X_1)$ in that $ X_t = t X_1 + (1-t) X_0,\forall t\in[0,1]$. % We say that $(X_0,X_1)$ is $c$-rectifiable if $\vv{X}$ is $c$-rectifiable, and call $\vv Z = \crectflow(\vv{ X})$ the $c$-rectified flow of $(X_0,X_1)$. We call the induced $(Z_0,Z_1)$ the $c$-rectified coupling of $(X_0,X_1)$, denoted as $(Z_0,Z_1) = \crectify((X_0,X_1))$. \end{mydef} Note that the $c$-transport cost $\E[c(X_1-X_0)]$ is related to {the path-wise $c$-transport cost $F_c(\vv X)$} via \bb F_{c}(\vv X) = \E[c(X_1-X_0)] + S_c(\vv X), && S_c(\vv X) \defeq \int_0^1 \E[c(\dot X_t) - c(X_1-X_0)] \dt, \ee where $S_c(\vv X)$ is a non-negative measurement of how close $\vv X$ is to be {geodesic}: We have $S_c(\vv X) \geq 0$ following Jensen's inequality $\int_0^1 c(\dot X_t)\dt \geq c(\int_0^1 \dot X_t\dt ) = c(X_1-X_0)$, and $S_c(\vv X) = 0$ if $X_t = t X_1 + (1-t) X_0$. Hence, when $\vv X$ is the linear interpolation of $(X_0,X_1)$, we have from Theorem~\ref{thm:optmultimarg} that \bbb \label{equ:straighexz} % \E[c(X_1-X_0)] - \E[c(Z_1-Z_0)] = S_c(\vv Z) + L_{\X,c}(f^{\X,c}) \geq 0. \eee which establishes that $(Z_0,Z_1)$ yields no larger transport cost than $(X_0,X_1)$. \begin{thm}\label{thm:cost0} Assume that $c$ is convex with conjugate $c^* \in \Cone$, % and the conditions in Definition~\ref{def:lincp} holds. Then Equation~\eqref{equ:straighexz} holds and $\E[c(Z_1-Z_0)] \leq \E[c(X_1-X_0)].$ \end{thm} Compared with the regular $\map$ mapping, the key difference here is that the monotonicity of $\crectify$ only holds for the specific $c$ that it employees, rather than all convex cost functions. More importantly, as we show below, recursively applying $\crectify$ yields optimal couplings w.r.t. $c$, a key property that the regular rectified flow misses. \subsection{Fixed Points of $c$-{$\map$} are $c$-Optimal} \label{sec:crectifyFixed} We show three key results regarding the optimality of fixed points of the $\crectify$ mapping: 1) A coupling $(X_0,X_1)$ is a fixed point of $\crectify$, that is, $(X_0,X_1) = \crectify((X_0,X_1))$, if and only if it is $c$-optimal; 2) Define $\ell^*_{X,c} = \inf_f L_{\X,c}(f)$ where $\vv X$ is the linear interpolation of $(X_0,X_1)$. Then $\ell^*_{X,c}$ yields an indication of $c$-optimality of $(X_0,X_1)$, that is, $L_{X,c}^*=0$, iff $(X_0,X_1)$ is $c$-optimal. 3) The minimum $\ell^*_{X,c}$ in the first $k$ iterations of $\crectify$ steps decreases with an $O(1/k)$ rate. \begin{thm}\label{thm:copt} Assume that $c$ is {convex} with conjugate $c^*$, and $c, c^*\in \Cone$ and $\vv X$ is the linear interpolation process of $(X_0,X_1)$. Assume that $(X_0,X_1)$ is a $c$-rectifiable coupling, and $f^{\X,c} \in C^{2,1}(\RR^d\times [0,1])$. Then the following statements are equivalent: i) $(X_0,X_1)$ is a fixed point of $\crectify$, that is, $(X_0,X_1) = \crectify(X_0,X_1)$. ii) $ \ell^*_{X,c}\defeq \inf_{f} L_{\X,c}(f) = L_{\X,c}(f^{\X,c}) = 0$, for $L_{\X,c}$ in \eqref{equ:bregloss}. iii) $(X_0,X_1)$ is a $c$-optimal coupling. \end{thm} \begin{proof} i) $\to$ ii). If $(Z_0,Z_1) = (X_0,X_1)$, we have $S_c(\vv Z)=0$ and $L_{\X,c}(f^{\X,c}) = 0$ following \eqref{equ:straighexz}. iii) $\to$ ii). If $(X_0,X_1)$ is $c$-optimal, we have $\E[c(X_1-X_0)] \leq \E[c(Z_1-Z_0)]$, which again implies that $L_{\X,c}(f^{\X,c}) =0$ following \eqref{equ:straighexz}. ii) $\to$ i) Note that \bb L_{\X,c}(f^{\X,c}) = \int_0^1\e{\bcb{\dot X_t; ~ g^{\X,c}_t(X_t)}} \dt \geq 0. \ee Therefore, $L_{\X,c}(f^{\X,c}) =0$ implies that $\dot X_t= g^{\X,c}_t(X_t)$ $t$-almost surely. Because $Z_t$ satisfies the same equation, whose solution is assumed to be unique, we have $\vv Z =\vv X$ and hence $(Z_0,Z_1) = (X_0,X_1)$. ii) $\to$ iii) Because $\vv X$ is the linear interpolation, we have $X_t = t X_1 + (1-t) X_0$, and {it simultaneously satisfies the ODE $\d X_t= g^{\X,c}_t(X_t) \dt $}. Using Lemma~\ref{lem:hjc2} shows that $(X_0,X_1)$ is $c$-optimal. \end{proof} Knowing that $L_{\X,c}(f^{\X,c})$ is an indication of $c$-optimality, we show below that it is guaranteed to converge to zero with recursive $\map$ updates. \begin{cor}\label{thm:oneoverk} Let $\vv Z^{k}$ be the $k$-th $c$-rectified flow of $(X_0,X_1)$, satisfying $\vv Z^{k+1} = \crectflow((Z_0^k,Z_1^k))$ and $(Z_0^0,Z_1^0) = (X_0,X_1)$. Assume each $(Z_0^k, Z_1^k)$ is $c$-rectifiable for $k=0,\ldots, K$. Then $$ \sum_{k=0}^K L_{\vv Z^k,c}(f^{\vv Z^k,c}) + S_c(\vv Z^{k+1}) \leq \E[c(X_1-X_0)]. $$ Therefore, if $\E[c(X_1-X_0)]<+\infty$, we have $\min_{k\leq K} L_{\vv\Z^k,c}(f^{\vv \Z^k,c}) + S_c(\vv Z^{k+1}) = \bigO{1/K}$. \end{cor} \begin{proof} Applying \eqref{equ:straighexz} to $(Z_0^k,Z_1^k)$ and $(Z_0^{k+1},Z_1^{k+1})$ yields $$ L_{\vv Z^k,c}(f^{\vv Z^k,c}) + S_c(\vv Z^{k+1}) = \E[c(Z_1^k-Z_0^k)] - \E[c(Z_1^{k+1}-Z_0^{k+1})]. $$ Summing it over $k=0,\ldots, K$, \bb \sum_{k=0}^K L_{\vv Z^k,c}(f^{\vv Z^k,c}) + S_c(\vv Z^{k+1}) & = \sum_{k=0}^K \E[c(Z_1^k-Z_0^k)] - \E[c(Z_1^{k+1}-Z_0^{k+1})] \\ & = \E[c(Z_1^0-Z_0^0)] - \E[c(Z_1^{K+1} - Z_0^{K+1})] \\ & \leq \E[c(X_1-X_0)]. \ee \end{proof} \subsection{ $c$-Rectified Flow as Optimization Algorithms} \label{sec:crectifyOptView} In this section, we draw more understanding on how iterative $c$-rectified flowing solves the static and dynamic OT problems. % We first show that $c$-rectified flow can be viewed as an alternative direction descent on the dynamic OT problem \eqref{equ:qt}, and then that $c$-rectified coupling as a majorize-minimization (MM) algorithm on the statistic OT problem~\eqref{equ:mk}. The results in this section are framed in terms of a general path-wise loss function $F_c(\vv Y)$, and hence provide a useful starting point for deriving $c$-rectified flow like approaches to more general optimization problems with coupling constraints. \paragraph{$c$-Rectified flow as alternative direction descent on \eqref{equ:qt}} The mapping $\vv Z^{k+1} = \crectflow(\vv Z^k)$ can be interpreted as an alternative direction descent procedure for the dynamic OT problem \eqref{equ:qt}: % \bbb & \vv X^k = \argmin_{\vv Y} \left \{ F_c(\vv Y) ~~~s.t.~~~ (Y_0,Y_1) =(Z_0^k,Z_1^k) \right\}, \label{equ:linF0} \\ & \vv \Z^{k+1} = \argmin_{\vv Y} \left \{ F_c(\vv Y) ~~~s.t.~~~ \law(Y_t) = \law(X_t^k), ~~ \forall t\in[0,1] \right\}. \label{equ:mpF0} \eee Here in \eqref{equ:linF0}, we minimize $F_c(\vv Y)$ in the set of processes whose start-end pair $(Y_0,Y_1)$ equals the coupling $(Z_0^k, Z_1^k)$ from $\vv Z^k$, which simply yields the linear interpolation $X_t^k = t Z^k_1 + (1-t)Z^k_0$ by Jensen's inequality. In \eqref{equ:mpF0}, we minimize $F_c(\vv Y)$ given the path-wise marginal constraint of $\law(Y_t)=\law(X_t^k)$ for all time $t\in[0,1]$, which yields the $c$-rectified flow following Theorem~\ref{thm:optmultimarg}. Note that the updates in both \eqref{equ:linF0} and \eqref{equ:mpF0} keep the start-end marginal laws $\law(Y_0)$ and $\law(Y_1)$ unchanged, and hence the algorithm stays inside the feasible set $\{\vv Y \colon \law(Y_0)=\tg_0, \law(Y_1)=\tg_1\}$ in \eqref{equ:qt} once it is initialized to be so. The updates in \eqref{equ:linF0}-\eqref{equ:mpF0} highlight a key difference between our method and the {\bbformula} approach~\eqref{equ:cm}-\eqref{equ:bb}: the key idea of {\bbformula} is to restrict the optimization domain to the set of deterministic, ODE-induced processes (a.k.a. flows), but our updates alternate between the deterministic $c$-rectified flow $\vv Z^k$ and the linear interpolation process $\vv X^k$, which is \emph{not} deterministic or ODE-inducable unless the fixed point is achieved. \paragraph{$c$-Rectified flow as an MM algorithm} The majorize-minimization (MM) algorithm \citep{hunter2004tutorial} is a general optimization recipe that works by finding a surrogate function that \emph{majorizes} the objective function. Let $F(X)$ be the objective concave function to be minimize. An MM algorithm consists of iterative update of form $X^{k+1} \in \argmin_Y F^+(Y~|~X^k)$, where $F^+$ is a majorization function of $F$ that satsifies $$ F(Y) = \min_{X} F^+(Y~|~X), ~~~~ \text{and the minimum is attained when $X = Y$}. $$ In this case, the MM update guarantees that % $F(X^k)$ is monotonically non-increasing: $$ F(X^{k+1}) \leq F^+(X^{k+1} | X^k) \leq F^+(X^k~|~X^k) = F(X^k). $$ One can also view MM as conducting coordinate descent on $(X,Y)$ for solving $\min_{X,Y} F^+(Y~|~X)$. In the following, we show that $(Z_0^{k+1},Z_1^{k+1}) = \crectify((Z_0^k,Z_1^k))$ can be interpreted as an MM algorithm for the static OT problem \eqref{equ:mk} for minimizing $\E[c(X_1-X_1)]$ in the set of couplings of $\tgg$. % The majorization function corresponding to $\crectify$ can be shown to be \bb F^+_c((Y_0,Y_1)~|~(X_0,X_1)) & = \inf_{\tilde{\vv Y}} \left \{ F_c(\tilde{\vv Y}) ~~~s.t.~~~ (\tilde Y_0,\tilde Y_1) = (Y_0, Y_1), ~~~ \vv Y\in \mathcal M_X \right \}, \\ & \text{with}~~~~\mathcal M_X = \{\vv Y \colon ~~ \law(Y_t) = \law(t X_1 + (1-t)X_0),~~\forall t\in[0,1]\}, \ee where $F^+_c((Y_0,Y_1)~|~(X_0,X_1))$ denotes the minimum value of $F_c(\tilde{ \vv Y}) $ for $\tilde{\vv Y}$ whose start-end points equal $(Y_0, Y_1)$, and yields the same marginal laws as that of the linear interpolation process of $(X_0,X_1)$. \begin{pro} i) $F^+_c$ yields a majorization function of the $c$-transport cost $\E[c(Y_1-Y_0)]$ in the sense that $$\displaystyle \E[c(Y_1-Y_0)]=\min_{(X_0,X_1)} \{ F^+_c((Y_0,Y_1)~|~(X_0,X_1)), {~~s.t.~~ (X_0,X_1) \in \Pi_{0,1}}\}, $$ and the minimum is attained by $(X_0,X_1) = (Y_0,Y_1)$, {where $\Pi_{0,1}$ denotes the set of couplings of $\tgg$.} ii) % $\crectify$ yields the MM update related $F^+$ in that $$ \displaystyle \crectify((X_0,X_1)) \in \argmin_{(Y_0,Y_1)\in \Pi_{0,1}}F^+_c((Y_0,Y_1)~|~(X_0,X_1)). $$ \end{pro} \begin{proof} i) For any coupling $(X_0,X_1)$ and $(Y_0,Y_1)$, we have $$ F^+_c((Y_0,Y_1)|(X_0,X_1)) \geq \inf_{\tilde{\vv Y}} \left \{ \vv F_c(\tilde{\vv Y}) ~~~s.t.~~~ (\tilde Y_0, \tilde Y_1) = (Y_0,Y_1) \right\} = \E[c(Y_1-Y_0)], $$ where the inequality holds because remove the constraint $\vv Y\in \mathcal M_X$. % In addition, it is obvious that the inequality above becomes equality when $(X_0,X_1) = (Y_0,Y_1)$. ii) Note that $$ \inf_{(Y_0,Y_1)}F^+_c((Y_0,Y_1)~|~(X_0,X_1)) = \inf_{\vv{ Y}} \left \{ F_c(\vv{ Y}) ~~~s.t.~~~ \vv Y\in \mathcal M_X \right \}, $$ whose minimum of the right side is attained by $\vv Y = \crectflow((X_0,X_1))$ following Theorem~\ref{thm:optmultimarg}. Hence, the minimum of the left side is attained by $(Y_0,Y_1) = \crectify((X_0,X_1))$. \end{proof} \subsection{Hamilton-Jacobi Equation and Optimal Transport} \label{sec:hj} The proof of Theorem~\ref{thm:copt} relies on a key lemma shows that if the trajectories of an ODE of form $\d X_t = \dd c^*(\dd f_t(X_t))\dt $ are geodesic in that $X_t = tX_1+(1-t) X_0$, then the induced coupling $(X_0,X_1)$ is an $c$-optimal coupling of its marginals. The proof of this lemma relies on Hamilton-Jacobi (HJ) equation, which provides a characterization of $f$ for an ODE $\d X_t = \dd c^*(\dd f_t(X_t))\dt $ whose trajectories are geodesic. The connection between HJ equation and optimal transport has been a classic result and can be found in, for example, \cite{villani2021topics,villani2009optimal}. \begin{lem}\label{lem:hjc2} Let $v_t(x) = \dd c^*(\dd f_t(x))$ where $c^* \in C^1(\RR^d)$ is a convex function $c$, % and $f \in C^{2,1}(\RR^d\times [0,1])$ and $\dd c^*$ is an injective mapping. Assume all trajectories of $\d x_t = v_t(x_t)\dt$ are geodesic paths in that $x_{t}=t x_1 +(1-t)x_0$. Then we have: i) There exists $\tilde f_t$ such that $\dd \tilde f_t=\dd f_t$ (and hence we can replace $f$ with $\tilde f$ in the assumption), such that the following Hamilton–Jacobi (HJ) equation holds \bbb \label{equ:hj} \partial_t \tilde f_t(x) + c^*(\dd \tilde f_t(x)) =0,~~~\forall x\in \RR^d, ~~ t\in[0,1], && \text{(HJ equation)}. \eee ii) % $f$ satisfies \bb f_t(y_t) = \inf_{y_0 \in \RR^d} \left\{ t c\left (\frac{y_t-y_0}{t} \right ) + f_0(y_0) \right \} , ~~\forall t \in [0,1], ~~~ y_t\in\RR^d, && \text{(Hopf-Lax formula)} \ee where the minimum is attained if $\{y_t\}$ follows the ODE $\d y_t = v_t(y_t)\dt $. iii) Assume a coupling $(X_0,X_1)$ of $\tg_0,\tg_1$ satisfies $\d X_t = v_t(X_t)\dt$. Then $(X_0, X_1)$ is a $c$-optimal coupling. % \end{lem} \begin{proof} i) Starting from any point $x_t = x \in\RR^d$ at time $t$, because the trajectories of $\d x_t = v_t(x_t) \dt $ are geodesic, we have $\dot x_t = v_t(x_t) =\const$ following the trajectory. Because $v_t(x) = \dd c^*(\dd f_t(x))$ and $\dd c^*$ is injective, we have $\dd f_t(x_t) = const$ as well. Hence, we have \bb 0 = \ddt \dd f_t(x_t) & = \partial_t \dd f_t(x_t) + \dd ^2f_t(x_t) \dot x_t \\ & = \partial_t\dd f_t(x_t) + \dd ^2f_t(x_t) \dd c^*(\dd f_t(x_t)). \ee On the other hand, define $h_t(x) = \partial_t f_t(x) + c^*(\dd f_t(x))$. Then we have \bb \dd_x h_t(x) & = \partial_t \dd f_t(x) + \dd^2 f_t(x_t) \dd c^*(\dd f_t(x)) = 0. \ee This suggests that $\dd_x h_t(x) =0$ everywhere and hence $h_t(x)$ does not depend on $x$. Define $\tilde f_t(x) = f_t(x) - \int_0^t h_t(x_0) \d t $, where $x_0$ is any fixed point in $\RR^d$. Then $$ \tilde h_t(x) \defeq \partial_t \tilde f_t(x) + c^*(\dd \tilde f_t(x)) = h_t(x) - h_t(x_0) = 0.$$ ii) Take any $y_0,y_1$ in $\RR^d$, let $y_t = t y_1 + (1-t) y_0$ be their linear interpolation. We have \bb & f_1(y_1) - f_0(y_0) \\ & = \int_0^1 (\partial_t f_t(y_t) + \dd f_t(y_t) \tt (y_t - y_0)) \dt \\ & = \int_0^1 \dd f_t(y_t)\tt (y_1 - y_0) - c^*(\dd f_t(y_t)) \dt \ant{$h_t = \partial f_t + c^*(\dd f_t) = 0$}\\ &\overset{(1)}{\leq} \int_0^1 c(y_1- y_0) \dt \ant{$c(x) + c^*(y) \geq x\tt y$}\\ & = c(y_1- y_0). % \ee The equality in $\overset{(1)}{\leq}$ is attained if $y_t$ follows the geodesic ODE $\d y_t = v_t(y_t) \dt $ as we have $y_1 -y_0 = \dd c^*(\dd f_t(y_t))$, $\forall t$ in this case. A similar derivation holds for $f_t$. iii) Note that i) gives that $c(y_1-y_0) \geq f_1(y_1) - f_0(y_0) $. For any coupling $(Y_0,Y_1)$ of $\tg_0,\tg_1$, we have \bb \E[c(Y_1-Y_0)] \geq \E[f_1(Y_1) - f_0(Y_0)] = \E[f_1(X_1) - f_0(X_0)] = \E[c(X_1- X_0)]. \ee Hence, $(X_0,X_1)$ is a $c$-optimal coupling. \end{proof} \paragraph{Connection to {\bbformula} Formula} The results in Lemma~\ref{lem:hjc2} can also formally derived from {\bbformula} problem \eqref{equ:bb}, as shown in the seminal work of \cite{benamou2000computational}. By introducing a Lagrangian multiplier $\lambda \colon \RR^d\times [0,1]\to \RR$ for the constraint of $\dot \varrho_t + \div (v_t \varrho_t) =0$, the problem in \eqref{equ:bb} can be framed into a minimax problem: $$ \inf_{v,\varrho} \sup_{\lambda } \left\{ \mathcal L(v,\varrho, \lambda) \defeq \int c(v_t) \varrho_t + \int \lambda_t (\dot \varrho_t + \div (v_t \varrho_t) ~~~~s.t.~~~~ \varrho \in \Gamma_{0,1} \right\}, $$ where $\mathcal L(v,\varrho, \lambda) $ is the Lagrangian function, and $\Gamma_{0,1}$ denotes the set of density functions $\{\varrho_t\}_t$ satisfying $\varrho_0=\d \tg_0/\dx, ~ \varrho_1 = \d \tg_1/\dx$. Note that the following integration by parts formulas: \bb \int \lambda_t \div (v_t\varrho_t)+ \dd \lambda_t \tt v_t\varrho_t = 0, && \int \lambda_t \dot \varrho_t + \dot \lambda_t \varrho_t= \lambda_1\varrho_1 - \lambda_0 \varrho_0, % \ee where we assume that $\lambda_t v_r \rho_t$ decays to zero sufficiently fast at infinity. We have $$ \mathcal L(v,\varrho, \lambda) = (\lambda_1 \varrho_1 - \lambda_0 \varrho_0) + \int (c\circ v_t) \rho_t - \dot \lambda_t \varrho_t - \dd \lambda_t \tt (v_t \varrho_t). $$ At the saddle points, the functional derivations of $\mathcal L$ equal zero, yielding \bb \frac{\delta \mathcal L}{\delta \varrho_t} = c(v_t) - \dot \lambda_t - \dd \lambda_t \tt v_t = 0, && \frac{\delta \mathcal L}{\delta v_t} = (\dd c(v_t) - \dd \lambda_t)\varrho_t = 0. \ee Assume $\varrho_t$ is positive everywhere and note that $\dd c^*(\dd c(x)) = x$, we have $v_t = \dd c^*(\dd \lambda_t)$, and hence $\dd \lambda_t\tt v_t - c( v_t) = c^*(\dd \lambda_t)$. Plugging it back to $\frac{\delta \mathcal L}{\delta \rho_t} =0$ yields that $\dot \lambda_t + c^*(\dd \lambda_t)=0$. Overall, the (formal) KKT condition of \eqref{equ:bb} is \bb & \dot \varrho_t + \div (v_t \varrho_t) = 0, ~~~\rho_0 = \d \tg_0/\dx, ~~\rho_1 = \d\tg_1/\dx \ant{coupling condition} \\ & v_t = \dd c^* (\dd \lambda_t) \ant{mapping is gradient of convex function} \\ & \dot \lambda_t + c^*\left ({\dd \lambda_t}\right ) = 0. \ant{Hamilton-Jacobi equation} \ee This matches the result in Lemma~\ref{lem:hjc2} with $\lambda_t = \tilde f_t$. \section{Discussion and Open Questions} \begin{enumerate} \item Corollary~\ref{thm:oneoverk} only bounds the surrogate measure $\ell^*_{Z^k, c}$. Can we directly bound the optimality gap on the $c$-transport cost $e^*_k = \E[c(Z_1^k-Z_0^k)] - \inf_{(Z_0,Z_1)} \E[c(Z_1-Z_0)]$? Can we find a certain type of strong convexity like condition, under which $e_k^*$ decays exponentially with $k$? \item For machine learning (ML) tasks such as generative models and domain transfer, the transport cost is not necessarily the direct object of interest. In these cases, as suggested in \cite{rectified}, rectified flow might be preferred because it is simpler and does not require to specify a particular cost $c$. Question: for such ML tasks, when would it be preferred to use OT with a specific $c$, and how to choose $c$ optimally? \item In practice, recursively applying the ($c$-)rectification accumulates errors because the training optimization for the drift field and the simulation of the ODE can not be conducted perfectly. How to avoid the error accumulation at each step? Assume $\{x_{1,i}\}_i\sim \tg_1$, and $\{z_{0,i}^k, z_{1,i}^k\}_i$ is obtained by solving the ODE of the $k$-th $c$-rectified flow starting from $z_{0,i}^k \sim \tg_0$. As we increase $k$, $\{z_{0,i}^k\}_i$ may yield increasingly bad approximation of $\tg_1$ due to the error accumulation. One way to fix this is to adjust $\{z_{1,i}^k\}$ to make it closer to $\{x_{1,i}^k\}_i$ at each step. This can be done by reweighting/transporting $\{z_{1,i}^k\}_i$ towards $\{x_{1,i}^k\}_i$ by minimizing certain discrepancy measure, or replacing each $z_{1,i}^k$ with $x_{\sigma(i)}^k$ where $\sigma$ is a permutation that yields a one-to-one matching between $\{z_1\datai\}$ and $\{x_1\datai\}_i$. The key and challenging part is to do the adjustment in a good and fast way, ideally with a (near) linear time complexity. \item With or without the adjustment step, build a complete theoretical analysis on the statistical error of the method. \item In what precise sense is rectified flow solving a multi-objective variant of optimal transport? \end{enumerate}
{'timestamp': '2022-09-30T02:08:22', 'yymm': '2209', 'arxiv_id': '2209.14577', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14577'}
arxiv
\section{Introduction} In recent years, many explanations methods have been developed for explaining machine learning models, with a strong focus on local analysis, i.e., generating explanations for individual prediction (see \citep{molnar2022} for a survey). Among this plethora of methods, one of the most prominent and active techniques are Counterfactual Explanations \citep{Wachter2017CounterfactualEW}. Unlike popular local attribution methods, e.g., SHAP \citep{lundberg2020local2global} and LIME \citep{ribeiro2016why}, which highlight the importance score of each feature, Counterfactuals Explanations (CE) describe the smallest modification to the feature values that changes the prediction to a desired target. Although CE are intuitive and user-friendly by giving recourse in some scenarios (e.g., loan application), they have many shortcomings in practice. Indeed, most counterfactual methods rely on a gradient-based algorithm or heuristics approaches \citep{survey_counterfactual}, thus can fail to identify the most natural explanations and lack guarantees. Most algorithms either do not guarantee sparse counterfactuals (changes in the smallest number of features) or do not generate in-distribution samples (see \citep{counterfactual_r1, CHOU202259} for a survey on counterfactuals methods). Although some works \citep{optimalce_vidal, face_counterfactual, prototype_basedce} try to solve the plausibility/sparsity problem, the suggested solutions are not entirely satisfactory. \\ In another direction, many papers \citep{dice, Karimi2020ModelAgnosticCE, diverce_ce} encourages the generation of diverse counterfactuals in order to find actionable recourse \citep{Ustun2019ActionableRI}. Actionability is a vital desideratum, as some features may be non-actionable, and generating many counterfactuals increases the chance of getting actionable recourse. However, the diversity of CE makes the explanations less intelligible, and the synthesis of various CE or local explanations, in general, is yet to be comprehensively solved \citep{rethinkinxai}. In addition, recently \cite{himanoisycounterfactuals} highlights a new problem of local CE called: \textit{noisy responses to prescribed recourses}. Indeed, in real-world scenarios, some individuals may not be able to implement exactly the prescribed recourses, and they show that most CE methods fail in this noisy environment. Therefore, we propose to reverse the usual way of explaining with counterfactual by computing \textit{Counterfactual rules}. We introduce a new line of counterfactuals: we build interpretable policies for changing a decision with a given probability that ensure the stability of the deduced recourse. These policies are optimal (in sparsity) and faithful to the data distribution. Their computation comes with statistical guarantees as they use a consistent estimator of the conditional distribution. Our proposal is to find a general policy or rule that permits changing the decision while fixing some features instead of generating many counterfactual samples. One of the main challenges is to identify the (minimal) set of features that provide the best promising directions for changing the decision to the desired output. We also show this approach can be extended for finding a collection of regional counterfactuals, such that we have a global counterfactual policy for analyzing a model. An example of the counterfactual rules that we introduce is given in figure \ref{fig:oce}. \begin{figure}[ht] \centering \includegraphics[scale=0.4]{figures/lcr_rcl_illustration.png} \caption{Illustration of the local and regional Counterfactuals Rules that we introduced on a dataset with 4 variables: Age, Salary, Sex, and HoursPerWeek. The Counterfactual Rules define intervals on the minimal subset of features to change the decision of a model prediction in the local counterfactual rule or the decision of a rule that applies on a sub-population in the regional counterfactual rule. In Blue, we have the proposed rules to change the decision.} \label{fig:oce} \end{figure} \section{Motivation and Related works} Most of the methods that propose Counterfactuals Explanations are based on the approach of the seminal work of \cite{wachter2017counterfactual}: the counterfactuals are generated by optimizing a cost, but this procedure does not account directly the plausibility of the counterfactual examples (see \citep{counterfactual_r1} for classification of CE methods). Indeed, a major shortcoming is that the adverse decision needed for obtaining the counterfactual is not designed to be feasible or representative of the underlying data distribution. However, some recent studies proposed ad-hoc plausibility constraint in the optimization, using for instance an outlier score \citep{dace}, an Isolation Forest \citep{optimalce_vidal} or a density-weighted metrics \citep{face_counterfactual} to generate in-distribution samples. In another direction, \cite{prototype_basedce} proposes to use an autoencoder that penalizes out-of-distribution candidates. Instead of relying on ad-hoc constraints, we propose CE that gives plausible explanations by design. Indeed, for each observation, we identify the variables and associated ranges of values that have the highest probability of changing the prediction. We can compute this probability with a consistent estimator of the conditional distribution $P(Y | \boldsymbol{X}_S)$. As a consequence, the sparsity of the counterfactuals is not encouraged indirectly by adding a penalty term ($\ell_0$ or $\ell_1$) as existing works \citep{dice}. Our approach is inspired by the concept of \textit{Same Decision Probability (SDP)} (introduced in \citep{Chen2012TheSP}) that can be used for identifying the smallest subset of features to guarantee (with a given probability) the stability of a prediction. This minimal subset is called \textit{Sufficient Explanations}. In \citep{amoukou2021consistent}, it has been shown that the \textit{SDP} and the \textit{Sufficient Explanations} can be estimated and computed efficiently for identifying important local variables in any classification and regression models. For counterfactuals, we are interested in the dual set: we want the minimal subset of features that have a high probability of changing the decision (when the other features are fixed). Another limitation of the current CE is their local nature and the multiplicity of the explanations produced. While some papers \citep{dice, Karimi2020ModelAgnosticCE, diverce_ce} promote the generation of diverse counterfactual samples to ensure actionable recourse, such diverse explanations should be summarized to be intelligible \citep{rethinkinxai}, but the compilation of local explanations is often a very difficult problem. To address this problem, we do not generate counterfactual samples, but we build a rule \textit{Counterfactual Rules} (CR) from which we can derive counterfactuals. Contrary to classic CE which gives the nearest instances with a desired output, we find the most effective rule for each observation (or group of similar observations) that changes the prediction to the desired target. This local rule easily aggregates similar counterfactuals. For example, if $\boldsymbol{x} = \{ \texttt{Age=20, Salary=35k, HoursWeek=25h, Sex=M}, \dots \}$ with \texttt{Loan=False}, fixing the variables \texttt{Age} and \texttt{Sex} and changing the \texttt{Salary} and \texttt{HoursWeek} change the decision. Therefore, instead of given multiples combination of \texttt{Salary} and \texttt{HoursWeek} (e.g. 35k and 40h or 40k and 55h, \dots) that result in many instances, the counterfactual rule gives the range of values: \texttt{IF HoursWeek $\in \texttt{[35h, 50h]}$, Salary $\in$ [40k, 50k], and the} \textbf{remaining features are fixed} \texttt{THEN Loan=True}. It can be extended at a regional scale, e.g., given a rule $\textbf{R} = \{\texttt{IF Salary} \in \texttt{[35k, 20k], Age} \in \texttt{[20, 80] THEN Loan=False}\}$, the regional Counterfactual Rule (CR) could be $\{ \texttt{\textbf{IF } Salary} \in \texttt{[40k, 50k],} \texttt{ HoursWeek} \in \texttt{[35h, 50h] and the} \textbf{ remaining rules are fixed} \texttt{ THEN Loan=True}\}$. The main difference between a local and a global CR is that the Local-CR explain a single instance by fixing the remaining feature values (not used in the CR) ; while a regional-CR is defined by keeping the remaining variables in a given interval (not used in the regional-CR). Moreover, by giving ranges of values that guarantee a high probability of changing the decision, we partly answer the problem of \textit{noisy responses to prescribed recourses} \citep{himanoisycounterfactuals} so long as the perturbations are within our ranges. Although the \textit{Local Counterfactual Rule} is new, the \textit{Regional Counterfactual Rule} can be related to some recent works. Indeed, \cite{rawal2020beyond} proposed Actionable Recourse Summaries (AReS), a framework that constructs global counterfactual recourses in order to have a global insight of the model and detect unfair behavior. While AReS is similar to the Regional Counterfactual Rule, we emphasize some significant differences. Our methods can address regression problems and deal with continuous features. Indeed, AReS needs to discretize the continuous features, inducing a trade-off between speed and performance as noticed by \citep{globalce}. Thus, too few bins result in unrealistic recourse, while too many bins result in excessive computation time. In addition, AReS uses a greedy heuristic search approach to find global recourse, which might produce sub-optimal recourse. As we have already mentioned, the changes we provide overcome these two limitations because the consistency of our counterfactual is controlled by an estimation of the probability of changing the decision, and because we favor changes of a minimum number of features. Another global CE framework has been introduced in \citep{cet4} to ensure transparency: the Counterfactual Explanation Tree (CET) partitions the input space with a decision tree and assigns an appropriate action for changing the decision of each subspace. Therefore, it gives a unique action for changing the decision of multiple instances. In our case, we offer more flexibility in the counterfactual explanations because we provide a range of possible values that guarantee a change with a given probability. In our approach, we do not make any assumption about the cost of changing the feature nor the causal structure. If we have such information, then we can add it as additional post-processing such that it can be made more explicit and more transparent for the final user as required for trustworthy AI. \section{Minimal Counterfactual Rules} We assume that we have an i.i.d sample $\mathcal{D}_n = \{(\boldsymbol{X}_i,Y_i)_{i=1,\dots,n}\}$ such that $(\X, Y) \sim P_{(\X, Y)}$ where $\X \in \mathcal{X}$ (typically $\mathcal{X}=\mathbb{R}^p$) and $Y \in \mathcal{Y}$. The output $\mathcal{Y}$ can be discrete or continuous. We want to explain the predictor $f:\mathbb{R}^p \mapsto \mathcal{Y}$, that has been learned with the dataset $\mathcal{D}_n$. We use uppercase letters for random variables and lowercase letters for their value assignments. For a given subset $S \subset [p]$, $\XS = (X_i)_{i \in S}$ denotes a subgroup of features, and we write $\x=(\xs,\xsb)$ (with some abuse of notation). For an observation $(\x,y=f(\x))$, we have a target set $\YSt \subset \mathcal{Y}$, such that $y\notin \YSt$. For the simple case of classification problem, $\YSt = \{ y^\star\}$ is the standard singleton such that $y^\star\in \mathcal{Y}$ is different of $y$. Contrary to standard approaches, our definition of the counterfactual deals also with the regression case by considering $\YSt = [a,b]\subset \mathbb{R}$; our definitions and computations of counterfactuals are the same for both classification and regression. We remind that the classic CE problem (defined only for classification) is to find a function $\A: \mathcal{X} \mapsto \mathcal{X}$, such that for all observations $\x \in \mathcal{X}$, $f(\x)\neq y^\star$, and we have $f(\A(\x))=y^\star$. With standard CE, the function is defined point-wise by solving an optimisation program. Most often $\A(\cdot)$ is not a real function, as $\A(x)$ may be in fact a collection of (random) values $\{\x_1^\star,\dots,\x_p^\star\}$. A more recent point of view was proposed by \cite{cet4}, and it defines $\A$ as a decision tree, where in each leaf $L$, the best perturbation $a_L$ is predicted and add it to all the instances $\x \in L$. \\ Our approach is hybrid, because we do not propose a single action for each subspace of $\mathcal{X}$ or sub-group of population, but we give sets of possible perturbations. Indeed, a \emph{Local Counterfactual Rule} (Local-CR) for $\YSt$ and observation $\x$ (with $f(\x)\notin \YSt$) is a rectangle $C_{S}(\boldsymbol{x};\YSt) = \prod_{i\in S} [a_i, b_i], a_i, b_i \in \overline{\mathbb{R}}$ such that for all perturbations of $\x=\left(\xs,\xsb \right)$ obtained as $\boldsymbol{x}^\star = \left(\zs,\xsb \right)$ with $\zs \in C_{S}(\x;\YSt)$ and $\boldsymbol{x}^\star$ an in-distribution sample, then $f\left( \boldsymbol{x}^\star\right)$ is in $\YSt$ with a high probability.\\ Similarly, a \emph{Regional Counterfactual Rule} (Regional-CR) $C_S(\boldsymbol{R}; \YSt)$ is defined for $\YSt$ and a rectangle $\boldsymbol{R}=\prod_{i=1}^{d} [a_i, b_i], a_i, b_i \in \overline{\mathbb{R}}$, if for all observations $\x=(\xs,\xsb) \in \boldsymbol{R}$, the perturbations obtained as $\boldsymbol{x}^\star = (\zs,\xsb)$ with $\zs \in C_S(\boldsymbol{R},\YSt)$ and $\boldsymbol{x}^\star$ an in-distribution sample are such that $f\left( \boldsymbol{x}^\star\right)$ is in $\YSt$ with high probability.\\ We build such rectangles sequentially, first, we propose to find the best directions $S \subset [p]$ that offers the best probability of change. Then, we find the best intervals $[a_i, b_i], i \in S$ that change the decision to the desired target. A central tool in this approach is the Counterfactual Decision Probability. \begin{definition} \label{def:cdp}\textbf{Counterfactual Decision Probability (CDP).} The Counterfactual Decision Probability of the subset $S\subset\left\llbracket 1,p\right\rrbracket $, w.r.t $\boldsymbol{x}=\left(\boldsymbol{x}_{S},\boldsymbol{x}_{\bar{S}}\right)$ and the desired target $\YSt$ (s.t. $f(\x)\notin \YSt)$ i \[CDP_{S}\left(\YSt; \boldsymbol{x}\right)=P\left(f(\X) \in \YSt\left|\boldsymbol{X}_{\bar{S}}=\boldsymbol{x}_{\bar{S}}\right.\right). \nonumber\] \end{definition} The $CDP$ of the subset S is the probability that the decision changes to the desired target $\YSt$ by sampling the features $\XS$ given $\boldsymbol{X}_{\bar{S}} = \boldsymbol{x}_{\bar{S}}$. It is related to the Same Decision Probability $SDP_{S}(\mathscr{Y}; \boldsymbol{x}) = P\left(f(\X) \in \mathscr{Y} \vert \XS=\xs \right)$ used in \citep{amoukou2021consistent} for solving the dual problem of selecting the most local important variables for obtaining and maintaining the decision $f(\x) \in \mathscr{Y}$ (where $f(\x)\in\mathscr{Y}\subset \mathcal{Y}$). The set $S$ is called the Minimal Sufficient Explanation. Indeed, we have $CDP_S(\YSt; \boldsymbol{x}) = SDP_{\bar{S}}(\YSt; \boldsymbol{x})$. The computation of these probabilities is challenging and discussed in Section 4. We now focus on the minimal subset of features $S$ such that the model makes the desired decision with a given probability $\pi$ \begin{definition} \label{def:minimal_countset}(\textbf{ Minimal Divergent Explanations}). Given an instance $\boldsymbol{x}$ and a desired target $\YSt$, $S$ is a Divergent Explanation for probability $\pi>0$, if $CDP_{S}\left(\YSt;\boldsymbol{x}\right)\geq\pi$, and no subset $Z$ of $S$ satisfies $CDP_{Z}\left(\YSt;\boldsymbol{x}\right)\geq\pi$. Hence, a Minimal Divergent Explanation is a Divergent Explanation with minimal size. \end{definition} The set minimizing this probability is not unique, and we can have several Minimal Divergent Explanations. Note that the probability $\pi$ represents the minimum level required for a set to be chosen for generating counterfactuals, and its value should be as high as possible and depends on the use case. We have now enough material to define our main criterion for building a Local Counterfactual Rule (Local-CR): \begin{definition}\label{def:local_counterfactual_rule} (\textbf{Local Counterfactual Rule}). Given an instance $\boldsymbol{x}$, a desired target $\YSt \not\owns f(\x)$ , a Minimal Divergent Explanation $S$, the rectangle $C_{S}(\boldsymbol{x}; \YSt) = \prod_{i\in S} [a_i, b_i], a_i, b_i \in \overline{\mathbb{R}}$ is a Local Counterfactual Rule with probability $\pi_C$ if \begin{align} \label{eq:crp_instance} CRP_S(\YSt,\x, C_S(\x;y^\star)) \triangleq P( f(\X) \in \YSt \; | \boldsymbol{X}_S \in C_S(\boldsymbol{x};\YSt), \boldsymbol{X}_{\bar{S}} = \boldsymbol{x}_{\bar{S}}) \geq \pi_C. \end{align} The $CRP_S$ is the Counterfactual Rule Probability. \end{definition} The higher the probability $\pi_C$ is, the better the relevance of the rule $C_S(\x; \YSt)$ is, for this instance. Given a set $S$, we seek for the maximal rectangle in the direction $S$ satisfying Definition \ref{eq:crp_instance}. In practice, we can observe that the Local-CR $C_{S}(\cdot;\YSt)$ for neighbors $\x,\x'$ are often quite close, because the Minimal Divergent Explanations are similar and the corresponding rectangles often overlaps. Hence, this motivates a generalisation of these Local-CR to hyperrectangle $\boldsymbol{R} = \prod_{i=1}^{d} [a_i, b_i], a_i, b_i \in \overline{\mathbb{R}}$ regrouping similar observations. We denote $\text{supp}(\boldsymbol{R}) = \{i : [a_i, b_i] \neq \overline{\mathbb{R}}\}$ the support of the rectangle, and we extend the Local-CR to Regional Counterfactual Rules (Regional-CR). In order to do it, we denote $\boldsymbol{R}_{\bar{S}} = \prod_{i \in \bar{S}} [a_i, b_i]$ as the rectangle with intervals of $\boldsymbol{R}$ in $\text{supp}(\boldsymbol{R}) \cap \bar{S}$ and we also defines the corresponding Counterfactual Decision Probability CDP (Definition \ref{def:cdp}) for rule $\boldsymbol{R}$ and subset $S$ as $CDP_S(\YSt; \boldsymbol{R}) = P\left(f(\X) \in \YSt \left|\boldsymbol{X}_{\bar{S}} \in \boldsymbol{R}_{\bar{S}}\right.\right)$. Therefore, we can also compute the Minimal Divergent Explanation for rule $\boldsymbol{R}$ using Definition \ref{def:minimal_countset} with the CDP for rules. \begin{definition}\label{def:regional_rule} (\textbf{Regional Counterfactual Rule}). Given any rectangle $\boldsymbol{R}$, a desired target $\YSt$, a Minimal Divergent Explanation $S$ of $R$, the rectangle $C_S(\boldsymbol{R}; y^\star) = \prod_{i\in S} [a_i, b_i]$ is a Regional Counterfactual Rule with probability $\pi_C$ if \begin{align} \label{eq:crp_rule} CRP_S(\YSt; \boldsymbol{R}, C_S(\boldsymbol{R}, \YSt)) \triangleq P( f(\X) \in \YSt \; | \boldsymbol{X}_S \in C_S(\boldsymbol{R},\YSt), \XSb \in \boldsymbol{R}_{\bar{S}} )\geq \pi_C. \end{align} $CRP_S(\YSt; \boldsymbol{R}, C_S(\boldsymbol{R}))$ is the corresponding Counterfactual Rule Probability for rule $\boldsymbol{R}$. \end{definition} \paragraph{Remarks: } Local-CR and regional-CR differ slightly: for local, we condition by $\boldsymbol{X}_{\bar{S}} = \boldsymbol{x}_{\bar{S}}$ in Eq. \ref{eq:crp_instance}, while for regional, we condition by $\boldsymbol{X}_{\bar{S}} \in \boldsymbol{R}_{\bar{S}}$. For computing regional-CR, we can start for a rectangle generated by any method, such as \citep{bayesianRuleListRudin, OptimalDecisionTreeRudin}. The only condition is that it contains a homogeneous group, i.e. with almost the same output. However, by default we use as initial rules the Sufficient Rules derived in \citep{amoukou2021consistent} as it handles regression problem. The Sufficient Rules are minimal support rectangles define for a given output $\mathscr{Y}$ as $C_S(\mathscr{Y}) = \Pi_{i\in S} [a_i,b_i]$ such that $\forall \x \in \mathcal{X}, \xs \in C_S(\mathscr{Y})$, $P(f(\X) \in \mathscr{Y} \vert \XS = \xs) \geq \pi$. \section{Estimation of the $CDP$ and $CRP$} In order to compute the probabilities $CDP_S$ and $CRP_S$ for any $S$, we use a dedicated Random Forest (RF) $m_{k, n}$ that learns the model $f$ to explain. Indeed, the conditional probabilities $CDP_S$ and $CRP_S$ can be easily computed from a RF by combining the Projected Forest algorithm \citep{benard2021shaff} and the Quantile Regression Forest \citep{meinshausen2006quantile}: hence we can estimate consistently the probabilities $CDP_S(\mathscr{Y}^\star; \boldsymbol{x})$. We adapt the approach used in \citep{amoukou2021consistent} and remind for the sake of completeness, the computation of the estimate of $SDP_S$. \subsection{Projected Forest and $CDP_S$} The estimator of the $SDP_S$ is built upon a learned Random Forest \citep{breiman1984classification}. A Random Forest (RF) is a predictor consisting of a collection of $k$ randomized trees (see \citep{Loh2011ClassificationAR} for a detailed description of decision tree). For each instance $\boldsymbol{x}$, the predicted value of the $j$-th tree is denoted $m_n(\boldsymbol{x}, \Theta_j)$ where $\Theta_j$ represents the resampling data mechanism in the $j$-th tree and the successive random splitting directions. The trees are then averaged to give the prediction of the forest as: \begin{align} \label{eq:random_forest_baggin_estimator} \small m_{k, n}(\boldsymbol{x}, \Theta_{1:k}, \mathcal{D}_n) = \frac{1}{k} \sum_{l=1}^{k} m_n(\boldsymbol{x}; \Theta_l, \mathcal{D}_n) \end{align} However, the RF can also be view as an adaptive nearest neighbor predictor. For every instance $\boldsymbol{x}$, the observations in $\mathcal{D}_n$ are weighted by $w_{n, i}(\boldsymbol{x}; \Theta_{1:k}, \mathcal{D}_n)$, $i=1, \dots, n$. Therefore, the prediction of RF can be rewritten as\[ \small m_{k, n}(\boldsymbol{x}, \Theta_{1:k}, \mathcal{D}_n) = \sum_{i=1}^{n} w_{n, i}(\boldsymbol{x}; \Theta_{1:k}, \mathcal{D}_n) Y_i. \nonumber \] This emphasizes the central role played by the weights in the RF's algorithm, see \citep{meinshausen2006quantile, amoukou2021consistent} for detailed description of the weights. Therefore, it naturally gives estimators of other quantities e.g., Cumulative hazard function \citep{ishwaran2008random}, Treatment effect \citep{wager2017estimation}, conditional density \citep{du2021wasserstein}. For instance, \cite{meinshausen2006quantile} showed that we can used the same weights to estimate the Conditional Distribution Function with the following estimator: \begin{align} \widehat{F}(y | \boldsymbol{X} = \boldsymbol{x}, \Theta_{1:k}, \mathcal{D}_n) = \sum_{i=1}^{n} w_{n, i}(\boldsymbol{x}; \Theta_{1:k}, \mathcal{D}_n) \mathds{1}_{Y_{i} \leq y} \label{eq:estimator_boostrap_quantile} \end{align} In another direction, \cite{benard2021shaff} introduced the Projected Forest algorithm \citep{benard2021mda, benard2021shaff} that aims to estimate $E[Y | \boldsymbol{X}_S]$ by modifying the RF's prediction algorithm. \paragraph{Projected Forest:} To estimate $E[Y | \XS = \xs]$ instead of $E[Y | \boldsymbol{X} = \x]$ using a RF, \cite{benard2021interpretable} suggests to simply ignore the splits based on the variables not contained in $S$ from the tree predictions. More formally, it consists of projecting the partition of each tree of the forest on the subspace spanned by the variables in S. The authors also introduced an algorithmic trick that computes the output of the Projected Forest efficiently without modifying the initial tree structures. We drop the observations down in the initial trees, ignoring the splits which use a variable not in $S$: when it encounters a split involving a variable $i \notin S$, the observations are sent both to the left and right children nodes. Therefore, each instance falls in multiple terminal leaves of the tree. To compute the prediction of $\xs$, we follow the same procedure, and gather the set of terminal leaves where $\xs$ falls. Next, we collect the training observations which belong to every terminal leaf of this collection, in other words, we keep only the observations that fall in the intersection of the leaves where $\xs$ falls. Finally, we average their outputs $Y_i$ to generate the estimation of $E[Y | \XS = \xs]$. Notice that the author show that this algorithm converges asymptotically to the true projected conditional expectation $E[Y | \XS = \xs]$. As the RF, the PRF gives also a weight to each observation. The associated PRF is denoted $ m_{k, n}^{(\xs)}(\xs) = \sum_{i=1}^{n} w_{n, i}(\xs) Y_i$. Therefore, as the weights of the original forest was used to estimate the CDF in equation \ref{eq:estimator_boostrap_quantile}, \cite{amoukou2021consistent} used the weights of the Projected Forest Algorithm to estimate the $SDP$ as $\widehat{SDP}_{S}\left(\mathscr{Y};\boldsymbol{x}\right) = \sum_{i=1}^{n} w_{n, i}(\xs) \mathds{1}_{Y_i \in \mathscr{Y}}$. The idea is essentially to replace $Y_i$ by $\mathds{1}_{Y_i \in \mathscr{Y}}$ in the Projected Forest equation defined above. The authors also show that this estimator converges asymptotically to the true $SDP_S$. Therefore, we can estimate the $CDP$ with the following estimator \begin{equation} \label{eq:CDP_estimator} \widehat{CDP}_{S}\left(\YSt;\boldsymbol{x}\right) = \sum_{i=1}^{n} w_{n, i}(\xsb) \mathds{1}_{Y_i \in \YSt}. \end{equation} \paragraph{Remarks:} Note that we only give the estimator of the $CDP_S$ of an instance $\x$. The estimator of the $CDP_S$ of a rule $R$ will be discussed in the next section as it is related to the estimator of the $CRP_S$. \subsection{Regional RF and $CRP_S$} In this section, we focus on the estimation of the $CRP_S(\YSt, \x, C_S(\x;\YSt)) = P(f(\X) \in \YSt \; | \boldsymbol{X}_S \in C_S(\boldsymbol{x}; \YSt), \boldsymbol{X}_{\bar{S}} = \boldsymbol{x}_{\bar{S}})$ and $CRP_S(\YSt, \boldsymbol{R}, C_S(\boldsymbol{R};\YSt)) = P(f(\X) \in \YSt \; | \boldsymbol{X}_S \in C_S(\boldsymbol{R};\YSt), \boldsymbol{X}_{\bar{S}} \in \boldsymbol{R}_{\bar{S}})$. For simplicity, we remove the dependency of the rectangles in $\YSt$. Based on the previous Section, we already know that the estimators using the RF will be in the form of $\widehat{CRP}_{S}\left(\YSt,\boldsymbol{x}, C_S(\boldsymbol{x})\right) = \sum_{i=1}^{n} w_{n, i}(\x) \mathds{1}_{Y_i \in \YSt}$, thus we only need to find the right weighting. The main challenge is that we have a condition based on a region, e.g., $\XS \in C_S(\boldsymbol{x})$ or $\boldsymbol{X}_{\bar{S}} \in \boldsymbol{R}_{\bar{S}}$ (regional-based) instead of condition of type $\XS = \xs$ (fixed value-based) as usually. However, we introduced a natural generalization of the RF algorithm to make predictions when the conditions are both regional-based and fixed value-based. Thus, the case where there are only regional-based conditions are naturally derived. \paragraph{Regional RF to estimate $CRP_S(\YSt,\x, C_S(\x)) = P(f(\X) \in \YSt \; | \boldsymbol{X}_S \in C_S(\boldsymbol{x}), \boldsymbol{X}_{\bar{S}} = \boldsymbol{x}_{\bar{S}})$:} The algorithm is based on a slight modification of RF. Its works as follow: we drop the observations in the initial trees, if a split used variable $i \in \bar{S}$, i.e., fixed value-based condition, we use the classic rules of RF, if $x_i \leq t$, the observations go to the left children, otherwise the right children. However, if a split used variable $i \in S$, i.e, regional-based condition, we use the rectangles $C_S(\boldsymbol{x}) = \prod_{i=1}^{|S|} [a_i, b_i]$. The observations are sent to the left children if $b_i \leq t$, right children if $a_i > t$ and if $t \in [a_i, b_i]$ the observations are sent both to the left and right children. Therefore, we use the weights of the Regional RF algorithm to estimate the $CRP_S$ as in equation \ref{eq:CDP_estimator}, the estimator is $\widehat{CRP}_S(y^\star; \boldsymbol{x}, C_S(\boldsymbol{x})) = \sum_{i=1}^{n} w_{n, i}(\x) \mathds{1}_{Y_i = y^\star}$. A more detailed version of the algorithm is provided and discussed in Appendix. To estimate the $CDP$ of a rule $CDP_{S}\left(\YSt; \boldsymbol{R}\right)=P\left(f(\X) \in \YSt \left|\boldsymbol{X}_{\bar{S}}\in \boldsymbol{R}_{\bar{S}} \right.\right)$, we just have to apply the projected Forest algorithm to the Regional RF, i.e., when a split involving a variable outside of $\bar{S}$ is met, the observations are sent both to the left and right children nodes, otherwise we use the Regional RF split rule, i.e., if an interval of $\boldsymbol{R}_{\bar{S}}$ is below $t$, the observations go to the left children, otherwise the right children and if $t$ is in the interval, the observations go to the left and right children. The estimator of the $CRP_S(\YSt; \boldsymbol{R}, C_S(\boldsymbol{R}))$ for rule is also derived from the Regional RF. Indeed, it is a special case of the Regional RF algorithm where there are only regional-based conditions. \section{Learning the Counterfactual Rules} We compute the Local and Regional CR using the estimators of the previous section. First, we find the Minimal Divergent Explanation in the same way as Minimal Sufficient Explanation can be found \citep{amoukou2021consistent}. As the exploration of all possible subsets is exponential, we search the Minimal Divergent Subset among the $K=10$ most frequently selected variables in the RF $m_{k,n}$ used to estimate the probabilities $CDP_S, CRP_S$ ($K$ is an hyper-parameter to select according to the use case and computational power). We can also use any importance measure. Given an instance $\boldsymbol{x}$ or rectangle $\boldsymbol{R}$ (and set $\YSt$) and their corresponding Minimal Divergent Explanation S, we want to find a rule $C_S(\boldsymbol{x}) = \prod_{i \in S} [a_i, b_i]$ s.t. given $\boldsymbol{X}_{\bar{S}} = \boldsymbol{x}_{\bar{S}}$ or $\boldsymbol{X}_{\bar{S}} \in \boldsymbol{R}_{\bar{S}}$ and $\XS \in C_S(\boldsymbol{x})$, the probability that $Y \in \YSt$ is high. More formally, we want: $P(f(\X) \in \YSt | \XS \in C_S(\boldsymbol{x}), \boldsymbol{X}_{\bar{S}} = \boldsymbol{x}_{\bar{S}})$ or $P(f(\X) \in \YSt| \XS \in C_S(\boldsymbol{x}), \boldsymbol{X}_{\bar{S}} \in \boldsymbol{R}_{\bar{S}} )$ above $\pi_C$. The computation of the rectangles $C_S(\boldsymbol{x}) = \prod_{i\in S|} [a_i, b_i]$ relies heavily on our use of RF and on the algorithmic trick of the projected RF. Indeed, the rectangles defining the rules arise naturally from RF, while AReS \citep{rawal2020beyond} relies on binned variables to generate candidate rules and tests all these possible rules for choosing an optimal one. We overcome the computational burden and the challenge of choosing the number of bins. \begin{figure}[!htb] \minipage{0.30\textwidth} \includegraphics[width=\linewidth]{figures/tree_partition.png} \caption{The partition of the RF learned to classify the toy data (Green/Blue stars). Its has 10 leaves. The explainee $\boldsymbol{x}$ is the Blue triangle in leaf 5. }\label{fig:forest_part} \endminipage\hfill \minipage{0.30\textwidth} \includegraphics[width=\linewidth]{figures/projected_partition.png} \caption{The partition of the projected Forest when we condition on $X_0$, i.e., ignoring the splits based on $X_1$ (the dashed lines).}\label{fig:projected_part} \endminipage\hfill \minipage{0.30\textwidth}% \includegraphics[width=\linewidth]{figures/counterfactual_rule.png} \caption{The optimal CR for $\boldsymbol{x}$ when we condition given $X_0=x_0$ is the Green region, its corresponds to the union of leaf 3 and 4 of the forest}\label{fig:cr} \endminipage \end{figure} To illustrate the idea, we use a two-dimensional data $(X_0, X_1)$ with label Y represented as Green/Blue stars in figure \ref{fig:forest_part}. We fit a Random Forest to classify this dataset and show its partition in figure \ref{fig:forest_part}. The explainee $\boldsymbol{x}$ is the Blue triangle observation. By looking at the different cells/leaves of the RF, we can guess that the Minimal Divergent Explanation of $\boldsymbol{x}$ is $S = X_1$. Indeed, in figure \ref{fig:projected_part}, we observe the leaves of the Projected Forest when we do not condition on $S = X_1$, thus projected the RF's partition only on the subspace $X_0$. Its consists of ignoring all the splits in the other directions (here the $X_1$-axis), thus $\boldsymbol{x}$ falls in the projected leaf 2 (see figure \ref{fig:projected_part}) and its $CDP$ is $CDP_{X_1}(\text{Green}; \boldsymbol{x})=\frac{10 \text{ Green}}{10\text{ Green} + 17\text{ Blue}} = 0.58$. Finally, the problem of finding the optimal rectangle $C_S(\boldsymbol{x}) = [a_i, b_i]$ in the direction of $X_1$ s.t. the decision changes can be easily solved by using the leaves of the RF. In fact, by looking at the leaves of the RF (figure \ref{fig:forest_part}) of the observations that belong in the projected RF leaf 2 (figure \ref{fig:projected_part}) where $\boldsymbol{x}$ falls, we see in figure \ref{fig:cr} that the optimal rectangle to change the decision given $X_0 = x_0$ or being in the projected RF leaf 2 is the union of the intervals on $X_1$ of the leaf 3 and 4 of the RF (see the Green region of figure \ref{fig:cr}). Given an instance $\boldsymbol{x}$ and its Minimal Divergent Explanation $S$, the first step is the collect of the observations which belong to the leaf of the Projected Forest given $\bar{S}$ where $\boldsymbol{x}$ falls. It corresponds to the observations that has positive weights in the computation of the $CDP_S(\YSt; \boldsymbol{x}) = \sum_{i=1}^{n} w_{n, i}(\boldsymbol{x}_{\bar{S}}) \mathds{1}_{Y_i \in \YSt}$, i.e., $\{\x_i: w_{n, i}(\boldsymbol{x}_{\bar{S}}) >0\}$. Then, we used the partition of the original forest to find the possible leaves $C_S(\boldsymbol{x})$ in the direction $S$. The possible leaves is among the RF's leaves of the collected observations $\{\boldsymbol{x}_i: w_{n,i}(\boldsymbol{x}_{\bar{s}}) >0\}$. Let denote $L(\boldsymbol{x}_i)$ the leaves of the observations $\x_i$ with $w_{n, i}(\boldsymbol{x}_{\bar{S}}) >0$. A possible leaf is a leaf $L(\boldsymbol{x}_i)$ s.t. $CRP_S(\YSt, \boldsymbol{x}, L(\boldsymbol{x}_i)_S) = P( f(\X) \in \YSt | \XS \in L(\x_i)_S, \boldsymbol{X}_{\bar{S}} = \boldsymbol{x}_{\bar{S}}) \geq \pi_C$. Finally, we merge all the neighboring possible leaves to get the largest rectangle, and this maximal rectangle is the counterfactual rule. Note that the union of the possible leaves is not necessary a connected space, thus we can have multiple counterfactual rules. We apply the same idea to find the regional CR. Given a rule $\boldsymbol{R}$ and its Minimal Divergent Explanation $S$, we used the Projection given $\boldsymbol{X}_{\bar{S}} \in \boldsymbol{R}_{\bar{S}}$ to find the compatible observations and their leaves and combine the possible ones to obtain the regional CR that has $CRP_S(\YSt, \boldsymbol{R}, C_S(\boldsymbol{R})) \geq \pi_C$. For example, if we consider the leaf 5 of the original forest as a rule: \texttt{If $\boldsymbol{X} \in $ Leaf 5, then predict Blue}. Its Minimal Divergent Explanation is also $S=X_1$. The R-CR would also be the Green region in figure \ref{fig:cr}. Indeed, if we satisfy the $X_0$ condition of the leaf 5 and $X_1$ condition of the leaf 3 and 4, then the decision change to Green. \section{Experiments} To demonstrate the performance of our framework, we conduct two experiments on real-world datasets. The first consists of showing how we can use the \textit{Local Counterfactual Rules} for explaining a regression model. In the second experiment, we compare our approaches with the 2 baselines methods in classification problem: (1) \textbf{CET} \citep{cet4}, which partition the input space using a decision tree and associate a vector perturbation for each leaf, (2) \textbf{AReS} \citep{rawal2020beyond} performs an exhaustive search for finding global counterfactual rules, but we used the implementation of \cite{cet4} that adapts the algorithm for returning counterfactuals samples instead of rules. We compare the methods only in classification problem as most prior works do not deal regression problem. In all experiments, we split our dataset into train ($75\%$) - test ($25\%$), and we learn a model $f$, a LightGBM \textit{(estimators=50, nb leaves=8)}, on the train set that is the explainee. We learn $f$'s predictions on the train set with an approximating RF $m_{nb,n}$ \textit{(estimators=20, max depth=10)}: \textbf{that} will be used to generate the CR with $\pi=0.9$. The used parameters for \textbf{AReS}, \textbf{CET} are \textit{max rules=8, bins=10} and \textit{max iterations=1000, max leaf=8, bins=10} respectively. Due to page limitation, the detailed parameters of each method are provided in Appendix. \paragraph{Sampling CE using the Counterfactual Rules:} Notice that our approaches cannot be directly compare with the baseline methods since they all return counterfactual samples while we give rules (range of vector values) that permit to change the decision with high probability. However, we adapt the CR to generate also counterfactual samples using a generative model. For example, given an instance $\x = (\xs, \x_{\bar{S}})$, target $\YSt$ and its counterfactual rule $C_S(\x; \YSt)$, we want to find a sample $x^\star = (\boldsymbol{z}_S, \x_{\bar{S}})$ with $\boldsymbol{z}_S \in C_S(\x, \YSt)$ s.t $\x^\star$ is an in-distribution sample and $f(\x^\star) \in \YSt$. Instead of using a complex conditional generative model as \citep{modeling_td, sdv} that can be difficult to calibrate, we use an energy-based generative approach \citep{ebmduvenaud, yanebm}. The core idea is to find $\boldsymbol{z}_S \in C_S(\x, y^\star)$ s.t. $\x^\star$ maximize a given energy score to ensure that it is an in-distribution sample. As an example of an energy function, we use the negative outlier score of an Isolation Forest \citep{liu2008isolation}. We use Simulated Annealing (see \citep{review_simulated_annealing} for a review) to maximize the negative outlier score using the information of the counterfactual rules $C_S(\x; \YSt)$. In fact, the range values given by the CR $C_S(\x; \YSt)$ reduce the search space for $\boldsymbol{z}_S$ drastically. We used the training set $\mathcal{D}_n$ to find the possible values i.e., we defined $P_i$, $P_S$ as the list of values of the variable $i \in S$ found in $\mathcal{D}_n$ and $P_S = \{ \boldsymbol{z}_S = (z_1, \dots, z_S): \boldsymbol{z}_S \in C_S(\x, y^\star), z_i \in P_i\}$ the possible values of $\boldsymbol{z}_S$ respectively. Then, we sample $\boldsymbol{z}_S$ in the set $P_S$ and use Simulated Annealing to find a $\x^\star$ that maximizes the negative outlier score. Note that the algorithm is the same for sampling CE with the Regional-CR. A more detailed version of the algorithm is provided in Appendix. Finally, we compare the methods on unseen observations using three criteria. \textit{Correctness} is the average number of instances for which acting as prescribed change to the desired prediction. \textit{Plausibility} is the average number of inlier (predict by an Isolation Forest) in the counterfactual samples. \textit{Sparsity} is the average number of features that have been changed, and especially for the global counterfactual methods (AReS, Regional-CR) that do not ensure to cover all the instances, we compute \textit{Coverage} that corresponds to the average number of unseen observations we cover. \paragraph{Local counterfactual rules for regression:} We give recourse for the \textbf{California House Price} dataset \citep{california_data} derived from the 1990 U.S. census. We have information about each district (demography, \dots), and the goal is to predict the median house value of each district. To illustrate the efficiency of the Local-CR, we select all the observations in the test set having a price lower than $100k$ (1566 houses), and we aim to find the recourse that permit to increase their price : we want the price $y$ to be in the interval $\YSt=[200k, 250k]$. For each instance $\x$, we compute the Minimal Divergent Explanation $S$, the Local-CR $C_S(\x; [200k, 250k])$ and a CE using the Simulated Annealing as described above. We succeed in changing the decision of all the observations $(\textit{Correctness}=1)$ and most of them passed the outlier test with $\textit{Plausibility}=0.92$. On top of that, our Local-CR have sparse support ($\textit{Sparsity}=4.45$). For example, the Local-CR of the instance $\x =$ \texttt{(Longitude=-118.2, latitude=33.8, housing median age=26, total rooms=703, total bedrooms=202, population=757, households=212, median income=2.52)} is $C_S(\x, [200k, 250k]) =$\texttt{ (total room $\in [2132, 3546],$ total bedrooms $\in [214, 491]$)}. It means if \texttt{total room and total bedrooms} satisfy the conditions in $C_S(\x, [200k, 250k])$ and the remaining features of $\x$ is fixed, then the probability that the price is in $[200k, 250k]$ is 0.97. \paragraph{Comparisons of Local-CR and Regional-CR with baselines (AReS, CET):} We use 3 real-world datasets: \textbf{Diabetes} \citep{diabetes} contains diagnostic measurements and aims to predict whether or not a patient has diabetes, \textbf{Breast Cancer Wisconsin (BCW)} \citep{UCI} consists of predicting if a tumor is benign or not using the characteristic of the cell nuclei, and \textbf{Compas} \citep{compasdata} was used to predict recidivism, and it contains information about the criminal history, demographic attributes. During the evaluation, we observe that \textbf{AReS, CET} are very sensitive to the number of bins and the maximal number of rules or actions as noticed by \citep{globalce}. A bad parameterization gives completely useless explanations. Moreover, a different model needs to be trained for each class to be accurate, while we only need to have a RF that has good precision. In table \ref{tab:results}, we notice that the Local and Regional-CR succeed in changing decisions with a high accuracy in all datasets, outperforming \textbf{AReS} and \textbf{CET} with a large margin on \textbf{BCW}, and \textbf{Diabetes}. Moreover, we notice that the baselines struggle to change at the same time the positive and negative class, (e.g. CET has \textit{Acc}=1 in the positive class, and 0.21 for the negative class on \textbf{BCW}) or when they have a good \textit{Acc}, the CE are not plausible. For instance, CET has \textit{Acc}=0.98 and \textit{Psb}=0 on \textbf{Compas}, meaning that all the CE are outlier. Regarding the coverage of the global CE, CET covers all the instances as it partitions the space, but we observe that \textbf{AReS} has a smaller \textit{Coverage}$=\{0.43, 0.44, 0.81\}$ than the Regional-CR which has $\{1, 0.7, 1\}$ for \textbf{BCW, Diabetes, and Compas} respectively. To sum up, the CR is easier to train and provides more accurate and plausible rules than the baselines methods. \begin{table}[ht!] \caption{Results of the \textit{Correctness} (Acc), \textit{Plausibility}, and \textit{Sparsity} (Sprs) of the different methods. We compute each metric according to the positive (Pos) and negative (Neg) class.} \label{tab:results} \resizebox{\columnwidth}{!}{% \begin{tabular}{ccccccccccccccccccc} \cline{2-19} & \multicolumn{6}{c}{\textbf{COMPAS}} & \multicolumn{6}{c}{\textbf{BCW}} & \multicolumn{6}{c}{\textbf{Diabetes}} \\ \cline{2-19} & \multicolumn{2}{c}{Acc} & \multicolumn{2}{c}{Psb} & \multicolumn{2}{c|}{Sps} & \multicolumn{2}{c}{Acc} & \multicolumn{2}{c}{Psb} & \multicolumn{2}{c|}{Sps} & \multicolumn{2}{c}{Acc} & \multicolumn{2}{c}{Psb} & \multicolumn{2}{c}{Sps} \\ \cline{2-19} & Pos & Neg & Pos & Neg & Pos & \multicolumn{1}{c|}{Neg} & Pos & Neg & Pos & Neg & Pos & \multicolumn{1}{c|}{Neg} & Pos & Neg & Pos & Neg & Pos & Neg \\ \textbf{L-CR} & 1 & 0.9 & 0.87 & 0.73 & 2 & \multicolumn{1}{c|}{4} & 1 & 1 & 0.96 & 1 & 9 & \multicolumn{1}{c|}{7} & 0.97 & 1 & 0.99 & 0.8 & 3 & 4 \\ \textbf{R-CR} & 0.9 & 0.98 & 0.74 & 0.93 & 2 & \multicolumn{1}{c|}{3} & 0.89 & 0.9 & 0.94 & 0.93 & 9 & \multicolumn{1}{c|}{9} & 0.99 & 0.99 & 0.9 & 0.87 & 3 & 4 \\ \textbf{AReS} & 0.98 & 1 & 0.8 & 0.61 & 1 & \multicolumn{1}{c|}{1} & 0.63 & 0.34 & 0.83 & 0.80 & 4 & \multicolumn{1}{c|}{3} & 0.73 & 0.60 & 0.77 & 0.86 & 1 & 1 \\ \textbf{CET} & 0.85 & 0.98 & 0.7 & 0 & 2 & \multicolumn{1}{c|}{2} & 1 & 0.21 & 0.6 & 0.80 & 8 & \multicolumn{1}{c|}{2} & 0.84 & 1 & 0.60 & 0.20 & 6 & 6 \end{tabular}% } \end{table} \section{Conclusion} Most current works that generate CE are implicit through an optimization process or a brunch of random samples, thus lacking guarantees. For this reason, we rethink CE as \textit{Counterfactual Rules}. For any individual or sub-population, it gives the simplest policies that change the decision with high probability. Our approach learns robust, plausible, and sparse adversarial regions where the observations should be moved. We make central use of Random Forests, which give consistent estimates of the interest probabilities and naturally give the counterfactual rules we want to extract. In addition, it permits us to deal with regression problems and continuous features. Consequently, our methods are suitable for all datasets where tree-based model performs well (e.g., tabular data). A prospective work is to evaluate the robustness of our methods to noisy human responses, i.e., when the prescribed recourse is not implemented exactly, and to refine the methodology for selecting the threshold probabilities $\pi$ and $\pi_C$. \newpage \section{Regional RF detailed} In this section, we give a simple application of the Regional RF algorithm to better understand how it works. Recall that the regional RF is a generalization of the RF's algorithm to give prediction even when we condition given a region, e.g., to estimate $E(f(\X) \; | \boldsymbol{X}_S \in C_S(\boldsymbol{x}), \boldsymbol{X}_{\bar{S}} = \boldsymbol{x}_{\bar{S}})$ with $C_{S}(\boldsymbol{x}) = \prod_{i=1}^{|S|} [a_i, b_i], a_i, b_i \in \bar{\mathbb{R}}$ a hyperrectangle. The algorithm works as follows: we drop the observations in the initial trees, if a split used variable $i \in \bar{S}$, a fixed value-based condition, we used the classic rules i.e., if $x_i \leq t$, the observations go to the left children, otherwise the right children. However, if a split used variable $i \in S$, regional-based condition, we used the hyperrectangle $C_S(\boldsymbol{x}) = \prod_{i=1}^{|S|} [a_i, b_i]$. The observations are sent to the left children if $b_i \leq t$, right children if $a_i > t$ and if $t \in [a_i, b_i]$ the observations are sent both to the left and right children. To illustrate how it works, we use a two dimensional variables $\X \in \mathbb{R}^2$, a simple decision tree $f$ represented in figure \ref{fig:tree_example}, and want to compute for $\x = [1.5, 1.9],$ $E(f(\X) | \boldsymbol{X}_1 \in [2, \; 3.5], \boldsymbol{X}_{0} = 1.5)$. We assume that $P(X_1 \in [2, \; 3.5] \; | X_0 = 1.5) >0$ and denoted $T_1$ as the set of the values of the splits based on variables $X_1$ of the decision tree. One way of estimating this conditional mean is by using Monte Carlo sampling. Therefore, there are two cases : \begin{figure}[ht!] \centering \includegraphics[scale=0.5]{figures/illustration_neurips.png} \caption{Representation of a simple decision tree (right figure) and its associated partition (left figure). The gray part in the partition corresponds to the region $[2, \; 3.5] \times [1, 2]$} \label{fig:tree_example} \end{figure} \begin{itemize} \item If $\forall t \in T_1,$ $t \leq 2$ or $t > 3$, then all the observations sampled s.t. $\Tilde{X}_i \sim \mathcal{L} (\X \; |\boldsymbol{X}_1 \in [2, \; 3.5], \boldsymbol{X}_{0} = 1.5)$ follow the same path and fall in the same leaf. The Monte Carlo estimator of the decision tree $E(f(\X) | \boldsymbol{X}_1 \in [2, \; 3.5], \boldsymbol{X}_{0} = 1.5)$ is equal to the output of the Regional RF algorithm. \begin{itemize} \item For instance, a special case of the case above is: if $\forall t \in T_1, t \leq 2$, and we sample using $\mathcal{L} (\X \; |\boldsymbol{X}_1 \in [2, \; 3.5], \boldsymbol{X}_{0} = 1.5)$, then all the observations go to the right children when they encounters a node using $X_1$ and fall in the same leaf. \end{itemize} \item If $\exists \; t \in T_1$ and $t \in [2, \; 3.5]$, then the observations sampled s.t. $\Tilde{X}_i \sim \mathcal{L} (\X \; |\boldsymbol{X}_1 \in [2, \; 3.5], \boldsymbol{X}_{0} = 1.5)$ can fall in multiple terminal leaf depending on if their coordinates $x_1$ is lower than $t$. Following our example, if we generate samples using $\mathcal{L} (\X \; |\boldsymbol{X}_1 \in [2, \; 3.5], \boldsymbol{X}_{0} = 1.5)$, the observations will fall in the gray region of figure \ref{fig:tree_example}, and thus can fall in node 4 or 5. Therefore, the true estimate is: \begin{align} & E(f(\X) | \boldsymbol{X}_1 \in [2, \; 3.5], \boldsymbol{X}_{0} = 1.5 ) \nonumber\\ & = p(X_1 \leq 2.9\; | X_0=1.5)*E[f(\X)\;| \X \in L_4] + p(X_1 > 2.9\; | X_0=1.5)*E[f(\X)\; |\X \in L_5] \label{fig:weighted_mean} \end{align} \end{itemize} Concerning the last case $(t \in [2, \; 3.5])$, we need to estimate the different probabilities $p(X_1 \leq 2.9\; | X_0=1.5), p(X_1 > 2.9\; | X_0=1.5)$ to compute $E(f(\X) | \boldsymbol{X}_1 \in [2, \; 3.5], \boldsymbol{X}_{0} = 1.5 )$, but these probabilities are difficult to estimate in practice. However, we argue that we can ignore these splits, and thus do no need to fragment the query region using the leaves of the tree. Indeed, as we are no longer interest in a point estimate but regional (population mean) we do not need to go to the level of the leaves. We propose to ignore the splits of the leaves that divide the query region. For instance, the leaves 4 and 5 split the region $[2, \; 3.5]$ in two cells, by ignoring these splits we estimate the mean of the gray region by taking the average output of the leaves 4 and 5 instead of computing the mean weighted by the probabilities as in Eq. \ref{fig:weighted_mean}. Roughly, it consists to follow the classic rules of a decision tree (if the region is above or below a split) and ignore the splits that are in the query region, i.e., we average the output of all the leaves that are compatible with the condition $\boldsymbol{X}_1 \in [2, \; 3.5], \boldsymbol{X}_{0} = 1.5$. We think that it leads to a better approximation for two reasons. First, we observe that the case where t is in the region and thus divides the query region does not happen often. Moreover, the leaves of the trees are very small in practice, and taking the mean of the observations that fall in the union of leaves that belong to the query region is more reasonable than computing the weighted mean and thus trying to estimate the different probabilities $p(X_1 \leq 2.9\; | X_0=1.5), p(X_1 > 2.9\; | X_0=1.5)$. \section{Additional experiments} In table \ref{tab:add_exp}, we compare the \textit{Correctness} (Acc), \textit{Plausibility} (Psb), and \textit{Sparsity} (Sprs) of the different methods on additonal real-world datasets: FICO \citep{helocdata}, NHANESI \citep{nhanes}. We observe that the L-CR, and R-CR outperform the baseline methods by a large margin on \textit{Correctness} and \textit{Plausibility}. The baseline methods still struggle to change at the same time the positive and negative class. In addition, AReS and CET give better sparsity, but their counterfactual samples are less plausible than the ones generated by the CR. \begin{table}[ht!] \caption{Results of the \textit{Correctness} (Acc), \textit{Plausibility}, and \textit{Sparsity} (Sprs) of the different methods. We compute each metric according to the positive (Pos) and negative (Neg) class.} \label{tab:add_exp} \resizebox{\columnwidth}{!}{% \begin{tabular}{ccccccccccccc} \cline{2-13} & \multicolumn{6}{c}{\textbf{FICO}} & \multicolumn{6}{c}{\textbf{NHANESI}} \\ \cline{2-13} & \multicolumn{2}{c}{Acc} & \multicolumn{2}{c}{Psb} & \multicolumn{2}{c|}{Sps} & \multicolumn{2}{c}{Acc} & \multicolumn{2}{c}{Psb} & \multicolumn{2}{c}{Sps} \\ \cline{2-13} & Pos & Neg & Pos & Neg & Pos & \multicolumn{1}{c|}{Neg} & Pos & Neg & Pos & Neg & Pos & Neg \\ \textbf{L-CR} & 0.98 & 0.94 & 0.98 & 0.99 & 5 & \multicolumn{1}{c|}{5} & 0.99 & 0.98 & 0.98 & 0.97 & 5 & 6 \\ \textbf{R-CR} & 0.90 & 0.94 & 0.98 & 0.99 & 9 & \multicolumn{1}{c|}{8.43} & 0.86 & 0.95 & 0.96 & 0.99 & 7 & 7 \\ \textbf{AReS} & 0.34 & 0.01 & 0.85 & 0.86 & 2 & \multicolumn{1}{c|}{1} & 0.06 & 1 & 0.87 & 0.92 & 1 & 1 \\ \textbf{CET} & 0.76 & 0 & 0.76 & 0.60 & 2 & \multicolumn{1}{c|}{2} & 0 & 0.40 & 0.82 & 0.56 & 0 & 5 \end{tabular}% } \end{table} \section{Simulated annealing to generate counterfactual samples using the Counterfactual Rules} \begin{lstlisting}[language=Python, caption=The simulated annealing algorithm to generate samples that satisfy the condition CR] import numpy as np def generate_candidate(x, S, x_train, C_S, n_samples): """ Generate sample by sampling marginally between the features value of the training observations. Args: x (numpy.ndarray)): 1-D array, an observation S (list): contains the indices of the variables on which to condition x_train (numpy.ndarray)): 2-D array represent the training samples C_S (numpy.ndarray)): 3-D (#variables x 2 x 1) representing the hyper-rectangle on which to condition n_samples (int): number of samples Returns: The generated samples """ x_poss = [x_train[(C_S[i, 0] <= x_train[:, i]) * (x_train[:, i] <= C_S[i, 1]), i] for i in S] x_cand = np.repeat(x.reshape(1, -1), repeats=n_samples, axis=0) for i in range(len(S)): rdm_id = np.random.randint(low=0, high=x_poss[i].shape[0], size=n_samples) x_cand[:, S[i]] = x_poss[i][rdm_id] return x_cand def simulated_annealing(outlier_score, x, S, x_train, C_S, batch, max_iter, temp, max_iter_convergence): """ Generate sample X s.t. X_S \in C_S using simulated annealing and outlier score. Args: outlier_score (lambda functon): outlier_score(X) return a outlier score. If the value are negative, then the observation is an outlier. x (numpy.ndarray)): 1-D array, an observation S (list): contains the indices of the variables on which to condition x_train (numpy.ndarray)): 2-D array represent the training samples C_S (numpy.ndarray)): 3-D (#variables x 2 x 1) representing the hyper-rectangle on which to condition batch (int): number of sample by iteration max_iter (int): number of iteration of the algorithm temp (double): the temperature of the simulated annealing algorithm max_iter_convergence (double): minimun number of iteration to stop the algorithm if it find an in-distribution observation Returns: The generated sample, and its outlier score """ best = generate_candidate(x, S, x_train, C_S, n_samples=1) best_eval = outlier_score(best)[0] curr, curr_eval = best, best_eval it = 0 for i in range(max_iter): x_cand = generate_candidate(curr, S, x_train, C_S, batch) score_candidates = outlier_score(x_cand) candidate_eval = np.max(score_candidates) candidate = x_cand[np.argmax(score_candidates)] if candidate_eval > best_eval: best, best_eval = candidate, candidate_eval it = 0 else: it += 1 # check convergence if best_eval > 0 and it > max_iter_convergence: break diff = candidate_eval - curr_eval t = temp / np.log(float(i + 1)) metropolis = np.exp(-diff / t) if diff > 0 or rand() < metropolis: curr, curr_eval = candidate, candidate_eval return best, best_eval \end{lstlisting} \section{Parameters detailed} In this section, we give the different parameters of each method. For all methods and datasets, we first used a greedy search given a set of parameters. For AReS, we use the following set of parameters: \begin{itemize} \item max rule = $\{4, 6, 8\}$, max rule length $=\{4, 8 \}$, max change num $= \{2, 4, 6\}$, \item minimal support $= 0.05$, discretization bins = $\{ 10, 20\}$, \item $\lambda_{acc} = \lambda_{cov} = \lambda_{cst} = 1$. \end{itemize} For CET, we search in the following set of parameters: \begin{itemize} \item max iterations $ = \{500, 1000\}$, \item max leaf size $= \{ 4, 6, 8, -1\}$, \item $\lambda = 0.01, \gamma = 1 $. \end{itemize} Finally, for the Counterfactual Rules, we used the following parameters: \begin{itemize} \item nb estimators = $\{20, 50 \}$, max depth= $\{8, 10, 12\}$, \item $\pi=0.9$, $\pi_C=0.9$. \end{itemize} We obtained the same optimal parameters for all datasets: \begin{itemize} \item AReS: max rule $= 4$, max rule length$= 4$, max change num $= 4$, minimal support $= 0.05$, discretization bins = $10$, $\lambda_{acc} = \lambda_{cov} = \lambda_{cst} = 1$ \item CET: max iterations $= 1000$, max leaf size $=-1$, $\lambda = 0.01, \gamma = 1 $ \item CR: nb estimators$= 20$, max depth$=10$, $\pi=0.9$, $\pi_C=0.9$ \end{itemize} The code and the results can be found at \url{https://github.com/anoxai/counterfactual_rules}. \newpage
{'timestamp': '2022-09-30T02:08:02', 'yymm': '2209', 'arxiv_id': '2209.14568', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14568'}
arxiv
\section{Introduction} \label{intro} Abstract Meaning Representation (AMR) \cite{ban-AMR} parsing targets to transform a sentence into a directed acyclic graph, which represents the relations among different concepts. The original AMR does not provide concept-to-word alignment information, which hinders the trace-back from concept to input word and brings difficulties to AMR parsing. To solve the problem, based on Chinese AMR \cite{li-etal-2016-annotating} , \newcite{Li_Wen_Song_Qu_Xue_2019} further propose to add concept and relation alignment to the structure of Chinese AMR as shown in Figure~\ref{fig:camr}. Currently, while a majority of work is focusing on improving the performance of English AMR Parsing \cite{xu-seqpretrain,bevil-spring,HCL,bai-etal-2022-graph,chen-etal-2022-atp,drozdov-etal-2022-inducing}, those methods or models can not be directly applied to Chinese AMR Parsing since English AMR does not provide alignment information itself. To better reflect the full structure of Chinese AMR, CAMRP-2022 evaluation\footnote{https://github.com/GoThereGit/Chinese-AMR} firstly requires the AMR parser to generate explicit word alignment including concept and relation alignment which calls for novel models and algorithms. \begin{figure}[h] \centering \includegraphics[width=0.7\linewidth]{pic/camrp.pdf} \caption{An example of Chinese AMR. Red word-IDs under concepts denote concept alignment. Red words and word-IDs under relation denote relation alignment. } \label{fig:camr} \end{figure} We propose a two-stage method to conduct Chinese AMR Parsing with alignment generation\footnote{We participate in the closed-track evaluation where we can only use HIT-roberta\cite{cui-etal-2020-revisiting} as the pretrained language model}. In a nutshell, the method includes the Concept-Prediction and Relation-Prediction stages, which can be regarded as the process of graph formation. In the Concept-Prediction stage, we develop a hierarchical sequence tagging framework to deal with the concept generation and the complex multi-type concept alignment problem. In the Relation-Prediction stage, we utilize the biaffine network to predict relations and Relation-alignment simultaneously among predicted concepts. Our model ranks 2nd in the closed-track of the evaluation, achieving 0.7756 and 0.7074 Align-Smatch \cite{alignsmatch} F1 scores on the CAMR 2.0 test set and the blind-test set of CAMRP-2022 individually. \section{Method} Our methods includes the Concept-Prediction stage and Relation-Prediction stage. As illustrated in Figure~\ref{fig:piplines}, during training, both stages have individual input and output. During inference, the output concepts from the Concept-Prediction stage are passed to the Concept-Prediction stage to generate the full AMR graph. \begin{figure}[h] \centering \includegraphics[width=1\linewidth]{pic/pipeline2.pdf} \caption{Pipeline for the two-stage method. In the training phase, the relation prediction stage takes the concepts from the gold AMR graph as input. During the inference phase, the relation prediction stage takes the output of the concept predictor as input.} \label{fig:piplines} \end{figure} \subsection{Concept-Prediction} Different from English AMR where nodes or concepts can have arbitrary variable names, a large portion of concepts of Chinese AMR have standard variable names which denote the alignment to input words. Moreover, there are different alignment patterns which make generating the right alignment a complex problem. In following sections, we'll sequentially introduce the alignment rules we design for CAMRP-2022, the two-stage method and the model. \subsubsection{Multi-Type Concept Alignment Rule} We mainly design 6 different alignment rules for concepts according to different alignment patterns, which are \textbf{\textit{Direct Alignment}}, \textbf{\textit{Normalization Alignment}}, \textbf{\textit{Continuous Multi-word Alignment}}, \textbf{\textit{Discontinuous Multi-word Alignment}}, \textbf{\textit{Split Alignment}} and \textbf{\textit{Null-Aligned Concepts}}. The difference among alignment rules lies in how an abstract concept corresponds to the input words. We list three cases involving different rules as shown in Figure~\ref{fig:concept_align} as examples. \begin{enumerate} \item \textbf{Direct Alignment} is the easiest alignment where a concept directly corresponds to a certain word in the input without the need for any modification. \item \textbf{Normalization Alignment} exists when a concept still corresponds to one word in the input however needs to be ``normalized'' into the final concept. The normalization includes different situations like word sense disambiguation for predicate and Arabic numerals transformation for numerals in other languages. For example, as shown in Figure~\ref{fig:concept_align}, in case (a) the word ``\begin{CJK*}{UTF8}{gbsn}称为\end{CJK*}'' corresponds to the concept ``\begin{CJK*}{UTF8}{gbsn}称为-01\end{CJK*}'' after word sense disambiguation. In case (c), Chinese numeral ``\begin{CJK*}{UTF8}{gbsn}一\end{CJK*}'' would be mapped to concept ``1'' since all numeral concepts in CAMR are Arabic. \item \textbf{Continuous Multi-word Alignment} exists when multiple continued words in the input sentence are concatenated into the final concept, which usually happens for named entities. \item \textbf{Discontinuous Multi-word Alignment} means multiple discontinued words in the input sentence are joined into the final concept or preposition patterns like ``\begin{CJK*}{UTF8}{gbsn}在...上\end{CJK*}'' . \item \textbf{Split Alignment} denotes one word that could correspond to multiple concepts, which usually suggests the word corresponds to a sub-graph in the final AMR graph. \item \textbf{Null-Aligned Concepts} do not have alignment and could have arbitrary variable names. These concepts usually abstract away from syntactic features and do not directly correspond to certain word in the input sentence, making them harder for the model to predict. In fact, according to our experiment, our system could reach a 0.91 f1 score for aligned concepts' prediction but only a 0.70 f1 score for Null-Aligned concepts' prediction. \end{enumerate} \begin{figure}[t] \centering \includegraphics[width=1\linewidth]{pic/aligment_cases0928.pdf} \caption{Example of different Concept Alignment cases. Gold concepts denote all concepts in the gold AMR graph of the input sentence. The concepts can be divided into different categories according to the alignment rules. We use words in color to represent the unique alignments in each example.} \label{fig:concept_align} \end{figure} \begin{figure}[b] \centering \includegraphics[width=1\linewidth]{pic/pies0928.pdf} \caption{Statistics about the alignment between concepts and input words in CAMR 2.0.} \label{fig:concept_align_pie} \end{figure} As shown in Figure \ref{fig:concept_align_pie}, we further collect more statistics about the alignment between concepts and input words with the training set of the CAMR 2.0 dataset. From the perspective of input sentences, about 75\% of words in the input sentences are associated with certain concepts under one alignment rule. From the perspective of concepts, there are 83\% of concepts with alignment. For all concepts with alignment, a majority of them belongs to Direct(56\%) and Normalization(33\%) Alignments. \subsubsection{Sequence Tagging Framework} \begin{figure}[t] \centering \includegraphics[width=1\linewidth]{pic/TWO_MODELS.pdf} \caption{The Two-Stage Parsing Model. We use the same Concept Tagging model structure to conduct three hierarchical sequence tagging tasks, each with a different Tag Classifier. Relation Classification takes concepts as input and the Biaffine Classifier outputs the relation between every two concepts. In both models, words or concepts are first splitted into characters before feeding into the pretrained language model and we use the hidden state of the first character to represent the word in the last classifier layers. } \label{fig:models} \end{figure} In spite of the complex word alignment rules, we can see that a large portion of concepts are directly or indirectly aligned with a single word of input and one word can only correspond to one concept at most, which inspires us to adopt sequence tagging method. It can deal with concept prediction and Direct Alignment prediction simultaneously. Considering different alignment rules, we develop three sequence tagging rules to cover all possible situations. \paragraph{Model Structure} As depicted in Figure~\ref{fig:models}, we add a linear layer on the top of the Chinese RoBERTa model as a Tag Classifier. Adapting to character-based Chinese pretrained language model, Tag classification is conducted \textbf{on the first character's hidden state} for a word with multiple characters. During training, we use Cross-Entropy as the loss function and use the average loss of $N$ all tags in a sentence as the final loss, as described in Equation~\ref{eq:tagging}, \begin{equation} \begin{aligned} \text{TagCLS}(\mathbf{a}) & = [\mathbf{a};\mathbf{1}]\mathbf{W}, (\mathbf{a} \in \mathbb{R}^{1 \times d}, \mathbf{W} \in \mathbb{R}^{(d+1)\times c} ) \\ \text{Loss}&=\frac{1}{N}\sum_{i=1}^N CE(\text{TagCLS}(\mathbf{h_i}) ,\hat{\mathbf{h_i}}) \end{aligned} \label{eq:tagging} \end{equation} where $d$ denotes the hidden size, $c$ denotes the number of different tags, $N$ denotes the number of input words, $\mathbf{h_i}$ denotes the $i^{th}$ word's output hidden state from the encoder and $\hat{\mathbf{h_i}}$ denotes the one-hot vector of its gold tag. \paragraph{Surface Tagging} We design an 8-classes BIO tagging rule as the first step to process the input sentence. The eight classes are O, B-Single, B-Continuous-Multiword, I-Continuous-Multiword, B-Discontinuous-Multiword, I-Discontinuous-Multiword, B-Split, and B-Virtual. This tagging rule can cover 4 out of 6 alignment rules, which are Direct Alignment, Continuous Multi-word Alignment, Discontinuous Multi-word Alignment, and Split Alignment. Note that the B-Single tag is for both Direct Alignment and Normalization Alignment because they both correspond to one input word. As for B-Split, we use manually curated rules to split the word with Split Alignment. Note that B-Virtual is also added to label the virtual word for the later relation classification task. The F1-score of the Surface Tagging step can reach 91\% on the development set in our experiment. \paragraph{Normalization Alignment Tagging} Previous Surface Tagging can not recognize words that need normalization like word sense disambiguation so we introduce a 2-class Tagging rule to identify whether a word from the input sentence needs normalization before becoming a concept in the AMR graph. The labels can be collected directly from the gold AMR graph. If one concept is aligned to one identical word from the input sentence, then the word's label is negative. If the concept is aligned to a word different from itself, then the word's label is positive. The F1-score of Normalization Alignment Tagging can reach 0.95\% on the development set. After recognizing words needing normalization, we run a statistical normalization method as described in Appendix A. This step can cover and predict the Normalization Alignment. \paragraph{Null-Aligned Concept Tagging} For concepts that do not have alignment with input words, we define trigger words for those concepts and also use sequence tagging method. To be more specific, we first collect the dictionary of all Null-Aligned concepts in the training set and there are 184 different Null-Aligned concepts in total. The label of the input word is the class of Null-Aligned concept it triggers, or ``None'' if it triggers nothing. For Null-Aligned concept, we define the concepts that it has a direct relation to as its trigger concepts and the aligned word of the trigger concept as the trigger word. For example, as shown in Figure~\ref{fig:camr}, the Null-Aligned concept ``Event'' has direct relation to concept ``\begin{CJK*}{UTF8}{gbsn}钱塘江大潮\end{CJK*}''. According to the alignment information of the concept, the trigger words of the concept ``Event'' are x1 and x2. Since a Null-Aligned concept could have multiple concepts it has a direct relation to, we tried using the first or the last of the concepts. The experimental result shows that using the last concept is more effective with a 0.03 F1 improvement. There are nearly 5\% cases where the trigger concepts are all Null-Aligned concepts. Under such circumstances, we keep tracing back from the trigger concept until we reach the first concept with alignment and we regard this concept as the trigger concept. \subsection{Relation-Prediction} As shown in Figure~\ref{fig:models}, we design a RoBERTa-BiLSTM-Biaffine network to conduct relation prediction given the predicted concepts. All concepts are first split into characters before feeding into the RoBERTa model to extract hidden representations. After the RoBERTa model, all hidden states are fed into a one-layer BiLSTM network to better encode sequential information to the hidden states. At last, the \textbf{first hidden states of every two concepts} are fed into the biaffine network to get the relation between the two concepts. During training, we use Cross-Entropy as the loss function and use the average loss of $N\times N$ relations as the final loss, as described in Equation~\ref{eq:biaffine}, \begin{equation} \begin{aligned} \text{Biaffine}(\mathbf{a},\mathbf{b}) & = [\mathbf{a};\mathbf{1}]\mathbf{W}[\mathbf{b};\mathbf{1}]^T, (\mathbf{a} \in \mathbb{R}^{1 \times d}, \mathbf{b} \in \mathbb{R}^{1 \times d}, \mathbf{W} \in \mathbb{R}^{(d+1)\times c \times(d+1)}) \\ \text{Loss}&=\frac{1}{N^2}\sum_{i=1}^N \sum_{j=1}^N CE(\text{Biaffine}(\mathbf{h_i},\mathbf{h_j}), \hat{r}(\mathbf{h_i},\mathbf{h_j}))\\ \text{Relation}_{a,b} & = \arg \max \text{Biaffine}(\mathbf{a},\mathbf{b}) \end{aligned} \label{eq:biaffine} \end{equation} where $d$ denotes the hidden size, $c$ denotes the number of relations, $N$ denotes the number of input concepts, $\hat{r}$ denotes the one-hot vector for the gold relation and $\mathbf{h_i}$ denotes the $i^{th}$ output hidden state from the BiLSTM network. \paragraph{Relation-Alignment Prediction} On top of relation between concepts, another important feature of Chinese AMR is the relation alignment, which takes Chinese functional words' semantics into consideration in AMR graph. For example, as shown in Figure~\ref{fig:camr}, functional word ``\begin{CJK*}{UTF8}{gbsn}被\end{CJK*}'' is aligned to the ``arg1'' relation between concepts ``\begin{CJK*}{UTF8}{gbsn}称为-01\end{CJK*}'' and ``Event''. In fact, in the input Chinese sentence, the word ``\begin{CJK*}{UTF8}{gbsn}被\end{CJK*}'' is the marker of relation ``arg1'' between concept ``\begin{CJK*}{UTF8}{gbsn}钱塘江大潮\end{CJK*}'' and ``\begin{CJK*}{UTF8}{gbsn}称为-01\end{CJK*}''. We use the same model as relation prediction to align functional words with relations. To be more specific, concepts and functional words are both fed into the RoBERTa-BiLSTM-Biaffine network. As depicted in Figure~\ref{fig:relaton_example}, for any relation triples(concept1, concept2, relation), if the relation is aligned with functional word $w$, we create another triple(concept1, $w$, relation) for the model to predict. In this way, we can predict the relation and relation alignment simultaneously. After predicting all relations, if one concept is linked with one concept and one functional word with the same relation, the functional word will be aligned to the relation. \begin{figure}[t] \centering \includegraphics[width=0.8\linewidth]{pic/relation_table.pdf} \caption{An example of Relation Classification label matrix. The inputs are from the gold concepts of sentence ``\begin{CJK*}{UTF8}{gbsn}钱塘江大潮被称为天下奇观\end{CJK*}''. Each column denotes the start node of a relation while each row denotes end node of a relation. ``O'' denotes there is no relation between the two nodes. Relation in red denotes the relation alignment for functional words.} \label{fig:relaton_example} \end{figure} \subsection{Teacher Forcing in Training} Since our method has two stages, during inference the Relation-Prediction model takes the output of Concept-Prediction as input. To stabilize and prevent error propagation during training, we adopt the Teacher Forcing method, where we use the gold concepts and relations as the input of the relation prediction model. However, error propagation still exists in the inference phase. We will discuss the error propagation situation of our system in section~\ref{sec:error_p}. \section{Experiment} \begin{table}[t] \centering \resizebox{0.4\textwidth}{!}{ \begin{tabular}{lcc} \toprule Dataset Split & Sentences & Tokens \\ \midrule Train & 16576 & 386234\\ Development & 1789 & 41822\\ Test & 1713 & 39228 \\ Blind Test & 1999 & 36940 \\ \bottomrule \end{tabular}} \caption{The dataset description of CAMRP-2022. Note that the train, development and test splits are directly from CAMR 2.0 dataset while the blind test split is from this evaluation.} \label{tab:dataset} \end{table} \subsection{Dataset} \label{sec:dataset} The CAMRP-2022 evaluation uses the training, development, and test splits of the CAMR 2.0 dataset as its dataset and also involves an out-of-domain blind test set to measure the generalization performance of parsers. The statistics of the dataset are shown in Table~\ref{tab:dataset}. For concepts, there are 31941 different concepts in the training set. Among all concepts, there are 8443 different predicates that need to conduct word sense disambiguation and 184 Null-Aligned concepts. As for relations, there are 142 different relations and 841 relation alignment words. The top 5 most frequent relation alignment words are ``\begin{CJK*}{UTF8}{gbsn}的\end{CJK*}'',``\begin{CJK*}{UTF8}{gbsn}是\end{CJK*}'',``\begin{CJK*}{UTF8}{gbsn}和\end{CJK*}'',``\begin{CJK*}{UTF8}{gbsn}在\end{CJK*}'' and ``\begin{CJK*}{UTF8}{gbsn}对\end{CJK*}''. \subsection{Model} Both the Concept Tagging and Relation Classification model adopt the HIT-roberta-large\cite{cui-etal-2020-revisiting} pretrained model downloaded from HuggingFace model hub\footnote{https://huggingface.co/hfl/chinese-roberta-wwm-ext-large}. For Concept Tagging models, the output size of the tag classifier is 8, 2, 185 for Surface Tagging, Normalization Alignment Tagging, and Null-Aligned Concept Tagging individually and the dropout rate of the classifiers is 0.1 in all experiments. For the Relation Classification model, there is one BiLSTM layer and the hidden size is 4096. the dimension of Biaffine matrix is $4097\times142\times4097$. \subsection{Training Details} We use Adam as the optimizer and conduct hyper-parameter searches on batch-size (from 10 to 100) and learning rate (from 1e-5 to 1e-4 ) in all models. The optimal hyper-parameters for each model are listed in Appendix B. We train all models for 100 epochs with 1\% warmup steps and select the one with the best result on the development set as the final model. \subsection{Results} \label{sec:result} \begin{table}[t] \centering \resizebox{0.7\textwidth}{!}{ \begin{tabular}{lccc} \toprule Task(Dev) & Precision & Recall & F1 \\ \midrule Surface Tagging & 0.918 & 0.944 & 0.931 \\ Normalization Aligment Tagging & 0.878 & 0.878 & 0.878 \\ Null-Aligned Concept Tagging & 0.708 & 0.679 & 0.693 \\ Relation Classification (With Gold Concepts) & 0.751 & 0.737 & 0.744 \\ \midrule AlignSmatch & 0.778 & 0.766 & 0.768\\ \quad - Only Instance &0.830 & 0.833 &0.832\\ \quad - Only Attribute &0.928&0.954&0.941\\ \quad - Only Relation &0.614&0.556&0.583\\ \bottomrule \\ \toprule Task(Test) & Precision & Recall & F1 \\ \midrule AlignSmatch & 0.786 &0.765 &0.776 \\ \quad - Only Instance & 0.834 & 0.840 & 0.837\\ \quad - Only Attribute& 0.932 & 0.959 & 0.945\\ \quad - Only Relation & 0.628 & 0.570 & 0.598\\ \bottomrule \\ \toprule Task(Blind Test) & Precision & Recall & F1 \\ \midrule AlignSmatch& 0.715 & 0.696& 0.705\\ \quad - Only Instance & 0.768 & 0.775 & 0.772\\ \quad - Only Attribute & 0.866 & 0.901 & 0.883\\ \quad - Only Relation & 0.549 & 0.492 & 0.519\\ \bottomrule \end{tabular}} \caption{The fine-grained results of our model in CAMRP-2022. We report the overall and fine-grained AlignSmatch scores of our model on the development, test and blind test sets. We also report the results of each sub-task in the two-stage method on the development set.} \label{tab:result} \end{table} As shown in Table~\ref{tab:result}, we list the results of our trained 2-stage AMR Parser on the development, test, and blind-test set of CAMRP-2022. For the development set, we list the concrete results of all different sub-tasks in two stages along with the overall and fine-grained AlignSmatch scores. \paragraph{Sub-task Results} For the three sub-tasks of the Concept-Prediction stage, we can tell from Table~\ref{tab:result} that our model performs better in the Surface Tagging task with a 0.931 F1 score and Normalization Alignment Tagging task (0.878 F1) than in Null-Aligned Concept Tagging task (0.693 F1). It suggests that the model can better recognize concepts with alignment and there is a big performance drop when predicting concepts without alignment under the same sequence tagging framework. For the Relation Classification task, our model can reach 0.744 F1 when given gold concepts while only 0.583 F1 in inference when the concepts are generated by the Concept-Prediction stage instead of gold concepts. It reveals a train-inference discrepancy existing in the current method since the model might generate wrong concepts during the Concept Prediction stage in inference which would bias the Relation Prediction stage. \paragraph{AlignSmatch Results} As for the overall AlignSmatch scores, we can tell from the result of Development, Test and Blind-Test evaluations that there exists a domain shift. When looking at the fine-grained scores, the trend is consistent among three evaluation dataset that the performance of attribute or alignment prediction is better than instance prediction and far better than relation prediction. The trend indicates that the model generally outperforms in the first stage than in the second stage. Moreover, for relation prediction, we can see that the recall is about 5 points lower than the precision in all experiments and the gap is much bigger than instance or attribute prediction. The reason is that in the relation classification model there exists a performance gap in relation prediction and relation alignment prediction. Compared to relation prediction, a lot more relation alignments are not predicted while the relation-only score in AlignSmatch takes both relation and relation alignment into account, which makes the recall score lower. In fact, if we preclude relation alignment prediction in the relation-only score, the gap between precision and recall will be reduced to 2 points. It hints to us that we need to pay more attention to the relation alignment prediction to improve the overall performance. \section{Discussion} In this section, we summarize some problems that need to be addressed to improve the performance of the Chinese AMR parser. \subsection{Error Propagation in the Two-Stage Model} \label{sec:error_p} As pointed out in Section~\ref{sec:result}, there exists error propagation in the two-stage model. The direct evidence is that while the relation prediction could reach 0.744 F1 with gold concepts, this score drops to 0.583 when giving it the model predicted concepts. Error propagation also exists in the Concept-Prediction stage since Normalization Alignment needs both the correct result from Surface Tagging and Normalization Alignment Tagging. \subsection{Class Imbalance Problem} As pointed out in section~\ref{sec:dataset}, there exist severe class imbalance problems in both stages of the parsing task. As for the Concept-Prediction stage, the problem reflects the great differences in the distribution of different tags in the three tagging tasks, especially for the Null-Aligned Concept Tagging tasks. For the Relation-Prediction stage, a large portion of labels is ``None Relation'' as shown in Figure~\ref{fig:relaton_example}. We have tried some techniques like using weighted loss that assigns greater weight to the minority classes to handle the class imbalance problem. While this can greatly reduce the time required for the model to converge, it does not improve the final performance when all epochs are finished. \subsection{Improving the Null-Aligned Concept Prediction Performance} In our model, we use a trigger-based method to predict concepts without alignment. This method could cover nearly 95\% cases while the rest 5\% is neglected because they are mostly triggered by another Null-Aligned concept. Though we design methods to overcome the drawback by tracing back to the first aligned concept, the overall result of Null-Aligned Concept Prediction is still the lowest in the Concept-Prediction stage, which could lead to great bias for the next stage. A more natural method to predict those concepts might greatly improve this task. \section{Conclusion} In this paper, we provide a detailed description of the proposed two-stage Chinese AMR Parsing model which is the first to deal with the explicit word alignment problem for CAMRP-2022 evaluation. We also analyze the result and point out the limitation of the current method and some potential roads that might lead to improvement. Though straightforward, the method is far from perfect that it still calls for future exploration to reach a better result in the Chinese AMR Parsing task.
{'timestamp': '2022-09-30T02:06:30', 'yymm': '2209', 'arxiv_id': '2209.14512', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14512'}
arxiv
\subsection{Adversarial Graph Signal Denoising Problem} Note that the second term in the GSD problem (Eq.~(\ref{graph signal denoising})) which controls the smoothness of the feature matrix over graphs, is related to both the graph Laplacian and the node features. Therefore, the slight changes in the graph Laplacian matrix could lead to an unstable denoising effect. Inspired by the recent studies in adversarial training~\citep{madry2018towards}, we formulate the adversarial graph signal denoising problem as a min-max optimization problem: \begin{equation} \label{adv gsd} \min_{\mathbf{F}} \left[\left\|\mathbf{F}-\mathbf{X}\right\|_{F}^{2}+\lambda \cdot \max_{\mathbf{L}^{\prime}} \ \operatorname{tr}\left(\mathbf{F}^{\top} \mathbf{L}^{\prime} \mathbf{F}\right)\right] \quad \operatorname{s.t.} \quad \left\|\mathbf{L}^{\prime}-\widetilde{\mathbf{L}}\right\|_{F} \leq \varepsilon. \end{equation} Intuitively, the inner maximization on the Laplacian $\mathbf{L}'$ generates perturbations on the graph structure\footnote{Here we do not need exact graph structure perturbations as in graph adversarial attacks~\citep{zugner2018adversarial,zugner2019adversarial} but a virtual perturbation that could lead to small changes in the Laplacian.}, and enlarges the distance between the node representations of connected neighbors. Such maximization finds the worst case perturbations on the graph Laplacian that hinders the global smoothness of $\mathbf{F}$ over the graph. Therefore, by training on those worse case Laplacian perturbations, one could obtain a robust graph signal denoising solution. Ideally, through solving Eq.~(\ref{adv gsd}), the smoothness of the node representations as well as the implicit denoising effect can be enhanced. \subsection{Minimization of the Optimization Problem} \label{Minimization of the Optimization Problem} The min-max formulation in Eq.~(\ref{adv gsd}) also makes the adversarial graph signal denoising problem much harder to solve. Fortunately, unlike adversarial training~\citep{madry2017towards} where we need to first adopt PGD to solve the inner maximization problem before we solve the outer minimization problem, here inner maximization problem is simple and has a closed form solution. In other words, we do not need to add random perturbations on the graph structure at each training epoch and can find the largest perturbation which maximizes the inner adversarial loss function. Denote the perturbation as $\bm{\delta}$, and $\mathbf{L}'=\widetilde{\mathbf{L}} + \bm{\delta}$. Directly solving\footnote{More details on how to solve the inner maximization problem can be found in Appendix~\ref{appendix:how to solve the optimization problem}.} the inner maximization problem, we get $\bm{\delta}=\varepsilon\nabla h(\bm{\delta})=\frac{\varepsilon\mathbf{F}\mathbf{F}^{\top}}{\left\|\mathbf{F}\mathbf{F}^{\top}\right\|_{F}}$. Plugging this solution into Eq.~(\ref{adv gsd}), we can rewrite the outer optimization problem as follows: \begin{equation} \rho(\mathbf{F})=\min_{\mathbf{F}} \left[\left\|\mathbf{F}-\mathbf{X}\right\|_{F}^{2}+\lambda \max \operatorname{tr}\left(\mathbf{F}^{\top} \widetilde{\mathbf{L}} \mathbf{F}\right)+\lambda\varepsilon\operatorname{tr}\frac{\mathbf{F}^{\top}\mathbf{F}\mathbf{F}^{\top}\mathbf{F}}{\left\|\mathbf{F}\mathbf{F}^{\top}\right\|_{F}}\right]. \end{equation} Taking the gradient of $\rho(\mathbf{F})$ to zero, we get the solution of the outer optimization problem as follows: \begin{equation}\label{eq:advF} \mathbf{F} = \left(\mathbf{I}+\lambda\widetilde{\mathbf{L}}+\lambda\varepsilon\frac{\mathbf{F}\mathbf{F}^{\top}}{\left\|\mathbf{F}\mathbf{F}^{\top}\right\|_{F}}\right)^{-1}\mathbf{X}. \end{equation} Both sides of Eq.~(\ref{eq:advF}) contains $\mathbf{F}$, directly computing the solution is difficult. Note that in Eq.~(\ref{adv gsd}) we also require $\mathbf{F}$ to be close to $\mathbf{X}$, we can approximate Eq.~(\ref{eq:advF}) by replacing the $\mathbf{F}$ with $\mathbf{X}$ in the inverse matrix on the right hand side. With the Neumann series expansion of the inverse matrix, we get the final approximate solution as \begin{equation} \label{RNGC filter} \mathbf{H} \approx \frac{1}{\lambda+1}\sum_{s=0}^{S}\left[\frac{\lambda}{\lambda+1}\left(\widetilde{\bm{\mathcal{A}}}-\frac{\varepsilon\mathbf{X}\mathbf{X}^{\top}}{\left\|\mathbf{X}\mathbf{X}^{\top}\right\|_{F}}\right)\right]^{s}\mathbf{X}\mathbf{W}. \end{equation} The difference between Eq.~(\ref{RNGC filter}) and Eq.~(\ref{NGC filter}) is that there is one more term in Eq.~(\ref{RNGC filter}) derived from solving the inner optimization problem of Eq.~(\ref{adv gsd}). Based on this, we proposed our robust Neumann graph convolution (RNGC). \paragraph{Scalability.}{Although RNGC introduces extra computational burdens for large graphs due to the $\mathbf{X} \mathbf{X}^{\top}$ term, if the feature matrix is sparse, the extra computational effort is minimal as the $\mathbf{X} \mathbf{X}^{\top}$ term can also be sparse. For the scalability of RNGC on large graphs with dense feature matrix, we only compute the inner product of feature vectors ($\mathbf{X}_i, \mathbf{X}_{j|j\in\mathcal{N}_{i}}$) between adjacent neighbors like masked attention in GAT. Compared with \name, the additional computation cost is $\mathcal{O}(|\mathcal{E}|)$.} \subsection{Denoising Effectiveness Comparison of Various GNN Models} In this section, we compare the denoising effectiveness of different GNN models through their test accuracy by training on the noisy feature matrix with Gaussian noise. \paragraph{Datasets.} In our experiments, we utilize three public citation network datasets Cora, Citeseer, and Pubmed~\citep{sen2008collective} which are homophily graphs for semi-supervised node classification. For the semi-supervised learning experimental setup, we follow the standard fixed splits employed in~\citep{yang2016revisiting}, with 20 nodes per class for training, 500 nodes for validation, and 1,000 nodes for testing. We also use four datasets: Cornell, Texas, Wisconsin, and Actor which are heterophily graphs for full-supervised node classification. For each dataset, we randomly split nodes into 60\%, 20\%, and 20\% for training, validation, and testing as suggested in \citep{pei2020geom}. Moreover, we utilize three large-scale graph datasets: Coauthor-CS, Coauthor-Phy~\citep{shchur2018pitfalls}, and ogbn-products~\citep{hu2020open} for evaluation. For Coauthor datasets, we split nodes into 60\%, 20\%, and 20\% for training, validation, and testing. For ogbn-products dataset, we follow the dataset split in OGB~\citep{hu2020open}. \paragraph{Baselines.} For the baselines, we consider graph neural networks derived from graph signal denoising, including GLP~\citep{li2019label}, S$^2$GC~\citep{zhu2021simple}, and IRLS~\citep{yang2021graph}; popular GNN architectures, such as GCN~\citep{kipf2017semi} and GAT~\citep{velivckovic2018graph}; and MLP which has no aggregation operation. \paragraph{Experimental Setup and Implementations.} We assume that the original feature matrix is clean and do not have noise and we synthesize the noise from the standard Gaussian distribution and add them on the original feature matrix. By default, we apply row normalization for data after adding the Gaussian noise\footnote{We also perform an analysis on the effect of row normalization in noisy feature matrix in Appendix~\ref{appendix:row norm}.}, and train all the models based on these noisy feature matrix. For the hyper-parameters of each model, we follow the setting that reported in their original papers. To eliminate the effect of randomness, we repeat such experiment for 100 or 10 times and report the mean accuracy. Note that in each repeated run, we add different Gaussian noises. While for the same run, we apply the same noisy feature matrix for training all the models. For our \name and R\name model, the hyper-parameter details can be found in Appendix~\ref{appendix:hyperparameter}. \input{heterophily_results} \input{large-scale_results} \paragraph{Results on Supervised Node Classification.} Figure~\ref{fig:noise} illustrates the comparison of classification accuracy against the various noise levels for semi-supervised node classification tasks. The noise level $\xi$ controls the magnitude of the Gaussian noise we add to the feature matrix: $\mathbf{X}+\xi\bm{\eta}$ where $\bm{\eta}$ is sampled from standard i.i.d., Gaussian distribution. For Cora and Citeseer, we test $\xi \in \{0.1, 0.2, 0.3, 0.4, 0.5\}$ and for Pubmed, we test $\xi \in \{0.01, 0.02, 0.03, 0.04, 0.05\}$. From Figure~\ref{fig:noise}, we can observe that the test accuracy of MLP is close to randomly guessing (RG) when the noise level is relatively large. This implies the weak denoising effect of MLP models. For shallow GNN models, such as GCN and GAT (which usually contain 2 layers), their denoising performance is limited especially on Pubmed since they do not aggregate information (features and noise) from higher-order neighbors. For models with deep layers{\footnote{We also perform an analysis on the denoising effect of depth in \name and R\name in Appendix~\ref{appendix:depth analysis}.}}, such as IRLS ($\geq 8$ layers), the denoising performance is much better compared to shallow models. Lastly, our \name and R\name model with 16 layers ($S=16$) achieve significantly better denoising performance compared with other baseline methods, which backup our theoretical analyses. In most cases, \name and R\name achieve very similar denoising performance but in general, R\name still slightly outperforms \name, suggesting that we indeed gain more benefits by solving the adversarial graph denoising problem. {Table~\ref{tab:heterophily} reports the comparison of classification accuracy against the various noise levels for full-supervised node classification tasks on heterophily graphs. The first- and second-highest accuracies are highlighted in bold. For these datasets, we test $\xi \in \{0.01, 1\}$. From Table~\ref{tab:heterophily}, we can observe that MLP is better than most GNN models in most cases due to the heterophily properties of these graphs. However, our proposed R\name achieves significantly better or matches denoising performance compared with other baseline methods, which demonstrates the superiority of our R\name.} {For ogbn-products, we only choose MLP, GCN, and S$^2$GC as baselines, since the results are sensitive concerning model size and various tricks from the OGB leaderboard. For fair comparison, the size of parameters for these baselines and R\name is the same. We also use full-batch training for the baselines and our model. Table~\ref{tab:coauthor} and \ref{tab:ogb} report the comparison of classification accuracy against the various noise levels for full-supervised node classification tasks on large-scale graphs. The first- and second-highest accuracies are highlighted in bold. For these datasets, we test $\xi \in \{0.1, 1\}$. Compared with the above small datasets, the node degree on these three datasets is larger, which means they have better connectivity. From Table~\ref{tab:coauthor} and \ref{tab:ogb}, we can observe that the test accuracy of MLP is far lower than GCN and R\name. This implies the weak denoising effect of MLP. The test accuracy of GCN is slightly smaller than R\name on these datasets since they are well-connected and have a large graph size and we can achieve a good denoising performance with shallow-layer GNN models. For the scalability of R\name on large graphs such as ogbn-products, we use the acceleration method mentioned in Sec.~\ref{Minimization of the Optimization Problem}.} \input{flip_defense_results} \subsection{Denoising Performance on Feature Flipping Perturbation} In this section, we compare the denoising effectiveness of different models through their test accuracy by training on the noisy feature matrix which is perturbated through flipping the individual feature with a small Bernoulli probability on three citation datasets. \paragraph{Setting and Results.} We flip the individual feature on three citation datasets: Cora, Citeseer, and Pubmed as the noise. And we compare the denoising performance of R\name with MLP and GCN. From Table~\ref{tab:flip}, we can observe that the denoising performance of R\name is much better than baselines when the flip probability is 0.4. In fact, the added perturbations by flipping the individual feature approximately follow a Bernoulli distribution, which is also a Sub-Gaussian distribution. The results verify our theoretical analysis further. \subsection{Defense Performance of R\name against Graph Structure Attack} Although we do not perform actual graph structure perturbations as in graph adversarial attacks~\citep{zugner2018adversarial,zugner2019adversarial} but a virtual perturbation in the Laplacian. Therefore, it's not clear how much perturbations on the Laplacian correspond to the actual perturbations on graph structure. Nevertheless, we still conduct the experiments of R\name against graph structure meta-attack where the ptb rate is 25\%. As shown in the Table~\ref{tab:attack}, our R\name model outperforms than GCN, GAT, RobustGCN \citep{zugner2019robustgcn}, GCN-Jaccard \citep{wu2019adversarial}, GCN-SVD \citep{entezari2020all}, and S$^2$GC on Cora, Citeseer, and Pubmed. \section{The details on how to solve the inner maximization problem in Sec.~\ref{Minimization of the Optimization Problem}} \label{appendix:how to solve the optimization problem} Different from the non-concave inner maximization problem in the adversarial attack, our inner maximization problem is indeed a convex optimization problem. Hence, we do not need to add random perturbations on the graph structure at each training epoch and can find the largest perturbation which maximizes the inner adversarial loss function. Denote the perturbation as $\bm{\delta}$, and $\mathbf{L}'=\widetilde{\mathbf{L}} + \bm{\delta}$. We can rewrite the inner maximization problem as \begin{equation} \max_{\mathbf{L}^{\prime}} \operatorname{tr}\left(\mathbf{F}^{\top} \mathbf{L}^{\prime} \mathbf{F}\right) =\langle\widetilde{\mathbf{L}}, \mathbf{F}^{\top}\mathbf{F}\rangle + \max_{\bm{\delta}}\langle\bm{\delta}, \mathbf{F}^{\top}\mathbf{F}\rangle \quad \operatorname{s.t.} \quad \left\|\bm{\delta}\right\|_{F} \leq \varepsilon. \end{equation} We denote $h(\bm{\delta})=\langle\bm{\delta}, \mathbf{F}^{\top}\mathbf{F}\rangle$. Obviously, $h(\bm{\delta})$ reaches the largest value when $\bm{\delta}$ has the same direction with the gradient of $h(\bm{\delta})$, e.g. $\bm{\delta}=\varepsilon\nabla h(\bm{\delta})=\frac{\varepsilon\mathbf{F}\mathbf{F}^{\top}}{\left\|\mathbf{F}\mathbf{F}^{\top}\right\|_{F}}$, which is illustrated in Fig.~\ref{figure:adv inner problem}. \begin{figure}[htbp] \begin{center} \includegraphics[width=.45\columnwidth]{images/adv_inner_problem.pdf} \end{center} \caption{The illustration of the inner maximization problem. The adversarial loss function reaches the largest value when the direction of $\bm{\delta}$ is the same with $\nabla h(\bm{\delta})$} \label{figure:adv inner problem} \end{figure} \section{Additional Details on the Neumann Series} \label{appendix:neumann series} We provide additional details and derivations on how to obtain the Neumann Series which leads to our Neumann Graph Convolution (NGC) method. Before we derive the Neumann Series, we first introduce the following lemmas which are crucial to the derivation of the Neumann Series. \begin{lemma} \rm {\textbf{(Gelfand formula)~\citep{bhatia2013matrix}} } \label{Gelfand formula} \emph{Given any matrix norm $\||\cdot|\|$, then $\rho(\mathbf{A})=\lim\limits_{k \rightarrow \infty}\||\mathbf{A}^{k}|\|^{1 / k}=\inf\limits_{k \geq 1}\||\mathbf{A}^k|\|^{1/k}\leq \||\mathbf{A}|\|$}. \end{lemma} Lemma~\ref{Gelfand formula} describes the relationship between the spectral radius of a matrix and its matrix norm, $i.e.$ $\rho(\mathbf{A})=\lim\limits_{k \rightarrow \infty}\||\mathbf{A}^{k}|\|^{1 / k}$. \begin{lemma} \label{convergence of neumann series} Let $\mathbf{A} \in \mathbb{C}^{n \times n}$, the spectral radius $\rho(\mathbf{A})=\max (\operatorname{abs}(\operatorname{spec}(\mathbf{A})))$, if $\rho(\mathbf{A})<1$, then $\sum_{k=0}^{\infty} \mathbf{A}^{k}$ converges to $(\mathbf{I}-\mathbf{A})^{-1}$. \end{lemma} \begin{proof} We first prove that $(\mathbf{I}-\mathbf{A})^{-1}$ exists as follows: Based on the definition of eigenvalues of $\mathbf{A}$, we have $|\lambda \mathbf{I} - \mathbf{A}| = 0$ and the solution is the eigenvalue of $\mathbf{A}$. Since $\rho(\mathbf{A}) < 1$, if $\lambda \geq 1$, then $|\lambda \mathbf{I} - \mathbf{A}| \neq 0$, so $|\mathbf{I} - \mathbf{A}| \neq 0$, which means $(\mathbf{I}-\mathbf{A})^{-1}$ exists. Since $\rho(\mathbf{A}) < 1$ and by Lemma~\ref{Gelfand formula}, we have $\lim\limits_{k \rightarrow \infty}\||\mathbf{A}^{k}|\|=\rho(\mathbf{A})^k=0$. Let $\mathbf{S}_k$ = $\mathbf{A}^0 + \mathbf{A}^1 + \cdots + \mathbf{A}^k$, then we have \begin{equation*} \begin{split} \lim_{k \rightarrow \infty}(\mathbf{S}^k-\mathbf{A}\mathbf{S}^k) &= \lim\limits_{k \rightarrow \infty}(\mathbf{I}-\mathbf{A})\mathbf{S}^k \\ &=\lim_{k \rightarrow \infty}(\mathbf{I}-\mathbf{A}^{k+1}) \\ &= \mathbf{I} \end{split} \end{equation*} Since $(\mathbf{I}-\mathbf{A})^{-1}$ exists, so we have $(\mathbf{I}-\mathbf{A})\lim\limits_{k \rightarrow \infty}\mathbf{S}^k=\mathbf{I}$, and $\lim\limits_{k \rightarrow \infty}\mathbf{S}^k=(\mathbf{I}-\mathbf{A})^{-1}$, which finishes the proof. \end{proof} Lemma~\ref{convergence of neumann series} describes the convergence of Neumann Series and the condition to get the convergence. \begin{lemma} \rm {\textbf{(Gerschgorin Disc)~\citep{bhatia2013matrix}}} \label{Gerschgorin Disc} \emph{Let $\mathbf{A} \in \mathbb{C}^{n \times n}$, with entries $a_{ij}$. For any eigenvalue $\lambda$, there exits $i$ and the corresponding Gerschgorin disc $D\left(a_{i i}, R_{i}\right) \subseteq \mathbb{C}$ such that $\lambda$ lies in this disc, i.e.} \begin{equation*} |\lambda-a_{ii}| \leq \sum_{j\neq i}^{n}|a_{ij}|. \end{equation*} \end{lemma} Lemma~\ref{Gerschgorin Disc} describes the estimated range of eigenvalues. Now we start to derive the Neumann Series expansion of the solution of GSD as follows. \begin{lemma} \label{Neumann derivation} Let $\mathbf{A} \in\{0,1\}^{n \times n}$ be the adjacency matrix of a graph and $\widetilde{\bm{\mathcal{A}}}=\widetilde{\mathbf{D}}^{-\frac{1}{2}} \widetilde{\mathbf{A}} \widetilde{\mathbf{D}}^{-\frac{1}{2}}$ or $\widetilde{\bm{\mathcal{A}}} = \widetilde{\mathbf{D}}^{-1} \widetilde{\mathbf{A}}$, then \begin{equation*} (\mathbf{I}-\frac{\lambda}{\lambda+1}\widetilde{\bm{\mathcal{A}}})^{-1}=\sum_{k=0}^{\infty} \left(\frac{\lambda}{\lambda+1}\widetilde{\bm{\mathcal{A}}}\right)^{k}. \end{equation*} \end{lemma} \begin{proof} We first prove that $\rho(\widetilde{\bm{\mathcal{A}}})\leq1$ where $\widetilde{\bm{\mathcal{A}}}=\widetilde{\mathbf{D}}^{-\frac{1}{2}} \widetilde{\mathbf{A}} \widetilde{\mathbf{D}}^{-\frac{1}{2}}$. Let $\lambda$ be the eigenvalue of $\widetilde{\bm{\mathcal{A}}}$, and $\mathbf{v}$ be the corresponding eigenvector. Then we have \begin{equation*} \begin{split} \left(\widetilde{\mathbf{D}}^{-\frac{1}{2}} \widetilde{\mathbf{A}} \widetilde{\mathbf{D}}^{-\frac{1}{2}}\right)\mathbf{v}=\lambda\mathbf{v} &\Longrightarrow \widetilde{\mathbf{D}}^{-\frac{1}{2}} \left(\widetilde{\mathbf{D}}^{-\frac{1}{2}} \widetilde{\mathbf{A}} \widetilde{\mathbf{D}}^{-\frac{1}{2}}\right)\mathbf{v}=\lambda\widetilde{\mathbf{D}}^{-\frac{1}{2}}\mathbf{v}\\ &\Longrightarrow \left(\widetilde{\mathbf{D}}^{-1} \widetilde{\mathbf{A}}\right) \widetilde{\mathbf{D}}^{-\frac{1}{2}}\mathbf{v} = \lambda\widetilde{\mathbf{D}}^{-\frac{1}{2}}\mathbf{v}, \end{split} \end{equation*} which means $(\lambda, \widetilde{\mathbf{D}}^{-\frac{1}{2}}\mathbf{v})$ is the eigen-pair of $\widetilde{\mathbf{D}}^{-1}\mathbf{A}$. By Lemma~\ref{Gerschgorin Disc}, there exists $i$, such that \begin{equation*} \begin{split} &\left|\lambda-\left(\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\right)_{ii}\right|\leq \sum_{j\neq i}\left|\left(\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\right)_{ij}\right|\\ &\Longrightarrow \left(\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\right)_{ii} - \sum_{j\neq i}\left|\left(\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\right)_{ij}\right| \leq \lambda \leq \left(\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\right)_{ii} + \sum_{j\neq i}\left|\left(\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\right)_{ij}\right|. \end{split} \end{equation*} Since $\left(\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\right)_{ij}>0$ and $\sum_{j}\left|\left(\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\right)_{ij}\right|=\sum_{j}\left(\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\right)_{ij}=1$, obviously \begin{equation*} -1<\left(\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\right)_{ii} - \sum_{j\neq i}\left|\left(\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\right)_{ij}\right| \leq \lambda \leq \left(\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\right)_{ii} + \sum_{j\neq i}\left|\left(\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\right)_{ij}\right|=1. \end{equation*} So if $\widetilde{\bm{\mathcal{A}}}=\widetilde{\mathbf{D}}^{-\frac{1}{2}} \widetilde{\mathbf{A}} \widetilde{\mathbf{D}}^{-\frac{1}{2}}$, we have $\rho(\widetilde{\bm{\mathcal{A}}})\leq1$. When $\widetilde{\bm{\mathcal{A}}}=\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}$, we denote $(\lambda, \mathbf{v})$ as the eigen-pair of $\mathbf{\widetilde{\mathbf{D}}^{-1}\mathbf{A}}$. Similarly, by Lemma~\ref{Gerschgorin Disc}, there exists $i$, such that \begin{equation*} \begin{split} &\left|\lambda-\left(\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\right)_{ii}\right|\leq \sum_{j\neq i}\left|\left(\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\right)_{ij}\right|\\ &\Longrightarrow \left(\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\right)_{ii} - \sum_{j\neq i}\left|\left(\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\right)_{ij}\right| \leq \lambda \leq \left(\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\right)_{ii} + \sum_{j\neq i}\left|\left(\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\right)_{ij}\right|. \end{split} \end{equation*} Obviously, we can get the same conclusion for $\widetilde{\bm{\mathcal{A}}}=\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}$. So it is true for $\rho\left(\frac{\lambda}{\lambda+1}\widetilde{\bm{\mathcal{A}}}\right) \leq \frac{\lambda}{\lambda+1}<1$ By Lemma~\ref{convergence of neumann series}, we get the result $(\mathbf{I}-\frac{\lambda}{\lambda+1}\widetilde{\bm{\mathcal{A}}})^{-1}=\sum_{k=0}^{\infty} \left(\frac{\lambda}{\lambda+1}\widetilde{\bm{\mathcal{A}}}\right)^{k}$, which finishes the proof. \end{proof} By Lemma~\ref{Neumann derivation}, we approximate the inverse matrix $(\mathbf{I}+\lambda \tilde{\mathbf{L}})^{-1}$ up to $S$-th order with \begin{equation*} \left(\mathbf{I}+\lambda \widetilde{\mathbf{L}}\right)^{-1} =\frac{1}{\lambda+1}\left(\mathbf{I}-\frac{\lambda}{\lambda+1}\widetilde{\bm{\mathcal{A}}}\right)^{-1}\approx\frac{1}{\lambda+1}\sum_{s=0}^{S} \left(\frac{\lambda}{\lambda+1}\widetilde{\bm{\mathcal{A}}}\right)^{s}. \end{equation*} \section{The Row Summation of the Neumann Series} \label{appendix:row sum} We provide the derivations of the row sum of $\widetilde{\bm{\mathcal{A}}}_{S}$ in this section. Before we derive the row summation of $\widetilde{\bm{\mathcal{A}}}_{S}$, we first derive the row summation of $\widetilde{\bm{\mathcal{A}}}^{k}$. \begin{lemma} \label{transition matrix} Consider a probability matrix $\mathbf{P} \in \mathbb{R}^{n \times n}$, where $\mathbf{P}_{ij}\geq0$. Besides, for all $i$, we have $\sum_{j=1}^n\mathbf{P}_{ij}=1$. Then for any $s \in \mathbb{Z}_{+}$, we have $\sum_{j=1}^n\mathbf{P}^s_{ij}=1$, \end{lemma} \begin{proof} We give a proof by induction on $k$.\\ \textbf{Base case:} When $k=1$, the case is true.\\ \textbf{Inductive step:} Assume the induction hypothesis that for a particular $k$, the single case n = k holds, meaning $\mathbf{P}^k$ is true: \begin{equation*} \forall i, \sum_{j=1}^n \mathbf{P}_{ij}^k =1. \end{equation*} As $\mathbf{P}^{k+1}=\mathbf{P}^{k}\mathbf{P}$, so we have \begin{equation*} \sum_{j=1}^n\mathbf{P}^{k+1}_{ij}=\sum_{j=1}^n\sum_{k=1}^n\mathbf{P}^{k}_{ik}\mathbf{P}_{kj} = \sum_{k=1}^n\sum_{j=1}^n\mathbf{P}^{k}_{ik}\mathbf{P}_{kj} = \sum_{k=1}^n\mathbf{P}^{k}_{ik}\left(\sum_{j=1}^n\mathbf{P}_{kj}\right) = \sum_{k=1}^n\mathbf{P}^{k}_{ik} = 1, \end{equation*} which finishes the proof. \end{proof} Lemma~\ref{transition matrix} describes the row summation of $\widetilde{\bm{\mathcal{A}}}^{k}$ is 1. Now we can obtain the row summation for $\widetilde{\bm{\mathcal{A}}}_{S}$. Then for any $i$, we have \begin{equation} \begin{split} \sum_{j=1}^{n}\left[\widetilde{\bm{\mathcal{A}}}_{S}\right]_{ij} &=\frac{1}{\lambda+1}\sum_{s=0}^{S} \left(\frac{\lambda}{\lambda+1}\left[\widetilde{\bm{\mathcal{A}}}\right]_{ij}\right)^{s}\\ &=\frac{1}{\lambda+1}\sum_{s=0}^{S}\left(\frac{\lambda}{\lambda+1}\right)^{s} \\ &=1-\left(\frac{\lambda}{\lambda+1}\right)^{S+1}. \end{split} \end{equation} \section{Proof of Lemma 1} \label{appendix:upper bound with hoeffding} We provide the details of proof of Lemma 1. We first introduce the General Hoeffding Inequality~\citep{hoeffding1994probability}, which is essential for bounding $\left\|\widetilde{\bm{\mathcal{A}}}_S\bm{\eta}\right\|_{F}^{2}$. \begin{lemma} \label{hoeffding} \rm{\textbf{(General Hoeffding Inequality~\citep{hoeffding1994probability})}} \emph{Suppose that the variables $X_{1}, \cdots, X_{n}$ are independent, and $X_i$ has mean $\mu_{i}$ and sub-Gaussian parameter $\sigma_{i}$. Then for all $t\geq0$, we have} \begin{equation} \mathbb{P}\left[\sum_{i=1}^{n}\left(X_{i}-\mu_{i}\right) \geq t\right] \leq \exp \left\{-\frac{t^{2}}{2 \sum_{i=1}^{n} \sigma_{i}^{2}}\right\}. \end{equation} \end{lemma} Now let's prove Lemma~\ref{upper bound of aggregated noised matirx}. \begin{proof}[Proof of Lemma~\ref{upper bound of aggregated noised matirx}.] For any entry $\left[\widetilde{\bm{\mathcal{A}}}_S\bm{\eta}\right]_{ij}=\sum_{p=1}^{n}\left(\widetilde{\bm{\mathcal{A}}}_S\right)_{ip}\bm{\eta}_{pj}$, where $\bm{\eta}_{pj}$ is a sub-Gaussian variable with parameter $\sigma^{2}$. By the General Hoeffding inequality~\ref{hoeffding}, we have \begin{equation} \mathbb{P}\left(\left|\left[ \frac{1}{\lambda+1}\sum_{s=0}^{S}\left(\frac{\lambda}{\lambda+1}\widetilde{\bm{\mathcal{A}}}_{S}\right)^{s}\bm{\eta}\right]_{ij}\right|\geq t\right) \leq 2\exp \left\{-\frac{nt^{2}}{2\tau\left(1-\left(\frac{\lambda}{\lambda+1}\right)^{S+1}\right)^2\sigma^2}\right\}. \end{equation} where $\tau = \max_i \tau_i$ and $ \tau_i = {n\sum_{j=1}^{n}\left[\widetilde{\bm{\mathcal{A}}}_{S}\right]_{ij}^2}\Bigg/{\left(1-\left(\frac{\lambda}{\lambda+1}\right)^{S+1}\right)^2}$. Applying union bound~\citep{vershynin2010introduction} to all possible pairs of $i \in [n]$, $j \in [n]$, we get \begin{equation} \mathbb{P}\left(\left\|\widetilde{\bm{\mathcal{A}}}_S\bm{\eta}\right\|_{\infty, \infty}\geq t\right) \leq \sum_{i,j}\mathbb{P}\left(\left[\widetilde{\bm{\mathcal{A}}}_S\bm{\eta}\right]_{ij}\geq t\right) \leq 2n^2\exp \left\{-\frac{nt^{2}}{2\tau\left(1-\left(\frac{\lambda}{\lambda+1}\right)^{S+1}\right)^2\sigma^2}\right\}. \end{equation} Applying union bound again, we have \begin{equation} \mathbb{P}\left(\left\|\widetilde{\bm{\mathcal{A}}}_S\bm{\eta}\right\|_{F}^{2}\geq t\right) \leq \sum_{i,j}\mathbb{P}\left(\left\|\widetilde{\bm{\mathcal{A}}}_S\bm{\eta}\right\|_{\infty, \infty}\geq \sqrt{t}\right)\leq2n^4\exp \left\{-\frac{nt}{2\tau\left(1-\left(\frac{\lambda}{\lambda+1}\right)^{S+1}\right)^2\sigma^2}\right\}. \end{equation} Choose $t=2\tau\left(1-\left(\frac{\lambda}{\lambda+1}\right)^{S+1}\right)^2\left(4\log n+\log{2d}\right)/n$ and with probability $1-1/d$, we have \begin{equation} \left\|\widetilde{\bm{\mathcal{A}}}_S\bm{\eta}\right\|_{F}^{2}\leq \frac{2\tau\left(1-\left(\frac{\lambda}{\lambda+1}\right)^{S+1}\right)^2\sigma^2\left(4\log n+\log{2d}\right)}{n}, \end{equation} which finishes the proof. \end{proof} \section{Proof of the Main Theorem~\ref{theorem:main}} \label{appendix:upper bound with optimization} We provide the details of proof of main theorem~\ref{theorem:main}.\\ \input{optimization_upper_bound} \section{More Details on Equation~(\ref{graph signal denoising}).} We provide more details on how to obtain Equation~(\ref{graph signal denoising}). Note that if we set $\widetilde{\mathbf{L}}=\mathbf{I}-\widetilde{\mathbf{D}}^{-\frac{1}{2}}\widetilde{\mathbf{A}} \widetilde{\mathbf{D}}^{-\frac{1}{2}}$, we have $\operatorname{tr}\left(\mathbf{F}^{\top} \widetilde{\mathbf{L}} \mathbf{F}\right)=\operatorname{tr}\left(\mathbf{F}^{\top} (\mathbf{I}-\widetilde{\mathbf{D}}^{-\frac{1}{2}}\widetilde{\mathbf{A}} \widetilde{\mathbf{D}}^{-\frac{1}{2}}) \mathbf{F}\right)=\operatorname{tr}\left(\mathbf{F}^{\top}\mathbf{F}\right)-\operatorname{tr}\left(\mathbf{F}^{\top} \widetilde{\mathbf{D}}^{-\frac{1}{2}}\widetilde{\mathbf{A}} \widetilde{\mathbf{D}}^{-\frac{1}{2}} \mathbf{F}\right)=\operatorname{tr}\left(\mathbf{F}\mathbf{F}^{\top}\right)-\operatorname{tr}\left( \widetilde{\mathbf{D}}^{-\frac{1}{2}}\widetilde{\mathbf{A}} \widetilde{\mathbf{D}}^{-\frac{1}{2}} \mathbf{F}\mathbf{F}^{\top}\right)$. On the other hand, if we set $\widetilde{\mathbf{L}}=\mathbf{I}-\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}$, we have $\operatorname{tr}\left(\mathbf{F}^{\top} \widetilde{\mathbf{L}} \mathbf{F}\right)=\operatorname{tr}\left(\mathbf{F}^{\top} (\mathbf{I}-\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}) \mathbf{F}\right)=\operatorname{tr}\left(\mathbf{F}^{\top}\mathbf{F}\right)-\operatorname{tr}\left(\mathbf{F}^{\top} \widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}} \mathbf{F}\right)=\operatorname{tr}\left(\mathbf{F}\mathbf{F}^{\top}\right)-\operatorname{tr}\left( \widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}\mathbf{F}\mathbf{F}^{\top}\right)$. We denote $\mathbf{F}=\left[\begin{array}{c} \mathbf{F}_{1} \\ \vdots \\ \mathbf{F}_{n} \\ \end{array}\right]$ and $\mathbf{F}^{\top}=\left[\mathbf{F}_{1}^{\top} \cdots \mathbf{F}_{n}^{\top}\right]$, where $\mathbf{F}_i=\left[\mathbf{F}_{i1} \cdots \mathbf{F}_{id}\right]$, then we have $\operatorname{tr}\left(\mathbf{F}\mathbf{F}^{\top}\right) = \sum_{i=1}^n \mathbf{F}_{i}\mathbf{F}^{\top}_{i}$. \\ When $\widetilde{\mathbf{L}}=\mathbf{I}-\widetilde{\mathbf{D}}^{-\frac{1}{2}}\widetilde{\mathbf{A}} \widetilde{\mathbf{D}}^{-\frac{1}{2}}$, we have \begin{equation*} \begin{split} &\quad\operatorname{tr}\left( \widetilde{\mathbf{D}}^{-\frac{1}{2}}\widetilde{\mathbf{A}} \widetilde{\mathbf{D}}^{-\frac{1}{2}} \mathbf{F}\mathbf{F}^{\top}\right)\\ &=\operatorname{tr}\left(\left[\begin{array}{cccc} \frac{\mathbf{A}_{11}}{\sqrt{d_{1}+1}\sqrt{d_{1}+1}} & \frac{\mathbf{A}_{12}}{\sqrt{d_{1}+1}\sqrt{d_{2}+1}} & \cdots & \frac{\mathbf{A}_{1n}}{\sqrt{d_{1}+1}\sqrt{d_{n}+1}} \\ \frac{\mathbf{A}_{21}}{\sqrt{d_{2}+1}\sqrt{d_{1}+1}} & \frac{\mathbf{A}_{22}}{\sqrt{d_{2}+1}\sqrt{d_{2}+1}} & \cdots & \frac{\mathbf{A}_{2n}}{\sqrt{d_{2}+1}\sqrt{d_{n}+1}} \\ \vdots & \ddots & \ddots & \vdots \\ \frac{\mathbf{A}_{n1}}{\sqrt{d_{n}+1}\sqrt{d_{1}+1}} & \frac{\mathbf{A}_{n2}}{\sqrt{d_{n}+1}\sqrt{d_{2}+1}} & \cdots & \frac{\mathbf{A}_{nn}}{\sqrt{d_{n}+1}\sqrt{d_{n}+1}} \end{array}\right] \left[\begin{array}{cccc} \mathbf{F}_{1}\mathbf{F}_{1}^{\top} & \mathbf{F}_{1}\mathbf{F}_{2}^{\top} & \cdots & \mathbf{F}_{1}\mathbf{F}_{n}^{\top} \\ \mathbf{F}_{2}\mathbf{F}_{1}^{\top} & \mathbf{F}_{2}\mathbf{F}_{2}^{\top} & \cdots & \mathbf{F}_{2}\mathbf{F}_{n}^{\top} \\ \vdots & \ddots & \ddots & \vdots \\ \mathbf{F}_{n}\mathbf{F}_{1}^{\top} & \mathbf{F}_{n}\mathbf{F}_{2}^{\top} & \cdots & \mathbf{F}_{n}\mathbf{F}_{n}^{\top} \end{array}\right]\right)\\ &=\sum_{i=1}^{n}\sum_{j=1}^{n}\frac{\mathbf{A}_{ij}}{\sqrt{d_{i}+1}\sqrt{d_{j}+1}}\mathbf{F}_{j}\mathbf{F}_{i}^{\top}. \end{split} \end{equation*} On the other hand, when $\widetilde{\mathbf{L}}=\mathbf{I}-\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}$, we have \begin{equation*} \begin{split} &\quad\operatorname{tr}\left( \widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}} \mathbf{F}\mathbf{F}^{\top}\right)\\ &=\operatorname{tr}\left(\left[\begin{array}{cccc} \frac{\mathbf{A}_{11}}{d_{1}+1} & \frac{\mathbf{A}_{12}}{d_{1}+1} & \cdots & \frac{\mathbf{A}_{1n}}{d_{1}+1} \\ \frac{\mathbf{A}_{21}}{d_{2}+1} & \frac{\mathbf{A}_{22}}{d_{2}+1} & \cdots & \frac{\mathbf{A}_{2n}}{d_{2}+1}\\ \vdots & \ddots & \ddots & \vdots \\ \frac{\mathbf{A}_{n1}}{d_{n}+1} & \frac{\mathbf{A}_{n2}}{d_{n}+1} & \cdots & \frac{\mathbf{A}_{nn}}{d_{n}+1} \end{array}\right] \left[\begin{array}{cccc} \mathbf{F}_{1}\mathbf{F}_{1}^{\top} & \mathbf{F}_{1}\mathbf{F}_{2}^{\top} & \cdots & \mathbf{F}_{1}\mathbf{F}_{n}^{\top} \\ \mathbf{F}_{2}\mathbf{F}_{1}^{\top} & \mathbf{F}_{2}\mathbf{F}_{2}^{\top} & \cdots & \mathbf{F}_{2}\mathbf{F}_{n}^{\top} \\ \vdots & \ddots & \ddots & \vdots \\ \mathbf{F}_{n}\mathbf{F}_{1}^{\top} & \mathbf{F}_{n}\mathbf{F}_{2}^{\top} & \cdots & \mathbf{F}_{n}\mathbf{F}_{n}^{\top} \end{array}\right]\right)\\ &=\sum_{i=1}^{n}\sum_{j=1}^{n}\frac{\mathbf{A}_{ij}}{d_{i}+1}\mathbf{F}_{j}\mathbf{F}_{i}^{\top}. \end{split} \end{equation*} So when $\widetilde{\mathbf{L}}=\mathbf{I}-\widetilde{\mathbf{D}}^{-\frac{1}{2}}\widetilde{\mathbf{A}} \widetilde{\mathbf{D}}^{-\frac{1}{2}}$, we have \begin{equation*} \begin{split} &\quad\operatorname{tr}\left(\mathbf{F}^{\top} \widetilde{\mathbf{L}} \mathbf{F}\right)\quad \left(\widetilde{\mathbf{L}}=\mathbf{I}-\widetilde{\mathbf{D}}^{-\frac{1}{2}}\widetilde{\mathbf{A}} \widetilde{\mathbf{D}}^{-\frac{1}{2}}\right)\\ &= \operatorname{tr}\left(\mathbf{F}^{\top} (\mathbf{I}-\widetilde{\mathbf{D}}^{-\frac{1}{2}}\widetilde{\mathbf{A}} \widetilde{\mathbf{D}}^{-\frac{1}{2}}) \mathbf{F}\right) \\ &=\operatorname{tr}\left(\mathbf{F}\mathbf{F}^{\top}\right)-\operatorname{tr}\left( \widetilde{\mathbf{D}}^{-\frac{1}{2}}\widetilde{\mathbf{A}} \widetilde{\mathbf{D}}^{-\frac{1}{2}} \mathbf{F}\mathbf{F}^{\top}\right) \\ &= \sum_{i=1}^n \mathbf{F}_{i}\mathbf{F}^{\top}_{i} -\sum_{i=1}^{n}\sum_{j=1}^{n}\frac{\mathbf{A}_{ij}}{\sqrt{d_{i}+1}\sqrt{d_{j}+1}}\mathbf{F}_{j}\mathbf{F}_{i}^{\top} \\ &= \frac{1}{2}\sum_{i=1}^n \mathbf{F}_{i}\mathbf{F}^{\top}_{i} + \frac{1}{2}\sum_{j=1}^n \mathbf{F}_{j}\mathbf{F}^{\top}_{j} -\sum_{i=1}^{n}\sum_{j=1}^{n}\frac{\mathbf{A}_{ij}}{\sqrt{d_{i}+1}\sqrt{d_{j}+1}}\mathbf{F}_{j}\mathbf{F}_{i}^{\top} \\ &=\frac{1}{2}\left(\sum_{i=1}^n \mathbf{F}_{i}\mathbf{F}^{\top}_{i} + \sum_{j=1}^n \mathbf{F}_{j}\mathbf{F}^{\top}_{j} -2\sum_{i=1}^{n}\sum_{j=1}^{n}\frac{\mathbf{A}_{ij}}{\sqrt{d_{i}+1}\sqrt{d_{j}+1}}\mathbf{F}_{j}\mathbf{F}_{i}^{\top}\right) \\ &= \frac{1}{2}\left( \sum_{i=1}^n \sum_{j=1}^n \frac{\mathbf{A}_{ij}\mathbf{F}_{i}\mathbf{F}^{\top}_{i}}{d_i+1} + \sum_{i=1}^n \sum_{j=1}^n \frac{\mathbf{A}_{ij}\mathbf{F}_{j}\mathbf{F}^{\top}_{j}}{d_j+1} -2\sum_{i=1}^{n}\sum_{j=1}^{n}\frac{\mathbf{A}_{ij}}{\sqrt{d_{i}+1}\sqrt{d_{j}+1}}\mathbf{F}_{j}\mathbf{F}_{i}^{\top}\right) \text{undirected graph}\\ &=\frac{1}{2}\left(\sum_{i=1}^{n}\sum_{j=1}^{n}\left(\frac{\mathbf{A}_{ij}\mathbf{F}_{i}\mathbf{F}^{\top}_{i}}{d_i+1} +\frac{\mathbf{A}_{ij}\mathbf{F}_{j}\mathbf{F}^{\top}_{j}}{d_j+1}-\frac{\mathbf{A}_{ij}}{\sqrt{d_{i}+1}\sqrt{d_{j}+1}}\mathbf{F}_{j}\mathbf{F}_{i}^{\top}-\frac{\mathbf{A}_{ij}}{\sqrt{d_{i}+1}\sqrt{d_{j}+1}}\mathbf{F}_{i}\mathbf{F}_{j}^{\top}\right)\right)\\ &=\frac{1}{2}\left(\sum_{i=1}^{n}\sum_{j=1}^{n}\mathbf{A}_{ij}\left(\frac{\mathbf{F}_{i}\mathbf{F}^{\top}_{i}}{d_i+1} +\frac{\mathbf{F}_{j}\mathbf{F}^{\top}_{j}}{d_j+1}-\frac{\mathbf{F}_{j}\mathbf{F}_{i}^{\top}}{\sqrt{d_{i}+1}\sqrt{d_{j}+1}}-\frac{\mathbf{F}_{i}\mathbf{F}_{j}^{\top}}{\sqrt{d_{i}+1}\sqrt{d_{j}+1}}\right)\right)\\ &=\frac{1}{2}\left(\sum_{i=1}^{n}\sum_{j=1}^{n}\mathbf{A}_{ij}\left(\frac{\mathbf{F}_i}{\sqrt{d_i+1}}-\frac{\mathbf{F}_j}{\sqrt{d_j+1}}\right)\left(\frac{\mathbf{F}_i^{\top}}{\sqrt{d_i+1}}-\frac{\mathbf{F}_j^{\top}}{\sqrt{d_j+1}}\right)\right)\\ &=\frac{1}{2}\left(\sum_{i=1}^{n}\sum_{j=1}^{n}\mathbf{A}_{ij}\left\|\frac{\mathbf{F}_{i}}{\sqrt{d_{i}+1}}-\frac{\mathbf{F}_{j}}{\sqrt{d_{j}+1}}\right\|_{2}^{2}\right) = \sum_{(i, j) \in \mathcal{E}} \mathbf{A}_{i j}\left\|\frac{\mathbf{F}_{i}}{\sqrt{d_{i}+1}}-\frac{\mathbf{F}_{j}}{\sqrt{d_{j}+1}}\right\|_{2}^{2}. \end{split} \end{equation*} On the other hand, when $\widetilde{\mathbf{L}}=\mathbf{I}-\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}$, we have \begin{equation*} \begin{split} &\operatorname{tr}\left(\mathbf{F}^{\top} \widetilde{\mathbf{L}} \mathbf{F}\right)\quad \left(\widetilde{\mathbf{L}}=\mathbf{I}-\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}} \right)\\ &= \operatorname{tr}\left(\mathbf{F}^{\top} (\mathbf{I}-\widetilde{\mathbf{D}}^{-1}\widetilde{\mathbf{A}}) \mathbf{F}\right) \\ &= \sum_{i=1}^n \mathbf{F}_{i}\mathbf{F}^{\top}_{i} -\sum_{i=1}^{n}\sum_{j=1}^{n}\frac{\mathbf{A}_{ij}}{d_{i}+1}\mathbf{F}_{j}\mathbf{F}_{i}^{\top} \\ &= \frac{1}{2}\sum_{i=1}^n \mathbf{F}_{i}\mathbf{F}^{\top}_{i} + \frac{1}{2}\sum_{j=1}^n \mathbf{F}_{j}\mathbf{F}^{\top}_{j} -\sum_{i=1}^{n}\sum_{j=1}^{n}\frac{\mathbf{A}_{ij}}{d_{i}+1}\mathbf{F}_{j}\mathbf{F}_{i}^{\top} \\ &= \frac{1}{2}\left( \sum_{i=1}^n \sum_{j=1}^n \frac{\mathbf{A}_{ij}\mathbf{F}_{i}\mathbf{F}^{\top}_{i}}{d_i+1} + \sum_{i=1}^n \sum_{j=1}^n \frac{\mathbf{A}_{ij}\mathbf{F}_{j}\mathbf{F}^{\top}_{j}}{d_i+1} -2\sum_{i=1}^{n}\sum_{j=1}^{n}\frac{\mathbf{A}_{ij}}{\sqrt{d_{i}+1}\sqrt{d_{i}+1}}\mathbf{F}_{j}\mathbf{F}_{i}^{\top}\right) \text{undirected graph}\\ &=\frac{1}{2}\left(\sum_{i=1}^{n}\sum_{j=1}^{n}\mathbf{A}_{ij}\left(\frac{\mathbf{F}_i}{\sqrt{d_i+1}}-\frac{\mathbf{F}_j}{\sqrt{d_i+1}}\right)\left(\frac{\mathbf{F}_i^{\top}}{\sqrt{d_i+1}}-\frac{\mathbf{F}_j^{\top}}{\sqrt{d_i+1}}\right)\right)\\ &=\frac{1}{2}\left(\sum_{i=1}^{n}\sum_{j=1}^{n}\mathbf{A}_{ij}\left\|\frac{\mathbf{F}_{i}}{\sqrt{d_{i}+1}}-\frac{\mathbf{F}_{j}}{\sqrt{d_{i}+1}}\right\|_{2}^{2}\right) = \sum_{(i, j) \in \mathcal{E}} \mathbf{A}_{i j}\left\|\frac{\mathbf{F}_{i}}{\sqrt{d_{i}+1}}-\frac{\mathbf{F}_{j}}{\sqrt{d_{i}+1}}\right\|_{2}^{2}. \end{split} \end{equation*} \section{Datasets Details} Cora, Citeseer, and Pubmed are standard citation network benchmark datasets~\citep{sen2008collective}. Coauthor-CS and Coauthor-Phy are extracted from Microsoft Academic Graph~\citep{shchur2018pitfalls}. Cornell, Texas, Wisconsin, and Actor are constructed by \citet{pei2020geom}. ogbn-products is a large-scale product, constructed by \citet{hu2020open}. \begin{table}[!hbtp] \caption{Datasets statistics} \label{tab:stat} \setlength{\tabcolsep}{2mm} \begin{center} \begin{tabular}{lcccc} \toprule \multicolumn{1}{l}{\textbf{Dataset}} & \# Nodes & \# Edges & \# Features & \# Classes \\ \midrule Cora & 2708 & 5429 & 1433 & 7 \\ Citeseer & 3327 & 4732 & 3703 & 6 \\ Pubmed & 19717 & 44338 & 500 & 3 \\ Cornell & 183 & 295 & 1703 & 5 \\ Texas & 183 & 309 & 1703 & 5 \\ Wisconsin & 251 & 499 & 1703 & 5 \\ Actor & 7600 & 33544 & 931 & 5 \\ Coauthor-CS & 18333 & 81894 & 6805 & 15 \\ Coauthor-Phy & 34493 & 247962 & 8415 & 5 \\ ogbn-products & 2449029 & 61859140 & 100 & 42\\ \bottomrule \end{tabular} \end{center} \end{table} \section{Reproducibility} \subsection{Implementation Details} We use Pytorch~\citep{paszke2019pytorch} and PyG~\citep{fey2019fast} to implement \name and R\name. The codes of baselines are implemented referring to the implementation of MLP\footnote{https://github.com/tkipf/pygcn}\footnote{https://github.com/snap-stanford/ogb/blob/master/examples/nodeproppred/products/mlp.py}, GCN\footnote{https://github.com/tkipf/pygcn}\footnote{https://github.com/snap-stanford/ogb/blob/master/examples/nodeproppred/products/gnn.py}, GAT\footnote{https://github.com/pyg-team/pytorch\_geometric/blob/master/examples/gat.py}, GLP\footnote{https://github.com/liqimai/Efficient-SSL}, S$^2$GC\footnote{https://github.com/allenhaozhu/SSGC}, and IRLS\footnote{https://github.com/FFTYYY/TWIRLS}. All the experiments in this work are conducted on a single NVIDIA Tesla A100 with 80GB memory size. The software that we use for experiments are Python 3.6.8, pytorch 1.9.0, pytorch-scatter 2.0.9, pytorch-sparse 0.6.12, pyg 2.0.3, ogb 1.3.4, numpy 1.19.5, torchvision 0.10.0, and CUDA 11.1. \subsection{Hyperparameter Details} \label{appendix:hyperparameter} We provide details about hyparatemeters of \name and R\name in Table~\ref{tab:citation_hyper}, \ref{tab:heterophily_hyper}, \ref{tab:co-author_hyper}, \ref{tab:products_hyper}, and \ref{tab:citation_hyper_flip}. \begin{table}[t] \setlength{\tabcolsep}{0.6mm} \caption{The hyper-parameters for \name and R\name on three citation datasets.} \label{tab:citation_hyper} \vskip 0.15in \centering \begin{tabular}{l|c|c|c|c|c|c|c|c|c|c} \toprule Model & dataset & runs & lr & epochs & wight decay & hidden & dropout & $S$ & $\lambda$ & $\epsilon$\\ \midrule \name & Cora & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & - \\ \name & Citeseer & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & - \\ \name & Pubmed & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & - \\ \hline R\name & Cora & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & 1 \\ R\name & Citeseer & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & 1 \\ R\name & Pubmed & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & 1 \\ \bottomrule \end{tabular} \end{table} \begin{table}[t] \setlength{\tabcolsep}{0.6mm} \caption{The hyper-parameters for \name and R\name on four heterophily graphs.} \label{tab:heterophily_hyper} \vskip 0.15in \centering \begin{tabular}{l|c|c|c|c|c|c|c|c|c|c|c|c} \toprule Model & dataset & noise level & runs & lr & epochs & wight decay & hidden & dropout & $S$ & $\lambda$ & $\epsilon$ & +MLP\\ \midrule \name & Cornell & 0.01 & 10 & 0.2 & 200 & 5e-4 & 16 & 0.5 & 16 & 1 & - & y \\ \name & Cornell & 1 & 10 & 0.2 & 200 & 5e-4 & 16 & 0.5 & 16 & 1024 & - & y \\ \name & Texas & 0.01 & 10 & 0.2 & 200 & 5e-4 & 16 & 0.5 & 16 & 1 & - & y \\ \name & Texas & 1 & 10 & 0.2 & 200 & 5e-4 & 16 & 0.5 & 16 & 1024 & - & y \\ \name & Wisconsin & 0.01 & 10 & 0.2 & 1000 & 5e-4 & 16 & 0.5 & 2 & 1 & - & y \\ \name & Wisconsin & 1 & 10 & 0.2 & 1000 & 5e-4 & 16 & 0.5 & 2 & 1024 & - & y \\ \name & Actor & 0.01 & 10 & 0.2 & 1000 & 5e-4 & 16 & 0.5 & 2 & 1 & - & y \\ \name & Actor & 1 & 10 & 0.2 & 1000 & 5e-4 & 16 & 0.5 & 2 & 1024 & - & y \\ \hline R\name & Cornell & 0.01 & 10 & 0.2 & 200 & 5e-4 & 16 & 0.5 & 16 & 1 & 1 & y \\ R\name & Cornell & 1 & 10 & 0.2 & 200 & 5e-4 & 16 & 0.5 & 16 & 1024 & 1 & y \\ R\name & Texas & 0.01 & 10 & 0.2 & 200 & 5e-4 & 16 & 0.5 & 16 & 1 & 1 & y \\ R\name & Texas & 1 & 10 & 0.2 & 200 & 5e-4 & 16 & 0.5 & 16 & 1024 & 1 & y \\ R\name & Wisconsin & 0.01 & 10 & 0.2 & 1000 & 5e-4 & 16 & 0.5 & 2 & 1 & 1e-5 & y \\ R\name & Wisconsin & 1 & 10 & 0.2 & 1000 & 5e-4 & 16 & 0.5 & 2 & 1024 & 1e-5 & y \\ R\name & Actor & 0.01 & 10 & 0.2 & 1000 & 5e-4 & 16 & 0.5 & 2 & 1 & 1e-5 & y \\ R\name & Actor & 1 & 10 & 0.2 & 1000 & 5e-4 & 16 & 0.5 & 2 & 1024 & 1e-5 & y \\ \bottomrule \end{tabular} \end{table} \begin{table}[t] \setlength{\tabcolsep}{0.6mm} \caption{The hyper-parameters for \name and R\name on two co-author datasets.} \label{tab:co-author_hyper} \vskip 0.15in \centering \begin{tabular}{l|c|c|c|c|c|c|c|c|c|c|c} \toprule Model & dataset & noise level & runs & lr & epochs & wight decay & hidden & dropout & $S$ & $\lambda$ & $\epsilon$ \\ \midrule \name & Coauthor-CS & 0.1 & 10 & 0.2 & 1000 & 1e-7 & 0 & 0 & 16 & 1 & - \\ \name & Coauthor-CS & 1 & 10 & 0.2 & 1000 & 1e-7 & 0 & 0 & 16 & 128 & - \\ \name & Coauthor-Phy & 0.1 & 10 & 0.2 & 200 & 5e-4 & 16 & 0.5 & 16 & 1 & - \\ \name & Coauthor-Phy & 1 & 10 & 0.2 & 200 & 5e-4 & 16 & 0.5 & 16 & 1024 & - \\ \hline R\name & Coauthor-CS & 0.1 & 10 & 0.2 & 1000 & 1e-7 & 0 & 0 & 16 & 1 & 1 \\ R\name & Coauthor-CS & 1 & 10 & 0.2 & 1000 & 1e-7 & 0 & 0 & 16 & 128 & 1 \\ R\name & Coauthor-Phy & 0.1 & 10 & 0.2 & 200 & 5e-4 & 16 & 0.5 & 16 & 1 & 1 \\ R\name & Coauthor-Phy & 1 & 10 & 0.2 & 200 & 5e-4 & 16 & 0.5 & 16 & 1024 & 1 \\ \bottomrule \end{tabular} \end{table} \begin{table}[t] \setlength{\tabcolsep}{0.6mm} \caption{The hyper-parameters for \name and R\name on ogbn-products dataset.} \label{tab:products_hyper} \vskip 0.15in \centering \begin{tabular}{l|c|c|c|c|c|c|c|c|c|c|c} \toprule Model & noise level & runs & lr & epochs & hidden & dropout & $S$ & $\lambda$ & $\epsilon$ & layers & +MLP \\ \midrule \name & 0.1 & 10 & 0.01 & 300 & 256 & 0.5 & 128 & 32 & - & 3 & y \\ \name & 1 & 10 & 0.01 & 300 & 256 & 0.5 & 128 & 256 & - & 3 & y\\ \hline R\name & 0.1 & 10 & 0.01 & 300 & 256 & 0.5 & 128 & 32 & 1e-2 & 3 & y \\ R\name & 1 & 10 & 0.01 & 300 & 256 & 0.5 & 128 & 256 & 1e-2 & 3 & y\\ \bottomrule \end{tabular} \end{table} \begin{table}[t] \setlength{\tabcolsep}{0.6mm} \caption{The hyper-parameters for \name and R\name on three citation datasets of the flipping experiments.} \label{tab:citation_hyper_flip} \vskip 0.15in \centering \begin{tabular}{l|c|c|c|c|c|c|c|c|c|c|c} \toprule Model & dataset & flip probability & runs & lr & epochs & wight decay & hidden & dropout & $S$ & $\lambda$ & $\epsilon$\\ \midrule \name & Cora & 0.1 & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 32 & 64 & - \\ \name & Cora & 0.2 & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & - \\ \name & Cora & 0.4 & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & - \\ \name & Citeseer & 0.1 & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & - \\ \name & Citeseer & 0.2 & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & - \\ \name & Citeseer & 0.4 & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & - \\ \name & Pubmed & 0.1 & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & - \\ \name & Pubmed & 0.2 & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & - \\ \name & Pubmed & 0.4 & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & - \\ \hline R\name & Cora & 0.1 & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 32 & 64 & 1e-5 \\ R\name & Cora & 0.2 & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & 1e-5 \\ R\name & Cora & 0.4 & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & 1e-1 \\ R\name & Citeseer & 0.1 & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & 1e-5 \\ R\name & Citeseer & 0.2 & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & 1e-5 \\ R\name & Citeseer & 0.4 & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & 1e-5 \\ R\name & Pubmed & 0.1 & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & 1e-1 \\ R\name & Pubmed & 0.2 & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & 1e-1 \\ R\name & Pubmed & 0.4 & 100 & 0.2 & 100 & 1e-5 & 0 & 0 & 16 & 32 & 1e-1 \\ \bottomrule \end{tabular} \end{table} \section{Additional Experiments} \subsection{Analysis on Row Normalization} \label{appendix:row norm} \begin{table}[htbp] \normalsize \caption{Summary of results of NGC w/o raw normalization on three datasets in terms of classification accuracy (\%)} \label{tab:row normalization} \setlength{\tabcolsep}{2.5mm} \begin{center} \begin{tabular}{cccccccccc} \toprule \multirow{2}{*}{Noise Level} & \multicolumn{3}{c}{Cora} & \multicolumn{3}{c}{Citeseer} & \multicolumn{3}{c}{Pubmed} \\ \cmidrule(r){2-4} \cmidrule(r){5-7} \cmidrule(r){8-10} & 1 & 10 & 100 & 1 & 10 & 100 & 1 & 10 & 100 \\ \midrule w/o RN &68.3 &59.7 &56.1 &43.5 &40.4 &37.6 &43.1 &38.8 &37.4 \\ w RN &66.1 &65.5 &66.2 &45.3 &45.1 &44.8 &62.3 &62.7 &62.1 \\ \bottomrule \end{tabular} \end{center} \end{table} In this section, we analyze the influence of row normalization on denoising performance. The noise level $\xi$ controls the magnitude of the Gaussian noise we add to the feature matrix: $\mathbf{X}+\xi\bm{\eta}$ where $\bm{\eta}$ is sampled from standard i.i.d., Gaussian distribution. For Cora, Citeseer, and Pubmed, we test $\xi \in \{1, 10, 100\}$. From Table~\ref{tab:row normalization}, we can observe that the denoising performance of w/ row normalization is better than w/o row normalization. Since row normalization can shrink the value of elements in $\bm{\eta}$, thus reducing the variance $\sigma$. In other words, row normalization make $\left\|\widetilde{\bm{\mathcal{A}}}_S\bm{\eta}\right\|_{F}^{2}$ converge to zero faster. \subsection{Analysis on the Depth of \name and R\name} \label{appendix:depth analysis} In this section, we analyze the influence of the depth of \name and R\name model on denoising performance by testing the classification accuracy on semi-supervised node classification tasks. We conduct two sets of experiments: with/without noise in feature matrix. For experiment with feature noise, we simple fix the noise level $\xi =1$. In each set of experiments, we evaluate the test accuracy with respect to \name and R\name model depth, which corresponding to the value of $S$ in $\widetilde{\mathcal{A}}_{S}$. From Figure~\ref{fig:depth_ngc} and \ref{fig:depth_rngc}, we can observe that the test accuracy barely changes with depth if the model is trained on the clean features on Cora and Pubmed but changes greatly if the model is trained on the clean feature on Citeseer. In this regard, the over-smoothing issue exists in R\name model on citeseer. However, the denoising performance of shallow R\name is not good as deeper R\name models, especially on the large graph like Pubmed. This suggests that we do need to increase the depth of GNN model to include more higher-order neighbors for better denoising performances. \begin{figure}[t] \begin{center} \includegraphics[width=0.325\textwidth]{images/cora_compar.pdf} \includegraphics[width=0.325\textwidth]{images/citeseer_compar.pdf} \includegraphics[width=0.325\textwidth]{images/pubmed_compar.pdf} \end{center} \caption{Comparison of classification accuracy v.s. \name model depth on semi-supervised node classification tasks. The experiments are conducted on clean and noisy features.} \label{fig:depth_ngc} \end{figure} \begin{figure}[t] \begin{center} \includegraphics[width=0.325\textwidth]{images/cora_compar_rngc.pdf} \includegraphics[width=0.325\textwidth]{images/citeseer_compar_rngc.pdf} \includegraphics[width=0.325\textwidth]{images/pubmed_compar_rngc.pdf} \end{center} \caption{Comparison of classification accuracy v.s. R\name model depth on semi-supervised node classification tasks. The experiments are conducted on clean and noisy features.} \label{fig:depth_rngc} \end{figure} \section{Introduction} \input{01introduction} \section{A Simple Unifying Framework: Neumann Graph Convolution} \label{sec:NGC} \input{03NGC} \section{Main Theory} \label{sec:main theory} \input{04theory} \section{Robust Neumann Graph Convolution} \label{sec:RNGC} \input{05adversarial} \section{Experiments} \label{sec:experiments} \input{06experiment} \section{Related Work} \input{07related} \section{Conclusion} \input{08conclusion} \newpage \normalem
{'timestamp': '2022-09-30T02:06:31', 'yymm': '2209', 'arxiv_id': '2209.14514', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14514'}
arxiv
\section{Introduction} \label{sec:intro} The principal component analysis (PCA) model postulates that $N$ independent realisations of $K$-dimensional data ${\bf x}_i \in \mathbb{R}^K$ ($i=1,\ldots,N$) are described as \begin{equation} \label{eqn:mfa} {\bf x}_i = v_{i1} {\bf a}_1 + \cdots + v_{iJ} {\bf a}_J + \bm{\epsilon}_i = \left(\sum_{j=1}^J v_{ij} {\bf a}_j\right) + \bm{\epsilon}_i, \quad \bm{\epsilon} \sim {\rm N}_K ({\bf 0}_K, \sigma^2 {\bf I}_K), \end{equation} where $\{{\bf a}_1, \ldots, {\bf a}_J\}$ are the $J (< K)$ latent (unobserved) factor loadings with each factor loading ${\bf a}_j \in \mathbb{R}^K$, and ${\bf v}_j \sim {\rm N}({\bf 0}_N, {\bf I}_N)$ are the factor scores distributed as per the standard normal distribution. It is assumed that the residuals follow an isotropic zero mean normal distribution with the variance-covariance matrix $\sigma^2 {\bf I}_K$. Without loss of generality, we assume that the data has been centered to the mean. We can write this PCA model in matrix notation as follows \begin{equation} {\bf x}_i = {\bf A} {\bf v}_i + \bm{\varepsilon}, \quad {\bf A} \in \mathbb{R}^{K \times J}, \quad {\bf v}_i \in \mathbb{R}^J, \quad \bm{\varepsilon} \sim N_K({\bf 0}, \sigma^2 {\bf I}_K), \end{equation} where $i = (1,\ldots,N)$, ${\bf A} = ({\bf a}_1, \ldots, {\bf a}_J)$ and ${\bf V} = ({\bf v}_1, \ldots, {\bf v}_N) \in \mathbb{R}^{J \times N}$. Integrating out the factor scores yields the multivariate Gaussian marginal distribution of the data \begin{equation} \label{eqn:y:marginal} {\bf x}_i \sim N_K({\bf 0}_K, \bm{\Sigma}_0), \quad \bm{\Sigma} = {\bf A} {\bf A}^\prime + \sigma^2 {\bf I}_K . \end{equation} The probabilistic principal component model as described suffers from identifiability constraints~\citep{AndersonRubin56,LawleyMaxwell71}. A key reason for this is that the latent factors affect the likelihood function only through their outer product ${\bf A} {\bf A}^\prime$, which implies that an estimate of the factors can only be determined up to a rotation. To ensure the model is not over parametarised, the maximum number of latent factors to be estimated cannot exceed \begin{equation} J_\text{MAX} \leq K + \frac{1}{2} \left(1-\sqrt{8k + 1}\right) , \end{equation} see \citep{Beal03} (pp. 108) for details. For example, when $K = 4,5,6$ we have $J_\text{MAX} = 1, 2, 3$, respectively. \cite{TippingBishop99} showed how to interpret standard PCA model in a probabilistic framework and obtained maximum likelihood estimates of the latent factors and residual variance. This manuscript examines estimation of the probabilistic PCA model under the Bayesian minimum message length (MML) inductive inference framework. Although single and multiple factor analysis has been examined within the MML framework by \cite{WallaceFreeman92} and \cite{Wallace98} respectively, this manuscript departs from the earlier work in the following: \begin{itemize} \item We consider the marginal distribution of the data (\ref{eqn:y:marginal}) rather than the model (\ref{eqn:mfa}) analysed by \cite{Wallace98}. % \item Using polar decomposition, we write the factor load matrix ${\bf A}$ as a product of an orthogonal matrix and a diagonal matrix representing the direction and length of the loadings, respectively. Unlike the earlier MML approaches, we parameterize the orthogonal matrix via Givens rotations to explicitly capture orthogonality constraints. % \item We use matrix polar decomposition to develop a prior distribution for the latent factors ${\bf A}$ that is a product of a matrix variate Cauchy distribution and a uniform distribution over the corresponding Stiefel manifold. % \item We obtain analytic MML estimates of the parameters and find a polynomial whose roots yield the MML estimate of the residual variance. \end{itemize} \section{Maximum likelihood estimation} This section summarises the results of \cite{TippingBishop99}. The negative log-likelihood of the data under the probabilistic PCA model is \begin{equation} \ell (\bm{\theta} ) = \frac{N K}{2} \log (2\pi) + \frac{N}{2} \log |\bm{\Sigma} | + \frac{N}{2} {\rm tr} \left(\bm{\Sigma}^{-1} {\bf S}_x\right) \end{equation} where ${\bf S}_x = \frac{1}{N}\sum_i {\bf x}_i {\bf x}_i^\prime$ is the sample variance-covariance matrix. We have the observed data ${\bf X}$ and wish to estimate the number of latent factors $J$ and all parameters $\bm{\theta} = \left\{{\bf A},\sigma^2\right\}$. Differentiating the negative log-likelihood with respect to the factor loads \begin{align*} \partial \ell(\bm{\theta}) &= N {\rm tr} \, {\bf A}^\prime \bm{\Sigma}^{-1}(\partial {\bf A}) - N {\rm tr} \left( {\bf A}^\prime \bm{\Sigma}^{-1} {\bf S}_x \bm{\Sigma}^{-1} (\partial {\bf A}) \right) \end{align*} and setting the derivatives to zero we get \begin{align*} {\bf S}_x {\bf \Sigma}^{-1} {\bf A} &= {\bf A} \end{align*} Consider the singular value decomposition ${\bf A} = {\bf U} {\bf L} {\bf V}^\prime$, where ${\bf U} \in \mathbb{R}^{K\times J}$, ${\bf L} = {\rm diag}(l_1,\ldots,l_j)$ and ${\bf V} \in \mathbb{R}^{J\times J}$ is an orthogonal matrix. Noting that $\bm{\Sigma}^{-1} {\bf A} = {\bf U} {\bf L} ({\bf L}^2 + \sigma^2 {\bf I}_J )^{-1} {\bf V}^\prime$, we have \begin{align*} {\bf S}_x {\bf U} &= {\bf U} ({\bf L}^2 + \sigma^2 {\bf I}_J ) \\ {\bf S}_x {\bf u}_j &= (l_j^2 + \sigma^2 ) {\bf u}_j, \quad (j=1,\ldots,J), \end{align*} which is an example of the eigenvalue problem. That is, ${\bf U}$ is a $(K\times J)$ matrix whose columns are the top $J$ eigenvectors of the sample covariance matrix ${\bf S}_x$ corresponding to the $J$ largest eigenvalues \begin{eqnarray} \delta_j = \hat{l}^2_j + \sigma^2, \quad j=1,\ldots, J, \end{eqnarray} where $\hat{l}_j = (\delta_j - \sigma^2)^{\frac{1}{2}}$ is the $j$-th largest singular value of ${\bf A}$. Without loss of generality we assume that $\delta_1 > \delta_2 > \ldots > \delta_K > 0$ throughout the manuscript. This implies that the maximum likelihood estimate is \begin{eqnarray} \hat{\bf A}_\text{ML} = {\bf U} (\bm{\Delta} - \sigma^2 {\bf I}_J )^\frac{1}{2} {\bf O}, \quad \bm{\Delta} = {\rm diag}(\delta_1, \ldots, \delta_J) \end{eqnarray} where ${\bf O}$ is an arbitrary (orthogonal) rotation matrix and $\bm{\Delta}$ is a diagonal matrix with the $J$-th largest eigenvalues of ${\bf S}_x$. Substituting the maximum likelihood estimate of the factor loads into the negative log-likelihood we have \begin{align} \ell (\sigma, \hat{\bf A}_{\text{ML}} ) = \frac{N K}{2} \log (2\pi) + \frac{N}{2} \sum_{i=1}^J \log \delta_j + \frac{N (K-J)}{2} \log \sigma^2 + \frac{N J}{2} + \frac{N}{2 \sigma^2} \sum_{j=J+1}^K \delta_j . \end{align} The concentrated negative log-likelihood is minimised by \begin{align} \hat{\sigma}^2 = \frac{1}{K-J} \sum_{j=J+1}^K \delta_j \end{align} which is the sum of the (K-J) smallest eigenvalues of the sample variance-covariance matrix. \cite{TippingBishop99} show that these estimates minimise the negative log-likelihood and discuss other saddle points of the log-likelihood function. \section{Minimum message length analysis of the PCA model} Under suitable regularity conditions~\citep{Wallace05}) (pp. 226), the MML87 codelength approximation for data ${\bf x}$ is \begin{equation} \label{eqn:mml87:codelength} \mathcal{I}_{87}({\bf x}, \bm{\theta}) = \underbrace{-\log \pi(\bm{\theta}) + \frac{1}{2} \log \abs{{\bf J}_{\bm{\theta}}(\bm{\theta})} + \frac{P}{2} \log \kappa_P}_{\rm assertion} + \underbrace{\frac{P}{2} - \log p({\bf x}|\bm{\theta})}_{\rm detail} \end{equation} where $\pi_{\bm{\theta}}(\bm{\theta})$ is the prior distribution for the parameters $\bm{\theta}$, $\abs{{\bf J}_{\bm{\theta}}(\bm{\theta})}$ is the determinant of the expected Fisher information matrix, $p({\bf x}|\bm{\theta})$ is the likelihood function of the model and $\kappa_P$ is a quantization constant~\citep{ConwaySloane98,AgrellEriksson98}; for small $P$ we have \begin{equation} \kappa_1 = \frac{1}{12}, \quad \kappa_2 = \frac{5}{36 \sqrt{3}}, \quad \kappa_3 = \frac{19}{192 \times 2^{1/3}}, \end{equation} while, for large $P$, $\kappa_P$ is well-approximated by~\citep{Wallace05}: \begin{equation} \frac{p}{2} (\log \kappa_p + 1) \approx -\frac{p}{2} \log 2\pi + \frac{1}{2} \log p \pi - \gamma, \end{equation} where $\gamma \approx 0.5772$ is the Euler--Mascheroni constant. \subsection{Orthogonality constraints} As discussed in Section~\ref{sec:intro}, it is well-known that the PCA model is not identifiable given the data. A key reason for this is that the latent vectors affect the likelihood only through their outer product $ {\bf A} {\bf A}^\prime = \sum_{j=1}^J {\bf a}_j {\bf a}^\prime_j. $ However, there are infinitely many sets of vectors that could generate the same matrix. To resolve this ambiguity, it is a convention to estimate the factor load vectors to be mutually orthogonal; that is, \begin{equation} {\bf A}^\prime {\bf A} = \bm{\alpha} = {\rm diag}(\alpha^2_1, \ldots, \alpha^2_J), \quad \alpha_j = ({\bf a}_j^\prime {\bf a}_j)^{\frac{1}{2}}, \quad (j=1,\ldots, J), \end{equation} where $\alpha_j$ denote the length of the $j$-th load vector. We enforce orthogonality constraints by parameterizing the matrix ${\bf A}$ in terms of Givens rotations ~\cite{PourzanjaniEtAl21}. Specifically, we can write ${\bf A}$ as \begin{align} {\bf A} &= \left[ R_{12}(\phi_{1,2}) \cdots R_{1,K}(\phi_{1,K}) R_{2,3}(\phi_{2,3}) \cdots R_{2,K}(\phi_{2,K}) \cdots R_{J,J+1}(\phi_{J,J+1}) \cdots R_{J,K}(\phi_{J,K}) {\bf I}_{K,J} \right] \bm{\alpha} \\ % &= {\bf R} \, \bm{\alpha} \end{align} where ${\bf I}_{K,J}$ is the first $J$ columns of a $K \times K$ identity matrix and $R_{i,j}(\phi_{i,j})$ is a $(K \times K)$ rotation matrix that is equal to the identity matrix except for the $(i, i)$ and $(j, j)$ positions which are replaced by $\cos (\phi_{i,j})$, and the $(i, j)$ and $(j, i)$ positions which are replaced by $-\sin (\phi_{i,j})$ and $\sin (\phi_{i,j})$ respectively. Thus ${\bf R} \in \mathbb{R}^{K \times J}$ and $\bm{\alpha} \in \mathbb{R}^{J \times J}$ denote the orientations and lengths of the factor load vectors, respectively. For example, when $K=J=2$, we have \begin{equation} {\bf A} = \left( \begin{array}{cc} \cos \left(\phi_{1,2}\right) & -\sin \left(\phi_{1,2}\right) \\ \sin \left(\phi_{1,2}\right) & \cos \left(\phi_{1,2}\right) \\ \end{array} \right) \left( \begin{array}{cc} 1 & 0 \\ 0 & 1 \\ \end{array} \right) \left( \begin{array}{c} \alpha _1 \\ \alpha _2 \\ \end{array} \right) . \end{equation} This parametarization explicitly takes into account that the estimated factor loads are pairwise orthogonal. The model parameters are now \begin{itemize} \item the lengths of the latent factors $\bm{\alpha}=(\alpha_1, \ldots, \alpha_J) \in \mathbb{R}_+^J$, \item the orientation of the factor load vectors as captured by the $D = J K- J(J+1)/2$ angles \begin{equation*} \bm{\phi} = (\phi_{1,2},\ldots,\phi_{1,K}, \phi_{2,3}, \ldots, \phi_{2,K},\ldots,\phi_{J,J+1},\ldots,\phi_{J,K}) \end{equation*} \item and the residual variance $\sigma^2 > 0$. \end{itemize} \subsection{Fisher information} Following lengthy and tedious algebra, the expected Fisher information matrix is seen to be block diagonal with determinant \begin{align} | {\bf J}(\bm{\alpha},\sigma,\bm{\phi}) | &= N^{P} | {\bf J}(\bm{\alpha},\sigma) | \, | {\bf J}(\bm{\phi}) | \\ | {\bf J}(\bm{\alpha},\sigma) | &= \frac{2^{J+1} (K-J)}{{\sigma^2}} \prod _{j=1}^J \frac{\alpha_j^2}{\left(\alpha_j^2+\sigma ^2\right)^2} \\ | {\bf J}(\bm{\phi}) | &= |J_{{\bf A} \to \bm{\phi}}|^2 \left(\prod _{i=1}^J \left(\frac{\alpha_i^4}{\sigma ^2}\right){}^{K-J} \frac{1}{\left(\alpha_i^2+\sigma ^2\right){}^{K-1}}\right) \prod _{j<k} \left(\alpha_j^2-\alpha_k^2\right)^2 \end{align} where $|J_{{\bf A} \to \bm{\phi}}|$ is the transformation of measure under the Givens representation~\citep{PourzanjaniEtAl21} \begin{equation*} |J_{{\bf A} \to \bm{\phi}}| = \prod_{i=1}^J \prod_{j=i+1}^K (\cos \phi_{i,j})^{j-i-1} , \end{equation*} and $P = (D + J + 1)$ is the total number of free parameters. Combining all the terms we have \begin{align} | {\bf J}(\bm{\alpha},\sigma,\bm{\phi}) | &= N^{P} \frac{\left(2^{J+1} (K-J)\right)}{{\sigma^2}} |J_{{\bf A} \to \bm{\phi}}|^2 \left(\prod _{i=1}^J \frac{\alpha_i^2}{\left(\alpha_i^2+\sigma ^2\right)^2} \left(\frac{\alpha_i^4}{\sigma ^2}\right){}^{K-J} \frac{1}{\left(\alpha_i^2+\sigma ^2\right){}^{K-1}}\right) \prod _{j<k} \left(\alpha_j^2-\alpha_k^2\right)^2 \nonumber \\ &= \frac{N^{P} 2^{J+1} (K-J) |J_{{\bf A} \to \bm{\phi}}|^2}{{\sigma^{2(J(K-J)+1)}}} \prod_{i=1}^J \frac{\alpha_i^{4(K-J)+2}}{\left(\alpha_i^2+\sigma ^2\right)^{K+1}} \prod _{j<k}^J \left(\alpha_j^2-\alpha_k^2\right)^2 \end{align} \subsection{Prior information} \label{sec:mfa:priors} The prior distribution for the residual standard deviation $\bm{\Sigma}^{\frac{1}{2}}$ is chosen to be the scale-invariant density \begin{equation} \label{eqn:prior:sigma} \pi_\sigma(\sigma) \propto \sigma^{-1}, \end{equation} defined over some suitable range. The prior distribution for the matrix of factor loads ${\bf A} \in \mathbb{R}^{K \times J}$ is not immediately obvious as the estimates of the factor loads are enforced to be mutually orthogonal. Ideally, we would like a prior distribution that is uniform over the direction of the $J$ factors, while the distribution of the lengths of these vectors should be heavy tailed to allow for a wide range of lengths. We follow a similar approach to \cite{Wallace98} and assume a prior distribution over the unknown latent vectors that is then transformed to account for the estimated factors being mutally orthogonal. Further, as in~\cite{Wallace98}, we shall consider a prior distribution for the scaled factors \begin{align*} {\bf b}_j = \left( \frac{{\bf a}_j}{\sigma} \right), \quad \beta_j = ({\bf b}_j^\prime {\bf b}_j)^{\frac{1}{2}}, \quad (j=1,\ldots,J) \end{align*} where the residual variance is used as a default scale. Let $\tilde{\bf B} \in \mathbb{R}^{K \times J}$ denote the matrix containing the $J$ true (unknown) scaled factors. We assume $\tilde{\bf B}$ to follow a matrix variate Cauchy distribution~\citep{BandekarDaya03} with probability density function \begin{equation} \pi_{\tilde{A}}(\tilde{\bf B}) = \frac{\Gamma_K((K+J)/2)}{\pi^{K J / 2} \Gamma_K(K/2)} {\rm det}({\bf I}_K + \tilde{\bf B} \tilde{\bf B}^\prime)^{-(K+J)/2}. \end{equation} This is a reasonable choice as the matrix variate Cauchy is spherically symmetric and has appropriately heavy tails. Further, our choice of the prior distribution implies that $\tilde{\bf B}^\prime \in \mathbb{R}^{J \times K}$ follows a matrix variate Cauchy distribution with density \begin{equation} \pi_{\tilde{B}^\prime}(\tilde{\bf B}^\prime) = \frac{\Gamma_J((K+J)/2)}{\pi^{K J / 2} \Gamma_J(J/2)} {\rm det}({\bf I}_J + \tilde{\bf B}^\prime \tilde{\bf B})^{-(K+J)/2} . \end{equation} Consider the unique matrix polar decomposition \begin{equation} \tilde{\bf B}^\prime = {\bf W}_B^{\frac{1}{2}} \, {\bf H}_B, \quad {\bf W}_B = \tilde{\bf B}^\prime \tilde{\bf B}, \quad {\bf H}_B = (\tilde{\bf B}^\prime \tilde{\bf B})^{-\frac{1}{2}} \tilde{\bf B}^\prime \end{equation} where ${\bf H}_B$ is defined over the Stiefel manifold $\mathcal{V}_J (\mathbb{R}^K )$ and ${\bf W}_B$ is a symmetric positive definite matrix. We may think of the matrix ${\bf H}_B$ as the orientation matrix, while the matrix ${\bf W}_B$ determines the squared lengths of the true scaled latent vectors. If $\tilde{\bf B}^\prime$ follows a matrix variate Cauchy distribution, it is known that ${\bf H}_B$ is distributed uniformly over the Stiefel manifold with density function~\citep{BandekarDaya03}: \begin{equation} \pi_H({\bf H}_B) = \frac{1}{{\rm Vol}( \mathcal{V}_{J} (\mathbb{R}^K ) )}, \quad {\rm Vol}(\mathcal{V}_J (\mathbb{R}^K ) ) = \frac{ 2^J \pi^{K J / 2} } { \Gamma_J (K/2)} , \end{equation} where $\Gamma_p( y )$ is the multivariate Gamma function \begin{align*} \Gamma_J(y) = \pi^{J(J-1)/4} \prod_{j=1}^J \Gamma(y + (1-j)/2) . \end{align*} Further, the random variable ${\bf W}_B$ representing the squared lengths of the true scaled factors is independent of ${\bf H}_B$ with probability density function~\cite{BandekarDaya03} \begin{eqnarray} \pi_W({\bf W}_B) &\propto& {\rm det}( {\bf W}_B )^{(K - J - 1)/2} {\rm det}({\bf I}_K + {\bf W}_B)^{-(K+J)/2} \end{eqnarray} which is a matrix variate beta type II distribution ${\bf W}_B \sim B_J^{II}(K/2, J/2)$ with parameters $(K/2, J/2)$ (see~\cite{GuptaNagar99}, pp. 166, for further details); this is also known as the matrix variate $F$ distribution. Recall that the estimated (scaled) factor load vectors obey \begin{equation} {\bf S}_B = \tilde{\bf B}\tilde{\bf B}^\prime = \sum_{j=1}^J \tilde{\bm{\beta}}_j \tilde{\bm{\beta}}_j^\prime = \sum_{j=1}^J \bm{\beta}_j \bm{\beta}_j^\prime = {\bf B} {\bf B}^\prime , \quad \bm{\beta}_j^\prime \bm{\beta}_{k \neq j} = 0 . \end{equation} where ${\bf S}_B$ is a $(K \times K)$ symmetric matrix of rank $J$. The distribution of the squared scaled lengths $\beta_j^2$ of the estimated latent vectors can then be taken as the joint distribution of the $J$ eigenvalues of ${\bf S}_B$ which is (see Appendix~F) \begin{align} \pi_{\bm{\beta}^2}(\beta_1^2,\ldots,\alpha_J^2) &= \frac{\pi^{J^2/2}}{\Gamma_J(J/2) \mathcal{B}_J(K/2,J/2)}\prod_{j=1}^J \beta_j^{(K-J-1)} (1 + \beta_j^2)^{-(K+J)/2} \prod_{j<k}^J | \beta_j^2 - \beta_k^2| , \nonumber \end{align} where $\mathcal{B}_p(a,b)$ denote the multivariate beta function \begin{align*} \mathcal{B}_J(a,b) = \frac{\Gamma_J(a) \Gamma_J(b)}{\Gamma_J(a+b)}. \end{align*} This implies that the prior distribution of the lengths of the scaled latent factors is \begin{align} \pi_{\bm{\beta}}(\beta_1,\ldots,\beta_J) &= \frac{2^J \pi^{J^2/2}}{\Gamma_J(J/2) \mathcal{B}_J(K/2,J/2)}\prod_{j=1}^J \beta_j^{(K-J)} (1 + \beta_j^2)^{-(K+J)/2} \prod_{j<k}^J | \beta_j^2 - \beta_k^2| . \end{align} Finally, the prior distribution for the lengths of the (unscaled) latent factors is \begin{align} \pi_{\bm{\alpha}}(\alpha_1,\ldots,\alpha_J) &= \frac{2^J \pi^{J^2/2} \sigma ^{J^2}}{\Gamma_J(J/2) \mathcal{B}_J(K/2,J/2) }\prod_{j=1}^J \alpha_j^{(K-J)} (\sigma^2 + \alpha_j^2)^{-(K+J)/2} \prod_{j<k}^J | \alpha_j^2 - \alpha_k^2| . \label{eqn:prior:len:b} \end{align} The complete prior distribution over all model parameters is \begin{align} \pi(\bm{\alpha},\sigma,\bm{\phi}) = \pi_\sigma(\bm{\Sigma}^{\frac{1}{2}}) \, \pi_{\bm{\alpha}}(\alpha_1,\ldots,\alpha_J) |J_{{\bf A} \to \bm{\phi}}| \, J! , \end{align} where the term $J!$ is included because the labelling of the latent factors is arbitrary and $|J_{{\bf A} \to \bm{\phi}}|$ is the transformation of measure from the matrix parametrization ${\bf A}$ to the orthogonality-preserving parameterization based on Givens rotations. \subsection{Codelength} Omitting constants, the \cite{WallaceFreeman87} codelength for the probabilistic PCA model is \begin{align*} \mathcal{I} &\propto \frac{N}{2} \log |\bm{\Sigma}| + \frac{N}{2} {\rm tr} \left( \bm{\Sigma}^{-1} {\bf S}_x\right) - K J \log (\sigma ) + \frac{1}{2} \sum_{j=1}^J \log \left[\alpha_j ^{2 (K-J+1)} \left(\alpha_j ^2+\sigma^2\right)^{(J-1)} \right] \end{align*} where ${\bf S}_x = \frac{1}{N}\sum_i {\bf x}_i {\bf x}_i^\prime$ is the sample variance-covariance matrix. To obtain MML estimates, we start with the Langrangian of the factor orientations \begin{align*} \psi({\bf R}) &= \log |\bm{\Sigma} | + {\rm tr} \left(\bm{\Sigma}^{-1} {\bf S}_x\right) - {\rm tr} {\bf L} ({\bf R}^\prime {\bf R} - I) , \end{align*} where ${\bf L}$ is a $J \times J$ symmetric matrix of Lagrange multipliers. Clearly, minimising $\psi({\bf R})$ is equivalent to minimising the codelength with respect to ${\bf R}$. The first differential of the Lagrangian is \begin{align*} \partial \psi({\bf R}) &= 2 \text{tr} \left[\bm{\alpha} {\bf A}^\prime \left( \bm{\Sigma}^{-1} - \bm{\Sigma}^{-1} {\bf S}_x \bm{\Sigma}^{-1}\right) (d{\bf R})\right] - 2 \text{tr} \left( {\bf L} {\bf R}^\prime (d{\bf R}) \right) , \end{align*} which implies the following first order conditions \begin{align} \bm{\alpha} {\bf A}^\prime \left( \bm{\Sigma}^{-1} - \bm{\Sigma}^{-1} {\bf S}_x \bm{\Sigma}^{-1}\right) &= {\bf 0} \label{eqn:lag:cond1}\\ {\bf L} {\bf R}^\prime &= {\bf 0} \label{eqn:lag:cond2} \\ {\bf R}^\prime {\bf R} &= {\bf I}_J \label{eqn:lag:cond3} \end{align} From (\ref{eqn:lag:cond2}) we have that ${\bf L} = {\bf 0}$ and from (\ref{eqn:lag:cond1}) \begin{align*} {\bf S}_x {\bf R} &= {\bf R} \, \text{diag} \left( \sigma^2 + \alpha_1^2, \ldots, \sigma^2 + \alpha_J^2\right) \\ {\bf S}_x {\bf r}_j &= {\bf r}_j (\sigma^2 + \alpha_j^2), \quad (j=1,\ldots,J) . \end{align*} We see that, at the codelength minimum, the MML estimate of the factor orientations is the matrix ${\bf R}$ whose columns are the top $J$ eigenvectors of the variance--covariance matrix ${\bf S}_x$ with eigenvalues $\delta_j = (\sigma^2 + \alpha_j^2)$, for $j = 1,\ldots J$. This is identical to the corresponding maximum likelihood estimate. The concentrated codelength, as a function of $\sigma^2$ is \begin{align} \mathcal{I}(\sigma) &\propto \frac{N}{2} \log \left( (\sigma^2)^{K-J} \prod_{j=1}^J (\alpha_j^2 + \sigma^2) \right) + \frac{N}{2 \sigma^2} \left(\sum_{j=1}^K \delta_j\right) - \frac{N}{2 \sigma^2} \sum_{j=1}^J \alpha_j^2 \nonumber \\ & \quad - K J \log (\sigma ) + \frac{1}{2} \sum_{j=1}^J \log \left[\alpha_j ^{2 (K-J+1)} \left(\alpha_j ^2+\sigma^2\right)^{(J-1)} \right] \nonumber \\ % &= \frac{N (K-J) - K J}{2} \log \left( \sigma^2 \right) + \frac{N}{2 \sigma^2} \left(\sum_{j=1}^K \delta_j\right) - \frac{N}{2 \sigma^2} \sum_{j=1}^J (\delta_j - \sigma^2) + \frac{(K-J+1)}{2} \sum_{j=1}^J \log \left(\delta_j - \sigma^2 \right) \label{eqn:msglen:conc} \end{align} The following theorem shows how to obtain the MML estimate of the residual variance from the concentrated message length. \begin{thm} \label{thm:mmlest} Let $\tau = \sigma^2$. The concentrated codelength (\ref{eqn:msglen:conc}) has $(J+1)$ stationary points whose location are the roots of the $n=(J+1)$-degree polynomial \begin{equation*} a_n \tau^n + a_{n-1} \tau^{n-1} + \cdots + a_1 \tau + a_0, \quad (0 < \tau < \delta_J) \end{equation*} with coefficients \begin{align*} a_0 &= - \hat{\tau}_{{\rm ML}} e_J, \\ a_j &= (-1)^{j+1} \left[ \hat{\tau}_{{\rm ML}} \, e_{J-j} + \left(1-\frac{(j-1) (J-1)}{N (K-J)}-\frac{K (J-j+1)}{N (K-J)}\right) e_{J-j+1} \right], \quad (1 \leq j \leq J) \\ % a_n &= (-1)^J \left[1 - \frac{J(J-1)}{N(K-J)}\right] \\ \end{align*} where the terms $e_t$ refer to elementary symmetric polynomials $e_t(\delta_1,\ldots,\delta_J)$ in $J$ variables $(\delta_1, \ldots, \delta_J)$. For example, for $J=3$, we have the following four elementary symmetric polynomials \begin{align*} e_0(\delta_1,\delta_2,\delta_3) &= 1 \\ e_1(\delta_1,\delta_2,\delta_3) &= \delta_1 + \delta_2 + \delta_3 \\ e_2(\delta_1,\delta_2,\delta_3) &= \delta_1 \delta_2 + \delta_1 \delta_3 + \delta_2 \delta_3 \\ e_3(\delta_1,\delta_2,\delta_3) &= \delta_1 \delta_2 \delta_3 . \end{align*} MML estimate of the residual variance is the stationary point in the domain $0 < \tau < \delta_J$ that yields the shortest codelength. MML estimates of the factor lengths can be obtained from $\hat{\alpha}_j = (\delta_j - \hat{\sigma}^2)^{\frac{1}{2}}$ for all $j = 1,\ldots,J$. % \end{thm} Importantly, all $(J+1)$ elementary symmetric polynomials can be efficiently computed in $O(J \log^2 J)$ time by Fast Fourier Transform (FFT) polynomial multiplication, following an algorithm widely attributed to Ben-Or. {\bf Example 1:} For a single latent factor ($J=1$), the stationary points of the concentrated codelength are the roots of the quadratic polynomial in $\tau$: \begin{align} - \delta_1 \hat{\tau}_{\text{ML}} + \left(\hat{\tau}_{\text{ML}} + c \delta_1 \right) \tau - \tau ^2=0, \quad c= 1-\frac{K}{N (K-1) }, \end{align} given by \begin{align*} \frac{1}{2}\left( \hat{\tau}_{\text{ML}} + c \, \delta_1 \pm \Delta^{\frac{1}{2}}\right), \quad \Delta = c^2 \delta _1^2+2 (c-2) \delta _1 \hat{\tau}_{\text{ML}}+\hat{\tau} _{\text{ML}}^2 . \end{align*} The quadratic polynomial has no real roots if: \begin{align} -\frac{c+2 \sqrt{1-c}-2}{c^2}<\frac{\delta_1}{\hat{\tau}_{\text{ML}}}<\frac{-c+2 \sqrt{1-c}+2}{c^2} \label{eqn:mml:1pc} \end{align} in which case the MML solution is the uncorrelated multivariate Gaussian model. For example, when $N = 25$ and $K = 4$, the quadratic will have no real roots if \begin{align*} 0.219 < \frac{\delta_1}{\delta_2 + \delta_3 + \delta_4} < 0.564 . \end{align*} In the limit as $N \to \infty$, we have \begin{align*} \lim_{N \to \infty} \pm \frac{c+2 \sqrt{1-c}-2}{c^2} = 1 . \end{align*} so that both the lower and upper bound in (\ref{eqn:mml:1pc}) approach 1. {\bf Example 2:} For a PCA model with two latent factors ($J=2$), the stationary points of the concentrated codelength are the roots of the cubic polynomial in $\tau$: \begin{align*} - \delta_1 \delta_2 \hat{\tau}_{\text{ML}} + \left( (\delta_1 + \delta_2) \hat{\tau}_{\text{ML}} + c_1 \delta_1 \delta_2 \right)\tau- \left(\hat{\tau}_{\text{ML}} + \left(c_0 + c_1\right) (\delta_1 + \delta_2)\right)\tau ^2 + (2 c_0+c_1) \tau ^3 \end{align*} where the constants \begin{align*} c_0 = \frac{K-1}{N(K-2) }, \quad c_1 = 1-\frac{2 K}{N(K-2) } , \end{align*} depend only on $N$ and $K$. \section{Experiments} \subsection{Parameter estimation} \label{sec:exp:pest} \begin{table*}[tbph] \scriptsize \begin{center} \begin{tabular}{ccccccccccccccc} \toprule $N$ & $K$ & $J$ & \multicolumn{2}{c}{$S_1$} & & \multicolumn{2}{c}{$S_2$} & & \multicolumn{2}{c}{KL Divergence} \\ & & & MLE & MML87 & ~ & MLE & MML87 & ~ & MLE & MML87 \\ \cmidrule{1-11} \multirow{9}{*}{25} & \multirow{3}{*}{5} & 1 & -0.072 & {\bf -0.023} & & 0.011 & {\bf 0.007} & & 0.167 & {\bf 0.130} \\ & & 2 & -0.093 & {\bf 0.001} & & 0.021 & {\bf 0.009} & & 0.279 & {\bf 0.179} \\ & \multirow{3}{*}{8} & 1 & -0.069 & {\bf -0.030} & & 0.008 & {\bf 0.004} & & 0.244 & {\bf 0.194} \\ & & 2 & -0.120 & {\bf -0.021} & & 0.018 & {\bf 0.005} & & 0.463 & {\bf 0.285} \\ & & 4 & -0.103 & {\bf 0.038} & & 0.020 & {\bf 0.007} & & 0.647 & {\bf 0.353} \\ & \multirow{3}{*}{16} & 1 & -0.066 & {\bf -0.034} & & 0.006 & {\bf 0.003} & & 0.407 & {\bf 0.332} \\ & & 2 & -0.111 & {\bf -0.040} & & 0.014 & {\bf 0.003} & & 0.818 & {\bf 0.557} \\ & & 4 & -0.207 & {\bf -0.012} & & 0.045 & {\bf 0.003} & & 1.809 & {\bf 0.764} \\ \vspace{-2mm} \\ \cmidrule{2-11} \vspace{-2mm} \\ \multirow{9}{*}{50} & \multirow{3}{*}{5} & 1 & -0.035 & {\bf -0.009} & & 0.004 & {\bf 0.003} & & 0.074 & {\bf 0.065} \\ & & 2 & -0.056 & {\bf 0.006} & & 0.008 & {\bf 0.004} & & 0.127 & {\bf 0.096} \\ & \multirow{3}{*}{8} & 1 & -0.034 & {\bf -0.012} & & 0.003 & {\bf 0.002} & & 0.113 & {\bf 0.100} \\ & & 2 & -0.060 & {\bf -0.008} & & 0.005 & {\bf 0.002} & & 0.208 & {\bf 0.159} \\ & & 4 & -0.069 & {\bf 0.034} & & 0.009 & {\bf 0.004} & & 0.324 & {\bf 0.209} \\ & \multirow{3}{*}{16} & 1 & -0.033 & {\bf -0.015} & & 0.002 & {\bf 0.001} & & 0.209 & {\bf 0.186} \\ & & 2 & -0.056 & {\bf -0.018} & & 0.004 & {\bf 0.001} & & 0.401 & {\bf 0.323} \\ & & 4 & -0.107 & {\bf -0.010} & & 0.012 & {\bf 0.001} & & 0.785 & {\bf 0.489} \\ \vspace{-2mm} \\ \cmidrule{2-11} \vspace{-2mm} \\ \multirow{9}{*}{100} & \multirow{3}{*}{5} & 1 & -0.017 & {\bf -0.004} & & 0.002 & {\bf 0.001} & & 0.033 & {\bf 0.031} \\ & & 2 & -0.031 & {\bf 0.004} & & 0.003 & {\bf 0.002} & & 0.058 & {\bf 0.049} \\ & \multirow{3}{*}{8} & 1 & -0.016 & {\bf -0.005} & & 0.001 & {\bf 0.001} & & 0.051 & {\bf 0.048} \\ & & 2 & -0.029 & {\bf -0.002} & & 0.002 & {\bf 0.001} & & 0.095 & {\bf 0.082} \\ & & 4 & -0.049 & {\bf 0.021} & & 0.004 & {\bf 0.002} & & 0.159 & {\bf 0.118} \\ & \multirow{3}{*}{16} & 1 & -0.016 & {\bf -0.006} & & 0.001 & {\bf 0.000} & & 0.100 & {\bf 0.094} \\ & & 2 & -0.027 & {\bf -0.007} & & 0.001 & {\bf 0.000} & & 0.193 & {\bf 0.171} \\ & & 4 & -0.054 & {\bf -0.004} & & 0.003 & {\bf 0.000} & & 0.367 & {\bf 0.283} \\ \vspace{-3mm} \\ \bottomrule \vspace{+1mm} \end{tabular} \caption{Performance metrics for maximum likelihood (MLE) and MML87 estimates of residual variance $\sigma^2$ computed over $10^5$ simulations. \label{tab:results:pest}} \end{center} \end{table*} This section compares the newly derived MML parameter estimates for the probabilistic PCA model to the standard approach based on the maximum likelihood estimator. Since MML and maximum likelihood estimates of the the factor lengths (for a given $\sigma^2$) and factor orientations are identical, the key difference between to two approaches is in the estimation of the residual variance. Our simulation experiments are loosely based on Section~6 in \citep{Wallace98}. We conducted $10^5$ simulations for each combination of the sample size $N \in \{25,50,100\}$, the dimensionality of the data $K \in \{5, 8, 16\}$ and the number of estimated latent factors $J \in \{1,2,4\}$. As both maximum likelihood and MML are scale invariant, the residual variance was set to $\sigma^2 = 1$ and the factors lengths were $\alpha_j = 1$ ($j=1,\ldots,J$) for each simulation run, without loss of generality. The factor directions were randomly sampled from a unit $K$-sphere. We used the three performance metrics discussed in \citep{Wallace98} to evaluate the estimators: \begin{align*} S_1 = \log \hat{\sigma}_i , \quad S_2 = (\log \hat{\sigma}_i)^2 , \end{align*} and the Kullback--Leibler (KL) divergence~\citep{KullbackLeibler51} between two multivariate Gaussian distributions \begin{equation*} \text{KL}(\bm{\Sigma}_0, \bm{\Sigma}_1) = \frac{1}{2} \left(\text{tr}\left( \bm{\Sigma}^{-1}_1 \bm{\Sigma}_0\right) + \log \left( \frac{ \bm{|\Sigma}_1|}{|\bm{\Sigma}_0|}\right) - K \right) . \end{equation*} The first metric $S_1$ is a measure of bias, while $S_2$ measures error in any direction. Both $S_1$ and $S_2$ are zero for exact estimates as the true residual variance was $\sigma^2 = 1$ in all experiments. The error measures were specifically chosen as they do not depend on the number of estimated latent vectors $J$. Simulation results averaged over $10^5$ iterations are shown in Table~\ref{tab:results:pest}. The MML estimate of the residual variance was found to be superior to the usual maximum likelihood estimate for all tested combinations of sample sizes, data dimensionality and the number of latent vectors. Maximum likelihood appeared to underestimate the residual variance more strongly compared to the minimum message length estimate. The differences in the performances of the two estimates were most pronounced when the sample size and data dimensionality was small ($N \leq 50$, $K = 5$). \subsection{Model selection} We have also compared the performance of MML model selection against the highly popular Bayesian information criterion (BIC) and Laplace's method for approximating the marginal distribution of the data~\citep{Minka00}, referred to as `Bayes' henceforth. Using numerical experiments, \cite{Minka00} demonstrated that approximating Bayesian evidence is superior to methods like cross validation. The simulation setup was identical to Section~\ref{sec:exp:pest} except the sample size was $N \in \{50,100\}$, the dimensionality of the data $K = 10$ and the number of estimated latent factors $J \in \{1,2,4\}$. Simulation results, averaged over $10^5$ iterations, are shown in Table~\ref{tab:results:msel}. As expected, both MML and the Bayes method have similar performance and both improve significantly over the popular BIC criterion. \begin{table*}[tbph] \scriptsize \begin{center} \begin{tabular}{cccccccc} \toprule $N$ & $J$ & Method & KL Divergence & & \multicolumn{3}{c}{Model Selection (\%)} \\ & & & &~ & $<J$ & $=J$ & $>J$ \\ \cmidrule{1-8} \multirow{9}{*}{50} & \multirow{3}{*}{1} & MML & 0.060 & & -- & 99.55 & 0.45\\ & & BIC & 0.063 & & -- & 100.00 & 0.00\\ & & Bayes & 0.066 & & -- & 97.19 & 2.81\\ & \multirow{3}{*}{2} & MML & 0.126 & & 70.40 & 28.32 & 1.27\\ & & BIC & 0.145 & & 96.40 & 3.60 & 0.00\\ & & Bayes & 0.129 & & 52.52 & 45.17 & 2.31\\ & \multirow{3}{*}{4} & MML & 0.198 & & 81.00 & 5.78 & 13.22\\ & & BIC & 0.257 & & 99.99 & 0.01 & 0.00\\ & & Bayes & 0.209 & & 91.09 & 7.92 & 0.98\\ \vspace{-2mm} \\ \cmidrule{2-8} \vspace{-2mm} \\ \multirow{9}{*}{100} & \multirow{3}{*}{1} & MML & 0.028 & & -- & 99.74 & 0.26\\ & & BIC & 0.029 & & -- & 100.00 & 0.00\\ & & Bayes & 0.030 & & -- & 97.86 & 2.14\\ & \multirow{3}{*}{2} & MML & 0.062 & & 30.47 & 68.49 & 1.05\\ & & BIC & 0.094 & & 74.75 & 25.25 & 0.00\\ & & Bayes & 0.060 & & 17.96 & 79.84 & 2.20\\ & \multirow{3}{*}{4} & MML & 0.096 & & 66.32 & 22.70 & 10.98\\ & & BIC & 0.166 & & 99.48 & 0.52 & 0.00\\ & & Bayes & 0.103 & & 72.71 & 25.93 & 1.36\\ \vspace{-3mm} \\ \bottomrule \vspace{+1mm} \end{tabular} \caption{Model selection simulation results for minimum message length (MML), Bayesian information criterion (BIC) and Laplace's method for estimating Bayesian evidence averaged over $10^5$ simulations. In all experiments, data dimensionality was $K=10$. \label{tab:results:msel}} \end{center} \end{table*}
{'timestamp': '2022-09-30T02:07:56', 'yymm': '2209', 'arxiv_id': '2209.14559', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14559'}
arxiv
\section{Introduction} Over the course of the last several years, a significant amount of scholarly attention has been drawn to the issue of feature selection. At a high level, feature selection can be considered as a branch of reducing data dimensionality of which the two primary methods are \textit{feature learning} and \textit{feature selection}. The problem of feature learning involves the creation of new features from the original data. In contrast, the feature selection problem does not change the original representation of the data variables, so the physical meaning of each variable is preserved. To be more specific, the feature selection problem can be subdivided into two scenarios: supervised and unsupervised. Since we do not have target variables, selecting unsupervised features is more challenging. Typically, the unsupervised feature selection relies on matrix decomposition \citep{cheng2005compression, liberty2007randomized, martinsson2011randomized, lu2022bayesian}, filter \citep{dash2002feature}, and embeddings \citep{dy2004feature, hou2011feature}. On the other hand, matrix decomposition algorithms such as QR decomposition, and singular value decomposition have been used extensively over the years to reveal hidden structures of data matrices in scientific and engineering areas such as collaborative filtering \citep{marlin2003modeling, lim2007variational, mnih2007probabilistic, lu2022matrix, lu2022bayesian}, recommendation systems \citep{lu2022matrix}, clustering and classification \citep{li2009non, wang2013non}. Low-rank matrix approximations are therefore essential in data science. Due to the Eckart-Young-Misky theorem, low-rank approximation problems can be easily solved with singular value decomposition \citep{golub1987generalization}. However, it is frequently desirable for many applications to operate with a basis consisting of a subset of the original columns of the observed matrix \citep{martinsson2011randomized, kakushadze2016101}. The interpolative decomposition (ID) is one of these low-rank approximations; it reuses columns from the observed matrix, preserving matrix sparsity and nonnegativity while removing redundant information. In this context, the ID of underlying matrices captures our interest. The ID of an $M\times N$ data matrix $\bm{A}$ can be described by $\bm{A}=\bm{C}\bm{W}+\bm{P}$, where the matrix $\bm{A}$ is approximately factorized into a matrix $\bm{C}\in \mathbb{R}^{M\times K}$ reusing $K$ \textit{basis columns} of $\bm{A}$ (thus $\bm{C}$ is also known as a skeleton of $\bm{A}$) and a matrix $\bm{W}\in \mathbb{R}^{K\times N}$ with entries no greater than 1 in magnitude; the error is captured by an $M\times N$ matrix $\bm{P}$. Training such models amounts to finding the optimal rank-$K$ approximation to the observed $M\times N$ data matrix $\bm{A}$ under some loss functions. Let $\bm{r}\in \{0,1\}^N$ be the \textit{state vector} with each entry indicating the type of the corresponding column, i.e., \textit{basis column} or \textit{interpolated (remaining) column}: if $r_n=1$, then the $n$-th column of $\bm{A}$ is a basis column; on the contrary, the $n$-th column is interpolated using the basis columns within a tolerance of error. Suppose further the set $I$ contains the indices of the interpolated columns with $r_n=0$ and the set $J$ contains the indices of the basis columns with $r_n=1$ where $$ J\cap I =\emptyset ; \,\,\,\,\,\,\,\, J \cup I =\{1,2,\ldots, N\}. $$ Then $\bm{C}$ can be described by the Matlab-style notation as $\bm{C}=\bm{A}[:,J]$ where the colon operator implies all indices. The approximation $\bm{A}\approx \bm{C}\bm{W}$ can be equivalently stated that $\bm{A}\approx\bm{C}\bm{W}=\bm{X}\bm{Y}$ where $\bm{X}\in \mathbb{R}^{M\times N}$ and $\bm{Y}\in \mathbb{R}^{N\times N}$ with $$ \begin{aligned} \bm{X}[:,J]&=\bm{C}\in \mathbb{R}^{M\times K}; \,\,\,\,\,\,\,\, &\bm{X}[:,I] &= \mathbf{0}\in \mathbb{R}^{M\times (N-K)};\\ \bm{Y}[J,:]&=\bm{W} \in \mathbb{R}^{K\times N}; \,\,\,\,\,\,\,\, &\bm{Y}[I,:] &= \text{random matrix} \in \mathbb{R}^{(N-K)\times N}. \end{aligned} $$ We also notice that there exists a $K\times K$ identity matrix $\bm{I}$ inside $\bm{W}$ and $\bm{Y}$: \begin{equation}\label{equation:submatrix_bid_identity} \bm{I} = \bm{W}[:,J] = \bm{Y}[J,J]. \end{equation} Having the equivalence of $\bm{C}\bm{W}=\bm{X}\bm{Y}$, the problem of $\bm{A}\approx\bm{C}\bm{W}$ can be stated as finding the approximation $\bm{A}\approx\bm{X}\bm{Y}$ alternatively with the state vector $\bm{r}$ recovering the submatrix $\bm{C}$ (Figure~\ref{fig:id-column}). Mean squared error (MSE) is applied to evaluate the \textit{reconstruction error}: \begin{equation}\label{equation:idbid-per-example-loss} \mathop{\min}_{\bm{W},\bm{Z}} \,\, \frac{1}{MN}\sum_{n=1}^N \sum_{m=1}^{M} \left(a_{mn} - \bm{x}_m^\top\bm{y}_n\right)^2, \end{equation} where $a_{mn}$ is the $(m,n)$-th element of matrix $\bm{A}$, and $\bm{x}_m$, $\bm{y}_n$ are the $m$-th \textbf{row} and $n$-th \textbf{column} of $\bm{X}$, $\bm{Y}$ respectively for simplicity. The magnitude constraint in $\bm{Y}$ or $\bm{W}$ is approached by considering the Bayesian ID model as a latent factor model where we employ Bayesian inference to find the latent components via the specified graphical model. Therefore, no explicit magnitude constraints are considered. In this paper, we introduce a novel Bayesian ID (BID) approach with each column of the observed matrix having its score measuring the importance in the model; the larger the score, the higher the priority to select; hence the name \textit{intervened interpolative decomposition (IID)}. The rest of the paper is organized as follows. We will introduce the vanilla Bayesian ID method in Section~\ref{section:related_iid_word}. Section~\ref{section:iid_main} then presents the proposed IID method. Section~\ref{section:iid_quantaprob} provides one of the applications for the IID method in finding quantitative strategies, followed by the experiments in Section~\ref{section:iid_experiments}. \section{Related Work}\label{section:related_iid_word} \begin{figure*}[h] \centering \vspace{-0.35cm} \subfigtopskip=2pt \subfigbottomskip=9pt \subfigcapskip=-5pt \includegraphics[width=0.95\textwidth]{imgs/id-column.pdf} \caption{Overview of the ID of the matrix $\bm{A}\in\mathbb{R}^{M\times N}$ where the yellow vectors denote the basis columns of matrix $\bm{A}$, white columns denote zero vectors, purple entries denote one, blue and black entries denote elements that are not necessarily zero. The Bayesian ID models get the approximation $\bm{A}\approx\bm{X}\bm{Y}$ and the post processing procedure obtains the approximation $\bm{A}\approx\bm{X}\bm{Y}\approx\bm{C}\bm{W}$.} \label{fig:id-column} \end{figure*} \subsection{Bayesian GBT Model for Interpolative Decomposition} \begin{SCfigure \centering \vspace{-0.55cm} \subfigtopskip=2pt \subfigbottomskip=6pt \subfigcapskip=-2pt \includegraphics[width=0.36\textwidth]{./imgs/bmf_bid_GBT_IID.pdf} \caption{Graphical representation of the GBT model where green circles denote prior variables, orange circles represent observed and latent variables, and plates represent repeated variables. Comma ``," in the cycles represents ``and", and ``/" in the cycles represents ``or". Parameters $a,b$ are fixed with $a=-1,b=1$ in our case; while a weaker construction can set them to $a=-2,b=2$.} \label{fig:bmf_bids_foriid} \end{SCfigure} In this section, we review the Bayesian approach for computing the interpolative decomposition. We consider the data matrix $\bm{A}$ to be generated via the probabilistic generative process (Figure~\ref{fig:bmf_bids_foriid}). The element $a_{mn}$ of matrix $\bm{A}$ is modeled via a Gaussian likelihood function, \begin{equation}\label{equation:iid_data_entry_likelihood} p(a_{mn} | \bm{x}_m^\top\bm{y}_n, \sigma^2) = \mathcal{N}(a_{mn}|\bm{x}_m^\top\bm{y}_n, \sigma^2), \end{equation} where $\bm{x}_m^\top\bm{y}_n$ and $\sigma^2$ are mean and variance respectively. Then, we place an inverse-Gamma prior over the data variance (a conjugate prior), \begin{equation}\label{equation:prior_iid_gamma_on_variance} p(\sigma^2 | \alpha_\sigma, \beta_\sigma) = \mathrm{IG}(\sigma^2 | \alpha_\sigma, \beta_\sigma), \end{equation} where $\mathrm{IG}(x|\alpha_\sigma, \beta_\sigma)= \frac{(\beta_\sigma)^\alpha}{\Gamma(\alpha_\sigma)} x^{-\alpha_\sigma-1}\exp\{-\frac{\beta_\sigma}{x}\}u(x)$ is an inverse-Gamma density with $\Gamma(\cdot)$ being the gamma function and $u(x)$ being the unit step function that has a value of $1$ when $x\geq0$ and 0 otherwise. We treat the latent variables $y_{kl}$'s (with $k,l\in \{1,2,\ldots,N\}$, see Figure~\ref{fig:bmf_bids_foriid}) as random variables. And in order to express beliefs about the values of these latent variables, we need prior densities over them, for example, a constraint with magnitude smaller than 1, even when there are many additional constraints (e.g., semi-nonnegativity in \citet{ding2008convex}, nonnegativity in \citet{lu2022flexible, lu2022robust}, or discreteness in \citet{gopalan2014bayesian, gopalan2015scalable}). Here we assume further that the latent variable $y_{kl}$'s are independently drawn from a general-truncated-normal prior: \begin{equation}\label{equation:rn_prior_bidd} p(y_{kl} | \cdot ) = \mathcal{GTN}(y_{kl} | \mu_{kl}, (\tau_{kl})^{-1}, a=-1, b=1), \end{equation} where $\mathcal{GTN}(x|\mu, \frac{1}{\tau}, a, b)=$ $\frac{\sqrt{\frac{\tau}{2\pi}} \exp \{-\frac{\tau}{2}(x-\mu)^2 \} }{\Phi((b-\mu)\cdot \sqrt{\tau})-\Phi((a-\mu)\cdot \sqrt{\tau})}$$u(x|a,b)$ is a general-truncated-normal (GTN) with zero density below $x=a$ or above $x=b$ and renormalized to integrate to one, $u(x|a,b)$ is a step function that has a value of 1 when $a\leq x\leq b$ and 0 otherwise, and $\Phi(\cdot)$ function is the cumulative distribution function of standard normal density $\mathcal{N}(0,1)$. The parameters $\mu$ and $\tau$ in GTN are known as the ``parent mean" and ``parent precision" of the original normal distribution $\mathcal{N}(\mu, \frac{1}{\tau})$. This GTN prior is thus utilized to enforce the constraint on the components $\bm{Y}$ (or $\bm{W}$) with no entry of $\bm{Y}$ having an absolute value greater than 1, and is conjugate to the Gaussian likelihood. We call the Bayesian ID method discussed above \textit{GBT} where \textit{G} stands for Gaussian density, \textit{B} stands for Beta-Bernoulli density intrinsically, and \textit{T} is short for general-truncated-normal density. \paragraph{Hierarchical prior and automatic relevance determination (ARD)} There is also a hierarchical model on Bayesian inference for ID where we place a joint hyperprior over the hyperparameters $\{\mu_{kl}, \tau_{kl}\}$ of GTN density in Eq.~\eqref{equation:rn_prior_bidd}, i.e., the GTN-scaled-normal-Gamma (GTNSNG) density that can decouple the parameters $\mu_{kl}, \tau_{kl}$, and as a result, their posterior conditional densities are normal and Gamma respectively \citep{lu2022bayesian}. And also the ARD method can determine the number of columns inside the factored component $\bm{X}$ automatically by a special prior on the state vector $\bm{r}$ \citep{lu2022comparative}. The development of the IID method on the non-hierarchical, hierarchical, and ARD models are the same, and we shall only discuss the non-hierarchical and non-ARD versions for simplicity. \paragraph{Post processing} The last step shown in Figure~\ref{fig:id-column} presents a step of post processing, where we enforce the identity submatrix in $\bm{W}$ (Eq.~\eqref{equation:submatrix_bid_identity}). This normally can reduce the MSE to a minor extent \citep{lu2022bayesian}. \subsection{Gibbs Sampler for GBT Model} In this section, we only shortly describe the posterior conditional density for Gibbs sampling to find the Bayesian inference. While a step-by-step derivation is provided in \citet{lu2022bayesian, lu2022comparative} for both hierarchical, non-hierarchical, ARD, and non-ARD versions. Denote all elements of $\bm{Y}$ except $y_{kl}$ as $\bm{Y}_{-kl}$, the conditional density of $y_{kl}$ is also a GTN density and it can be obtained by \begin{equation}\label{equation:posterior_gbt_ykl} \begin{aligned} &\,\,\,\,\,\,\,\, p(y_{kl} | \bm{A}, \bm{X}, \bm{Y}_{-kl}, \mu_{kl}, \tau_{kl}, \sigma^2) \propto p(\bm{A}|\bm{X},\bm{Y}, \sigma^2) \cdot p(y_{kl}|\mu_{kl}, \tau_{kl} )\\ & \propto \mathcal{GTN}(y_{kl}| \widetilde{\mu},( \widetilde{\tau})^{-1}, a=-1,b=1), \end{aligned} \end{equation} where $\widetilde{\tau} =\frac{\sum_{i}^{M} x_{ik} ^2}{\sigma^2} +\tau_{kl}$ is the posterior ``parent precision" of the GTN distribution, and $ \widetilde{\mu} = \big(\frac{1}{\sigma^2} \sum_{i}^{M} x_{ik} \big(a_{il}-\sum_{j\neq k}^{N}x_{ij} y_{jl}\big) +\textcolor{black}{\tau_{kl}\mu_{kl}} \big) \big/ \widetilde{\tau} $ is the posterior ``parent mean" of the GTN distribution. Given the state vector $\bm{r}=[r_1,r_2, \ldots, r_N]^\top\in \mathbb{R}^N$ such that the index set $J = J(\bm{r}) = \{n|r_n = 1\}_{n=1}^N$ and $I = I(\bm{r}) = \{n|r_n = 0\}_{n=1}^N$. To draw a state vector $\bm{r}$, we can select one index $j\in J$ and another index $i\in I$ (where the old values are $r_j=1$ and $r_i=0$) such that \begin{equation}\label{equation:postrerior_gbt_rvector} \begin{aligned} o_j &= \frac{p(r_j=0, r_i=1|\bm{A},\sigma^2, \bm{Y}, \bm{r}_{-ji})} {p(r_j=1, r_i=0|\bm{A},\sigma^2, \bm{Y}, \bm{r}_{-ji})}\\ &= \frac{p(r_j=0, r_i=1)}{p(r_j=1, r_i=0)} \times \frac{p(\bm{A}|\sigma^2, \bm{Y}, \bm{r}_{-ji}, r_j=0, r_i=1)}{p(\bm{A}|\sigma^2, \bm{Y}, \bm{r}_{-ji}, r_j=1, r_i=0)}, \end{aligned} \end{equation} where $\bm{r}_{-ji}$ denotes all elements of $\bm{r}$ except the $j$-th and $i$-th entries. In GBT, every column has same priority so we have $p(r_j=0, r_i=1)=p(r_j=1, r_i=0)$. Then the conditional probability of $p(r_j=0, r_i=1|\bm{A},\sigma^2, \bm{Y}, \bm{r}_{-ji})$ can be obtained by \begin{equation}\label{equation:postrerior_gbt_rvector222} p(r_j=0, r_i=1|\bm{A},\sigma^2, \bm{Y}, \bm{r}_{-ji}) = \frac{o_j}{1+o_j}. \end{equation} Finally, by conjugacy, the conditional posterior density of $\sigma^2$ is an inverse-Gamma distribution: \begin{equation}\label{equation:posterior_gnt_sigma2} \begin{aligned} &\,\,\,\,\,\,\,\, p(\sigma^2 | \bm{X}, \bm{Y}, \bm{A}) = \mathrm{IG}(\sigma^2 | \widetilde{\alpha_\sigma}, \widetilde{\beta_\sigma}), \end{aligned} \end{equation} where $\widetilde{\alpha_\sigma} = \frac{MN}{2}+\alpha_\sigma$, $\widetilde{\beta_\sigma}=\frac{1}{2} \sum_{i,j=1}^{M,N}(a_{ij}-\bm{x}_i^\top\bm{y}_j)^2+\beta_\sigma$ are the posterior shape and scale parameters for the inverse-Gamma density. The procedure for GBT is then formulated in Algorithm~\ref{alg:gbt_iid_gibbs_sampler}. \begin{algorithm}[!htb] \caption{Gibbs sampler for GBT (and IID) model. The procedure presented here can be inefficient but is explanatory. While a vectorized manner can be implemented to find a more efficient algorithm. By default, weak priors are $\alpha_\sigma=0.1, \beta_\sigma=1$, $\{\mu_{kl}\}=0, \{\tau_{kl}\}=1$, and $a=-1, b=1$ are fixed. Set the latent dimension $K$.} \label{alg:gbt_iid_gibbs_sampler} \begin{algorithmic}[1] \FOR{$t=1$ to $T$} \STATE Sample state vector $\bm{r}$ from Eq.~\eqref{equation:postrerior_gbt_rvector222} (based on Eq.~\eqref{equation:postrerior_gbt_rvector} for GBT, or on Eq.~\eqref{equation:posterior_IID} for IID); \STATE Update matrix $\bm{X}$ by $\bm{A}[:,J]$ where index vector $J$ is the index of $\bm{r}$ with value 1 and set $\bm{X}[:,I]=\mathbf{0}$ where index vector $I$ is the index of $\bm{r}$ with value 0; \STATE Sample variance $\sigma^2$ from $p(\sigma^2 | \bm{X},\bm{Y}, \bm{A})$ in Eq.~\eqref{equation:posterior_gnt_sigma2}; \FOR{$k=1$ to $N$} \FOR{$l=1$ to $N$} \STATE Sample factored component $y_{kl}$ from $p(y_{kl} | \bm{A}, \bm{X}, \bm{Y}_{-kl}, \mu_{kl}, \tau_{kl}, \sigma^2)$ in Eq.~\eqref{equation:posterior_gbt_ykl}; \ENDFOR \ENDFOR \STATE Output $||\bm{A}-\bm{X}\bm{Y}||_2$ loss in Eq.~\eqref{equation:idbid-per-example-loss}, and stop iteration if it converges. \ENDFOR \STATE Output mean loss in Eq.~\eqref{equation:idbid-per-example-loss} for evaluation after burn-in iterations. \end{algorithmic} \end{algorithm} \section{Intervened Interpolative Decomposition (IID)}\label{section:iid_main} Going further from the GBT model, we propose the intervened interpolative decomposition (IID) algorithm. The proposed IID algorithm has exactly the same generative process as shown in Eq.~\eqref{equation:iid_data_entry_likelihood}, inverse-Gamma prior on the variance parameter $\sigma^2$ in Eq.~\eqref{equation:prior_iid_gamma_on_variance}, and GTN prior over the latent variables $y_{kl}$'s in Eq.~\eqref{equation:rn_prior_bidd}. However, we consider further that some columns of the observed matrix $\bm{A}$ has a larger importance that \textit{should} be selected with a higher priority over the other columns. Suppose the importance of each column of the observed matrix $\bm{A}$ is captured by a \textit{raw importance vector} $\widehat{\bm{p}}\in \mathbb{R}^N$ where $\widehat{p}_i \in [-\infty, \infty]$ for all $i$ in $\{1,2,\ldots, N\}$. The raw importance vector can then be transformed into the range 0 to 1 $$ \bm{p} = \text{Sigmoid}(\widehat{\bm{p}}), $$ where \textit{Sigmoid($\cdot$)} is the $f(x) = \frac{1}{1+\exp\{-x\}}$ that can return value in the range 0 to 1. The Sigmoid function acts as a squashing function because its domain is the set of all real numbers, and its range is (0, 1). Then we take the $\bm{p}$ vector as the final \textit{importance vector} to indicate the importance of each column in the matrix $\bm{A}$. Going further from Eq.~\eqref{equation:postrerior_gbt_rvector}, the intermediate variable $o_j$ is calculated instead by \begin{equation}\label{equation:posterior_IID} \begin{aligned} o_j &= \frac{p(r_j=0, r_i=1)}{p(r_j=1, r_i=0)} \times \frac{p(\bm{A}|\sigma^2, \bm{Y}, \bm{r}_{-ji}, r_j=0, r_i=1)}{p(\bm{A}|\sigma^2, \bm{Y}, \bm{r}_{-ji}, r_j=1, r_i=0)}\\ &= \textcolor{blue}{ \frac{1-p_j }{p_j} \frac{p_i }{1-p_i} } \times \frac{p(\bm{A}|\sigma^2, \bm{Y}, \bm{r}_{-ji}, r_j=0, r_i=1)}{p(\bm{A}|\sigma^2, \bm{Y}, \bm{r}_{-ji}, r_j=1, r_i=0)}. \end{aligned} \end{equation} And again, the conditional probability of $p(r_j=0, r_i=1|\bm{A},\sigma^2, \bm{Y}, \bm{r}_{-ji})$ can be obtained by \begin{equation}\label{equation:postrerior_gbt_rvector222_IID} p(r_j=0, r_i=1|\bm{A},\sigma^2, \bm{Y}, \bm{r}_{-ji}) = \frac{o_j}{1+o_j}. \end{equation} Since we intervene in the procedure of the Gibbs sampling in Eq.~\eqref{equation:posterior_IID}, hence the name \textit{intervened interpolative decomposition (IID)}. \section{Quantitative Problem Statement}\label{section:iid_quantaprob} After developing the intervened interpolative decomposition algorithm, one may get confused about why it is so important and curious about the applications it can be applied in practice. It is well known that large quantitative hedge funds and asset managers have been recruiting a large number of data miners and financial engineers in order to build effective alphas, and the number of alpha components might climb into the millions or perhaps billions \citep{tulchinsky2019finding}. As a result, creating a meta-alpha from all of the alphas or a large fraction of the alpha pool might be troublesome for the following reasons: a). If we use the same alphas as others, some illiquid alphas with low volume will be traded heavily. This will make the strategy meaningless due to capacity constraints; b). Using too many alphas may result in overfitting, resulting in poor out-of-sample (OS) performance; c). Many alphas might be mutually dependent, and certain machine learning algorithms, such as neural networks, might uncover their limits caused by multi-linear difficulties while attempting to determine the meta-strategy from the entire set of alphas; d). Finding trading signals from the full alpha pool can be time-consuming because of limited computing resources; e). To minimize market risks, we constantly aim to discover a distinct subset of alphas to test alternative methods with low correlation. For the five reasons stated above, there is an urgent need to design algorithms that choose a small subset of alphas from a large pool of them in order to prevent overfitting, make the final approach more scalable, and obtain the findings in a reasonable amount of time. It is trivial to select an appropriate subset by the \textit{RankIC} metric (see definition below), i.e., we select the alphas having the highest RankIC values. However, the problems still remain that the selected subset will not represent the whole pool of alphas, and the selected alphas may be mutually dependent. Our objective is to identify as many representative alpha factors as possible with optimal performance. The selected subset of alphas is representative in the sense that the small subset of alphas can be used to reconstruct other alphas with a small replication error. The traditional ID algorithm, either using a \textit{Randomized algorithm} \citep{liberty2007randomized} or a Bayesian approach we have discussed above, can only help to find the representative ones. However, the end choices may seem to select alphas with low performance. Using the proposed IID method, on the other hand, can help find the representative (that can reconstruct other alphas with small error) and the desirable (high RankIC scores) alphas at the same time. \subsection{Formulaic Alphas} WorldQuant, a quantitative investment management firm, previously disclosed 101 formulaic short-term alpha determinants in 2016 \citep{kakushadze2016101}. Since then, the 191 alpha factors from Guotai Junan Securities \citep{guotaijunan2017} have also been welcomed by many investors and institutions. These formulaic alpha components are derived from several stock data elements, including, among others, volumes, prices, volatilities, and volume-weighted average prices (vwap). As the name implies, a formulaic alpha is a type of alpha that can be expressed as a formula or a mathematical expression. For example, a \textit{mean-reversion} alpha can be expressed in terms of a mathematical expression as follows: $$ \text{Alpha = }- \left( \text{close(today) $-$close(5$\_$days$\_$ago ) } \right)/ \text{close(5$\_$days$\_$ago)}. $$ In this sense, we take the opposite action as indicated by the closing price: we go short if the price has risen during the previous five days, and we go long otherwise. At a high level, the alpha value indicates the trend of the price in the days to come; the higher the alpha value for each stock, the more likely it is that the stock's price will rise in the next few days. \subsection{Evaluation Metrics} Let $r_{t}$ denote the yield rate of stock $s$ on $t$-th day. Suppose further $p_t$ is asset closing price at time $t$ where $t\in \{1,2,\ldots, T\}$, the return of the asset at time $t$ can be obtained by the following equation: \begin{equation} r_t = \frac{p_t - p_{t-1}}{p_t}. \end{equation} We use the Rank information coefficient (\textit{RankIC}) to evaluate the effectiveness of an alpha: \begin{equation} \text{RankIC}(\bm{a}, \bm{r}^h)=\text{Spearman}(\bm{a}, \bm{r}^h), \end{equation} where $\text{Spearman}(\cdot)$ indicates the Spearman correlation, $\bm{a}$ is the sequence of an alpha, $\bm{r}^h$ is the sequence of the return value with holding period $h$ such that the $i$-th element of $\bm{r}^h$ represent the daily return of $h$ days later. The RankIC then can be used as an indicator of the importance of each alpha factor and plugged into Eq.~\eqref{equation:posterior_IID} directly. \section{Experiments}\label{section:iid_experiments} For each stock $s$ (i.e., $s\in \{1,2,\ldots, S\}$ where $S$ is the total number of stocks), we have a matrix $\bm{A}_s$ with shape $\bm{A}_s\in \mathbb{R}^{N\times D}$ where $N$ is the number of alphas and $D$ is the number of dates so that each row of $\bm{A}_s$ is regarded as an alpha series. We want to select a subset of the alphas (here we assume $M$ out of the $N$ alphas are selected). The RankIC between each alpha series and the delayed return series with horizon $h=1$ is then taken as the \textit{important value} directly, a higher RankIC indicates a higher priority. \begin{table}[h] \centering \small \setlength{\tabcolsep}{7.4pt} \begin{tabular}{llllll} \hline Ticker & Type & Sector & Company & Average Amount \\ \hline SH601988 & Share & Bank & Bank of China Limited & 427,647,786 \\ SH601601 & Share & Public Utility & China Pacific Insurance (Group) & 819,382,926 \\ SH600028 & Share & Public Utility & China Petroleum \& Chemical Corporation & 748,927,952\\ SH600016 & Share & Bank & China Minsheng Banking Corporation &285,852,414 \\ SH601186 & Share & Public Utility & China Railway Construction Corporation & 594,970,588\\ SH601328 & Share & Bank & Bank of Communications Corporation & 484,445,915 \\ SH601628 & Share & Public Utility & China Life Insurance Company Limited&368,179,861 \\ SH601939 & Share & Bank & China Construction Bank Corporation &527,876,669 \\ \hline SH510300 & ETF & CSI 300 & Huatai-PineBridge CSI 300 ETF &1,960,687,059 \\ SH510050 & ETF & CSI 50 & ChinaAMC China CSI 50 ETF &2,020,385,879 \\ \hline \end{tabular} \vspace{-0.25cm} \caption{Summary of the underlying portfolios in the China market, ten assets in total. The average amount (in the currency of RMB) is calculated in the period of the test set.} \label{table:iid_cn_data_summary} \end{table} \paragraph{Dataset} To assess the proposed algorithm and highlight the primary benefits of the IID technique, we perform experiments with several analytical tasks and use data for ten assets from the China market and diverse industrial areas, including Bank, Public Utility, and ETF. We obtain publicly available data from tushare \footnote{\url{https://tushare.pro/}.}. The data covers a three-year period, i.e., 2018-07-18 to 2021-07-05 (720 trading days), where the data between 2018-07-18 and 2020-07-09 is considered the training set (480 calendar days); while data between 2020-07-10 and 2021-07-05 is taken as the test set (240 trading days). The underlying portfolios are summarized in Table~\ref{table:iid_cn_data_summary} and Figure~\ref{fig:bid_iid_datasets_ashare} shows the series of different assets where we initialize each portfolio with a unitary value for clarity. The assets are chosen by selecting the ones with high amount values (random ten assets among the fifty assets with highest average amounts in China market during the selected period) so that there are fewer trading restrictions. We obtain 78 alphas from the 101 formulaic alphas \citep{kakushadze2016101}, 94 alphas from the 191 formulaic alphas \citep{guotaijunan2017}, and 19 proprietary alphas. The alphas are chosen to have a value that is neither too large nor too small. In this sense, the alpha matrix $\bm{A}_s$ is of shape $214\times 480$ for each asset. In all scenarios, the same parameter initialization is adopted when conducting different tasks. Experimental evidence demonstrates that post-processing can marginally improve performance. For clarification, we only provide the findings of the GBT and IID models after post processing. The IID model can select the important features (alphas) with a higher priority while keeping the reconstructive error as small as possible, resulting in performance that is as good as or better than the vanilla GBT method in low-rank ID approximation across a wide range of experiments on different datasets. We use mean squared error (MSE, Eq.~\eqref{equation:idbid-per-example-loss}), which measures the similarity between the observed and reconstructive matrices, to evaluate the overall decomposition performance; the smaller the value, the better the performance. \begin{figure*}[h] \centering \vspace{-0.2cm} \subfigtopskip=2pt \subfigbottomskip=0pt \subfigcapskip=-2pt \subfigure[Convergence of the models on the SH510050, SH510300, SH601939, SH601628, and SH601328 datasets, as measured by MSE. The algorithm almost converges in less than 100 iterations.]{\includegraphics[width=1\textwidth]{imgs/iid_alpha_convergence.pdf} \label{fig:iid_alpha_convergence}} \subfigure[Averaged autocorrelation coefficients of samples of $y_{kl}$ computed using Gibbs sampling on the SH510050, SH510300, SH601939, SH601628, and SH601328 datasets.]{\includegraphics[width=1\textwidth]{imgs/iid_alpha_autocorrelation.pdf} \label{fig:iid_alpha_autocorrelation}} \vspace{-0.3cm} \caption{Convergence results (upper), and sampling mixing analysis (lower) on the SH510050, SH510300, SH601939, SH601628, and SH601328 datasets for a latent dimension of $K=10$. } \label{fig:allresults_bids_ard} \end{figure*} \paragraph{Hyperparameters} In those experiments, we use $a=-1, b=1,\alpha_\sigma=0.1, \beta_\sigma=1$, ($\{\mu_{kl}\}=0, \{\tau_{kl}\}=1$) for both GBT and IID models. The adopted parameters are uninformative and weak prior choices and the models are insensitive to them. The observed or unobserved variables are initialized from random draws as long as those hyperparameters are fixed since this initialization method provides a better initial guess of the correct patterns in the matrices. In all cases, we execute 1,000 iterations of Gibbs sampling with a burn-in of 100 iterations and a thinning of 5 iterations, since the convergence analysis indicates the algorithm can converge in fewer than 100 iterations. \begin{table}[] \centering \vspace{-0.35cm} \scriptsize \setlength{\tabcolsep}{3pt} \begin{tabular}{lllllllllll} \hline & SH601988 & SH601601 & SH600028 & SH600016 & SH601186 & SH601328 & SH601628 & SH601939 & SH510300 & SH510050\\ \hline GBT Min & 5.235 & 5.814 & 5.235 & \textbf{6.381}& 5.819 & 5.700 & 5.734 & 5.785 & 5.462 & 6.297 \\ IID Min & \textbf{4.567} &\textbf{5.700}& \textbf{4.843} & 6.490 & \textbf{5.104} & \textbf{5.658} & \textbf{5.445} & \textbf{5.435} & \textbf{4.876} & \textbf{5.767} \\ GBT Mean & 6.476 & \textbf{7.367} & 6.764 & 8.053 & 7.066 & 7.250 & 7.206 & 7.242 & 6.769 & 7.776 \\ IID Mean & \textbf{6.239} & 7.449 & \textbf{6.664} & \textbf{7.831} & \textbf{6.558} & \textbf{7.081} & \textbf{7.002} & \textbf{7.031} & \textbf{6.450} & \textbf{7.492} \\ \hline \end{tabular} \vspace{-0.3cm} \caption{Minimal and mean MSE measures after burn-in across different iterations for GBT and IID models on the 10 alpha matrices from 10 assets. In all cases, $K=10$ is set as the latent dimension. In most cases, the results of IID converge to a smaller value than the GBT model.} \label{table:comparis_gbt_iid_mse} \vspace{-0.1cm} \end{table} \begin{figure*}[h] \centering \vspace{-0.3cm} \subfigtopskip=2pt \subfigbottomskip=9pt \subfigcapskip=-5pt \subfigure[Ten different portfolios where we initialize each portfolio with a unitary value for clarity.]{\includegraphics[width=0.49\textwidth]{imgs/bid_iid_datasets_ashare.pdf} \label{fig:bid_iid_datasets_ashare}} \subfigure[Portfolio values with the same strategy by using different alphas via comparative selection models.]{\includegraphics[width=0.49\textwidth]{imgs/bid_iid_portfolio_ashare.pdf} \label{fig:bid_iid_portfolio_ashare}} \vspace{-0.7cm} \caption{Portfolio values of the ten assets (left), and the portfolio values (right) of different methods where we split by in-sample and out-of-sample periods, and initialize with a unitary value for each period. The proposed IID performs better in the out-of-sample period (see also Table~\ref{table:iid_selected_mean_ic}).} \label{fig:bid_iid_portfolio_ashare_full} \end{figure*} \subsection{Convergence and Comparative Analysis} We first show the rate of convergence over iterations on different assets. Due to space constraints, we omit convergence results for the first five assets and only present those for portfolios SH510050, SH510300, SH601939, SH601628, and SH1303. Results for the other assets are qualitatively similar. We run GBT and IID models with $K=10$ for the five datasets where $214$ is the full rank of the matrices, and the error is measured by MSE. Figure~\ref{fig:iid_alpha_convergence} shows the rate of convergence over iterations. Figure~\ref{fig:iid_alpha_autocorrelation} shows autocorrelation coefficients of samples computed using Gibbs sampling. We observe that the mixings of the IID are close to those of GBT. When the lags are greater than ten, the coefficients are less than 0.1, indicating that the Gibbs sampler mixes well. In all experiments, the algorithm converges in less than 100 iterations. We also observe that the IID model does not converge to a larger error than the vanilla GBT model, though we put more emphasis on selecting the columns with high RankIC. Table~\ref{table:comparis_gbt_iid_mse} presents the minimal MSE and mean MSE after burn-in across different iterations for GBT and IID models on the ten alpha matrices from ten assets. In most cases, the IID can even converge to a smaller MSE value. \begin{algorithm}[!htb] \caption{Alpha selection for portfolio allocation. Gibbs sampler for GBT and GBTN ID models. Select holding period $h$, number of alphas to select $M$. } \label{alg:iid_alpha_selection} \begin{algorithmic}[1] \STATE Split the alpha matrix for in-sample (IS) and out-of-sample (OS) evaluations: $$ \bm{A}_{\text{in}} = \bm{A}_s[:,0:D_{\text{in}}] \in \mathbb{R}^{N\times D_{\text{in}}}, \,\,\,\,\,\,\,\, \bm{A}_{\text{out}} = \bm{A}_s[:,D_{\text{in}}+1:D]\in \mathbb{R}^{N\times (D-D_{\text{in}})}; $$ \STATE Using ID to decide the alphas to be selected on matrix $\bm{A}_{\text{in}}^\top$, with the selected indices $\bm{m}$: $$ \widehat{\bm{A}}_{\text{in}} = \bm{A}_s[\bm{m},0:D_{\text{in}}] \in \mathbb{R}^{\textcolor{blue}{M}\times D_{\text{in}}}, \,\,\,\,\,\,\,\, \widehat{\bm{A}}_{\text{out}} = \bm{A}_s[\bm{m},D_{\text{in}}+1:D]\in \mathbb{R}^{\textcolor{blue}{M}\times (D-D_{\text{in}})}; $$ \FOR{$m=1$ to $M$} \STATE Using the $m$-th IS alpha vector $\bm{a}_m=\widehat{\bm{A}}_{\text{in}}[m,:]\in \mathbb{R}^{D_{\text{in}}}$ to decide the weight $\bm{w}$ and interception $b$ via ordinary least squares (OLS) so that the MSE between the prediction $\bm{a}_m^\top\bm{w}_m +b_m$ and the shifted return vector $\bm{r}^h$ is minimized, i.e., minimizing $\text{MSE}(\bm{a}_m^\top\bm{w}_m +b_m, \bm{r}^h)$. The weight and interception are then used in OS evaluation. \ENDFOR \FOR{$d=1$ to $D-D_{\text{in}}$} \STATE On each day in the OS period, we use the mean evaluation of each prediction from the $M$ alphas to decide to go long or not, i.e., to go long if $\sum_{m=1}^M \bm{a}_m^\top\bm{w}_m +b_m >0$; and do nothing otherwise since we restrict the analysis to long-only portfolios. Though we employ a long-only portfolio, we can favor a \textit{market-neutral strategy}: we open long positions only when we anticipate that at least half of the stocks will rise on the following $h$ day, and we weight each stock equally. \ENDFOR \end{algorithmic} \end{algorithm} \begin{table}[] \centering \vspace{-0.4cm} \setlength{\tabcolsep}{10pt} \small \begin{tabular}{lllll} \hline Methods & Highest RankIC & Randomized ID & BID with GBT & BID with IID \\ \hline Mean RankIC & \textbf{0.1035} & 0.0651 & 0.0553 & \textbf{0.0752} \\ Mean Correlation & 0.2276$\downarrow$ & 0.5741$\downarrow$ & \textbf{0.1132} & \textbf{0.1497} \\ \hline Sharpe Ratio (OS) & 1.0276 & 1.0544 & 0.5045 & \textbf{1.5721} \\ Sharpe Ratio (IS) & \textbf{2.6511} & 1.3019 & 1.4965 & 2.3231 \\ \hline Annual Return (OS) & 0.1043 & 0.0932 & 0.0484 & \textbf{0.1633} \\ Annual Return (IS) & \textbf{0.4390} & 0.2281 & 0.2425 & 0.3805 \\ \hline Max Drawdown (OS) & 0.0632 & \textbf{0.0373} & \textbf{0.0484} & \textbf{0.0552} \\ Max Drawdown (IS) & \textbf{0.0892} & 0.1548 & 0.1232 & \textbf{0.0975} \\ \hline \end{tabular} \vspace{-0.3cm} \caption{Mean RankIC and correlation of the selected alphas across various assets for different methods. A higher mean RankIC and a lower mean correlation are better. The proposed IID method can find the trade-off between the mean RankIC and the mean correlation. In all cases, \textit{IS} means in-sample measurements, and \textit{OS} means out-of-sample measurements. The symbol ``$\downarrow$" means the performance is extremely poor. } \label{table:iid_selected_mean_ic} \end{table} \subsection{Quantitative Strategy} After executing the GBT and IID algorithms for computing the interpolative decomposition of each asset's alpha matrix, the state vector $\bm{r}$ for each asset is saved and the ten alphas with the largest mean selection during the 1,000 iterations are chosen (with a burn-in of 100 iterations, and thinning of 5 iterations). Then we follow the quantitative strategy in Algorithm~\ref{alg:iid_alpha_selection} (in which case $h=1$, $N=214$ alphas, $M=10$ alphas, $D=720$ trading days, and $D_{\text{in}}=480$ trading days). The procedure shown in Algorithm~\ref{alg:iid_alpha_selection} is a very simple quantitative strategy. However, the algorithm can show precisely how the proposed IID method can work in practice. The strategy using the alphas selected by the proposed IID method is only slightly worse than the one selecting the \textit{highest RankIC} alphas for the in-sample (IS) performance in terms of Sharpe ratio, annual return, and maximum drawdown; however, the IID performs better in the out-of-sample (OS) scenario and this is what we actually want (see Table~\ref{table:iid_selected_mean_ic} and Figure~\ref{fig:bid_iid_portfolio_ashare}). To evaluate the strategy, we also adopt the Randomized algorithm to compute the ID for comparison \citep{liberty2007randomized}, termed \textit{Randomized ID}. The Randomized ID performs even worse than BID with GBT (see Table~\ref{table:iid_selected_mean_ic}). Though the IID does not select alphas with the highest RankIC values, this does not mean that the alpha selection procedure is meaningless for the following reasons: 1). \textit{Pool size}: We only use a small alpha pool that only contains 214 alpha factors. When the number of alphas is approaching millions or even billions, the alpha selection procedure is expected to work better. 2). \textit{Correlation}: The mean correlation of selected alphas across the ten assets of the proposed IID method is smaller than the highest RankIC method. In this sense, the alphas of the latter method have high correlations and a low diversity. If the correlated alphas have low liquidity or perform poorly during a given period, the strategy's risk might increase. 3). \textit{Machine learning models}: In our test, we only use OLS to find the weight of each alpha. For more complex models, e.g., neural networks, the correlated alphas can cause multi-linear problems so that the performance and interpretability are hampered. 4). \textit{Diversification}: Even if selecting the alphas with the highest RankIC can work well in practice, we also want to diversify the strategies so that we are not exposed to specific risks. The proposed IID method can help find different strategies. \section{Conclusion} The purpose of this paper is to propose a novel Bayesian identification algorithm that can select the most significant features while still representing the entire feature pool. The proposed IID method is computationally efficient and requires minimal additional processing. Overall, we demonstrate that the convergence results of the presented IID model are comparable to those of the existing GBT model. Similar to vanilla GBT, the IID model can ensure numerical stability by restricting the magnitude of the factored matrix to no more than one.
{'timestamp': '2022-09-30T02:07:07', 'yymm': '2209', 'arxiv_id': '2209.14532', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14532'}
arxiv
\section{Introduction}\label{Intro} Online news articles have, over time, started to replace traditional print and radio media as a primary source of information \cite{dallmann2015a}. A varying word choice may have a major effect on the public and individual perception of societal issues, especially since regular news consumers are mostly not fully aware of the degree and scope of bias \cite{spinde2020b}. As shown in existing research~\cite{park2009newscube, baumer2015a}, detecting and highlighting media bias might be relevant for media analysis and to mitigate the effects of biased reports on readers. Also, the detection of media bias can assist journalists and publishers in their work \cite{Spinde2021}. To date, only a few research projects focus on the detection and aggregation of bias \cite{lim2020annotating, Spinde2020INRA}. Even though bias embodies a complex structure, contributions \cite{hube2019neural, chen_analyzing_2020} often neglect annotator background and use crowdsourcing to collect annotations. Therefore, existing data sets exhibit low annotator agreement and inferior quality. Our study holds both theoretical and practical significance. We propose BABE (\textbf{B}ias \textbf{A}nnotations \textbf{B}y \textbf{E}xperts), a data set of media bias annotations, which is built on top of the MBIC data set \cite{spinde2021mbic}. MBIC offers a balanced content selection, annotations on a word and sentence level, and is with 1,700 annotated sentences one of the largest data sets available in the domain. BABE improves MBIC, and other data sets, in two aspects. First, annotations are performed by trained experts and in a larger number. Second, the corpus size is expanded considerably with additional 2,000 sentences. The resulting labels are of higher quality and capture media bias better than labels gathered via crowdsourcing. In sum, BABE consists of 3,700 sentences with gold standard expert annotations on the word and sentence level.\footnote{We also provide another 1,000 yet unlabeled sentences for future work. We have not labeled them to date due to resource restrictions.} To analyze the ideal trade-off between the number of sentences, annotations, and human annotation cost, we divide our gold standard into 1,700 and 2,000 sentences, which are annotated by eight and five experts, respectively.\footnote{With the 1,700 stemming from MBIC \cite{spinde2021mbic}.} Lastly, we train and present a neural BERT-based classifier that outperforms existing approaches such as the one by \citet{Spinde2021}. Even though neural network architectures have been applied to the media bias domain \cite{hube2019neural,chen_analyzing_2020}, their data sets created using crowdsourcing do not exhibit similar quality as our expert data set. In addition, we include five state-of-the-art neural models in our comparison and extend two of them in a distant supervision approach \cite{tang2014,deriu2017}. Leveraging large amounts of distantly labeled data, we formulate a pre-training task helping the model to learn bias-specific embeddings by considering bias information when optimizing its loss function. For the classification presented in this paper, we focus on sentence level bias detection, which is the current standard in related work (Section \ref{sec:relatedwork})\footnote{Our data set is in English language, which is also currently most common in the domain \cite{Spinde2021e}.}. We address future work on word level bias in Section \ref{sec:discussion}. We publish all our code and resources on \url{https://github.com/Media-Bias-Analysis-Group/Neural-Media-Bias-Detection-Using-Distant-Supervision-With-BABE}. \section{Related Work}\label{sec:relatedwork} Media bias can be defined as slanted news coverage or internal news article bias \cite{recasens2013a}. While there are multiple forms of bias, e.g., bias by personal perception or by the omission of information \cite{PUGLISI2015647}, our focus is on bias caused by word choice, in which different words refer to the same concept. For a detailed explanation of the types of media bias, we refer to \citet{Spinde2021}. In the following, we summarize the existing literature on bias data sets and media bias classification. \subsection{Media Bias Data Sets}\label{sec:data sets} \citet{lim2018b} present 1,235 sentences labeled for word and sentence level bias by crowdsource workers. All the sentences in their data set focus on one event. Another data set focusing on just one event is presented by \citet{10.1145/3340531.3412876}. It consists of 2,057 sentences from 90 news articles, annotated with bias labels on article and sentence levels, and contains labels such as overall bias, hidden assumption, and framing. The annotators agree with a Krippendorff's $\alpha$ = -0.05. \citet{lim2020annotating} also provide a second data set with 966 sentences labeled on the sentence level. However, their reported interrater-agreement (IRR) of Fleiss' Kappa on different topics averages at zero. \citet{baumer2015a} classify framing in political news. Using crowdsourcing, they label 74 news articles from eight US news outlets, collected from politics-specific RSS feeds on two separate days. \citet{chen_analyzing_2020} create a data set of 6,964 articles containing political bias, unfairness, and non-objectivity labels at the article level. Altogether, they present 11 different topics such as “presidential election”, “politics”, and “white house”. \citet{fan2019a} present 300 news articles containing annotations for lexical and informational bias made by two experts. They define lexical bias as bias stemming from specific word choice, and informational bias as sentences conveying information tangential or speculative to sway readers’ opinions towards entities \cite{fan2019a}. Their data set, BASIL, allows for analysis at the token level and relative to the target, but only 448 sentences are available for lexical bias. Under the name MBIC, \citet{spinde2021mbic} extract 1,700 sentences from 1,000 news articles. Crowdsource workers then label bias and opinion on a word and sentence level using a survey platform that also surveyed the annotators' backgrounds. MBIC covers 14 different topics and yields a Fleiss' Kappa score of 0.21. Even though the referenced data sets contribute valuable resources to the media bias investigation, they still have significant drawbacks, such as (1) a small number of topics \cite{lim2018b, lim2020annotating}, (2) no annotations on the word level \cite{lim2018b}, (3) low inter-annotator agreement \cite{spinde2021mbic, lim2020annotating, baumer2015a, lim2018b}, and (4) no background check for its participants (except \cite{spinde2021mbic}). Also, some related papers focus on framing rather than on bias \cite{baumer2015a, fan2019a}, and results are only partially transferable. Our work aims to address these weaknesses by gathering sentence level annotations about bias by word choice over a balanced and broad range of topics. The annotations are made by trained expert annotators with a higher capability of identifying bias than crowdsource workers. \subsection{Media Bias Classification Systems} Several studies tackle the automated detection of media bias \cite{hube2018detecting, spinde2020a, chen_analyzing_2020}. Most of them use manually created features to detect bias \cite{hube2018detecting}, and are based on traditional machine learning models \cite{Spinde2021}. \citet{recasens2013a} identify sentence level bias in Wikipedia using supervised classification. They use a bias lexicon and a set of various linguistic features (e.g., assertive verbs, sentiment) with a logistic regression classifier, identifying bias-inducing words in a sentence. They also report that crowdsource workers struggle to identify bias words that their classifier is able to detect. \citet{Spinde2021} create a media bias data set (i.e., MBIC) and develop a feature-based tool to detect bias-inducing words. The authors identify and evaluate a wide range of linguistic, lexical, and syntactic features serving as potential bias indicators. Their final classifier returns an $F_{1}$-score of 0.43 and 0.79 AUC. Spinde et al. point out the explanatory power of various feature-based approaches and the performance of their own model on the MBIC data set. Yet, their results indicate that Deep Learning models are promising alternatives for future work. \citet{hube2018detecting} propose a semi-automated approach to extract domain-related bias based on word embeddings properties. The authors combine bias words and linguistic features (e.g., report verbs, assertive verbs) in a random forest classifier to detect sentence level bias in Wikipedia. They achieve an $F_{1}$-score of 0.69 on a newly created ground truth based on Conservapedia.\footnote{\url{https://conservapedia.com/Main\_Page}, accessed on 2021-04-10.} In their following work, \citet{hube2019neural} propose a neural statement-level bias detection approach based on Wikipedia data. Using recurrent neural networks (RNNs) and different attention mechanisms, the authors achieve an $F_{1}$-score of 0.77, indicating a possible advantage of neural classifiers in the domain. \citet{chen_analyzing_2020} train a RNN to classify article-level bias. They also conduct a reverse feature analysis and find that, at the word level, political bias correlates with categories such as negative emotion, anger, and affect. To summarize, most approaches use manually created features, leading to lower performance and poor representation. The few existing contributions on neural models are based on naive data sets (cf. Section \ref{sec:data sets}). Therefore, we decided to develop a neural classifier trained on BABE. Our system incorporates state-of-the-art models and improves their pre-training step through distant supervision \cite{tang2014,deriu2017}, allowing the model to learn bias-specific embeddings, thus improving its representation. Almost all models focus on sentence level bias, describing it as the lowest meaningful level that can be aggregated to higher levels, like the document level. Therefore, we follow the standard practice and construct a sentence level classifier. \section{Data Set Creation}\label{sec:data} Since media bias by word choice rarely depends on context outside the sentences \cite{fan2019a}, we focused on gathering sentences only. To tackle the weaknesses of existing bias data sets, we created a robust and diverse corpus containing \textbf{B}ias \textbf{A}nnotations \textbf{B}y \textbf{E}xperts (BABE). \subsection{Data Collection} The general data collection and annotation pipeline is outlined in Figure \ref{workflow}. Similar to the filtering strategy proposed by \citet{Spinde2021}, the sentences should contain more biased than neutral sentences. BABE contains 3,700 sentences, 1,700 from MBIC \cite{spinde2021mbic} and additional 2,000. Like \citet{spinde2021mbic}, we extracted our sentences from news articles covering 12 predefined controversial topics.\footnote{The list of topics is provided at the repository mentioned in Section \ref{Intro}.} The articles were published on 14 US news platforms from January 2017 until June 2020. We focused on the US media since their political scenario became increasingly polarizing over the last years \cite{atkins2016skewed}. \begin{figure}[H] \centering \small \def0.905{0.905} \input{Figures/workflow_pdf_V2} \caption{\label{workflow}Data collection and annotation pipeline} \end{figure} We selected appropriate left-wing, center, and right-wing news outlets based on the media bias chart provided by Allsides.\footnote{\url{https://www.allsides.com/media-bias/media-bias-chart}, accessed on 2021-04-13.} The sentence collection was performed on the open-source media analysis platform Media Cloud.\footnote{\url{https://mediacloud.org/}, accessed on 2021-04-13.} The collection process was as follows. We defined keywords describing every topic in one word or a short phrase, specified the news outlets, their time frame, and retrieved all available links for the relevant articles.\footnote{The keywords can be found at the repository mentioned in Section \ref{Intro}.} Then, we extracted sentences by manually inspecting the provided list of articles. The sentence selection was based on our media bias annotation guidelines comprising diverse examples of biased and neutral text instances (see Section \ref{sec:data_annotation}). \subsection{Data Annotation} \label{sec:data_annotation} As laid out in Section \ref{sec:relatedwork}, high-quality annotations are often obtained if the participants are properly instructed and have sufficient training \cite{fan2019a,Spinde2021}. We compare our expert annotations with the crowdsourced labels provided by \citet{spinde2021mbic} to further analyze quality differences between the two groups. Our results show that expert annotators render more qualitative bias labels than MBIC's crowdsourcers. We define as an expert a person with at least six months of experience in the media bias domain and underwent sufficient training to (1) reliably identify biased wording, (2) distinguish between bias and plain polarizing language, and (3) take on a politically neutral viewpoint when annotating.\footnote{Note: We cannot guarantee that a media bias expert is fully neutral, but we assume that an expert is able to leave political viewpoints aside to a substantial extent.} To build up such experience, we developed detailed instruction guidelines that are presented before the annotation task.\footnote Available on the repository mentioned in Section \ref{Intro}.} The instructions are substantially more comprehensive than instructions in a crowdsourcing setting. Considering that the annotation of bias on a fine-grained linguistic level is a complex task, and cognitive and language abilities likely have an impact on text perception \cite{kause2019framing}, we hired only master students from programs completely held in English, who were among the top 20\% with respect to their grade. Based on an iterative feedback loop between all annotators and us, we refined the guidelines multiple times with richer and clearer details. We discussed and evaluated existing annotations weekly as a group during the first three weeks of each annotator's work. We also always asked each annotator to hand in annotations before the discussion sessions, so they could not influence each other. The annotators had to provide basic reasoning about their annotation decisions during our discussions. We maintained the labels only if the annotators were able to elaborate their annotations. Annotations of one annotator were discarded based on this method. Apart from evaluation and instructions, each annotator rated at least 1,700 sentences to improve experience over time.\footnote{The same sentences as in MBIC.} On average, per hour, they were paid 15,00\texteuro ~and labeled 40 sentences, costing approximately 10,000\texteuro . The sum of money required to obtain a sufficient number of reasonable bias labels can be restrictive for media bias research. Therefore, BABE represents a major contribution that alleviates the lack of high-quality annotations in the domain. The annotators were instructed to label carefully and not as fast as possible, even though this resulted in a higher overall cost. The general instructions for the annotation task were identical to the approach by \citet{spinde2021mbic}. First, raters were asked to mark words or phrases inducing bias. Then, we asked them to indicate whether the whole sentence was \textit{biased} or \textit{non-biased}. Lastly, the annotators labeled the sentence as \textit{opinionated}, \textit{factual}, \textit{or mixed}. As our resources were limited and the ideal trade-off between the number of sentences and annotators per sentence is not yet determined, we organized BABE into subgroups (SG), as described below: \begin{itemize} \item \textbf{SG1}. 1,700 sentences annotated by eight expert raters each. \item \textbf{SG2}. 3,700 sentences annotated by five expert raters each. \end{itemize} For SG1, we hired eight raters to annotate the 1,700 sentences (same as MBIC) on word and sentence levels \citep{spinde2021mbic}.\footnote{In the original MBIC data set, each sentence was evaluated by ten crowdsource workers \cite{spinde2021mbic}.} Thereby, we obtained an expert-labeled ground truth comparable to MBIC's crowdsourcing results. For SG2, five of the previous eight annotators also labeled the 2,000 additionally collected sentences. We explored the ideal number of annotators by sampling. 5 annotators is a compromise between the agreement quality for both the bias and opinion labels, assuming that the annotation quality stays the same. To show the difference to 8 annotators, and as an outlook into future extensions of the data set, we also release the codings made by 8 raters\footnote{But recommend to use 5-person ratings when using the full data set.}. We will also add detailed statistics and results about all data and point out our selection process more clearly. As resources and time were limited, we leave the inclusion of further annotators and more sentences to future work. All raters were master students with a background in Data Science, Computer Science, Psychology, or Intercultural Communication. The groups and their annotators are described in detail in the repository mentioned in Section \ref{Intro}. \subsection{Evaluation of Data Sets} The raw labels obtained during the annotation phase were processed as follows. We calculated an aggregated bias/opinion label for every sentence based on a majority vote principle. For instance, if a sentence was labeled as biased by more than four expert annotators in SG1, we assigned the label \textit{biased} to the sentence. Otherwise, the sentence was marked as \textit{non-biased}.\footnote{Note: In SG2, the threshold reduced respectively due to the lower number of expert annotators.} The annotators did not agree on a label (no majority vote) in some sentences. Here, we assigned the label \textit{no agreement}. Our annotation scheme allows respondents to mark biased words. In SG1, a word is marked as biased if at least three annotators label it as such. In SG2, the threshold is subsequently reduced to two expert annotators labeling a word as biased.\footnote{We manually inspected all instances to determine reasonable thresholds.} We compute agreement metrics on the sentence level to acquire knowledge about data quality resulting from all annotation approaches. Our agreement metric choice is Krippendorff's $\alpha$ \cite{krippendorff2011computing}, which is a robust agreement metric for studies including varying numbers of annotators per text instance \citep{antoine-etal-2014-weighted}. We first compared the annotations resulting from MBIC's crowdsourcing approach with our expert-based approach, including eight annotators labeling 1,700 sentences (SG1). Table \ref{results_table} shows the agreement scores for the bias and opinion labels on a sentence level. Considering the bias agreement, SG1 exhibits fair agreement ($\alpha$ = 0.39) and outperforms MBIC's agreement score ($\alpha$ = 0.21).\footnote{The scoring interpretations are based on guidelines published by \citet{landis1977measurement}.} A similar pattern can be observed regarding the opinion labels (i.e., SG1: $\alpha$ = 0.46; MBIC: $\alpha$ = 0.26). Furthermore, MBIC's crowdsourcers labeled more words as biased compared to SG1's experts, i.e., 3,283 vs. 1,530 (absolute) and 2.40 vs. 1.95 (average per biased sentence). Even though media bias detection is generally a difficult task, our inter-annotator agreement is much higher than in existing research in the domain, where $\alpha$ ranges between 0 and 0.20, as shown in Section \ref{sec:relatedwork}. \begin{table}[t] \centering \resizebox{0.4\textwidth}{!}{ \begin{threeparttable} \begin{tabular}{lcc} \hline \multirow{2}{*}{\textbf{Metric}} & \multicolumn{2}{c}{\textbf{Data}}\\ \cline{2-3} & SG1 & MBIC \\ \hline Bias Agreement\textsuperscript{1} & 0.39 & 0.21\\ Opinion Agreement\textsuperscript{1} & 0.46 & 0.26 \\ Total Biased Words & 1530\textsuperscript{3} & 3283\textsuperscript{3} \\ $\varnothing$ Biased Words \textsuperscript{2} & 1.95 & 2.40 \\ \hline \end{tabular} \begin{tablenotes} \small \item[1] Calculated based on Krippendorff's $\alpha$ \item[2] Average of bias words per biased sentence \item[3] Out of 56,826 words in total \end{tablenotes} \end{threeparttable} } \caption{\label{results_table} Annotation results for the expert-annotated (SG1) and crowdsourced (MBIC) approach based on 1,700 sentences.} \end{table} Table \ref{label_dist} shows the label distribution comparison between SG1 and MBIC.\footnote{Absolute numbers for all labels are reported in the code files at the repository mentioned in Section \ref{Intro}.} We can observe that our expert annotators (SG1) are more conservative in their annotation than the crowdsourcers (MBIC). In the expert data, 43.88\% of the sentences are labeled as biased, whereas the crowdsources annotated 59.88\%. The opinion labels' distribution is fairly balanced in both the expert annotator and crowdsourced data. Factual sentences occur slightly more often than opinionated sentences in both data sets. \begin{table} \centering \resizebox{0.36\textwidth}{!}{ \begin{threeparttable} \begin{tabular}{lcc} \hline \multirow{2}{*}{\textbf{Label}} & \multicolumn{2}{c}{\textbf{Data}}\\ \cline{2-3} & SG1 & MBIC \\ \hline Biased & 43.88\% & 59.88\%\\ Non-biased & 47.05\% & 31.35\% \\ No agreement & 9.05\% & 8.76\% \\ \cdashline{1-3} Opinionated & 25.00\% & 30.65\%\\ Factual & 37.59\% & 33.65\% \\ Mixed & 26.64\% & 25.47\% \\ No agreement & 10.76\% & 10.24\% \\ \hline \end{tabular} \end{threeparttable} } \caption{\label{label_dist} Class distribution for SG1's and MBIC's 1700 sentences. } \end{table} Next, we evaluate our expert-based annotation approach, including five expert annotators labeling 3,700 sentences (SG2) in comparison to 1,700 (SG1). We compare metrics between both approaches to ascertain whether the reduced number of annotators in SG2 has a substantial impact on the annotator agreement. The finding could yield implications for future research on our extended dataset (SG2). Table \ref{results_table2} shows agreement metrics for the bias and opinion labels of both expert-annotated approaches, and Table \ref{results_table3} represents label distributions. SG2 exhibits moderate agreement ($\alpha$ = 0.40) in the bias annotation task, and slightly outperforms SG1 ($\alpha$ = 0.39). Regarding the opinion labels, we observe a similar pattern, with SG2 outperforming SG1 more substantially (SG2: $\alpha$ = 0.60; SG2: $\alpha$ = 0.46). The expert annotators of SG1 are more conservative in labeling bias than SG2 (SG1: 43.88\% vs. SG2: 49.26\% labeled as biased).\footnote{Due to the uneven number of annotators in SG2, "no agreement" cases do not exist here.} The opinion labels are distributed marginally skewed in both annotator groups. Factual sentences occur more often than opinionated sentences in both data sets. Further statistics on SG 1 and SG 2 such as bias/opinion distribution per news outlet and topic, the connection between bias and opinion, and the overall topic distribution are provided in the repository mentioned in Section \ref{Intro}. \begin{table}[t] \centering \resizebox{0.4\textwidth}{!}{ \begin{threeparttable} \begin{tabular}{lcc} \hline \multirow{2}{*}{\textbf{Metric}} & \multicolumn{2}{c}{\textbf{Data}}\\ \cline{2-3} & SG1 & SG2 \\ \hline Bias Agreement\textsuperscript{1} & 0.39 & 0.40\\ Opinion Agreement\textsuperscript{1} & 0.46 & 0.60 \\ \hline \end{tabular} \begin{tablenotes} \small \item[1] Calculated based on Krippendorff's $\alpha$ \end{tablenotes} \end{threeparttable} } \caption{\label{results_table2}Data set annotation results for the expert-based approaches (left: eight annotators labeling 1,700 sentences (SG1); right: five annotators labeling 3,700 sentences (SG2)).} \end{table} \begin{table}[t] \centering \resizebox{0.4\textwidth}{!}{ \begin{threeparttable} \begin{tabular}{lcc} \hline \multirow{2}{*}{\textbf{Label}} & \multicolumn{2}{c}{\textbf{Data}}\\ \cline{2-3} & SG1 & SG2 \\ \hline Biased & 43.88\%& 49.26\%\\ Non-biased & 47.05\% & 50.70\% \\ No agreement & 9.05\% & 0.00\% \\ \cdashline{1-3} Opinionated & 25.00\% & 23.35\%\\ Factual & 37.59\% & 43.54\% \\ Mixed & 26.64\% & 27.21\% \\ No agreement & 10.76\% & 5.88\% \\ \hline \end{tabular} \end{threeparttable} } \caption{\label{results_table3}Data set class distribution for the expert-based approaches (left: eight annotators labeling 1,700 sentences (SG1); right: five annotators labeling 3,700 sentences (SG2)).} \end{table} \section{Methodology}\label{sec:methodology} We propose the use of neural classifiers with automated feature learning capabilities to solve the given media bias classification task. A distant supervision framework, similar to \citet{tang2014}, allows us to pre-train the feature extraction algorithms leading to improved language representations, thus, including information about a sample's bias. As obtaining large amounts of pre-training labeled data using humans is prohibitively expensive, we resort to noisy yet abundantly available labels that provide supervisory signals. \subsection{Learning Task} Given a corpus $X$ and a randomly sampled sequence of tokens $x_i \in X$ with $i \in \{1,...,N\}$, the learning task consists of assigning the correct label $y_i$ to $x_i$ where $y_i \in \{0,1\}$ represents the \textit{neutral} and \textit{biased} classes, respectively. The supervised task can be optimized by minimizing the binary cross-entropy loss \begin{equation} \label{eq:loss} \mathcal{L} := - \frac{1}{N} \sum_{i=1}^{N} \sum_{k=\{0,1\}} f_k(x_i) \cdot log(\hat{f_k}(x_i)). \end{equation} where $f_k(\cdot)$ is a binary indicator triggering 0 in the case of neutral labels and 1 in the case of a biased sequence. $\hat{f}_k(\cdot)$ is a scalar representing the language model score for the given sequence. \subsection{Neural Models} We fit $\hat{f}_k(\cdot)$ using a range of state-of-the-art language models. Central to the architectural design of these models is \citet{vaswani2017}'s encoder stack of the Transformer relying solely on the attention mechanism. Specifically, we use the BERT model \citep{devlin2018} and its variants DistilBERT \citep{sanh2019} and RoBERTa \citep{liu2019} that learned bidirectional language representations from the unlabeled text. DistilBERT is a compressed model of the original BERT, and RoBERTa uses a slightly different loss function with more training data than its predecessor. We also evaluate models built on the transformer architecture but differ in the training objective. While DistilBERT and RoBERTa use masked language modeling as a pre-training task, ELECTRA \citep{clark2020} uses a discriminative approach to learn language representations. We also include XLNet \citep{yang2019} in our comparison as an example of an autoregressive model. We systematically evaluate the models' performance on the media bias sentence classification task. We also investigate the impact of an additional pre-training task introduced in the next section on the BERT and RoBERTa models' classification capabilities. \subsection{Distant Supervision} Fine-tuning general language models on the target task has proven beneficial for many tasks in NLP \cite{howard2018}. The language model pre-training followed by fine-tuning allows models to incorporate the idiosyncrasies of the target corpus. For text classification, the authors of ULMFiT \cite{howard2018} demonstrated the superiority of task-specific word embeddings. Before fine-tuning, we introduce an additional pre-training task to improve feature learning capabilities considering media bias content. The typical unsupervised setting used in the general pre-training stage does not include information on language bias in the learning of the embedded space. To remedy this, we incorporate bias information directly in the loss function (equation \ref{eq:loss}) via distant supervision. In this approach, distant or \textit{weak} labels are predicted from noisy sources, alleviating the need for data labeled by humans. Results by \citet{severyn2015} and \citet{deriu2017} demonstrated that pre-training on larger distant datasets followed by fine-tuning on supervised data yields improved performance for sentiment classification. A pre-training corpus is compiled consisting of news headlines of outlets with and without a partisan leaning to learn bias-specific word embeddings. The data source, namely, the news outlets, are leveraged to provide distant supervision to our system. As a result, the large amounts of data necessary to learn continuous word representations are gathered by mechanical means alleviating the burden of collecting expensive annotations. The assumption is that the distribution of biased words is denser in some news sources than in others. Text sampled from news outlets with a partisan leaning according to the Media Bias Chart is treated as biased. Text sampled from news organizations with high journalistic standards is treated as neutral. Thus, the mapping of bias and neutral labels to sequences is automatized. The data collection resembles the collection of the ground-truth data described in Section \ref{sec:data}. The defined keywords reflect contentious issues of the US society, as we assume slanted reporting to be more likely among those topics than in the case of less controversial topics. The obtained corpus consisting of 83,143 neutral news headlines and 45,605 biased instances allows for the encoding of a sequence's bias information in the embedded space. The news headlines corpus serves to learn more effective language representations, it is not suitable for evaluation purposes due to its noisy nature. We ensure that no overlap exists between the distant corpus and BABE to guarantee model to guarantee model integrity with respect to training and testing. \section{Experiments}\label{sec:experiments} \textbf{Training Protocol.} We implement the neural models with HuggingFace's Transformer API \citep{wolf2020}. The model components are instantiated with their pre-trained parameters. Parameters of the classification components are uniformly instantiated and learned. First, we fine-tune and evaluate neural models on BABE. Second, we identify the best performing model of the first run and include the distant supervision pre-training task. \textbf{Implementation.} The hyperparameters remain unchanged for pre-training on the distant corpus and fine-tuning on BABE. Sentences are batched together with 64 sentences per mini-batch because estimating gradients in an online learning situation resulted in less stable estimates. To optimize $\mathcal{L}$, we use the Adam optimization with a learning rate of $5^{-5}$ \citep{kingma2014}. Training on the distantly labeled corpus is performed for one epoch. While training on BABE, convergence can be observed after three to four epochs. A monitoring system is in place that stops training after two epochs without improvement of the loss and restores the parameters of the best epoch. All computations were performed on a single Tesla T4 GPU. All in all, pre-training and training of all models is executed in 5 hours. \textbf{Baseline.} To assess the benefit of modern language models for the domain of media bias, we compare their performance to a traditional feature-based model (Baseline). We use the work by \citet{Spinde2021} as our baseline method, as it offers the most complete set of features for the media bias domain. The authors use syntactic and lexical features related to bias words such as dictionaries of opinion words \citep{hu2004}, hedges \citep{hyland2018a} and assertive and factive verbs \citep{hooper1975a}. \citet{Spinde2021}'s classifier serves as a baseline to evaluate our approach. As feature-based models operate on the word level, we provide comparability by implementing the classification rule that the presence of a predicted biased word leads to the overall sentence being labeled as biased. In contrast, if the baseline model does not label words as biased in a given sequence, the sequence will be classified as neutral. \textbf{Evaluation Metric.} Given the relatively small size of 3,700 sequences in BABE, we report performance metrics averaged on a 5 fold cross-validation procedure to stabilize the results. Because the class distribution in SG1 is slightly unbalanced, we use stratified cross-validation to preserve this imbalance in each fold. Following the standard in the literature, we report a weighted average of $F_1$-scores. \section{Results}\label{sec:results} Table \ref{Tab:class_res} summarizes our performance results. Our baseline using engineered features exhibits low scores of 0.511 and 0.569 for SG1 and SG2, respectively.\footnote{In this Section, we show three decimal places to account for detailed model differences.} BERT improves over the baseline by a large margin of 0.251 points on SG1 and 0.220 points on SG2. DistilBERT exhibits a lower performance for both corpora, whereas RoBERTa is the strongest representative of BERT-based models. Both models based on a different training approach than BERT, namely ELECTRA and XLNet, do not match the performance of BERT and its optimized variants. These results reaffirm established findings of the attention mechanism's advantage over traditional models \cite{e23030283} and indicate the benefits of large pre-trained models' for media bias detection. Models trained and evaluated on SG2 generally perform better due to their bigger corpus size. The increase is around 0.02 points of the macro $F_1$-score for all models except RoBERTa + distant, where it is insignificant. Overall, we believe the improvement indicates that extending the data set in the future will be valuable. Results of the fourth block of table \ref{Tab:class_res} show that the distant supervision pre-training task leads to an improvement over BERT and RoBERTa. Our best performing model BERT + distant on SG2 achieves a macro $F_1$-score of 0.804 and improves over the BERT model by 0.02 points. Media bias can be better captured when word embedding algorithms are pre-trained on the news headlines corpus with distant supervision based on varying news outlets. With the added data, information on a sequence's bias is incorporated in the loss function, which is not the case in "general purpose" language models. \begin{table}[ht] \centering \resizebox{0.49\textwidth}{!}{ \begin{threeparttable} \begin{tabular}{p{3cm}cc} \hline \multirow{2}{*}{\textbf{Model}} & \multicolumn{2}{c}{\textbf{Macro $F_1$}} \\ \cline{2-3} & SG1 & SG2 \\ \hline Baseline & 0.511 (0.008) & 0.569 (0.008) \\ \cdashline{1-3} BERT & 0.762 (0.019) & 0.789 (0.011) \\ DistilBERT & 0.758 (0.029) & 0.777 (0.009)\\ RoBERTa & 0.775 (0.023) & 0.799 (0.011)\\ \cdashline{1-3} ELECTRA & 0.742 (0.020) & 0.760 (0.013)\\ XLNet & 0.760 (0.042) & 0.797(0.015) \\ \cdashline{1-3} BERT + distant & 0.778 (0.017) & \textbf{0.804} (0.014) \\ RoBERTa + distant & \textbf{0.798} (0.022) & 0.799 (0.017)\\ \hline \end{tabular} \begin{tablenotes} \small \item Standard errors across folds in parentheses. \item The first model block shows the best results of feature-based models. The second block of models consists of BERT and optimize variants. The models in the third block use new architectural or training approaches. The fourth block refers to models having learned bias-specific embeddings from the distantly supervised corpora. \item The best results are printed in \textbf{bold}. \end{tablenotes} \end{threeparttable} } \caption{Stratified 5 fold cross-validation results.} \label{Tab:class_res} \end{table} \section{Discussion}\label{sec:discussion} Employing annotators with domain expertise allows us to achieve an inter-annotator agreement of $\alpha$ = 0.40, which is higher than existing data sets \cite{spinde2021mbic}. We believe domain knowledge and training alleviate the difficulty of identifying bias and are imperative to create a strong benchmark due to the complexity of the task. In future work, apart from improving the current data set and classifier, we will also explore why a text passage might be biased, not just its overall classification. Currently, traditional machine learning models are interpretable \cite{Spinde2021} but outperformed by recurrence and attention-based models. Hand-crafted features like static dictionaries cannot adequately address the complexity and context-dependence of bias. We argue that standard metrics (e.g., accuracy and $F_1$) provide a limited perspective into a model's predictive power in case of a complex construct like media bias. Further research needs to tackle these pitfalls to propose systems with better generalization capabilities. A promising starting point might be a more refined evaluation scheme that decomposes the bias detection task into multiple sub-tasks, such as presented in CheckList \citep{ribeiro2020beyond}. This scheme will also allow us to understand how our system performs on different types of bias (e.g., bias by context, by linguistics, by overall reporting). Additionally, we believe that current research on explainable artificial intelligence might increase users' trust in neural-based classifiers. Existing research already presents ways to visualize Transformer-based models and make their results more accessible and interpretable \citep{vig2019}. Lastly, combining neural methods with advances in linguistic bias theory \cite{Spinde2021} to explain a classifier's decision to users will also be part of our future work. For this work, we focused on sentence level bias, which is often used in the media bias domain. Still, in addition to the 3,700 labeled sentences, we also include word level annotations in our data set to encourage solutions focusing on more granular characteristics. We believe that word level bias conveys strong explanatory and structural knowledge and see a detailed word level bias analysis and detection as a promising research direction. \section{Conclusion}\label{sec:conclusion} This work proposes BABE, a new high-quality media bias data set. BABE contains 3,700 labeled sentences, and enables us to compare crowdsourcing and expert annotations directly. Additionally, we propose a sentence level bias classifier based on BERT, which outperforms existing work in the domain. By deriving bias-specific word embeddings using distant supervision, we have improved our classifier even more, achieving a macro $F_1$-score = 0.804. We make all models, data, and code publicly available.\footnote{We publish the link in Section \ref{Intro}.} \section*{Ethics/Broader Impact Statement} Detecting and highlighting media bias instances may have many positive implications and can mitigate the effects of such biases \cite{baumer2015a}. Still, bias is a highly sensitive topic, and some forms of bias especially rely on other factors than the content itself, such as a different perception of any text related to the individual background of a reader. When showing detected bias or news outlet classifications on a political or polarization scale to a reader, every algorithm should be transparent in how the classifications were made. In general, the topic should be handled carefully. We want to point out that it is uncertain if and how actual news consumers would like to obtain such information. Some research groups working on the detection of bias have also started to work on psychological and societal questions related to bias \cite{spinde2020b}. From a social science perspective, it remains to be explored how a classifier can mitigate the negative effects of biased media on society. Generally, when performed in a balanced and transparent way, bias detection might positively affect collective decision-making and opinion formation processes. As such, and to this point, we see no immediate negative ethical or societal impacts of our work beyond what applies to other core building blocks of deep learning. Apart from the system transparency, as mentioned above, one important factor to consider when building, training, and presenting any media bias classifier is a manipulation protection strategy. Participants in any study, especially public ones, should not be able to tweak algorithms and therefore, e.g., flag neutral content as biased to undermine the validity of media bias detection systems. Hence, annotations should always be compared among multiple users, where trustworthiness can at least be largely assured. In open (crowdsourcing) scenarios, collecting user characteristics and consciously implementing specific content (like questions that should give an obvious answer but might be answered differently when users a following any pattern) is important. As a side effect of our project, we experienced that our annotators learned to read the news more critically and reflected more about what they read even after the study ended. We have already started to implement the insights we gained into ways to improve the perception of bias in a game, teaching players to read news with greater care and execute a large study investigating how such a game can affect children, especially in school. Our data set is completely anonymized to preserve the identities of everyone involved. \section*{Acknowledgments} The Hanns-Seidel-Foundation, Germany, supported this work, as did the DAAD (German Academic Exchange Service). We are grateful to our raters, who we will keep anonymous, as we are grateful to Dr. Franz Hahn and Prof. Dr. Jelena Mitrović for helping us to hire a part of the annotators.
{'timestamp': '2022-09-30T02:07:43', 'yymm': '2209', 'arxiv_id': '2209.14557', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14557'}
arxiv
\section*{References}} \usepackage{graphicx} \graphicspath{ {figures/} } \usepackage{amsmath,amssymb} \DeclareMathOperator*{\argmax}{arg\,max} \DeclareMathOperator*{\argmin}{arg\,min} \DeclareMathOperator*{\calL}{\mathcal{L}} \DeclareMathOperator*{\rhovec}{\bm{\rho}} \title{Bayesian Neural Network Versus Ex-Post Calibration For Prediction Uncertainty} \author{% Satya Borgohain \\ Monash University \\ \texttt{satya.borgohain@monash.edu} \\ \And Klaus Ackermann \\ Monash University \\ \texttt{klaus.ackermann@monash.edu} \\ \AND Ruben Loaiza-Maya \\ Monash University \\ \texttt{ruben.loaizamaya@monash.edu} \\ } \begin{document} \maketitle \begin{abstract} Probabilistic predictions from neural networks which account for predictive uncertainty during classification is crucial in many real-world and high-impact decision making settings. However, in practice most datasets are trained on non-probabilistic neural networks which by default do not capture this inherent uncertainty. This well-known problem has led to the development of post-hoc calibration procedures, such as Platt scaling (logistic), isotonic and beta calibration, which transforms the scores into well calibrated empirical probabilities. A plausible alternative to the calibration approach is to use Bayesian neural networks, which directly models a predictive distribution. Although they have been applied to images and text datasets, they have seen limited adoption in the tabular and small data regime. In this paper, we demonstrate that Bayesian neural networks yields competitive performance when compared to calibrated neural networks and conduct experiments across a wide array of datasets. \end{abstract} \section{Introduction}\label{sec:intro} Obtaining well calibrated estimates of probabilities is crucial, particularly in domains where decision making could have direct consequences on human life such as medical diagnosis \cite{Huang2020} and credit approval \cite{beque2017approaches} to name a few. In such scenarios, it is often not enough for a model to be accurate but it also needs to capture and quantify the degree of uncertainty with which it makes such decisions. However, many classification tasks still primarily rely on the classifier's error rate (or accuracy) as the key metric for its selection and deployment in real world use-cases which could lead to over/under confident predictions. Coupled with class imbalance it poses challenges that given a set of features, simply predicting class membership does not help us understand. Raw probabilities estimates provide a more complete picture of the underlying decision making process by the classifiers and alternative diagnostic metrics such as AUC-ROC, precision, recall and F1 certainly help in that regard \cite{kuhn2013applied}. Post-hoc calibration methods are one such approach which helps match the predicted probabilities with the expected class distribution of the target. They take the output of any model and map the score to the empirical probabilities \cite{Kull2017}. Fairness and bias is another closely related field in machine learning and an arena that has received much attention recently. Some of the methods predominantly used there involve thresholding in order to de-bias the learned model against certain classes. However, finding optimal thresholds without optimization are only possible if the classifiers are well-calibrated \cite{Kull2017}. Bayesian neural networks (BNN) have recently emerged as an alternative approach to calibration methods \cite{kingma2013auto}. However, adding Bayesian layers to neural networks alone, does not solve the problem of not receiving well calibrated output as shown in \cite{hortua2020parameter}. A BNN creates a probabilistic model by linking the neural net to the conditional distribution of the outcome of interest. Thus, BNNs directly allow the researcher to measure aleatoric uncertainty without the need for any post-hoc processing steps. Because BNNs are probabilistic models with high-dimensional parameters spaces they are estimated using approximate Bayesian methods such as variational inference \citep{kingma2013auto}. The computation of a posterior distribution implies that BNNs also have the ability to capture epistemic uncertainty. Therefore, unlike calibration methods, the coherent probabilistic nature of BNNs implies that both aleatoric and epistemic uncertainty are considered in the production of out-of-sample predictions. Furthermore, methods such as SWA-Gaussian \cite{maddox2019simple} which tries to approximate the posterior over the parameters using information inherent in the trajectory of SGD have provably shown that Bayesian methods do work well with neural networks to provide well-calibrated probabilities. Platt scaling has also seen much adoption in large neural nets \cite{guo2017calibration}. Despite the modelling benefits of BNNs, their uptake in machine learning has been relatively slow. One of the main reasons is that, to our knowledge, no comprehensive studies have been undertaken to demonstrate the effectiveness of BNNs over calibration approaches, particularly for tabular and smaller datasets. The main purpose of this paper is to fill this gap in the literature. Although there have been notable developments using Bayesian approaches in the field, they usually involve non-tabular datasets with a large sample size. Using a subset of the rich amalgam of datasets considered in \cite{Kull2017}, we investigate if BNNs outperform post-hoc calibration methods in terms of probability calibration. The key contributions of the paper can thus be summarized as follows: \begin{itemize} \item We illustrate that BNNs are a plausible alternative to obtaining well-calibrated empirical probabilities for classification. \item We specifically demonstrate the applicability of BNNs in tabular, real-world, small data regime. \end{itemize} \section{Bayesian neural networks} \begin{figure} \centering \includegraphics[width=\textwidth]{figures/toy_example.pdf} \caption{BNN predictive results for simulation example. Panel (a) displays the true classes, with red corresponding to observation with $y_i=1$ and blue to observations with $y_i=0$. Panel (b) presents the BNN point predictions $\hat{y}_i$, with the same color scheme as panel (a). Panel (c) reports the classification probabilities $\text{Pr}(Y_i=1|\bm{x}_i,\bm{\theta})$.} \label{Fig:toyexample} \end{figure} \subsection{The model} \label{sec:model} Denote as $\bm{y} = \left(y_1,\dots,y_N\right)^\top$ a vector of $N$ realizations of the binary variable $y_i\in\{0,1\}$, as $\bm{x}_i=\left(x_{1,i},\dots,x_{p,i}\right)^\top$ a vector of $p$ covariates with explanatory power on $y_i$, and set $\bm{x} = \left(\bm{x}_1^\top,\dots,\bm{x}_N^\top\right)^\top$. A Bayesian neural network (BNN) is a probabilistic model that links a neural network function $f_{NN}\left(\bm{x}_i,\bm{\theta}\right)$ to the conditional distribution function of $y_i$ (see \cite{mullachery2018bayesian} for an overview on BNNs). For the binary outcomes considered in this paper, we link $f_{NN}\left(\bm{x}_i,\bm{\theta}\right)$ to the conditional probability distribution of $y_i$ via the logistic function $g\left(a\right) = \frac{1}{1+e^{-a}}$, so that \begin{equation}\label{EQ1} p\left(y_i|\bm{x}_i,\bm{\theta}\right) = g\left[f_{NN}\left(\bm{x}_i,\bm{\theta}\right)\right]^{I\left(y_i=1\right)}\left\{1-g\left[f_{NN}\left(\bm{x}_i,\bm{\theta}\right)\right]\right\}^{I\left(y_i=0\right)}, \end{equation} where $I\left(.\right)$ denotes an indicator function that is equal to one if its argument is true, and zero otherwise. Because a BNN fully characterizes the conditional distribution $p\left(y_i|\bm{x}_i,\bm{\theta}\right)$, it has the ability to both, produce point classification predictions as $\hat{y}_i = \argmax_{Y\in\{0,1\}} p(Y|\bm{\theta},\bm{x}_i)$, and also capture the level of classification uncertainty over those predictions as $\text{Pr}(\hat{y}_i = y_i|\bm{\theta},\bm{x}_i)$. Using the assumption that the elements in $\bm{y}$ are conditionally independent, we can then express the likelihood function for the probabilistic neural network as \begin{align*} p\left(\bm{y}|\bm{\theta},\bm{x}\right) =& \prod_{i=1}^{N}p\left(y_i|\bm{x}_i,\bm{\theta}\right). \end{align*} The main challenge in using a BNN is inference. The parameter vector $\bm{\theta}$ has generally thousands of elements, which often makes exact Bayesian estimation infeasible. In the following section we discuss how approximate Bayesian estimation of BNNs can be applied instead. \subsection{Variational inference} In Bayesian estimation the density of interest is that of the parameters of the neural network conditional on the data. This density is denoted here by $p\left(\bm{\theta}|\bm{y}\right)\propto p\left(\bm{y}|\bm{\theta}\right)p\left(\bm{\theta}\right)$, where $p\left(\bm{\theta}\right)$ is the prior density and $\bm{x}$ is dropped for ease of notation . Because of the high-dimensionality of $\bm{\theta}$, exact Bayesian estimation methods are computationally costly, and as such not practical for the problem at hand. Instead, we resort to variational inference (VI) methods, where a density $q_\lambda(\bm{\theta})$ - member of some parametric family of densities - is used to approximate $p(\bm{\theta}|\bm{y})$, and where $\bm{\lambda}$ is a vector of parameters known as variational parameters (see for instance \cite{blei2017variational} and \cite{kingma2013auto}). Variational inference can then be described as an optimization problem, where the aim is to minimize the Kullback-Leibler divergence between $q_\lambda(\bm{\theta})$ and $p(\bm{\theta}|\bm{y})$ with respect to $\bm{\lambda}$, defined as \begin{align*} \text{KL}(q_\lambda(\bm{\theta})||p(\bm{\theta}|\bm{y}) ) & = E_{q_\lambda}\left[ \log \frac{q_\lambda(\bm{\theta})}{p(\bm{\theta}|\bm{y})}\right]. \end{align*} This divergence can be re-written as $\text{KL}(q_\lambda(\bm{\theta}) ||p(\bm{\theta}|\bm{y}) ) = \log p(\bm{y})-\calL(\bm{\lambda}) \label{kldexpression} $, with $p(\bm{y})=\int p(\bm{\theta})p(\bm{y}|\bm{\theta}) d\bm{\theta}$, $h\left(\bm{\theta}\right)=p\left(\bm{y}|\bm{\theta}\right)p\left(\bm{\theta}\right)$ and where $\calL(\bm{\lambda})$ is known as the Evidence Lower Bound (ELBO), given as \begin{equation} \calL(\bm{\lambda})=E_{q_\lambda}\left[\log h(\bm{\theta}) - \log q_\lambda(\bm{\theta})\right]\ . \label{eq:lowerbound} \end{equation} Because $\log p(\bm{y})$ does not depend on $\bm{\lambda}$, minimization of the Kullback-Leibler divergence with respect to $\bm{\lambda}$ is equivalent to maximizing the ELBO; however, ELBO optimization is more computationally feasible as it does not require evaluation of the intractable term $\log p(\bm{y})$. Stochastic gradient ascent methods (SGA) can be applied for maximization of the ELBO, by first setting an initial value $\bm{\lambda}^{(0)}$ for $\bm{\lambda}$, and then sequentially iterating over the expression \begin{align*} \bm{\lambda}^{(i+1)} & = \bm{\lambda}^{(i)}+\bm{\rho}_i \circ \widehat{\nabla_\lambda \calL(\bm{\lambda}^{(i)})}, \;\mbox{ for } i=1,2,\ldots\,, \end{align*} where $\rhovec_i=(\rho_{i1},\dots, \rho_{im})^\top$ denotes a vector of learning rates, `$\circ$' denotes the element-wise product of two vectors, and $\widehat{\nabla_\lambda \calL(\bm{\lambda}^{(i)})}$ is an unbiased estimate of the gradient of $\calL(\bm{\lambda})$ evaluated at $\bm{\lambda}=\bm{\lambda}^{(i)}$. Here, the learning rates are set according to the ADAM method proposed by \cite{kingma2014adam}. The selection of an unbiased and low variance estimate of the ELBO gradient is key to the success of VI. We follow \cite{kingma2013auto} and employ the so called ``reparametrization trick'' . This approach requires a generative formula $\bm{\theta}=k(\bm{\varepsilon},\bm{\lambda})$ from the specific approximating density $q_\lambda$, where the vector $\bm{\varepsilon}$ has density $f_\varepsilon$ which does not depend on $\bm{\lambda}$. The reparametrization trick then allows to re-write the ELBO as \begin{align} \calL(\bm{\lambda}) & = E_{f_\varepsilon}\left[\log h(k(\bm{\varepsilon},\bm{\lambda}))-\log q_\lambda(k(\bm{\varepsilon},\bm{\lambda}))\right]\,. \label{lbdrepar} \end{align} By differentiating (\ref{lbdrepar}), the ELBO gradient can be expressed as \begin{align} \nabla_\lambda \calL(\bm{\lambda}) & = E_{f_\varepsilon}\left[\frac{\partial\bm{\theta}}{\partial\bm{\lambda}}^\top \left\{\nabla_{\theta} \log h(\bm{\theta})-\nabla_{\theta}\log q_\lambda(\bm{\theta})\right\}\right]\,. \label{lbdgradexpr} \end{align} Then, an unbiased low variance estimate of the ELBO gradient can be computed by estimating the expectation in (\ref{lbdgradexpr}) using one random draw from $f_\varepsilon$. The last component of VI is the selection of an adequate approximating family. We follow \cite{ong2018gaussian} and employ a Gaussian approximation with a factor covariance structure, so that \begin{equation} q_\lambda(\bm{\theta})=\phi_{m}\left(\bm{\theta};\bm{\mu},BB'+D^2\right)\,, \label{eq:q} \end{equation} where $\phi_{m}\left(\bm{x};\bm{\mu},\Sigma\right)$, denotes the $m-$variate Gaussian density with mean $\bm{\mu}$ and covariance $\Sigma$, $D$ is a diagonal matrix with diagonal elements $\bm{d} = \left(d_1,\dots,d_m\right)^\top$, $B$ is an $m\times K$ matrix, $K<m$ denotes the number of factors, and $\bm{\lambda} = (\bm{\mu}^\top,\bm{d}^\top,\text{vech}(B)^\top)^\top$, where $\text{vech}$ denotes the half-vectorization operator of a rectangular matrix. With this approximation, the generative formula needed for the reparametrization trick is $\bm{\theta}=k(\bm{\varepsilon},\bm{\lambda}) = \bm{\mu}+B\bm{z}+D\bm{\eta}$, where $\bm{\varepsilon} = \left(\bm{z}^\top,\bm{\eta}^\top\right)^\top$. The terms needed to perform SGA are $\frac{\partial\bm{\theta}}{\partial\bm{\lambda}}$, $\nabla_{\theta}\log q_\lambda(\bm{\theta})$ and $\nabla_{\theta} \log h(\bm{\theta})$. The first two terms were provided in \cite{ong2018gaussian} for the family of approximations used here. The third term can be re-written as \begin{align}\label{Eq:logpost_gradient} \nabla_{\theta} \log h(\bm{\theta}) = \nabla_{\theta} \log p\left(\bm{y}|\bm{\theta}\right) + \nabla_{\theta} \log p\left(\bm{\theta}\right). \end{align} We employ uniform priors for $\bm{\theta}$, which implies that $\nabla_{\theta} \log p\left(\bm{\theta}\right)=\bm{0}$. The remaining term, $\nabla_{\theta} \log p\left(\bm{y}|\bm{\theta}\right)$, can be computed as \begin{align*} \nabla_\theta\log p\left(\bm{y}|\bm{\theta}\right) = &\sum_{\left\{i:y_i=1\right\}}\nabla_\theta f_{NN}\left(\bm{x}_i,\bm{\theta}\right)\\ &-\sum_{i}g\left[f_{NN}\left(\bm{x}_i,\bm{\theta}\right)\right]\nabla_\theta f_{NN}\left(\bm{x}_i,\bm{\theta}\right), \end{align*} where $\nabla_\theta f_{NN}\left(\bm{x}_i,\bm{\theta}\right)$ is the gradient of the neural network function, which can be evaluated using any readily available back propagation algorithm. \subsection{Toy example} To provide some intuition about how the BNN in Section~\ref{sec:model} can be used in practice, we applied it to a simple simulated data set. We started by generating $10000$ realizations of the i.i.d covariates $x_{i,1}\sim N(0,1)$ and $x_{i,2}\sim N(0,1)$. Subsequently, we generated the corresponding $10000$ realizations of $y_i$ from the true data generating process (DGP) \begin{equation}\label{Eq:trueDGP} y_i = I(x_{i,1}<t(x_{i,2})+\epsilon_i), \end{equation} where $\epsilon_i\sim N(0,1)$ is an i.i.d Gaussian error, while the function $t()$ is the Yeo-Johnson transformation \citep{yeo2000new} with parameter $-1$, whose role is to induce non-linearity in the way the two covariates determine $y_{i}$. In order to learn the true DGP in \eqref{Eq:trueDGP}, we applied the BNN to a random subset of $8000$ observations, and used the remaining $2000$ observations to produce out-of-sample predictions. For the choice of $f_{NN}\left(\bm{x}_i,\bm{\theta}\right)$ we used a feedforward neural network with two nodes and three layers. Panel (a) in Figure~\ref{Fig:toyexample} presents the true binary categories of the out-of-sample points as a function of the covariates. The red dots indicate the observations for which $y_i = 1$, while the blue dots display the observations for which $y_i=0$. Although there is some overlap in the classification regions, the red points are concentrated in the top-left quadrant while the blue dots are concentrated in the bottom-right. Panel (b) in Figure~\ref{Fig:toyexample} presents the point predictions $\hat{y}_i$ from the neural network. The point predictions indicate that there is a clear separation threshold. However, we know from panel (a) that the closer the observations are to the threshold, the more classification overlap will be observed and thus the higher the classification uncertainty. Via the computation of the probabilities $\text{Pr}(Y_i=1|\bm{x}_i,\bm{\theta})$, the BNN naturally allow us to measure the classification uncertainty. These probabilities are presented in panel (c) in Figure~\ref{Fig:toyexample}, where the color scale of the dots indicates the classification uncertainty, with green dots indicating higher uncertainty ($\text{Pr}(Y_i=1|\bm{x}_i,\bm{\theta}) \approx 0.5$). The plot indicates that observations located in the top-left corner are classified as $\hat{y}_i=1$ with high certainty as $\text{Pr}(Y_i=1|\bm{x}_i,\bm{\theta}) \approx 1$. Similarly, observations located in the bottom-right corner are classified as $\hat{y}_i=0$ with high certainty as $\text{Pr}(Y_i=1|\bm{x}_i,\bm{\theta}) \approx 0$. Finally, as the observations get closer to the threshold in the middle, the classification uncertainty increases, which indicates the BNN is able to identify the high probability of class overlap in that region. Figure~\ref{fig:reliability-diagram} shows the reliability diagram for the same highlighting different calibration methods which we discuss in Section~\ref{sec:calibration}. \begin{figure}\ \centering \includegraphics[scale=0.45]{figures/calibration-curve.pdf} \caption{Reliability diagram for the Toy dataset. Also known as Calibration curves, they help visually determine the degree of calibration in probabilistic forecast between different models. Here the x-axis represents the predicted probability and y-axis represents the observed relative frequency of membership to class \cite{brocker2007increasing}. The closer the curves are to perfectly calibrated line (diagonal) the better. The log-losses are denoted in the legend beside each method. We observe here that BNN performs better than the other methods.}. \label{fig:reliability-diagram} \end{figure} \section{Post-Hoc probability calibration} \label{sec:calibration} We draw upon the seminal work by \cite{Kull2017} to compare our findings with the recent advances in the literature and follow their benchmark methodology. We benchmark our approach to well established calibration procedures in the literature. The goal of any calibration method is given the output score $s$ of a classifier, to correctly represent the empirical probabilities of a given example belonging to a class. These empirical probabilities can be visualised using reliability diagrams shown in figure \ref{fig:reliability-diagram}. For a given score range from $0.9-1$ on the test set, 90 to 100 percent of the examples should be members of the class. \paragraph{Isotonic calibration} is a non parametric method that uses the ranking of the output of any classifier to assign bins for mapping from score to probability based on how well a the classifier has ranked the examples \cite{10.1145/775047.775151,fawcett2007pav}. This approach requires enough samples for any given bin, which for small datasets causes this procedure to overfit\cite{Kull2017}. \paragraph{Logistic calibration} was introduced by \cite{platt2000probabilities} for support vector machines. It takes the form of $ \mu(s,\gamma,\delta)=\frac{1}{1+1/exp(\gamma \cdot s + \delta)}$, where $\gamma$ and $\delta$ are real valued parameters. This procedure is commonly referred to as Platt scaling. \cite{Kull2017} showed that this procedure has the tendency to lead to worse results after calibration, compared to only relying on the raw output of a given classifier. \paragraph{Beta calibration} was introduced by \cite{Kull2017}, where the underlying modeling assumption is the beta distribution, a probability distribution bound to the interval $[0,1]$. In general, the beta distribution is used for modeling the behaviour of proportions or percentages, and therefore suited to model the score distribution for a given class. Negative log-likelihood (NLL), also referred to as cross-entropy or log-loss, gives us a measure of how well the methods compare. It penalizes predictions that appear to be more confident than they are. In line with the literature \cite{Kull2017}, we use log-loss as our key metric. A measure of accuracy would require the setting of a threshold and might therefore mask the true probabilities of predictions. \section{Experiments} In order to minimize inductive biases imparted by any complex architectural choice, we consider a simple feedforward neural network consisting of just $2$ hidden layers with $4$ ReLU units each. We use ADAM \cite{kingma2014adam} for parameter optimization in both the networks with a global learning rate of $10^{-3}$ or $10^{-2}$ and the following hyperparameters for the same: $\beta_{1} = 0.9$, $\beta_{2} = 0.999$ and $\epsilon = 10^{-7}$. Minimal hyperparameter optimization was done as we mostly selected the default values\footnote{The computation was performed under Ubuntu 18.04 using a Intel(R) Xeon(R) W-2145 CPU @ 3.70GHz and a NVIDIA Quadro P6000 as GPU}. We devise the following strategy to train both the networks: First, we randomly split the dataset between training ($80\%$) and test ($20\%$) followed by further splitting the train set into validation and calibration sets respectively. For each set, we perform stratified sampling to preserve the original class distribution and standardize the feature matrix with the mean and standard deviation of the train set (avoiding data leakage). During the validation stage, we monitor the cross entropy loss in order to find the optimal number of epochs ($\tau$), which correspond to the minimum validation loss, for each model. Thereafter, we train both the models to $\tau$ and use the base neural network to further calibrate its output probabilities with the post-hoc methods as per Section~\ref{sec:calibration}. We also observed from our experiments that on an average, the standard feedforward neural network needed relatively fewer epochs to converge when compared to the BNN and set their maximum number of epochs during the validation stage to be approximately half that of BNN. We note that early stopping as a regularizing strategy proved to be difficult as the loss curves (particularly for BNNs) sometimes exhibit the double descent phenomena \cite{nakkiran2019deep} to varying degrees. Furthermore, we employ a similar strategy as \cite{Kull2017} and binarize the target variable, considering the majority class as $1$ and the rest to be $0$, in order to convert from a multi-class to binary classification setting. We also note that calibrated neural networks are exposed to roughly $\sim20\%$ more data points than BNN due to their use of calibration set. This also illustrates that BNNs can still work remarkably well given fewer data points than its counterparts. We implement our code using TensorFlow with Python 3.6 to conduct the experiments. In particular, we make use of the fast tensor computation for the Jacobian of errors accessed via the gradient tape on GPU. \subsection{Datasets} We evaluate the calibration of all the models on $20$ well-known datasets from the UCI Machine Learning Repository \cite{Dua2019}. Here we consider datasets representing domains such as financial, medical, social, just to name a few, as listed under Table~\ref{uci-datasets-table}. \begin{table} \caption{UCI datasets for used in the experiments.} \label{uci-datasets-table} \centering \begin{tabular}{lrrll} \toprule Name & Features & Samples & Attribute Type(s) & Domain \\ \midrule Abalone & 8 & 4177 & Categorical, Integer, Real & Life (Marine) \\ Balance Scale & 4 & 625 & Categorical & Social \\ Credit Approval & 15 & 653 & Categorical, Integer, Real & Financial \\ German Credit & 20 & 1000 & Categorical, Integer & Financial \\ Ionosphere & 34 & 351 & Integer, Real & Physical \\ Image Segmentation & 19 & 2310 & Real & N/A \\ Landsat Satellite & 36 & 6435 & Integer & Physical \\ Letter Recognition & 16 & 35000 & Integer & Computer \\ Mfeat (Karhunen) & 64 & 2000 & Integer, Real & Computer \\ Mfeat (Morphological) & 6 & 2000 & Integer, Real & Computer \\ Mfeat (Zernike) & 47 & 2000 & Integer, Real & Computer \\ Mushroom & 22 & 8124 & Categorical & Life \\ Optical Digits Recognition & 64 & 5620 & Integer & Computer \\ Page Blocks & 10 & 5473 & Integer, Real & Computer \\ Spambase & 57 & 4601 & Integer, Real & Computer \\ Vehicle & 18 & 946 & Integer & N/A \\ Waveform-5000 & 40 & 5000 & Real & Physical \\ WDBC & 30 & 569 & Real & Life (Cancer) \\ WPBC & 33 & 194 & Real & Life (Cancer) \\ Yeast & 8 & 1484 & Real & Life (Proteins) \\ \bottomrule \end{tabular} \end{table} Neural networks typically require training samples orders of magnitude more than those of the UCI datasets. Although theoretically, small sample sizes makes the network prone to overfitting, we empirically did not observe any drastic effect on their performances in part due to the simple architecture with a relatively small number of parameters. We also note that due to the stochastic nature of our learning algorithms they are sensitive to initialization of the parameters. \subsection{Evaluation} We observe that BNN yields competitive performance (and on average outperforms) when compared to the other calibration methods across the datasets as outlined in Table~\ref{tab:results}. As expected, BNN also performs better than the uncalibrated vanilla neural network in most cases. Additionally, we also track other metrics such as Brier score and Expected Calibration Error (ECE) with a bin size of $10$. Brier score provides the mean squared error for a probabilistic forecast and is given by $\frac{1}{N}\sum_{i=1}^{N}(f_i - o_i)$, where $f_i$ are probabilities and $o_i$ are observed classes. ECE is a popular binning based approach to measuring calibration error which is quite sensitive to the choice of bins and ultimately not as strongly reliable \cite{naeini2015obtaining}. Figure~\ref{Fig:predictions} illustrates the performance of each model on two of the datasets. Interestingly, we also notice for a few datasets that calibrating with the post-hoc methods sometimes leads to further miscalibration and higher log-loss. \begin{figure} \centering \includegraphics[width=\textwidth]{figures/test-predictions.pdf} \caption{Predictions on the Test set for Balance Scale and Mushroom Datasets. The colour scale represents probabilities between $0-1$. Here we perform PCA on the original feature space and plot on the two principle axes.} \label{Fig:predictions} \end{figure} \begin{table} \caption{Log-loss for each dataset. The best method is marked in bold for each row.} \label{tab:results} \centering \begin{tabular}{lrrrrr} \toprule {} & \multicolumn{5}{c}{Methods} \\ \cmidrule(r){2-6} & Uncalibrated & Beta & Isotonic & Logistic & Var Bayes \\ Dataset & & & & & \\ \midrule Abalone & \textbf{0.597890} & 0.598148 & 0.691808 & 0.602227 & 0.615603 \\ Balance Scale & 0.098068 & 0.080771 & 0.092153 & 0.089347 & \textbf{0.069333} \\ Credit Approval & 0.491384 & 0.522863 & 0.897678 & \textbf{0.437511} & 0.457618 \\ German Credit & 0.525405 & \textbf{0.517368} & 0.532982 & 0.517461 & 0.565519 \\ Ionosphere & 0.385311 & 0.310725 & 0.334547 & \textbf{0.308752} & 0.330256 \\ Image Segmentation & 0.410117 & 0.410120 & 0.410120 & 0.410120 & \textbf{0.012053} \\ Landsat Satellite & 0.549391 & 0.549391 & 0.549391 & 0.549391 & \textbf{0.065981} \\ Letter Recognition & 0.015198 & 0.015066 & 0.015491 & 0.022324 & \textbf{0.012077} \\ Mfeat (Karhunen) & 0.056259 & \textbf{0.052115} & 0.165397 & 0.121016 & 0.067857 \\ Mfeat (Morphological) & 0.325083 & 0.325096 & 0.325096 & 0.325096 & \textbf{0.000206} \\ Mfeat (Zernike) & 0.092498 & 0.070683 & 0.166497 & \textbf{0.048465} & 0.073144 \\ Mushroom & 0.035914 & 0.037741 & 0.037741 & 0.037741 & \textbf{0.033184} \\ Optical Digits Recognition & 0.086171 & 0.056051 & 0.086846 & 0.063662 & \textbf{0.047854} \\ Page Blocks & \textbf{0.071376} & 0.072884 & 0.091231 & 0.082372 & 0.085377 \\ Spambase & 0.225907 & \textbf{0.211673} & 0.212747 & 0.213790 & 0.235523 \\ Toy & 0.376422 & 0.377564 & 0.401984 & 0.391937 & \textbf{0.375313} \\ Vehicle & 0.107625 & 0.331832 & 0.310363 & 0.390933 & \textbf{0.091739} \\ Waveform-5000 & 0.239015 & \textbf{0.234735} & 0.240671 & 0.265519 & 0.238321 \\ WDBC & 0.080406 & 0.164898 & 0.156011 & 0.176233 & \textbf{0.070994} \\ WPBC & 0.584846 & 0.614227 & 1.777795 & 0.594910 & \textbf{0.541680} \\ Yeast & 0.594895 & 0.583243 & 0.806812 & \textbf{0.561925} & 0.569832 \\ \midrule Rank & 2.7619 & 2.6667 & 4.2857 & 3.1905 & \textbf{2.0952} \\ \bottomrule \end{tabular} \end{table} To establish whether the differences between the methods are statistically significant, we follow \cite{demvsar2006statistical} and perform Friedman test across all datasets with the null hypothesis ($H_0$) as there being no significant differences in performance between the classifiers. Considering a significance level of $0.05$, we reject the null with a p-value of $0.000119$ along with a test statistic of $23.13$ and perform a post-hoc analysis based on Wilcoxon-Holm test to further analyse their pairwise differences. Figure~\ref{Fig:critical-diff} illustrates the critical difference diagram with pairwise significance. Here we observe that BNN (Var Bayes) have the highest rank as compared to the other methods. However, we also note that pairwise differences between BNN, Uncalibrated, Beta and Logistic are not as significant as that between BNN and Isotonic. Overall BNNs provide competitive, if not better, performance as its calibrated counterparts. Interestingly, what \cite{Kull2017} observed for Beta calibration when applied to Adaboost and Naive Bayes classifiers does not perfectly hold for neural nets as evident from our experiments. \begin{figure} \centering \includegraphics[scale=0.5]{CD_diagram-crop.pdf} \caption{Critical difference diagram for log-loss along with ranks for each method.} \label{Fig:critical-diff} \end{figure} \section{Conclusion} In this paper, we propose the use of BNNs as a plausible alternative to obtain well-calibrated probabilities when compared with post-hoc calibration methods such as platt scaling, isotonic and beta calibration for tabular datasets. We performed extensive experiments on 20 datasets using the same neural network architecture as our underlying model. With the the normal neural network implementation we applied the common calibration techniques. Our results show that our proposed method works provably well for tabular datasets with small sample size. We made use of recent advances in fast gradient calculation within TensorFlow framework to calculate the full Jacobian matrix with respect to the parameters, as required for Variational Bayes Inference. Albeit, certain datasets required a larger number of epochs for convergence in the Variational framework. Future research will investigate the impact of different priors such as Horseshoe on the parameters and its impact on convergence and calibration. \section{Ethical and societal implication} BNNs could be applied across many domains where neural networks are starting to be heavily utilized in real world settings and strict $0$ or $1$ outcomes are not desired. Although for most machine learning researchers it is clear that output scores obtained via softmax, for example, do not represent true probabilities, many practitioners interpret the same as otherwise. This becomes especially critical, when decision threshold are set, that have major consequences for an individual. In areas such as, bail or no bail, treatment with some medicine or not, having wrongly calibrated models could lead to detrimental or harmful outcomes \cite{rudin2019stop}. Thresholding is also used to try to make machine learning predictions more fair, by setting different thresholds based on protected attributes such as race or gender \cite{hardt2016equality}. Again in such applications, it is highly important that the thresholds represent actual probabilities rather than a ranking. Similarly, in recent years governments have started to scarcely assign resources to its citizen based on algorithmic decisions to make the most efficient use of their limited resources. Hence it becomes increasingly important that resource allocation prioritizes those who truly need such aid. Alternatively, having well calibrated neural networks could also lead to overconfidence and over reliance on algorithms by decision and policy makers. We would encourage further work of the relationship of calibrated threshold in real world scenarios to fully understand the impact miscalibration has. Nevertheless, we hope our work helps counter these issues and ultimately creates a positive social impact across domains.
{'timestamp': '2022-09-30T02:08:48', 'yymm': '2209', 'arxiv_id': '2209.14594', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14594'}
arxiv
\section{Introduction} Recent research efforts on conditional generative modeling, such as Imagen~\citep{saharia2022photorealistic}, DALL$\cdot$E~2~\citep{ramesh2022hierarchical}, and Parti~\citep{yu2022scaling}, have advanced text-to-image generation to an unprecedented level, producing accurate, diverse, and even creative images from text prompts. These models leverage paired image-text data at Web scale (with hundreds of millions of training examples), and powerful backbone generative models, \textit{i.e.}, autoregressive models~\citep{van2017neural,ramesh2021zero,yu2022scaling}, diffusion models~\citep{ho2020denoising,dhariwal2021diffusion}, \textit{etc.}, and generate highly realistic images. Studying these models' generation results, we discovered their outputs are surprisingly sensitive to the frequency of the entities (or objects) in the text prompts. In particular, when generating text prompts about frequent entities (see Appendix~\ref{frequent}), these models often generate realistic images, with faithful grounding to the entities' visual appearance. However, when generating from text prompts with less frequent entities, those models either hallucinate non-existent entities, or output related frequent entities (see~\autoref{fig:comparison}), failing to establish a connection between the generated image and the visual appearance of the mentioned entity. This key limitation can greatly harm the trustworthiness of text-to-image models in real-world applications and even raise ethical concerns. \begin{figure}[!thb] \centering \includegraphics[width=1.0\linewidth]{comparison.001.jpeg} \caption{{Comparison of images generated by Imagen and {Re-Imagen}\xspace on less frequent entities}. We observe that Imagen hallucinates the entities while {Re-Imagen}\xspace maintains better faithfulness.} \label{fig:comparison} \vspace{-2ex} \end{figure} In this paper, we propose a \textbf{Re}trieval-augmented Text-to-\textbf{Ima}ge \textbf{Gen}erator ({Re-Imagen}\xspace), which alleviates such limitations by searching for entity information in a multi-modal knowledge base, rather than attempting to memorize the appearance of rare entities. Specifically, we define our multi-modal knowledge base encodes the visual appearances and descriptions of entities with a collection of reference \texttt{<}image, text\texttt{>} pairs'. To use this resource, {Re-Imagen}\xspace first uses the input text prompt to retrieve the most relevant \texttt{<}image, text\texttt{>} pairs from the external multi-modal knowledge base, then uses the retrieved knowledge as model additional inputs to synthesize the target images. Consequently, the retrieved references provide knowledge regarding the semantic attributes and the concrete visual appearance of mentioned entities to guide {Re-Imagen}\xspace to paint the entities in the target images. The backbone of {Re-Imagen}\xspace is a cascaded diffusion model \citep{ho2022cascaded}, which contains three independent generation stages (implemented as U-Nets \citep{ronneberger2015u}) to gradually produce high-resolution (\textit{i.e.}, 1024{$\times$}1024) images. In particular, we train {Re-Imagen}\xspace on a dataset constructed from the image-text dataset used by Imagen~\citep{saharia2022photorealistic}, where each data instance is associated with the top-k nearest neighbors within the dataset, based on text-only BM25 score. The retrieved top-k \texttt{<}image, text\texttt{>} pairs will be used as a reference for the model attend to. During inference, we design an interleaved guidance schedule that switches between text guidance and retrieval guidance, which ensures both text alignment and entity alignment. We show some examples generated by {Re-Imagen}\xspace, and compare them against Imagen in~\autoref{fig:comparison}. We can qualitatively observe that the our images are more faithful to the appearance of the reference entity. To further quantitatively evaluate {Re-Imagen}\xspace, we present \textit{zero-shot text-to-image generation} results on two challenging datasets: COCO~\citep{lin2014microsoft} and WikiImages~\citep{chang2022webqa}\footnote{The original WikiImages database contains (entity image, entity description) pairs. It was a crawled from Wikimedia Commons for visual question answering, and we repurpose it here for text-to-image generation.}. {Re-Imagen}\xspace uses an external non-overlapping image-text database as the knowledge base for retrieval and then grounds on the retrieval to synthesize the target image. We show that {Re-Imagen}\xspace achieves the state-of-the-art performance for text-to-image generation on COCO and WikiImages, measured in FID score~\cite{heusel2017gans}, among non-fine-tuned models. For non-entity-centric dataset COCO, the perform gain is coming from biasing the model to generate images with similar styles as the retrieved in-domain images. For the entity-centric dataset WikiImages, the performance gain comes from grounding the generation on retrieved images containing similar entities. We further evaluate {Re-Imagen}\xspace on a more challenging benchmark --- EntityDrawBench, to test the model's ability to generate a variety of infrequent entities (dogs, landmarks, foods) in different scenes. We compare {Re-Imagen}\xspace with Imagen~\citep{saharia2022photorealistic}, DALL-E 2~\citep{ramesh2022hierarchical} and StableDiffusion~\citep{rombach2022high} in terms of faithfulness and photorealism with human raters. We demonstrate that that {Re-Imagen}\xspace can reach around 71\% on the faithfulness score, greatly improving from Imagine's score of 27\% and DALL-E 2's score of 48\% . Analysis shows that the improvement mostly comes from low-frequency entities. To summarize, our key contributions are: {(1)} a novel retrieval-augmented text-to-image model {Re-Imagen}\xspace, which achieves SoTA FID scores on two dasets; {(2)} interleaved classifier-free guidance during sampling to ensure both text alignment and entity fidelity; and {(3)} We introduce EntityDrawBench and show that {Re-Imagen}\xspace can significantly improve faithfulness on less-frequent entities. \section{Related Work} \noindent \textbf{Text-to-Image Diffusion Models} There has been a wide-spread success~\citep{ashual2022knn,ramesh2022hierarchical,saharia2022photorealistic,nichol2021glide} in modeling text-to-image generation with diffusion models, which has outperformed GANs~\citep{goodfellow2014generative} and auto-regressive Transformers~\citep{ramesh2021zero} in photorealism and diversity (under similar model size), without training instability and mode collapsing issues. Among them, some recent large text-to-image models such as Imagen~\citep{saharia2022photorealistic}, GLIDE~\citep{nichol2021glide}, and DALL-E2~\citep{ramesh2022hierarchical} have demonstrated excellent generation from complex prompt inputs. These models achieve highly fine-grained control over the generated images with text inputs. However, they do not perform explicit grounding over external visual knowledge and are restricted to memorizing the visual appearance of every possible visual entity in their parameters. This makes it difficult for them to generalize to rare or even unseen entities. In contrast, {Re-Imagen}\xspace is designed to free the diffusion model from memorizing, as models are encouraged to retrieve semantic neighbors from the knowledge base and use retrievals as context to paint the image. {Re-Imagen}\xspace improves the grounding of the diffusion models to real-world knowledge and is therefore capable of faithful image synthesis. \vspace{1ex} \\ \noindent \textbf{Concurrent Work} There are several concurrent works~\citep{li2022memory,blattmann2022retrieval,ashual2022knn}, that also leverage retrieval to improve diffusion models. RDM~\citep{blattmann2022retrieval} is trained similarly to {Re-Imagen}\xspace, using examples and near neighbors, but the neighbors in RDM are selected using image features, and at inference time retrievals are replaced with user-chosen exemplars. RDM was shown to effectively transfer artistic style from exemplars to generated images. In contrast, our proposed {Re-Imagen}\xspace conditions on both text and multi-modal neighbors to generate the image, includes retrieval at inference time, and is demonstrated to improve performance on rare images (as well as more generally). KNN-Diffusion~\citep{ashual2022knn} is more closely related work to us, as it also uses retrieval to the quality of generated images. However, KNN-Diffusion uses discrete image representations, while {Re-Imagen}\xspace uses the raw pixels, and {Re-Imagen}\xspace's retrieved neighbors can be \texttt{<}image, text\texttt{>} pairs, while KNN-Diffusion's are only images. Quantitatively, {Re-Imagen}\xspace{} outperforms KNN-Diffusion on the COCO dataset significantly. \vspace{1ex}\\ \noindent \textbf{Others} Due to the space limit, we provide an additional literature review in the Appendix~\ref{extended_review}. \section{Model} In this section, we discuss our proposed {Re-Imagen}\xspace in detail. We start with background knowledge, in the form of a brief overview of the cascaded diffusion models used by Imagen~\citep{wang2022high}. Next, we describe the concrete technical details on how we incorporate multi-modal retrieval for {Re-Imagen}\xspace. Finally, we discuss training and the interleaved guidance sampling for {Re-Imagen}\xspace. \subsection{Preliminaries} \noindent \textbf{Diffusion Models} Diffusion models~\citep{sohl2015deep} are latent variable models, parameterized by $\theta$, in the form of $p_{\theta}(\bm{x}_0) := \int p_{\theta}(\bm{x}_{0:T})d\bm{x}_{1:T}$, where $\bm{x}_1, \cdots, \bm{x}_T$ are ``noised'' latent versions of the input image $\bm{x}_0 \sim q(\bm{x}_0)$. Note that the dimensionality of both latents and the image are the same throughout the entire process, with $\bm{x}_{0:T} \in \mathbb{R}^d$ and $d$ equals the product of \texttt{<}height, width, \# of channels\texttt{>}. The process that computes the posterior distribution $q(\bm{x}_{1:T}|\bm{x}_0)$ is also called the forward (or diffusion) process, and is implemented as a predefined Markov chain that gradually adds Gaussian noise to the data according to a schedule $\beta_t$: \begin{equation} q(\bm{x}_{1:T}|\bm{x}_0)=\prod_{t=1}^{T}q(\bm{x}_t | \bm{x}_{t-1}) \quad \quad q(\bm{x}_t | \bm{x}_{t-1}) := \mathcal{N}(\bm{x}_t; \sqrt{1 - \beta_t}\bm{x}_{t-1}, \beta_t \bm{I}) \end{equation} Diffusion models are trained to learn the image distribution by reversing the diffusion Markov chain. Theoretically, this reduces to learning to denoise $\bm{x}_t \sim q(\bm{x}_t|\bm{x}_0)$ into $\bm{x}_0$, with a time re-weighted square error loss---see~\cite{ho2020denoising} for the complete proof: \begin{equation} \label{eq:loss} \mathbb{E}_{\bm{x}_0, \bm{\epsilon}, t} [w_t \cdot ||\hat{\bm{x}}_{\theta}(\bm{x}_t, \bm{c}) - \bm{x}_0||_2^2] \end{equation} Here, the noised image is denoted as $\bm{x}_t := \sqrt{\bar{\alpha}_t} \bm{x}_0 + \sqrt{1-\bar{\alpha}_t} \bm{\epsilon}$, $\bm{x}_0$ is the ground-truth image, $\bm{c}$ is the condition, $\bm{\epsilon} \sim \mathcal{N}(\bf{0}, I)$ is the noise term, $\alpha_t: = 1 - \beta_t$ and $\bar{\alpha}_t := \prod_{s=1}^t \alpha_s$. To simplify notation, we will allow the condition $\bm{c}$ include multiple conditioning signals, such as text prompts $\bm{c}_p$, a low-resolution image input $\bm{c}_x$ (which is used in super-resolution), or retrieved neighboring images $\bm{c}_n$ (which are used in {Re-Imagen}\xspace). Imagen~\citep{saharia2022photorealistic} uses a U-Net~\citep{ronneberger2015u} to implement $\bm{\epsilon}_{\theta}(\bm{x}_{t}, \bm{c}, t)$. The U-Net represents the reversed noise generator as follows: \begin{equation} \label{eq:recover_original} \hat{\bm{x}}_{\theta}(\bm{x}_t, \bm{c}) := (\bm{x}_t - \sqrt{1 - \bar{\alpha}_t} \bm{\epsilon}_{\theta}(\bm{x}_{t}, \bm{c}, t)) / \sqrt{\bar{\alpha}_t} \end{equation} During the training, we randomly sample $t \sim \mathcal{U}([0, 1])$ and image $\bm{x}_0$ from the dataset $\mathcal{D}$, and minimize the difference between $\hat{\bm{x}}_{\theta}(\bm{x}_t, \bm{c})$ and $\bm{x}_0$ according to~\autoref{eq:loss}. At the inference time, the diffusion model uses DDPM~\citep{ho2020denoising} to sample recursively as follows: \begin{equation} \bm{x}_{t-1} = \frac{\sqrt{\bar{\alpha}_{t-1}} \beta_t}{1 - \bar{\alpha}_t} \hat{\bm{x}}_{\theta}(\bm{x}_t, \bm{c}) + \frac{\sqrt{\alpha_t}(1- \bar{\alpha}_{t-1})}{1 - \bar{\alpha}_t}\bm{x}_t + \sqrt{\frac{(1 - \bar{\alpha}_{t-1})\beta_t}{1 - \bar{\alpha}_t}}\bm{\epsilon} \end{equation} The model sets $\bm{x}_T$ as a Gaussian noise with $T$ denoting the total number of diffusion steps, and then keep sampling in reverse until step $T=0$, i.e. $\bm{x}_{T} \rightarrow \bm{x}_{T-1} \rightarrow \cdots$, to reach the final image $\hat{\bm{x}}_0$. For better generation efficiency, cascaded diffusion models~\citep{ho2022cascaded,ramesh2022hierarchical,saharia2022photorealistic} use three separate diffusion models to generate high-resolution images gradually, going from low resolution to high resolution. The three models 64$\times$ model, 256$\times$ super-resolution model and 1024$\times$ super-resolution model gradually increase the model resolution to $1024\times1024$. \begin{figure}[!t] \centering \includegraphics[width=1.0\linewidth]{model.001.jpeg} \caption{ An illustration of the text-to-image generation pipeline in the 64$\times$ diffusion model. Specifically, {Re-Imagen}\xspace learns a UNet to iteratively predict $\bm{\epsilon}(\bm{x_t}, \bm{c}_n, \bm{c}_p, t)$ that denoises the image. ($\bm{c}_n$: a set of retrieved image-text pairs from the database; $\bm{c}_p$: input text prompt; $t$: current time-step) } \label{fig:model} \end{figure} \noindent \textbf{Classifier-free Guidance} \label{sec:cfg} \cite{ho2021classifier} first proposed classifier-free guidance to trade off diversity and sample quality. This sampling strategy has been widely used due to its simplicity. In particular, Imagen~\citep{saharia2022photorealistic} adopts an adjusted $\epsilon$-prediction as follows: \begin{equation} \hat{\bm{\epsilon}} = w \cdot \bm{\epsilon}_{\theta}(\bm{x}_t, \bm{c}, t) - (w - 1) \cdot \bm{\epsilon}_{\theta}(\bm{x}_t, t) \end{equation} where $w$ is the guidance weight. The unconditional $\epsilon$-prediction $\bm{\epsilon}_{\theta}(\bm{x}_t, t)$ is calculated by dropping the condition, i.e. the text prompt. \subsection{Generating Image with Multi-Modal Knowledge} Similar to Imagen~\citep{saharia2022photorealistic}, {Re-Imagen}\xspace is a cascaded diffusion model, consisting of 64$\times$, 256$\times$, and 1024$\times$ diffusion models. However, {Re-Imagen}\xspace augments the diffusion model with the new capability of leveraging multimodal `knowledge' from the external database, thus freeing the model from memorizing the appearance of rare entities. For brevity (and concreteness) we present below a high-level overview of the 64$\times$ model: the others are similar. \noindent \textbf{Main Idea} As shown in~\autoref{fig:model}, during the denoising process, {Re-Imagen}\xspace conditions its generation result not only on the text prompt $\bm{c}_p$ (and also with $\bm{c}_x$ for super-resolution), but on the neighbors $\bm{c}_n$ that were retrieved from the external knowledge base. Here, the text prompt $\bm{c}_p \in \mathbb{R}^{n \times d}$ is represented using a T5 embedding~\citep{raffel2020exploring}, with $n$ being the text length and $d$ being the embedding dimension. Meanwhile, the top-k neighbors $\bm{c}_n:=[\texttt{<}\text{image, text}\texttt{>}_1, \cdots, \texttt{<}\text{image, text}\texttt{>}_k]$ are retrieved from external knowledge base $\mathcal{B}$, using the input prompt $p$ as the query and a retrieval similarity function $\gamma(p, \mathcal{B})$. We experimented with two different choices for the similarity function: maximum inner product scores for BM25~\citep{robertson2009probabilistic} and CLIP~\citep{radford2021learning}. \vspace{1ex} \\ \noindent \textbf{Model Architecture} We show the architecture of our model in~\autoref{fig:detail}, where we decompose the UNet into the downsampling encoder (DStack) and the upsampling decoder (UStack). Specifically, the DStack takes an image, a text, and a time step as the input, and generates a feature map, which is denoted as $f_{\theta}(\bm{x}_t, \bm{c}_p, t) \in \mathbb{R}^{F \times F \times d}$, with $F$ denoting the feature map width and $d$ denoting the hidden dimension. We share the same DStack encoder when we encode the retrieved \texttt{<}image, text\texttt{>} pairs (with $t$ set to zero) which produces a set of feature maps $f_{\theta}(\bm{c}_n, 0) \in \mathbb{R}^{K \times F \times F \times d}$. We then use a multi-head attention module~\citep{vaswani2017attention} to extract the most relevant information to produce a new feature map $f'_{\theta}(\bm{x}_t, \bm{c}_p, \bm{c}_n, t) = Attn(f_{\theta}(\bm{x}_t, \bm{c}_p, t), f_{\theta}(\bm{c}_n, 0))$. The upsampling stack decoder then predicts the noise term $\bm{\epsilon}_{\theta}(\bm{x}_{t}, \bm{c}_p, \bm{c}_n, t)$ and uses it to compute $\hat{\bm{x}}_{\theta}$ with~\autoref{eq:recover_original}, which is either used for regression during training or DDPM sampling. \vspace{1ex} \\ \noindent \textbf{Model Training} In order to train {Re-Imagen}\xspace, we construct a new dataset KNN-ImageText based on the 50M ImageText-dataset used in Imagen. There are two motivations for selecting this dataset. (1) the dataset contains many similar photos regarding specific entities, which is extremely helpful for obtaining similar neighbors, and (2) the dataset is highly sanitized with fewer unethical or harmful images. For each instance in the 50M ImageText-dataset, we search over the same dataset with text-to-text BM25 similarity to find the top-2 neighbors as $\bm{c}_n$ (excluding the query instance). We experimented with both CLIP and BM25 similarity scores, and retrieval was implemented with ScaNN~\citep{guo2020accelerating}. We train {Re-Imagen}\xspace on the KNN-ImageText by minimizing the loss function of~\autoref{eq:loss}. During training, we also randomly drop the text and neighbor conditions independently with 10\% chance. Such random dropping will help the model learn the marginalized noise term $\bm{\epsilon}_{\theta}(\bm{x}_{t}, \bm{c}_p, t)$ and $\bm{\epsilon}_{\theta}(\bm{x}_{t}, \bm{c}_n, t)$, which will be used for the classifier-free guidance. \vspace{1ex} \\ \noindent \textbf{Interleaved Classifier-free Guidance} \label{sec:interleaved} Different from existing diffusion models, our model needs to deal with more than one condition, \textit{i.e.}, text prompts $\bm{c}_t$ and retrieved neighbors $\bm{c}_n$, which allows new options for incorporating guidance. In particular, {Re-Imagen}\xspace could use classifier-free guidance by subtracting the unconditioned $\epsilon$-predictions, or either of the two partially conditioned $\epsilon$-predictions. Empirically, we observed that subtracting unconditioned $\epsilon$-predictions (the standard classifier-free guidance of~\autoref{sec:cfg}) often leads to an undesired imbalance, where the outputs are either dominated by the text condition or the neighbor condition. Hence, we designed an interleaved guidance schedule that balances the two conditions. Formally, we define the two adjusted $\epsilon$-predictions as: \begin{align} \label{eq:sample} \begin{split} \hat{\bm{\epsilon}}_{p} &= w_p \cdot \bm{\epsilon}_{\theta}(\bm{x}_t, \bm{c}_p, \bm{c}_n, t) - (w_p - 1) \cdot \bm{\epsilon}_{\theta}(\bm{x}_t, \bm{c}_n, t) \\ \hat{\bm{\epsilon}}_{n} &= w_n \cdot \bm{\epsilon}_{\theta}(\bm{x}_t, \bm{c}_p, \bm{c}_n, t) - (w_n - 1) \cdot \bm{\epsilon}_{\theta}(\bm{x}_t, \bm{c}_p, t) \end{split} \end{align} where $\hat{\bm{\epsilon}}_{p}$ and $\hat{\bm{\epsilon}}_{n}$ are the text-enhanced and neighbor-enhanced $\epsilon$-predictions, respectfully. Here, $w_p$ is the text guidance weight and $w_n$ is the neighbor guidance weight. We then interleave the two guidance predictions by a certain predefined ratio $\eta$. Specifically, at each guidance step, we sample a [0, 1]-uniform random number $R$, and $R < \eta$, we use $\hat{\bm{\epsilon}}_{p}$, and otherwise $\hat{\bm{\epsilon}}_{n}$. We can adjust $\eta$ to balance the faithfulness w.r.t text description or the retrieved image-text pairs. In EntityDrawBench experiment, we found that $\eta=0.55$ can lead to better quality. \begin{figure}[!t] \centering \includegraphics[width=1.0\linewidth]{kimgen.001.jpeg} \caption{The detailed architecture of our model. The retrieved neighbors are first encoded using the DStack encoder and then used to augment the intermediate representation of the denoising image (via cross-attention). The augmented representation is fed to the UStack to predict the noise.} \label{fig:detail} \vspace{-2ex} \end{figure} \section{Experiments} {Re-Imagen}\xspace consists of three submodels: a 2.5B 64$\times$64 text-to-image model, a 750M 256$\times$256 super-resolution model and a 400M 1024$\times$1024 super-resolution model. We finetune these models on the constructed KNN-ImageText dataset. We evaluate the model under two settings: (1) automatic evaluation on COCO and WikiImages dataset, to measure the model's general performance to generate photorealistic images, and (2) human evaluation on the newly introduced EntityDrawBench, to measure the model's capability to generate long-tail entities. \noindent \textbf{Training and Evaluation details} The fine-tuning was run for 200K steps on 64 TPU-v4 chips and completed within two days. We use Adafactor for the 64$\times$ model and Adam for the 256$\times$ super-resolution model with a learning rate of 1e-4. We set the number of neighbors $k$=2 and set $\gamma$=BM25 during training. For the image-text database $\mathcal{B}$, we consider three different variants: {(1)} the COCO/WikiImages training set, which contains non-overlapping small-scale in-domain image-text pairs, {(2)} the ImageText dataset containing 50M \texttt{<}image, caption\texttt{>} pairs, and {(3)} the LAION dataset~\citep{schuhmann2021laion} containing 400M \texttt{<}image, text\texttt{>} crawled pairs. Since indexing ImageText and LAION with CLIP encodings is expensive, we only considered the BM25 retriever for these databases. For the COCO/WikiImages training set, we used both BM25 and CLIP. \subsection{Evaluation on COCO and WikiImages} In these two experiments, we used the standard non-interleaved classifier-free guidance (\autoref{sec:cfg}) with $T$=1000 steps for both the 64$\times$ diffusion model and 256$\times$ super-resolution model. The guidance weight $w$ for the 64$\times$ model is swept over [1.0, 1.25, 1.5, 1.75, 2.0], while the 256$\times$256 super-resolution models' guidance weight $w$ is swept over [1.0, 5.0, 8.0, 10.0]. We select the guidance $w$ with the best FID score, which is reported in~\autoref{tab:coco}. We also demonstrate examples in~\autoref{fig:dataset}. \vspace{1ex} \\ \noindent \textbf{COCO Results} COCO is the most widely-used benchmark for text-to-image generation models. Although COCO does not contain many rare entities, it does contain unusual combinations of common entities, so it is plausible that retrieval augmentation could also help for some challenging text prompts. We adopt FID~\citep{heusel2017gans} score to measure image quality. Following the previous literature, we randomly sample 30K prompts from the validation set as input to the model. The generated images are compared with the reference images from the full validation set (42K). We list the results in two columns: FID-30K denotes the model with access to the COCO train set (either to fine-tune or retrieve from), while Zero-shot FID-30K does not have access to any COCO data. \begin{table}[!t] \small \centering \begin{tabular}{lccc} \toprule Model & \# of Params & FID-30K & Zero-shot FID-30K \\ \midrule GLIDE~\citep{nichol2021glide} & \hphantom{0}\pd5B & - & 12.24 \\ DALL-E 2~\citep{ramesh2022hierarchical} & $\sim$5B & - & 10.39 \\ VQ-Diffusion~\citep{gu2022vector} & 0.4B & - & 19.75 \\ KNN-Diffusion~\citep{ashual2022knn} & 0.8B & - & 16.66 \\ Stable-Diffusion~\citep{rombach2022high} & \hphantom{.}\pz1B & - & 12.63 \\ Imagen~\citep{saharia2022photorealistic} & \hphantom{.}\pz3B & - & \pz7.27 \\ Make-A-Scene~\citep{gafni2022make} & \hphantom{.}\pz4B & 7.55 & 11.84 \\ Parti~\citep{yu2022scaling} & \pd20B & \textbf{3.22} & \pz7.23 \\ \midrule {Re-Imagen}\xspace ($\gamma$=BM25; $\mathcal{B}$=COCO; $k$=2) & 3.6B & \textbf{5.25}$^\dagger$ & - \\ {Re-Imagen}\xspace ($\gamma$=CLIP; $\mathcal{B}$=COCO; $k$=2) & 3.6B & 5.29$^\dagger$ & - \\ {Re-Imagen}\xspace ($\gamma$=BM25; $\mathcal{B}$=ImageText; $k$=2) & 3.6B & - & \pz7.02 \\ {Re-Imagen}\xspace ($\gamma$=BM25; $\mathcal{B}$=LAION; $k$=2) & 3.6B & - & \hphantom{0} 6.88 \\ \bottomrule \end{tabular} \caption{MS-COCO results for zero-shot text-to-image generation. We use a guidance weight of 1.25 for the 64$\times$ diffusion model and 5 for our 256$\times$ super-resolution model. ($\dagger$: {Re-Imagen}\xspace \textit{is not fine-tuned} on the COCO data---it only uses it as the knowledge base for retrieval.) } \label{tab:coco} \vspace{-2ex} \end{table} {Re-Imagen}\xspace (with the COCO database) can achieve a significant gain on FID-30K without fine-tuning: roughly a 2.0 absolute FID improvement over Imagen. The performance is even better than fine-tuned Make-A-Scene~\citep{gafni2022make}, but slightly worse than fine-tuned 20B Parti. In contrast, {Re-Imagen}\xspace retrieving from out-of-domain databases (LAION) achieves less gain, but still obtains a 0.4 FID improvement over Imagen. {Re-Imagen}\xspace outperforms KNN-Diffusion, another retrieval-augmented diffusion model, by a large margin. Since COCO does not contain infrequent entities, `entity knowledge' is not important. In contrast, retrieving from the training set can provide useful `style knowledge' for the model to ground on. {Re-Imagen}\xspace is able to adapt the generated images to the same style of the COCO distribution, it can achieve a much better FID score. As can be seen in the upper part of from~\autoref{fig:dataset}, {Re-Imagen}\xspace with retrieval generates images of the same style as COCO, while without retrieval, the output is still high quality, but the style is less similar to COCO. \begin{figure}[!t] \centering \includegraphics[width=1.0\linewidth]{dataset.001.jpeg} \caption{{The retrieved top-2 neighbors of COCO and WikiImages and model generation.}} \label{fig:dataset} \vspace{-2ex} \end{figure} \noindent\textbf{WikiImages Results} WikiImages is constructed based on the multimodal corpus provided in Web\-QA~\citep{chang2022webqa}, which consists of \texttt{<}image, text\texttt{>} pairs crawled from Wikimedia Commons\footnote{\url{https://commons.wikimedia.org/wiki/Main_Page}}. We filtered the original corpus to remove noisy data (see the Appendix\ref{wikiimages}), which leads to a total of 320K examples. We randomly sample 22K as our validation set to perform zero-shot evaluation, we further sample 20K prompts from the dataset as the input. Similar to the previous experiment, we also adopt the guidance weight schedule as before and evaluate 256$\times$256 images. We report our experimental results in~\autoref{tab:wiki} and mainly compare with Imagen and Stable-Diffusion. \begin{table}[!t] \small \centering \begin{tabular}{lccc} \toprule Model & \# of Params & FID-30K & Zero-shot FID-20K \\ \midrule Stable-Diffusion~\citep{rombach2022high} & \hphantom{.}\pz1B & - & 7.50 \\ Imagen~\citep{saharia2022photorealistic} & \hphantom{.}\pz3B & - & 6.44 \\ \midrule {Re-Imagen}\xspace ($\gamma$=BM25; $\mathcal{B}$=WikiImages; $k$=2) & 3.6B & 5.88 & - \\ {Re-Imagen}\xspace ($\gamma$=CLIP; $\mathcal{B}$=WikiImages; $k$=2) & 3.6B & 5.85 & - \\ {Re-Imagen}\xspace ($\gamma$=BM25; $\mathcal{B}$=ImageText; $k$=2) & 3.6B & - & 6.04 \\ {Re-Imagen}\xspace ($\gamma$=BM25; $\mathcal{B}$=LAION; $k$=1) & 3.6B & - & 5.94 \\ {Re-Imagen}\xspace ($\gamma$=BM25; $\mathcal{B}$=LAION; $k$=2) & 3.6B & - & 5.82 \\ {Re-Imagen}\xspace ($\gamma$=BM25; $\mathcal{B}$=LAION; $k$=3) & 3.6B & - & \textbf{5.80} \\ \bottomrule \end{tabular} \caption{WikiImages results for zero-shot text-to-image generation. We use a guidance weight of 1.5 for the 64$\times$ diffusion model and 5 for our 256$\times$ super-resolution model.} \label{tab:wiki} \vspace{-2ex} \end{table} From~\autoref{tab:wiki}, we found that using out-of-domain LAION-400M as the database actually achieves better performance than using in-domain WikiImages as the database. Unlike COCO, Wiki\-Images contains mostly entity-focused images, thus the importance of finding relevant entities is the database is more important than distilling the styles from the training set---and since the scale of LAION-400M is 100x larger than WikiImages-300K, the chance of retrieving related entities is much higher, which leads to better performance. One example is depicted in the lower part of~\autoref{fig:dataset}, where the LAION retrieval finds `Island of San Giorgio Maggiore', which helps the model generate the classical Renaissance-style church. When generating without retrieval, the model is not able to generate the specific church. This indicates the importance of having relevant entities in the retrievals for WikiImages dataset and also explains why LAION database achieves the best results. We also present more examples from WikiImages in the Appendix~\ref{wikiimages}. \subsection{Entity Focused Evaluation on EntityDrawBench} \noindent \textbf{Dataset Construction} We introduce EntityDrawBench to evaluate the model's capability to generate diverse sets of entities in different visual scenes. Specifically, we pick three types of visual entities (dog breeds, landmarks, and foods) from Wikipedia Commons and Google Landmarks to construct our prompts. In total, we collect 150 entity-centric prompts for evaluation. These prompts are mostly unique and we cannot find corresponding images with Google Image Search. More construction details are in Appendix~\ref{entitydrawbench}. We use the prompt as the input and its corresponding image-text pairs as the `retrieval' for {Re-Imagen}\xspace, to generate four 1024$\times$1024 images. For the other models, we feed the prompts directly also to generate four images. We will pick the best image of these four samples to rate its Photorealism and Faithfulness. For photorealism, we assign 1 if the image is moderately realistic without noticeable artifacts, otherwise, we assign a score of 0. For the faithfulness measure, we assign 1 if the image is faithful to both the entity source and the text description, otherwise, we assign 0. \noindent \textbf{Experimental Results} We use the proposed interleaved classifier-free guidance (\autoref{sec:interleaved}) for the 64$\times$ diffusion model, which runs for 256 diffusion steps under a strong guidance weight of $w$=30 for both text and neighbor conditions. For the 256$\times$ and 1024$\times$ resolution models, we use a constant guidance weight of 5.0 and 3.0, respectively, with 128 and 32 diffusion steps. The inference speed is 30-40 secs for 4 images on 4 TPU-v4 chips. We demonstrate our human evaluation results for faithfulness and photorealism in~\autoref{tab:faithfulness}. \begin{table}[!t] \small \centering \begin{tabular}{l|cccc|c} \toprule \multirow{2}{*}{Model} & \multicolumn{4}{c|}{\textbf{Faithfulness}} & \textbf{Photorealism} \\ & Dogs & Foods & Landmarks & All & All \\ \midrule \addlinespace Imagen & 0.28 $\pm$ 0.02 & 0.26 $\pm$ 0.02 & 0.27 $\pm$ 0.02 & 0.27 & \textbf{0.98} \\ DALL-E 2 & 0.60 $\pm$ 0.02 & 0.47 $\pm$ 0.02 & 0.36 $\pm$ 0.04 & 0.48 & \textbf{0.98} \\ Stable-Diffusion & 0.16 $\pm$ 0.02 & 0.24 $\pm$ 0.04 & 0.12 $\pm$ 0.06 & 0.17 & 0.92 \\ \midrule \addlinespace {Re-Imagen}\xspace & \textbf{0.68} $\pm$ 0.04 & \textbf{0.70} $\pm$ 0.02 & \textbf{0.74} $\pm$ 0.04 & \textbf{0.71} & 0.97 \\ \bottomrule \end{tabular} \caption{Human evaluation results for different models on different types of entities. } \label{tab:faithfulness} \vspace{-2ex} \end{table} We can observe that {Re-Imagen}\xspace can in general achieve much higher faithfulness than the existing models while maintaining similar photorealism scores. When comparing with our backbone Imagen, we see the faithfulness score jumps from 27\% to 71\%, which indicates that our model is paying attention to the retrieved knowledge and assimilating it into the generation process. \begin{figure}[!h] \centering \begin{tabular}{@{}c@{}c@{}} \includegraphics[height=3cm]{figures/frequent_entity_v3} & \includegraphics[height=3cm]{figures/infrequent_entity_v3.png} \\ \end{tabular} \vspace{-2ex} \caption{The human evaluation scores for both frequent and infrequent entities. } \label{fig:human_evaluation_frequency} \end{figure} We further partition the entities into `frequent' and `infrequent' categories based on their frequency (top 50\% as `frequent') in Imagen's training corpus. We plot faithfulness score for `frequent' and `infrequent' separately in~\autoref{fig:human_evaluation_frequency} . We can see that our model is less sensitive to the frequency of the input entities than the other models, with only a 10-20\% drop on infrequent entities. In contrast, both Imagen and DALL-E 2 drop by 40\%-50\% on infrequent entities. This study reflects the effectiveness of text-to-image generation models on long-tail entities. \noindent \textbf{Comparison to Other Models} We demonstrate some examples from different models in~\autoref{fig:example}. As can be seen, the images generated from {Re-Imagen}\xspace strike a good balance between text alignment and entity fidelity. Unlike image editing to perform in-place modification, {Re-Imagen}\xspace can transform the neighbor entities both geometrically and semantically according to the text guidance. As a concrete example, {Re-Imagen}\xspace generates the \textit{Braque Saint-Germain} (2nd row in \autoref{fig:example}) on the grass, in a different viewpoint from to the reference image. \begin{figure}[!t] \centering \includegraphics[width=0.95\linewidth]{example.001.jpeg} \caption{None-cherry picked examples from EntityDrawBench for different models. } \vspace{-1ex} \label{fig:example} \end{figure} \begin{figure}[!t] \centering \includegraphics[width=0.95\linewidth]{more_examples_for_arxiv.001.jpeg} \includegraphics[width=0.95\linewidth]{more_examples_for_arxiv.002.jpeg} \includegraphics[width=0.95\linewidth]{more_examples_for_arxiv.003.jpeg} \caption{Extra None-cherry picked examples from EntityDrawBench for different models. } \vspace{-1ex} \label{fig:more_example_for_arxiv} \end{figure} \noindent \textbf{Text and Entity Faithfulness Trade-offs} In our experiments, we found that there is a trade-off between faithefulness to the text prompt and faithfulness to the retrieved entity images. Based on~\autoref{eq:sample}, by adjusting $\eta$, \textit{i.e.} the proportion of $\hat{\epsilon}_p$ and $\hat{\epsilon}_n$ in the sampling schedule, we can control {Re-Imagen}\xspace so as to generate images that explore this tradeoff: decreasing $\eta$ will increase the entity's image faithfulness but decrease the text alignment. In contrast, increasing the value $\eta$ will increase the text alignment and decrease the similarity to retrieved image. We demonstrate this in~\autoref{fig:transition}. With small $\eta$, the model ignores the text description and simply copies the retrieved image, while with large $\eta$, the model reverts to standard Imagen, without using to the input image much. We found that having $\eta$ around 0.5 is usually a `sweet spot' that balances both conditions. \begin{figure}[!t] \centering \includegraphics[width=0.95\linewidth]{transition.001.jpeg} \caption{Ablation study of interleaved guidance ratio $\eta$ to show the trade-off. } \vspace{-2ex} \label{fig:transition} \end{figure} \section{Conclusions and Limitations} We present {Re-Imagen}\xspace, a retrieval-augmented diffusion model, and demonstrate its effectiveness in generating realistic and faithful images. We exhibit such advantages not only through automatic FID measures on standard benchmarks (\textit{i.e.}, COCO and WikiImage) but also through human evaluation on the newly introduced EntityDrawBench. We further demonstrate that our model is particularly effective in generating an image from text that mentions rare entities. {Re-Imagen}\xspace still suffers from well-known issues in text-to-image generation, which we review below in \autoref{broader_impact}. In addition, {Re-Imagen}\xspace also has some unique limitations due to the retrieval-augmented modeling. First, because {Re-Imagen}\xspace is sensitive the to retrieved image-text pairs it is conditioned on, when the retrieved image is of low-quality, there will be a negative influence on the generated image. Second, {Re-Imagen}\xspace sometimes still fail to ground on the retrieved entities when the entity's visual appearance is out of the generation space. Third, we noticed that the super-resolution model is less effective, and frequently misses low-level texture details of the visual entities. In future work, we plan to further investigate the above limitations and address them. \section*{Ethics Statement} \label{broader_impact} Strong text-to-image generation models, \textit{i.e.}, Imagen~\citep{saharia2022photorealistic} and Parti~\citep{yu2022scaling}, raise ethical challenges along dimensions such as the \textit{social bias}. {Re-Imagen}\xspace is exposed to the same challenges, as we employed Web-scale datasets that are similar to the prior models. The retrieval-augmented modeling techniques of {Re-Imagen}\xspace has substantially improved the controllability and attribution of the generated image. Like many basic research topics, this additional control could be used for beneficial or harmful purposes. One obvious danger is that {Re-Imagen}\xspace (or similar models) could be used for malicious purposes like spreading misinformation, \textit{e.g.,} by producing realistic images of specific people in misleading visual contexts. On the other side, additional control has many potential benefits. One general benefit is that {Re-Imagen}\xspace can reduce hallucination and increase the faithfulness of the generated image to the users' intent. Another benefit is that the ability to work with tail entities makes the model more useful for minorities and other users in smaller communities: for example, {Re-Imagen}\xspace is more effective at generating images of landmarks famous in smaller communities or cultures, and generating images of indigenous foods and cultural artifacts. We argue that this model can help decrease the frequency-caused bias in current neural network based AI systems. Considering such potential threats to the public, we have currently decide not to release the code or a public demo. In future work, we will explore a framework for responsible use that balances the value of external auditing of research with the risks of unrestricted open access, allowing this work to be used in a safe and beneficial way. \section*{Acknoledgement} We thank Jason Baldridge, Boqing Gong, Keran Rong and Slav Petrov for their valuable comments on an early version of the manuscript, which has helped improve this work. We also thank William Chan and Mohammad Norouzi for providing us with their support and the pre-trained models of Imagen, and Michiel de Jong for suggesting the model name.
{'timestamp': '2022-10-04T02:09:01', 'yymm': '2209', 'arxiv_id': '2209.14491', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14491'}
arxiv
\section{Introduction} Recent face recognition model recognizes the identity of a given face image from the 1M distractors with an accuracy of 99.087\%~\cite{Kemelmacher-Shlizerman2015}. However, most face recognition benchmarks such as MegaFace~\cite{Kemelmacher-Shlizerman2015}, CASIA~\cite{Yi2014}, and~MS-Celeb-1M \cite{Guo2016} contain high resolution (HR) images that differ significantly from real-world environments, typically captured by surveillance cameras. When deep learning approaches are directly applied to low resolution (LR) images after being trained on HR images, significant performance degradation occurred~\cite{Cheng2018LowResolutionFR,10.5555/1736406.1736429,5634490}. \begin{figure} \centering \includegraphics[height=5.0cm]{figure/concept.png} \caption{Proposed attention similarity knowledge distillation (A-SKD) concept for low resolution (LR) face recognition problem. Well-constructed attention maps from the HR network are transferred to the LR network by forming high similarity between them for guiding the LR network to focus on detailed parts captured by the HR network. Face images and attention maps are from the AgeDB-30~\cite{inproceedings}.} \label{fig:concept} \end{figure} To overcome the LR problem associated with face recognition, prior knowledge extracted from HR face images is used to compensate spatial information loss. Depending on the approach of transferring the prior knowledge to LR image domain, LR face recognition methods are categorized into two types: super-resolution and knowledge distillation based approaches. Super-resolution based approaches utilize generative models to improve LR images to HR before input to recognition networks~\cite{Fookes2012,Gunturk2003,Hennings-Yeomans2008,Kong2019,Tran2017,5634490}. Following the development of super-resolution methods, LR images can be successfully reconstructed into HR images and recognized by a network trained on HR images~\cite{Dong2016AcceleratingTS,7364266,Ledig2017PhotoRealisticSI,8889765}. However, super-resolution models incur high computational costs for both training and inference, even larger than the costs required for recognition networks. Furthermore, generating HR from LR images is an ill-posed problem, i.e., many HR images can match with a single LR image~\cite{srcnn}; hence the identity of a LR image can be altered. To combat this, knowledge distillation based methods have been proposed to transfer prior knowledge from HR images to models trained on LR face images~\cite{Ge_Zhang_Liu_Hua_Zhao_Jin_Wen_2020,Massoli2020,8682926}. When the resolution of face images is degraded, face recognition models cannot capture accurate features for identification due to spatial information loss. In particular, features from detailed facial parts are difficult to be captured from a few pixels on LR images, e.g. eyes, nose, and mouth~\cite{S2LD}. Previous studies mainly focused on feature based knowledge distillation (F-KD) methods to encourage the LR network's features to mimic the HR network's features by reducing the Euclidean distance between them~\cite{Ge_Zhang_Liu_Hua_Zhao_Jin_Wen_2020,Massoli2020,8682926}. The original concept of F-KD was proposed as a lightweight student model to mimic features from over-parameterized teacher models~\cite{F-KD}. Because teacher model's features would generally include more information than the student model, F-KD approaches improve the accuracy of the student model. Similarly, informative features from the HR network are distilled to the LR network in the LR face recognition problems. This study proposes the attention similarity knowledge distillation approach to distill well-constructed attention maps from an HR network into an LR network by increasing similarity between them. The approach was motivated by the observation that humans can approximate an object's regions from LR images based on prior knowledge learned from previously viewed HR images. Kumar et al. proposed that guiding the LR face recognition network to generate facial keypoints (e.g., eyes, ears, nose, and lips) improved recognition performance by directing the network's attention to the informative regions~\cite{S2LD}. Thus, we designed the prior knowledge as an attention map and transferred the knowledge by increasing similarity between the HR and LR networks' attention maps. Experiments on LR face recognition, face detection, and general object classification demonstrated that the attention mechanism was the best prior knowledge obtainable from the HR networks and similarity was the best method for transferring knowledge to the LR networks. Ablation studies and attention analyses demonstrated the proposed A-SKD effectiveness. \section{Related Works} \textbf{Knowledge distillation.} Hinton et al. first proposed the knowledge distillation approach to transfer knowledge from a teacher network into a smaller student network~\cite{KD}. Soft logits from a teacher network were distilled into a student network by reducing the Kullback-Leibler (KL) divergence score, which quantifies the difference between the teacher and student logits distributions. Various F-KD methods were subsequently proposed to distill intermediate representations~\cite{Park2019,FitNet,F-KD,AT}. FitNet reduced the Euclidean distance between teacher and student network's features to boost student network training~\cite{FitNet}. Zagoruyko et al. proposed attention transfer (AT) to reduce the distance between teacher and student network's attention maps rather than distilling entire features~\cite{AT}. Since attention maps are calculated by applying channel-wise pooling to feature vectors, activation levels for each feature can be distilled efficiently. Relational knowledge distillation (RKD) recently confirmed significant performance gain by distilling structural relationships for features across teacher and student networks~\cite{Park2019}. \textbf{Feature guided LR face recognition.} Various approaches that distill well-constructed features from the HR face recognition network to the LR network have been proposed to improve LR face recognition performances~\cite{Ge_Zhang_Liu_Hua_Zhao_Jin_Wen_2020,Massoli2020,8682926}. Conventional knowledge distillation methods assume that over-parameterized teacher networks extract richer information and it can be transferred to smaller student networks. Similarly, LR face recognition studies focused on transferring knowledge from networks trained on highly informative inputs to networks trained on less informative inputs. Zhu et al. introduced knowledge distillation approach for LR object classification \cite{8682926}, confirming that simple logit distillation from the HR to LR network significantly improved LR classification performance, even superior to super-resolution based methods. F-KD~\cite{Massoli2020} and hybrid order relational knowledge distillation (HORKD)~\cite{Ge_Zhang_Liu_Hua_Zhao_Jin_Wen_2020}, which is the variant of RKD~\cite{Park2019}, methods were subsequently applied to LR face recognition problems to transfer intermediate representations from the HR network. Another approach is to guide the LR network by training it to generate keypoints (e.g. eyes, ears, nose, and lips)~\cite{S2LD}. An auxiliary layer is added to generate keypoints, and hence guide the network to focus on specific facial characteristics. It is well known that facial parts such as eyes and ears are important for recognition~\cite{landmark,S2LD}, hence LR face recognition networks guided by keypoints achieve better performance. Inspired by this, we designed the attention distillation method that guides the LR network to focus on important regions of the HR network. However, attention distillation methods have not been previously explored for LR face recognition. We investigated the efficient attention distillation methods for LR settings and proposed the cosine similarity as the distance measure between HR and LR network's attention maps. \section{Method} \subsection{Low resolution image generation} We require HR and LR face image pairs to distill the HR network's knowledge to the LR network. Following the protocol for LR image generation in super-resolution studies~\cite{Dong2016AcceleratingTS,7364266,Ledig2017PhotoRealisticSI,8889765}, we applied bicubic interpolation to down-sample HR images with 2$\times$, 4$\times$, and 8$\times$ ratios. Gaussian blur was then added to generate realistic LR images. Finally, the downsized images were resized to the original image size using bicubic interpolation. Figure \ref{fig:face_images} presents sample LR images. \begin{figure}[h!] \centering \includegraphics[scale=0.43]{figure/face_images.png} \caption{The samples of HR and LR images from the training dataset (CASIA \cite{Yi2014}) with the down-sampling ratios of 2$\times$, 4$\times$, and 8$\times$.} \label{fig:face_images} \end{figure} \subsection{Face recognition with attention modules} \textbf{Face recognition network.} ArcFace \cite{Deng2018} is a SOTA face recognition network comprising convolutional neural network (CNN) backbone and angular margin introduced to softmax loss. Conventional softmax loss can be expressed as \begin{equation} \label{eq:softmax} L_{softmax} = -\frac{1}{N} \sum_{i=1}^{N}log\frac{e^{W^T_{y_i}x_i + b_{y_i}}}{\sum_{j=1}^{n}e^{W^T_jx_i + b_j}} , \end{equation} where $x_i \in \mathbb{R}^d$ is the embedded feature of the $i$-th sample belonging to the $y_i$-th class; $N$ and $n$ are the batch size and the number of classes, respectively; $W_j \in \mathbb{R}^d$ denotes the $j$-th column of the last fully connected layer's weight $W \in \mathbb{R}^{d \times n}$ and $b_j \in \mathbb{R}^n$ is the bias term for the $j$-th class. For simplicity, the bias term is fixed to 0 as in \cite{sphereface}. Then the logit of the $j$-th class can be represented as $W^T_j x_i = \lVert{W_j}\rVert \lVert{x_i}\rVert {cos(\theta_j)}$, where $\theta_j$ denotes the angle between the $W_j$ and $x_i$. Following previous approaches~\cite{sphereface,cosface}, ArcFace set $\lVert{W_j}\rVert=1$ and $\lVert{x_i}\rVert=1$ via $l_2$ normalisation to maximize $\theta_j$ among inter-class and minimize $\theta_j$ among intra-class samples. Further, constant linear angular margin ($m$) was introduced to avoid convergence difficulty. The ArcFace~\cite{Deng2018} loss can be expressed as \begin{equation} \label{eq:arcface} L_{arcface} = -\frac{1}{N} \sum_{i=1}^{N}log\frac{e^{s(cos(\theta_{y_i} + m))}}{e^{s(cos(\theta_{y_i} + m)) + \sum_{j=1,j\ne {y_i}}^{n}e^{s(cos(\theta_j))}}} , \end{equation} where $s$ is the re-scale factor and $m$ is the additive angular margin penalty between $x_i$ and $W_{y_i}$. \textbf{Attention.} Attention is a simple and effective method to guide feature focus on important regions for recognition. Let $\mathbf{f}_i = \mathcal{H}_i(\mathbf{x})$ be intermediate feature outputs from the \textit{i}-th layer of the CNN. Attention maps about $\mathbf{f}_i$ can be represented as the $\mathcal{A}_i(\mathbf{f}_i)$, where $\mathcal{A}_i(\cdot)$ is attention module. Many attention mechanisms have been proposed; AT \cite{AT} simply applied channel-wise pooling to features to estimate spatial attention maps. SENet~\cite{senet} and CBAM \cite{Woo2018} utilized parametric transformations, e.g. convolution layers, to represent attention maps. Estimated attention maps were multiplied with the features and passed to a successive layer. Trainable parameters in attention module are updated to improve performance during back-propagation, forming accurate attention maps. Attention mechanisms can be expressed as \begin{equation} \label{eq:refine1} \mathbf{f^{'}_{i}} = \mathcal{A}^c_{i}(\mathbf{f_{i}}) \otimes \mathbf{f_{i}} \end{equation} and \begin{equation} \label{eq:refine2} \mathbf{f^{''}_{i}} = \mathcal{A}^s_{i}(\mathbf{f^{'}_{i}}) \otimes \mathbf{f^{'}_{i}} , \end{equation} where $\mathcal{A}^c_{i}(\cdot)$ and $\mathcal{A}^s_{i}(\cdot)$ are attention modules for channel and spatial attention maps, respectively. \begin{figure} \centering \includegraphics[height=4.5cm]{figure/model_outline.png} \caption{Proposed A-SKD framework. The LR network formulates precise attention maps by referencing well-constructed channel and spatial attention maps obtained from the HR network, focusing on detailed facial parts which are helpful for the face recognition. We only show the attention distillation for the first block.} \label{fig:model} \end{figure} Features are refined twice by multiplying channel and spatial attention maps in order (\ref{eq:refine1}) and (\ref{eq:refine2}). Any parametric attention transformation could be employed for the proposed A-SKD, and we adopted the popular CBAM~\cite{Woo2018} module, \begin{equation} \label{eq:cam} \mathcal{A}^c(\mathbf{f}) = \sigma (FC(AvgPool(\mathbf{f}))+FC(MaxPool(\mathbf{f}))) \end{equation} and \begin{equation} \label{eq:sam} \mathcal{A}^s(\mathbf{f}) = \sigma (f^{7\times7}(AvgPool(\mathbf{f});MaxPool(\mathbf{f}))) , \end{equation} where $\sigma(\cdot)$ is the sigmoid function; and $FC(\cdot)$ and $f^{7\times7}(\cdot)$ are fully connected and convolution layers with $7\times7$ filters, respectively. \subsection{Proposed attention similarity knowledge distillation framework} Unlike the conventional knowledge distillation, the network size of teacher and student network is same for A-SKD. Instead, the teacher network is trained on HR images whereas the student network is trained on LR images. Due to the resolution differences, features from both networks are difficult to be identical. Therefore, we propose to distill well-constructed attention maps from the HR network into the LR network instead of features. \begin{equation} \begin{split} \rho_i &= 1 - \langle\mathcal{A}_{T,i}(\mathbf{f}_{T,i}), \mathcal{A}_{S,i}(\mathbf{f}_{S,i})\rangle \\ &= 1 - \frac{\mathcal{A}_{T,i}(\mathbf{f}_{T,i})}{\lVert \mathcal{A}_{T,i}(\mathbf{f}_{T,i}) \rVert_2} \cdot \frac{\mathcal{A}_{S,i}(\mathbf{f}_{S,i})}{\lVert \mathcal{A}_{S,i}(\mathbf{f}_{S,i})\rVert_2} , \end{split} \end{equation} where $\rho_i$ is the cosine distance between attention maps from the \textit{i}-th layer of the teacher and student networks; $\langle \cdot, \cdot \rangle$ denotes the cosine similarity; $\lVert \cdot \rVert_2$ denotes L2-norm; $\mathcal{A}_i(\mathbf{f}_i)$ denotes the attention maps for the \textit{i}-th layer features; and $T$ and $S$ denote the teacher and student network, respectively. Thus, $\mathcal{A}_{T,i}(\mathbf{f}_{T,i})$ and $\mathcal{A}_{S,i}(\mathbf{f}_{S,i})$ are attention maps estimated from the \textit{i}-th layer of the teacher and student network's features, respectively. Reducing the cosine distance between HR and LR attention maps increases the similarity between them. Distillation loss for A-SKD is calculated as \begin{equation} \label{eq:kd_loss} \mathcal{L}_{distill} = \sum^{N}_{i=1} \frac{(\rho^s_i + \rho^c_i)}{2} \end{equation} which average the cosine distance for channel and spatial attention maps between the HR and LR networks, and sums them across layers ($i=1,2,3,...,N$) of the backbone. $N$ is the number of layers utilized for the distillation. Total loss for the LR face recognition network is the sum of target task's loss and distillation loss (\ref{eq:kd_loss}) weighted by the factor ($\lambda_{distill}$). In this work, we utilized the ArcFace loss (\ref{eq:arcface}) as a target task's loss. \begin{equation} \label{eq:tot_loss} \mathcal{L}_{total} = \mathcal{L}_{arcface} + \lambda_{distill} * \mathcal{L}_{distill}. \end{equation} Further, our method can be utilized in conjunction with the logit distillation by simply adding the logit distillation loss~\cite{KD} to our loss function (\ref{eq:tot_loss}). Since logit is the final output of the network, incorporating the logit distillation loss allows the LR network to make the same decision as the HR network based on the refined attention maps. \section{Experiments} \subsection{Settings} \textbf{Datasets.} We employed the CASIA~\cite{Yi2014} dataset for training, which is a large face recognition benchmark comprising approximately 0.5M face images for 10K identities. Each sample in CASIA was down-sampled to construct the HR-LR paired face dataset. For the evaluation, the manually down-sampled face recognition benchmark (AgeDB-30~\cite{inproceedings}) and the popular LR face recognition benchmark (TinyFace~\cite{Cheng2018LowResolutionFR}) were employed. Since AgeDB-30 have similar resolution to CASIA, networks trained on down-sampled CASIA images were validated on AgeDB-30 down-sampled images with matching ratio. In contrast, the real-world LR benchmark (TinyFace) comprises face images with the resolution of 24$\times$24 in average when they are aligned. Therefore, they were validated using a network trained on CASIA images down-sampled to 24$\times$24 pixels. \textbf{Task and metrics.} Face recognition was performed for two scenarios: face verification and identification. Face verification is where the network determines whether paired images are for the same person, i.e., 1:1 comparison. To evaluate verification performance, accuracy was determined using validation sets constructed from probe and gallery set pairs following the LFW protocol~\cite{LFW}. Face identification is where the network recognize the identity of a probe image by measuring similarity against all gallery images, i.e., 1:N comparison. This study employed the smaller AgeDB-30 dataset for the face verification; and larger TinyFace dataset for the face identification. \textbf{Comparison with other methods.} Typically, the distillation of intermediate representation is performed concurrently with the target task’s loss. Previous distillation methods in the experiments utilized the both face recognition and distillation loss, albeit face recognition loss of varying forms. In addition, some feature distillation approach reported their performances with the logit distillation loss. In order to conduct a fair comparison, we re-implemented the prior distillation methods with the same face recognition loss (ArcFace~\cite{Deng2018}) and without the logit distillation loss. Further, our method requires the parametric attention modules for the distillation. Therefore, we utilized the same backbone network with CBAM attention modules for all methods; we combined the CBAM modules to all convolution layers, with the exception of the stem convolution layer and the convolution layer with a kernel size of 1. \textbf{Implementation details.} We followed the ArcFace protocol for data preprocessing: detecting face regions using the MTCNN~\cite{Zhang2016} face detector, cropping around the face region, and resizing the resultant portion to 112$\times$112 pixel using bilinear interpolation. The backbone network was ResNet-50 with CBAM attention module. For the main experiments, we distilled the attention maps for every convolution layers with the exception of the stem convolution layer and the convolution layer with a kernel size of 1. Weight factors for distillation (\ref{eq:tot_loss}) $\lambda_{distill} = 5$. This weight factors generally achieved the superior results not only for the face recognition benchmarks, but also for the ImageNet~\cite{imagenet}. Learning rate = 0.1 initially, divided by 10 at 6, 11, 15, and 17 epochs. SGD optimizer was utilized for the training with batch size = 128. Training completed after 20 epochs. The baseline refers to the LR network that has not been subjected to any knowledge distillation methods. For the hyperparameter search, we divided 20\% of the training set into the validation set and conducted a random search. After the hyperparameter search, we trained the network using the whole training set and and performed the evaluation on the AgeDB-30 and TinyFace. \subsection{Face recognition benchmark results} \textbf{Evaluation on AgeDB-30.} Table \ref{tab:performances} shows LR face recognition performance on AgeDB-30 with various down-sample ratios depending on distillation methods. Except for HORKD, previous distillation methods~\cite{Massoli2020,AT} exhibited only slight improvement or even reduced performance when the downsampling ratios increase. This indicates that reducing the L2 distance between the HR and LR network's features is ineffective. In contrast, HORKD improved LR recognition performance by distilling the relational knowledge of the HR network's features. When the input’s resolution decrease, the intermediate features are hard to be identical with the features from the HR network. Instead the relation among the features of the HR network can be transferred to the LR network despite the spatial information loss; this was the reason of HORKD’s superior performances even for the 4$\times$ and 8$\times$ settings. \begin{table}[] \centering \caption{Proposed A-SKD approach compared with baseline and previous SOTA methods on AgeDB-30 with 2$\times$, 4$\times$, and 8$\times$ down-sampled ratios. L, F, SA, and CA indicate distillation types of logit, feature, spatial attention, and channel attention, respectively. Ver-ACC denotes the verification accuracy. Base refers to the LR network that has not been subjected to any knowledge distillation methods.} \resizebox{0.82\columnwidth}{!}{% \begin{tabular}{@{}ccccc@{}} \toprule \multirow{2}{*}{\textbf{Resolution}} & \multirow{2}{*}{\textbf{Method}} & \multirow{2}{*}{\textbf{Distill Type}} & \multirow{2}{*}{\textbf{Loss Function}} & \multirow{2}{*}{\textbf{\begin{tabular}[c]{@{}c@{}}Ver-ACC (\%)\\ (AgeDB-30)\end{tabular}}} \\ & & & & \\ \midrule 1$\times$ & Base & - & - & 93.78 \\ \hline \multirow{7}{*}{2$\times$} & Base & - & - & 92.83 \\ & F-KD \cite{Massoli2020} & F & L2 & 93.05 \\ & AT \cite{AT} & SA & L2 & 92.93 \\ & HORKD \cite{Ge_Zhang_Liu_Hua_Zhao_Jin_Wen_2020} & F & L1+Huber & 93.13 \\ & A-SKD \textbf{(Ours)} & SA+CA & Cosine & \textbf{93.35} \\ & A-SKD+KD \textbf{(Ours)} & SA+CA+L & Cosine+KLdiv & \textbf{93.58} \\ \hline \multirow{7}{*}{4$\times$} & Base & - & - & 87.74 \\ & F-KD \cite{Massoli2020} & F & L2 & 87.72 \\ & AT \cite{AT} & SA & L2 & 87.75 \\ & HORKD \cite{Ge_Zhang_Liu_Hua_Zhao_Jin_Wen_2020} & F & L1+Huber & 88.08 \\ & A-SKD \textbf{(Ours)} & SA+CA & Cosine & \textbf{88.58} \\ & A-SKD+KD \textbf{(Ours)} & SA+CA+L & Cosine+KLdiv & \textbf{89.15} \\ \hline \multirow{7}{*}{8$\times$} & Base & - & - & 77.75 \\ & F-KD \cite{Massoli2020} & F & L2 & 77.85 \\ & AT \cite{AT} & SA & L2 & 77.40 \\ & HORKD \cite{Ge_Zhang_Liu_Hua_Zhao_Jin_Wen_2020} & F & L1+Huber & 78.27 \\ & A-SKD \textbf{(Ours)} & SA+CA & Cosine & \textbf{79.00} \\ & A-SKD+KD \textbf{(Ours)} & SA+CA+L & Cosine+KLdiv & \textbf{79.45} \\ \bottomrule \end{tabular}% } \label{tab:performances} \end{table} However, attention maps from the HORKD exhibit similar pattern to LR baseline network rather than the HR network in the Figure~\ref{fig:attn_example}. HR attention maps are highly activated in facial landmarks, such as eyes, lips, and beard, which are helpful features for face recognition~\cite{S2LD}. In contrast, detailed facial parts are less activated for LR attention maps because those parts are represented with a few pixels. Although HORKD boosts LR recognition performance by transferring HR relational knowledge, it still failed to capture detailed facial features crucial for recognition. The proposed A-SKD method directs the LR network's attention toward detailed facial parts that are well represented by the HR network's attention maps. Based on the refined attention maps, A-SKD outperforms the HORKD and other knowledge distillation methods for all cases. AgeDB-30 verification accuracy increased 0.6\%, 1.0\%, and 1.6\% compared with baseline for 2$\times$, 4$\times$, and 8$\times$ down-resolution ratios, respectively. In addition, when A-SKD is combined with logit distillation (KD), the verification accuracy increased significantly for all settings. From the results, we confirmed that the attention knowledge from the HR network can be transferred to the LR network and led to significant improvements that were superior to the previous SOTA method. \textbf{Evaluation on TinyFace.} Unlike the face verification, the identification task requires to select a target person's image from the gallery set consists of a large number of face images. Therefore, the identification performances decrease significantly when the resolution of face images are degraded. Table \ref{tab:tinyface} showed the identification performances on the TinyFace benchmark. When the AT~\cite{AT} was applied, the rank-1 identification accuracy decreased 13.34\% compared to the baseline. However, our approach improved the rank-1 accuracy 13.56\% compared to the baseline, even outperforming the HORKD method. This demonstrated that the parametric attention modules (CBAM) and cosine similarity loss are the key factors for transferring the HR network's knowledge into the LR network via attention maps. The proposed method is generalized well to real-world LR face identification task which is not manually down-sampled. \begin{table}[] \centering \caption{Evaluation results on TinyFace identification benchmark depending on the distillation methods. Acc@K denotes the rank-K accuracy (\%).} \label{tab:tinyface} \resizebox{0.60\textwidth}{!}{% \begin{tabular}{@{}ccccc@{}} \toprule \textbf{} & \textbf{ACC@1} & \textbf{ACC@5} & \textbf{ACC@10} & \textbf{ACC@50} \\ \midrule Base & 42.19 & 50.62 & 53.67 & 60.41 \\ AT~\cite{AT} & 36.56 & 45.68 & 49.03 & 56.44 \\ HORKD~\cite{Ge_Zhang_Liu_Hua_Zhao_Jin_Wen_2020} & 45.49 & 54.80 & 58.26 & 64.30 \\ A-SKD \textbf{(Ours)} & \textbf{47.91} & \textbf{56.55} & \textbf{59.92} & \textbf{66.60} \\ \bottomrule \end{tabular}% } \end{table} \section{Discussion} \textbf{Attention correlation analysis.} Figure \ref{fig:correlation} shows Pearsons correlation between attention maps from the HR and LR networks for the different distillation methods. Spatial and channel attention maps from the four blocks for models other than A-SKD have a low correlation between the HR and LR networks, with a magnitude lower than 0.5. In particular, spatial attention maps obtained from the first block of the LR baseline and HORKD network have negative correlation with the HR network ($r = -0.39$ and $-0.29$, respectively). \begin{figure} \centering \includegraphics[height=7.3cm]{figure/attention.png} \caption{Normalized spatial attention maps from the first block for different distillation methods. Red and blue regions indicate high and low attention, respectively. Face images and attention maps are from the AgeDB-30.} \label{fig:attn_example} \end{figure} Figure \ref{fig:attn_example} shows that spatial attention maps from LR baseline and HORKD networks are highly activated in skin regions, which are less influenced by resolution degradation, in contrast to the HR network. This guides the LR network to the opposite directions from the HR network. However, spatial attention maps from A-SKD exhibit strong positive correlation with those from the HR network, highlighting detailed facial attributes such as beard, hair, and eyes. Through the A-SKD, the LR network learned where to focus by generating precise attention maps similar to those for the HR network. Consequently, Pearsons correlation, i.e., the similarity measure between HR and LR attention maps, was significantly improved for all blocks, with a magnitude higher than 0.6. Thus the proposed A-SKD approach achieved superior efficacy and success compared with previous feature based SOTA methods. \begin{figure} \centering \includegraphics[height=5.1cm]{figure/correlation.png} \caption{Pixel level Pearsons correlation between the HR and LR network's attention maps for different distillation methods. B\{$i$\}-\{S,C\} indicates Pearsons correlation for spatial or channel attention maps obtained from the $i$-th ResNet block between the HR and LR networks; and $r$ is Pearsons correlation coefficient representing linear relationships between input variables. Base refers to the LR network that has not been subjected to any knowledge distillation methods. Pearsons correlation is measured using the AgeDB-30.} \label{fig:correlation} \end{figure} \textbf{Comparison with attention transfer~\cite{AT}.} Primary distinctions between AT \cite{AT} and A-SKD include the cosine similarity loss, parametric attention modules, and distillation of both channel and spatial attention maps. Correlation analysis for A-SKD confirmed that the cosine similarity loss is an effective strategy for transferring attention knowledge. Distilling AT attention maps using the cosine similarity rather than the L2 loss increased AgeDB-30 verification accuracy by 0.32\%p (Table~\ref{tab:ablation}). AT calculates attention maps using channel-wise pooling, a non-parametric layer; whereas A-SKD calculates attention maps using parametric layers comprising fully connected and convolution layers. When the input image resolution degrades, the student network’s feature representation diverges from that of the teacher network. Therefore, it is difficult to match the attention maps of the student network obtained by the non-parametric module with those of the teacher network. Instead, A-SKD employs the parametric module for the attention maps extraction and the cosine similarity loss for the distillation; therefore, the attention maps from the student network can be adaptively trained to be similar to the attention maps from the teacher network despite the differences in the features. Finally, A-SKD distills both spatial and channel attention maps in contrast to AT which only considered spatial attention maps. We confirmed A-SKD with spatial and channel attention additionally improved AgeDB-30 verification accuracy by 0.34\%p compared with spatial-only attention. This comparison results also confirmed that A-SKD, designed for attention distillation on LR settings, is the most effective approach for transferring attention knowledge. \begin{table}[] \centering \caption{Comparing attention transfer (AT) \cite{AT} and proposed A-SKD on AgeDB-30 benchmark down-sampled with 8$\times$ ratio. AT* indicates the cosine similarity loss was utilized for attention transfer rather than the original L2 loss. SA and CA indicate spatial and channel attention maps, respectively.} \resizebox{0.80\textwidth}{!}{% \begin{tabular}{@{}ccccc@{}} \toprule \textbf{Method} & \textbf{Type} & \textbf{Transformation} & \textbf{Loss Function} & \textbf{\begin{tabular}[c]{@{}c@{}}Ver-ACC (\%)\\ (AgeDB-30)\end{tabular}} \\ \midrule AT \cite{AT} & SA & Non-parametric layer & L2 & 77.40 \\ AT$^*$ & SA & Non-parametric layer & Cosine & 77.72 \\ A-SKD & SA & Parametric layer & Cosine & 78.66 \\ A-SKD & SA + CA & Parametric layer & Cosine & \textbf{79.00} \\ \bottomrule \end{tabular} \label{tab:ablation}% } \end{table} \section{Extension to Other Tasks} \subsection{Object classification} We conducted experiments for object classification on LR images using the 4$\times$ down-sampled ImageNet~\cite{imagenet}. For the backbone network, we utilized the ResNet18 with CBAM attention modules. We compared our method to other knowledge distillation methods (AT~\cite{AT} and RKD~\cite{Park2019}) which are widely utilized in the classification domains. We re-implemented those methods using its original hyperparameters. Usually, AT and RKD were utilized along with the logit distillation for the ImageNet; therefore, we performed the AT, RKD, and A-SKD in conjunction with the logit distillation in the Table \ref{tab:imagenet_result}. Training details are provided in the Supplementary Information. Table \ref{tab:imagenet_result} shows that A-SKD outperformed the other methods on the LR ImageNet classification task. Park et al. demonstrated that introducing the accurate attention maps led the significant improvement on classification performances~\cite{Park2018BAMBA,Woo2018}. When the attention maps were distilled from the teacher network, student network could focus on informative regions by forming precise attention maps similar with the teacher's one. Thus, our method can be generalized to general object classification task, not restricted to face related tasks. \begin{table}[] \centering \caption{Proposed A-SKD performance on low resolution ImageNet classification. All distillation methods were performed in conjunction with the logit distillation.} \label{tab:imagenet_result} \resizebox{0.36\textwidth}{!}{% \begin{tabular}{@{}ccc@{}} \toprule \textbf{Resolution} & \textbf{Method} & \textbf{ACC (\%)} \\ \midrule 1$\times$ & Base & 70.13 \\ \hline \multirow{4}{*}{4$\times$} & Base & 65.34 \\ & AT~\cite{AT} & 65.79 \\ & RKD~\cite{Park2019} & 65.95 \\ & A-SKD & \textbf{66.52} \\ \bottomrule \end{tabular}% } \end{table} \subsection{Face detection} Face detection is a sub-task of object detection to recognize human faces in an image and estimate their location(s). We utilized TinaFace~\cite{TinaFace}, a deep learning face detection model, integrated with the CBAM attention module to extend the proposed A-SKD approach to face detection. Experiments were conducted on the WIDER FACE~\cite{7780965} dataset (32,203 images containing 393,703 faces captured from real-world environments) with images categorized on face detection difficulty: easy, medium, and hard. LR images were generated with 16$\times$ and 32$\times$ down-resolution ratios, and further training and distillation details are provided in the Supplementary Information. \begin{table}[] \centering \caption{Proposed A-SKD performance on LR face detection. mAP is mean average precision; easy, medium, and hard are pre-assessed detection difficulty.} \resizebox{0.46\textwidth}{!}{% \begin{tabular}{ccccc} \toprule \multirow{2}{*}{\textbf{Resolution}} & \multirow{2}{*}{\textbf{Model}} & \multicolumn{3}{c}{\textbf{mAP (\%)}} \\ \cline{3-5} & & \textbf{Easy} & \textbf{Medium} & \textbf{Hard} \\ \midrule 1$\times$ & Base & 95.56 & 95.07 & 91.45 \\ \hline \multirow{2}{*}{16$\times$} & Base & 54.38 & 52.73 & 35.29 \\ & A-SKD & \textbf{62.93} & \textbf{60.19} & \textbf{47.28} \\ \hline \multirow{2}{*}{32$\times$} & Base & 31.15 & 26.68 & 14.00 \\ & A-SKD & \textbf{33.50} & \textbf{30.04} & \textbf{16.02} \\ \bottomrule \end{tabular}% } \label{tab:detection-result} \end{table} Table~\ref{tab:detection-result} shows that A-SKD improved the overall detection performance by distilling well-constructed attention maps, providing significant increases of mean average precision (mAP) for the easy (15.72\% for 16$\times$ and 7.54\% for 32$\times$), medium (14.15\% for 16$\times$ and 12.59\% for 32$\times$), and hard (33.98\% for 16$\times$ and 14.43\% for 32$\times$) level detection tasks. Small faces were well detected in the LR images after distillation as illustrated in Figure \ref{fig:detection_result}. Thus the proposed A-SKD approach can be successfully employed for many LR machine vision tasks. \begin{figure} \centering \includegraphics[height=5.0cm]{figure/detection_result.png} \caption{Qualitative results for LR face detection before and after applying A-SKD. Small faces were better detected after A-SKD. The face images are from the evaluation set of WIDERFACE.} \label{fig:detection_result} \end{figure} \section{Conclusion} We verified that attention maps constructed from HR images were simple and effective knowledge that can be transferred to LR recognition networks to compensate for spatial information loss. The proposed A-SKD framework enabled any student network to focus on target regions under LR circumstances and generalized well for various LR machine vision tasks by simply transferring well-constructed HR attention maps. Thus, A-SKD could replace conventional KD methods offering improved simplicity and efficiency and could be widely applicable to LR vision tasks, which have not been strongly studied previously, without being limited to face related tasks. \\ \textbf{Acknowledgments} This work was supported by the ICT R\&D program of MSIT/IITP[2020-0-00857, Development of Cloud Robot Intelligence Augmentation, Sharing and Framework Technology to Integrate and Enhance the Intelligence of Multiple Robots. And also, this work was partially supported by Korea Institute of Energy Technology Evaluation and Planning (KETEP) grant funded by the Korea government (MOTIE)(No. 20202910100030) and supported by Electronics and Telecommunications Research Institute (ETRI) grant funded by the Korean government. [22ZR1100, A Study of Hyper-Connected Thinking Internet Technology by autonomous connecting, controlling and evolving ways]. \clearpage \bibliographystyle{splncs04} \section{Implementation Details of Previous Methods} Various knowledge distillation approaches have been proposed to transfer the teacher network's knowledge to student network. Usually, the loss term of the knowledge distillation methods can be defined as the summation of the target task's loss and the distillation loss. $L_{total} = L_{target} + L_{distill}$. To compare the A-SKD with the previous distillation methods (HORKD~\cite{Ge_Zhang_Liu_Hua_Zhao_Jin_Wen_2020}, F-KD~\cite{Massoli2020}, and AT~\cite{AT}), we re-implemented those methods using the official implementation code. The distillation loss function of the AT~\cite{AT} is defined as the L2 distance between the teacher and student network's self-attention maps. For the ResNet50, the AT distills the self-attention maps on the four blocks. We performed the experiments using the official implementation of AT (\url{https://github.com/szagoruyko/attention-transfer}). The distillation loss function of the F-KD~\cite{Massoli2020} is defined as the L2 distance between the teacher and student network's feature maps. The penultimate layer's features (output of the backbone network before input to the margin) are utilized for the distillation. We performed the experiments using the official implementation of F-KD (\url{https://github.com/fvmassoli/cross-resolution-face-recognition}). The loss function of the previous SOTA method (HORKD~\cite{Ge_Zhang_Liu_Hua_Zhao_Jin_Wen_2020}) is defined as \begin{equation} \label{eq:horkd_loss} \mathcal{L}_{distill} = L_1 + \alpha L_2 + \beta L_3 + \gamma L_C \end{equation} where $L_1, L_2, L_3$, and $L_C$ indicate the individual-level, pair-level, triplet-level, and group-level knowledge distillation loss, respectively; the different order relational distillation losses are tuned by the factor of $\alpha, \beta, \gamma$ in order. In our implementation, $\alpha=0.1$, $\beta=0.2$, and $\gamma=0.1$ after the hyperparameter search using the same protocol with our method. The penultimate layer's features (output of the backbone network before input to the margin) are utilized for the distillation. Because HORKD has no official implementation code, we referenced the official implementation of RKD~\cite{Park2019} (\url{https://github.com/lenscloth/RKD}). \section{Extension to Other Tasks} \subsection{Object Classification.} We utilized the ResNet50-CBAM backbone for the ImageNet training. The model was trained by SGD optimizer for 90 epochs with learning rate = 0.4, batch size = 1024, momentum = 0.9, and weight decay = 0.0001. Mixed precision was applied for the efficient training. We referenced the code of \url{https://github.com/rwightman/pytorch-image-models} for the training and validation on ImageNet benchmark. \subsection{Face Detection} The WIDER FACE~\cite{7780965} was utilized for training and validation to extend A-SKD to face detection. The WIDER FACE contained 32,203 images from 61 event classes, totaling 393,703 faces. The WIDER FACE categorized images into three face detection difficulties: easy, medium, and hard, considering scale, occlusion, and pose. Face detection performance on WIDER FACE was evaluated by overall mean average precision (mAP), and easy, medium, and hard images were evaluated separately. We trained TinaFace~\cite{TinaFace} on WIDER FACE by combining it with the CBAM attention module. LR images with 16$\times$ and 32$\times$ down-sampling ratio were trained to validate A-SKD effectiveness. TinaFace used ResNet-50 backbone network; and the loss function combined face detection and attention distillation losses. For the detection task, we distilled the attention maps of the four ResNet blocks, not every convolution layer. The model was trained by SGD optimizer for 150 epochs with learning rate = 0.001, momentum = 0.9, and weight decay = 0.0005 on two Titan RTX (24GB) GPUs with batch size = 8. We used non-maximum suppression threshold = 0.4 and confidence level = 0.02. We referenced the code of \url{https://github.com/Media-Smart/vedadet} for the implementation of TinaFace. \clearpage \bibliographystyle{splncs04}
{'timestamp': '2022-09-30T02:05:58', 'yymm': '2209', 'arxiv_id': '2209.14498', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14498'}
arxiv
\section{Introduction} In general, there are two main paradigms to do text summarization: \textit{abstractive}~\cite{rush2015neural,nallapati2016abstractive,gehrmann2018bottom} and \textit{extractive}~\cite{cheng2016neural,narayan2018ranking, zhong2019searching, zhong2022unsupervised} methods. For extractive summarization, previous studies~\cite{nallapati2017summarunner, liu2019text} formulate it as a \textit{sentence-level} sequence labeling task. However, there is an inherent gap between the \textit{sentence-level} scoring and the \textit{summary-level} evaluation~\cite{DBLP:conf/acl/ZhongLCWQH20}.This means that some high-scoring sentences may share the same meaning, making them not a qualified summary when combined. Similarly, the previous training paradigm for abstractive summarization models can be viewed as a \textit{token-level} scoring process upon the decoder of sequence-to-sequence model. There also exists the issue of exposure bias~\cite{bengio2015scheduled, paulus2017deep} in the teacher-forcing framework leading to the error accumulation during auto-regressive decoding. Therefore, previous frameworks for both extractive and abstractive methods did not perform \textit{summary-level} optimization. To tackle this problem, state-of-the-art summarization systems~\cite{DBLP:conf/acl/ZhongLCWQH20, liu2021simcls} are enhanced with an additional module (called re-ranker) and follow a two-stage paradigm. They first train a summarizer to model the conditional distribution $p(Y|X)$ where $X$ is the document and $Y$ is the output summary. Then the re-ranker is trained to re-score candidates sampled from the pre-trained summarizer in the second stage. However, this paradigm trades efficiency for accuracy, the auxiliary re-ranking greatly harms the inference efficiency especially for the highly efficient extractive systems. Experimentally, the decoding speed of two-stage re-ranking models is only \textasciitilde{{7.0}} samples/s while removing the re-ranker module will greatly boost the decoding speed to \textasciitilde{\textbf{42.0}} samples/s\footnote{We run these two models on the test set of CNN/DailyMail using single GeForce GTX TITAN XP GPU for 3 times and report the average speed.}. This makes two-stage summarization systems may be unacceptable in real-world scenarios that require timely feedback. The limitations of the existing work motivate us to build a one-stage summarization system that can 1) replace previous naive sentence/token-level score with a summary-level score and 2) do not sacrifice the parameter and inference efficiency. In this paper, we propose a \textbf{Co}ntrastive \textbf{L}earning based re-ranking framework for \textbf{o}ne-stage summarization called \textsc{CoLo} for both extractive and abstractive approach. Contrastive learning has been explored in summarization~\cite{sun2021alleviating,an2021retrievalsum} and generation~\cite{lee2020contrastive, an2022cont}. \textsc{CoLo} uses a contrastive re-ranking training objective. We first present a novel sampling method that can be equipped to any one-stage summarization systems so that it can re-score candidates without the second stage. The existing two-stage models use \textbf{offline sampling} to preprocess samples for training of re-ranker where candidate samples are drawn from a fixed model distribution. This is a huge obstacle to turning \textit{summarize-then-rerank} two-stage framework into an efficient end-to-end model. To solve this issue, we propose an \textbf{online sampling} approach. Concretely, instead of sampling from a fixed distribution, we draw positive and negative samples from a dynamic distribution of model outputs during training, which ultimately eliminates the requirement for additional modules in the overall framework. We then introduce a summary-level optimization strategy in addition to the traditional sentence-level (for extractive systems) or token-level loss (for abstractive systems). As a result, as a one-stage model, \textsc{CoLo} achieves comparable performance to two-stage systems, and greatly improves decoding speed to meet the needs of real-world applications. We summarize our contributions as follows: \begin{itemize} \item We are the first to propose a one-stage re-ranking framework \textsc{CoLo} for both extractive and abstractive summarization systems. \item Results on the popular CNN/DailyMail benchmark show that both the extractive and abstractive versions of \textsc{Colo} outperform previous state-of-the-art one-stage systems by a large margin. Compared to the two-stage systems, \textsc{CoLo} achieves comparable performance without additional pre-trained model. More importantly, \textsc{Colo} do not sacrifice inference speed and thus can be more widely used in real-world scenarios. \end{itemize} \section{Background} \subsection{Preliminary about Two-Stage Systems } Two-stage paradigms~\cite{DBLP:conf/acl/ZhongLCWQH20,liu2021simcls} improve summarization quality by re-ranking and selecting a candidate from a given set of candidates. MatchSum~\cite{DBLP:conf/acl/ZhongLCWQH20} forms a contrastive learning based re-ranking framework where they first generate a set of candidates summaries by a extractive summarization model and then feed them to a re-ranker. The re-ranker is trained to optimize a summary-level score and it can evaluate the candidate summaries holistically. SimCLS~\cite{liu2021simcls} is the abstractive version which replaces the extractive summarizer in \citet{DBLP:conf/acl/ZhongLCWQH20} with a abstractive summarizer. The training objective for summarization models is to estimate a conditional probability distribution $p(Y|X)$, where $X$ is the document and $Y$ is the output summary. Given a summarization model $\mathcal{M}$ that has already tuned under the conventional framework with loss function $\mathcal{L}_{sum}$ where $\mathcal{L}_{sum}$ could be binary cross entropy loss (BCELoss) or negative log likelihood loss (NLLLoss). The two-stage systems should first use a sampling algorithm e.g. beam search to sample a candidate set $\mathcal{C} = \{C_1, C_2, \ldots, C_m\}$ of size $m$ from the fixed model distribution $C_i \sim p_{\mathcal{M}}(Y|X)$. Candidates in $\mathcal{C}$ are sort by their ROUGE score in descending order. Then the they further train a separate re-ranker,e.g., BERT , with a contrastive-style ranking loss $\mathcal{L}_{rank}$ to select the the best candidate from $\mathcal{C}$ as the final output. The ranking loss used in the best re-ranking system for summarization is the triplet margin loss~\cite{kingma2014adam}. For a candidate pair $(C_i, C_j)$ where $i<j$, if $C_i$ has higher ROUGE score and it will be treated as the positive sample: \begin{equation} \mathcal{L}_{i,j} = max\{0, \text{cos}(\mathbf{z}_X, \mathbf{z}_{C_i}) - \text{cos}(\mathbf{z}_X, \mathbf{z}_{C_j}) + \rho \}, \label{eq:loss_rank} \end{equation} where $\mathbf{z}_X, \, \mathbf{z}_{C_i},\, \mathbf{z}_{C_j}$ are the vector feature representation of $X, C_i, C_j$ output by the re-ranker, and $\rho$ is the margin value. The final ranking loss is obtained by summing up all pairs: $\mathcal{L}_{rank} = \sum_j\sum_{i<j} \mathcal{L}_{i,j}$. The ranking loss ensures that candidates with higher ROUGE score is closer to the document in the embedding space. \subsection{A Comparison between Two-Stage Systems and \textsc{CoLo}} Figure~\ref{fig:compare} illustrates the difference between the architecture of two-stage systems and \textsc{CoLo}. Although MatchSum and SimCLS significantly outperform all one-stage models, they mainly suffer from three drawbacks which strongly emphasize the necessity of designing an one-stage model: (1) Training/inference inefficiency. Building the training set of the re-ranker and the second training stage consumes large amounts of GPU and CPU time (see details in Section~\ref{sec:effi}). Moreover, the need of re-feeding generation results to another module also requires unaffordable computational resources. (2) Coupling between the summarizer and re-ranker. Each improvement to one of these modules requires simultaneous updating or retraining of another module, which limits the use of such systems in the real world. For example, to try a larger candidate set or a different decoding method, we have to prepare the training set again for the second stage. In addition, how to tune the hyperparameters to be optimal in both modules at the same time is another tricky issue. Compared with two-stage systems, our one-stage system has a simple and clean implementation. (3) Two-stage systems also face difficulties in long document summarization, because the input length of the re-ranker will drastically increase as the length of candidates increasing (see detailed analysis in Appendix~\ref{sec:long_doc}). Correspondingly, \textsc{CoLo} is not easily affected by length variance. \newcommand{\unskip \vrule width 0.5pt}{\unskip \vrule width 0.5pt} \begin{figure*}[ht!] \centering \subfigure[Two-stage models: MatchSum and SimCLS]{ \label{fig:rerank} \includegraphics[width=0.42\textwidth]{figures/rerank.pdf} } \unskip \vrule width 0.5pt \subfigure[CoLo (this work)]{ \label{fig:CoLo} \includegraphics[width=0.26\textwidth]{figures/CoLo.pdf} } \caption{ A comparison between two-stage models and \textsc{CoLo}. The two-stage models including two training stages and a time-consuming preprocess while \textsc{CoLo} is trained in an end-to-end fashion. (GPU and CPU hours cost in each stage are shown in Table~\ref{tab:training effi}). Two-stage models use offline sampling to build positive-negative pairs while \textsc{CoLo} builds positive-negative pairs with online sampling where we directly get theses pairs from a changing model distribution. } \label{fig:compare} \end{figure*} \section{Method} \subsection{A Naive One-Stage Re-ranking Model} The goal of one-stage re-ranking systems is to enable both training and inference to score candidate summaries holistically without requiring a second stage of computation by a separate model. Ideally, an one-stage summarization model should both function as a summarizer and a re-ranker. A straightforward solution is multi-task learning. The naive training pipeline can be formulated as follows: (i) tuning $\mathcal{M}$ with $\mathcal{L}_{sum}$. (ii) Getting positive and negative samples from $p_{\mathcal{M}}(Y|X)$ via offline sampling for each datapoint $X$ in the training set. (iii) Building the ranking loss with these candidates and further tuning $\mathcal{M}$ with $\mathcal{L}_{rank} + \mathcal{L}_{sum}$. However, in practice, such training method is always suboptimal compared to the state-of-the-art two-stage models. We denote the model after multi-task learning as $\mathcal{M'}$. There is a serious \textit{generalization error} in the naive methods: via multi-task learning, $\mathcal{M}'$ is only able to rank candidates drawn from the original model distribution $p_{\mathcal{M}}(Y|X)$ but not candidates from the new distribution $p_{\mathcal{M'}}(Y|X)$. This error makes the naive approach unable to directly output a good summary in sequence-level generated by itself. \subsection{Our approach: \textsc{CoLo}}\label{ext_detail} The first step of CoLo is also to train the summarization model with $\mathcal{L}_{sum}$ like the naive approach. In CoLo, we discard using positive-negative samples that from a fixed model distribution, instead, we sample these candidates from a constantly shifting model distribution during multi-task learning. By doing so, we can mitigate the above mentioned generalization error as much as possible because candidates are dynamically changing with the parameters of the model distribution $p_{\mathcal{M}}(Y|X)$ updated by gradient descent. To implement this process, at each training step, we sample the newest candidates along with their feature presentations from the summarization model and calculate the ranking loss. We will give a detailed description about how we performing the online sampling process on mainstream extractive and abstractive summarization models in the following parts. \paragraph{Online Sampling for Extractive Model} The task of extractive summarization is to assign a label $y_i \in \{0,1\}$ for each sentence ${sent}_{i}$ from the source document $X$ $ = ({sent}_{1}, {sent}_{2},\ldots,{sent}_{n})$ consisting of $n$ sentences. Figure~\ref{fig:ext_model} gives an example of our one-stage extractive summarization model. Extractive candidates can be viewed as a subset of sentences from the document. In this figure, we sample $sent_1, sent_2$ to form the first candidate $C_1 = \{sent_1, sent_2\}$, and $C_2$ is consisting of $\{sent_2, sent_3\}$. After constructing these candidates, the next step is to represent them in the embedding space. In our one-stage model, we employ a heuristic way to obtain the feature presentations of candidates: pooling results of the sentence embedding from the extractive model. Concretely, we denote the sentence embedding for the $i$-th sentence as $\mathbf{h}_i$. The hidden representation of a candidate is created by pooling the sentence representations belong to it. For example $\mathbf{z}_{C_1}$ is the average pooling result of $\mathbf{h}_1$ and $\mathbf{h}_2$. Suppose $C_2$ has higher ROUGE score than $C_1$, then $C_2$ is treated as a positive sample and $C_1$ is treated as a negative sample for this pair. Finally, the whole system is trained by the sum of $\mathcal{L}_{rank}$ and $\mathcal{L}_{sum}$. Sampling informative candidates is essential in re-ranking systems. The first step of the sampling method is to determine ${\mathcal{N}}$ which represents the number of candidate sentences. ${\mathcal{N}}$ is set depending on the number of summary sentences of downstream datasets. Take CNN/DailyMail as an example, we set ${\mathcal{N}}$ to $\{2,3\}$ because most gold summaries consist of 2$\sim$3 sentences. At each training step, we iterate over $\mathcal{N}$ by combination and form $m$ different candidates $\mathcal{C} = \{C_1, C_2, \ldots, C_m\}$. $ m$ is equal to $\sum_iC_{n}^{num_i}$ where $num_i$ is the $i$-th element in ${\mathcal{N}}$ and $n$ is number of sentences of the document. For CNN/DailyMail whose ${\mathcal{N}}$ is set to $\{2,3\}$, we can sample $C_n^2 + C_n^3$ different candidates. However, in practice, we always face the combination explosion problem when the number of sentences $n$ grows larger. The two-stage system~\cite{DBLP:conf/acl/ZhongLCWQH20} pre-trained an extractive model to clip the origin number of sentences to an acceptable size. Notice that our extractive summarizer is also supervised with the BCELoss, so that we can clip the sampling space to $n'$ (a hyperparameter) with the output distribution over the sentences at each training step. Then the total size of the final candidate set decreases to $m' = \sum_iC_{n'}^{num_i}$. For CNN/DailyMail, $n'$ is set to 5, and we can get $C_5^2 + C_5^3 = 20 $ different extractive candidates. Details about the setting of $\mathcal{N}$ and $n'$ can be found in Table~\ref{tab:candidate_size} in Appendix. Notably, the offline sampling needs to feed each candidate into the pre-trained encoder. In real-life setting, when summarizing some long documents, the number of sentences in the input document and output summary will increase significantly. It will bring a polynomial level increase to the computation and GPU overhead of the two-stage model. But our one-stage system with online sampling is robust to the length variance. \paragraph{Inference Stage of Extractive Model} Since we have modeled a summary-level score during training, it is easy to directly generate summaries according to the summary-level semantic score. Concretely, given a candidate set $\mathcal{C}$ built by the combination strategy, we calculate the cosine similarity between each candidate presentation $\mathbf{z}_{C_i}$ and the document representation $\mathbf{z}_X$: \begin{equation} \label{eq:ext_inf} \hat{C} = \max_{C_i \in \mathcal{C}}{cos( \mathbf{z}_{X},\mathbf{z}_{C_i})}. \end{equation} The final output is the candidate with highest cosine similarity score. \begin{figure}[t] \centering \includegraphics[width=0.9\linewidth]{figures/extractive.pdf} \caption{Architecture of our extractive model. Input sequence: The `[doc]' token is used to get vector representation $\mathbf{z}_{X}$ of the document $X$, `[sep]' is used as separator for sentences. We omit the classifier and the BCELoss. $\mathbf{h}_i$ is the sentence embedding the i-$th$ sentence in $X$. $\mathbf{z}_{C_i}$ means the feature representation of the $i$-th candidate.} \label{fig:ext_model} \end{figure} \paragraph{Online Sampling for Abstractive Model} Our method can also be easily adapted in abstractive summarization. Selecting a generated summary maximum a posteriori (MAP) usually result in poor performance~\cite{stahlberg2019nmt}, thus most state-of-the-art generation model usually use the beam search algorithm at inference stage. The online sampling for the abstractive version is much simpler than the extractive version. We use beam search as sampling algorithm and get the feature representations from the encoder/decoder output. We denote the encoder output of source document $X$ as $H_{enc}$ and the decoder hidden states of the target summary as $H_{dec}$. We get the document representation from the encoder output of the 0-th token $\mathbf{z}_{X} = H_{enc}^0$. The feature representation of the $i$-th candidate $C_i$ with length = $|C_i|$ is derived from the last step of the decoder output $\mathbf{z}_{C_i} = H_{dec}^{|C_i|-1}$. Hidden states of other steps can not represent the entire sequence because of the sequence mask in transformer decoder. finally we formulate the ranking loss following Eq.~\ref{eq:loss_rank}. \paragraph{Inference Stage of Abstractive Model} The inference stage of our abstractive version is similar to the extractive version. We save the feature representation of the document and each beam during beam search. The final output is determind by the cosine distance between $\mathbf{z}_{X}$ and $\mathbf{z}_{C_i}$. \section{Experimental Setup} \renewcommand\arraystretch{1.4} \begin{table}[t]\footnotesize\setlength{\tabcolsep}{2.3pt} \centering \begin{tabular}{lccccc} \toprule \qquad &\textbf{CNN/DM} & \textbf{Reddit} & \textbf{XSum} & \textbf{SSN} & \textbf{PubMed} \\ \midrule $n'$ & 5 & 5 & 5 & 8 & 8 \\ $ {\mathcal{N}} $ & 2,3 & 1,2 & 1,2 & 6 & 6,7 \\ $|\mathcal{C}$| & 20 & 15 & 15 & 28 & 36 \\ \bottomrule \end{tabular}% \caption{candidate size $|\mathcal{C}|$ of each datasets (extractive). $|n'|$ is the clipped candidate size, ${\mathcal{N}}$ is a set containing all number of possible sentence.} \label{tab:candidate_size} \end{table} \subsection{Datasets} We conduct experiments on five mainstream datasets to evaluate the effectiveness of our approach. \\ \textbf{CNN/DailyMail} \cite{hermann2015teaching} is a classic benchmark which contains articles from the CNN/Daily Mail newspapers. We use the cased version from datasets\footnote{\url{https://github.com/huggingface/datasets}} \\ \textbf{XSum}~\cite{narayan2018don} is a one-sentence summary dataset from BBC News. Gold summaries are professionally written by the authors of documents.\\ \textbf{Reddit}~\cite{kim2019abstractive} is collected from social media platform and we use the TIFU-long version.\\ \textbf{PubMed}~\cite{cohan2018discourse} is a long document summarization dataset from scientific domain whose $avg$ summary length is about 4 times longer than CNN/DM.\\ \textbf{SSN}~\cite{an2021enhancing} consists of papers mainly from math, physics and computer science with the abstract section as gold reference.\\ \subsection{Implementation Details} For the simplity of experimental settings, both extractive model and abstractive mode are based on BART. We use the encoder of BART (170M) as the backbone and a 3-layer MLP as the classifier to implement the extractor. We add two special token `<cls>' to generate the sentence representation and `<sep>' as sentence separator. `<doc>' token is used to generate the document feature representation. candidate size for each dataset can be found in~\ref{tab:candidate_size} We use adam optimizer~\cite{kingma2014adam} learning rate schedule follows the setting in transformer~\cite{vaswani2017attention}. We train our model for 15000 steps with BCELoss and 32000 steps with BCELoss and RankingLoss where each step has a batch size of 36. The margin parameter $\gamma$ is set to 0.01. The size of generated candidates $|\mathcal{C}|$ is set to 20 for CNN/DM. We report the results. Other settings follow the default setting in \citet{liu2019text}. Our model is trained on single GeForce RTX 3090 GPU for 8 hours. Both our abstractive model and extractive model are trained on 24G GeForce RTX 3090 GPUs and the inference process is on 12G GeForce GTX TITAN XP GPUs. For abstractive model, we choose BART initialized with facebook/bart-large-cnn from transformers\footnote{\url{https://github.com/huggingface/transformers}} as the basic summarizer. We further fintune this model by NLLLoss and RankingLoss for 15000 steps where each step with a batch size of 8. Other setting is the same with our extractive version. To encourage diversity, we use the diverse beam search~\cite{vijayakumar2016diverse} to generate the candidates with beam size set to 16 and diversity penalty set to 1.0. Our model is trained on 8 GeForce RTX 3090 GPUs for about 18 hours. \subsection{Evaluation Metrics} We examine our approach with 4 metrics that measure the distance between generated summaries against the gold reference. \textbf{ROUGE}~\cite{lin2004rouge} where R-1 and R-2 measure informativeness based on n-gram overlapping and R-L represents fluency. \textbf{JS-2 Divergence}~\cite{louis2013automatically} measures Jensen-Shannon divergence between the bigram distributions of two input texts. \textbf{BERTScore}~\cite{zhang2019bertscore} measures soft overlap between BERT embeddings of two texts instead of using lexical matching methods. \textbf{MoverScore}~\cite{zhao2019moverscore} is also based on the neural model but applies a earth mover distance measure to contextualized BERT embeddings. \section{Results} We denote the model without contrastive learning as the baseline system. Since the backbone of our extractive model is BART encoder so that we call the baseline model \textsc{BartExt}. The baseline model for abstractive system is BART. Our extractive model is called \textsc{CoLo}$_{Ext}$ and its abstractive version is denoted as \textsc{CoLo}$_{Abs}$. \subsection{Extractive Results} We compare our models with baseline models which has similar amount of parameters and decoding speed of our models in this section. Our extractive results on CNN/DM are shown in Table~\ref{table:ext_cnndm} We compare our model with previous strong extractive baseline built on pre-trained model~\cite{zhong2019searching, bae2019summary, liu2019text} and strong multi-stage systems~\cite{DBLP:conf/acl/ZhongLCWQH20}. From the third section of Table~\ref{table:ext_cnndm}, we can see that our model \textsc{CoLo}$_{Ext}$ beats the baseline model by 1.49 ROUGE-1 score and achieve the state-of-the-art among all end-to-end systems when input length set to 512 and the results can be further improved while extending the input length to 1024. Even compared with the \textsc{BertSum}-large (340M)~\cite{liu2019text} which is built on large PTM, We still have an improvement of 0.42 with only the half number of parameters of theirs. Though RL-based methods hold the motivation of optimizing towards the evaluation metric, but it does not gain much improvement on performance in practice. To verify whether our model is effective on datasets of various lengths, we also evaluate our model on datasets with short summaries (Reddit and XSum) and long document dataset PubMed and results are shown in Table~\ref{tab:ext_other_datasets}. On reddit and XSum, we achieve the advantage of more than 1.0 point ROUGE-1 than baseline systems and close performance with the upper bound ORACLE. We also gain improvements when tested on the long document summarzation dataset PubMed. Detailed results on long document dataset can be found in Appendix~\ref{sec:long_doc}. \renewcommand\arraystretch{1.2} \begin{table}[t] \center \footnotesize \setlength{\tabcolsep}{1.05mm}{ \begin{tabular}{lccc} \toprule {\textbf{Model}} & \textbf{R-1} & \textbf{R-2} & \textbf{R-L} \\ \midrule LEAD & 40.43 & 17.62 & 36.67 \\ ORACLE & 52.59 & 31.23 & 48.87 \\ \midrule Transformer\cite{vaswani2017attention} & 40.90 &18.02 &37.17 \\ \textsc{Bert-Ext}\cite{bae2019summary} & 42.29 & 19.38 & 38.63 \\ \textsc{Bert-Ext} + RL & 42.76 & 19.87 & 39.11 \\ {BertSum}~\cite{liu2019text} & 42.57 & 19.96 & 39.04 \\ {BertSum}-large & \underline{43.85} & 20.34 & 39.90 \\ \midrule \textsc{BartExt} & 42.78 & 20.24 & 39.24 \\ \textsc{BartExt} ($len=1024$) & 43.65 & \underline{20.88} & \underline{40.19} \\ \midrule Naive one-stage & 43.53 & 20.54 & 39.62 \\ \textsc{CoLo}$_{Ext}$ & 44.10 & 20.97 & 40.19 \\ \textsc{CoLo}$_{Ext}$ + BERTScore & 44.27 & 21.01 & 40.34 \\ \textsc{CoLo}$_{Ext}$ ($len=1024$) & \textbf{44.58} & \textbf{21.25} & \textbf{40.65} \\ \bottomrule \end{tabular}} \caption{Extractive results on CNN/DM test set. $len$ means the input length of the document, results without the marker using 512 tokens as input. +RL means the addition of reinforcement learning. +BERTScore means we use BERTScore to determine positive-negative samples. \textsc{CoLo} clearly outperform all previous one-stage summarization systems. The best results are in bold and the second best ones are underlined. } \label{table:ext_cnndm} \end{table} \renewcommand\arraystretch{1.0} \begin{table*}[t] \center \footnotesize \tabcolsep0.13 in \begin{tabular}{lccccccccc} \toprule \multicolumn{1}{c}{\multirow{2}[1]{*}{\textbf{Model}}} & \multicolumn{3}{c}{\textbf{Reddit}} & \multicolumn{3}{c}{\textbf{XSum}} & \multicolumn{3}{c}{\textbf{PubMed}} \\ & \textbf{R-1} & \textbf{R-2} & \textbf{R-L} & \textbf{R-1} & \textbf{R-2} & \textbf{R-L} & \textbf{R-1} & \textbf{R-2} & \textbf{R-L} \\ \cmidrule(lr){1-1} \cmidrule(lr){2-4} \cmidrule(lr){5-7} \cmidrule(lr){8-10} LEAD & 12.38 & 2.17 & 10.12 & 14.40 & 1.46 & 10.59 & 37.58 & 12.22. & 33.44 \\ ORACLE & 29.10 & 11.08 & 23.10 & 25.62 & 7.62 & 18.72 & 45.12 & 20.33 & 40.19 \\ \cmidrule(lr){1-1} \cmidrule(lr){2-4} \cmidrule(lr){5-7} \cmidrule(lr){8-10} \textsc{BertSum} & 23.86 & 5.85 & 19.11 & 22.86 & 4.48 & 17.16 & 41.05 & 14.88 & 36.57 \\ \textsc{BartExt} & 23.97 & 5.68 & 19.24 & 22.96 & 4.70 & 17.29 &41.40 & 16.18 & 37.89 \\ \rowcolor{mygray} \textsc{CoLo}$_{Ext}$ & \textbf{25.06} & \textbf{5.90} & \textbf{19.52} & \textbf{24.51} & \textbf{5.04} & \textbf{18.21} & \textbf{41.93} & \textbf{16.51} & \textbf{38.28} \\ \bottomrule \end{tabular} \caption{Results on test sets of reddit, XSum and PubMed. Our model achieve significant improvement on the baseline model \textsc{BartExt}. LEAD means we select the first $k$ sentences from the source document as the output summary and ORACLE is the upper bound of extractive methods. } \label{tab:ext_other_datasets} \end{table*} \subsection{Abstractive results} Early work also successfully applies reinforcement learning on abstractive summarization~\cite{paulus2017deep,li2019deep}. But we do not find related works that successfully combine reinforcement learning with strong pre-trained models. Therefore, most of our baselines are strong pertrained model finetuned with NLLLoss. Our results is shown in Table~\ref{table:abs_cnndm}, due to the huge cost of using large pre-trained model with length set to 1024, we also report results with 512 input tokens and it is able to significantly outperform other baselines which has longer input length (1024). \textsc{CoLo}$_{Abs}$ has an improvement of \textbf{2.17} R-1 socre on the very strong BART-large baseline without adding additional parameters or modules. Additionally, our method is able to outperform all one-stage baseline systems by a large margin. We also conduct experiments on long document summarzation datasets (see in Table~\ref{tab:abs_long} in Appendix). \renewcommand\arraystretch{1.3} \begin{table}[t] \center \footnotesize \tabcolsep0.07in \setlength{\tabcolsep}{0.75mm}{ \begin{tabular}{lccc} \toprule {\textbf{Model}} & \textbf{R-1} & \textbf{R-2} & \textbf{R-L} \\ \midrule {BertSumAbs}\cite{liu2019text} & 41.72 &19.39 &38.76 \\ Pegasus\cite{zhang2020pegasus} & 44.17 & 21.47& 41.11 \\ BART\cite{lewis2020bart} & 44.16 & 21.28& 40.90 \\ BART+R3F\cite{aghajanyan2020better} & {44.38} & {21.53} & {41.17} \\ BART ($len=512$) & 43.82 & 20.96 & 40.63 \\ \midrule ConSum~\cite{sun2021alleviating} & 44.53 & 21.54 & 41.57 \\ SeqCo~\cite{xu2021sequence} &\underline{45.02} & \underline{21.80} & \underline{41.75}\\ \midrule Naive one-stage (ROUGE, $len=512$) & 43.90 & 20.88 & 40.69 \\ \textsc{CoLo}$_{Abs}$ (ROUGE, $len=512$)& 45.45 & 21.53 & 42.35 \\ \textsc{CoLo}$_{Abs}$(ROUGE) & \textbf{46.33} & \textbf{22.15} & \textbf{43.08} \\ \bottomrule \end{tabular}} \caption{Abstractive results on CNN/DM test set. $len$ means the maximum input length of the encoder, results without the marker using 1024 tokens as the input. ConSum~\cite{sun2021alleviating} and SeqCo~\cite{xu2021sequence} in the second block are also previous contrastive learning based methods without re-ranking. } \label{table:abs_cnndm} \end{table} \subsection{Comparison with Multi-stage Systems}\label{sec:effi} Apart from the one-stage systems, we also compare our model with these powerful multi-stage systems: CTRLSum, multi-stage re-ranking models. CTRLSum needs other systems to previously produce a control signal. \renewcommand\arraystretch{1.2} \begin{table}[t] \center \footnotesize \setlength{\tabcolsep}{0.5mm}{ \begin{tabular}{lccc} \toprule {\textbf{Model}} & \textbf{R-1} & \textbf{R-2} & \textbf{R-L} \\ \midrule \multicolumn{4}{c}{\textit{extractive systems}} \\ \midrule \textsc{CoLo}$_{Ext}$ & 44.27 & 21.01 & 40.34 \\ BERT+BERT$^\mathcal{R}$~\cite{DBLP:conf/acl/ZhongLCWQH20} & 44.22 & 20.62 & 40.38 \\ BERT+RoBERTa$^\mathcal{R}$ ~\cite{DBLP:conf/acl/ZhongLCWQH20} & 44.41 & 20.86 & 40.55\\ \textsc{CoLo}$_{Ext}$ +RoBERTa$^\mathcal{R}$ & \textbf{44.70} & \textbf{21.03} & \textbf{40.74}\\ \midrule \multicolumn{4}{c}{\textit{abstractive systems}} \\ \midrule \textsc{CoLo}$_{Abs}$ & 46.33 & 22.15 & 43.08 \\ {CTRLSum}\cite{he2020ctrlsum} & 45.65 & \textbf{22.35} & 42.50\\ BART+RoBERTa$^\mathcal{R}$~\cite{liu2021simcls} & \textbf{46.67} & 22.15 & \textbf{43.54} \\ \bottomrule \end{tabular}} \caption{ Comparision with the multi-stage systems. RoBERTa$^\mathcal{R}$ means a RoBERTa re-ranker is is added to the summarization model. } \label{table:multi-stage} \end{table} \paragraph{performance} The addition of another pre-trained model implicitly introduces more parameters and knowledge, thus it is usually unfair to directly compare one-stage systems with the two-stage systems. But we show that \textsc{CoLo} is able to achieve comparable performance with the multi-stage systems. As is shown in the first part of Table~\ref{table:multi-stage}, compared with the multi-stage models that ensembles another pre-trained encoder as a re-ranker, \textsc{CoLo}$_{Ext}$ still performs better than their BERT+BERT$^\mathcal{R}$ version without the need to re-feed the generated candidates to another model meanwhile we obtain a \textasciitilde$\times 5$ speed up over the multi-stage systems. We also try concatenating a re-ranker RoBERTa for our model, results shows that \textsc{CoLo}$_{Ext}$ can be further improved by combing another pre-trained re-ranker reaching new extractive SOTA on the test set of CNN/DM. For abstractive models, our end-to-end model still legs behind multi-stage systems but we do not need training another model and keep similar inference speed with baseline models. \paragraph{Inference Efficiency} Despite the fact that multi-stage models outperform all end-to-end systems, they frequently suffer from inefficiency. In this part we mainly focus on analysing the efficiency of 3 kinds of systems: 1) baseline, which is trained only with BCELoss or NLLLoss, 2) \textsc{CoLo}, our end-to-end constrastive learning framework, 3) Rerank, which means the multi-stage re-ranking systems. it has more 110M parameters than baseline model and \textsc{CoLo}. The efficiency experiments for training and inference are respectively conducted on 24G RTX 3090 GPUs and 12G TITAN XP GPUs. For extractve summarization, figures~\ref{fig:cnn1},\ref{fig:cnnm} give a detailed comparison of the inference speed between the three models. Y-axis represents the number of samples processed per second. To give a fair comparison, we test the inference efficiency in two settings: i) all models are tested with batch size fixed to 1. ii) all models are tested with the maximum batch size allowed by the GPU. While the candidate size varies from 4$\sim$32, both our model have a $\mathbf{3\times \sim 8\times}$ speed-up ratio over the multi-stage re-ranking model. When the candidate size is set to 20, the baseline model is able to process \textasciitilde31.2/41.9 (batch = 1/\textit{MAX}) samples per second, the decoding speed of \textsc{CoLo}$_{Ext}$ is \textasciitilde30.4/38.9 samples/s (batch=1/\textit{MAX}) and the decoding speed of the multi-stage re-ranking model is only \textasciitilde4.9/7.0 samples/s(batch=1/\textit{MAX}). Our model almost does no harm on inference speed while the candidate size $|\mathcal{C}|$ is less than 16. However, when the candidate size grows larger there is more time spent on generating the representations of the candidates. Figure~\ref{fig:abs_time} show the comparison of inference time of the abstractive models. While the bottleneck of abstractive models is the auto-regressive generation process. Our abstractive model generally save \textasciitilde0.5 GPU hours compared to the re-ranking model. \begin{figure}[ht!] \centering \subfigure[CNN/DM (batch=1)]{ \label{fig:cnn1} \includegraphics[width=0.22\textwidth]{figures/cnndm_time.pdf} } \subfigure[CNN/DM (batch =\textit{MAX})]{ \label{fig:cnnm} \includegraphics[width=0.22\textwidth]{figures/cnndm_full_time.pdf} } \caption{Inference speed on CNN/DM (extractive). we use the candidate size $|\mathcal{C}|$ as the X-axis. The Y-axis represents the number of samples processed per second. batch=\textit{{MAX}} means we use the maximum batch size allowed by GPU memory. } \label{fig:decoding_time} \end{figure} \begin{table}[t]\footnotesize\setlength{ \tabcolsep}{1.5pt} \centering \begin{tabular}{lcccc} \toprule \textbf{Systems} &\textbf{Stage1} & \textbf{Preprocess} & \textbf{Stage2} & \textbf{Total hours}\\ \midrule Ext+RoBERTa$^\mathcal{R}$ & 4 & 5 (+20) & 128 & 137 (+20) \\ \textsc{CoLo}$_{Ext}$ & 7 & -- & -- & 7 ($\downarrow\mathbf{130}$) \\ \midrule Abs+RoBERTa$^\mathcal{R}$ & 80 & 132 (+18) & 128 & 340 (+18) \\ \textsc{CoLo}$_{Abs}$ & 224 & -- & -- & 224 ($\downarrow\mathbf{116}$) \\ \bottomrule \end{tabular}% \caption{ GPU hours spent on training for each process on the training set of CNN/DM(reported results are rounded down after the decimal point. Ext+RoBERTa$^\mathcal{R}$/Abs+RoBERTa$^\mathcal{R}$ denotes the multi-stage re-ranking systems with an extracitve/abstrastive summarizer. (+18)/(+20) means 18/20 CPU hours are spent on calculate ROUGE score for each candidate with 32 threads. } \label{tab:training effi} \end{table} \paragraph{Training Efficiency} Table~\ref{tab:training effi} gives an overview of the training time of our system and the multi-stage models on the training set of CNN/DM. The general pipeline for the multi-stage models is: i) training a generator {(Stage1)}, ii) {Preprocess}, ii) training a re-ranker (Stage2). The preprocess includes generating the training/dev/test set for training re-ranker and sorting candidates by ROUGE. For extractive system we save \textbf{130} GPU hours compared to the multi-stage systems whose bottleneck is training the re-ranking model. For abstractive model, apart from the 128 GPU hours spent on training the ranker, using beam search to generate the training set for re-ranker model is also very time consuming, generally we obtain \textbf{116} GPU hours and 18 CPU hours saved. \begin{figure}[t] \centering \includegraphics[width=0.7\linewidth]{figures/abs_time.pdf} \caption{ Test inference time with beam size for abstractive model. We use the maximum batch size allowed by GPU memory. } \label{fig:abs_time} \end{figure} \subsection{Ablation for Different Discriminators} In addition to ROUGE, we also select other metrics as the discriminator (shown in Table~\ref{table:cmp_metrics}). ROUGE and JS-2 is based on lexical matching while BERTScore and MoverScore are based on the contextualized embedding from BERT. Our model generally obtains the best results on the metric used in training. Because these metrics are not actually separated, using one of these metrics as the discriminator can also gain significant improvements on other metrics. Overall, the neural evaluation metric BERTScore and MoverScore bring more improvements compared with metrics that based on the lexical matching. But incorporating neural model based metrics in training will obviously increase the training time. \renewcommand\arraystretch{1.2} \begin{table}[t] \center \footnotesize \tabcolsep0.07in \setlength{\tabcolsep}{1.2mm}{ \begin{tabular}{lcccccc} \toprule {\textbf{Metric Used}} & \textbf{R-1} & \textbf{R-2} & \textbf{R-L}& \textbf{JS-2} & \textbf{BS} & \textbf{MS} \\ \midrule Baseline & 42.78 & 20.24 & 39.23 & 54.24 & 43.52 & 58.27 \\ ROUGE-1,2 & \cellcolor[gray]{0.9} 44.10 & \cellcolor[gray]{0.9} 20.97 & 40.19 & 54.07 & 44.26 & 58.63 \\ ROUGE-L & 44.09 & 20.93 & \cellcolor[gray]{0.9} \bf40.34 & 54.06 & 44.32 & 58.60 \\ JS-2 & 43.85 & \textbf{21.13} & 39.98 & \cellcolor[gray]{0.9} \textbf{53.92} & 44.19 & 58.60 \\ BERTScore & \textbf{44.27} & 21.01 & \textbf{40.34} & 54.08 & \cellcolor[gray]{0.9}\textbf{44.85} & 58.71 \\ MoverScore & 44.21 & 20.81 & 40.25 & 54.33 & 44.47 & \cellcolor[gray]{0.9}\textbf{58.78} \\ \bottomrule \end{tabular}} \caption{Extractive results of using different evaluation metrics as the discriminator on CNN/DM test set. } \label{table:cmp_metrics} \end{table} \subsection{Visualization Experiment} We conduct a visualization experiment on our extractive model to get a close look on the distribution of candidates in semantic space. We randomly sample 100 documents with more than 10 sentences from the test set of CNN/DM. We first select the top 10 sentences based on the predicted score from the classifier. We set the possible number of sentences to $\{2, 3\}$ resulting a candidate size of $C_{10}^2 + C_{10}^3 = 165$ for each sample. We visualize the learned embedding of these candidates and the anchor in a two-dimensional space by applying the t-SNE algorithm. As shown in Figure~\ref{fig:viz}, there is an obvious cluster of the top 50 candidates (colored in purple) and the candidates with higher score are closer to the anchor while the distribution of uninformative candidates (gray,cyan points) is relatively random. \begin{figure}[ht!] \centering \subfigure{ \includegraphics[width=0.225\textwidth]{figures/case1.png} } \subfigure{ \includegraphics[width=0.225\textwidth]{figures/case2.png} } \caption{T-SNE Visualization of two examples from CNN/DM test set. We divide the candidates into 3 groups based on ROUGE score: candidates ranking 1\textasciitilde50, candidates ranking 51\textasciitilde100, candidate ranking 101\textasciitilde150. The red point denotes the anchor and the purple/cyan/gray points respectively denote the top 50/100/150 candidates.} \label{fig:viz} \end{figure} \subsection{Human Evaluation}\label{human_eval} We also conduct a human evaluation on our models to get more accurate results . We randomly select 30 articles from the test set of CNN/DM, and each articles have 5 candidate summaries 4 from automatic systems and 1 is the gold reference. We recruit 2 PhD students majoring in computer science and ask them to rank the candidate summries based on the fluency, informativeness. If two of these systems generate the same summary for the source document, this sample will be filtered out. As we can see from Table~\ref{tab:human_evaluation}, the \textsc{CoLo}$_{Ext}$ with the discriminator as BERTScore achieve the best result among all automatic systems. However, using BERTScore will bring much training time. We also suggest taking JS-2 divergence as the discriminator which also does a good job in human evaluation. \renewcommand\arraystretch{1.2} \begin{table}[!ht] \center \footnotesize \tabcolsep0.05in \setlength{\tabcolsep}{0.9mm}{ \begin{tabular}{lcccccc} \toprule \textbf{Metric Used} & \textbf{1st} & \textbf{2nd} & \textbf{3rd} & \textbf{4th} & \textbf{5th} & \textbf{Avg R.} \\ \midrule Baseline & 0\% & 8.3\%& 8.3\% & 23.3\% & 60\% & 4.33\\ JS2 & 6.7\% & 25\% & 33.3\%& 21.7\% & 13.3\% & 3.10\\ R1+R2 & 5\% & 20\% & 28.3\% & 30.3\% & 16.7\% & 3.35\\ BERTScore & 10\% & 35\% & 20\%& 25\% & 10\% & 2.90\\ Gold label & 78.3\% & 11.7\% & 10\% & 0\% & 0\% & 1.32\\ \bottomrule \end{tabular}} \caption{ Results of human evaluation results. Baseline means the \textsc{BartExt} model, Gold-label means the means the human written summary. Avg R. denotes the average ranking of the system. } \label{tab:human_evaluation} \end{table} \section{Limitations and Future Work} Compared with the most well-known contrastive learning framework simCLR~\cite{chen2020simple} which propose to construct positive and negative pairs from training samples in the same batch, Drawing negative-positive pairs from the summarization model requires more training time. Ideally, providing more positive and negative samples will benefit the performance of \textsc{CoLo} . However, decoding with very large beam size in training mode will cost more GPU memory and training time. Future work can search for an efficient way to construct these positive-negative pairs to perform re-ranking during training. \section{Conclusion} We introduce \textsc{CoLo}, a contrastive learning based summarization framework for one-stage summarization where positive-negative pairs are generated directly from the summaizer with online sampling. \textsc{CoLo} can be both easily applied on extractive and abstractive methods. Results show that we greatly exceed previous stage-of-the art one-stage systems with no additional parameters and obivious decline of the inference efficiency. \section*{Acknowledgement} We would like to thank Yixin Liu and the anonymous reviewers for their valuable advice. This work was supported by the National Key Research and Development Program of China (No.2020AAA0106702) and National Natural Science Foundation of China (No.62022027).
{'timestamp': '2022-09-30T02:08:05', 'yymm': '2209', 'arxiv_id': '2209.14569', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14569'}
arxiv
\section{INTRODUCTION} The ability to detect dynamic and stationary obstacles (e.g., cars, trucks, pedestrians, bicycles, hazards) is critical for autonomous vehicles. This is particularly important in semi-urban and urban settings characterized by complex scenes with large amounts of occlusion and varieties of shapes. Previous perception methods rely heavily on utilizing cameras~\cite{liftsplatshoot}~\cite{cameraCenternet}\cite{camera10d} or LiDARs~\cite{mvLidarNet}~\cite{hendy2020fishing}~\cite{fastFurious}~\cite{2018pixor} to detect obstacles. These methods have a number of drawbacks: they are unreliable in cases of heavy occlusions, the sensors may be prohibitively expensive, they can be unreliable in adverse weather conditions~\cite{lidarFog} or at night. Traditional RADAR based obstacle detection methods work well in detecting moving objects that have good reflection properties, but often struggle when estimating object dimensions and orientations and often completely fail in detecting stationary objects or objects with poor RADAR reflectivity. In this paper, we present a deep neural network (DNN) that detects moving and stationary obstacles, computes their orientation and size, and detects drivable free space from RADAR data alone. We do this in top-down bird's-eye view (BEV) for highway and urban scenarios while using readily available automotive RADARs. Our method relies on RADAR peak detections alone~\cite{classicalRadar2dFFT}~\cite{classicalRadarDopplerFFT} since automotive RADAR firmware provides only this data. In contrast, other approaches~\cite{azimuthRangeTensor}~\cite{probOrientedRadar}, require expensive Fast Fourier Transformation operations on the raw RADAR data cube cross-sections that are not available in most commercial automotive sensors. Our deep learning approach is able to accurately distinguish between stationary obstacles, such as cars, versus stationary background noise. This is important when navigating in a cluttered urban environment. In addition, our approach allows us to regress the dimensions and orientations of these obstacles, which classical methods cannot provide. Our DNN can even detect obstacles with poor reflectivity like pedestrians. Finally, our method provides an occupancy probability map to mark unclassified obstacles and regresses drivable free space. We have tested our NVRadarNet DNN in real-world autonomous driving on our vehicles running NVIDIA DRIVE AGX's embedded GPU. Our DNN runs \emph{faster than real-time} at \textbf{1.5~ms} end-to-end and provides sufficient time for the planner to react safely. Our contributions are as follows: \begin{itemize} \item NVRadarNet: A first of its kind multi-class deep neural network that detects dynamic and stationary obstacles end-to-end without post-processing in a top-down bird's-eye view (BEV) using only peak detections coming from automotive RADARs; \item A novel semi-supervised drivable free space detection method using only RADAR peak detections; \item A DNN architecture that runs \emph{faster than real-time} at \textbf{1.5~ms} end-to-end on an embedded GPU. \end{itemize} \section{PREVIOUS WORK} \textbf{Obstacle Detection.} Fast and efficient obstacle perception is a core component of a self-driving vehicle. Automotive RADAR sensors provide a cost-efficient way of obtaining rich 3D positioning and velocity information and are widely available on most modern cars. Several recent papers examined the use of the dense RADAR data cubes in order to perform obstacle detection~\cite{azimuthRangeTensor}~\cite{probOrientedRadar}. However, these methods require high input/output bandwidth to obtain such rich data. This makes them impractical for real-world autonomous vehicles. Thus, most classical methods in automotive RADAR applications utilize post-processed peak detections from the data cube in order to perform classification and occupancy grid detection~\cite{radarClassicalBerha}~\cite{radarClassicalEnsamble}~\cite{occupancySemanticGridBMW}. Others realized that the RADAR peak detections can be viewed as a sparse 3D point cloud and therefore can be used in sensor fusion along with 3D LiDAR points in approaches similar to LiDAR DNNs~\cite{mvLidarNet}~\cite{4DNet}~\cite{radarNet2020}~\cite{hendy2020fishing}~\cite{liraNet}. There were attempts to enhance camera 3D obstacle detection by fusing it with RADAR as well~\cite{centerNetCameraRadarFusion}. \textbf{Free Space Detection.} RADAR-based drivable free space estimation has been attempted in~\cite{ism} and~\cite{occupancyISM2019}. Our DNN performs multi-class detection of dynamic and static obstacles together with the segmentation of drivable free space by using RADAR peak detections alone. Our DNN architecture is lightweight and runs \emph{faster than real-time} at \textbf{1.5~ms} end-to-end on an embedded GPU (on NVIDIA DRIVE AGX). It has been proven to be robust in real-world driving and was tested on over $10000$~km of highway and urban roads as part of our autonomous stack. To date, we are not aware of any RADAR peak detections only DNN that can perform all of these tasks and can run efficiently on autonomous vehicles. \section{METHOD} \subsection{Input Generation} The input to our network is a top-down BEV orthographic projection of accumulated RADAR detections peaks around our ego-vehicle, which is placed at the center of this top-down bird's-eye view (BEV) with its front facing right. To compute this input, we first accumulate RADAR peak detections across all RADAR sensors on our vehicle (8 radars covering 360 degrees field of view) and then transform them to our ego-vehicle rig coordinate system. We also accumulate these peak detections temporally over $0.5$~seconds in order to increase the density of the signal. Each data point gets a relative timestamp to indicate its age, similar to~\cite{4DNet}. Next, we perform ego-motion compensation for the accumulated detections to the latest known vehicle position. We propagate the older points using the known ego-motion of our vehicle to estimate where they will be at at the time of DNN inference (current time). Next, we project each accumulated detection to a top-down BEV grid using the desired space quantization to create an input tensor for our DNN. We set our input resolution to 800$\times$800 pixels with $\pm$ $100$~m range in each direction, resulting in $25$~cm per pixel resolution. Each valid BEV pixel (with data) gets a set of features in its depth channel computed by averaging the raw signal features of the RADAR detections that land in that pixel. Our final input for time $t$ is a tensor $I_t \in \R^{h \times w \times 5}$ where $h=800, w=800$ are height and width of a top-down view. The 5 RADAR features in the depth channel are the averages of: Doppler, elevation angle, RADAR cross section (\textit{RCS}), azimuth angle and the relative detection timestamp. We normalize these values to a $[0,1]$ range for training stability using maximum and minimum values provided by the hardware specifications. The resulting tensor is used as input to our network. \subsection{Label Propagation}\label{label_propogation} We use LiDAR-based human-annotated bounding box labels as the ground truth for training our RADAR DNN. These labels are created for LiDAR data for the same scene on which we train our RADAR DNN. Given how sparse the RADAR signal is, it is practically impossible for humans to distinguish vehicles using RADAR points alone even in top-down BEV view. Hence, we rely on LiDAR to label training data. We capture both LiDAR and RADAR data at different frequencies and select the data closest in time for processing. We then create a top-down BEV projection of the LiDAR scene for humans to annotate objects with bounding box labels and free space with polylines. For each labeled LiDAR BEV frame, we compute the closest accumulated RADAR BEV image via the pre-processing method described above and then transfer the labels to the RADAR top-down view. We further clean up the the ground truth by removing any vehicle labels that contain fewer than $4$ RADAR detections, which empirically demonstrated to increase the network accuracy. Finally, we remove any detections with an \textit{RCS} below $-40$~dBm as we empirically determined that they introduce more noise than signal. An example can be seen in Fig.~\ref{fig:lidar_to_radar}. \begin{figure} \centering \begin{subfigure}{1\linewidth} \includegraphics[width=1.0\linewidth]{radarnet_images/lidar_to_radar.png} \end{subfigure} \caption{Propagating bounding box labels for cars from LiDAR domain to RADAR domain.} \label{fig:lidar_to_radar} \vspace{-2mm} \end{figure} \subsection{Free Space Label Generation} \begin{figure} \centering \begin{subfigure}{1\linewidth} \includegraphics[width=1.0\linewidth]{radarnet_images/radarnet_freespace_labels.png} \end{subfigure} \caption{Visual representation of the free space target: observed and free in black, observed and occupied in white, unobserved in light gray and partially observed in dark gray.} \label{fig:freespace_labels} \vspace{-6mm} \end{figure} The free space target is generated by using the raw LiDAR point cloud. First, we pre-process the point cloud by identifying and removing the points belonging to the drivable surface itself by using surface slope angle estimation of adjacent LiDAR scan lines. We then overlay manually obtained LiDAR free space labels to further clean up this estimate. Next, a set of rays is traced from the ego-vehicle's origin in all angular directions, enabling us to reason about which regions are: \begin{itemize} \item Observed and free. \item Observed and occupied. \item Unobserved. \item Partially observed. \end{itemize} Finally, we overlay our existing 3D obstacle labels on top of the automatically derived occupancy. We explicitly mark obstacles as observed and occupied. See Fig.~\ref{fig:freespace_labels}. \subsection{Dataset}\label{dataset} Our model is trained on a diverse internal dataset with over 300k training frames and over 70k validation frames sampled from hundreds of hours of driving in several geographic regions. The dataset includes a combination of urban and highway data and contains synchronized LiDAR, RADAR and IMU readings. The labels are human annotated and include vehicles, cyclists, pedestrians and drivable free space. \subsection{Network Architecture} \begin{figure} \centering \begin{subfigure}{1\linewidth} \includegraphics[width=1.0\linewidth]{radarnet_images/freespace_inferred_head.png} \end{subfigure} \caption{Inferred dense occupancy probability map showing probabilities from low in dark to high probability in gradients from red to yellow (highest).} \label{fig:occupancy_map} \vspace{-4mm} \end{figure} \begin{figure*} \centering \begin{subfigure}{0.7\linewidth} \includegraphics[width=1\linewidth]{radarnet_images/NVRadarNet_arch.png} \end{subfigure} \caption{Network architecture. Our network uses CNN for the encoder and decoder with skip connections. The network has three heads: a classification head (produces detection probabilities), a shape regression head (produces bounding box parameters) and a free space segmentation head.} \label{fig:network_diagram} \end{figure*} \begin{table} \caption{Network architecture for NVRadarNet} \begin{center} \begin{minipage}[t]{.95\linewidth} \resizebox{\linewidth}{!}{ \begin{tabular}{l|l|l|l} \textbf{Layer} & \textbf{Layer description} & \textbf{Input} & \textbf{Output dimensions} \\ \hline \hline \multicolumn{3}{c}{\textbf{Inputs:}} \\ input & \emph{Input RADAR data} & -- & $ 5 \times 800 \times 800$ \\ \hline \multicolumn{3}{c}{\textbf{Encoder:}} \\ \hline 1 & conv $(7 \times 7), ReLU $ & input & $ 64 \times 400 \times 400 $ \\ 2a & conv $(3 \times 3), ReLU $ & 1 & $ 64 \times 200 \times 200 $ \\ 2b & conv $(3 \times 3), ReLU $ & 2a & $ 64 \times 200 \times 200 $ \\ 3a & conv $(3 \times 3), ReLU $ & 2b & $ 64 \times 200 \times 200 $ \\ 3b & conv $(3 \times 3), ReLU $ & 3a & $ 64 \times 200 \times 200 $ \\ 4a & conv $(3 \times 3), ReLU $ & 3b & $ 128 \times 100 \times 100 $ \\ 4b & conv $(3 \times 3), ReLU $ & 4a & $ 128 \times 100 \times 100 $ \\ 4c & conv $(3 \times 3), ReLU $ & 4b & $ 128 \times 100 \times 100 $ \\ 4d & conv $(3 \times 3), ReLU $ & 4c & $ 128 \times 100 \times 100 $ \\ 5a & conv $(3 \times 3), ReLU $ & 4d & $ 256 \times 50 \times 50 $ \\ 5b & conv $(3 \times 3), ReLU $ & 5a & $ 256 \times 50 \times 50 $ \\ 5c & conv $(3 \times 3), ReLU $ & 5b & $ 256 \times 50 \times 50 $ \\ 5d & conv $(3 \times 3), ReLU $ & 5c & $ 256 \times 50 \times 50 $ \\ 6a & conv $(3 \times 3), ReLU $ & 5d & $ 512 \times 50 \times 50 $ \\ 6b & conv $(3 \times 3), ReLU $ & 6a & $ 512 \times 50 \times 50 $ \\ 6c & conv $(3 \times 3), ReLU $ & 6b & $ 512 \times 50 \times 50 $ \\ 6d & conv $(3 \times 3), ReLU $ & 6c & $ 512 \times 50 \times 50 $ \\ \hline \multicolumn{3}{c}{\textbf{Decoder:}} \\ \hline freespace\textunderscore output & deconv $(4 \times 4), {ReLU} $ & 6d & $ 2 \times 400 \times 400 $ \\ \hline regression\textunderscore output & deconv $(4 \times 4), {ReLU} $ & 6d & $ 6 \times 200 \times 200 $ \\ \hline class\textunderscore output & deconv $(4 \times 4), {ReLU} $ & 6d & $ 4 \times 200 \times 200 $ \end{tabular} }\end{minipage} \end{center} \label{tab:network_arch} \vspace{-4mm} \end{table} We use a DNN architecture similar to Feature Pyramid Network~\cite{fpn}. Our DNN consists of encoder and decoder components and several heads for predicting different outputs. See Fig.~\ref{fig:network_diagram} for high-level structure and Table~\ref{tab:network_arch} for details. Our encoder starts with a \textit{2D convolutional layer} with $64$ filters, stride 2 and $7\times7$ kernels. It is followed by $4$ blocks of $4$ layers each, where each block increases the number of filters by two, while dividing the resolution in half. Each layer in the block contains a \textit{2D convolution} with \textit{batch normalization} and \textit{ReLU activation}. The decoder consists of one \textit{transposed 2D convolution} with stride $4$ and $4\times4$ kernels per head. We also experimented with using two \textit{transposed 2D convolutions} with a skip connection in the middle. The resulting output tensor is at $1/4$ of the spatial resolution of the input. We use the following heads in our network: \begin{itemize} \item \textbf{Class segmentation head} predicts a multi-channel tensor, one channel per class. Each value contains a confidence indicating that a given pixel belongs to a class corresponding to its channel. \item \textbf{Instance regression head} predicts oriented bounding boxes for an object using an $n_r$ ($n_r = 6$) channels of information for each predicted pixel. The $n_r$ element vectors contains: [$\delta_x$, $\delta_y$, $w_0$, $l_0$, $\sin\theta$, $\cos\theta$], where ($\delta_x$, $\delta_y$) points toward the centroid of the corresponding object, $w_0$ $\times$ $l_0$ are the object dimensions, and $\theta$ is the orientation in the top-down BEV. \item \textbf{Inverse sensor model head} (ISM) computes a map of occupancy probabilities for each grid cell~\cite{ism}. \end{itemize} \subsection{Loss} Our loss consists of a standard cross-entropy loss for the classification head, with a larger weight emphasis on the minority classes, $L_1$ loss for instance bounding box regression, and the inverse sensor model loss for free space detection~\cite{ism}. We combine these losses using Bayesian learned weights by modeling each task weight as a homoscedastic task-dependent uncertainty following the method described in \cite{multiTaskLearning}. This approach allows us to efficiently co-train these three diverse tasks without affecting the overall model accuracy. The total loss is defined as: \begin{align} \textit{TotalLoss} = \sum_{i=0}^{K-1} L_i w_i + \mu_w \end{align} where $K$ is the number of tasks/heads, $L_i$ is a loss for task $i$, $w_i$ = $e^{-\delta_i}$, $\delta_i$ is a learned log variance parameter per task, and $\mu_w$ is the mean of $w_i$ weights. \subsection{End-to-end Obstacle Detection} In order to avoid expensive non-maximum suppression (NMS) or clustering at post-processing (e.g. DBSCAN), we employ an end-to-end approach by classifying a single pixel per obstacle, as inspired by OneNet~\cite{oneNet}. First we compute the $L_1$ loss for the regression head and the pixel-wise classification loss for the classification head. Next, for each target obstacle, we select the foreground pixel with the lowest total loss between $(\textit{ClassWeight} * \textit{ClassLossPerPixel}) + \textit{RegressionLossPerPixel}$. This pixel is then selected for the final loss computation while the rest of the foreground pixels are ignored. The losses from the background pixels are then selectively used by utilizing hard negative mining. Finally, we perform batch normalization by dividing the total cross-entropy loss by the number of positive pixels selected during the above process. The regression losses are computed only for the selected positive pixels. At inference time we simply pick all of the candidate pixels above a certain threshold in the classification head, per class. The obstacle dimensions are picked directly from the regression head for each corresponding threshold candidate. By using this technique our network is able to directly output the final obstacle without expensive post-processing. \subsection{Converting ISM Head Output to a Radial Distance Map} Autonomous vehicle applications often represent drivable free space area by its boundary contour. In this sections we describe how to convert the boundary contour to a \textit{radial distance map} (RDM) if needed. The RDM assigns a set of angular directions $\phi_{f}$, in the top-down BEV view around the ego-vehicle, to the distance $d_{f}$ between a reference point $\vec{p}_{ref}$ on the ego-vehicle and the drivable free space boundary. To compute the RDM, we first re-sample the dense occupancy probability map (DNN output) into a polar coordinate system centered around the reference point $\vec{p}_{ref}$. By employing a nearest-neighbour interpolation schema, the re-sampling process can be expressed in terms of an indexing operation. This assigns the value of each pixel $(\phi_{f},d_{f})$ of the polar representation the value of a single pixel of the predicted dense occupancy probability map. Since this mapping only depends on the dimensions of the occupancy map and the position of reference point $\vec{p}_{ref}$, all required indices can be calculated offline and stored in a lookup table. Fig.~\ref{fig:occupancy_map_polar} shows the occupancy probability map. Fig.~\ref{fig:occupancy_map} shows it re-sampled in polar coordinates. After re-sampling, the distance $d_{f}$ for each angular direction $\phi_{f}$ is determined by finding the first pixel along each angular axis, where the occupancy probability reaches some threshold $p_{occ}$. Fig.~\ref{fig:drivable_freespace_boundary} shows the RDM representation of the drivable free space boundary derived by this procedure from the dense occupancy probability map shown in Fig.~\ref{fig:occupancy_map}. \begin{figure} \centering \begin{subfigure}{1\linewidth} \includegraphics[width=1.0\linewidth]{radarnet_images/occupancy_map_polar.png} \end{subfigure} \caption{Predicted dense occupancy map re-sampled into the polar coordinate system centered around the reference point $\vec{p}_{ref}$. Gradient colors from red (low) to yellow (high) show probabilities.} \label{fig:occupancy_map_polar} \end{figure} \begin{figure} \vspace{-4mm} \centering \begin{subfigure}{1\linewidth} \includegraphics[width=1.0\linewidth]{radarnet_images/rdm.png} \end{subfigure} \caption{Radial distance map representation of the drivable free space boundary extracted from the predicted dense occupancy probability map.} \label{fig:drivable_freespace_boundary} \vspace{-2mm} \end{figure} \section{EXPERIMENTS} \subsection{Internal Dataset Experiments} Datasets, benchmarks and published DNNs dedicated to RADAR based obstacle and freespace detection are limited at this time which presents difficulty when evaluating. See Table~\ref{tab:radarmethods} for a list of available methods and their features. The closest works ~\cite{radarNet2020}~\cite{hendy2020fishing}~\cite{centerNetCameraRadarFusion}~\cite{liraNet} use sensor fusion and do not share RADAR only results publicly. Thus, to the best of our knowledge we are setting a baseline for obstacle detection, classification and freespace regression using RADAR peaks alone. Detection of pedestrians and cyclists is a big challenge due to the sparsity of the RADAR signal. \begin{table} \caption{Related RADAR detection methods. Our method (in bold) uses only RADAR data, supports object and free space detection and we provide public results.} \begin{center} \begin{tabular}{l|l|l|l|l} \textbf{Method}&\textbf{Radar Only}&\textbf{Public}&\textbf{Objects}&\textbf{Freespace}\\ \hline \hline RadarNet\cite{radarNet2020} & \ding{55} & \checkmark & \checkmark & \ding{55} \\ FishingNet\cite{hendy2020fishing} & \ding{55} & \checkmark & \checkmark & \ding{55} \\ LiRaNet\cite{liraNet} & \ding{55} & \checkmark & \checkmark & \ding{55} \\ RADModel\cite{azimuthRangeTensor} & \checkmark & \ding{55} & \checkmark & \ding{55} \\ XSense\cite{probOrientedRadar} & \checkmark & \ding{55} & \checkmark & \ding{55} \\ OccupancyNet\cite{occupancyISM2019} & \checkmark & \checkmark & \ding{55} & \checkmark \\ \textbf{Ours} & \textbf{\checkmark} & \textbf{\checkmark} & \textbf{\checkmark} & \textbf{\checkmark} \\ \end{tabular} \end{center} \label{tab:radarmethods} \vspace{-4mm} \end{table} We evaluated our DNN on our internal NVIDIA's RADAR dataset as well as on the nuScenes public dataset. We also compared our DNN to other published works as much as was practically possible and list all results in this section. For our internal NVIDIA's RADAR dataset, we used held out test data mentioned in section~\ref{dataset} for evaluation. It is important to note that, even after filtering out the ground truth bounding boxes, which contain too few RADAR peak detections (as described in section~\ref{label_propogation}), we still end up with noisy ground truth labels. For example, there are many instances where vehicles are occluded by other vehicles and so human labelers are not able to create good ground truth from LiDAR data alone. In such cases, RADAR still produces valid returns and some obstacles are correctly classified by our DNN, but they are marked as false positives at evaluation due to ground truth shortcomings. This lowers our precision. Also, LiDAR sensor is mounted higher on the vehicle (roof) than RADAR sensors (bumpers) and therefore some obstacles may be visible by LiDAR and have limited RADAR visibility which leads to noisy RADAR data and labels. This results in false negatives and lowers our recall. Our results for the object detection task can be seen in Tables~\ref{tab:internal_results_800},~\ref{tab:internal_mAP}. The metrics for the free space detection task (Table~\ref{tab:internal_freespace}) are calculated for the free space region and the free space RDM independently. The free space region is defined by an occupancy probability $p_{o} < 0.4$. \begin{table} \begin{threeparttable}[b] \caption{Our DNN's obstacle detection accuracy on the internal NVIDIA dataset by class and range.} \begin{center} \begin{tabular}{l|l|l|l} \textbf{Class} & \textbf{Range} & \textbf{F-score, small res.}\tnote{1} & \textbf{F-score, large res.}\tnote{2} \\ \hline \hline vehicles & 0 -- 10 m & 0.728 & 0.770 \\ vehicles & 10 -- 25 m & 0.608 & 0.628 \\ vehicles & 25 -- 40 m & 0.728 & 0.485 \\ vehicles & 40 -- 70 m & 0.327 & 0.319 \\ vehicles & 70 -- 100 m & 0.225 & 0.216 \\ \hline pedestrians & 0 -- 10 m & 0.197 & 0.248 \\ pedestrians & 10 -- 25 m & 0.204 & 0.24 \\ pedestrians & 25 -- 40 m & 0.145 & 0.174 \\ pedestrians & 40 -- 70 m & 0.084 & 0.113 \\ pedestrians & 70 -- 100 m & 0.040 & 0.062 \\ \hline cyclists & 0 -- 10 m & 0.145 & 0.264 \\ cyclists & 10 -- 25 m & 0.125 & 0.257 \\ cyclists & 25 -- 40 m & 0.085 & 0.192 \\ cyclists & 40 -- 70 m & 0.064 & 0.137 \\ cyclists & 70 -- 100 m & 0.065 & 0.114 \\ \end{tabular} \begin{tablenotes} \item [1] Input resolution: $800 \times 800 \times 5$. \item [2] Input resolution: $1024 \times 1024 \times 5$. \end{tablenotes} \end{center} \label{tab:internal_results_800} \end{threeparttable} \vspace{-6mm} \end{table} \begin{table} \begin{threeparttable}[b] \caption{Our DNN's obstacle detection accuracy on the internal NVIDIA dataset by class.} \begin{center} \begin{tabular}{l|l|l} \textbf{Class} & \textbf{mAP, small resolution}\tnote{1} & \textbf{mAP, large resolution}\tnote{2} \\ \hline \hline vehicles & 0.438 & 0.473 \\ pedestrians & 0.039 & 0.057 \\ cyclists & 0.032 & 0.066 \\ \end{tabular} \begin{tablenotes} \item [1] Input resolution: $800 \times 800 \times 5$. \item [2] Input resolution: $1024 \times 1024 \times 5$. \end{tablenotes} \end{center} \label{tab:internal_mAP} \end{threeparttable} \end{table} \begin{table} \caption{Our DNN's free space regression accuracy on the internal NVIDIA dataset.} \begin{center} \begin{tabular}{l|l|l|l|l} \textbf{Resolution} & \textbf{Accuracy} & \textbf{IoU} & \textbf{RDM MAE} & \textbf{RDM IoU} \\ \hline \hline $800 \times 800 \times 5$ & 0.970 & 0.597 & $3.129$~m & 0.630 \\ $1024 \times 1024 \times 5$ & 0.968 & 0.576 & $2.674$~m & 0.712 \\ \end{tabular} \end{center} \label{tab:internal_freespace} \end{table} \subsection{NuScenes Dataset Performance} We further evaluate our approach on the public nuScenes dataset~\cite{nuscenes2019}. This dataset contains sensor data from 1 LiDAR and 5 RADARs. However, the sensors in this dataset are from the older generation making direct comparison difficult. The LiDAR sensor used for the nuScenes data collection contains only 32 beams vs 128 beams in our internal dataset. The extra sparsity in this dataset degrades the quality of our auto-generated free space targets. Similarly, the Continental ARS 408-21 RADARs used in nuScenes dataset produce significantly sparser detections when compared to the newer generation Continental ARS430 RADAR sensors we use in our internal dataset. Nonetheless, we demonstrate respectable results, especially at close ranges. See Tables~\ref{tab:nuscenes_results_800},~\ref{tab:nuscnes_map} and~\ref{tab:nuscenes_freespace} for details. \begin{table} \begin{threeparttable}[b] \caption{Our DNN's obstacle detection accuracy on nuScenes dataset by class and range.} \begin{center} \begin{tabular}{l|l|l|l} \textbf{Class} & \textbf{Range} & \textbf{F-score, small}\tnote{1} & \textbf{F-score, large}\tnote{2} \\ \hline \hline vehicles & 0 -- 10 m & 0.520 & 0.563 \\ vehicles & 10 -- 25 m & 0.500 & 0.538 \\ vehicles & 25 -- 40 m & 0.352 & 0.386 \\ vehicles & 40 -- 70 m & 0.180 & 0.199 \\ vehicles & 70 -- 100 m & 0.080 & 0.086 \\ \hline pedestrians & 0 -- 10 m & 0.056 & 0.059 \\ pedestrians & 10 -- 25 m & 0.046& 0.052 \\ pedestrians & 25 -- 40 m & 0.030 & 0.040 \\ pedestrians & 40 -- 70 m & 0.016 & 0.024 \\ pedestrians & 70 -- 100 m & 0.000 & 0.005 \\ \hline cyclists & 0 -- 10 m & 0.050 & 0.030 \\ cyclists & 10 -- 25 m & 0.068 & 0.066 \\ cyclists & 25 -- 40 m & 0.059 & 0.066 \\ cyclists & 40 -- 70 m & 0.044 & 0.041 \\ cyclists & 70 -- 100 m & 0.000 & 0.000 \\ \end{tabular} \begin{tablenotes} \item [1] Input resolution: $800 \times 800 \times 5$. \item [2] Input resolution: $1024 \times 1024 \times 5$. \end{tablenotes} \end{center} \label{tab:nuscenes_results_800} \end{threeparttable} \end{table} \begin{table} \begin{threeparttable}[b] \caption{Our DNN's obstacle detection accuracy on nuScenes dataset by class.} \begin{center} \begin{tabular}{l|l|l} \textbf{Class} & \textbf{mAP, small resolution}\tnote{1} & \textbf{mAP, large resolution}\tnote{2} \\ \hline \hline vehicles & 0.245 & 0.280 \\ pedestrians & 0.002 & 0.003 \\ cyclists & 0.005 & 0.004 \\ \end{tabular} \begin{tablenotes} \item [1] Input resolution: $800 \times 800 \times 5$. \item [2] Input resolution: $1024 \times 1024 \times 5$. \end{tablenotes} \end{center} \label{tab:nuscnes_map} \end{threeparttable} \end{table} \begin{table} \caption{Our DNN's free space regression accuracy on nuScenes dataset.} \begin{center} \begin{tabular}{l|l|l|l|l} \textbf{Resolution} & \textbf{Accuracy} & \textbf{IoU} & \textbf{RDM MAE} & \textbf{RDM IoU} \\ \hline \hline $800 \times 800 \times 5$ & 0.896 & 0.351 & $10.621$~m & 0.394 \\ $1024 \times 1024 \times 5$ & 0.881 & 0.353 & $9.584$~m & 0.441 \\ \end{tabular} \end{center} \label{tab:nuscenes_freespace} \vspace{-2mm} \end{table} We further compare our NVRadarNet DNN free space detection accuracy against the method published in~\cite{occupancyISM2019}, which also presents results on nuScenes dataset. However, this method operates on a grid covering the area in front of the ego vehicle up to $86$~m with $10$~m to each side and, unlike our approach, does not regresses or classifies obstacles. For this comparison we performed the evaluation on the same image region, while converting the predicted occupancy probability to three classes \textit{Occupied}, \textit{Free} and \textit{Unobserved} as follows. \begin{itemize} \item Occupied: $p_{occ} > 0.65$ \item Free: $p_{occ} < 0.35$ \item Unobserved: $0.35 <= p_{occ} <= 0.65$ \end{itemize} The results are given in table~\ref{tab:occupancy_net_freespace}. Our DNN outperforms the other method for occupied space regression (best results in bold) and performs similarly on other tasks. \begin{table} \caption{Comparison to OccupancyNet~\cite{occupancyISM2019} on nuScenes dataset. Best results in bold.} \begin{center} \begin{tabular}{l|l|l|l|l} \textbf{Method} & \textbf{Occupied} & \textbf{Free} & \textbf{Unobs.} & \textbf{mIoU} \\ \hline \hline OccupancyNet~\cite{occupancyISM2019} & 0.108 & \textbf{0.614} & \textbf{0.593} & \textbf{0.439} \\ Ours @ $800 \times 800$ & \textbf{0.237} & 0.564 & 0.436 & 0.412 \\ Ours @ $1024 \times 1024$ & 0.222 & 0.574 & 0.405 & 0.400 \\ \end{tabular} \end{center} \label{tab:occupancy_net_freespace} \end{table} \subsection{NVRadarNet DNN Inference} Our NVRadarNet DNN can be trained in mixed precision mode using INT8 quantization without any loss of accuracy. We export the network using NVIDIA TensorRT and time it on NVIDIA DRIVE AGX's embedded GPU used in our autonomous vehicles. Our DNN is able to achieve \textbf{1.5~ms} end-to-end inference with all three heads. We process all of the surround RADARs, perform obstacle detection and free space segmentation much faster than real-time on the embedded GPU. It was difficult to find other RADAR DNNs inference timings in the literature for direct comparison. We only found that \cite{azimuthRangeTensor} is an order of magnitude slower. \section{CONCLUSION} In this work, we presented NVRadarNet DNN, a real-time deep neural network for obstacle and drivable free space detection from raw RADAR data provided by common automotive RADARs. We benchmarked our DNN on both internal NVIDIA dataset and the public nuScenes dataset and provided accuracy results. Our DNN runs faster than real-time at \textbf{1.5~ms} end-to-end inference time on NVIDIA DRIVE AGX's embedded GPU. To date, we are not aware of any other RADAR only networks that can simultaneously perform obstacle detection and free space regression while running faster than real-time on automotive embedded computers. \section*{Acknowledgment} We would like to thank Sriya Sarathy, Tilman Wekel and Stan Birchfield for their technical contributions. We further would like to acknowledge David Nister, Sangmin Oh and Minwoo Park for their support. \clearpage \bibliographystyle{IEEEtran}
{'timestamp': '2022-09-30T02:05:58', 'yymm': '2209', 'arxiv_id': '2209.14499', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14499'}
arxiv
\section{Introduction} Large datasets containing millions of samples have become the standard for obtaining advanced models in many artificial intelligence directions, including natural language processing~\cite{brown2020language}, speech recognition~\cite{baevski2020wav2vec}, and computer vision~\cite{goyal2021self}. Meanwhile, large datasets also raise some issues. For example, data storage and preprocessing are becoming more and more difficult. Also, expensive servers are needed to train models on these datasets, which is not friendly for low-resource environments~\cite{li2022tri}. An effective way to solve these problems is data selection (coreset construction) which identifies representative training samples of large datasets~\cite{bachem2017practical}. However, since some of the original data cannot be discarded, there is an upper limit on the compression rate of the data selection method. \par Recently, dataset distillation as an alternative method to data selection has attracted widespread attention~\cite{wang2018datasetdistillation}. Dataset distillation is the task of synthesizing a small dataset that preserves most information of the original large dataset. The algorithm of dataset distillation takes a sizeable real dataset as input and synthesizes a small distilled dataset. Unlike the data selection method that uses actual data from the original dataset, dataset distillation generates synthetic data with a different distribution from the original one~\cite{dong2022privacy}. Therefore, the dataset distillation method can distill the whole dataset into several images, or even only one image~\cite{sucholutsky2021soft}. Dataset distillation has many application scenarios, such as privacy protection~\cite{li2020soft, song2022federated}, continual learning~\cite{wiewel2021soft, sangermano2022sample}, neural architecture search~\cite{such2020generative, zhao2021datasetcondensation}, etc. \par Since the dataset distillation task was first introduced in 2018 by Wang et al.~\cite{wang2018datasetdistillation}, it has gained increasing attention in the research community. The original dataset distillation algorithm is based on meta-learning and optimizes the distilled images with gradient-based hyperparameter optimization. Subsequently, many works have significantly improved the distillation performance with label distillation~\cite{bohdal2020flexible}, gradient matching~\cite{zhao2021datasetcondensation}, differentiable augmentation~\cite{zhao2021differentiatble}, and distribution/feature matching~\cite{zhao2021distribution, wang2022cafe}. The recently proposed dataset distillation method by matching network parameters has been the new SOTA on several datasets~\cite{cazenavette2022dataset}. However, a network usually has a large number of parameters. And we found that a few parameters are difficult to match in the distillation process and harm the distillation performance, which could be improved. \par In this paper, we propose a new dataset distillation method using parameter pruning. As one of the model pruning approaches, parameter pruning is often used for model compression and accelerated model training. Here, we introduce parameter pruning into dataset distillation to remove the effect of difficult-to-match parameters. The proposed method can synthesize more robust distilled datasets by pruning difficult-to-match parameters in the distillation process, improving the distillation and cross-architecture generalization performance. Experimental results on two benchmark datasets and a real-world COVID-19 chest X-ray (CXR) dataset show the superiority of the proposed method to other SOTA dataset distillation methods. \par Our main contributions can be summarized as follows: \begin{itemize} \item We propose a new dataset distillation method using parameter pruning, which can synthesize more robust distilled datasets and improve the distillation performance. \item The proposed method can outperform other SOTA dataset distillation methods on two benchmark datasets and have better performance in cross-architecture generalization. \item We verify the effectiveness of the proposed method in the real-world application on a COVID-19 CXR dataset. \end{itemize} \begin{figure*}[t] \centering \includegraphics[width=15cm]{Image/Method.png} \caption{Overview of the proposed method. Our method uses a teacher-student architecture, and the objective is to make the student network parameters $\tilde{\theta}'_{i,J}$ match the teacher network parameters $\theta'_{i+K}$. Our method can avoid the influence of the difficult-to-match parameters on the distilled dataset by pruning the parameters in teacher and student networks.} \label{fig1} \end{figure*} \section{Methodology} An overview of the proposed method is shown in Fig.~\ref{fig1}. Our method is constructed on a teacher-student architecture, and the objective is to make the student network parameters trained on the distilled dataset $\mathcal{D}_\textrm{distill}$ match the teacher network parameters trained on the original large dataset $\mathcal{D}_\textrm{original}$. Our method consists of three stages, teacher-student architecture training, dataset distillation using parameter pruning, and optimized distilled dataset generation, which we will show details in the following subsections. \subsection{Teacher-Student Architecture Training} First, we pre-train $N$ teacher networks on $\mathcal{D}_\textrm{original}$ and save their snapshot parameters at each epoch. We define teacher parameters as time sequences of parameters $\{\theta_{i}\}^{I}_{0}$. Meanwhile, student parameters are defined as $\tilde{\theta}_{i}$ who are trained on the distilled dataset $\mathcal{D}_\textrm{distill}$ at each training step $i$. At each distillation step, we first sample parameters from one of the teacher parameters at a random step $i$ and use it to initialize student parameters as $\tilde{\theta}_{i}=\theta_{i}$. We set an upper bound $I^{+}$ on the random step $i$ to ignore the less informative later parts of the teacher parameters. And the number of updates for student parameters and teacher parameters are set to $J$ and $K$, where $J \ll K$. For each student update $j$, we sample a minibatch $b_{i,j}$ from distilled dataset as follows: \begin{equation} b_{i,j} \thicksim \mathcal{D}_\textrm{distill}, \end{equation} Then we perform $j$ updates on the student parameters $\tilde{\theta}$ using the cross-entropy loss $\ell$ as follows: \begin{equation} \tilde{\theta}_{i,j+1} = \tilde{\theta}_{i,j} - \alpha\nabla\ell(\mathcal{A}(b_{i,j});\tilde{\theta}_{i,j}), \end{equation} where $\alpha$ represents the trainable learning rate. $\mathcal{A}$ represents a differentiable data augmentation module proposed in~\cite{zhao2021differentiatble}, which can improve the distillation performance. \begin{algorithm}[t] \caption{Dataset Distillation using Parameter Pruning} \label{alg1} \begin{algorithmic}[1] \REQUIRE $\{\theta_{i}\}^{I}_{0}$ : teacher parameters trained on $\mathcal{D}$; $\alpha_{0}$: initial value for $\alpha$; $\mathcal{A}$: differentiable augmentation function; $\epsilon$: threshold for pruning; $T$: number of distillation step; $J$: number of updates for student network; $K$: number of updates for teacher network; $I^{+}$: maximum start epoch. \ENSURE optimized distilled dataset $\mathcal{D}^{\ast}_\textrm{distill}$ and learning rate $\alpha^{\ast}$. \\ \STATE Initialize distilled dataset: $\mathcal{D}_\textrm{distill} \thicksim \mathcal{D}$ \STATE Initialize trainable learning rate: $\alpha = \alpha_{0}$ \FOR{each distillation step $t = 0$ to $T - 1$} \STATE Choose random start epoch $i < I^{+}$ \STATE Initialize student network with teacher parameter: $\tilde{\theta}_{i}=\theta_{i}$ \FOR{each distillation step $j = 0$ to $J - 1$} \STATE Sample a minibatch of distilled dataset: $b_{i,j} \thicksim \mathcal{D}_\textrm{distill}$ \STATE Update student network with cross-entropy loss: \STATE $\tilde{\theta}_{i,j+1} = \tilde{\theta}_{i,j} - \alpha\nabla\ell(\mathcal{A}(b_{i,j});\tilde{\theta}_{i,j})$ \ENDFOR \IF{parameter similarity in $\tilde{\theta}_{i,J}$ and $\theta_{i+K}$ is less than $\epsilon$} \STATE Prune network parameters: \STATE $\tilde{\theta}'_{i,J}, \theta'_{i+K}, \theta'_{i} = \textrm{Prune}(\tilde{\theta}_{i,J}, \theta_{i+K}, \theta_{i})$ \ENDIF \STATE Compute loss between pruned parameters: \STATE $\mathcal{L} = || \tilde{\theta}'_{i,J}-\theta'_{i+K} ||^{2}_{2} \,\,\,/\,\,\, || \theta'_{i}-\theta'_{i+K} ||^{2}_{2}$ \STATE Update $\mathcal{D}_\textrm{distill}$ and $\alpha$ with respect to $\mathcal{L}$ \ENDFOR \end{algorithmic} \end{algorithm} \begin{table*}[t] \footnotesize \centering \caption{Test results of different methods on CIFAR-10 and CIFAR-100.} \label{tab1} \begin{tabular}{l|c|cccccccc|cc} \hline & IPC & Random & Forgetting~\cite{toneva2019empirical} & Herding~\cite{chen2010super} & DSA~\cite{zhao2021differentiatble} & DM~\cite{zhao2021distribution} & CAFE~\cite{wang2022cafe} & MTT~\cite{cazenavette2022dataset} & Ours & Full Dataset\\\hline \multirow{3}*{CIFAR-10} & 1 & 14.4$\pm$2.0 & 13.5$\pm$1.2 & 21.5$\pm$1.2 & 28.8$\pm$0.7 & 26.0$\pm$0.8 & 31.6$\pm$0.8 & 46.3$\pm$0.8 & \bfseries{46.4$\pm$0.6} & \multirow{3}*{84.8$\pm$0.1} \\ & 10 & 26.0$\pm$1.2 & 23.3$\pm$1.0 & 31.6$\pm$0.7 & 52.1$\pm$0.5 & 48.9$\pm$0.6 & 50.9$\pm$0.5 & 65.3$\pm$0.7 & \bfseries{65.5$\pm$0.3} & \\ & 50 & 43.4$\pm$1.0 & 23.3$\pm$1.1 & 40.4$\pm$0.6 & 60.6$\pm$0.5 & 63.0$\pm$0.4 & 62.3$\pm$0.4 & 71.6$\pm$0.2 & \bfseries{71.9$\pm$0.2} & \\\hline \multirow{3}*{CIFAR-100} & 1 & 4.2$\pm$0.3 & 4.5$\pm$0.2 & 8.4$\pm$0.3 & 13.9$\pm$0.3 & 11.4$\pm$0.3 & 14.0$\pm$0.3 & 24.3$\pm$0.3 & \bfseries{24.6$\pm$0.1} & \multirow{3}*{56.2$\pm$0.3} \\ & 10 & 14.6$\pm$0.5 & 15.1$\pm$0.3 & 17.3$\pm$0.3 & 32.3$\pm$0.3 & 29.7$\pm$0.3 & 31.5$\pm$0.2 & 40.1$\pm$0.4 & \bfseries{43.1$\pm$0.3} & \\ & 50 & 30.0$\pm$0.4 & 30.5$\pm$0.3 & 33.7$\pm$0.5 & 42.8$\pm$0.4 & 43.6$\pm$0.4 & 42.9$\pm$0.2 & 47.7$\pm$0.2 & \bfseries{48.4$\pm$0.3} & \\\hline \end{tabular} \end{table*} \subsection{Dataset Distillation Using Parameter Pruning} Next, we get the student parameters $\tilde{\theta}_{i,J}$ trained on the distilled dataset $\mathcal{D}_\textrm{distill}$ from $J$ updates after initializing the student network. Meanwhile, we can get the teacher parameters $\theta_{i+K}$ trained on the original dataset $\mathcal{D}_\textrm{original}$ from $K$ updates, which are the known parameters that have been pre-trained. If the similarity of parameters in $\tilde{\theta}_{i,J}$ and $\theta_{i+K}$ is less than a threshold $\epsilon$, these parameters are recognized as difficult-to-match parameters and are pruned as follows: \begin{equation} \tilde{\theta}'_{i,J}, \theta'_{i+K}, \theta'_{i} = \textrm{Prune}(\tilde{\theta}_{i,J}, \theta_{i+K}, \theta_{i}), \end{equation} where $\textrm{Prune}$ represents a function that transforms the parameters to a one-dimension vector and prunes the parameters under the threshold at each last distillation step. By pruning difficult-to-match parameters in teacher and student networks, the proposed method can avoid the influence of these parameters on the distilled dataset, which can improve the distillation and cross-architecture generalization performance. The final loss $\mathcal{L}$ calculates the normalized squared $L_{2}$ error between pruned student parameters $\tilde{\theta}'_{i,J}$ and teacher parameters $\theta'_{i+K}$ as follows: \begin{equation} \mathcal{L} = \frac{|| \tilde{\theta}'_{i,J}-\theta'_{i+K} ||^{2}_{2}} {|| \theta'_{i}-\theta'_{i+K} ||^{2}_{2}}, \end{equation} where we normalize the $L_{2}$ error by the distance $\theta'_{i}-\theta'_{i+K}$ moved by the teacher so that we can still obtain proper supervision from the late training period of the teacher network even if it has converged. In addition, the normalization eliminates cross-layer and neuronal differences in magnitude. \subsection{Optimized Distilled Dataset Generation} Finally, we minimize the loss $\mathcal{L}$ using momentum stochastic gradient descent (SGD) and backpropagate the gradients through all $J$ updates to the student network for updating the pixels of the distilled dataset $\mathcal{D}_\textrm{distill}$ and trainable learning rate $\alpha$. Note that the process of searching the optimized learning rate $\alpha^{\ast}$ can act as an automatic adjustment for the number of student and teacher updates (i.e., hyperparameters $J$ and $K$). The distillation process of the proposed method is summarized in Algorithm~\ref{alg1}. After obtaining the optimized distilled dataset $\mathcal{D}^{\ast}_\textrm{distill}$, we can train different neural networks on it for efficiency and use for downstream tasks, such as continual learning and neural architecture search. \section{Experiments} In this section, we conduct three experiments to verify the effectiveness of the proposed method. The experimental settings are shown in subsection 3.1. Subsections 3.2, 3.3, and 3.4 show the results of benchmark comparison, cross-architecture generalization, and real-world dataset verification, respectively. All of our experiments were conducted using the PyTorch framework with an NVIDIA RTX A6000 GPU. \begin{figure}[t] \centering \includegraphics[width=8cm]{Image/CIFAR-10.png} \caption{Visualization results of the distilled CIFAR-10 dataset.} \label{fig2} \end{figure} \begin{table}[t] \footnotesize \centering \caption{Test results of different width KIP~\cite{nguyen2021kipimprovedresults} and our method on CIFAR-10 and CIFAR-100.} \label{tab2} \begin{tabular}{l|c|c|cc} \hline & IPC & KIP-1024 & KIP-128 & Ours-128 \\\hline \multirow{3}*{CIFAR-10} & 1 & 49.9 & 38.3 & \bfseries{46.4} \\ & 10 & 62.7 & 57.6 & \bfseries{65.5} \\ & 50 & 68.6 & 65.8 & \bfseries{71.9} \\\hline \multirow{3}*{CIFAR-100} & 1 & 15.7 & 18.2 & \bfseries{24.6} \\ & 10 & 28.3 & 32.8 & \bfseries{43.1}\\ & 50 & - & - & \bfseries{48.4} \\\hline \end{tabular} \end{table} \subsection{Experimental Settings} We used two benchmark datasets (i.e., CIFAR-10 and CIFAR-100) in the experiments for comparison with other methods. The resolution of images in CIFAR-10 and CIFAR-100 is 32 $\times$ 32. We also used a COVID-19 CXR dataset~\cite{li2022self} for proving the effectiveness of our method in the real-world application. The COVID-19 CXR dataset has four classes, including COVID-19 (3616 images), Lung Opacity (6012 images), Normal (10192 images), and Viral Pneumonia (1345 images). Since CXR images have high resolutions (224 $\times$ 224), they are resized to 112 $\times$ 112 for rapid distillation. \par For comparative methods, we used three data selection methods, including random selection (Random), example forgetting (Forgetting)~\cite{toneva2019empirical}, and herding method (Herding)~\cite{chen2010super}. Also, we used five SOTA dataset distillation methods, including Differentiable Siamese Augmentation (DSA)~\cite{zhao2021differentiatble}, Distribution Matching (DM)~\cite{zhao2021distribution}, Aligning Features (CAFE)~\cite{wang2022cafe}, Matching Training Trajectories (MTT)~\cite{cazenavette2022dataset} and Kernel Inducing Point (KIP)~\cite{nguyen2021kipimprovedresults}. The network used in this study is a sample 128-width ConvNet~\cite{gidaris2018dynamic}, which is often used in current dataset distillation methods. We conducted three experiments to verify the effectiveness of the proposed method, including benchmark comparison, cross-architecture generalization, and real-world dataset verification. We found that pruning too many parameters would cause the model training to crash. Hence parameter pruning threshold $\epsilon$ was set to 0.1, which performed well in all experiments. All experimental results are average accuracy and standard deviation of five networks trained from scratch on the distilled dataset. \subsection{Benchmark Comparison} In this subsection, we verify the effectiveness of the proposed method by comparing it with other SOTA dataset distillation methods on two benchmark datasets, i.e., CIFAR-10 and CIFAR-100. We employed zero-phase component analysis (ZCA) whitening with default parameters and used a 3-depth ConvNet the same as MTT~\cite{cazenavette2022dataset}. We pre-trained 200 teacher networks (50 epochs per teacher) for the distillation process. The number of distillation steps was set to 5,000. And the number of images per class (IPC) was set to 1, 10, and 50, respectively. For KIP~\cite{nguyen2021kipimprovedresults}, we used their original 1024-width ConvNet (KIP-1024) and 128-width ConvNet (KIP-128) for a fair comparison. Also, we used their custom ZCA implementation for distillation and evaluation. \par From Table~\ref{tab1}, we can see that the proposed method outperformed dataset selection methods and SOTA dataset distillation methods in all settings. Especially for CIFAR-100 with IPC = 10, our method has an accuracy increased by 3.0\% compared to the second best method MTT. As shown in Table~\ref{tab2}, the proposed method drastically outperformed KIP using the same 128-width ConvNet. Even for KIP that uses 1024-width ConvNet, our method has higher accuracy except for CIFAR-10 with 1 image per class. For the results of CIFAR-100 with IPC = 50, KIP did not conduct experiments due to the large computational resources and time required, so we only report our results in this paper. Figure~\ref{fig2} shows visualization results of the distilled CIFAR-10 dataset. As shown in Fig.~\ref{fig2}, when we set the number of distilled images to 1, the generated images were more abstract but also more information-dense because all information of a class has to be compressed into only one image in the distillation process. Meanwhile, when the number of distilled images was set to 10, the generated images were more realistic and contained various forms because discriminative features in a class can be compressed into multiple images in the distillation process. For example, we can see various types of dogs and different colored cars. \begin{table}[t] \footnotesize \centering \caption{Cross-architecture generalization results on CIFAR-10 dataset with IPC = 10.} \label{tab3} \begin{tabular}{lcccc} \hline Architecture & ConvNet & AlexNet & VGG & ResNet \\\hline Ours & \bfseries{65.4$\pm$0.4} & \bfseries{35.8$\pm$1.3} & \bfseries{52.9$\pm$0.9} & \bfseries{51.8$\pm$1.1} \\ MTT~\cite{cazenavette2022dataset} & 64.3$\pm$0.7 & 34.2$\pm$2.6 & 50.3$\pm$0.8 & 46.4$\pm$0.6 \\ KIP~\cite{nguyen2021kipimprovedresults} & 47.6$\pm$0.9 & 24.4$\pm$3.9 & 42.1$\pm$0.4 & 36.8$\pm$1.0 \\\hline \end{tabular} \end{table} \begin{table}[t] \footnotesize \centering \caption{Test results on a COVID-19 CXR dataset when using different numbers of distilled images.} \label{tab4} \begin{tabular}{lcccccc} \hline IPC & 1 & 5 & 10 & 20 \\\hline Ours & \bfseries{54.2$\pm$3.7} & \bfseries{81.6$\pm$0.3} & \bfseries{83.5$\pm$0.2} & \bfseries{84.1$\pm$0.6} \\ MTT~\cite{cazenavette2022dataset} & 52.5$\pm$5.5 & 79.3$\pm$0.4 & 82.2$\pm$0.2 & 82.7$\pm$0.5 \\\hline \end{tabular} \end{table} \begin{figure}[t] \centering \includegraphics[width=7.8cm]{Image/COVID.png} \caption{Visualization results of real and distilled CXR images.} \label{fig3} \end{figure} \subsection{Cross-Architecture Generalization} In this subsection, we verify the effectiveness of our method in cross-architecture generalization. Cross-architecture means using distilled images generated by one architecture and testing on other architectures. The distilled images were generated by ConvNet on CIFAR-10 and the number of distilled images was set to 10. We used the same pre-trained teacher networks used in subsection 3.2 for rapid distillation and experimentation. For KIP, we used 128-width ConvNet and their custom ZCA implementation for distillation and evaluation. And we tested the accuracy of ConvNet and three cornerstone networks for evaluation of cross-architecture generalization, i.e., AlexNet~\cite{krizhevsky2012imagenet}, VGG~\cite{simonyan2015very}, and ResNet~\cite{he2016deep}. \par From Table~\ref{tab3}, we can see that our method outperformed the SOTA methods MTT and KIP with all architectures. Especially for ResNet, our method has increased accuracy by 5.2\% compared to MTT. The results indicate that our method generated more robust distilled images. By pruning difficult-to-match parameters in teacher and student networks, the proposed method can avoid the influence of these parameters on the distilled dataset, which improves cross-architecture generalization performance. \subsection{Real-World Dataset Verification} In this subsection, we verify the effectiveness of the proposed method in real-world application on a COVID-19 CXR dataset. We used a 5-depth ConvNet for distillation since the image resolution increases significantly compared to CIFAR-10 and CIFAR-100. We pre-trained 100 teacher networks (50 epochs per teacher) for the distillation process. The number of distillation steps was set to 5,000. And we tested the COVID-19 accuracy when the IPC was set to 1, 5, 10, and 20, respectively. \par Table~\ref{tab4} shows that the proposed method achieved high test accuracy even when using a few distilled CXR images, such as IPC = 20 (80 distilled CXR images). Furthermore, the proposed method outperformed the SOTA method MTT in all IPC settings, indicating the effectiveness of our method in the real-world application for COVID-19 detection. Figure~\ref{fig3} shows visualization results of real and distilled CXR images. The distilled CXR images are generated from noise and have different distributions from the original images. Compared with the original CXR images, the distilled images are visually different, showing the potential of dataset distillation for anonymization and privacy preservation. \section{Conclusion} This paper has proposed a novel dataset distillation method using parameter pruning. The proposed method can synthesize more robust distilled datasets by pruning difficult-to-match parameters in the distillation process. Experimental results show that the proposed method can outperform other SOTA dataset distillation methods on two benchmark datasets and have better performance in cross-architecture generalization. We also verify the effectiveness of our method in the real-world application on a COVID-19 CXR dataset. \newpage \bibliographystyle{IEEEbib}
{'timestamp': '2022-10-06T02:10:53', 'yymm': '2209', 'arxiv_id': '2209.14609', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14609'}
arxiv
\section{Introduction} \label{sec:intro} Online recommendation is fundamental to functioning of the modern web. From online stores to streaming service engines and content discovery platforms, it enables users to discover relevant content faster, and product owners to make their products visible to a broader public. Recommender systems can be understood as a feedback loop between the recommendation engine and the target audience – based on provided recommendations, the interactions with the recommendations are stored and considered to improve a given recommender further~\cite{batmaz2019review}. Machine learning models underlie many online recommendation systems. The most common branch of algorithms considered, both due to their performance and lower complexity, are \textbf{factorization machines (FM)}. These algorithms require the modelers to provide both the space of features and their interactions (\emph{featurization}), as well as model hyperparameters~\cite{rendle2012factorization}. The latter is the main focus of this paper. Tuning hyperparameters can be considered as an optimization task, formulated as follows: $$\textrm{Solution} \approx \argmin_{\substack{\Theta \in \textrm{hyperParamSpace}}} \mathbb{E} \big [\textsc{Loss} \big ( \textrm{\emph{LearningEngine}},\Theta,\textrm{data}\big ) \big ],$$ \noindent where \emph{data} corresponds to the training data of choice, $\Theta$ to a given hyperparameter configuration, and \emph{LearningEngine} to the machine learning model considered. The minimization aims to identify minimal expected \emph{Loss} of choice (lower is better in this formulation). This formulation considers one \emph{LearningEngine} evaluation for each configuration. As the optimization progresses, configuration-target pairs are obtained and stored. \emph{Surrogate models} exploit this data to estimate which configuration the \emph{LearningEngine} will consider next. The problem with larger data sets is that the amount of engine evaluations is \emph{limited}, hence having \textbf{data-efficient surrogates} is a desired property that can substantially shorten research cycles. The contributions presented are multi-fold, and are stated next. First, we describe the process of integration of surrogate-based optimization into the \textbf{in-house AutoML framework} -- we considered both Bayesian and non-Bayesian (surrogate) models, reporting on their behaviour. We next present the implemented strategy of \textbf{Dynamic Surrogate Switching} (DSS) that builds on the recent ideas of automated model switching during optimization. The results of initial evaluations indicate this is a promising strategy to speed up hyperparameter optimization in real-life settings, where the number of learning engine evaluations is limited due to the scale of data considered. \section{Selected Related work} \label{sec:related} \begin{figure \centering \Description[Example 3D visualization of hyperparameter landscape.]{Hyperparameters visualized: two hyperparameters with corresponding RIG scores.} \includegraphics[width=1\linewidth]{hyperparamExample.png} \caption{Example two-hyperparameter non-convex (interpolated) landscape.} \label{fig:nonconvex} \end{figure} The vast majority of machine learning models require the specification of \textbf{hyperparameters} for their normal mode of operation. Early approaches mostly considered grid-based, random, or evolution-based search through the space of possible configurations~\cite{friedrichs2005evolutionary}. However, recent trends indicate that, albeit random search often represents a viable baseline, exploiting the information obtained during the optimization can be a better strategy. There are multiple ways these hyperparameter-target score data points can be utilized. The simplest examples include incorporation of their statistical properties into the search strategy, however, considering them as input data samples for the \emph{surrogate model} is also often considered~\cite{falkner2018bohb}. The ideas of \textbf{surrogate-based} optimization are tightly linked with the field of Bayesian optimization~\cite{malu2021bayesian}; effectively, if a surrogate is a probabilistic model capable of also outputting the (epistemic) uncertainty associated with a given prediction, both the prediction and the associated uncertainty can be used by the \emph{acquisition function} -- the procedure responsible for linking the surrogate's output(s) with parts of the search space that should be considered in the next round of learning engine evaluations. There exist a plethora of commonly considered acquisition functions -- examples include the probability of improvement, expected improvement and more~\cite{frazier2018tutorial}. If the surrogate is only capable of outputting the prediction, acquisition functions are simpler -- for example, viable configurations can be identified already by sorting the space of candidate configurations according to the surrogate's outputs. The \textbf{acquisition function} is thus responsible for using a trained surrogate to \emph{score} parts of the hyperparameter space -- these can be obtained via random sampling or more involved optimization schemes (such as for example, using L-BFGS~\cite{zhu1997algorithm} to minimize the acquisition function directly). Non-convex optimization landscapes can emerge already when considering as few as two hyperparameters in production environments (example shown in Figure~\ref{fig:nonconvex}). The presented methodology also builds on the recent ideas of Online \textbf{AutoML} (Automated Machine Learning)~\cite{he2021automl}. The goal of AutoML systems is to automate various data-related processes commonly manually performed by human modelers. In particular, we built on some of the ideas presented recently in~\cite{celik2022online}, where dynamic ensembles were used to perform online learning. The main finding of the aforementioned study is that \emph{switching} the models can help mitigate problems related to data quantity (at the initial stages) and concept drift (at the latter stages). Albeit the considered setting is being tested offline, we can interpret the search itself as a dynamic process -- commonly, a single surrogate type is considered throughout the search, however, is this the preferred strategy? We explored whether dynamic re-configuration of surrogate models \emph{during the optimization} is a sensible, sample-efficient hyperparameter optimization strategy suitable for \textbf{large-scale} model configuration search. \begin{figure \centering \Description[Workflow depicting DSS.]{A cyclic workflow showing how the models are iteratively refined/switched.} \includegraphics[width=0.95\linewidth]{scheme.png} \caption{Conceptual overview of \textbf{DSS}, part of the in-house AutoML.} \label{fig:scheme} \end{figure} \begin{figure}[t!] \centering \Description[Two figures showing DSS's performance]{Left image shows iterative model switching in action, right one shows benchmark performance against strong baselines.} \begin{subfigure}[b]{0.45\textwidth} \centering \includegraphics[width=\textwidth, height=4.3cm]{surrogateDynamic.png} \caption{Visualizing Dynamic Surrogate Switching -- the surrogates change as the optimization progresses.} \end{subfigure} \hfill \begin{subfigure}[b]{0.45\textwidth} \centering \includegraphics[width=\textwidth, height=4cm]{benchmark2.png} \caption{Benchmark results -- offline tests -- CTR task (Relative information gain~\cite{he2014practical}) with fixed stopping.} \end{subfigure} \caption{Visualization of DSS benchmark experiment and an ablation. The goal was to identify whether surrogate switching is a feasible strategy to obtain good model configurations. The benchmark results on a private data set consisting of hundreds of millions of instances (target was click-through rate -- CTR) are shown in Figure b). Results indicate DSS is a promising strategy candidate for sample-efficient hyperparameter optimization, requiring minimal human involvement during configuration.} \label{fig:three graphs} \end{figure} \section{Dynamic Surrogate Switching (DSS)} \label{sec:method} Surrogate models learn to estimate configuration quality during hyperparameter optimization. Changing surrogates during the search itself was previously shown to have a positive effect on the search's efficiency~\cite{Mehmani2018}. This work builds on similar ideas, extending them beyond common function optimization benchmark sets to operate as a part of the internal \emph{AutoML framework} that requires handling of \textbf{hundreds of millions} of instances during the search for suitable FM configurations. This section describes the key components of the presented method and the initial study of their behaviour. We refer to the proposed method as Dynamic Surrogate Switching (DSS). A conceptual overview of the proposed method is shown in Figure~\ref{fig:scheme}. The approach follows the paradigm of surrogate-based modeling extended by the idea of surrogate switching. We continue with \textbf{an overview of DSS}. As the first step, we will consider the evaluation of the learning engine (in our case, field-aware factorization machines (FFMs)~\cite{juan2016field}\footnote{Field aware factorization machines implementation available as \url{https://github.com/outbrain/fwumious_wabbit}.}. Initially, diverse parts of the search space are selected and considered by the learning engine to obtain the initial set of configuration-score tuples suitable for surrogate-based learning. The \textbf{evaluation data update} step is responsible for storing the configurations in a format suitable for learning. Further, this step also checks for anomalies in the evaluations (e.g., too many similar/same results). Note that the evaluation data set is constantly updated throughout the search, with all data considered each update (to maximize utilization of prior evaluations). The subsequent step of \textbf{surrogate selection} is what differentiates DSS from conventional surrogate-based learning the most -- the DSS is based on the previous work~\cite{Mehmani2018} and the ideas of OAML, aimed to enable dynamic surrogate re-configuration. We implemented it by considering a collection of different model types and their initial configurations. The considered models that can serve as a surrogate are, for example, Random Forests~\cite{breiman2001random}, Gaussian Processes~\cite{rasmussen2003gaussian} and Gradient Boosting Machines~\cite{friedman2001greedy}~\footnote{Implemented with components from~\cite{varoquaux2015scikit}.}. As the evaluation of such surrogates is inexpensive (and thus not the bottleneck of the whole search), the surrogate selection phase considers multiple parametrizations of the mentioned model types -- overall, hundreds of surrogates are evaluated each iteration. The next issue we tackled was how to \emph{score} the surrogates. We perform the selection based on the \emph{proportion of explained variance}. Thus, the surrogate model scoring (including ranking) can be formulated as: $\argsort_{s \in S} \frac{\textrm{Var} (y - s(D))}{\textrm{Var} (y)},$ \noindent where $S$ is the set of possible surrogate models and $D$ the current set of configuration-score tuples obtained by the learning engine during search. The highest-ranked surrogate is selected and used during the acquisition step for a given search iteration. An important component of surrogate-based optimization is \textbf{configuration generation}. Solution candidates are scored in mini-batches to tackle the memory overhead. We further augmented the random configuration search with a memory structure that discards parts of the space considered previously. Once the surrogate is selected, re-trained on the current data and the candidate space is selected, \textbf{solution scoring} takes place. Here, the surrogate is used to provide a score for each generated configuration. There are multiple possible ways of utilizing the obtained scores; e.g., in Bayesian search, probability-of-improvement or similar heuristics can be considered. As the considered DSS does not always offer probabilistic outputs, simpler acquisition functions are required. We exploit the fact that the AutoML system that implements DSS runs in \textbf{multi-threaded} mode, enabling us to devote some threads to top-ranked solutions obtained by the surrogate while leaving some threads to perform exploration based on more randomized configurations. Once selected, the learning engine considers the configurations, and the feedback loop continues. Example results are summarized in Figure~\ref{fig:three graphs}. Overall, the DSS was identified as a promising approach to tuning FFMs. \section{Conclusions} \label{sec:conclusions} The paper presents Dynamic Surrogate Switching (DSS), an approach aimed to facilitate hyperparameter search -- one of the components of the in-house AutoML utilized daily by many data scientists. The results indicate that dynamic surrogates indeed offer a promising alternative to existing strong baselines (e.g., Random Forest-based surrogates), are potentially more adaptive to particular problems considered, and require less human intervention during configuration. Further work includes testing the idea on different data sets and studying its behaviour when considering different learning engines. \section*{AUTHOR BIO} \label{sec:bio} Bla\v{z} \v{S}krlj is a machine learning researcher active in the areas of AutoML and representation learning. During his PhD at the Jo\v{z}ef Stefan International Postgraduate School he worked on low-resource AutoML and its applications to natural language processing, graph-based machine learning and compressibility of latent representations. Currently, Bla\v{z} is part of Outbrain’s AutoML team, where he is exploring the limits of AutoML for large-scale recommendation. \bibliographystyle{ACM-Reference-Format}
{'timestamp': '2022-09-30T02:08:52', 'yymm': '2209', 'arxiv_id': '2209.14598', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14598'}
arxiv
\section{Introduction} Offline reinforcement learning seeks to solve decision-making problems without interacting with the environment. This is compelling because online data collection can be dangerous or expensive in many realistic tasks. However, relying entirely on a static dataset imposes new challenges. One is that policy evaluation is hard because the mismatch between the behavior and the learned policy usually introduces extrapolation error \citep{bcq}. In most offline tasks, it is difficult or even impossible for the collected transitions to cover the whole state-action space. When evaluating the current policy via dynamic programming, leveraging actions that are not presented in the dataset (out-of-sample) may lead to highly unreliable results, and thus performance degrade. Consequently, in offline RL it is critical to stay close to the behavior policy during training. Recent advances in model-free offline methods mainly include two lines of work. The first is the adaptation of existing off-policy algorithms. These methods usually include value pessimism about unseen actions or regulations of feasible action space \citep{bcq, bear, cql}. The other line of work \citep{awr, crr, awac} is derived from constrained policy search and mainly trains a parameterized policy via weighted regression. Evaluations of every state-action pair in the dataset are used as regression weights. The main motivation behind weighted policy regression is that it helps prevent querying out-of-sample actions \citep{awac,iql}. However, we find that this argument is untenable in certain settings. Our key observation is that policy models in existing weighted policy regression methods are usually unimodal Gaussian models and thus lack distributional expressivity, while in the real world collected behaviors can be highly diverse. This distributional discrepancy might eventually lead to selecting unseen actions. For instance, given a bimodal target distribution, fitting it with a unimodal distribution unavoidably results in covering the low-density area between two peaks. In Section \ref{motivation}, we empirically show that lack of policy expressivity may lead to performance degrade. Ideally, this problem could be solved by switching to a more expressive distribution class. However, it is nontrivial in practice since weighted regression requires exact and derivable density calculation, which places restrictions on distribution classes that we can choose from. Especially, we may not know what the behavior or optimal policy looks like in advance. To overcome the limited expressivity problem, we propose to decouple the learned policy into two parts: an expressive generative behavior model and an action evaluation model. Such decoupling avoids explicitly learning a policy model whose target distribution is difficult to sample from, whereas learning a behavior model is much easier because sampling from the behavior policy is straightforward given the offline dataset collected by itself. Access to data samples from the target distribution is critical because it allows us to leverage existing advances in generative methods to model diverse behaviors. To sample from the learned policy, we use importance sampling to select actions from candidates proposed by the behavior model with the importance weights computed by the action evaluation model, which we refer to as \textbf{S}electing \textbf{f}rom \textbf{B}ehavior \textbf{C}andidates (\textbf{SfBC}). The fidelity of the learned behavior model is critical in our method because it directly determines the feasible action space. While covering any low-density area increases the possibility of selecting unseen actions during training, failing to cover all action modes in the dataset results in overly restricted action space. To fulfill this requirement, we propose to learn from diverse behaviors using diffusion probabilistic models \citep{diffusion}, which have recently achieved great success in modeling diverse image distributions, outperforming other existing generative models \citep{diffusion_beat_gan}. We also propose a planning-based operator for Q-learning, which performs implicit planning strictly within dataset trajectories based on the current policy, and is provably convergent. The planning scheme greatly reduces bootstrapping steps required for dynamic programming and thus can help to further reduce extrapolation error and increase computational efficiency. The main contributions of this paper are threefold: 1. We address the problem of limited policy expressivity in conventional methods by decoupling policy learning into behavior learning and action evaluation, which allows the policy to inherit distributional expressivity from a diffusion-based behavior model. 2. The learned policy is further combined with an implicit in-sample planning technique to suppress extrapolation error and assist dynamic programming over long horizons. 3. Extensive experiments demonstrate that our method achieves competitive or superior performance compared with state-of-the-art offline RL methods, especially in sparse-reward tasks such as AntMaze. \section{Background} \subsection{Constrained Policy Search in Offline RL} Consider a Markov Decision Process (MDP), described by a tuple $\langle\mathcal{S},\mathcal{A},P,r,\gamma\rangle$. $\mathcal{S}$ denotes the state space and $\mathcal{A}$ is the action space. $P({\bm{s}}'|{\bm{s}},{\bm{a}})$ and $r({\bm{s}}, {\bm{a}})$ respectively represent the transition and reward functions, and $\gamma \in (0,1]$ is the discount factor. Our goal is to maximize the expected discounted return $J(\pi) = \mathbb{E}_{{\bm{s}} \sim \rho_\pi({\bm{s}})}\mathbb{E}_{{\bm{a}} \sim \pi(\cdot|{\bm{s}})}\left[r({\bm{s}}, {\bm{a}})\right]$ of policy $\pi$, where $\rho_\pi({\bm{s}}) = \sum_{n=0}^\infty \gamma^n p_\pi({\bm{s}}_n = {\bm{s}})$ is the discounted state visitation frequencies induced by the policy $\pi$ \citep{rlbook}. According to the \textit{policy gradient theorem} \citep{PG}, given a parameterized policy $\pi_\theta$, and the policy's state-action function $Q^\pi$, the gradient of $J(\pi_\theta)$ can be derived as: \begin{equation} \label{Eq:objective} \nabla_\theta J(\pi_\theta) = \int_\mathcal{S} \rho_\pi({\bm{s}}) \int_\mathcal{A} \nabla_\theta \pi_\theta({\bm{a}} | {\bm{s}}) Q^\pi({\bm{s}}, {\bm{a}}). \end{equation} When online data collection from policy $\pi$ is not possible, it is difficult to estimate $\rho_\pi({\bm{s}})$ in \Eqref{Eq:objective}, and thus the expected value of the Q-function $\eta(\pi_\theta) := \int_\mathcal{S} \rho_\pi({\bm{s}}) \int_\mathcal{A} \pi_\theta({\bm{a}} | {\bm{s}}) Q^\pi({\bm{s}}, {\bm{a}})$. Given a static dataset $\mathcal{D}^\mu$ consisting of multiple trajectories $\{\left({\bm{s}}_n, {\bm{a}}_n, r_n \right)\}$ collected by a behavior policy $\mu({\bm{a}}|{\bm{s}})$, previous off-policy methods \citep{dpg, ddpg} estimate $\eta(\pi_\theta)$ with a surrogate objective $\hat{\eta}(\pi_\theta)$ by replacing $\rho_\pi({\bm{s}})$ with $\rho_\mu({\bm{s}})$. In offline settings, due to the importance of sticking with the behavior policy, prior works \citep{awr, awac} explicitly constrain the learned policy $\pi$ to be similar to $\mu$, while maximizing the expected value of the Q-functions: \begin{equation} \mathop{\mathrm{arg \ max}}_{\pi} \quad \int_\mathcal{S} \rho_\mu({\bm{s}}) \int_\mathcal{A} \pi({\bm{a}} | {\bm{s}}) Q_\phi({\bm{s}}, {\bm{a}}) \ d{\bm{a}} \ d{\bm{s}} - \frac{1}{\alpha}\int_\mathcal{S} \rho_\mu({\bm{s}}) D_{\mathrm{KL}} \left(\pi(\cdot |{\bm{s}}) || \mu(\cdot |{\bm{s}}) \right) d{\bm{s}}. \label{Eq:rl_main} \end{equation} The first term in \Eqref{Eq:rl_main} corresponds to the surrogate objective $\hat{\eta}(\pi_\theta)$, where $Q_\phi({\bm{s}}, {\bm{a}})$ is a learned Q-function of the current policy $\pi$. The second term is a regularization term to constrain the learned policy within support of the dataset $\mathcal{D}^\mu$ with $\alpha$ being the coefficient. \subsection{Policy Improvement via Weighted Regression} \label{Sec:weighted_regression} The optimal policy $\pi^*$ for \Eqref{Eq:rl_main} can be derived \citep{rwr, awr, awac} by use of Lagrange multiplier: \begin{align} \pi^*({\bm{a}}|{\bm{s}}) &= \frac{1}{Z({\bm{s}})} \ \mu({\bm{a}}|{\bm{s}}) \ \mathrm{exp}\left(\alpha Q_\phi({\bm{s}}, {\bm{a}}) \right), \label{Eq:pi_optimal} \end{align} where $Z({\bm{s}})$ is the partition function. \Eqref{Eq:pi_optimal} forms a policy improvement step. Directly sampling from $\pi^*$ requires explicitly modeling behavior $\mu$, which itself is challenging in continuous action-space domains since $\mu$ can be very diverse. Prior methods \citep{awr, crr, bail} bypass this issue by projecting $\pi^*$ onto a parameterized policy $\pi_\theta$: \begin{align} & \mathop{\mathrm{arg \ min}}_{\theta} \quad \mathbb{E}_{{\bm{s}} \sim \mathcal{D}^\mu} \left[ D_{\mathrm{KL}} \left(\pi^*(\cdot | {\bm{s}}) \middle|\middle| \pi_\theta(\cdot | {\bm{s}})\right) \right]\nonumber \\ = & \mathop{\mathrm{arg \ max}}_{\theta} \quad \mathbb{E}_{({\bm{s}}, {\bm{a}}) \sim \mathcal{D}^\mu} \left[ \mathrm{log} \ \pi_\theta({\bm{a}} | {\bm{s}}) \ \mathrm{exp}\left(\alpha Q_\phi({\bm{s}}, {\bm{a}}) \right) \right]. \label{Eq:wr} \end{align} Such method is usually referred to as weighted regression, with $\mathrm{exp}\left(\alpha Q_\phi({\bm{s}}, {\bm{a}})\right)$ being the regression weights. Although weighted regression avoids the need to explicitly model the behavior policy, it requires calculating the exact density function $\pi_\theta({\bm{a}} | {\bm{s}})$ as in \Eqref{Eq:wr}. This constrains the policy $\pi_\theta$ to distribution classes that have a tractable expression for the density function. We find this in practice limits the model expressivity and could be suboptimal in some cases (See Section \ref{motivation}). \subsection{Diffusion Probabilistic Model} \label{Sec:diffusion_bg} Diffusion models \citep{sohl2015deep,diffusion,sde} are generative models by firstly defining a forward process to gradually add noise to an unknown data distribution $p_0({\bm{x}}_0)$ and then learning to reverse it. The forward process $\{ {\bm{x}}(t) \}_{t\in [0, T]}$ is defined by a stochastic differential equation (SDE) $d{\bm{x}}_t = f({\bm{x}}_t, t) \mathrm{d}t + g(t) \mathrm{d} {\bm{w}}_t$, where ${\bm{w}}_t$ is a standard Brownian motion and $f(t)$, $g(t)$ are hand-crafted functions \citep{sde} such that the transition distribution $p_{t0}({\bm{x}}_t|{\bm{x}}_0)=\mathcal{N}({\bm{x}}_t|\alpha_t{\bm{x}}_0, \sigma_t^2\bm{I})$ for some $\alpha_t,\sigma_t>0$ and $p_T({\bm{x}}_T)\approx \mathcal{N}({\bm{x}}_T|0,\bm{I})$. To reverse the forward process, diffusion models define a scored-based model ${\bm{s}}_\theta$ and optimize the parameter $\theta$ by: \begin{equation} \mathop{\mathrm{arg \ min}}_{\theta} \quad \mathbb{E}_{t,{\bm{x}}_0,\bm{\epsilon}}[\| \sigma_t \mathbf{s}_\theta({\bm{x}}_t, t) + \bm{\epsilon} \|_2^2], \end{equation} where $t\sim\mathcal{U}(0,T)$, ${\bm{x}}_0\sim p_0({\bm{x}}_0)$, $\bm{\epsilon}\sim \mathcal{N}(0,\bm{I})$, ${\bm{x}}_t=\alpha_t{\bm{x}}_0+\sigma_t\bm{\epsilon}$. Sampling by diffusion models can be alternatively viewed as discretizing the diffusion ODEs~\citep{sde}, which are generally faster than discretizing the diffusion SDEs~\citep{song2020denoising,lu2022dpm}. Specifically, the sampling procedure needs to firstly sample a pure Gaussian ${\bm{x}}_T\sim\mathcal{N}(0,\bm{I})$, and then solve the following ODE from time $T$ to time $0$ by numerical ODE solvers: \begin{equation} d {\bm{x}}_t = \bigg[f(t){\bm{x}}_t - \frac{1}{2}g^2(t) {\bm{s}}_\theta({\bm{x}}_t,t)\bigg] \mathrm{d}t. \label{Eq:prob_ode} \end{equation} Then the final solution ${\bm{x}}_0$ at time $0$ is the sample from the diffusion models. \section{Method} \label{Method} We propose a Selecting-from-Behavior-Candidates (SfBC) approach to address the limited expressivity problem in offline RL. Below we first motivate our method by highlighting the importance of a distributionally expressive policy in learning from diverse behaviors. Then we derive a high-level solution to this problem from a generative modeling perspective. \subsection{Learning from Diverse Behaviors} \label{motivation} In this section, we show that the weighted regression broadly used in previous works might limit the distributional expressivity of the policy and lead to performance degrade. As described in Section \ref{Sec:weighted_regression}, conventional policy regression methods project the optimal policy $\pi^*$ in \Eqref{Eq:pi_optimal} onto a parameterized policy set. In continuous action-space domains, the projected policy is usually limited to a narrow range of unimodal distributions (e.g., squashed Gaussian), whereas the behavior policy could be highly diverse (e.g., multimodal). Lack of expressivity directly prevents the RL agent from exactly mimicking a diverse behavior policy. This could eventually lead to sampling undesirable out-of-sample actions during policy evaluation and thus large extrapolation error. Even if Q-values can be accurately estimated, an inappropriate unimodal assumption about the optimal policy might still lead to failure in extracting a policy that might have multiple similarly rewarding but distinctive action choices. \begin{wrapfigure}{r}{0.555\textwidth}{ \vskip -0.45cm \sbox{\measurebox}{% \begin{minipage}[b]{.27\textwidth} \centering \vskip 0.2cm \subfloat{\label{fig:figB}\hspace{-0.1cm}\includegraphics[width=0.95\textwidth]{pics/toydrawleft.drawio.pdf}} \vfill \vskip 0.4cm \subfloat{\label{fig:figC}\includegraphics[width=\textwidth]{pics/toypolicyillustration.pdf}} \end{minipage} } \usebox{\measurebox} \begin{minipage}[b][\ht\measurebox][s]{.27\textwidth} \vskip 0.1cm \centering \subfloat{\label{fig:figA}\includegraphics[width=\textwidth]{pics/toyresultcomparison.pdf}} \end{minipage} \caption{Illustration of the Bidirectional-Car task and comparison between SfBC and unimodal policies. See Section \ref{lfdb} for experimental details.} \label{fig:illustration} \vskip -0.3cm } \end{wrapfigure} We design a simple task named Bidirectional Car to better explain this point. Consider an environment where a car placed in the middle of two endpoints can go either side to gain the final reward. If an RL agent finds turning left and right similarly rewarding, by incorrectly assuming a unimodal distribution of the behavior policy, it ends up staying put instead of taking either one of the optimal actions (Figure \ref{fig:illustration}). As a result, unimodal policies fail to completely solve this task or loss diversity while a more distributionally expressive policy easily succeeds. We therefore deduce that distributional expressivity is a necessity to enable diverse behavior learning. To better model the complex behavior policy, we need more powerful generative modeling for the policy distribution, instead of the simple and unimodal Gaussians. \subsection{Selecting from Behavior Candidates} In this section, we provide a generative view of how to model a potentially diverse policy. Specifically, in order to model $\pi^*$ with powerful generative models, essentially we need to perform maximum likelihood estimation for the model policy $\pi_\theta$, which is equivalent to minimizing KL divergence between the optimal and model policy: \begin{equation} \mathop{\mathrm{arg \ max}}_{\theta} \quad \mathbb{E}_{{\bm{s}} \sim \mathcal{D}^\mu} \mathbb{E}_{a \sim \pi^*(\cdot | s)}\left[\log \pi_\theta(a|s) \right] \ \Leftrightarrow \ \mathop{\mathrm{arg \ min}}_{\theta} \quad \mathbb{E}_{{\bm{s}} \sim \mathcal{D}^\mu} \left[ D_{\mathrm{KL}} \left(\pi^*(\cdot | {\bm{s}}) \middle|\middle| \pi_{\theta}(\cdot | {\bm{s}})\right) \right]. \end{equation} However, drawing samples directly from $\pi^*$ is difficult, so previous methods \citep{awr, awac, crr} rely on the weighted regression as described in \Eqref{Eq:wr}. The main reason that limits the expressivity of $\pi_\theta$ is the need of calculating exact and derivable density function $\pi_\theta({\bm{a}} | {\bm{s}})$ in policy regression, which places restrictions on distribution classes that we can choose from. Also, we might not know what the behavior or optimal policy looks like previously. Our solution is based on a key observation that directly parameterizing the policy $\pi$ is not necessary. To better model a diverse policy, we propose to decouple the learning of $\pi$ into two parts. Specifically, we leverage \Eqref{Eq:pi_optimal} to form a policy improvement step: \begin{equation} \label{Eq:decouple} \pi({\bm{a}}|{\bm{s}}) \propto \mu_\theta({\bm{a}}|{\bm{s}}) \ \mathrm{exp}\left(\alpha Q_\phi({\bm{s}},{\bm{a}}) \right). \end{equation} One insight of the equation above is that minimizing KL divergence between $\mu$ and $\mu_\theta$ is much easier compared with directly learning $\pi_\theta$ because sampling from $\mu$ is straightforward given $D^\mu$. This allows to us to leverage most existing advances in generative modeling (Section \ref{dbc}). $Q_\phi(s,a)$ could be learned using the existing Q-learning framework (Section \ref{imp}). The inverse temperature parameter $\alpha$ in \Eqref{Eq:decouple} serves as a trade-off between conservative and greedy improvement. We can see that when $\alpha \to 0$, the learned policy falls back to the behavior policy, and when $\alpha \to +\infty$ the learned policy becomes a greedy policy. To sample actions from $\pi$, we use an importance sampling technique. Specifically, for any state ${\bm{s}}$, first we draw $M$ action samples from a learned behavior policy $\mu_\theta(\cdot|{\bm{s}})$ as candidates. Then we evaluate these action candidates with a learned critic $Q_\phi$. Finally an action is resampled from $M$ candidates with $\mathrm{exp}\left(\alpha Q_\phi({\bm{s}},{\bm{a}}) \right)$ being the sampling weights. We summarize this procedure as selecting from behavior candidates (SfBC), which could be understood as an analogue to rejection sampling. The main difference between our method and previous works is that we do not seek to fit a parameterized model $\pi_\theta$ to $\pi^*$. Although generative modeling of the behavior policy has been explored by several works \citep{bcq, bear}, it was mostly used to form an explicit distributional constraint for the policy model $\pi_\theta$. In contrast, we show directly leveraging the learned behavior model to generate actions is not only feasible but beneficial on the premise that high-fidelity behavior modeling can be achieved. We give a practical implementation in the next section. \section{Practical Implementation} In this section, we derive a practical implementation of SfBC, which includes diffusion-based behavior modeling and planning-based Q-learning. An algorithm overview is given in Appendix \ref{overview}. \subsection{Diffusion-based behavior modeling} \label{dbc} It is critical that the learned behavior model is of high fidelity because generating any out-of-sample actions would result in unwanted extrapolation error, while failing to cover all in-sample actions would restrict feasible action space for the policy. This requirement brings severe challenges to existing behavior modeling methods, which mainly include using Gaussians or VAEs. Gaussian models suffer from limited expressivity as we have discussed in Section \ref{motivation}. VAEs, on the other hand, need to introduce a variational posterior distribution to optimize the model distribution, which has a trade-off between the expressivity and the tractability~\citep{kingma2016improved, lucas2019understanding}. This still limits the expressivity of the model distribution. An empirical study is given in Section \ref{Sec:ablation}. To address this problem, we propose to learn from diverse behaviors using diffusion models \citep{diffusion}, which have recently achieved great success in modeling diverse image distributions \citep{dalle2, imagen}, outperforming other generative models \citep{diffusion_beat_gan}. Specifically, we follow \citet{sde} and learn a state-conditioned diffusion model $s_\theta$ to predict the time-dependent noise added to the action ${\bm{a}}$ sampled from the behavior policy $\mu(\cdot|{\bm{s}})$: \begin{equation} \theta = \mathop{\mathrm{arg \ min}}_{\theta} \quad \mathbb{E}_{({\bm{s}}, {\bm{a}}) \sim D^\mu,\bm{\epsilon}, t}[\| \sigma_t \mathbf{s}_\theta(\alpha_t{\bm{a}}+\sigma_t\bm{\epsilon}, {\bm{s}}, t) + \bm{\epsilon} \|_2^2], \end{equation} where $\bm{\epsilon}\sim \mathcal{N}(0,\bm{I})$, $t\sim\mathcal{U}(0,T)$. $\alpha_t$ and $\sigma_t$ are determined by the forward diffusion process. Intuitively $s_\theta$ is trained to denoise ${\bm{a}}_t := \alpha_t {\bm{a}} + \sigma_t \bm{\epsilon}$ into the unperturbed action ${\bm{a}}$ such that ${\bm{a}}_T \sim \mathcal{N}(0,\bm{I})$ can be transformed into ${\bm{a}} \sim \mu_\theta(\cdot|{\bm{s}})$ by solving an inverse ODE defined by $s_\theta$ (\Eqref{Eq:prob_ode}). \subsection{Q-learning via in-sample planning} \label{imp} Generally, Q-learning can be achieved via the Bellman expectation operator: \begin{equation} \label{Eq:one_step_bellman} \mathcal{T}^\pi Q({\bm{s}}, {\bm{a}}) = r({\bm{s}}, {\bm{a}}) + \gamma\mathbb{E}_{{\bm{s}}' \sim P(\cdot|{\bm{s}},{\bm{a}}), {\bm{a}}' \sim \pi(\cdot|{\bm{s}}')} Q({\bm{s}}', {\bm{a}}'). \end{equation} However, $\mathcal{T}^\pi$ is based on one-step bootstrapping, which has two drawbacks: First, this can be computationally inefficient due to its dependence on many steps of extrapolation. This drawback is exacerbated in diffusion settings since drawing actions from policy $\pi$ in \Eqref{Eq:one_step_bellman} is also time-consuming because of many iterations of Langevin-type sampling. Second, estimation errors may accumulate over long horizons. To address these problems, we take inspiration from episodic learning methods \citep{MFEC, vem} and propose a planning-based operator $\mathcal{T}^\pi_\mu$: \begin{equation} \label{Eq:planning_operator} \mathcal{T}^\pi_\mu Q({\bm{s}}, {\bm{a}}) := \max_{n \geq 0}\{(\mathcal{T}^{\mu})^{n}\mathcal{T}^{\pi}Q({\bm{s}}, {\bm{a}})\}, \end{equation} where $\mu$ is the behavior policy. $\mathcal{T}^\pi_\mu$ combines the strengths of both the n-step operator $(\mathcal{T}^{\mu})^{n}$, which enjoys a fast contraction property, and the operator $\mathcal{T}^\pi$, which has a more desirable fixed point. We prove in Appendix \ref{analysis} that $\mathcal{T}^\pi_\mu$ is also convergent, and its fixed point is bounded between $Q^\pi$ and $Q^*$. Practically, given a dataset $\mathcal{D}^\mu = \{(s_n, a_n, r_n)\}$ collected by behavior $\mu$, with $n$ being the timestep in a trajectory. We can rewrite \Eqref{Eq:planning_operator} in a recursive manner to calculate the Q-learning targets: \begin{align} \label{Eq:planning:1} &R_{n}^{(k)} = r_n + \gamma\max(R_{n+1}, V_{n+1}^{(k-1)}), \\ \label{Eq:planning:2} \text{where} \quad &V_{n}^{(k-1)} := \mathbb{E}_{{\bm{a}} \sim \pi(\cdot|{\bm{s}}_n)} Q_\phi({\bm{s}}_n, {\bm{a}}), \\ \text{and} \quad &\phi = \mathop{\mathrm{arg \ min}}_{\phi} \quad \mathbb{E}_{({\bm{s}}_n, {\bm{a}}_n) \sim \mathcal{D}^\mu} \| Q_\phi({\bm{s}}_n, {\bm{a}}_n) - R_n^{(k-1)} \|_2^2. \end{align} Above $k \in \{1, 2, \dots \}$ is the iteration number. We define $R_{n}^{(0)}$ as the vanilla return of trajectories. \Eqref{Eq:planning:1} offers an implicit planning scheme within dataset trajectories that mainly helps to avoid bootstrapping over unseen actions and to accelerate convergence. \Eqref{Eq:planning:2} enables the generalization of actions in similar states across different trajectories (stitching together subtrajectories). Note that we have omitted writing the iteration superscript of $\pi$ and $\mu$ for simplicity. During training, we alternate between calculating new Q-targets $R_n$ and fitting the action evaluation model $Q_\phi$. The operator $\mathcal{T}^\pi_\mu$ is similar to the multi-step estimation operator $\mathcal{T}_{\text{vem}}$ proposed by \citet{vem}. A notable difference between the two operators is that $\mathcal{T}_{\text{vem}}$ is combined with expectile regression, and thus can only apply to deterministic environments, while our method also applies to stochastic settings. However, unlike $\mathcal{T}_{\text{vem}}$, $\mathcal{T}^\pi_\mu$ does not share the same fixed point with $\mathcal{T}^\pi$. \begin{figure*} [t] \centering \includegraphics[width=1.00\textwidth]{pics/ant-medium-diverse-value.pdf} \caption{ Visualizations of the implicitly planned Q-targets $R_n^{(k)}$ sampled from the dataset of an AntMaze task in four subsequent value iterations. The red pentagram stands for the reward signal. Implicit planning helps to iteratively stitch together successful subtrajectories. } \label{fig:ant_stitch} \end{figure*} \section{Related Work} \label{Related} \textbf{Reducing extrapolation error in offline RL}. Offline RL typically requires careful trade-offs between maximizing expected returns and staying close to the behavior policy. Once the learned policy deviates from the behavior policy, extrapolation error will be introduced in dynamic programming, leading to performance degrade \citep{bcq}. Several works propose to address this issue by introducing either policy regularization on the distributional discrepancy with the behavior policy \citep{bcq, bear, brac, minimal}, or value pessimism about unseen actions \citep{cql, fisher}. Another line of research directly extracts policy from the dataset through weighted regression, hoping to avoid selecting unseen actions \citep{awr, awac, crr}. However, some recent works observe that the trade-off techniques described above are not sufficient to reduce extrapolation error, and propose to learn Q-functions through expectile regression without ever querying policy-generated actions \citep{iql, vem}. Unlike them, We find that limited policy expressivity is the main reason that introduces extrapolation error in previous weighted regression methods, and use an expressive policy model to help reduce extrapolation error. \textbf{Dynamic programming over long horizons}. Simply extracting policies from behavior Q-functions can yield good performance in many D4RL tasks because it avoids dynamic programming and therefore the accompanied extrapolation error \citep{awr, bail, noeval}. However, this method performs poorly in tasks that have sparse rewards and require stitching together successful subtrajectories (e.g., Maze-like environments). Such tasks are also challenging for methods based on one-step bootstrapping because they might require hundreds of steps to reach the reward signal, with the reward discounted and estimation error accumulated along the way. Episodic memory-based methods address this problem by storing labeled experience in the dataset, and plans strictly within the trajectory to update evaluations of every decision \citep{MFEC, gem, vem}. The in-sample planning scheme allows dynamic programming over long horizons to suppress the accumulation of extrapolation error, which inspires our method. \textbf{Generative models for behavior modeling}. Cloning diverse behaviors in a continuous action space requires powerful generative models. In offline RL, several works \citep{bcq, bear, brac} have tried using generative models such as Gaussians or VAEs \citep{vae} to model the behavior policy. However, the learned behavior model only serves as an explicit distributional constraint for another policy during training. In broader RL research, generative adversarial networks \citep{gan}, normalizing flows \citep{flow} and energy-based models \citep{EBM} have also been used for behavior modeling \citep{gail,Parrot, EBI}. Recently, diffusion models \citep{diffusion} have achieved great success in generating diverse and high-fidelity image samples \citep{diffusion_beat_gan}. However, exploration of its application in behavior modeling is still limited. \citet{diffuser} proposes to solve offline tasks by iteratively denoising trajectories, while our method uses diffusion models for single-step decision-making. \section{Experiments} In the following sections, we evaluate the performance of SfBC using several related or state-of-the-art offline RL methods as baselines. We additionally gain insight into SfBC by studying the following two questions: 1) How does SfBC benefit from an expressive generative policy in performing diverse behavior learning? 2) Which part of SfBC has a strong influence on the performance of the algorithm? \begin{table*}[t] \centering \small \resizebox{1.0\textwidth}{!}{% \begin{tabular}{llccccccccc} \toprule \multicolumn{1}{c}{\bf Dataset} & \multicolumn{1}{c}{\bf Environment} & \multicolumn{1}{c}{\bf SfBC (Ours)}& \multicolumn{1}{c}{\bf IQL} & \multicolumn{1}{c}{\bf VEM} & \multicolumn{1}{c}{\bf AWR} & \multicolumn{1}{c}{\bf BAIL} & \multicolumn{1}{c}{\bf BCQ} & \multicolumn{1}{c}{\bf CQL}& \multicolumn{1}{c}{\bf DT} & \multicolumn{1}{c}{\bf Diffuser} \\ \midrule Medium-Expert & HalfCheetah & $\bf{91.4 \pm 0.5}$ & $86.7 $& - & $52.7$ & $72.2$ & $64.7$ & $62.4$ & $\bf{86.8}$ & $ 79.8$ \\ Medium-Expert & Hopper & $\bf{110.4 \pm 0.9}$ & $ 91.5$& - & $27.1$ & $\bf{106.2}$ & $100.9$ & $98.7$ & $\bf{107.6}$ & $\bf{107.2}$ \\ Medium-Expert & Walker & $\bf{109.2 \pm 0.3}$ & $\bf{109.6}$& - & $53.8$ & $\bf{107.2}$ & $57.5$ & $\bf{111.0}$& $\bf{108.1}$& $\bf{108.4}$ \\ \midrule Medium & HalfCheetah & $ 42.4\pm 0.1$ & $\bf{47.4}$& $\bf{47.4}$& $37.4$ & $30.0$ & $40.7$ & $44.4$ & $42.6$ & $ 44.2$ \\ Medium & Hopper & $\bf{65.3 \pm 4.9}$ & $\bf{66.3}$& $56.6$ & $35.9$ & $62.2$ & $54.5$ &$ 58.0 $ & $\bf{67.6}$ & $58.5$ \\ Medium & Walker & $\bf{78.3\pm 1.0}$ & $\bf{78.3}$& $74.0$ & $17.4$ & $73.4$ & $53.1$ &$\bf{79.2}$ & $74.0$ & $\bf{79.7}$ \\ \midrule Medium-Replay & HalfCheetah & $ 38.1 \pm 2.1$& $\bf{44.2}$& - & $40.3$ & $40.3$ & $38.2$ &$\bf{46.2}$ & $36.6$ & $42.2$ \\ Medium-Replay & Hopper & $72.3 \pm 4.4$ & $\bf{94.7}$& - & $28.4$ & $\bf{94.7}$& $33.1$ & $48.6$ & $82.7$ & $\bf{96.8}$ \\ Medium-Replay & Walker & $\bf{71.9 \pm 4.2}$ & $\bf{73.9}$& - & $15.5$ & $58.8$ & $15.0$ & $26.7$ & $66.6$ & $61.2$ \\ \midrule \multicolumn{2}{c}{\bf Average (Locomotion)}&$\bf{75.5}$ & $\bf{76.9}$ & - & $34.3$ & $71.6$ & $51.9$ & $63.9$ & $\bf{74.7}$ & $\bf{75.3}$ \\ \specialrule{.05em}{.4ex}{.1ex} \specialrule{.05em}{.1ex}{.65ex} Default & AntMaze-umaze & $\bf{93.3 \pm 4.7}$ & $87.5$& $87.5$ & $56.0$ & $85.0$ & $78.9$ & $74.0$ & $59.2$ & - \\ Diverse & AntMaze-umaze & $\bf{86.7 \pm 4.7}$ & $62.2 $ & $78.0$ & $70.3$ & $76.7$ & $55.0$ &$\bf{84.0}$ & $53.0$ & - \\ \midrule Play & AntMaze-medium & $\bf{88.3 \pm 8.5}$ & $71.2$ & $78.0$ & $0.0$ & $15.0$ & $0.0$ & $61.2$ & $0.0$ & - \\ Diverse & AntMaze-medium & $\bf{90.0 \pm 4.1}$ & $70.0$ & $77.0$ & $0.0$ & $23.3$ & $0.0$ & $53.7$ & $0.0$ & - \\ \midrule Play & AntMaze-large & $\bf{63.3 \pm 2.4}$ & $39.6$ & $57.0$ & $0.0$ & $0.0$ & $6.7$ & $15.8$ & $0.0$ & - \\ Diverse & AntMaze-large & $41.7 \pm 7.1$ & $47.5$ & $\bf{58.0}$ & $0.0$ & $8.3$ & $2.2$ & $14.9$ & $0.0$ & - \\ \midrule \multicolumn{2}{c}{\bf Average (AntMaze)}& $\bf{77.2}$ & $63.0$ & $72.6$ & $21.0$ & $46.7$ & $23.8$ & $50.6$ & $18.7$ & - \\ \specialrule{.05em}{.4ex}{.1ex} \specialrule{.05em}{.1ex}{.65ex} \multicolumn{2}{c}{\bf Average (Maze2d)}& $74.0$ & $50.0$ & - & $10.8$ & - & $9.1$ & $7.7$ & - & $\bf{119.5}$ \\ \specialrule{.05em}{.4ex}{.1ex} \specialrule{.05em}{.1ex}{.65ex} \multicolumn{2}{c}{\bf Average (FrankaKitchen)}& $\bf{57.1}$ & $53.3$ & - & $8.7$ & - & $11.7$ & $48.2$ & - & - \\ \specialrule{.05em}{.4ex}{.1ex} \specialrule{.05em}{.1ex}{.65ex} Both-side & Bidirectional-Car&$\bf{100.0 \pm 0.0}$& $15.7$ & $0.0$ & $0.0$ & $52.0$ & $88.0$ & $42.3$ & $33.3$ & - \\ Single-side & Bidirectional-Car&$\bf{100.0 \pm 0.0}$& $\bf{100.0}$ & $\bf{100.0}$& $\bf{96.3}$ & $\bf{100.0}$ & $\bf{100.0}$ & $\bf{100.0}$ & $\bf{100.0}$ & - \\ \bottomrule \end{tabular} } \caption{ Evaluation numbers of SfBC. We report the mean and standard deviation over three seeds for SfBC. Scores are normalized according to \citet{d4rl}. Numbers within 5 percent of the maximum in every individual task are highlighted in boldface. Sources of referenced scores and experimental details are provided in Appendix \ref{details}. Note that Diffuser leverages the prior knowledge that Maze2d is a goal-based environment in ``trajectory inpainting'' while other algorithms don't.} \label{tbl:results} \end{table*} \subsection{Evaluations on D4RL Benchmarks} In Table \ref{tbl:results}, we compare the performance of SfBC to multiple offline RL methods in several D4RL \citep{d4rl} tasks. \texttt{MuJoCo locomotion} is a classic benchmark where policy-generated datasets only cover a narrow part of the state-action space, so avoiding querying out-of-sample actions is critical \citep{bcq, cql}. The Medium dataset of this benchmark is generated by a single agent, while the Medium-Expert and the Medium-Replay dataset are generated by a mixture of policies. \texttt{AntMaze} is about an ant robot navigating itself in a maze, which requires both low-level robot control and high-level navigation. Since the datasets consist of undirected trajectories, solving AntMaze typically requires the algorithm to have strong ``stitching'' ability \citep{d4rl}. Different environments contain mazes of different sizes, reflecting different complexity. \texttt{Maze2d} is very similar to AntMaze except that it's about a ball navigating in a maze instead of an ant robot. \texttt{FrankaKitchen} are robot-arm manipulation tasks. We only focus on the analysis of MuJoCo locomotion and AntMaze tasks due to the page limit. Our choices of referenced baselines are detailed in Appendix \ref{choice_baseline}. Overall, SfBC outperforms most existing methods by large margins in complex tasks with sparse rewards such as AntMaze. We notice that VEM also achieves good results in AntMaze tasks and both methods share an implicit in-sample planning scheme, indicating that episodic planning is effective in improving algorithms' stitching ability and thus beneficial in Maze-like environments. In easier locomotion tasks, SfBC provides highly competitive results compared to state-of-the-art algorithms. It can be clearly shown that performance gain is large in datasets generated by a mixture of distinctive policies (Medium-Expert) and is relatively small in datasets that are highly uniform (Medium). This is reasonable because SfBC is motivated to better model diverse behaviors. \subsection{Learning from Diverse Behaviors} \label{lfdb} \begin{figure} [t] \centering \includegraphics[width=1.00\textwidth]{pics/toy-action-visualize32.pdf} \caption{ Visualizations of actions taken by different RL agents in the Bidirectional-Car task. The ground truth corresponds to an agent which always takes the best actions, which is either 1.0 or -1.0. White space indicates suboptimal decisions. Green bounding boxes indicate possible initial states. } \label{fig:toyacion} \end{figure} In this section, we analyze the benefit of modeling behavior policy using highly expressive generative models. Although SfBC outperforms baselines in many D4RL tasks. The improvement is mainly incremental, but not decisive. We attribute this to the lack of multiple optimal solutions in existing benchmarks. To better demonstrate the necessity of introducing an expressive generative model, we design a simple task where a heterogeneous dataset is collected in an environment that allows two distinctive optimal policies. \textbf{Bidirectional-Car task}. As depicted in Figure \ref{fig:illustration}, we consider an environment where a car is placed in the middle of two endpoints. The car chooses an action in the range [-1,1] at each step, representing throttle, to influence the direction and speed of the car. The speed of the car will \textit{monotonically} increase based on the absolute value of throttle. The direction of the car is determined by the sign of the current throttle. Equal reward will be given on the arrival of either endpoint within the rated time. It can be inferred with ease that, in any state, the optimal decision should be either 1 or -1, which is not a unimodal distribution. The collected dataset also contains highly diverse behaviors, with an approximately equal number of trajectories ending at both endpoints. For the comparative study, we collect another dataset called ``Single-Side'' where the only difference from the original one is that we remove all trajectories ending at the left endpoint from the dataset. We test our method against several baselines, with the results given in Table \ref{tbl:results}. Among all referenced methods, SfBC is the only one that can always arrive at either endpoint within rated time in the Bidirectional-Car environment, whereas most methods successfully solve the ``Single-Side'' task. To gain some insight into why this happens, we illustrate the decisions made by an SfBC agent and other RL agents in the 2-dimensional state space. As is shown in Figure \ref{fig:toyacion}, the SfBC agent selects actions of high absolute values at nearly all states, while other unimodal actors fail to pick either one of the optimal actions when presented with two distinctive high-rewarding options. Therefore, we conclude that an expressive policy is necessary for performing diverse behavior learning. \subsection{Ablation Studies} \label{Sec:ablation} \begin{table*}[t] \centering \small \begin{tabular}{cccccc} \toprule \multicolumn{1}{c}{\bf Taks} & \multicolumn{1}{c}{\bf SfBC }& \multicolumn{1}{c}{\bf SfBC + Gaussian} & \multicolumn{1}{c}{\bf SfBC + VAE} & \multicolumn{1}{c}{\bf SfBC - Planning} \\ \midrule Medium-Expert & $\bf{103.7 \pm 0.6}$& $86.2 \pm 4.7$ & $95.5 \pm 4.8$ & $\bf{103.3 \pm 0.9} $ \\ Medium & $\bf{62.0 \pm 2.9}$ & $\bf{60.9} \pm 1.1$ & $\bf{62.7 \pm 2.5} $ & $\bf{60.9 \pm 2.5} $ \\ Medium-Replay & $\bf{60.8 \pm 3.6}$ & $56.6 \pm 4.6$ & $54.4 \pm 3.7 $ & $52.8 \pm 1.5 $ \\ \midrule \multicolumn{1}{c}{\bf Average (Locomotion)}& $\bf{75.5 \pm 2.3}$ & $67.9 \pm 3.3$ & $70.9 \pm 3.5 $ & $\bf{72.3 \pm 1.8} $ \\ \midrule AntMaze-umaze & $\bf{90.0 \pm 4.7}$& $\bf{90.8 \pm 2.4}$ & $85.0 \pm 3.7$ & $\bf{88.4 \pm 8.3}$ \\ AntMaze-medium & $\bf{89.2 \pm 6.7}$ & $82.5 \pm 5.8$ & $66.7 \pm 5.3 $ & $34.2 \pm 5.3 $ \\ AntMaze-large & $\bf{52.5 \pm 5.3}$ & $35.0 \pm 7.8$ & $27.5 \pm 5.8 $ & $7.5 \pm 6.9 $ \\ \midrule \multicolumn{1}{c}{\bf Average (AntMaze)}& $\bf{77.2 \pm 5.2}$ & $69.4 \pm 5.8$ & $59.7 \pm 4.8 $ & $43.3 \pm 5.5 $ \\ \bottomrule \end{tabular} \caption{Ablations of generative modeling methods and the implicit planning method. We report performance numbers averaged over three random seeds and multiple similar tasks. Detailed experimental results appear in Appendix \ref{missing}.} \label{tbl:ablation} \end{table*} We provide experimental results for several variants of SfBC in Table \ref{tbl:ablation}. \textbf{Diffusion vs. other generative models}. Our first ablation study aims to evaluate 3 variants of SfBC which are respectively based on diffusion models \citep{diffusion}, Gaussian probabilistic models and latent-based models (VAEs, \citet{vae}). The three variants use exactly the same training framework with the only difference being the behavior modeling method. The diffusion-based policy outperforms the other two variants by a clear margin in most experiments, especially in tasks with heterogeneous datasets (e.g., Medium-Expert), indicating that diffusion models are fit for ``high-fidelity'' behavior modeling. \textbf{Implicit in-sample planning}. To study the importance of implicit in-sample planning on the performance of SfBC, we first visualize the estimated state values learned at different iterations of Q-learning in an AntMaze environment (Figure \ref{fig:ant_stitch}). We can see that implicit planning helps to iteratively stitch together successful subtrajectories and provides optimistic action evaluations. Then we compare SfBC to a variant that removes the iterative planning scheme and instead learns the Q-function purely from vanilla returns. As shown in Table \ref{tbl:ablation}, implicit planning is beneficial in complex tasks like AntMaze-Medium and AntMaze-Large. However, it is less important in MuJoCo-locomotion tasks, except for Medium-Replay tasks in which many data trajectories suffer from an early-truncated problem and requires dynamic programming for more accurate evaluations. This finding is consistent with a prior work \citep{noeval}. \section{Conclusion} In this work, we address the problem of limited policy expressivity in previous weighted regression methods by decoupling the policy model into a behavior model and an action evaluation model. Such decoupling allows us to use a highly expressive diffusion model for high-fidelity behavior modeling, which is further combined with a planning-based operator to reduce extrapolation error. Our method enables learning from a heterogeneous dataset in a continuous action space while avoiding selecting out-of-sample actions. Experimental results on the D4RL benchmark show that our approach outperforms state-of-the-art algorithms in most tasks. With this work, we hope to draw attention to the application of high-capacity generative models in offline RL.
{'timestamp': '2022-09-30T02:07:20', 'yymm': '2209', 'arxiv_id': '2209.14548', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14548'}
arxiv
\section*{Acknowledgments} This work was supported by the funds of Research Project of the National Language Commission (No. ZDI135-131, No. ZDI145-24) and Fundamental Research Funds for the Central Universities in BLCU (No. 21PT04). We would like to thank all anonymous reviewers for their valuable comments and suggestions on this work. \bibliographystyle{ccl} \section{Introduction} Definition Generation (DG) is the task of describing the meaning that a word takes in a specific context. This task can help language learners by providing explanations for unfamiliar words. Recent researches \cite{Ishiwatari2019LearningTD,Zheng2021DecomposeFA} attempted to apply the task to the field of Intelligent Computer-Assisted Language Learning (ICALL), and have made a significant progress. Previous studies on DG mainly concentrate on generating different definitions for polysemous words \cite{Gadetsky2018ConditionalGO,Mickus-2019-mark,Reid-2020-vcdm}, or generating definitions with appropriate specificity \cite{Huang-2021-definition}. In these studies, researchers have faced various issues, such as the high complexity problem. High complexity definitions contain words that are more difficult than the defined word, and hence are labored for language learners to read and understand. Nevertheless, there have been few focuses on complexity controllable generation of definitions. A possible reason is that the complexities of definitions are not provided in currently existed datasets, which leads to the difficulty of automatic training and evaluation. Actually, the problems mentioned above are especially prominent in the language environment of Chinese. Definitions with suitable complexity are in urgent practical needs for Chinese as Foreign Language (CFL) learners. According to the Ministry of Education of China, by the end of 2020, more than 20 million foreign students are learning Chinese. But as \newcite{zhang-2011-duiwai} pointed out, since the difficulty of definitions is not considered, most existing dictionaries cannot meet CFL learner’s requirements. Besides, the existing Chinese learner dictionaries contain only a small number of words. For instance, the Contemporary Chinese Learner Dictionary (CCLD) only has about 6,400 words. In contrast, the Modern Chinese Dictionary (MCD), which is designed for native speakers, has about 69,000 words. Therefore, in this work, we focus on the task of generating definitions for CFL learners with appropriate complexities. At present, there are two datasets used for the Chinese definition generation task, but neither of them can meet the needs of this task. The most widely used CWN dataset \cite{Yang2020IncorporatingSI,Fan2020BERTChineseDM,Kong-2020-Toward} was built from the Chinese WordNet \cite{huang-2010-chinese}, which is a knowledge base of sense distinction\footnote{\url{http://lope.linguistics.ntu.edu.tw/cwn2}}. This dataset is limited in size with 8,221 words. \newcite{Zheng2021DecomposeFA} constructed a dataset from the 5th edition of MCD. But it only collects disyllabic nouns and verbs, and additional annotation of formation rules is required. Besides, both datasets didn't provide the complexity of definitions, which is essential information in the controllable generation. To enhance the study of this task, we propose to build a novel benchmark dataset named \textbf{COMPILING} (\textbf{C}hinese c\textbf{OMP}lex\textbf{I}ty contro\textbf{L}lable def\textbf{IN}ition \textbf{G}eneration). The dataset is large and of high quality, which contains 127,757 entries in total. Each entry consists of a word, an example, a definition, and two complexity measurements of this definition. More specifically, we build the dataset by using two Chinese dictionaries, namely the CCLD and the 7th edition of MCD. The former collects fewer words, but the definitions are simpler. The latter is the opposite. By combining these two dictionaries, we obtain a large amount of definitions that vary in different complexities. In order to quantitatively measure the \textit{complexity} of definitions, we refer to the graded vocabularies formulated by HSK (Chinese Proficiency Test). HSK is set up to test the proficiency of non-native speakers. It has nine levels from easy to hard, and each level corresponds to a vocabulary. The COMPILING dataset contains an average level and a maximum level of each definition. We find that both dictionaries tend to use phrases rather than complete sentences as examples in some cases. For instance, the word “\chinese{规模}” (scale) has two example phrases in MCD (Modern Chinese Dictionary), which are “\chinese{规模宏大}” (large scale) and “\chinese{初具规模}” (begin to take shape). We think that short phrases might be helpful for language learners to understand, but complete sentences can provide more context in the automatic definition generation. Thus, we design an algorithm to expand the phrases into sentences (Section \ref{section:expand-algo}). We believe that this dataset can further enhance the research on Chinese complexity controllable definition generation, which could not only benefit the language learners, but also low literacy readers, as well as people with aphasia or dyslexia. We also provide baselines of mainstream generation methods as references (Section \ref{section:experiments}). In summary, our contributions are listed below: \begin{itemize} \item{We propose a novel task of generating definitions for a word with appropriate complexity. The task is of great use in helping CFL learners to learn the vocabulary.} \item{ We propose the \textbf{COMPILING} dataset that is of large scale and high quality. This dataset could serve as the benchmark of the task we proposed.} \item {We perform several experiments on the COMPILING dataset and the results demonstrate it could assist models to achieve effective complexity controllable generations.} \end{itemize} \section{ Related Work} \subsection{Definition Generation} \newcite{Noraset2017DefinitionML} first proposed the definition modeling task and use word embeddings to generate definitions of the corresponding words. Referencing on the problem of word sense disambiguation, \newcite{Ishiwatari2019LearningTD} and \newcite{Gadetsky2018ConditionalGO} incorporated word contexts into definition modeling and demonstrated its effectiveness of distinguishing different meanings. Recent work \cite{Huang2021CDMCE} reformulates the task as generating descriptions using extracted knowledge. Research on Chinese definition modeling was first proposed by \newcite{Yang2020IncorporatingSI}, they adapted a transformer-based model and incorporated sememes into the model to provide more external semantic knowledge. \newcite{Fan2020BERTChineseDM} redefined the Chinese definition modeling as generating the corresponding definition for a target word and its context. \newcite{Zheng2021DecomposeFA} utilized the characteristics of Chinese by adding formation features to enhance definition modeling. Besides, there are also studies on multilingual definition generation \cite{Kong-2020-Toward} and combining extraction and generation for this task \cite{huang-2021-cdm}. Notably, \newcite{kong-etal-2022-multitasking} proposed to generate simple definitions employing a multitasking framework. Since the lack of a definition dataset with different complexities, they managed to generate both complex and simple definitions in an unsupervised way. Differently, we focus on building the benchmark dataset for different Chinese definition generation tasks and hope it could be beneficial for further research. \subsection{Controllable Generation} Controllable generation is widely adapted in kinds of language modeling tasks. For instance, data augmentation \cite{AminNejad2020ExploringTT}, dialog generation \cite{Firdaus2020EmoSenGS}, storytelling \cite{GoldfarbTarrant2020ContentPF}, and so on. And the objects controlled in different studies vary from each other. Specifically, considering the significance of sentiment in poetry definition, \newcite{Chen2019SentimentControllableCP} proposed a model to generate poetry with controllable emotions. \newcite{Gao2019DifficultyCG} first presented a framework to develop questions about specific answers that meet target difficulty levels. To attract more readers, \newcite{Jin2020HooksIT} introduced a headline generation model to produce enticing titles with target three styles. Likewise, in order to explore and release the practical value of definition generation, we propose the complexity controllable definition generation task committed to producing definitions satisfying users of all levels. Currently, the most controllable generation tasks are achieved based on pre-trained learning models. And \newcite{Zhang2022ASO} summarized the common methods as Finetuning, Retrain PLMs, and Post-Process. And we utilize the first method to control the complexity of the definition more efficiently. \subsection{Prompt Learning} In recent years, the pre-trained model with fine-tuning has gradually become the mainstream of natural language processing tasks. Due to the complex training objectives and large hyperparameter groups, large-scale pre-training models can effectively extract features from a large amount of supervised and unsupervised data. By storing the learned knowledge in parameters and fine-tuning the model for specific tasks, the same model can be applied to a series of downstream natural language processing tasks \cite{Han2021PreTrainedMP}. Prompt learning is a method of fully learning knowledge by adding additional text to the model’s input. Prompt can be divided into artificial and automatic construction according to the text attached to the input \cite{Han2021PreTrainedMP}. Among them, automatically constructed prompts are divided into discrete and continuous ones. A discrete prompt refers to the fact that the constructed prompt is composed of actual text symbols, and applicable tasks include text classification \cite{Han2021PTRPT}, text generation \cite{Zheng2021ExploringPF}, etc. Although the combination of pre-training and fine-tuning methods can be adapted to most NLP tasks, when it comes to each specific task, the number of parameters that need to be adjusted for are vast. By adopting prompt learning, the pre-training model can be applied to the required tasks by only modifying the part of the prompt for different downstream tasks. Therefore, the training process will become more efficient. \section{Problem Formulation} In this work, we aim to generate a definition $\bm d^c$ with appropriate complexity $c$, for a given word and example sentence $(w^*, \bm e)$. This task is feasible because the word and it's corresponding definition should be assumed to have the same semantics. A common solution is to predict tokens in the definition one by one, depending on the previous words and the other conditions, which can be formulated as: \begin{equation} P(\bm d^c | w^*, \bm e, c) = \prod_{t=1}^T P(\bm d^c_t | \bm d^c_{<t}, w^*, \bm e, c), \end{equation} where $d^c_t$ is the $t$-th token in the definition, and $T$ is the total length of definition. Each probability distribution can be approximated by the following equation: \begin{equation} P(\bm d^c_t | \bm d^c_{<t}, w^*, \bm e, c) \propto \exp(Wh_t/\tau), \end{equation} where $W$ is a matrix collecting word vectors, $h_t$ is a vector summarizing inputs at current time-step, and $\tau$ is a hyper-parameter for temperature, set to 1 in default. \section{Dataset Construction} The source corpora are extracted from the MCD and CCLD, both published by the Commercial Press. For corpus from MCD and CCLD, we process them separately with the same construction methods and finally put them together. The construction of the COMPILING dataset is divided into three stages: data structured annotation, example sentences expansion, and post-processing. First, we propose a strategy for building structured datasets due to the high complexity and compact construction of automatically extracted data. In this phase, we set up a platform. It not only helps annotators proofread and audit corpus data more efficiently but is also conducive for us to check and collect data. Besides, since the context of a targeted word in the dictionary is always a collocation instead of a complete sentence, we then conduct expanding context to enhance the overall abundance of language for our proposed datasets. Furthermore, to divide definitions into different complexity levels, we calculate the HSK level of each description. \subsection{Data Structured Annotation} In the beginning, we collect initial data and find they are disorganized and complex in structure, which is problematic to conduct automatic processing. Hence, we start up data structured annotation. To better manage and boost the whole process, we build up a platform before the formal annotation and deploy it on two servers, one for corpus from MCD, and the other for corpus from CCLD. This platform could not only serve specifically for this task, but it is also appropriate for the construction of any resource by replacing the data. Concentrating on tackling the problem of disorganized data, we suggest a series of rules for annotation. For a particular word, its attached contents include its spell, definition, example sentences of the usage of a specific definition, and so on. Hence, we propose to add labels before corresponding contents to distinguish different types of data, which is conducive for computers to extract this information based on their labels automatically. Both dictionaries have instructions illustrating the meta-information, such as the organization of entries, the style of definitions and examples, and basic usages. We invite a student who majors in linguistics to formulate the annotation guidelines based on the instructions, which will be the reference for annotators. By doing so, we hope annotators could restore that language information and the relationships between them to a large extent. Then, we invite 20 students majoring in linguistics to annotate the corpora on our platform regarding the guidelines. This phase lasted for two months. \begin{algorithm}[htb] \renewcommand{\algorithmicrequire}{\textbf{Input:}} \renewcommand{\algorithmicensure}{\textbf{Output:}} \caption{Example Sentences Expansion} \label{alg:1} \begin{algorithmic}[1] \Require phrase $p$, corpus $C$ \Ensure examples $E$ \State $D \gets \{\}, E \gets []$ \For{ $sentence$ \textbf{in} $C$ } \If {$p$ \textbf{in} $sentence$} \State $score \gets pplScore(sentence)$ \Comment Compute the PPL score for each sentence. \State $D[sentence] \gets score$ \EndIf \EndFor \State $sortedExamples \gets descSortByValue(D)$ \Comment Descendant sort by the scores. \For {$i=0 \to topN$} \Comment $topN$ is set to 5 in practice. \State $E.add(sortedExamples[i])$ \EndFor \end{algorithmic} \end{algorithm}\label{contextexpansion} \subsection{Example Sentences Expansion} \label{section:expand-algo} While the information extracted from dictionaries is large and abundant, the context attached to the targeted words given in dictionaries is too short to provide enough knowledge for the model to learn and generate descriptions. In the second stage of construction, considering the significance of sentences, we start up example sentence expansion. For contexts without sufficient length in the original corpus, we tend to find sentences with a longer length and higher quality in the new canon for replacement, and the specific process is as follows. We first screened each example sentence in the annotated texts. We set the length threshold to six, and if the length of the initial context is longer than the threshold, we will retain the sentences; otherwise, we will find longer sentences with more abundant information in the new corpus to cover the original ones. It is worth noting that if a term contains more than one sentence (collocation), for each sentence (collocation), we will replace it with new matching contexts. We design Algorithm \ref{alg:1} to match and gain new high-quality sentences. Given the ambiguity of most words, we utilize an allocation as the input of Algorithm \ref{alg:1} instead of a phrase to ensure the found sentences contain the corresponding usage of a specific definition. As shown in Algorithm \ref{alg:1}, we collect all the sentences that fit the requirements and grade them by utilizing Perplexity (PPL)\footnote{\url{https://huggingface.co/docs/transformers/perplexity}}, which is one of the most common metrics for evaluating language fluency. Eventually, the top five sentences in the rankings are designated to replace those original short contexts. \subsection{Post Processing} \label{hsk} \paragraph{Difficulty classification} The most crucial step of constructing a complexity-controlled dataset is integrating the difficulty level of definition into the dataset. We utilize the HSK metric to represent the complexity degree. HSK\footnote{\url{http://www.chinesetest.cn}}, called the Chinese Proficiency Test, set to evaluate the Chinese proficiency and application of non-native speakers. It is divided into nine levels, and the difficulty increases progressively from low to high. For convenience, we regard the seventh, eighth, and ninth levels as a whole. Finally, we set seven complexity levels of HSK, and each level corresponds to a vocabulary. For words that are not included in the first seven-level, we classify them as the highest level. \paragraph{Entry construction} Besides, For each definition, we first conduct word segmentation, then calculate the average and highest HSK level, and combine the HSK level into the dataset. Eventually, each entry of the COMPILING dataset consists of a target word, its definition, the average and highest HSK level, and the contexts of the corresponding usage of this description. \section{Dataset Analysis}\label{dataset} \begin{table}[htbp] \centering \setlength{\tabcolsep}{12pt} \caption{The main statistics of the COMPILING dataset.} \begin{tabular}{lcrrcrr} \toprule[1pt] \multirow{2}{*}{Datasets} & & \multicolumn{2}{c}{Count} & & \multicolumn{2}{c}{Average Length} \\ \cmidrule{3-4} \cmidrule{6-7} & & Words & Entries & & Definition & Context \\ \midrule MCD & & 67,801 & 101,314 & & 13.8 & 27.5 \\ CCLD & & 6,502 & 26,443 & & 13.4 & 20.4 \\ \bottomrule[1pt] \end{tabular}% \label{tableone}% \end{table}% As mentioned before, the smallest unit of the COMPILING dataset consists of five parts. In particular, if a word is polysemous or has numerous contexts, they are regarded as distinct entries. For instance, as shown in Table \ref{addlabe1}, the word “\chinese{收拾}” (clear up) has four different definitions, and each of them follows an example sentence. Hence there are four entries of “\chinese{收拾}” (clear up) in total. As shown in Table \ref{tableone}, we analyze statistics of data extracted from MCD and CCLD, respectively. Table \ref{tabletwo} shows the basic statistics of the COMPILING dataset and another dataset of Chinese definition modeling. For training, the given definitions of each entry are seen as the ground truth. \begin{table}[htbp] \centering \caption{Example entries of COMPILING dataset.} \resizebox{\textwidth}{!}{ \begin{tabular}{cccccc} \toprule Word & Definition & Average & Maximum & Sentence & Source \\ \midrule \makecell[c]{\chinese{收拾}\\clear up} & \makecell[c]{\chinese{使变干净整齐;整理} \\To make clean and tidy} & 2 & 3 & \makecell[c]{\chinese{东西都收拾好了,可以出门了。}\\ With everything packed up, \\we're ready to go.} & CCLD \\ \midrule \makecell[c]{\chinese{收拾}\\repair} & \makecell[c]{\chinese{使有毛病的东西功能正常;修理}\\To make something\\ defective function properly} & 2 & 4 & \makecell[c]{\chinese{我的手机坏了,得找厂家收拾一下。}\\My phone is out of order so I have to ask\\ manufacturer for help.} & CCLD \\ \midrule \makecell[c]{\chinese{收拾} \\settle} & \makecell[c]{\chinese{整理;整顿} \\Put in order} & 4 & 6 & \makecell[c]{\chinese{冬储夏衣,夏藏冬衣,收拾屋子,还要照看外孙女。}\\Store summer clothes in the winter, hide\\ winter clothes in the summer, clean \\the house, and look after her granddaughter.} & MCD \\ \midrule \makecell[c]{\chinese{收拾}\\kill} & \makecell[c]{\chinese{消灭;杀死} \\Eliminate} & 8 & 10 & \makecell[c]{\chinese{据点的敌人,全叫我们收拾了。} \\All the enemies in the stronghold \\have been eliminated.} & MCD \\ \bottomrule \end{tabular}}% \label{addlabe1}% \vspace{2.0em} \end{table}% \begin{table}[!htbp] \vspace*{-1cm} \centering \setlength{\tabcolsep}{12pt} \caption{Statistics of Chinese definition modeling datasets.} \footnotesize \begin{tabular}{lrrrrrr} \toprule[1pt] \multirow{2}{*}{Datasets} & & \multicolumn{2}{c}{Count} & & \multicolumn{2}{c}{Average Length} \\ \cmidrule{3-4} \cmidrule{6-7} & & Words & Entries & & Definition & Context \\ \midrule CWN & & 8,221 & 84,542 & & 9.07 & 21.57 \\ \textbf{COMPILING} & & 74,303 & 127,757 & & 13.60 & 23.95 \\ \bottomrule[1pt] \end{tabular}% \label{tabletwo}% \end{table}% To better highlight the complexity degree of the dataset, we set levels 1-3 in HSK as the simple grade, levels 3-7 as the medium grade, and levels 7-9 and 9+ as hard quality. We count the HSK level distribution of definitions of COMPILING, as shown in Figure \ref{distribution}. \begin{figure}[ht] \centering \includegraphics[width=.8\textwidth]{imgs/levels-crop.pdf} \caption{The distribution of average HSK level in CWN and COMPILING.} \label{distribution} \end{figure} The distribution of definitions in the COMPILING dataset in the three levels is closer than CWN. Given the particularity of the Complexity Controllable definition generation task, it is necessary to construct a dataset including entries covering all difficulty levels. In this way, the model can learn and distinguish the complexity of descriptions, hence generating a new definition of a word with a target complexity level. Hence, the COMPILING dataset could be applied to both general definition generation tasks and those which incorporate the complexity of definitions, demonstrating its value in being as a benchmark dataset. \section{Experiments}\label{section:experiments} \subsection{Baselines}\label{model} This section introduces several methods for common generation tasks, which can serve as baselines for our proposed task. \paragraph{LOG-CaD} LOG-CaD \cite{Ishiwatari2019LearningTD} is a model for generating descriptions for words and phrases. This model summarizes clues from the static, contextualized, as well as character-level embeddings of the given word, and then employs an LSTM-decoder for the generation. A gated attention mechanism is employed to capture and filter information from the embeddings during decoding. \paragraph{Transformser} We treat the task as a special type of single language translation and directly use the original transformer model proposed by \newcite{Vaswani-2017-attention}. We concatenate the word and example sentence as the input sequence and train the model to generate the definition. We use the same approach to deal with the input and output in BERT and BART models. All hyper-parameters are set according to the original paper for a fair comparison. \paragraph{BERT} Pretrained language models have been widely used in various NLP tasks in recent years. By obtaining prior knowledge during pretraining, the PLMs can encode the input sentence more effectively. Thus, we use the Chinese-bert-base \cite{Devlin-2019-bert} model to initialize all the parameters in a transformer encoder and employ a transformer decoder for the generation. Note that the decoder is trained from scratch without initialization. \paragraph{BART} Unlike BERT, BART \cite{Lewis-2019-bart} is a pretrained encoder-decoder language model, which is more suitable for generation tasks. Since the monolingual BART only support English, we use the multilingual version of BART and set both source and target language as Chinese for this task. \paragraph{MT5} T5 is one of the representative pre-training language models. It considers all NLP tasks as a uniform text-to-text paradigm. mT5 \cite{Xue2021mT5AM} is a multi-language variant of T5, and its performance on various benchmark tasks is generally outstanding. Therefore, we choose mT5 to perform the prompt learning method. \begin{table}[h] \centering \setlength{\tabcolsep}{15pt} \caption{Datasets divided by HSK level.} \begin{tabular}{lcc} \toprule[1pt] Complexity & HSK & Entries \\ \midrule Easy & 1-3 & 48,458 \\ Medium & 4-7 & 53,945 \\ Hard & 7+ & 25,354 \\ \bottomrule[1pt] \end{tabular}% \label{tablefour}% \end{table}% \subsection{Settings}\label{sett} As a benchmark dataset introduced to enhance the Chinese definition generation task, we set up the experiments to verify the effectiveness of the COMPILING dataset. \paragraph{Regardless of complexity levels} We first design the experiment to evaluate the overall performance of the baseline models on our dataset. In this setting, we train the models using the entire training set, despite of the different complexity levels. And the purpose of this setting is to provide a comparison standard for other experiments. We divide the dataset into training, development, and test sets according to 8:1:1. The training data are fine-tuned according to the input formats of different models. \paragraph{Complexity specific models} To evaluate the significant role of the COMPILING dataset in generating definitions across various difficulties, we set up an experiment to train the model on different complexity-level sub-datasets. First of all, we split the dataset into three subsets on basis of the average HSK level. As shown in Table \ref{tablefour}, the HSK levels of definitions in Easy Set are between 1 to 3, Medium Set corresponding to level 4-6, and Hard Set corresponding to level 7+. Then we split each subset into training, development, and test sets according to the ratio of 8:1:1. Finally, we fine-tune the BART model utilizing these three training sets, and hence getting three models. Each one could generate definitions with its corresponding complexity level. \paragraph{Unified model based on prompt learning} To assist the model to generate descriptions with different complexity of demand, we adopt the method of prompt learning. It allows the model to learn by adding tokens that represent difficulty information to the inputs, such as <extra\_id\_1> for level 1 (lowest), <extra\_id\_2> for level 2, and so on. The training set is formed by prefacing each definition of the COMPILING dataset with the corresponding special tokens. Each entry of the final dataset includes: <extra\_id\_x>, target word, its corresponding definitions and context. During the training phase, the model encodes both complexity and definition information. In the analysis stage, aiming to verify the effectiveness of this method, we select 10 entries from the test set of the COMPILING dataset. For each entry, only its difficulty token is modified with the other information keep remaining, so as to construct two copies of the entry. It is worth noting that the principle of constructing the new complexity tokens is, that the two new entries and the original one(a group of data) differ by at least 2 levels or more, which means they can represent easy, medium, and hard complexity respectively. For example, if the definition of the source entry is specified with the difficulty as 3, the complexities of the two copies of it need to be constructed as at least 1 and 5. Finally, a total of 30 entries are included in the new test set. Then, we perform the model on this new test set to observe whether the generated definitions are differentiated in line with their specified complexity. \subsection{Evaluation Metrics} In order to better analyze and quantify the experimental results, we select three evaluation metrics: BLEU \cite{Papineni2002BleuAM}, NIST \cite{Doddington2002AutomaticEO} and HSK, which are used to comprehensively evaluate the quality and complexity level of generated definitions. \paragraph{BLEU} BLEU (Bilingual Evaluation Understudy) \cite{Papineni2002BleuAM} was originally proposed for the evaluation of machine translation research. The core of BLEU is to separately calculate the N-gram in the generated and the reference sentence, and then compare them one by one to count the times that can be matched. The higher times illustrate higher accuracy. However, the shorter reference segment always leads to more co-occurrence times, which means the shorter generated definitions tend to get a higher BLEU score. \paragraph{NIST} On the basis of BLEU, NIST (National Institute of Standards and Technology) \cite{Doddington2002AutomaticEO} adds the calculation of the information weight of N-gram. While the BLEU simply sums up the number of N-grams, the NIST sums up the information weights and then divides it by the number of N-gram segments in the whole sentence. In this way, the weightage of those N-grams which appear less frequently will be heavier. \paragraph{HSK} As mentioned in section \ref{hsk}, HSK is a test set to evaluate the Chinese proficiency and application ability of non-native Chinese speakers. Based on the purpose of assisting CFL learners to understand Chinese well, we select HSK to measure the complexity level of definitions. Besides, we set seven difficulty levels (scores) of HSK and each of them corresponds to a vocabulary. The final level of a definition is determined by the average score of its segments. \subsection{Results and Analysis} \label{performance_on_model} \paragraph{Regardless of complexity levels} We report the experimental results on the entire COMPILING dataset in Table \ref{olala}. The results show that PLMs outperforms the other two methods in terms of the BLEU and NIST scores apparently. However, the results of BERT and BART models diverged on these two metrics. Since NIST assigns different weights to tokens, we believe it better reflects the model’s performance. We confirmed this by reading the generated samples. \begin{table}[htbp] \centering \caption{Experiment results on the COMPILING dataset.} \begin{tabular}{lccccccc} \toprule \multirow{2}{*}{ Models} & \multicolumn{3}{c}{Dev} & & \multicolumn{3}{c}{Test} \\ \cmidrule{2-4} \cmidrule{6-8} & BLEU & NIST & HSK & & BLEU & NIST & HSK \\ \midrule LOG-CaD & 27.66 & 25.55 & 3.74 & & 27.71 & 27.88 & 3.85 \\ Transformer & 28.61 & 25.85 & 3.92 & & 28.58 & 31.00 & 3.96 \\ BERT & \textbf{32.95 } & 29.66 & 4.05 & & \textbf{32.03} & 30.56 & 4.08 \\ BART & 29.49 & \textbf{36.90 } & \textbf{4.76} & & 30.63 & \textbf{42.79} & \textbf{4.80} \\ \bottomrule \end{tabular}% \label{olala}% \end{table}% We also notice that as the model performance improves, so does the average HSK level of the generated definitions. This phenomenon is because simpler words are used more frequently, and hence are more easily learned by models. As the modeling ability improves, the better-performing models learn to use more complex words. This can be challenging for future complexity controllable definition generation works, i.e., improving the performance and reducing the generation complexity at the same time. \paragraph{Complexity specific models} Table \ref{multi} illustrates experiment results on three different subsets. As listed in the table, we not only test on the subset in which the model is trained, but also on other subsets. Generally, all the models perform best on the subset it was trained, and poorly on other subsets. Moreover, the performance decays as the complexity level between the model and data increases. Definitions with different complexity have different lexical and syntax, resulting in poor cross-complexity generalization. Besides, we found that even on different test sets, definitions generated by the same model have similar complexity. \begin{table}[hbp] \centering \caption{Experiment results in terms of complexity controllable generation on three test sets.} \begin{tabular}{lccccccccccc} \toprule \multirow{2}{*}{Models} & \multicolumn{3}{c}{Easy Set} & & \multicolumn{3}{c}{Medium Set} & & \multicolumn{3}{c}{Hard Set} \\ \cmidrule{2-4}\cmidrule{6-8}\cmidrule{10-12} & BLEU & NIST & HSK & & BLEU & NIST & HSK & & BLEU & NIST & HSK \\ \midrule BART-Easy & \textbf{32.44 } & \textbf{64.40 } & 2.40 & & 21.56 & 27.61 & 2.73 & & 25.89 & 7.95 & 2.74 \\ BART-Medium & 22.92 & 24.59 & 4.70 & & \textbf{27.69 } & \textbf{40.68 } & 4.86 & & 29.37 & 16.09 & 5.01 \\ BART-Hard & 22.49 & 3.55 & \textbf{8.46} & & 23.70 & 7.04 & \textbf{8.45} & & \textbf{46.57 } & \textbf{18.22 } & \textbf{8.76} \\ \bottomrule \end{tabular}% \label{multi}% \end{table}% \paragraph{Unified model based on prompt learning} MT5-base \cite{Xue2021mT5AM} was selected as the benchmark model in this experiment. The best PPL obtained from the definitions generated on the validation set is 38.44. The BLEU and NIST of the model on the test set are 27.42 and 4.66, respectively. The model generates interpretations based on the new test mentioned in Section \ref{sett}. Table 7 lists two examples where it is fairly obvious that the resulting definitions are differentiated and conform to the expectations for their specified complexity levels. To evaluate the complexity of generating definitions more accurately, we adopt automatic evaluation, ranking the difficulty of each group\footnote{Each group of data refers to one original entry and its two copies, their specified complexity of definition is different and other information keep the same.}. The automatic evaluation is based on the Chinese Text Complexity Analysis Platform (CTAP)\footnote{\url{http://ctap.wenmind.net}} \cite{cui-2022-ctap}. We selected the features of word diversity and word density that reflect the difficulty of paraphrases and calculated the scores of definitions in each group based on the above features. Finally, the scatter distribution diagram is shown in Figure \ref{scatter}. \begin{figure*}[htbp] \centering \includegraphics[width=0.85\textwidth]{imgs/groups-crop.pdf} \caption{The automatic evaluation results. For example, the scatters of the Hard Group represent those definitions that are specified as the hardest, and the ordinate corresponds to the scores obtained by the automatic rating.} \label{scatter} \end{figure*} It can be seen that the complexity score of the Hard Group is mainly above 5, and the number of definitions with the highest score is the largest. The definition in the Easy Group scored the lowest overall score. This means the difficulty level of the model-generated interpretations obtained by automatic evaluation is roughly in line with expectations. The result proves the effectiveness of prompt learning on complexity controllable task, but since the difference in the overall distribution of scattered points in each group in the figure is not particularly obvious, it also reflects that there is room for exploration and improvement of this task in the future. \section{Conclusion} In this work, we propose a novel task of generating Chinese complexity controllable definitions for a given word and example sentence. This task is of great use in helping CFL learners and low literacy readers. Meanwhile, we introduce the COMPILING dataset, which is a benchmark adapting to kinds of definition generation tasks. We also provide several baselines for this task, among which the prompt learning method better assist models in generating definitions with specified complexity. Nevertheless, the experimental results also show that this task is challenging, and the performance needs further improvement. \section{Bibliographical References}
{'timestamp': '2022-09-30T02:09:31', 'yymm': '2209', 'arxiv_id': '2209.14614', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14614'}
arxiv
\section*{Acknowledgments} We are grateful to Yuni Iwamasa and Taihei Oki for initial discussions on the problem. The work was supported by the Lend\"ulet Programme of the Hungarian Academy of Sciences -- grant number LP2021-1/2021 and by the Hungarian National Research, Development and Innovation Office -- NKFIH, grant numbers FK128673 and TKP2020-NKA-06. Yutaro Yamaguchi was supported by JSPS KAKENHI Grant Numbers 20K19743 and 20H00605, and by Overseas Research Program in Graduate School of Information Science and Technology, Osaka University. Yu Yokoi was supported by JST PRESTO Grant Number JPMJPR212B. \section{Matroid Intersection under Common Independence Oracle} \label{sec:ci} As discussed in Section~\ref{sec:oracles}, the common independence oracle is strictly weaker than the minimum rank and the rank sum oracles. As weighted matroid intersection turned out to be tractable for the rank sum oracle, the complexity of the problem under the common independence oracle is especially interesting. In what follows, we present an algorithm for the unweighted matroid intersection problem when one of the matroids is a partition matroid, and an algorithm for the weighted matroid intersection problem when one of the matroids is an elementary split matroid. We also show that the common independence oracle, when complemented with the rank oracle, is strong enough to design an algorithm similar to that for the rank sum case. \subsection{Intersection with Partition Matroid} \label{sec:cipart} The aim of this section is to show that the unweighted matroid intersection problem is tractable under the common independence oracle when ${\mathbf{M}}_1$ is a \textbf{partition matroid} with all-one upper bound on the partition classes, that is, when ${\mathcal{I}}_1$ is represented as ${\mathcal{I}}_1 = \{\, I \subseteq E \mid |I \cap E_i| \leq 1\ \text{for $i=1,\dots,q$}\,\}$ for some partition $E=E_1\cup\dots\cup E_q$. We will provide an algorithm that emulates Algorithm~\ref{alg:1}, i.e., {{\sc Augment}$[E, {\mathcal{I}}_1, {\mathcal{I}}_2, I]$}, using only the common independence oracle. Take any $k = 0, 1, \dots, n - 1$ and let $I\in {\mathcal{I}}_1^k \cap {\mathcal{I}}_2^k$. To emulate Algorithm~\ref{alg:1}, we want to find a shortest $S_I$--$T_I$ path in the exchangeability graph $D[I] = (E \setminus I, I; A_1[I]\cup A_2[I])$. With only the common independence oracle, however, we cannot construct $D[I]$, and cannot determine even $S_I$ or $T_I$. Note that a shortest $S_I$--$T_I$ path in $D[I]$ never uses arcs entering sources or leaving sinks. Therefore, finding a shortest $S_I$--$T_I$ path in $D[I]$ is equivalent to finding it in $D'[I]$, where $D'[I]$ is the subgraph of $D[I]$ obtained by removing those arcs from $D[I]$ (it is used also in Section~\ref{sec:rank_sum}). We now provide a search procedure, described as Algorithm~\ref{alg:part2}, that will be used as a subroutine for our augmentating procedure. If a given element $s$ belongs to $S_I$, this search algorithm works like the breadth first search in $D'[I]$ rooted at $s$, and returns a shortest $s$--$T_I$ path or certifies the nonexistence of such a path. In Algorithm~\ref{alg:part2}, for each $y\in I$, a sequence $P_y$ of distinct elements is defined. In our analysis, $P_y$ will turn out to be a shortest $s$--$y$ path in $D'[I]$. We use the notation $P_y+x$ to denote the sequence obtained by appending an element $x$ to $P_y$. \begin{algorithm2e}[h!] \caption{{{\sc EmulatingBFS}$[E, {\mathcal{I}}_1 \cap {\mathcal{I}}_2, I, s]$}} \label{alg:part2} \SetAlgoLined \SetKwInOut{Input}{Input}\SetKwInOut{Output}{Output} \Input{Oracle access to ${\mathcal{I}}_1 \cap {\mathcal{I}}_2$ where ${\mathcal{I}}_1$ is the independent set family of a partition matroid, a common independent set $I \in {\mathcal{I}}^k_1 \cap {\mathcal{I}}^k_2$, and an element $s \in E \setminus I$.} \Output{A sequence $P$ with $I\triangle P\in {\mathcal{I}}_1 \cap {\mathcal{I}}_2$ and $|I\triangle P|=k+1$ if one exists, or a message \emph{``No''} otherwise. In particular, if $s\in S_I$ and $D'[I]$ has an $s$--$T_I$ path, then a shortest $s$--$T_I$ path is returned.} \BlankLine If $I+s\in {\mathcal{I}}_1 \cap {\mathcal{I}}_2$, halt with returning $s$. For each $y\in I$, set $P_y\gets sy$ if $I+s-y\in {\mathcal{I}}_1\cap {\mathcal{I}}_2$, and $P_y \gets {\mathsf{null}}$ otherwise. For $\ell=1,2,\dots$, do the following. \protect{ \begin{enumerate}[(i)] \item If there is no $y\in I$ with $|P_y|=2\ell$, halt with returning \emph{``No''}. \item If there exist $y'\in I$ and $x\in E\setminus I$ such that $|P_{y'}|=2\ell$, $x\not\in P_{y'}$, $\{y',x\}\not\in {\mathcal{I}}_1\cap{\mathcal{I}}_2$, and $I\triangle(P_{y'}+x)\in {\mathcal{I}}_1\cap {\mathcal{I}}_2$, then halt with returning $P_{y'}+x$. \item For each $y\in I$ with $P_y = {\mathsf{null}}$, if there exist $y'\in I$ and $x\in E\setminus I$ such that $|P_{y'}|=2\ell$, $x\not\in P_{y'}$, $\{y',x\}\not\in {\mathcal{I}}_1\cap {\mathcal{I}}_2$, and $I\triangle(P_{y'}+x+y)\in {\mathcal{I}}_1\cap {\mathcal{I}}_2$, then $P_y\gets P_{y'}+x+y$. \end{enumerate} } \end{algorithm2e} By the algorithm, it is clear that the output is either a sequence $P$ with $I\triangle P\in {\mathcal{I}}_1 \cap {\mathcal{I}}_2$ and $|I\triangle P|=k+1$ or a message \emph{``No''}. Also, if $s\in S_I\cap T_I$, we see that $s$ itself is a shortest $s$--$T_I$ path and is returned at Step~1. Therefore, we assume $s\in S_I\setminus T_I$ and show that a shortest $s$--$T_I$ path is returned if such a path exists. We denote by $\dist(s,T_I)$ the length (i.e., the number of vertices) of a shortest $s$--$T_I$ path in $D'[I]$ and by $\dist(s,y)$ the length of a shortest $s$--$y$ path in $D'[I]$ for each $y\in I$. Note that $\dist(s,T_I)$ is odd and $\dist(s,y)$ is even for any $y\in I$. \begin{lemma}\label{lem:part} Let $s\in S_I\setminus T_I$. The following hold for any $y\in I$ and any $\ell=1,2,\dots$. \begin{enumerate}[\rm (a)] \item $P_y$ is defined in Step~2 if and only if $\dist(s,y)=2$. If defined, it is a shortest $s$--$y$ path in $D'[I]$. \item A sequence is returned in the $\ell$th process of Step~3(ii) if and only if $\dist(s,T_I)=2\ell+1$. The returned sequence is a shortest $s$--$T_I$ path in $D'[I]$. \item $P_y$ is defined in the $\ell$th process of Step~3(iii) if and only if $\dist(s,y)=2\ell+2<\dist(s,T_I)$. If defined, it is a shortest $s$--$y$ path in $D'[I]$. \end{enumerate} \end{lemma} \begin{proof} For any $y\in I$, $\dist(s,y)=2$ means $(s,y)\in A'_2[I]$, which is equivalent to $I+s-y\in {\mathcal{I}}_2$ as $s\not\in T_I$. Since $s\in S_I$ implies $I+s-y\in {\mathcal{I}}_1$, then $I+s-y\in {\mathcal{I}}_1\cap {\mathcal{I}}_2$ holds if and only if $(s,y)\in A'_2[I]$. When $(s,y)\in A'_2[I]$, clearly $sy$ is a shortest $s$--$y$ path. Thus, (a) is shown. We show (b) and (c) by induction on $\ell$. Suppose that they hold for $1,2,\dots,\ell-1$ and we are at the beginning of the $\ell$th process of Step~3. Then $\dist(s,T_I)\geq 2\ell+1$ because otherwise the algorithm has halted before. Take any $y'\in I$ with $|P_{y'}|=2\ell$. Then \begin{itemize} \item $P_{y'}$ is a shortest $s$--$y'$ path in $D'[I]$ by (a) and induction for (c), \item $\mathrm{cl}_2(I)=\mathrm{cl}_2(I\triangle P_{y'})$ because $|I|=|I\triangle P_{y'}|$ and $I\triangle P_{y'}\in {\mathcal{I}}_2$ hold by the algorithm (Steps 2 and 3(iii)) and $P_{y'}\cap T_I=\emptyset$ follows from $\dist(s,T_I)\geq 2\ell+1$. \end{itemize} As $P_{y'}$ is a path in $D'[I]$, it uses arcs in $A'_2[I]$ and $A'_1[I]$ alternately. Let $N_1$ and $N_2$ be the sets of those arcs of $A'_1[I]$ and $A'_2[I]$, respectively. By $s\in E\setminus I$ and $y'\in I$, then $N_1$ and $N_2$ form matchings that cover $V(P_{y'})-s-y'$ and $V(P_{y'})$, respectively (recall that we denote by $V(P)$ the set of elements in a sequence $P$ for emphasizing that we focus on the set rather than the sequence). Take any $x\in E\setminus I$ with $x\not\in P_{y'}$. The following claim completes the proof of (b). \begin{claim}\label{claim:partition1} $(y',x)\in A'_1[I]$ and $x\in T_I$ if and only if $\{y',x\}\not\in {\mathcal{I}}_1\cap{\mathcal{I}}_2$ and $I\triangle(P_{y'}+x)\in {\mathcal{I}}_1\cap {\mathcal{I}}_2$. \end{claim} \begin{proof} For the ``only if'' part, suppose $(y',x)\in A'_1[I]$ and $x\in T_I$. As $\bf{M}_1$ is a partition matroid with all-one upper bounds, $(y',x)\in A'_1[I]$ means that $\{y',x\}$ is a circuit in $\bf{M}_1$, and hence $\{y',x\}\not\in {\mathcal{I}}_1\cap{\mathcal{I}}_2$. Since $s\in S_I$ and $N_1+(y',x)$ forms a matching that covers $V(P_{y'}+x)-s$, we have $I\triangle(P_{y'}+x)\in {\mathcal{I}}_1$. (In $I\triangle(P_{y'}+x)$, each element in $I\cap (P_{y'}+x-s)$ is replaced by another element in the same partition class and $s$ comes from a partition class whose element is not used in $I$.) Also, $\mathrm{cl}_2(I)=\mathrm{cl}_2(I\triangle P_{y'})$ and $x\in T_I$ imply $I\triangle (P_{y'}+x)=(I\triangle P_{y'})+x\in {\mathcal{I}}_2$. Thus, the ``only if'' part is shown. For the ``if'' part, suppose $\{y',x\}\not\in {\mathcal{I}}_1\cap{\mathcal{I}}_2$ and $I\triangle (P_{y'}+x)\in {\mathcal{I}}_1\cap{\mathcal{I}}_2$. As $\mathrm{cl}_2(I)=\mathrm{cl}_2(I\triangle P_{y'})$ holds, $I\triangle (P_{y'}+x)\in {\mathcal{I}}_2$ implies $x\in T_I$. Then $\{y',x\}\in {\mathcal{I}}_2$, and hence $\{y',x\}\not\in {\mathcal{I}}_1\cap{\mathcal{I}}_2$ implies that $\{y',x\}$ is a circuit in $\bf{M}_1$. Thus $(y',x)\in A'_1[I]$. \end{proof} Suppose that we are at the beginning of $\ell$th process of Step~3(iii). Take $y'$ and $x$ as before and take any $y\in I$ such that $P_y$ is undefined. Then $\dist(s,y)>2\ell$ by (a) and induction for (c). Also $(y',x)\in A'_1[I]$ implies $x\not\in T_I$ since otherwise the algorithm has halted at Step~3 (ii). The following claim completes the proof of (c). \begin{claim}\label{claim:partition2} Assume that $(y',x)\in A'_1[I]$ implies $x\not\in T_I$. Then $(y',x)\in A'_1[I]$ and $(x,y)\in A'_2[I]$ if and only if $\{y',x\}\not\in {\mathcal{I}}_1\cap{\mathcal{I}}_2$ and $I\triangle(P_{y'}+x+y)\in {\mathcal{I}}_1\cap {\mathcal{I}}_2$. \end{claim} \begin{proof} For the ``only if'' part, suppose $(y',x)\in A'_1[I]$ and $(x,y)\in A'_2[I]$. Similarly to the proof of Claim~\ref{claim:partition1}, $(y',x)\in A'_1[I]$ implies $\{y',x\}\not\in {\mathcal{I}}_1\cap{\mathcal{I}}_2$ and $I\triangle(P_{y'}+x)\in {\mathcal{I}}_1$, and hence $I\triangle(P_{y'}+x+y)=(I\triangle(P_{y'}+x))-y\in {\mathcal{I}}_1$. Suppose, to the contrary, $I\triangle(P_{y'}+x+y)\not\in {\mathcal{I}}_2$. Since $N_2+(x,y)\subseteq A'_2[I]$ forms a perfect matching on $V(P_{y'}+x+y)$, Lemma~\ref{lem:UPM} implies that there exists some other perfect matching $N'_2\subseteq A_2[I]$ on $V(P_{y'}+x+y)$. This $N'_2$ is included in $A'_2[I]$ because $(P_{y'}+x+y)\cap T_I=\emptyset$ follows from $P_{y'}\cap T_I=\emptyset$ and $x\not\in T_I$. Then, $D'[I]$ contains an $s$--$y$ path with arcs in $N_1\cup N'_2$ and length at most $2\ell$, which contradicts $\dist(s,y)>2\ell$. For the ``if'' part, suppose $\{y',x\}\not\in {\mathcal{I}}_1\cap{\mathcal{I}}_2$ and $I\triangle(P_{y'}+x+y)\in {\mathcal{I}}_1\cap {\mathcal{I}}_2$. By Lemma~\ref{lem:UPM-inv}, $I\triangle(P_{y'}+x+y)\in{\mathcal{I}}_2$ implies that $A_2[I]$ contains a perfect matching $N_2''$ on $V(P_{y'}+x+y)$. Conversely, suppose $(x,y)\not\in N''_2$. Then $(x^*,y)\in N_2''$ for some $x^*\in P_{y'}$, and $P_{y'}\cap T_I=\emptyset$ implies $(x^*,y)\in A'_2[I]$. Hence $D'[I]$ has an $s$--$y$ path with length at most $2\ell$, a contradiction. Thus, $(x,y)\in N''_2\subseteq A_2[I]$, which implies $x\in T_I$ or $(x,y)\in A'_2[I]$, where the latter implies $y\in C_2(I,x)\not\subseteq \{y',x\}$. Thus, in both cases, $\{y',x\}\in {\mathcal{I}}_2$. Therefore, $\{y',x\}\not\in {\mathcal{I}}_1\cap{\mathcal{I}}_2$ implies $\{y',x\}\not\in {\mathcal{I}}_1$, and hence $y'\in C_1(I,x)$, and $(y',x)\in A'_1[I]$ follows. By assumption, we then have $x\not\in T_I$, and hence $(x,y)\in A'_2[I]$. \end{proof} Thus, both (b) and (c) hold for $\ell$. \end{proof} Lemma~\ref{lem:part} completes the proof of correctness of Algorithm~\ref{alg:part2}. \begin{lemma}\label{lem:EmulatingBFS} The output of {\sc EmulatingBFS}$[E, {\mathcal{I}}_1 \cap {\mathcal{I}}_2, I,s]$ is always correct. \end{lemma} \begin{proof} If $\dist(s,T_I)=1$, i.e., if $s\in S_I\cap T_I$, then the algorithm correctly returns $s$ at Step 1. If $\dist(s,T_I)=2\ell+1>1$, then $s\in S_I\setminus T_I$, and hence Lemma~\ref{lem:part}(b) implies that a shortest $s$--$T_I$ path is returned in the $\ell$th process of Step 3(ii). \end{proof} Using {\sc EmulatingBFS} (Algorithm~\ref{alg:part2}) as a subroutine, we design a procedure that emulates {\sc Augment}$[E, {\mathcal{I}}_1, {\mathcal{I}}_2, I]$ with the common independence oracle. \begin{algorithm2e}[h!] \caption{{{\sc AugmentCommonIndependencePartition}$[E, {\mathcal{I}}_1 \cap {\mathcal{I}}_2, I]$}} \label{alg:part} \SetAlgoLined \SetKwInOut{Input}{Input}\SetKwInOut{Output}{Output} \Input{Oracle access to ${\mathcal{I}}_1 \cap {\mathcal{I}}_2$ where ${\mathcal{I}}_1$ is the independent set family of a partition matroid, and a common independent set $I \in {\mathcal{I}}^k_1 \cap {\mathcal{I}}^k_2$.} \Output{A common independent set $J \in {\mathcal{I}}^{k+1}_1 \cap {\mathcal{I}}^{k+1}_2$ if one exists, or a message \emph{``No''} otherwise.} \BlankLine If $I + x \in {\mathcal{I}}_1 \cap {\mathcal{I}}_2$ for some $x \in E \setminus I$, then halt with returning $J = I + x$. \label{st:part1} For each $s \in E \setminus I$, perform {\sc EmulatingBFS}$[E, {\mathcal{I}}_1 \cap {\mathcal{I}}_2, I, s]$. If some sequence $P$ is returned, then return $J=I\triangle P$. Otherwise return with the message \emph{``No''}. \label{st:part2} \end{algorithm2e} \begin{lemma}\label{lem:common_indep_partition} The output of {\sc AugmentCommonIndependencePartition}$[E, {\mathcal{I}}_1 \cap {\mathcal{I}}_2, I]$ (Algorithm~\ref{alg:part}) is always correct. \end{lemma} \begin{proof} The output in Step~\ref{st:part1} is clearly correct. As Step~\ref{st:part2} returns some sequence $P$ only if $I\triangle P$ is indeed a common independent set of size $k+1$, it suffices to show that if there exists a common independent set $J$ of size $k+1$, then {\sc EmulatingBFS}$[E, {\mathcal{I}}_1\cap{\mathcal{I}}_2,I, s]$ returns a sequence for some $s \in E \setminus I$. By the correctness of {\sc Augment}$[E, {\mathcal{I}}_1, {\mathcal{I}}_2, I]$, the existence of such $J$ implies that $D[I]$ has some $S_I$--$T_I$ path, and so does $D'[I]$. Then $D'[I]$ contains an $s$--$T_I$ path for some $s\in S_I$. For such $s$, {\sc EmulatingBFS}$[E, {\mathcal{I}}_1\cap{\mathcal{I}}_2,I, s]$ returns a shortest $s$--$T_I$ path in $D'[I]$. \end{proof} Lemma~\ref{lem:common_indep_partition} completes the proof of Theorem~\ref{thm:ci}. \begin{proof}[Proof of Theorem~\ref{thm:ci}] Starting from $I\coloneqq\emptyset$, the size of the common independent set can be gradually increased using {\sc AugmentCommonIndependencePartition}$[E, {\mathcal{I}}_1 \cap {\mathcal{I}}_2, I]$ until $I$ becomes a common independent set of maximum cardinality. The correctness of the algorithm follows by Lemma~\ref{lem:common_indep_partition}. \end{proof} \subsection{Intersection with Elementary Split Matroid} \label{sec:split} Motivated by the study of matroid polytopes from a tropical geometry point of view, Joswig and Schr\"oter~\cite{joswig2017matroids} introduced the notion of \textbf{split matroids}. This class does not only generalize paving matroids, but it is closed both under duality and taking minors. B\'erczi, Kir\'aly, Schwarcz, Yamaguchi and Yokoi~\cite{berczi2022hypergraph} later observed that every split matroid can be obtained as the direct sum of a so-called \textbf{elementary split matroid} and uniform matroids. Elementary split matroids capture all the nice properties of connected split matroids, and is closed not only under duality and taking minors but also truncation. Motivated by representations of paving matroids by hypergraphs, they provided a hypergraph characterization of elementary split matroids as follows. Let $E$ be a ground set of size at least $r$, ${\mathcal{H}}=\{H_1,\dots, H_q\}$ be a (possibly empty) collection of subsets of $E$, and $r, r_1, \dots, r_q$ be nonnegative integers satisfying \begin{align} |H_i \cap H_j| &\le r_i + r_j -r &&\text{for $1 \le i < j \le q$,}\tag*{(H1)}\label{eq:h1}\\ |E\setminus H_i| + r_i &\ge r &&\text{for $i=1,\dots, q$.} \tag*{(H2)}\label{eq:h2} \end{align} Then ${\mathcal{I}}=\{\, X\subseteq E\mid |X|\leq r,\ |X\cap H_i|\leq r_i\ \text{for $1\leq i \leq q$} \,\}$ forms the family of independent sets of a rank-$r$ matroid $M$ with rank function $r_M(Z)=\min\big\{r,|Z|,\min_{1\leq i\leq q}\{|Z\setminus H_i|+r_i\}\big\}$. Matroids that can be obtained in this form are called \textbf{elementary split matroids}. We call a set $F\subseteq E$ \textbf{$H_i$-tight} or \textbf{tight with respect to $H_i$} if $|F\cap H_i|=r_i$. The following lemma shows that an independent set of size less than $r$ cannot be tight with respect to two different hyperedges. \begin{lemma}\label{lem:tight} Let $M$ be an elementary split matroid with representation ${\mathcal{H}}=\{H_1,\dots,H_q\}$ and $r,r_1,\dots,r_q$, and let $F$ be a set of size less than $r$. Then $F$ is tight with respect to at most one of the hyperedges. \end{lemma} \begin{proof} Suppose to the contrary that $F$ is both $H_i$- and $H_j$-tight. Then we get \begin{align*} |H_i\cap H_j| {}&{}\geq |F\cap H_i\cap H_j| = |F\cap H_i|+|F\cap H_j|-|F\cap (H_i\cup H_j)|\\ {}&{}\geq r_i+r_j-|F| > r_i+r_j-r, \end{align*} contradicting~\ref{eq:h1}. \end{proof} Now we show that the weighted matroid intersection problem is tractable under the common independence oracle when ${\mathbf{M}}_1$ is an \textbf{elementary split matroid}, that is, when ${\mathcal{I}}_1$ can be represented as ${\mathcal{I}}_1=\{\, X\subseteq E\mid |X|\leq r,\ |X\cap H_i|\leq r_i\ \text{for $1\leq i \leq q$} \,\}$ for some (possibly empty) hypergraph ${\mathcal{H}}=\{H_1,\dots, H_q\}$ and nonnegative integers $r, r_1, \dots, r_q$ satisfying \ref{eq:h1} and \ref{eq:h2}. The proof is based on observing that the exchangeability graph has a special structure. \begin{proof}[Proof of Theorem~\ref{thm:split}] Suppose that we have oracle access to the common independent set family ${\mathcal{I}}_1\cap {\mathcal{I}}_2$ of two matroids on $E$, where ${\mathcal{I}}_1$ belongs to an elementary split matroid. Consider a $w$-maximal set $I \in {\mathcal{I}}_1^k \cap {\mathcal{I}}_2^k$ for some $k\in\{0, 1, \dots, n - 1\}$. According to Algorithm~\ref{alg:2} and Lemma~\ref{lem:shortest-cheapest-path}, a $w$-maximal set $J\in{\mathcal{I}}_1^{k+1}\cap{\mathcal{I}}_2^{k+1}$, if exists, can be obtained in the form $J=I\triangle P$ where $P$ is a shortest cheapest $S_I$--$T_I$ path in $D'[I]$. \begin{claim}\label{cl:short} If ${\mathcal{I}}_1^{k+1}\cap{\mathcal{I}}_2^{k+1}\neq\emptyset$, then there exists a shortest cheapest $S_I$--$T_I$ path in $D'[I]$ of length at most $3$. \end{claim} \begin{proof} As ${\mathcal{I}}_1^{k+1}\cap{\mathcal{I}}_2^{k+1}\neq\emptyset$, there necessarily exists an $S_I$--$T_I$ path in $D'[I]$; let $P=e_1e_2\cdots e_\ell$ be a shortest cheapest one. As $I$ is not a basis of ${\mathbf{M}}_1$, observe that $I+x\notin{\mathcal{I}}_1$ for some $x\in E\setminus I$ if and only if there exists a hyperedge $H_i$ such that $I$ is $H_i$-tight and $x\in H_i$. By Lemma~\ref{lem:tight}, $I$ is tight with respect to at most one of the hyperedges, hence we get that $E\setminus (S_I\cup I)\subseteq H_i$. This also implies that $A'_1[I]=\{\,(y,x)\mid x\in H_i\setminus I,~y\in H_i\cap I\,\}$. Assume that the length of the path is more than $3$. Then, by the above observation, both $(e_2, e_\ell)$ and $(e_{\ell-1}, e_3)$ exist in $D'[I]$. Therefore $C\coloneqq e_3e_4\cdots e_{\ell-1}e_3$ is a cycle in $D'[I]$, and $P'\coloneqq e_1e_2e_\ell$ is an $S_i$--$T_i$ path in $D'[I]$. By Lemma~\ref{lem:negative_cycle}, the cost of $C$ is nonnegative, and hence the cost of $P'$ is at most the cost of $P$, contradicting the choice of $P$. \end{proof} By Claim~\ref{cl:short}, a $w$-maximal member of ${\mathcal{I}}_1^{k+1}\cap{\mathcal{I}}_2^{k+1}$, if exists, can be found by checking every set $I'$ of size $k+1$ with $|I\triangle I'|\leq 2$. This concludes the proof of the theorem. \end{proof} \subsection{Complemented with Maximum Rank Oracle} \label{sec:cimax} When access is given to both a common independence and a maximum rank oracle, every step of Algorithms~\ref{alg:3} and \ref{alg:4}, i.e., {\sc EmulatingBellmanFord} and {\sc CheapestPathAugmentRankSum}, can be emulated and hence the weighted matroid intersection problem is solved as with Section~\ref{sec:rank_sum}. \begin{proof}[Proof of Theorem~\ref{thm:cimax}] Suppose that we have oracle access to the common independent set family ${\mathcal{I}}_1 \cap {\mathcal{I}}_2$ and the maximum rank function ${r_\mathrm{max}}$ of two matroids on $E$ instead of that to ${r_\mathrm{sum}}$. In {\sc EmulatingBellmanFord} and {\sc CheapestPathAugmentRankSum}, we ask the rank sum oracle the following types of questions: \begin{enumerate}[(a)] \item whether ${r_\mathrm{sum}}(I' + x) = 2|I'|$ or not for $I' \in {\mathcal{I}}_1 \cap {\mathcal{I}}_2$ and $x \in E \setminus I'$, \label{it:reda} \item whether ${r_\mathrm{sum}}(I' + x) = 2|I'| + 1$ or not for $I' \in {\mathcal{I}}_1 \cap {\mathcal{I}}_2$ and $x \in E \setminus I'$, \label{it:redb} \item whether ${r_\mathrm{sum}}(I' + x) = 2|I'|+2$ or not for $I' \in {\mathcal{I}}_1 \cap {\mathcal{I}}_2$ and $x \in E \setminus I'$, \label{it:redc} and \item whether ${r_\mathrm{sum}}(I') = 2|I'|$ or not for $I' \subseteq E$. \label{it:redd} \end{enumerate} These questions can be tested using the common independence and the maximum rank oracles together as follows. The answer to \eqref{it:reda} is \emph{``Yes''} if and only if $I' + x \notin {\mathcal{I}}_1 \cap {\mathcal{I}}_2$ and ${r_\mathrm{max}}(I' + x) = |I'|$, the answer to \eqref{it:redb} is \emph{``Yes''} if and only if $I' + x \not\in {\mathcal{I}}_1 \cap {\mathcal{I}}_2$ and ${r_\mathrm{max}}(I' + x) = |I'| + 1$, the answer to \eqref{it:redc} is \emph{``Yes''} if and only if $I' + x \in {\mathcal{I}}_1 \cap {\mathcal{I}}_2$, and the answer to \eqref{it:redd} is \emph{``Yes''} if and only if $I' \in {\mathcal{I}}_1 \cap {\mathcal{I}}_2$. \end{proof} \section{Introduction} \label{sec:introduction} A cornerstone of matroid theory is the efficient solvability of the matroid intersection problem introduced by Edmonds \cite{edmonds1970submodular}. Efficient algorithms for weighted matroid intersection were developed subsequently by Edmonds \cite{edmonds1979matroid}, by Lawler \cite{lawler1970optimal,lawler1976combinatorial}, and by Iri and Tomizawa \cite{iri1976algorithm}. The min-max duality theorem of Edmonds \cite{edmonds1970submodular} for the unweighted matroid intersection problem was generalized by Frank \cite{frank1981weighted} to the weighted case. These results do not only provide a well-established framework that includes various tractable combinatorial optimization problems such as bipartite matching and arborescence packing, but in certain cases they are unavoidable in solving natural optimization problems that seem to be unrelated to matroids. A beautiful example is the problem of computing a cheapest rooted $k$-connected spanning subgraph of a digraph \cite{frank2009rooted}. This is a pure graph optimization problem and yet the only known polynomial algorithm is based on the recognition that minimal rooted $k$-connected subgraphs of a digraph form the common bases of two matroids, and therefore a weighted matroid intersection algorithm can be applied. In order to design matroid algorithms and to analyze their complexity, it should be clarified how matroids are given. As the number of bases can be exponential in the size of the ground set, defining a matroid in an explicit form is inefficient. Rather than giving a matroid as an explicit input, it is usually assumed that one of the standard oracles is available, and the complexity of the algorithm is measured by the number of oracle calls and other elementary steps. Another way to define a matroid is to give an explicit linear representation, but this restricts the scope of the algorithm to linear matroids for which such an explicit representation is known. For both the unweighted and weighted problems, a variety of efficient algorithms have been developed; see e.g. \cite{edmonds1970submodular, edmonds1979matroid, lawler1970optimal, aigner1971matching, lawler1975matroid, iri1976algorithm, cunningham1986improved, frank1981weighted, brezovec1986two, huang2019exact}. A common feature of these algorithms, and also all previous studies on matroid intersection, is that they assume the availability of one of the standard oracles for both matroids; e.g., we can ask for the rank of a subset in each of them. Our main contribution is showing that this assumption is not necessary for the tractability of matroid intersection, not even in the weighted setting. One motivation for studying restricted oracles comes from polymatroid matching, a framework introduced by Lawler~\cite{lawler1976combinatorial} as a common generalization of matroid intersection and non-bipartite matching. In \cite{lovasz2009matching}, Edmonds' theorem was deduced from polymatroid matching using a sophisticated argument. The main point is that when the matroid intersection problem is formulated as a polymatroid matching problem, only the \emph{rank sum function} of the two matroids is used rather than the two rank functions. Although the polymatroid matching problem cannot be solved in polynomial time in general~\cite{lovasz1981matroid, jensen1982complexity}, the hardness was shown through special instances that seem to be far from matroid intersection. This suggests that matroid intersection might still be tractable when only the sum of the rank functions is available. We mention that another natural oracle to consider is the \emph{minimum rank function}, which answers the smaller value among the two ranks of a subset. It follows from the polyhedral results of Edmonds \cite{edmonds1970submodular} that this oracle suffices to describe the convex hull of common independent sets. In an unpublished manuscript, Bárász \cite{egresqp-06-03} gave a polynomial time algorithm for unweighted matroid intersection under the minimum rank oracle. We will present additional results about this oracle in a separate paper~\cite{inpreparation}. \paragraph{Our results} Our goal is to settle the tractability of the weighted matroid intersection problem under restricted oracles. In particular, we will focus on three different oracles: rank sum, common independence, and maximum rank oracles. The study of the rank sum oracle is motivated by the above discussed connection to polymatroid matching results. The difficulty of giving an efficient algorithm is that the usual augmenting path approach cannot be applied directly, since the exchangeability graphs are not determined by the rank sum oracle. Still, we are able to give a strongly polynomial time algorithm for the weighted matroid intersection problem by emulating the Bellman--Ford algorithm without explicitly knowing the underlying graph. \begin{theorem} \label{thm:ranksum} There exists a strongly polynomial time algorithm for the weighted matroid intersection problem in the rank sum oracle model. \end{theorem} It is not difficult to see that a common independence oracle can be constructed with the help of a rank sum oracle. Therefore, any algorithm that is based on the usage of a common independence oracle immediately translates into an algorithm that uses a rank sum oracle. Nevertheless, the reverse implication does not hold, hence the common independence oracle is strictly weaker. We show that unweighted matroid intersection remains tractable under the common independence oracle model when one of the matroids is a partition matroid. \begin{theorem} \label{thm:ci} There exists a strongly polynomial time algorithm for the unweighted matroid intersection problem in the common independence oracle model when one of the matroids is a partition matroid with all-one upper bound on the partition classes. \end{theorem} Although the complexity of the problem in general remains an intriguing open question even for the unweighted setting, this seemingly simple case already includes matchings in bipartite graphs and arborescences. Recently, Joswig and Schr\"oter~\cite{joswig2017matroids} introduced the notion of split matroids, a class with distinguished structural properties that generalizes paving matroids. B\'erczi, Kir\'aly, Schwarcz, Yamaguchi and Yokoi~\cite{berczi2022hypergraph} showed that every split matroid can be obtained as the direct sum of a so-called elementary split matroid and uniform matroids, and provided a hypergraph characterization of elementary split matroids. By relying on this characterization, we show that even weighted matroid intersection is tractable in the common independence oracle model when one of the matroids is from this class. \begin{theorem} \label{thm:split} There exists a strongly polynomial time algorithm for the weighted matroid intersection problem in the common independence oracle model when one of the matroids is an elementary split matroid. \end{theorem} We will see that the maximum rank oracle does not carry too much information on its own. However, when combined with the common independence oracle, they are strong enough to mimic our algorithm for the rank sum case. \begin{theorem} \label{thm:cimax} There exists a strongly polynomial time algorithm for the weighted matroid intersection problem when both the common independence and the maximum rank oracles are available. \end{theorem} \paragraph{Organization} The rest of the paper is organized as follows. Basic definitions and notation are introduced in Section~\ref{sec:preliminaries}, together with some fundamental results on matroid intersection. Section~\ref{sec:oracles} describes the relation between different oracles. We present our strongly polynomial algorithm under the rank sum oracle in Section~\ref{sec:rank_sum}. The common independence oracle case when one of the matroids is a partition matroid or an elementary split matroid, as well as the combination of the common independence and maximum rank oracles, is discussed in Section~\ref{sec:ci}. \section{Polynomial Reducibility of Oracles} \label{sec:oracles} Although there are many different types of oracles that are used in studies on matroids, many of these conventional oracles have the same computational power. More precisely, we say that an oracle ${\mathcal{O}}_1$ is \textbf{polynomially reducible} to another oracle ${\mathcal{O}}_2$ if ${\mathcal{O}}_1$ can be simulated by using a polynomial number of oracle calls to ${\mathcal{O}}_2$ measured in terms of the size of the ground set. Two oracles are \textbf{polynomially equivalent} if they are mutually polynomially reducible to each other. In this sense, the rank, independence, strong basis, circuit-finding, spanning, and port oracles are polynomially equivalent~\cite{robinson1980computational,hausmann1981algorithmic,coullard1996independence}. The aim of this section is to clarify the relation between the restricted oracles that we consider, that is, \textsc{Sum}, \textsc{Min}, \textsc{Max}, and \textsc{CI}. As it turns out, \textsc{Max} is not very useful on its own, but it provides a powerful tool when combined with any of the other three oracles. We denote by a `+' sign when we have access to two of the oracles, e.g., \textsc{Min+Max} means that for a set $X\subseteq E$ the oracle tells both ${r_\mathrm{min}}(X)$ and ${r_\mathrm{max}}(X)$. In what follows, we discuss the reducibility of the oracles one by one. In order to keep the presentation clear, some of the ideas appear multiple times. For an overview of the results, see Figure~\ref{fig:oracles}. Observe that, by ${r_\mathrm{sum}}(X)={r_\mathrm{min}}(X)+{r_\mathrm{max}}(X)$, any combination of at least two of \textsc{Min}, \textsc{Max}, and \textsc{Sum} is clearly equivalent. This immediately implies that each of {\sc Min}, {\sc Sum}, and {\sc Max} is reducible to each of {\sc Min+Max}, {\sc Min+Sum}, and {\sc Sum+Max}. \begin{figure}[t!] \centering \includegraphics[width=.5\linewidth]{reductions_new.pdf} \caption{Hierarchy of oracles, directed arcs representing polynomial reducibility. Grey boxes denote oracles for which strongly polynomial time algorithms are given in the present paper.} \label{fig:oracles} \end{figure} \begin{theorem}\label{thm:or1} \textsc{CI} is not polynomially reducible to \textsc{Max}, but it is polynomially reducible to \textsc{Min} and \textsc{Sum}. \end{theorem} \begin{proof} If ${\mathbf{M}}_1$ is the free matroid, then \textsc{Max} always answers $|X|$ independently from the choice of ${\mathbf{M}}_2$. Thus deciding if $X\subseteq E$ is a common independent set or not is impossible relying solely on \textsc{Max}. To see the second half, observe that for a set $X\subseteq E$, \textsc{CI} answers \emph{``Yes''} if and only if $X$ is a common independent set of the two matroids, that is, $r_1(X)=r_2(X)=|X|$. By the subcardinality of the rank functions, this is equivalent to ${r_\mathrm{min}}(X)=|X|$ and to ${r_\mathrm{sum}}(X)=2|X|$. As these conditions can be checked by \textsc{Min} and \textsc{Sum}, respectively, the theorem follows. \end{proof} \begin{theorem}\label{thm:or2} \textsc{Min} is not polynomially reducible to \textsc{Sum}, \textsc{CI}, \textsc{Max}, and \textsc{CI+Max}. \end{theorem} \begin{proof} We define two instances of the matroid intersection problem on the same ground set $E=\{a,b,c,d\}$ as follows. For $i=1,2$, let ${\mathbf{M}}_i$ be the graphic matroid of the graph $G_i$ on Figure~\ref{fig:m1m2a}, and let ${\mathbf{M}}'_i$ be the graphic matroid of the graph $G'_i$ on Figure~\ref{fig:m1m2b}. Consider the maximum-cardinality common independent set problem for ${\mathbf{M}}_1$ and ${\mathbf{M}}_2$, and for ${\mathbf{M}}'_1$ and ${\mathbf{M}}'_2$. For any subset $X$ of $E$, both \textsc{Sum} and \textsc{CI} give the same answer in the two instances, thus it is not possible to distinguish them from each other using one of these oracles. However, ${r_\mathrm{min}}(E)$ is $2$ in one of them while $3$ in the other one, showing that \textsc{Min} cannot be reduced to \textsc{Sum} or \textsc{CI}. Now take the $3$-truncation of these graphic matroids, and define ${\mathbf{N}}_1=({\mathbf{M}}_1)_3$, ${\mathbf{N}}_2=({\mathbf{M}}_2)_3$, ${\mathbf{N}}'_1=({\mathbf{M}}'_1)_3$, and ${\mathbf{N}}'_2=({\mathbf{M}}'_2)_3$. Consider the maximum-cardinality common independent set problem for ${\mathbf{N}}_1$ and ${\mathbf{N}}_2$, and for ${\mathbf{N}}'_1$ and ${\mathbf{N}}'_2$. By the slight change in the definitions, both \textsc{CI} and \textsc{Max} give the same answer in the two instances for any subset $X\subseteq E$, thus it is not possible to distinguish them from each other using a combination of these two oracles. However, ${r_\mathrm{min}}(E)$ is $2$ in one of them while $3$ in the other one, showing that \textsc{Min} cannot be reduced to \textsc{CI+Max}. The case when ${\mathbf{M}}_1$ is the free matroid shows again that ${r_\mathrm{min}}(X)$ cannot be determined relying solely on \textsc{Max}. \end{proof} \begin{figure}[t!] \centering \begin{subfigure}[t]{0.47\textwidth} \centering \includegraphics[width=.75\linewidth]{m1m2a.pdf} \caption{The graphs $G_1$ and $G_2$ defining ${\mathbf{M}}_1$ and ${\mathbf{M}}_2$.} \label{fig:m1m2a} \end{subfigure}\hfill \begin{subfigure}[t]{0.47\textwidth} \centering \includegraphics[width=.75\linewidth]{m1m2b.pdf} \caption{The graphs $G'_1$ and $G'_2$ defining ${\mathbf{M}}'_1$ and ${\mathbf{M}}'_2$.} \label{fig:m1m2b} \end{subfigure} \caption{Illustration of Theorems~\ref{thm:or2}, \ref{thm:or3}, and \ref{thm:or4}.} \label{fig:or2} \end{figure} \begin{theorem}\label{thm:or3} \textsc{Sum} is not polynomially reducible to \textsc{Min}, \textsc{CI}, \textsc{Max}, and \textsc{CI+Max}. \end{theorem} \begin{proof} If ${\mathbf{M}}_1$ is a uniform matroid of rank $1$, then ${r_\mathrm{min}}(X)=0$ if $X=\emptyset$ and $1$ otherwise, while \textsc{CI} answers \emph{``Yes''} if $|X|\leq 1$ and \emph{``No''} otherwise. These answers are independent from the choice of ${\mathbf{M}}_2$, therefore we cannot determine ${r_\mathrm{sum}}(X)$ with their help. The case when ${\mathbf{M}}_1$ is the free matroid shows again that ${r_\mathrm{sum}}(X)$ cannot be determined relying solely on \textsc{Max}. Consider the same two instances of the matroid intersection problem defined by the $3$-truncations of the graphic matroids on Figure~\ref{fig:or2} as in the proof of Theorem~\ref{thm:or2}. Recall that both \textsc{CI} and \textsc{Max} give the same answer in the two instances for any subset $X\subseteq E$, thus it is not possible to distinguish them from each other using a combination of these two oracles. However, ${r_\mathrm{sum}}(E)$ is $5$ in one of them while $6$ in the other one, showing that \textsc{Sum} cannot be reduced to \textsc{CI+Max}. \end{proof} \begin{theorem}\label{thm:or4} \textsc{Max} is not polynomially reducible to \textsc{Min}, \textsc{Sum}, and \textsc{CI}. \end{theorem} \begin{proof} The case when ${\mathbf{M}}_1$ is a uniform matroid of rank $1$ shows again that ${r_\mathrm{max}}(X)$ cannot be determined relying solely on \textsc{Min} or \textsc{CI}. Consider the same two instances of the matroid intersection problem defined by Figure~\ref{fig:or2} as in the proof of Theorem~\ref{thm:or2}. Recall that for any subset $X$ of $E$, \textsc{Sum} gives the same answer in both instances, thus it is not possible to distinguish them from each other using \textsc{Sum}. However, ${r_\mathrm{max}}(E)$ is $4$ in one of them while $3$ in the other one, showing that \textsc{Max} cannot be reduced to \textsc{Sum}. \end{proof} \section{Preliminaries} \label{sec:preliminaries} For the basics on matroids and the matroid intersection problem, we refer the reader to \cite{oxley2011matroid, schrijver2003combinatorial}. Throughout the paper, for $i=1,2$, let ${\mathbf{M}}_i=(E,{\mathcal{I}}_i)$ be loopless\footnote{The assumption that the matroids are loopless is not restrictive as loops can be easily detected by any of the oracles considered.} matroids on the same finite ground set $E$ of size $n$, whose \textbf{independent set families}, \textbf{rank functions}, and \textbf{closure operators} are denoted by ${\mathcal{I}}_i$, by $r_i$, and by $\mathrm{cl}_i$, respectively. For two sets $X,Y\subseteq E$, we denote their \textbf{symmetric difference} by $X\triangle Y=(X\setminus Y)\cup(Y\setminus X)$. The \textbf{$k$-truncation} of a matroid ${\mathbf{M}}=(S,{\mathcal{I}})$ is a matroid $({\mathbf{M}})_{k}=(S,{\mathcal{I}}^{\le k})$ with ${\mathcal{I}}^{\le k}=\{\, X\in{\mathcal{I}} \mid |X|\leq k \,\}$. For $I \in {\mathcal{I}}_i$ and $x \in \mathrm{cl}_i(I) \setminus I$, the \textbf{fundamental circuit} of $x$ with respect to $I$ in ${\mathbf{M}}_i$ is denoted by $C_i(I, x) = \{\, y \in I \mid I + x - y \in {\mathcal{I}}_i \,\}$. We consider four oracles for matroid intersection. Given a set $X\subseteq E$ as an input, a \textbf{rank sum oracle} (\textsc{\textsc{Sum}}) answers the sum ${r_\mathrm{sum}}(X)\coloneqq r_1(X)+r_2(X)$ of the ranks of $X$, a \textbf{minimum rank oracle} (\textsc{Min}) answers the minimum ${r_\mathrm{min}}(X)\coloneqq\min\left\{r_1(X),r_2(X)\right\}$ of the ranks of $X$, a \textbf{maximum rank oracle} (\textsc{Max}) answers the maximum ${r_\mathrm{max}}(X)\coloneqq\max\left\{r_1(X),r_2(X)\right\}$ of the ranks of $X$, and a \textbf{common independence oracle} (\textsc{CI}) answers \emph{``Yes''} if $X\in{\mathcal{I}}_1\cap{\mathcal{I}}_2$ and \emph{``No''} otherwise. Let us first overview some basic results on unweighted matroid intersection. In \cite{edmonds1970submodular}, Edmonds gave the following characterization for the maximum cardinality of a common independent set of two matroids. \begin{theorem}[Edmonds~\cite{edmonds1970submodular}]\label{thm:Edmonds} Given two matroids ${\mathbf{M}}_1=(E,{\mathcal{I}}_1)$ and ${\mathbf{M}}_2=(E,{\mathcal{I}}_2)$ on a common ground set $E$, the maximum cardinality of a common independent set of ${\mathbf{M}}_1$ and ${\mathbf{M}}_2$ is equal to \begin{align*} \min\left\{\, r_1(Z) + r_2(E \setminus Z) \mid Z \subseteq E \,\right\}. \end{align*} \end{theorem} The notion of exchangeability graphs plays a central role in any matroid intersection algorithm. \begin{definition}[Exchangeability Graphs]\label{def:exchange} Assume that $I\in{\mathcal{I}}_1\cap {\mathcal{I}}_2$. The \textbf{exchangeability graph} corresponding to $I$ is a bipartite digraph $D[I] = (E \setminus I, I; A[I])$ defined as follows. Set \begin{align*} S_I &\coloneqq \{\, s \in E \setminus I \mid I + s \in {\mathcal{I}}_1 \,\},\\ T_I &\coloneqq \{\, t \in E \setminus I \mid I + t \in {\mathcal{I}}_2 \,\}, \end{align*} where elements in $S_I$ and in $T_I$ are called \textbf{sources} and \textbf{sinks}, respectively. We then define the set $A[I] \coloneqq A_1[I] \cup A_2[I]$ of exchangeability arcs, where \begin{align*} A_1[I] \coloneqq&\ \{\, (y, x) \mid x \in E \setminus I,~y \in I,~I + x - y \in {\mathcal{I}}_1 \,\}\\ =&\ \{\, (y, s) \mid s \in S_I,~y \in I \,\} \cup \{\, (y, x) \mid x \in E \setminus (I \cup S_I),~y \in C_1(I, x) \,\},\\[1mm] A_2[I] \coloneqq&\ \{\, (x, y) \mid x \in E \setminus I,~y \in I,~I + x - y \in {\mathcal{I}}_2 \,\}\\ =&\ \{\, (t, y) \mid t \in T_I,~y \in I \,\} \cup \{\, (x, y) \mid x \in E \setminus (I \cup T_I),~y \in C_2(I, x) \,\}. \end{align*} Note that $S_I$ and $A_1[I]$ depend only on ${\mathcal{I}}_1$, and $T_I$ and $A_2[I]$ depend only on ${\mathcal{I}}_2$. \end{definition} Brualdi \cite{brualdi1969comments} observed that the set $A_i[I]$ satisfies the following property for $i=1,2$. \begin{lemma}\label{lem:UPM-inv} Let $I\in {\mathcal{I}}_i$ and let $Z\subseteq E$ satisfy $|I\triangle Z|=|I|$ and $I\triangle Z\in {\mathcal{I}}_i$. Then $A_i[I]$ contains a perfect matching on $Z$ (i.e., a set of vertex-disjoint arcs whose tails and heads constitute $Z$). \end{lemma} Krogdahl~\cite{krogdahl1974combinatorial,krogdahl1976combinatorial,krogdahl1977dependence} proved a partial converse to the above lemma. \begin{lemma}[Unique Perfect Matching Lemma]\label{lem:UPM} Let $I\in {\mathcal{I}}_i$ and let $Z\subseteq E$ satisfy $|I\triangle Z|=|I|$. If $A_i[I]$ contains a unique perfect matching on $Z$, then $I\triangle Z\in {\mathcal{I}}_i$. \end{lemma} Finally, let us recall that a standard algorithm for finding a maximum-cardinality common independent set is driven by the following subroutine (see \cite[$\S$~41.2]{schrijver2003combinatorial}). For any digraph $D=(E,A)$, a \textbf{path} in $D$ is a sequence $P=e_1e_2\cdots e_\ell$ of distinct vertices such that $(e_i,e_{i+1})\in A$ for each $i=1,2,\dots,\ell-1$; we call $P$ an \textbf{$e_1$--$e_\ell$ path} or \textbf{an $X$--$Y$ path} for sets $X \ni e_1$ and $Y \ni e_\ell$ to emphasize the end vertices, and define $\ell$ as the \textbf{length}. A \textbf{cycle} in $D$ is a sequence $e_1e_2\cdots e_\ell e_1$ such that $e_1e_2 \cdots e_\ell$ is a path and $(e_\ell, e_1)\in A$. We often identify a path or a cycle with its vertex set $\{e_1, e_2,\dots,e_\ell\}$. \begin{algorithm2e}[h!] \caption{{{\sc Augment}$[E, {\mathcal{I}}_1, {\mathcal{I}}_2, I]$}} \label{alg:1} \SetAlgoLined \SetKwInOut{Input}{Input}\SetKwInOut{Output}{Output} \Input{A finite set $E$, oracle access to ${\mathcal{I}}_1$ and ${\mathcal{I}}_2$, and a common independent set $I \in {\mathcal{I}}_1 \cap {\mathcal{I}}_2$.} \Output{A common independent set $J \in {\mathcal{I}}_1 \cap {\mathcal{I}}_2$ with $|J| = |I| + 1$ if one exists, or a subset $Z \subseteq E$ with $r_1(Z) + r_2(E \setminus Z) = |I|$ otherwise.} \BlankLine Construct the exchangeability graph $D[I]$ with source set $S_I$ and sink set $T_I$. If some $t \in T_I$ is reachable from some $s \in S_I$, then find a shortest $S_I$--$T_I$ path $P$ in $D[I]$, and return $J = I \triangle P$. Otherwise, return $Z = \{\, e \in E \mid e~\text{can reach some}~t \in T_I~\text{in}~D[I] \,\}$. \end{algorithm2e} Now we turn to the weighted setting. For a weight function $w \colon E \to {\mathbb{R}}$ and a subset $X \subseteq E$, define $w(X) \coloneqq \sum_{e \in X} w(e)$. For a family ${\mathcal{F}} \subseteq 2^E$, a subset $X \subseteq E$ is \textbf{$w$-maximal in ${\mathcal{F}}$} if $X \in \textrm{arg\,max}\left\{\, w(Y) \mid Y \in {\mathcal{F}} \,\right\}$. We define ${\mathcal{I}}_i^k \coloneqq \{\, X \in {\mathcal{I}}_i \mid |X| = k \,\}$ for $i = 1, 2$ and $k = 0, 1, \dots, n$. One approach to solve the weighted matroid intersection problem is via augmentation along cheapest paths in the exchangeability graph (see~\cite[$\S$~41.3]{schrijver2003combinatorial}), where the cost function $c \colon E \to {\mathbb{R}}$ is defined on the vertex set as follows: \begin{align}\label{eq:cost} c(e) &\coloneqq \begin{cases} w(e) & \text{if $e \in I$},\\ -w(e) & \text{if $e \in E \setminus I$}. \end{cases} \end{align} For each path (or cycle) $P$ in $D[I]$, we define the \textbf{cost} of $P$ as $c(P) \coloneqq \sum_{e \in P}c(e)$. \begin{algorithm2e}[h] \caption{{{\sc CheapestPathAugment}$[E, w, {\mathcal{I}}_1, {\mathcal{I}}_2, I]$}} \label{alg:2} \SetAlgoLined \SetKwInOut{Input}{Input}\SetKwInOut{Output}{Output} \Input{A finite set $E$, a weight function $w \colon E \to {\mathbb{R}}$, oracle access to ${\mathcal{I}}_1$ and ${\mathcal{I}}_2$, and a $w$-maximal set $I \in {\mathcal{I}}_1^k \cap {\mathcal{I}}_2^k$ for some $k\in\{0, 1, \dots, n - 1\}$.} \Output{A $w$-maximal set $J \in {\mathcal{I}}_1^{k+1} \cap {\mathcal{I}}_2^{k+1}$ if one exists, or a subset $Z \subseteq E$ with $r_1(Z) + r_2(E \setminus Z) = |I|$ otherwise.} \BlankLine Construct the exchangeability graph $D[I]$ with source set $S_I$ and sink set $T_I$. In addition, define the cost function $c \colon E \to {\mathbb{R}}$ by \eqref{eq:cost}. If some $t \in T_I$ is reachable from some $s \in S_I$, then find a shortest cheapest $S_I$--$T_I$ path $P$ in $D[I]$ (i.e., the cost $c(P)$ is minimum, and subject to this, the length of $P$ is minimum), and return $J = I \triangle P$. Otherwise, return $Z = \{\, e \in E \mid e~\text{can reach some}~t \in T_I~\text{in}~D[I] \,\}$. \end{algorithm2e} The next lemma characterizes $w$-maximal common independent sets in ${\mathcal{I}}^k_1\cap {\mathcal{I}}^k_2$. \begin{lemma}[cf.~{\cite[Theorem~41.5]{schrijver2003combinatorial}}]\label{lem:negative_cycle} A common independent set $I \in {\mathcal{I}}_1^k \cap {\mathcal{I}}_2^k$ is $w$-maximal if and only if $D[I]$ contains no negative-cost cycle with respect to the cost function $c$ defined as \eqref{eq:cost}. \end{lemma} \section{Matroid Intersection under Rank Sum Oracle} \label{sec:rank_sum} In Algorithm~\ref{alg:2}, we assume that we are given the independence oracles of matroids ${\mathbf{M}}_1$ and ${\mathbf{M}}_2$, which are polynomially equivalent to the oracles of rank functions $r_1$ and $r_2$, respectively. In this section, we consider the solvability of the weighted matroid intersection problem when only the \emph{rank sum function} ${r_\mathrm{sum}} \colon 2^E \to {\mathbb{Z}}_{\geq 0}$ is available, that is, for any set $X\subseteq E$ the oracle answers the value of ${r_\mathrm{sum}}(X) \coloneqq r_1(X)+r_2(X)$. Note that a subset $I \subseteq E$ belongs to ${\mathcal{I}}_1\cap {\mathcal{I}}_2$ if and only if ${r_\mathrm{sum}}(I) = 2|I|$. However, when ${r_\mathrm{sum}}(I)<2|I|$, we cannot decide whether $I\in {\mathcal{I}}_i$ or not for each $i=1,2$. The matroid intersection problem under this oracle model is exactly a special case of the \emph{polymatroid matching problem}, which is equivalent to the so-called \emph{matroid matching (or parity) problem}~\cite[\S~11.1]{lovasz2009matching}. While a max-min duality theorem was given by Lov\'asz~\cite{lovasz1980matroid} for the case when the matroids in question admit linear representations\footnote{For the matroid intersection considered as a special case, the two matroids are necessarily representable over the same field.}, such a good characterization is not known in general even in the matroid intersection case. In what follows, we provide an algorithm for the weighted matroid intersection problem with the rank sum oracle. We consider emulating Algorithm~\ref{alg:2}, i.e., {\sc CheapestPathAugment}$[E, w, {\mathcal{I}}_1, {\mathcal{I}}_2, I]$. \subsection{Searching a Shortest Cheapest Path} Take any $k \in \{0, 1, \dots, n - 1\}$ and let $I$ be a $w$-maximal set ${\mathcal{I}}_1^k \cap {\mathcal{I}}_2^k$. To emulate Algorithm~\ref{alg:2}, we want to find a shortest cheapest $S_I$--$T_I$ path in $D[I] = (E \setminus I, I; A_1[I]\cup A_2[I])$ with respect to vertex cost $c\colon E \to {\mathbb{R}}$ defined in Algorithm~\ref{alg:2}. With only the rank sum oracle, however, we cannot determine the sets $A_1[I]$, $A_2[I]$, $S_I$, and $T_I$, and hence cannot simply emulate Algorithm~\ref{alg:2}. We show that, despite this difficulty, we can compute a shortest cheapest $S_I$--$T_I$ path in $D[I]$. We first make some observations. Let $D'[I]=(E \setminus I, I; A'_1[I]\cup A'_2[I])$ be the subgraph of $D[I]$ obtained from $D[I]$ by removing arcs entering $S_I$ and leaving $T_I$, i.e., \begin{align*} A'_1[I] \coloneqq&\{\, (y, x) \mid x \in E \setminus (I \cup S_I),~y \in C_1(I, x) \,\},\\ A'_2[I] \coloneqq&\{\, (x, y) \mid x \in E \setminus (I \cup T_I),~y \in C_2(I, x) \,\}. \end{align*} Note that each element in $S_I\cap T_I$ is an isolated vertex in $D'[I]$. Recall that $D[I]$ has no negative cost cycle with respect to $c$ by Lemma~\ref{lem:negative_cycle}. This fact implies that finding a shortest cheapest $S_I$--$T_I$ path in $D[I]$ is equivalent to finding one in $D'[I]$. \begin{lemma}\label{lem:shortest-cheapest-path} Any shortest cheapest $S_I$--$T_I$ path in $D'[I]$ is a shortest cheapest $S_I$--$T_I$ path in $D[I]$. \end{lemma} \begin{proof} It is sufficient to show that any shortest cheapest $S_I$--$T_I$ path in $D[I]$ is contained in $D'[I]$. Suppose, to the contrary, that a shortest cheapest $S_I$--$T_I$ path $P$ uses some arc $(y,s^*)\in A_1[I]\setminus A'_1[I]$ or $(t^*,y)\in A_2[I]\setminus A'_2[I]$, and let $s \in S_I$ and $t \in T_I$ be its end vertices. If $P$ uses $(y,s^*)\in A_1[I]\setminus A'_1[I]$, let $P(s,y)$ and $P(s^*,t)$ be the subpaths of $P$ from $s$ to $y$ and from $s^*$ to $t$, respectively. Since $(y,s)\in A_1[I]$, the path $P(s,y)$ is extended to a cycle with the same vertex set in $D[I]$, and hence $c(P(s,y))$ is nonnegative by Lemma~\ref{lem:negative_cycle}. Then $c(P)=c(P(s,y))+c(P(s^*,t))\geq c(P(s^*,t))$ and $|P(s^*,t)|<|P|$, which contradicts that $P$ is a shortest cheapest $S_I$--$T_I$ path in $D[I]$. If $P$ uses $(t^*,y)\in A_2[I]\setminus A'_2[I]$, we can similarly show that $P(s,t^*)$ is an $S_I$--$T_I$ path that is at least as cheap as $P$ and shorter than $P$. \end{proof} While we cannot determine $S_I$ and $T_I$, we can determine $S_I\cup T_I$ as $S_I\cup T_I=\{\,s\in E\setminus I\mid {r_\mathrm{sum}}(I+s)\geq 2|I|+1\,\}$. We now provide a search algorithm with the rank sum oracle. Its description is given as Algorithm~\ref{alg:3}. For any $s\in S_I$ (resp., $s\in T_I$), it emulates the Bellman--Ford algorithm in $D'[I]$ (resp., in the inverse of $D'[I]$) rooted at $s$ without knowing $D'[I]$ explicitly. Since there is no negative cost cycle in $D'[I]$ by Lemma~\ref{lem:negative_cycle}, the algorithm finds shortest cheapest paths from $s$ to all reachable vertices, and it returns a shortest cheapest $s$--$T_I$ path (resp., $s$--$S_I$ path) if it exists. By applying this search algorithm for all $s\in S_I\cup T_I$, we can obtain a shortest cheapest $S_I$--$T_I$ path in $D'[I]$, which is also a shortest cheapest path in $D[I]$ by Lemma~\ref{lem:shortest-cheapest-path}. For each $e\in E$, the algorithm maintains a sequence $P_e$ of distinct elements of $E$. We will show that $P_e$ is an $s$--$e$ path in $D'[I]$. For a sequence $P_e$ and an element $e'\in E\setminus P_e$, we denote by $P_e+e'$ the sequence obtained by appending $e'$ to $P_e$. \begin{algorithm2e} \caption{{\sc EmulatingBellmanFord}$[E, c, {r_\mathrm{sum}}, I, s]$} \label{alg:3} \SetAlgoLined \SetKwInOut{Input}{Input}\SetKwInOut{Output}{Output} \Input{A finite set $E$, a weight function $w \colon E \to {\mathbb{R}}$, which defines $c \colon E \to {\mathbb{R}}$ by \eqref{eq:cost}, oracle access to ${r_\mathrm{sum}} \colon 2^E \to {\mathbb{Z}}_{\geq 0}$, a $w$-maximal set $I \in {\mathcal{I}}_1^k\cap {\mathcal{I}}_2^k$ for some $k \in\{ 0, 1, \dots, n - 1\}$, and $s\in S_I\cup T_I$.} \Output{For $s\in S_I$ (resp., $s\in T_I$), a shortest cheapest $s$--$T_I$ path (resp., $s$--$S_I$ path) in $D'[I]$ (resp, in the inverse of $D'[I]$) with respect to $c$ if one exists, or a message \emph{``No''} otherwise.} \BlankLine Set $P_s \gets s$, and $P_e \gets {\mathsf{null}}$ for each $e\in E-s$. For $\ell=1,2,\dots,n-1$, do the following. \protect{ \begin{description} \item[If $\ell$ is odd:] For each $y\in I$, do the following. \begin{itemize} \item Let $x\in E\setminus I$ minimize $c(P_x)$ subject to $P_x\neq {\mathsf{null}}$, $y\not\in P_x$, and \begin{align*} (*)\quad{r_\mathrm{sum}}(I\triangle P_x)=2|I|+1,\quad{r_\mathrm{sum}}(I\triangle(P_x+y))=2|I|.&& \end{align*} \item If $c(P_x+y)<c(P_y)$, update $P_y\gets P_x+y$. \end{itemize} \item[If $\ell$ is even:] For each $x\in E\setminus I$, do the following. \begin{itemize} \item Let $y\in I$ minimize $c(P_y)$ subject to $P_y\neq {\mathsf{null}}$, $x\not\in P_y$, and \begin{align*} (**)\quad&[~{r_\mathrm{sum}}(I+x)=2|I|,~{r_\mathrm{sum}}(I\triangle (P_y+x))=2|I|+1~]~\text{or}&&\\ &[~{r_\mathrm{sum}}(I+x)=2|I|+1,~ {r_\mathrm{sum}}(I\triangle (P_y+x))=2|I|+2~].&& \end{align*} \item If $c(P_y+x)<c(P_x)$, update $P_x\gets P_y+x$. \end{itemize} \end{description} } Let $t\in E\setminus I$ minimize $c(P_t)$ subject to ${r_\mathrm{sum}}(I\triangle P_t)=2|I|+2$. Return $P_t$ if $c(P_t)\neq\infty$, and otherwise return \emph{``No''}. \end{algorithm2e} \subsection{Correctness of the Search} The following lemma shows an important property of Algorithm~\ref{alg:3}, where we can assume that $s$ belongs to $S_I = \{\, s \in E \setminus I \mid I + s \in {\mathcal{I}}_1 \,\}$ by symmetry. (For $s\in T_I = \{\, s \in E \setminus I \mid I + s \in {\mathcal{I}}_2 \,\}$, replace $D'[I]$ with its inverse in the arguments.) \begin{lemma}\label{lem:invariants2} Let $s\in S_I$ and take any $\ell=1,2,\dots,n-1$. For any $e\in E$, just after the $\ell$th updating process of Step~2 of Algorithm~\ref{alg:3}, the sequence $P_e$ is a shortest cheapest $s$--$e$ path in $D'[I]$ subject to $|P_e|\leq \ell+1$, where $P_e={\mathsf{null}}$ means that there is no such path. \end{lemma} \begin{proof} We use induction on $\ell$. Note that the statement holds if $\ell=0$. We show the statement for any $\ell>0$ assuming that it holds for $\ell-1$. We use the following two claims. \begin{claim}\label{claim:equivalence1} Suppose that, for any $e$, $P_e$ is a shortest cheapest $s$--$e$ path in $D'[I]$ subject to $|P_e|\leq \ell$. Then, for any $y\in I$ and $x\in E\setminus I$ such that [$P_x\neq {\mathsf{null}}$, $y\not\in P_x$, and $c(P_x+y)<c(P_y)$], condition $(\ast)$ holds if and only if $(x,y)\in A'_2[I]$. \end{claim} \begin{claim}\label{claim:equivalence2} Suppose that, for any $e$, $P_e$ is a shortest cheapest $s$--$e$ path in $D'[I]$ subject to $|P_e|\leq \ell$. Then, for any $x\in E\setminus I$ and $y\in I$ such that [$P_y\neq{\mathsf{null}}$, $x\not\in P_y$, and $c(P_y+x)<c(P_x)$], condition $(\ast\ast)$ holds if and only if $(y,x)\in A'_1[I]$. \end{claim} We postpone the proofs of these claims and complete the proof of the lemma relying on them. For any $e\in E$, let $P^{\ell-1}_e$ and $P^{\ell}_e$ be the sequence $P_e$ just after the $(\ell-1)$th and $\ell$th process, respectively. By induction, $P^{\ell-1}_e$ is a shortest cheapest $s$--$e$ path in $D'[I]$ subject to $|P_e|\leq \ell$. Let $P^*_e$ be any shortest cheapest $s$--$e$ path in $D'[I]$ subject to $|P^*_e|\leq \ell+1$. By the ``only if'' parts of Claims~\ref{claim:equivalence1} and~\ref{claim:equivalence2}, $P^{\ell}_e$ is an $s$--$e$ path in $D'[I]$ with $|P^{\ell}_e|\leq \ell+1$, and hence $c(P^*_e)\leq c(P^{\ell}_e)$. Also, $c(P^{\ell}_e)\leq c(P^{\ell-1}_e)$ by the algorithm. If $c(P^*_e)=c(P^{\ell-1}_e)$, then $P^{\ell}_e=P^{\ell-1}_e$ and the statement immediately follows. Otherwise, $c(P^*_e)<c(P^{\ell-1}_e)$. This implies $|P^*_e|=\ell+1$. Then $e\in I$ if $\ell$ is odd and $e\in E\setminus I$ if $e$ is even (recall that $D'[I]$ is a bipartite digraph between $E\setminus I$ and $I$). Let $e'$ be the second last element in $P^*_e$ and let $P^*_{e'}:=P^*_{e}-e$ (i.e., delete $e$ from $P^*_e$). Then $P^*_{e'}$ is an $s$--$e'$ path with $|P_{e'}|=\ell$, and hence $c(P^{\ell-1}_{e'})\leq c(P^*_{e'})$. So $c(P^{\ell-1}_{e'}+e)\leq c(P^*_e)<c(P^{\ell-1}_e)$. If $\ell$ is odd, then $(e',e)\in A'_2[I]$, and hence ($\ast$) holds with $x:=e'$ and $y:=e$ by Claim~\ref{claim:equivalence1}. If $\ell$ is even, then $(e',e)\in A'_1[I]$, and hence ($\ast\ast$) holds with $y:=e'$ and $x:=e$ by Claim~\ref{claim:equivalence2}. In either case, we obtain $c(P^\ell_e)\leq c(P^*_{e'}+e)=c(P^*_e)$ and $|P^{\ell}_e|\leq \ell+1=|P^*_e|$. Hence $P^\ell_e$ is a shortest cheapest $s$--$e$ path subject to $|P_e|\leq \ell+1$. \end{proof} In what follows, we prove Claims~\ref{claim:equivalence1} and~\ref{claim:equivalence2}. First, we need the following lemma. \begin{lemma}\label{lem:invariants1} Let $s\in S_I$. At any moment of the algorithm, the following conditions hold. \begin{enumerate} \item[\rm (a)] Any $y\in I$ with $P_y\neq {\mathsf{null}}$ satisfies $|I\triangle P_y|=|I|$, $r_1(I\triangle P_y)=|I|$, and $r_2(I\triangle P_y)=|I|$. \item[\rm (b)] Any $x\in E\setminus I$ with $P_x\neq {\mathsf{null}}$ satisfies $|I\triangle P_x|=|I|+1$, $r_1(I\triangle P_x)=|I|+1$, and $r_2(I\triangle P_x)\geq|I|$. Moreover, it satisfies $r_2(I\triangle P_x)=|I|+1$ if and only if $x\in T_I$. \item[\rm (c)] For each $e\in E$ with $P_e \neq {\mathsf{null}}$, we have $(P_e-s)\cap S_I=\emptyset$ and $(P_e-e)\cap T_I=\emptyset$. \end{enumerate} \end{lemma} \begin{proof} By the algorithm, for each $e\in E$ with $P_e\neq {\mathsf{null}}$, the sequence $P_e$ starts with $s\in E\setminus I$ and uses elements in $E\setminus I$ and $I$ alternately. Then $|I\triangle P_y|=|I|$ for any $y\in I$ with $P_y\neq{\mathsf{null}}$ and $|I\triangle P_x|=|I|+1$ for any $x\in E\setminus I$ with $P_x\neq{\mathsf{null}}$. For any $y\in I$, after $P_y$ is updated, it satisfies ${r_\mathrm{sum}}(I\triangle P_y)=2|I|$ by the condition ($\ast$) for update. Then (a) follows. For any $e\in E\setminus I$ with $P_e \neq {\mathsf{null}}$, any $x'\in (P_e\setminus I)-e$ has some succeeding element $y'\in I$ in $P_e$ and ($\ast$) holds for $x'$ and $y'$. Hence ${r_\mathrm{sum}}(I\triangle P_{x'})=2|I|+1$. If $x'=s\in S_I$, it immediately implies $x'\not\in T_I$. If $x'\neq s$, then $x'$ has some preceding element $y''$ in $P_x$, and ($\ast\ast$) for $y''$ and $x'$ implies ${r_\mathrm{sum}}(I+x')=2|I|$, and hence $x'\not\in S_I\cup T_I$. Thus, $s\in S_I\setminus T_I$ and any $x'\in (P_e\setminus I)-s-e$ satisfies $x'\not\in S_I\cup T_I$. For any $x\in (E\setminus I)-s$ with $P_x\neq {\mathsf{null}}$, by ($\ast\ast$) for $x$ and its preceding element $y$, we have $[{r_\mathrm{sum}}(I+x)=2|I|, {r_\mathrm{sum}}(I\triangle P_x)=2|I|+1]$ or $[{r_\mathrm{sum}}(I+x)=2|I|+1, {r_\mathrm{sum}}(I\triangle P_x)=2|I|+2]$. In the former case, ${r_\mathrm{sum}}(I+x)=2|I|$ implies $x\not\in S_I\cup T_I$, and hence $P_x\cap T_I=\emptyset$. This implies $r_2(I\triangle P_x)\leq r_2(I \cup P_x) = |I|$, and then ${r_\mathrm{sum}}(I\triangle P_x)=2|I|+1$ implies $r_1(I\triangle P_x)=|I|+1$ and $r_2(I\triangle P_x)=|I|$. In the latter case, ${r_\mathrm{sum}}(I\triangle P_x)=2|I|+2$ implies $r_1(I\triangle P_x)=r_2(I\triangle P_x)=|I|+1$. Since any $x' \in (P_x \setminus I) - x$ satisfies $x' \not\in T_I$ (as seen in the previous paragraph), we must have $x\in T_I$, and then $x\not\in S_I$ follows from ${r_\mathrm{sum}}(I+x)=2|I|+1$. Thus, (b) and (c) are shown. \end{proof} Now we are ready to show Claims~\ref{claim:equivalence1} and~\ref{claim:equivalence2}. We sometimes denote by $V(P)$ the set of elements in a sequence $P$ for emphasizing that we focus on the set rather than the sequence. \begin{proof}[Proof of Claim~\ref{claim:equivalence1}] By Lemma~\ref{lem:invariants1}(b), ${r_\mathrm{sum}}(I\triangle P_x)=2|I|+1$ is equivalent to $x\not\in T_I$. Lemma~\ref{lem:invariants1}(b) also implies $r_1(I\triangle P_x)=|I|+1=|I\triangle P_x|$, and hence $r_1(I\triangle (P_x+y))=r_1((I\triangle P_x)-y)=|I|$. Therefore, ${r_\mathrm{sum}}(I\triangle (P_x+y))=2|I|$ is equivalent to $r_2(I\triangle (P_x+y))=|I|=|I\triangle (P_x+y)|$, i.e., $I\triangle (P_x+y)\in {\mathcal{I}}_2$. Then, the condition $(\ast)$ is equivalent to \begin{align*} (*)'\quad x \not\in T_I,\quad I \triangle (P_x + y) \in {\mathcal{I}}_2. \end{align*} We show that $(\ast)'$ holds if and only if $(x,y)\in A'_2[I]$. By induction hypothesis, $P_x$ is an $s$--$x$ path in $D'[I]$, and hence it uses arcs of $A'_2[I]$ and $A'_1[I]$ alternately. Let $N_1$ and $N_2$ be the sets of those arcs of $A'_1[I]$ and $A'_2[I]$, respectively. Since $x\in E\setminus I$, $N_1$ forms a matching that covers $V(P_x)-s$ and $N_2$ forms a matching that covers $V(P_x)-x$. To show the ``if'' part, suppose $(x,y)\in A'_2[I]$. Then $x\not\in T_I$ by the definition of $A'_2[I]$. Also, $N'_2:=N_2+(x,y)\subseteq A'_2[I]$ forms a perfect matching on $V(P_x+y)$. Suppose conversely that $I\triangle (P_x+y)\not\in {\mathcal{I}}_2$. Then Lemma~\ref{lem:UPM} implies that $A_2[I]$ contains some other perfect matching $N''_2$ on $V(P_x+y)$. We see that $N''_2\subseteq A'_2[I]$ because $(P_x+y)\cap T_I=\emptyset$ by Lemma~\ref{lem:invariants1}(c) and $x\not\in T_I$. Thus, $N'_2$, $N''_2$, and $N_1$ are all contained in $D'[I]$. Consider the digraph $D=(V(P_x+y), A)$ whose arc set $A$ consists of the arcs in $N'_2$, $N''_2$, and two copies of $N_1$, where we consider their multiplicity, i.e., each arc in $(N'_2 \cap N''_2) \cup N_1$ is taken twice (parallel). Since $N''_2\neq N'_2$, there exists an arc in $N''_2$ whose head precedes its tail on the path $P_x+y$. Then $D$ contains at least one directed cycle. The indegree and outdegree of each vertex in $D$ are given as $(d^{\rm in}(s),d^{\rm out}(s))=(0,2)$, $(d^{\rm in}(y),d^{\rm out}(y))=(2,0)$, and $(d^{\rm in}(e),d^{\rm out}(e))=(2,2)$ for all the other vertices $e$. Then $A$ can be decomposed into the arc sets of two $s$--$y$ paths and one or more cycles. Let $P_1$ and $P_2$ be those $s$--$y$ paths and $\mathcal{Q}$ be the set of those cycles (where paths and cycles are sequences of vertices). Then each vertex in $V(P_x+y)$ is used exactly twice in this decomposition, and hence \[\textstyle{c(P_1)+c(P_2)+\sum_{Q \in \mathcal{Q}}c(Q)=2c(P_x+y).}\] Since $D'[I]$ has no negative cycle, this implies $c(P_1)+c(P_2)\leq 2c(P_x+y)$. Also, $\mathcal{Q}\neq \emptyset$ implies $V(P_1)\subsetneq V(P_x+y)$ or $V(P_2)\subsetneq v(P_x+y)$. In case $V(P_1)=V(P_x+y)$, we have $V(P_2)\subsetneq V(P_x+y)$, which implies $|P_2|<|P_x+y|\leq\ell+1$ because $|P_x|\leq \ell$ holds by induction. Also, $V(P_1)=V(P_x+y)$ implies $c(P_2)\leq c(P_x+y)$, where $c(P_x+y)<c(P_y)$ by assumption. Thus, $P_2$ is an $s$--$y$ path in $D'[I]$ with $c(P_2)<c(P_y)$ and $|P_2|\leq \ell$, which contradicts the induction hypothesis that $P_y$ is a shortest cheapest $s$--$y$ path subject to $|P_y|\leq \ell$. The case $V(P_2)=V(P_x+y)$ is similar. In case $V(P_1)\subsetneq V(P_x+y)$ and $V(P_2)\subsetneq V(P_x+y)$, both $P_1$ and $P_2$ satisfy $|P_i|\leq \ell$ and at least one of them, say $P_i$, satisfies $c(P_i)\leq c(P_x+y)<c(P_y)$, which again contradicts the induction hypothesis on $P_y$. We next show the ``only if'' part. Let $(\ast)'$ hold. By $I\triangle (P_x+y)\in {\mathcal{I}}_2$, Lemma~\ref{lem:UPM-inv} implies that $A_2[I]$ contains a perfect matching $N'_2$ on $V(P_x+y)$. Also, $N'_2\subseteq A'_2[I]$ because $(P_x+y)\cap T_I=\emptyset$ by Lemma~\ref{lem:invariants1}(c) and $x\not\in T_I$. Thus, $N_2$, $N'_2$, and $N_1$ are all contained in $D'[I]$. Consider the digraph $D^*=(V(P_x+y), A^*)$ whose arc set $A^*$ consists of the arcs in $N_2$, $N'_2$, and two copies of $N_1$, where we consider their multiplicity as before. Conversely, suppose that $(x,y)\not\in A'_2[I]$. Then $(x,y)\not\in N'_2$. Since $N'_2$ covers $V(P_x+y)$, it has an arc whose tail is $x$ and whose head precedes $x$ in the path $P_x+y$. Then $D^*$ contains at least one directed cycle. Note that $(d^{\rm in}(s),d^{\rm out}(s))=(0,2)$, $(d^{\rm in}(x),d^{\rm out}(x))=(2,1)$, $(d^{\rm in}(y),d^{\rm out}(y))=(1,0)$, and $(d^{\rm in}(e),d^{\rm out}(e))=(2,2)$ for all the other vertices $e$ in $D^*$. Then $A^*$ can be decomposed into the arc sets of one $s$--$x$ path, one $s$--$y$ path, and one or more cycles. Let $R_x$, $R_y$, and $\mathcal{Q}'$ be that $s$--$x$ path, $s$--$y$ path, and the set of cycles, respectively. Then each vertex in $V(P_x+y)-y$ is used twice and $y$ is used once in this decomposition, and hence \[\textstyle{c(R_x)+c(R_y)+\sum_{Q \in \mathcal{Q}'}c(Q)=c(P_x)+c(P_x+y).}\] Since $D'[I]$ has no negative cost cycle, $c(R_x)+c(R_y)\leq c(P_x)+c(P_x+y)$. Also, $\mathcal{Q}\neq \emptyset$ implies $V(R_x)\subsetneq V(P_x)$ or $V(R_y)\subsetneq v(P_x+y)$. If $V(R_x)=V(P_x)$, then $V(R_y)\subsetneq V(P_x+y)$, which implies $|R_y|<|P_x+y|\leq \ell+1$. Also, $V(R_x)=V(P_x)$ implies $c(R_y)\leq c(P_x+y)<c(P_y)$. Thus, $R_y$ is an $s$--$y$ path with $c(R_y)<c(P_y)$ and $|R_y|\leq \ell$, which contradicts the induction hypothesis on $P_y$. In case $V(R_y)=V(P_x+y)$, we have $V(R_x)\subsetneq V(P_x)$, which implies $|R_x|<|P_x|$. Also, $V(R_y)=V(P_x+y)$ implies $c(R_x)\leq c(P_x)$. Thus, $R_x$ is an $s$--$x$ path with $c(R_x)\leq c(P_x)$ and $|R_x|<|P_x|$, which contradicts the induction hypothesis on $P_x$. In case $V(R_x)\subsetneq V(P_x)$ and $V(R_y)\subsetneq V(P_x+y)$, we have $|R_x|<|P_x|$ and $|R_y|\leq \ell$. Also, we have $c(R_x)\leq c(P_x)$ or $c(R_y)\leq c(P_x+y)<c(P_y)$, and each of them yields a contradiction. \end{proof} \begin{proof}[Proof of Claim~\ref{claim:equivalence2}] Since $I\triangle (P_y+x)=(I\triangle P_y)+x$, Lemma~\ref{lem:invariants1}(a) implies $|I\triangle (P_y+x)|=|I|+1$, $r_1(I\triangle (P_y+x))\geq |I|$, and $r_2(I\triangle (P_y+x))\geq |I|$. Also, by Lemma~\ref{lem:invariants1}(c), we have $P_y\cap T_I=\emptyset$ (which implies $\mathrm{cl}_2(I)=\mathrm{cl}_2(I\triangle P_y)$), and hence $r_2(I\triangle (P_y+x))=|I|+1$ holds if and only if $x\in T_I$. If $x\not\in T_I$ (resp., $x\in T_I$), then ${r_\mathrm{sum}}(I\triangle (P_y+x))=2|I|+1$ (resp., ${r_\mathrm{sum}}(I\triangle (P_y+x))=2|I|+2$) is equivalent to $r_1(I\triangle (P_y+x))=|I|+1$, and also ${r_\mathrm{sum}}(I+x)=2|I|$ (resp., ${r_\mathrm{sum}}(I+x)=2|I|+1$) is equivalent to $x\not\in S_I$. Therefore, $(\ast\ast)$ is equivalent to \begin{align*} (**)'\quad x\not\in S_I,\quad I\triangle (P_y+x)\in {\mathcal{I}}_1. \end{align*} We show that $(\ast\ast)'$ holds if and only if $(y,x)\in A'_1[I]$. By induction hypothesis, $P_y$ is an $s$--$y$ path in $D'[I]$, and hence it uses arcs of $A'_2[I]$ and $A'_1[I]$ alternately. Let $N_1$ and $N_2$ be the sets of those arcs of $A'_1[I]$ and $A'_2[I]$, respectively. Then $N_1$ forms a matching that covers $V(P_y)-y-s$ and $N_2$ forms a matching that covers $V(P_y)$. To show the ``if'' part, suppose $(y,x)\in A'_1[I]$. Then $x\not\in S_I$ by the definition of $A'_1[I]$. Also, $N'_1:=N_1+(y,x)\subseteq A'_1[I]$ forms a perfect matching on $V(P_y+x)-s$. Suppose conversely that $I\triangle (P_y+x)\not\in {\mathcal{I}}_1$. It implies $I\triangle(P_y+x-s)\not\in{\mathcal{I}}_1$ as follows. Lemma~\ref{lem:invariants1}(c) implies $(P_y+x)\cap S_I=\{s\}$, and hence $\mathrm{cl}_1(I\triangle (P_y+x-s))\subseteq \mathrm{cl}_1(I)$. If $\mathrm{cl}_1(I\triangle (P_y+x-s)) = \mathrm{cl}_1(I)$, then $\mathrm{cl}_1(I \triangle (P_y + x)) = \mathrm{cl}_1(I + s)$, and $I \triangle (P_y + x) \in {\mathcal{I}}_1$ as $I + s \in {\mathcal{I}}_1$, a contradiction. Thus, we have $\mathrm{cl}_1(I\triangle (P_y+x-s)) \subsetneq \mathrm{cl}_1(I)$, which implies $I \triangle (P_y + x - s) \not\in {\mathcal{I}}_1$. Then Lemma~\ref{lem:UPM} implies that $A_1[I]$ contains some other perfect matching $N''_1$ on $V(P_y+x)-s$. We see that $N''_1\subseteq A'_1[I]$ because $(P_y+x-s)\cap S_I=\emptyset$ by Lemma~\ref{lem:invariants1}(b) and $x\not\in S_I$. Thus, $N'_1$, $N''_1$, and $N_2$ are all contained in $D'[I]$. Consider the digraph $D=(V(P_x+y), A)$ whose arc set $A$ consists of the arcs in $N'_1$, $N''_1$, and two copies of $N_2$, where we consider their multiplicity as before. Similarly to the proof of Claim~\ref{claim:equivalence1}, we see that there exists an $s$--$y$ path $P$ in $D'[I]$ with $c(P)<c(P_x)$ and $|P|\leq \ell$, which contradicts the induction hypothesis on $P_x$. We next show the ``only if'' part. Let $(\ast\ast)'$ hold. By $I\triangle (P_y+x-s)\subseteq I\triangle (P_y+x) \in {\mathcal{I}}_1$, Lemma~\ref{lem:UPM-inv} implies that $A_1[I]$ contains a perfect matching $N'_1$ on $V(P_y+x)-s$. Also, $N'_1\subseteq A'_1[I]$ because $(P_y+x-s)\cap S_I=\emptyset$ by Lemma~\ref{lem:invariants1}(c) and $x\not\in S_I$. Thus, $N_1$, $N'_1$, and $N_2$ are all contained in $D'[I]$. Consider the digraph $D^*=(V(P_x+y), A^*)$ whose arc set $A^*$ consists of the arcs in $N_1$, $N'_1$, and two copies of $N_2$, where we consider their multiplicity as before. Then, similarly to the proof of Claim~\ref{claim:equivalence1}, we see that there exists an $s$--$y$ or $s$--$x$ path whose property contradicts the induction hypothesis on $P_y$ or $P_x$. \end{proof} \begin{lemma}\label{lem:BellmanFord} The output of {\sc EmulatingBellmanFord}$[E, c, {r_\mathrm{sum}}, I, s]$ is always correct. \end{lemma} \begin{proof} For any $e\in E$, a shortest cheapest $s$--$e$ path $P$ satisfies $|P|\leq n$. Then, after the $(n-1)$th updating process, $P_e$ is indeed a shortest cheapest $s$--$e$ path by Lemma~\ref{lem:invariants2}. Also, when some path is returned, it is a shortest cheapest $s$--$T_I$ path by Lemma~\ref{lem:invariants1}(b). \end{proof} \subsection{Matroid Intersection Algorithm under Rank Sum Oracle} Using Algorithm~\ref{alg:3} as a subroutine, we can emulate {{\sc CheapestPathAugment}$[E, w, {\mathcal{I}}_1, {\mathcal{I}}_2, I]$} as Algorithm~\ref{alg:4}. \begin{algorithm2e} \caption{{{\sc CheapestPathAugmentRankSum}$[E, w, {\mathcal{I}}_1, {\mathcal{I}}_2, I]$}} \label{alg:4} \SetAlgoLined \SetKwInOut{Input}{Input}\SetKwInOut{Output}{Output} \Input{A finite set $E$, a weight function $w \colon E \to {\mathbb{R}}$, oracle access to ${r_\mathrm{sum}} \colon 2^E \to {\mathbb{Z}}_{\geq 0}$, and a $w$-maximal set $I \in {\mathcal{I}}_1^k \cap {\mathcal{I}}_2^k$ for some $k = 0, 1, \dots, n - 1$.} \Output{A $w$-maximal set $J \in {\mathcal{I}}_1^{k+1} \cap {\mathcal{I}}_2^{k+1}$ if one exists, or a message \emph{``No''}.} \BlankLine Determine the set $S_I\cup T_I=\{\,s\in E\setminus I\mid {r_\mathrm{sum}}(I+s)\geq 2|I|+1\,\}$. Define a cost function $c \colon E \to {\mathbb{R}}$ by \eqref{eq:cost}. For each $s\in S_I\cup T_I$, apply {\sc EmulatingBellmanFord}$[E, c, {r_\mathrm{sum}}, I, s]$. If some path is returned in Step 2, then let $P$ be a shortest cheapest one among all returned paths, and return $J = I \triangle P$. Otherwise, return a message \emph{``No''}. \end{algorithm2e} The following theorem concludes the section. \begin{lemma}\label{lem:cpars} The output of {\sc CheapestPathAugmentRankSum}$[E, w, {\mathcal{I}}_1, {\mathcal{I}}_2, I]$ is always correct. \end{lemma} \begin{proof} The correctness of Algorithm~\ref{alg:4} immediately follows from Lemmas~\ref{lem:shortest-cheapest-path} and~\ref{lem:BellmanFord}. \end{proof} Lemma~\ref{lem:cpars} completes the proof of Theorem~\ref{thm:ranksum}. \begin{proof}[Proof of Theorem~\ref{thm:ranksum}] Starting from $I=\emptyset$, the size of the common independent set can be gradually increased using {\sc CheapestPathAugmentRankSum}$[E, w, {\mathcal{I}}_1, {\mathcal{I}}_2, I]$ until $I$ becomes a common independent set of maximum cardinality. The correctness of the algorithm follows from Lemma~\ref{lem:cpars}. Note that, if we are asked to find a maximum-weight common independent set, then it suffices to output one with maximum weight among the obtained $w$-maximal common independent sets. \end{proof}
{'timestamp': '2022-09-30T02:06:33', 'yymm': '2209', 'arxiv_id': '2209.14516', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14516'}
arxiv
\section{Introduction} \label{sec:intro} About $13$ million people in Bangladesh are suffering from different degrees of hearing loss, of which $3$ million have hearing disability~\cite{alauddin2004deafness}. There are around $1$ million using Bangladeshi Sign Language (BdSL) in their everyday life\cite{c2}. While communicating with a signer , there are two major tasks for a non-signer: \textit{(i)} understanding the signs and \textit{(ii)} expressing the signs. Researchers made impressive contributions to task~\textit{(i)} by developing sign letters\footnote{signs that represent letters only.} recognition techniques from images (Fig.~\ref{fig:teaser}~\protect\includegraphics[scale=.18]{crc1.png}). Several works has been proposed for BdSL letters classification via machine learning techniques~\cite{islam2022improving, rahim2022soft, miah2022bensignnet, hasan2021shongket, khatun2021systematic, talukder2021okkhornama, Hoque_2020_ACCV, BdSLiciet}. Task \textit{(ii)} still has less research attention since it is a difficult process for non-signers. A naive and tiresome approach to expressing signs is to use flashcards with signs and symbols. Being inspired by that,~\cite{shishir2020esharagan} proposed a system that generates symbols of signs using generative adversarial networks (GANs)~\cite{goodfellow2014generative}. However, their work only produces symbols of signs---which may raise questions regarding the necessity of such a system. Another way is by using animated avatars of signs, i.e.~\cite{KippAvat}; but there is no such system for BdSL. Moreover, an avatar-based system does not provide a realistic environment for communication. All the above scenarios inspired us to make task~\textit{(ii)} more realistic yet effortless. Hence, we introduced \textit{\textbf{PerSign}: {Pers}onalized Bangladeshi {Sign} Letters Synthesis} which converts the image of a user into an image showing signs while keeping the person's profile unchanged. Fig.~\ref{fig:teaser}~\protect\includegraphics[scale=.19]{crc2.png} explains the working pipeline of our prototype. A user first uploads their profile photo ($I_P$) only once to our system. The $I_P$ must follow a specific rule of showing hand and palm (as shown in~\protect\includegraphics[scale=.19]{crc2.png}{$^{a}$}). After that, the user inserts the desired letter ($L$) to be expressed (e.g. \protect\includegraphics[scale=.17]{Ga.png} in \protect\includegraphics[scale=.19]{crc2.png}{$^{b}$}). Our system converts $I_P$ into $I_L$ by considering $L$. This can be seen as $I_L \leftarrow I_P+L$, where $I_L$ contains the same person in $I_P$ with unchanged face, skin tone, attire, and background (\protect\includegraphics[scale=.19]{crc2.png}{$^{c}$}). In that case, the person does not need any expertise in sign language. We believe, a signer will feel a natural environment if $I_L$ is shown, thus, making the communication more realistic and affectionate. \textbf{\textit{\color{blue}Do we really need such a system?}}---in order to address this question, we performed a survey on a group of $6$ {guardians} and $11$ {teachers} of deaf children---who were also signers---regarding the necessity of our system. We let participants upload profile images to \textit{PerSign} and asked them to rate the results on a scale of \textcircled{\small 1} to \textcircled{\small 5} according to \textit{Likert} rating method~\cite{likert1932technique}, with \textcircled{\small 1} being \textit{not necessary at all} and \textcircled{\small 5} being \textit{very necessary}. Out of total $17$ participants, $13$ and $3$ rated \textit{PerSign} with \textcircled{\small 5} and \textcircled{\small 4} respectively with an average rating of $4.705$. Most of the sign language teachers commented that \textit{personalized} signs are very helpful for general people to get closer to signers, especially when it comes to children. \section{Implementation} We employed the \textit{Generative Adversarial Network} (Fig.~\ref{fig:teaser}~\protect\includegraphics[scale=.18]{crc3.png}), an unsupervised deep learning technique that automatically learns the patterns from datasets in order for the model to produce a new output~\cite{goodfellow2014generative}. Our problem lies under a sub-domain of GAN which \textit{image-to-image translation}~\cite{isola2017image} and we adopted \textit{GestureGAN}~\cite{tang2018gesturegan}---a gesture-to-gesture translation method---to implement a prototype system. For this purpose, we built a dataset of images with hand gestures of arbitrary poses, sizes, and backgrounds. Since we needed a paired dataset $\{I_P, I_L\}$ we could not reuse any of the existing unpaired ones. For localizing gestures and appearances, we exploited \textit{OpenPose}~\cite{8765346} to make the skeleton of the hands and face of the images and store the pair of input and output images. We then trained and tested the \textit{GestureGAN} model with our dataset, and constructed our system's working prototype. Fig.~\ref{fig:res} presents more results of \textit{PerSign}. \begin{figure}[htb] \includegraphics[width=0.49\textwidth]{res2.png} \caption{Result analysis. (a) input profile image. (b) generated image with signs. (c) zoomed view of faces from input \textit{(left)} and output \textit{(right)}. We can see, that the face is retained.} \label{fig:res} \Description {A picture of the result obtained exclusively showing the face and hand-gestures.} \end{figure} \section{Conclusion and Future work } In this poster, we proposed a framework---\textit{PerSign}---for synthesizing Bangladeshi Sign Letters that can be \textit{personalized}. Through our method, anyone will be able to communicate as a signer without having any expertise in BdSL. We built our own dataset and exploited \textit{GestureGAN} method to accomplish the task. Our work is still in progress and we gathered comments from the participants during the survey to find areas for improvement. Most of the users recommended applying the technique for a sequence of images to render video for a stream of input letters. We can achieve better results by increasing the number of diverse examples in our dataset. Though our dataset has samples for all BdSL letters, some specific letters need to be treated carefully because of their similarities in patterns. Our final aim is to merge task (\textit{i}) and (\textit{ii}) into a single system to provide an \textit{one-stop solution} for two-way communication. Some of the users also suggested extending our work for full gestures, rather than letters only. We are also intent on implementing better \textit{GUI} with voice input. Last but not the least, we plan to conduct a thorough evaluation from experts and signers. We believe, this poster opens new avenues in sign language for further research. \newpage \newpage \bibliographystyle{ACM-Reference-Format}
{'timestamp': '2022-09-30T02:08:42', 'yymm': '2209', 'arxiv_id': '2209.14591', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14591'}
arxiv
\section{Appendix} \label{s:App} In this section, we include additional comparisons to related work, additional definitions, proofs to the theorems in the main text, and additional experimental details. The code to reproduce the figures and experiments is available here: \url{https://github.com/cavalab/proportional-multicalibration}. \subsection{Related Work} \label{s:App:related} \paragraph{Definitions of Fairness} There are myriad ways to measure fairness that are covered in more detail in other works~\citep{barocasFairnessMachineLearning2019,chouldechovaFrontiersFairnessMachine2018,castelnovoZooFairnessMetrics2021}. We briefly review three notions here. The first, \textit{demographic parity}, requires the model's predictions to be independent of patient demographics ($A$). Although a model satisfying demographic parity can be desirable when the outcome should be unrelated to sensitive attributes~\citep{fouldsAreParityBasedNotions2020}, it can be unfair if important risk factors for the outcome are associated with those attributes~\citep{hardtEqualityOpportunitySupervised2016a}. For example, it may be more fair to admit socially marginalized patients to a hospital at a higher rate if they are assessed less able to manage their care at home. Furthermore, if the underlying rates of illness vary demographically, requiring demographic parity can result in a healthier patients from one group being admitted more often than patients who urgently need care. When the base rates of admission are expected to differ demographically, we can instead ask that the model's errors be balanced across groups. One such notion is \textit{equalized odds}, which states that for a given $Y$, the model's predictions should be independent of $A$. Satisfying equalized odds is equivalent to having equal FPR and FNR for every group in $A$. When the model is used for patient risk stratification, as in the target use case in this paper, it is important to consider a model's calibration for each demographic group in the data. Because risk prediction models influence who is prioritized for care, an unfairly calibrated model can systematically under-predict risk for certain demographic groups and result in under-allocation of patient care to those groups. Thus, guaranteeing group-wise calibration via an approach such as multicalibration also guarantees fair patient prioritization for health care provision. In some contexts, risk predictions are not directly interpreted, but only used to \textit{rank} patients, which in some contexts is sufficient for resource allocation. Authors have proposed various ways of measuring the fairness of model rankings, for example by comparing AUROC between groups~\citep{kallusAssessingAlgorithmicFairness2020}. \paragraph{Approaches to Fairness} Many approaches to achieving fairness guarantees according to demographic parity, equalized odds and its relaxations have been proposed~\citep{ dworkFairnessAwareness2012,hardtEqualityOpportunitySupervised2016a, berkConvexFrameworkFair2017,jiangIdentifyingCorrectingLabel2019a,kearnsPreventingFairnessGerrymandering2018}. When choosing an approach, is important to carefully weigh the relative impact of false positives, false negatives, and miscalibration on patient outcomes, which differ by use case. When group base rates differ (i.e., group-specific positivity rates), \emph{equalized odds and calibration by group cannot both be satisfied}~\citep{kleinbergInherentTradeoffsFair2016}. Instead, one can often equalized multicalibration while satisfying relaxations of equalized odds such as \emph{equalized accuracy}, where $Accuracy = \mu TPR+(1-\mu)(1-FPR)$ for a group with base rate $\mu$. However, to do so requires denigrating the performance of the model on specific groups~\citep{chouldechovaFairPredictionDisparate2017,pleissFairnessCalibration2017}, which is unethical in our context. As mentioned in the introduction, we are also motivated to utilize approaches to fairness that 1) dovetail well with intersectionality theory, and 2) provide privacy guarantees. Most work in the computer science/ machine learning space does not engage with the broader literature on socio-cultural concepts like intersectionality, which we see as a gap that makes adoption in real-world settings difficult~\citep{hanna2020towards}. One exception to this statement is differential fairness~\citep{fouldsIntersectionalDefinitionFairness2019}, a measure designed with intersectionality in mind. In addition to being a definition of fairness that provides equal protection to groups defined by intersections of protected attributes, models satisfying $\epsilon$-differential fairness also satisfy $\epsilon$-pufferfish privacy. This privacy guarantee is very desirable in risk prediction contexts, because it limits the extent to which the model reveals sensitive information to a decision maker that has the potential to influence their interpretation of the model's recommendation. However, prior work on differential fairness has been limited to using it to control for demographic parity, which is not an appropriate fairness measure for our use case~\citep{fouldsAreParityBasedNotions2020}. Multicalibration has inspired several extensions, including relaxations such as multiaccuracy~\citep{kimMultiaccuracyBlackboxPostprocessing2019}, low-degree multicalibration~\citep{gopalanLowDegreeMulticalibration2022}, and extensions to conformal prediction and online learning~\citep{jungMomentMulticalibrationUncertainty2021,guptaOnlineMultivalidLearning2021}. Noting that multicalibration is a guarantee over mean predictions on a collection of groups $\mathcal{C}$, \cite{jungMomentMulticalibrationUncertainty2021} propose to extend multicalibration to higher-order moments (e.g., variances), which allows one to estimate a confidence interval for the calibration error for each category. \cite{guptaOnlineMultivalidLearning2021} extend this idea and generalize it to the online learning context, in which an adversary chooses a sequence of examples for which one wishes to quantify the uncertainty of different statistics of the predictions. Recent work has also utilized higher order moments to ``interpolate" between the guarantees provided by multiaccuracy, which only requires accuracy in expectation for groups in $\mathcal{C}$, and multicalibration, which requires accuracy in expectation at each prediction interval~\citep{kimMultiaccuracyBlackboxPostprocessing2019}. Like proportional multicalibration (\cref{def:PMC}), definitions of multicalibration for higher order moments provide additional criteria for quantifying model performance over many groups; in general, however, much of the focus in other work is on statistics for uncertainty estimation. Like these works, one may view our proposal for proportional multicalibration as alternative definition of what it means to be multicalibrated. The key difference is that proportional multicalibration measures the degree to which multicalibration depends on differences in outcome prevalence between groups, and in doing so provides guarantees of pufferfish privacy and differential calibration. \cite{dworkLearningOutcomesEvidenceBased2019} study the relation of fair rankings to multicalibration, and, in a similar vein to differential fairness measures, formulate a fairness measure for group rankings using the relations between pairs of groups. However, these definitions are specific to the ranking relation between the groups, whereas differential calibration cares only about the outcome differential (conditioned on model predictions) between pairs of groups. \subsubsection{Differential Fairness} \label{s:App:DF} DF was explicitly defined to be consistent with the social theoretical framework of \emph{intersectionality}. This framework dates back as early as the social movements of the '60s and '70s \citep{collins_intersectionality_2020} and was brought into the academic mainstream by pioneering work from legal scholar Kimberlé Crenshaw~\citep{crenshawDemarginalizingIntersectionRace1989,crenshaw_mapping_1991} and sociologist Patricia Hill Collins~\citep{collins_black_1990}. Central to intersectionality is that hierarchies of power and oppression are structural elements that are fundamental to our society. Through an intersectional lens, these power structures are viewed as interacting and co-constituted, inextricably related to one another. To capture this viewpoint, DF~\citep{fouldsIntersectionalDefinitionFairness2019} constrains the differential of a general data mechanism among all pairs of groups, where groups are explicitly defined as the intersections of protected attributes in $\mathcal{A}$. \begin{definition}[$\epsilon$-differential fairness~\citep{fouldsIntersectionalDefinitionFairness2019}] \label{def:DF} Let $\Theta$ denote a set of distributions and let $x \sim \theta$ for $\theta \in \Theta$. A mechanism $M(x)$ is $\varepsilon$-differentially fair with respect to ($\mathcal{C}$,$\Theta$) for all $\theta \in \Theta$ with $x \sim \theta$, and $m \in Range(M)$ if, for all $(S_i,S_j) \in \mathcal{C} \times \mathcal{C}$ where $P(S_i|\theta)>0$, $P(S_j|\theta)>0$, \begin{equation}\label{eq:eDF} e^{-\varepsilon}\leq\frac{P_{M,\theta}(M(x)=m|S_i,\theta)}{P_{M,\theta}(M(x)=m|S_j,\theta)} \leq e^{\varepsilon} \end{equation} \end{definition} \begin{definition}[Pufferfish Privacy]\label{def:puff} Let the collection of subsets $\mathcal{C}$ represent sets of secrets. A mechanism $M({x})$ is $\epsilon$-\emph{pufferfish private} \citep{kiferPufferfishFrameworkMathematical2014} with respect to $(\mathcal{C}, \Theta)$ if for all $\theta \in \Theta$ with ${x} \sim \theta$, for all secret pairs $(S_i,S_j) \in \mathcal{C} \times \mathcal{C}$ and $y \in \mbox{Range}(M)$, \begin{equation} e^{-\epsilon} \leq \frac{P_{M, \theta}(M(x) = y| S_i, \theta)}{P_{M, \theta}(M(x) = y|S_j, \theta)}\leq e^\epsilon \mbox{ ,} \label{def:pufferfish} \end{equation} when $S_i$ and $S_j$ are such that $P(S_i|\theta) > 0$, $P(S_j|\theta) > 0$. \end{definition} \paragraph{Note on pufferfish and differential privacy} Although \cref{eq:eDF} is notable in its similarity to differential privacy~\citep{dwork2009differential}, they differ in important ways. Differential privacy aims to limit the amount of information learned about any one individual in a database by computations performed on the data (e.g. $M(x)$). Pufferfish privacy only limits information learned about the group membership of individuals as defined by $\mathcal{C}$. \cite{kiferPufferfishFrameworkMathematical2014} describe in detail the conditions under which these privacy frameworks are equivalent. \paragraph{Efficiency Property} \label{s:df-efficient} \cite{fouldsIntersectionalDefinitionFairness2019} also define an interesting property of $\varepsilon$-differential fairness that allows guarantees of higher order (i.e., marginal) groups to be met for free; the property is given in \cref{s:App:def}. \begin{definition}[Efficiency Property~\citep{fouldsIntersectionalDefinitionFairness2019}] \label{def:inter} Let $M(x)$ be an $\varepsilon$-differentially fair mechanism with respect to $(\mathcal{C},\Theta)$. Let the collection of subsets $\mathcal{C}$ group individuals according to the Cartesian product of attributes $A \subseteq \mathcal{A}$. Let $\cal G$ be any collection of subsets that groups individuals by the Cartesian product of attributes in $A'$, where $A' \subset A$ and $A' \neq \emptyset$. Then $M(x)$ is $\varepsilon$-differentially fair in $(\cal G,\Theta)$. \end{definition} The authors call this the "intersectionality property", yet its implication is the opposite: if a model satisfies $\epsilon$-DF for the low level (i.e. intersectional) groups in $\mathcal{C}$, then it satisfies $\epsilon$-DF for every higher-level (i.e. marginal) group. For example, if a model is ($\epsilon$)-differentially fair for intersectional groupings of individuals by race and sex, then it is $\epsilon$-DF for the higher-level race and sex groupings as well. Whereas the number of intersections grows exponentially as additional attributes are protected~\citep{kearnsPreventingFairnessGerrymandering2018}, the number of total possible subgroupings grows at a larger combinatorial rate: for $p$ protected attributes, we have $\sum_{k=1}^p{ \binom{p}{k} m_a^k}$ groups, where $m_a$ is the number of levels of attribute $a$. \paragraph{Limitations} To date, analysis of DF for predictive modeling has been limited to defining $R(x)$ as the mechanism, which is akin to asking for \emph{demographic parity}. Under demographic parity, one requires that model predictions be independent from group membership entirely, and this limits the utility of it as a fairness notion. Although a model satisfying demographic parity can be desirable when the outcome should be unrelated to $\mathcal{C}$~\citep{fouldsAreParityBasedNotions2020}, it can be unfair if important risk factors for the outcome are associated with demographics~\citep{hardtEqualityOpportunitySupervised2016a}. For example, if the underlying rates of an illness vary demographically, requiring demographic parity can result in a healthier patients from one group being admitted more often than patients who urgently need care. \subsection{Additional Definitions} \label{s:App:def} \begin{definition}[$\alpha$-calibration~\citep{hebert-johnsonCalibrationComputationallyIdentifiableMasses2018}] \label{def:calibration} Let $S \subseteq \mathcal{X}$. For $\alpha \in [0,1]$, $R$ is $\alpha$-\emph{calibrated} with respect to $S$ if there exists some $S' \subseteq S$ with $\card{S'} \ge (1-\alpha)\card{S}$ such that for all $r \in [0,1]$, $$ \card{ \E_D [ y | R(x) = r, x \in S' ] - r} \le \alpha. $$ \end{definition} \begin{definition}[$\alpha$-MC~\citep{hebert-johnsonCalibrationComputationallyIdentifiableMasses2018}] \label{def:MC} Let $\mathcal{C} \subseteq 2^{\mathcal{X}}$ be a collection of subsets of $\mathcal{X}$, $\alpha \in [0,1]$. A predictor $R$ is $\alpha$-multicalibrated on $\mathcal{C}$ if for all $S \in \mathcal{C}$, $R$ is $\alpha$-calibrated with respect to $S$. \end{definition} We note that, according to \cref{def:calibration}, a model need only be calibrated over a sufficiently large subset of each group ($S'$) in order to satisfy the definition. This relaxation is used to maintain a satisfactory definition of MC when working with discretized predictions. That is, with \cref{def:calibration}, \cite{hebert-johnsonCalibrationComputationallyIdentifiableMasses2018} show that $(\alpha, \lambda)$-multicalibrated models are at most $2\alpha$-multicalibrated. \subsubsection{Loss functions} The following loss functions are empirical analogs of the definitions of $MC$, $PMC$, and $DC$, and are used in the experiment section to measure performance. \begin{definition}[MC loss] \label{def:mcloss} Let $\mathcal{D} = \set{(y,x)_i}_{i=0}^{N} \sim D$, and let $\alpha, \lambda, \gamma > 0$. Define a collection of subsets $\mathcal{C} \in 2^{\mathcal{X}}$ such that for all $S \in \mathcal{C}, |S| \geq \gamma N$. Let $S_I = \set{x: R(x) \in I, x \in S}$ for $(S,I) \in \mathcal{C} \times \Lambda_\lambda$. Define the collection $\mathcal{S}$ containing all $S_I$ satisfying $S_I \geq \alpha \lambda N$. The MC loss of a model $R(x)$ on $\mathcal{D}$ is \[ \max_{S_I \in \mathcal{S}}{ \frac{1}{|S_I|} \card{\sum_{i \in S_I}{ y_i } - \sum_{i \in S_I}{ R_i }} } \] \end{definition} \begin{definition}[PMC loss] \label{def:pmcloss} Let $\mathcal{D} = \set{(y,x)_i}_{i=0}^{N} \sim D$, and let $\alpha, \lambda, \gamma, \rho > 0$. Define a collection of subsets $\mathcal{C} \in 2^{\mathcal{X}}$ such that for all $S \in \mathcal{C}, |S| \geq \gamma N$. Let $S_I = \set{x: R(x) \in I, x \in S}$ for $(S,I) \in \mathcal{C} \times \Lambda_\lambda$. Define the collection $\mathcal{S}$ containing all $S_I$ satisfying $S_I \geq \alpha \lambda N$. Let $\frac{1}{|S_I|}\sum_{i \in S_I}{ y_i } \geq \rho$. The PMC loss of a model $R(x)$ on $\mathcal{D}$ is \[ \max_{S_I \in \mathcal{S}}{ \frac{ \card{\sum_{i \in S_I}{ y_i } - \sum_{i \in S_I}{ R_i }} } { \sum_{i \in S_I}{ y_i } } } \] \end{definition} \begin{definition}[DC loss] \label{def:dcloss} Let $\mathcal{D} = \set{(y,x)_i}_{i=0}^{N} \sim D$, and let $\alpha, \lambda, \gamma > 0$. Define a collection of subsets $\mathcal{C} \in 2^{\mathcal{X}}$ such that for all $S \in \mathcal{C}, |S| \geq \gamma N$. Given a risk model $R(x)$ and prediction intervals $I$, Let $S_I = \set{x: R(x) \in I, x \in S}$ for $(S,I) \in \mathcal{C} \times \Lambda_\lambda$. Define the collection $\mathcal{S}$ containing all $S_I$ satisfying $S_I \geq \alpha \lambda N$. The DC loss of a model $R(x)$ on $\mathcal{D}$ is \[ \max_{(S_I^a,S_I^b) \in \mathcal{S} \times \mathcal{S}}{ \log{\card{ \frac{1}{|S_I^a|} \sum_{i \in S_I^a}{ y_i } - \frac{1}{|S_I^b|}\sum_{j \in S_I^b}{ y_j } }} } \] \end{definition} \subsection{Theorem Proofs} \label{s:proof} \paragraph{\cref{thm:alg}}\label{proof:alg} \textit{ \Paste{thm:alg} } \begin{proof} We show that \cref{alg:PMC} converges using a potential function argument~\citep{bansalPotentialfunctionProofsGradient2019}, similar to the proof techniques for the MC boosting algorithms in \cite{hebert-johnsonMulticalibrationCalibrationComputationallyIdentifiable2018,kimMultiaccuracyBlackboxPostprocessing2019}. Let $p^*_i$ be the underlying risk, $R_i$ be our initial model, and $R'_i$ be our updated prediction model for individual $i \in S_r$, where $S_r = \{x | x \in S, R(x) \in I\}$ and $(S,I) \in \mathcal{C} \times \Lambda_{\lambda}$. We use $p^*$, $R$, and $R'$ without subscipts to denote these values over $S_r$. We cannot easily construct a potential argument using progress towards ($\alpha$,$\lambda$)-PMC, since its derivative is undefined at $\E_D [ y | R \in I, x \in S]$=0. Instead, we analyze progress towards the difference in the $\ell_2$ norm at each step. \begin{align} ||p^*-R|| - ||p^*-R'|| &= \sum_{i \in S_r}{ (p_i^* - R_i)^2 } - \sum_{i \in S_r}{ (p_i^* - \text{squash}(R_i+\Delta r))^2 } \nonumber \\ &\geq \sum_{i \in S_r}{\left( (p_i^* - R)^2 - (p_i^* - (R_i+\Delta r))^2 \right) } \nonumber\\ &= \sum_{i \in S_r}{\left( 2p_i^* \Delta r - 2R_i \Delta r - \Delta r^2 \right) } \nonumber\\ &= 2 \Delta r \sum_{i \in S_r}{\left( p_i^* - R_i \right)} - |S_r|\Delta r^2 \label{eq:del} \end{align} From \cref{alg:PMC} we have $$ \Delta r = \frac{1}{|S_r|}\sum_{i \in S_r}{( p_i^* - R_i )} $$ Substituting into~\cref{eq:del} gives \begin{align*} ||p^*-R|| - ||p^*-R'|| &\geq |S_r|{\Delta r}^2 \\ \end{align*} We know that $|S_r| \geq \alpha \lambda \gamma N$, and that the smallest update $\Delta r$ is $\alpha \rho$. Thus, \begin{align*} ||p^*-R|| - ||p^*-R'|| &\geq \alpha^3 \rho^2 \lambda \gamma N \\ \end{align*} Since our initial loss, $|| p^* - R||$, is at most $N$, \cref{alg:PMC} converges in at most $O(\frac{1}{\lambda^3 \rho^2 \lambda \gamma})$ updates for category $S_r$. To understand the total number of steps, including those without updates, we consider the worst case, in which only a single category $S_r$ is updated in a cycle of the for loop (if no updates are made, the algorithm exits). Since each repeat consists of at most $|C|/\lambda$ loop iterations, this results in $O(\frac{|C|}{\alpha^3 \lambda^2 \rho^2 \gamma})$ total steps. \end{proof} \subsection{Additional Theorems}\label{s:App:thm} \subsubsection{Differentially calibrated models with global calibration are multicalibrated} Here we show that, under the assumption that a model is globally calibrated (satisfies $\delta$-calibration), models satisfying $\varepsilon$-DC are also multicalibrated. \begin{theorem}\label{thm:DCtoMC} Let R(x) be a model satisfying ($\varepsilon$,$\lambda$)-DC and $\delta$-calibration. Then $R(x)$ is ($1-e^{-\varepsilon}+\delta$, $\lambda$)-multicalibrated. \end{theorem} \begin{proof} From~\cref{eq:DC} we observe that $\varepsilon$ is bounded by the two groups with the largest and smallest group- and prediction- specific probabilities of the outcome. Let $I_M$ be the risk stratum maximizing $(\varepsilon,\lambda)$-DC, and let $p_n = \max_{S \in \mathcal{C}} P_D(y|R \in I_M, x \in S)$ and $p_d = \min_{S \in \mathcal{C}} P_D(y|R \in I_M,x \in S)$. These groups determine the upper and lower bounds of $\varepsilon$ as $e^{-\varepsilon} \leq p_d/p_n$ and $p_n/p_d \leq e^{\varepsilon}$. We note that $p_d \leq P_D(y|R \in I_M) \leq p_n$, since $P(y| R \in I_M) = \frac{1}{N} \sum_{S \in \mathcal{C}} |S| P_D(y|R \in I_M, x \in S)$, and $p_n$ and $p_d$ are the extreme values of $P(y|R\in I_M,x \in S)$ among $S$. So, $\alpha$-MC is bound by the group outcome that most deviates from the predicted value, which is either $p_n$ or $p_d$. Let $r = P_D( R|R \in I_M )$. There are then two scenarios to consider: \begin{enumerate} \item $ \alpha \leq | p_n - r | = p_n - r $ when $r \leq \frac{1}{2}(p_n + p_d)$; and \item $ \alpha \leq | p_d - r | = r - p_d $ when $r \geq \frac{1}{2}(p_n + p_d)$. \end{enumerate} We will look at the first case. Let $p^*_r = P_D(y|R \in I_M)$. Due to $\delta$-calibration, $p^*_r - \delta \leq r \leq p^*_r + \delta$. Then \begin{align*} \alpha &\leq p_n - r \\ &\leq p_n - (p^*_r - \delta) \\ &\leq p_n - p_d + \delta \\ &= p_n (1-e^{-\varepsilon}) + \delta\\ \alpha &\leq 1 - e^{-\varepsilon} + \delta. \end{align*} Above we have used the facts that $r \leq p^*_r - \delta$, $p^*_r \geq p_d$, $p_d \leq e^{-\varepsilon}p_n$, and $p_n \leq 1$. The second scenario is complementary and produces the identical bound. \end{proof} \cref{thm:DCtoMC} formally describes how $\delta$-calibration controls the baseline calibration error contribution to $\alpha$-MC, while $\varepsilon$-DC limits the deviation around this value by constraining the (log) maximum and minimum risk within each category. \subsection{Multicalibrated models satisfy intersectional guarantees} In contrast to DF, MC \citep{hebert-johnsonMulticalibrationCalibrationComputationallyIdentifiable2018} was not designed to explicitly incorporate the principles of intersectionality. However, we show that it provides an identical efficiency property to DF in the theorem below. \begin{theorem}\label{thm:intersectionalmc} Let the collection of subsets $\mathcal{C} \subseteq 2^\mathcal{X}$ define groups of individuals according to the Cartesian product of attributes $A \subseteq \mathcal{A}$. Let $\cal G \in 2^\mathcal{X}$ be any collection of subsets that groups individuals by the Cartesian product of attributes in $A'$, where $A' \subset A$ and $A' \neq \emptyset$. If $R(x)$ satisfies $\alpha$-MC on $\mathcal{C}$, then $R(x)$ is $\alpha$-multicalibrated on $\cal G$. \end{theorem} In proving \cref{thm:intersectionalmc}, we will make use of the following lemma. \begin{lemma}\label{lemma:express} The $\alpha$-MC criteria can be rewritten as: for a collection of subsets $\mathcal{C} \subseteq \mathcal{X}$, $\alpha \in [0,1]$, and $r \in [0,1]$, $$ \max_{c\in\mathcal{C}}\E_D [ y | R(x) = r, x \in c ]\leq r+\alpha $$ and $$ \min_{c\in\mathcal{C}}\E_D [ y | R(x) = r, x \in c ] \ge r-\alpha $$ \end{lemma} \begin{proof} The lemma follows from~\cref{def:MC}, and simply restates it as a constraint on the maximum and minimum expected risk among groups at each prediction level. \end{proof} \begin{proof}[Proof of \cref{thm:intersectionalmc}] We use the same argument as \cite{fouldsIntersectionalDefinitionFairness2019} in proving this property for DF. Define $Q$ as the Cartesian product of the protected attributes included in $\mathcal{A}$, but not $\mathcal{A}'$. Then for any $(y,x) \sim D$, \begin{align} \max_{g\in \cal G}\E_D [ y | R(x) = r, x \in g] =& \max_{g \in \cal G}\sum_{q\in Q} \E_D [ y | R(x) = r, x \in g \cap q ]P[x \in q | x \in g]\\ \leq& \max_{g \in \cal G}\sum_{q\in Q} \max_{q'\in Q}\E_D [ y | R(x) = r, x \in g \cap q' ]P[x \in q | x \in g]\\ =&\max_{g \in \cal G}\max_{q'\in Q}\E_D [ y | R(x) = r, x \in g \cap q' ]\\ =&\max_{c\in \mathcal{C}} \E_D [ y | R(x) = r, x \in c ] . \end{align} Moving from (5) to (6) follows from substituting the maximum value of $\E_D [ y | R(x) = r, x]$ for observations in the intersection of subsets in $\mathcal{G}$ and $Q$ which is the upper limit of the expression in (5). Moving from (6) to (7) follows from recognizing that the sum $P[x\in q|x \in g]$ for all subsets in $\mathcal{Q}$ is 1. Finally, moving from (7) to (8) follows from recognizing that the intersections of subsets in $\mathcal{G}$ and $\mathcal{Q}$ that satisfy (7), must define a subset of $\mathcal{C}$. Applying the same argument, we can show that $$ \min_{g\in \cal G}\E_D[y|R(x)=r,x\in g] \ge\min_{c\in \mathcal{C}} \E_D [ y | R(x) = r, x \in c ] . $$ Substituting into \cref{lemma:express}, $$ \max_{g\in \cal G}\E_D [ y | R(x) = r, x \in g]\leq \alpha+r\\ $$ and $$ \min_{g\in \cal G}\E_D [ y | R(x) = r, x \in g ] \ge r -\alpha $$ or $$ \card{\E_D [ y | R(x) = r, x \in g ]-r}\le{\alpha} $$ for all $g\in \cal G$. Therefore $R(x)$ is $\alpha$-multicalibrated with respect to $\cal G$. \end{proof} As a concrete example, imagine we have the protected attributes $A = \set{ \text{race} \in \set{B,W}, \text{gender} \in \set{M,F}}$. According to \cref{thm:intersectionalmc}, $\mathcal{C}$ would contain four sets: $\{(B,M),(B,F),(W,M),(W,F)\}$. In contrast, there are eight possible sets in $\cal G$: $\set{ (B,M),(B,F),(W,M),(W,F),(B,*),(W,*),(*,M), (*,F)}$, where the wildcard indicates a match to either attribute. As noted in \cref{s:df-efficient}, the efficiency property is useful because the number of possible sets in $\cal G$ grows at a large combinatorial rate, rate as additional attributes are added; meanwhile $\mathcal{C}$ grows at a slower, yet exponential, rate. For an intuition for why this property holds, consider that the maximum calibration error of two subgroups is at least as large as the maximum expected error of those groups combined; e.g., the maximum calibration error in a higher order groups such as $(B,*)$ will be covered by the maximum calibration error in either $(B,M)$ or $(B,F)$. \subsection{Additional Experiment Details} Models were trained on a heterogenous computing cluster. Each training instance was limited to a single core and 4 GB of RAM. We conducted a full parameter sweep of the parameters specified in \cref{tbl:params}. A single trial consisted of a method, a parameter setting from \cref{tbl:params}, and a random seed. Over 100 random seeds, the data was shuffled and split 75\%/25\% into train/test sets. Results in the manuscript are summarized over these test sets. \paragraph{Code} \label{s:code} Code for the experiments is available here: \url{https://github.com/by1tTZ4IsQkAO80F/pmc}. Code is licensed under GNU Public License v3.0. \paragraph{Data} We make use of data from the \href{https://physionet.org/content/mimic-iv-ed/1.0/}{MIMIC-IV-ED} repository, version 1.0, to train admission risk prediction models~\citep{johnsonalistairMIMICIVED2021}. This resource contains more than 440,000 ED admissions from Beth Isreal Deaconness Medical Center between 2011 and 2019. We preprocessed these data to construct an admission prediction task in which our model delivers a risk of admission estimate for each ED visitor after their first visit to triage, during which vitals are taken. Additional historical data for the patient was also included (e.g., number of previous visits and admissions). A list of features is given in \cref{tbl:features}. \begin{table} \caption{Features used in the hospital admission task.} \label{tbl:features} \begin{tabularx}{\textwidth}{XX} \toprule Description & Features \\ \midrule Vitals & temperature, heartrate, resprate, o2sat, systolic blood pressure, diastolic blood press, \\ Triage Acuity & Emergency Severity Index~\citep{tanabeReliabilityValidityScores2004} \\ Check-in Data & chief complaint, self-reported pain score \\ Health Record Data & no. previous visits, no. previous admissions \\ Demographic Data & ethnoracial group, gender, age, marital status, insurance, primary language \\ \bottomrule \end{tabularx} \end{table} \subsection{Additional Results} \label{s:app:results} \cref{tbl:params} lists a few parameters that may affect the performance of post-processing for both MC and PMC. Of particular interest when comparing MC versus PMC post-processing is the parameter $\alpha$, which controls how stringent the calibration error must be across categories to terminate, and the group definition ($A$), which selects which features of the data will be used to asses and optimize fairness. In comparing \cref{def:MC,def:PMC}, we note PMC's tolerance for error is more ``aggressive" for a given value of $\alpha$, since $\E_D [ y | R \in I, x \in S] \in [0,1]$. Thus a natural question is whether MC can match the performance of PMC on different fairness measures simply by specifying a smaller $\alpha$. We shed light on this question in three ways. First, we quantify how often the use of each post-processing algorithm gives the best loss for each metric and trial in \cref{tbl:wins}. Next, we look at the performance of MC and PMC postprocessing over values of $\alpha$ and group definitions in \cref{fig:auroc,fig:mcloss,fig:pmcloss}. Finally, we empirically compare MC- and PMC-postprocessing by the number of steps required for each to reach their best performance in \cref{fig:updates,tbl:time}. \cref{tbl:wins} quantifies the number of trials for which the baseline model and the two post-processing variants produce the best model according to a given metric, over all paramter configurations. In pure head-to-head comparisons, we observe that PMC-postprocessing produces models with the lowest fairness loss according to all three metrics (DC loss, MC loss, PMC loss) the majority of the time. This provides strong evidence that, over a large range of $\alpha$ values, PMC post-processing is beneficial compared to MC-postprocessing. From \cref{fig:auroc}, it is clear that post-processing has a minimal effect on AUROC in all cases; note the differences dissapear if we round to two decimal places. When post processing with RF, we do note a relationship between lower values of $\alpha$ and a very slight decrease in performance, particularly for MC-postprocessing. \cref{fig:mcloss,fig:pmcloss} show performance between methods on MC loss and PMC loss, respectively. In terms of MC loss, PMC-postprocessing tends to produce models with the lowest loss, at $\alpha$ values greater than 0.01. Lower values of $\alpha$ do not help MC-postprocessing in most cases, suggesting that these smaller updates may be overfitting to the post-processing data. In terms of PMC loss (\cref{fig:pmcloss}), we observe that performance by MC-postprocessing is highly sensitive to the value of $\alpha$. For smaller values of $\alpha$, MC-postprocessing is able to achieve decent performance by these metrics, although in all cases, PMC-postprocessing generates a model with a better median loss value at some configuration of $\alpha$. The ability of MC-postprocessing to perform well in terms of PMC and DC loss for certain values of $\alpha$ makes intuitive sense. If $\alpha$ can be made small enough, the calibration error $\card{\E_D [ R | R \in I, x \in S] - \E_D [ y | R \in I, x \in S]}$ on all categories will be small compared to the outcome prevalence, $\E_D [ y | R \in I, x \in S]$. However, to achieve this performance by MC-postprocessing may require a large number of unnecessary updates for high risk intervals, since the DC and PMC of multicalibrated models are limited by low-risk groups (\cref{thm:MCtoDC}). Furthermore, the number of steps in MC-postprocessing (and PMC-postprocessing) scales as an inverse high-order polynomial of $\alpha$ (cf. Thm. 2~\citep{hebert-johnsonMulticalibrationCalibrationComputationallyIdentifiable2018}). We assess how many steps/updates MC and PMC take for different values of $\alpha$ in \cref{fig:updates}, and summarize empirical measures of running time in \cref{tbl:time}. On the figure, we annotate the point for which each post-processing algorithm achieves the lowest median value of PMC loss across trials. \cref{fig:updates} validates that PMC-postprocessing is more efficient than MC-postprocessing at producing models with low PMC loss, on average requiring 4.0x fewer updates to achieve its lowest loss on test. From \cref{tbl:time} we observe that PMC typically requires a larger number of updates to achieve its best performance on MC loss (about 2x wall clock time and number of updates), whereas MC-postprocessing requires a larger number of updates to achieves its best performance on PMC loss and DC loss, due to its dependence on very small values of $\alpha$. We accompany these results with the caveat that they are based on performance on one real-world task, and wall clock time measurements are influenced by the heterogenous cluster environment; future work could focus on a larger empirical comparison. \begin{table} \centering \footnotesize \caption{Across 100 trials of dataset shuffles, we compare the post-processing configurations in terms of the number of times they achieve the best score for the metric shown on the left. PMC post-processing (\cref{alg:PMC}) achieves the best fairness the highest percent of the time, according to DC loss (63\%), MC loss (70\%), and PMC loss (72\%), while MC-postprocessed models achieve the best AUROC in 88\% of cases. } \input{tbls/winning_configs.tex} \label{tbl:wins} \end{table} \begin{figure} \includegraphics[width=\textwidth]{figs/catpoint_AUROC_vs_alpha_row-ML_col-groups_hue-postprocessing_annot-none.pdf} \caption{ AUROC test performance versus $\alpha$ across experiment settings. Rows are different ML base models, and columns are different attributes used to define $\mathcal{C}$. The color denotes the post-processing method. } \label{fig:auroc} \end{figure} \begin{figure} \includegraphics[width=\textwidth]{figs/catpoint_MC-loss_vs_alpha_row-ML_col-groups_hue-postprocessing_annot-none.pdf} \caption{ MC loss test performance versus $\alpha$ across experiment settings. Rows are different ML base models, and columns are different attributes used to define $\mathcal{C}$. The color denotes the post-processing method. } \label{fig:mcloss} \end{figure} \begin{figure} \includegraphics[width=\textwidth]{figs/catpoint_PMC-loss_vs_alpha_row-ML_col-groups_hue-postprocessing_annot-none.pdf} \caption{ PMC loss test performance versus $\alpha$ across experiment settings. Rows are different ML base models, and columns are different attributes used to define $\mathcal{C}$. The color denotes the post-processing method. } \label{fig:pmcloss} \end{figure} \begin{figure} \includegraphics[width=\textwidth]{figs/catpoint_n-of-Updates_vs_alpha_row-ML_col-groups_hue-postprocessing_annot-PMC-loss.pdf} \caption{ Number of post-processing updates by MC and PMC versus $\alpha$ across experiment settings. Rows are different ML base models, and columns are different attributes used to define $\mathcal{C}$. The color denotes the post-processing method. Each result is annotated with the median PMC loss for that method and parameter combination. } \label{fig:updates} \end{figure} \begin{table} \centering \footnotesize \caption{For MC- and PMC-postprocessing, we compare the median number of updates and median wall clock time (s) taken to train for the configuration ($\alpha$,$A$) that achieved the best performance on each metric. } \footnotesize \input{tbls/best_cfg_time.tex} \label{tbl:time} \end{table} \section{Introduction} Today, machine learning (ML) models have an impact on outcome disparities across sectors (health, lending, criminal justice) due to their wide-spread use in decision-making. When applied in clinical decision-making, ML models help care providers decide whom to prioritize to receive finite and time-sensitive resources among a population of potentially very ill patients. These resources include hospital beds~\citep{barak-correnPredictionPatientDisposition2021,dinhOvercrowdingKillsHow2021}, organ transplants~\citep{schnellinger2021mitigating}, specialty treatment programs~\citep{henryTargetedRealtimeEarly2015,obermeyerDissectingRacialBias2019}, and, recently, ventilator and other breathing support tools to manage the COVID-19 pandemic~\citep{rivielloAssessmentCrisisStandards2022}. In scenarios like these, decision makers typically rely on risk prediction models to be \emph{calibrated}. Calibration measures the extent to which a model's risk scores, $R$, match the observed probability of the event, $y$. Perfect calibration implies that $P(y|R=r) = r$, for all values of $r$. Calibration allows the risk scores to be used to rank patients in order of priority and informs care providers about the urgency of treatment. However, models that are not equally calibrated among subgroups defined by different sensitive attributes (race, ethnicity, gender, income, etc.) may lead to systematic denial of resources to marginalized groups (e.g.~\citep{obermeyerDissectingRacialBias2019,ashana2021equitably,roberts_fatal_2011,zelnick2021association,ku2021racial}). Just this scenario was observed by~\citet{obermeyerDissectingRacialBias2019} analyzed a large health system algorithm used to enroll high-risk patients into care management programs and showed that, at a given risk score, Black patients exhibited significantly poorer health than white patients. To address equity in calibration, \citet{hebert-johnsonMulticalibrationCalibrationComputationallyIdentifiable2018} proposed a fairness measure called \textit{multicalibration} (MC), which asks that calibration be satisifed simultaneously over many flexibly-defined subgroups. Remarkably, MC can be satisfied efficiently by post-processing risk scores without negatively impacting the generalization error of a model, unlike other fairness concepts like demographic parity~\citep{fouldsAreParityBasedNotions2020} and equalized odds~\citep{hardtEqualityOpportunitySupervised2016a}. This has motivated the use of MC in practical settings (e.g.~\citet{bardaAddressingBiasPrediction2021a}) and has spurred several extensions~\citep{kimMultiaccuracyBlackboxPostprocessing2019,jungMomentMulticalibrationUncertainty2021,guptaOnlineMultivalidLearning2021,gopalanLowDegreeMulticalibration2022}. If we bin our risk predictions, the MC criteria specifies that, for every group within each bin, the absolute difference between the mean observed outcome and the mean of the predictions should be small. As~\citet{barocasFairnessMachineLearning2019} note, equity in calibration embeds the fairness notion called \emph{sufficiency}, which states: for a given risk prediction, the expected outcome should be independent of group membership. Starting from this notion, we can assess the conditions under which MC satisfies sufficiency. In this work, we derive a fairness criteria directly from sufficiency dubbed \emph{differential calibration} for its relation to differential fairness~\citep{foulds_intersectional_2019}. We show that satisfying differential calibration can ensure that a model is equally ``trustworthy" among groups in the data. By equally ``trustworthy'', we mean that a decision maker cannot reasonably come to distrust the model's risk predictions for specific groups, which may help prevent differences in decision-making between demographic groups, given the same risk prediction. By relating sufficiency to MC, we describe a shortcoming of MC that can occur when the outcome probabilities are strongly tied to group membership. Under this condition, the amount of calibration error \emph{relative to the expected outcome} can be unequal between groups. This inequality hampers the ability of MC to (approximately) guarantee sufficiency, and thus guarantee equity in trustworthiness for the decision maker. We propose a simple variant of MC called \textit{proportional multicalibration} (PMC) that ensures that the proportion of calibration error within each bin and group is small. We prove that PMC bounds both multicalibration and differential calibration. We show that PMC can be satisfied with an efficinet post-processing method, similarly to MC. \looseness=-1 \subsection{Our Contributions} In this manuscript, we formally analyze the connection of MC to the fairness notion of sufficiency. To do so, we introduce differential calibration (DC), a sufficiency measure that constrains ratios of population risk between pairs of groups within prediction bins. We describe how DC, like sufficiency, provides a sense of equal trustworthiness from the point of view of the decision maker. With this definition, we prove the following. First, models that are ($\alpha$,$\lambda$)-multicalibrated satisfy $(log \frac{r_{min}+\alpha}{r_{min}-\alpha}, \lambda)$-DC, where $r_{min}$ is the minimum expected risk prediction among categories defined by subgroups and prediction intervals. We illustrate the meaning of this bound, which is that the proportion of calibration error in multicalibrated models may scale inversely with the outcome probability. Based on these observations, we propose an alternate definition of MC, PMC, that controls the percentage error by group and risk strata (\cref{def:PMC}). We show that models satisfying $(\alpha,\lambda)$-PMC are $(\frac{\alpha}{1-\alpha},\lambda)$-multicalibrated and $(\log \frac{1+\alpha}{1-\alpha})$-differentially calibrated. Proportionally multicalibrated models thereby obtain robust fairness guarantees that are independent of population risk categories. Furthermore, we define an efficient algorithm for learning predictors satisfying $\alpha$-PMC. Finally, we investigate the application of these methods to predicting patient admissions in the emergency department, a real-world resource allocation task, and show that post-processing for PMC results in models that are accurate, multicalibrated, and differentially calibrated. \section{Reconciling Multicalibration and Sufficiency} \label{s:methods} \subsection{Preliminaries} \looseness=-1 We consider the task of training a risk prediction model for a population of individuals with outcomes, $y \in \set{0,1}$, and features, $x \in \mathcal{X}$. Let $D$ be the joint distribution from which individual samples $(y, x)$ are drawn. We assume the outcomes $y$ are random samples from underlying independent Bernoulli distributions, denoted as $p^*(x) \in [0,1]$. Given an individual's attributes $x = (x_1,\;\dots,\;x_d)$, it will be useful to refer to subsets we wish to protect, e.g. demographic identifiers. To do so, we define $\mathcal{A} = \set{A_1,\;\dots,\;A_p}$, $p \leq d$, such that $A_1 = \{x_{1i},\;\dots,\;x_{1k}\}$ is a finite set of values taken by attribute $x_1$. Individuals can be further grouped into \emph{collections of subsets}, $\mathcal{C} \subseteq \text{2}^{\mathcal{X}}$, such that $S \in \mathcal{C}$ is the subset of individuals belonging to $S$, and $x \in S$ indicates that individual $x$ belongs to group $S$. We denote our risk prediction model as $R(x): \mathcal{X}$ $\rightarrow [0,1]$. In order to consider calibration in practice, the risk predictions are typically discretized and considered within intervals. The coarseness of this interval is parameterized by a partitioning parameter, $\lambda \in (0, 1]$. The \emph{$\lambda$-discretization} of $[0,1]$ is denoted by a set of intervals, $\Lambda_{\lambda} = \set{ \set{I_j}_{j=0}^{1/\lambda -1}}$, where $I_j = [ j\lambda, (j+1)\lambda ) $. For brevity, most proofs in the following sections are given in~\cref{s:proof}. \subsection{Multicalibration} \looseness=-1 MC~\citep{hebert-johnsonCalibrationComputationallyIdentifiableMasses2018} guarantees that the calibration error for any group from a collection of subsets, $\mathcal{C}$ will not exceed a user-defined threshold, over the range of risk scores. In order to work with bins of predictions, we will mostly concern ourselves with the discretized version of MC, defined below. The non-discretized versions are given in~\cref{s:App:def}. \begin{definition}[$(\alpha,\lambda)$-multicalibration] \label{def:alMC} Let $\mathcal{C} \subseteq \text{2}^{\mathcal{X}}$ be a collection of subsets of $\mathcal{X}$. For any $\alpha, \lambda > 0$, a predictor $R$ is \emph{$(\alpha,\lambda)$-multicalibrated} on $\mathcal{C}$ if, for all $I \in \Lambda_{\lambda}$ and $S \in \mathcal{C}$ where $P_D(R \in I |x \in S) \geq \alpha \lambda $, $$ \card{ \E_D [ y | R \in I, x \in S] - \E_D [ R | R \in I, x \in S]} \le \alpha .$$ \end{definition} MC is one of few approaches to achieving fairness that does not require a significant trade-off to be made between a model's generalization error and the improvement in fairness it provides~\citep{hebert-johnsonCalibrationComputationallyIdentifiableMasses2018}. As \cite{hebert-johnsonCalibrationComputationallyIdentifiableMasses2018} show, this is because achieving multicalibration is not at odds with achieving accuracy in expectation for the population as a whole. This separates calibration fairness from other fairness constraints like demographic parity and equalized odds~\citep{hardtEqualityOpportunitySupervised2016a}, both of which may denigrate the performance of the model on specific groups~\citep{chouldechovaFairPredictionDisparate2017,pleissFairnessCalibration2017}. In clinical settings, such trade-offs may be difficult or impossible to justify. In addition to its alignment with accuracy in expectation, \citet{hebert-johnsonCalibrationComputationallyIdentifiableMasses2018} propose an efficient post-processing algorithm for MC similar on boosting. We discuss additional extensions to MC in \cref{s:App:related}. \subsection{Sufficiency and Differential Calibration} MC provides a sense of fairness by approximating \emph{calibration by group}, which is perfectly satisfied when $P_D(y|R=r,x \in S)=r$ for all $S \in C$. Calibration by group is closely related to the \emph{sufficiency} fairness criterion~\citep{barocasFairnessMachineLearning2019}. Sufficiency is the condition where the outcome probability is independent from $\mathcal{C}$ conditioned on the risk score. In the binary group setting ($\mathcal{C} = \{S_i, S_j\}$), sufficiency can be expressed as $ P_D(y|R, x \in S_i) = P_D(y|R, x \in S_j) $, or \begin{equation}\label{eq:sufficiency} \frac{ P_D(y|R, x \in S_i) }{ P_D(y|R, x \in S_j) } = 1. \end{equation} Unlike calibration by group, sufficiency does not stipulate that the risk scores be calibrated, yet from a fairness perspective, sufficiency and calibration-by-group are equivalent~\citep{barocasFairnessMachineLearning2019}. Consider that one can easily transform a model satisfying sufficiency into one that is calibrated-by-group with a single function $f(R) \rightarrow [0,1]$, for example with Platt scaling~\citep{barocasFairnessMachineLearning2019}. In both cases, the sense of \emph{fairness} stems from the desire for the risk scores, $R$ to capture everything about group membership that is relevant to predicting the outcome, $y$. Under sufficiency, the risk score is equally informative of the outcome, regardless of group membership. In this sense, a model satisfying sufficiency provides \emph{equally trustworthy} risk predictions to a decision maker, regardless of the groups to which an individual belongs. Below, we define an approximate measure of sufficiency that constrains pairwise differentials between groups, and accomodates binned predictions: \begin{definition}[Differential calibration]\label{def:DC} Let $\mathcal{C} \subseteq \text{2}^{\mathcal{X}}$ be a collection of subsets of $\mathcal{X}$. A model $R(x)$ is ($\varepsilon$,$\lambda$)-differentially calibrated with respect to $\mathcal{C}$ if, across prediction intervals $I \in \Lambda_{\lambda}$, for all pairs $(S_i,S_j) \in \mathcal{C} \times \mathcal{C}$ for which $P_D(S_i), P_D(S_j) >0$, \begin{equation}\label{eq:DC} e^{-\varepsilon} \leq \frac{\E_D [ y | R \in I, x \in S_i]} {\E_D [ y | R \in I, x \in S_j ]} \leq e^{\varepsilon} \end{equation} \end{definition} By inspection we see that $\epsilon$ in $(\epsilon,\lambda)$-DC measures the extent to which $R$ satisifies sufficiency. That its, when $P(y|R \in I, x \in S_i) \approx P(y|R \in I, x \in S_j)$ for all pairs, $\varepsilon \approx 0$. $(\varepsilon,\lambda)$-DC says that, within any bin of risk scores, the outcome $y$ is at most $e^{\varepsilon}$ times more likely among one group than another, and a minimum of $e^{-\varepsilon}$ less likely. \cref{def:DC} fits into the general definition of a \emph{differential fairness} measure proposed by~\citet{fouldsIntersectionalDefinitionFairness2019}, although previously it was used to define demographic parity criteria~\citep{fouldsAreParityBasedNotions2020}. We describe the relation in more detail in~\cref{s:App:DF}, including \cref{eq:DC}'s connection to differential privacy~\cite{dwork2009differential} and pufferfish privacy~\cite{kiferPufferfishFrameworkMathematical2014}. \subsection{The differential calibration of multicalibrated models is limited by low-risk groups} At a basic level, the form of MC and sufficiency differ: MC constrainins absolute differences between groups across prediction bins, whereas sufficiency constrains pairwise differentials between groups. To reconcile MC and DC/sufficiency more formally, we pose the following question: if a model satisfies $\alpha$-MC, what, if anything does this imply about the $\varepsilon$-DC of the model? (In \cref{s:App:thm},\cref{thm:DCtoMC}, we answer the inverse question). We now show that multicalibrated models have a bounded DC, but that this bound is limited by small values of $R$. \begin{theorem} \label{thm:MCtoDC} \Copy{thm:MCtoDC}{ Let $R(x)$ be a model satisfying ($\alpha$,$\lambda$)-MC on a collection of subsets $\mathcal{C} \in 2^{\mathcal{X}}$. Let $r_{min} = \min_{(S, I) \in \mathcal{C} \times \Lambda_\lambda}{\E_D [ R | R \in I, x \in S]}$ be the minimum expected risk prediction among categories $(S, I) \in \mathcal{C} \times \Lambda_\lambda$. Then R(x) is $(\log \frac{r_{min}+\alpha}{r_{min}-\alpha}, \lambda)$-differentially calibrated. } \end{theorem} \begin{proof} Let $r = \E_D [ R | R \in I, x \in S]$ and $p^* = \E_D [ y | R \in I, x \in S]$. $(\alpha, \lambda)$-MC guarantees that $r - \alpha \leq p^* \leq r + \alpha$ for all groups $S \in \mathcal{C}$ and prediction intervals $r \in \Lambda_\lambda[0, 1]$. Plugging these lower and upper bounds into \cref{eq:DC} yields $ e^{\varepsilon} \geq {\frac{r+\alpha}{r-\alpha} } $. The maximum of this ratio, for a fixed $\alpha$, occurs at the smallest value of $r$; therefore $ \varepsilon \geq \log \frac{r_{min} + \alpha}{r_{min} - \alpha} . $ \end{proof} \cref{thm:MCtoDC} illustrates the important point that, \emph{in terms of percentage error}, $MC$ does not provide equal protection to groups with different risk profiles. Imagine a model satisfying (0.05,0.1)-MC for groups $S \in \mathcal{C}$. Consider individuals receiving model predictions in the interval $(0.9,1]$. MC guarantees that, for any category $\set{x : x \in S, R(x) \in I =(0.9,1]}$, the expected outcome prevalence ($\E_D[y|x \in S, R \in I]$) of at least $0.9 - \alpha = 0.85$. This bounds the percent error among groups in the $(0.9, 1]$ prediction interval to 6\%. In contrast, consider individuals for whom $R(x) \in (0.3-0.4]$; each group may have a true outcome prevalence as low as 0.25, which is an error of 20\% - about 3.4x higher than the percent error in the higher-risk group. \section{Proportional Multicalibration} We are motivated to define a measure that is efficiently learnable like MC (\cref{def:alMC}) but better aligned with the fundamental fairness notion of sufficiency, like DC (\cref{def:DC}). To do so, we define PMC, a variant of MC that constrains the proportional calibration error of a model among subgroups and risk strata. In this section, we show that bounding a model's PMC is enough to meaningfully bounds its DC and MC. Furthermore, we provide an efficient algorithm for satisfying PMC based on a simple extension of MC/Multiaccuracy boosting~\citep{kimMultiaccuracyBlackboxPostprocessing2019}. \begin{definition}[Proportional Multicalibration]\label{def:PMC} A model $R(x)$ is $(\alpha,\lambda)$-proportionally multicalibrated with respect to a collection of subsets $\mathcal{C}$ if, for all $S \in \mathcal{C}$ and $I \in \Lambda_\lambda$ satisfying $P_D(R(x) \in I | x \in S) \geq \alpha \lambda$, \begin{equation}\label{eq:lPMC} \frac{ \card{ \E_D [ y | R \in I, x \in S] - \E_D [ R | R \in I, x \in S] } } { \E_D [ y | R \in I, x \in S] } \le \alpha. \end{equation} \end{definition} Note that, in practice, we must ensure $\E_D [ y | R \in I, x \in S] \neq 0$ for \cref{def:PMC} to be defined. We handle this by introducing a parameter $\rho > 0$ constraining the lowest expected outcome among categories $(S,I)$. In the remainder of this section, we detail how PMC relates to suffiency/DC and MC. We provide bounds on the values of $MC$ and $DC$ given a proportionally multicalibrated model, and we illustrate the relationship between these three metrics in \cref{fig:params}. \paragraph{Comparison to Differential Calibration} Rather than constraining the differentials of prediction- and group- specific outcomes among all pairs of subgroups in $\mathcal{C} \times \mathcal{C}$ as in DC (\cref{def:DC}), PMC constrains the relative error of each group in $\mathcal{C}$. In practical terms, this makes it more efficient to calculate PMC by a factor of $O(\card{\mathcal{C}})$ steps compared to DC. In addition, PMC does not require additional assumptions about the overall calibration of a model in order to imply guarantees of MC, since PMC directly constrains calibration rather than constraining sufficiency alone. \begin{theorem} \label{thm:PMCtoDC} \Copy{thm:PMCtoDC} { Let R(x) be a model satisfying $(\alpha,\lambda)$-PMC on a collection $\mathcal{C}$. Then $R(x)$ is $(\log \frac{1+\alpha}{1-\alpha}, \lambda )$-differentially calibrated. } \end{theorem} \begin{proof} Let $r = \E_D [ R | R \in I, x \in S]$ and $p^* = \E_D [ y | R \in I, x \in S]$. If $R(x)$ satisfies $\alpha$-PMC (\cref{def:PMC}), then $ r/(1 + \alpha) \leq p^* \leq r/(1 - \alpha)$. Solving for the upper bound on $\varepsilon$-DC, we immediately have $\varepsilon \leq \log \frac{r(1+\alpha)}{r(1-\alpha)} \leq \log \frac{1+\alpha}{1-\alpha} $. \end{proof} \cref{thm:PMCtoDC} demonstrates that $\alpha$-proportionally multicalibrated models satisfy a straightforward notion of differential fairness that depends monotonically only on $\alpha$. The relationship between PMC and DC is contrasted with the relationship of MC and DC in \cref{fig:params}, left panel. The figure illustrates how MC's sensitivity to small risk categories limits its DC. \paragraph{Comparison to Multicalibration} Rather than constraining the absolute difference between risk predictions and the outcome as in MC, PMC requires that the calibration error be a small fraction of the expected risk in each category $(S,I)$. In this sense, it provides a stronger protection than MC by requiring calibration error to be a small fraction regardless of the risk group. In many contexts, we would argue that this is also more aligned with the notion of fairness in risk prediction contexts. Under MC, the underlying prevalence of an outcome within a group affects the fairness protection that is received (i.e., the percentage error that \cref{def:MC} allows). Because underlying prevalences of many clinically relevant outcomes vary significantly among subpopulations, multicalibrated models may systematically permit higher percentage error to specific risk groups. The difference in relative calibration error among populations with different risk profiles also translates in weaker sufficiency guarantees, as demonstrated in~\cref{thm:MCtoDC}. In contrast, PMC provides a fairness guarantee that is independent of subpopulation risks. In the following theorem, we show that MC is constrained when a model satisfies PMC. \begin{theorem} \label{thm:PMCtoMC} \Copy{thm:PMCtoMC}{ Let $R(x)$ be a model satisfying \emph{$\alpha$-PMC} on a collection $\mathcal{C}$. Then $R(x)$ is ($\frac{\alpha}{1-\alpha}$)-multicalibrated on $\mathcal{C}$. } \end{theorem} \begin{proof} To distinguish the parameters, let $R(x)$ be a model satisfying $\delta$-PMC. Let $r = \E_D [ R | R \in I, x \in S]$ and $p^* = \E_D [ y | R \in I, x \in S]$. Then $ r/(1 + \delta) \leq p^* \leq r/(1 - \delta) $. We solve for the upper bound on $\alpha$-MC from \cref{def:MC} for the case when $p^* > r$. This yields \begin{align*} \alpha &\leq p^* - r \\ &\leq \frac{r}{1-\delta} - r \\ &= r\frac{\delta}{1-\delta} \\ &\leq \frac{\delta}{1-\delta} . \end{align*} \end{proof} The right panel of \cref{fig:params} illustrates this relation in comparison to the DC-MC relationship described in \cref{s:App:thm}, \cref{thm:DCtoMC}. At small values of $\epsilon$ and $\alpha$ and when the model is perfectly calibrated overall, $\alpha$-PMC and $\epsilon$-DC behave similarly. However, given $\delta>0$, $\epsilon$-differentially calibrated models suffer from higher MC error than proportionally calibrated models when $\alpha$-PMC $< 0.3$. The right graph also illustrates the feasible range of $\alpha$ for $\alpha$-PMC is $0 < \alpha < 0.5$, past which it does not provide meaningful $\alpha$-MC. The steeper relation between $\alpha$-PMC and MC may have advantages or disadvantages, depending on context. It suggests that, by optimizing for $\alpha$-PMC, small improvements to this measure can result in relatively large improvements to MC; conversely, $\epsilon$-DC models that are well calibrated may satisfy a lower value of $\alpha$-MC over a larger range of $\epsilon$. \begin{figure} \centering \includegraphics[width=0.75\textwidth]{figs/parameter_comparison.pdf} \caption{ A comparison of $\varepsilon$-DC, $\alpha$-MC, and $\alpha$-PMC in terms of their parameters $\alpha$ and $\epsilon$. In both panes, the x value is a given value of one metric for a model, and the y axis is the implied value of the other metric, according to \cref{thm:DCtoMC}-\cref{thm:PMCtoMC}. The left filled area denotes the dependence of the privacy/DC of $\alpha$-multicalibrated models on the minimum risk interval, $r_{min} \in [0.01, 1.0]$. The right filled area denotes the dependence of the MC of $\epsilon$-differentially calibrated models on their overall calibration, $\delta \in [0.0, 0.5]$. $\alpha$-PMC does not have these sensitivities. } \label{fig:params} \end{figure} \subsection{Learning proportionally multicalibrated predictors} So far we have demonstrated that models satisfying PMC exhibit desirable guarantees relative to two previously defined measures of fair calibration, but have not considered whether PMC is easy to learn. Here, we answer in the affirmative by proposing \cref{alg:PMC} to satisfy PMC and proving that it learns an ($\alpha$,$\lambda$)-PMC model in a polynomial number of steps. \begin{theorem} \label{thm:alg} \Copy{thm:alg}{ Define $\alpha, \lambda, \gamma, \rho > 0$. Let $\mathcal{C} \subseteq 2^{\mathcal{X}}$ be a collection of subsets of $\mathcal{X}$ such that, for all $S \in \mathcal{C}$, $P_D(S) > \gamma$. Let $R(x)$ be a risk prediction model to be post-processed. For all $(S,I) \in \mathcal{C} \times \Lambda_{\lambda}$, let $E[y|R\in I, x \in S] > \rho$. There exists an algorithm that satisfies $(\alpha, \lambda)$-PMC with respect to $\mathcal{C}$ in $O(\frac{|C|}{\alpha^3\lambda^2\rho^2\gamma})$ steps. } \end{theorem} We analyze \cref{alg:PMC} and show it satisfies \cref{thm:alg} in \cref{s:proof}. \cref{alg:PMC} directly extends MCBoost\citep{pfistererMcboostMultiCalibrationBoosting2021}, but differs in that it does not terminate until $R(x)$ is within $\alpha \bar{y}$ for all categories, as opposed to simply within $\alpha$. This more stringent threshold requires an additional $O(\frac{1}{\rho^2})$ steps, where $\rho>0$ is a lower bound on the expected outcome within a category $(S,I)$. The parameter $\rho$ also serves to smooth empirical estimates of \cref{eq:lPMC} in our experiments. \algblockdefx{MRepeat}{EndRepeat}{\textbf{repeat}}{} \algnotext{EndRepeat} \begin{algorithm}[t] \caption{Proportional Multicalibration Post-processing} \label{alg:PMC} \begin{algorithmic}[1] \footnotesize \Require{ Predictor $R(x)$ \\ $\mathcal{C} \in 2^{\mathcal{X}}$ such that for all $S \in \mathcal{C}, P_D(S) \geq \gamma$ \\ $\alpha, \lambda, \gamma, \rho > 0$ \\ $\mathcal{D} = \set{(y,x)_i}_{i=0}^{N} \sim D$ } \Statex \Function{PMC}{$R$, $\mathcal{C}$, $\mathcal{D}$, $\alpha$, $\lambda$, $\gamma$, $\rho$} \MRepeat \hspace{1em} \Let{$\{(y,x)\}$}{sample $\mathcal{D}$} \For{$S \in \mathcal{C}, I \in \Lambda_\lambda$ such that $P_D(R \in I , x \in S) \geq \alpha \lambda \gamma$ } \Let{$S_r$}{$S \cap \set{x: R(x) \in I}$} \Let{$\bar{r}$}{$\frac{1}{|S_r|}\sum_{x \in S_r}{R(x)}$} \Comment{average group prediction } \Let{$\bar{y}$}{$\frac{1}{|S_r|}\sum_{x \in S_r}{y(x)}$} \Comment{average subgroup risk} \If{$\bar{y} \leq \rho$} \State continue \EndIf \Let{$\Delta r$}{$\bar{y} - \bar{r}$} \If{$\card{\Delta r} \geq \alpha \bar{y}$} \Let{$R(x)$}{$R(x) + \Delta r$ for all $x \in S_r$} \Let{$R(x)$}{squash($R(x)$, $[0,1]$)} \Comment{squash updates to $[0,1]$} \EndIf \EndFor \If{No Updates to R(x)} \State break \EndIf \EndRepeat \State \Return{$R$} \EndFunction \end{algorithmic} \end{algorithm} \section{Experiments} \label{s:exp} In our first set of experiments (\cref{s:exp}), we study MC and PMC in simulated population data to understand and validate the analysis in previous sections. In the second section, we compare the performance of varied model treatments on a real world hospital admission task, using an implementation of \cref{alg:PMC}. We make use of empirical versions of our fairness definitions which we refer to as \textit{MC loss} (\cref{def:mcloss}), \textit{PMC loss} (\cref{def:pmcloss}), and \textit{DC loss} (\cref{def:dcloss}), defined in \cref{s:App:def}. \paragraph{Simulation study} \label{s:exp:sim} We simulate data from $\alpha$-multicalibrated models. For simplicity, we specify a data structure with a one-to-one correspondence between subset and model estimated risk, such that for all $x$ in subset $S$, $R(x)=R(x|x\in S)=R(S)$. Therefore all information for predicting the outcome based on the features in $x$ is contained in the attributes $\mathcal{A}$ that define subgroup $S$. Prevalence is specified as $p_i^*=P_D(y|x \in S_i)=0.2+0.01(i-1)$ and $i=1,\cdots,N_s$, where $N_s$ is the number of subsets $S$, defined by $\mathcal{A}$ and indexed by $i$ with increasing $p^*$. For each group, $R_i=R(S_i)=R(x|x \in S_i)=p_i^*-\Delta_i.$ We randomly select $\Delta_i$ for one group to be $\pm\alpha$ and for the remaining groups, $\Delta_i= \pm\delta$, where $\delta\sim \textrm{Uniform}(\min=0, \max=\alpha)$. In all cases, the sign of $\Delta_i$ is determined by a random draw from a Bernoulli distribution. For these simulations we set $N_S=61$ and $\alpha=0.1$, such that $p^*_i\in[0.2,0.8]$ and $R_i\in[0.1,0.9]$. We generate $N_{sim}=1000$ simulated datasets, with $n=1000$ observations per group, and for each $S_i$, we calculate the ratio of the absolute mean error to $p^*_i$, i.e. the PMC loss function for this data generating mechanism. We also simulate three specific scenarios where: \begin{enumerate*}[label=\arabic*)] \item $\card{\Delta_i}$ is equivalent for all groups (Fixed); \item $\card{\Delta_i}$ increases with increasing $p_i^*$; and \item $\card{\Delta_i}$ decreases with increasing $p_i^*$ \end{enumerate*}, with $\alpha=0.1$ in each case. These scenarios compare when $\alpha$ is determined by all groups, the group with the lowest outcome prevalence, and the group with the highest outcome prevalence, respectively. \paragraph{Hospital admission} \label{s:exp:mimic} Next, we test PMC alongside other methods in application to prediction of inpatient hospital admission for patients visiting the emergency department (ED). The burden of overcrowding and long wait times in EDs is significantly higher among non-white, non-Hispanic patients and socio-economically marginalized patients~\citep{jamesAssociationRaceEthnicity2005,mcdonaldExaminingAssociationCommunityLevel2020a}. Recent work has demonstrated risk prediction models that can expedite patient visits by predicting patient admission at an early stage of a visit with a high degree of certainty (AUC $\geq$ 0.9 across three large care centers)~\citep{barak-correnProgressivePredictionHospitalisation2017,barak-correnEarlyPredictionModel2017,barak-correnPredictionHealthcareSettings2021,barak-correnPredictionPatientDisposition2021}. Our goal is to ensure no group of patients will be over- or under-prioritized over another by these models, which could exacerbate the treatment and outcome disparities that currently exist. We construct a prediction task similar to previous studies but using a new data resource: the \href{https://physionet.org/content/mimic-iv-ed/1.0/}{MIMIC-IV-ED} repository~\citep{johnsonalistairMIMICIVED2021}. The overall intersectional demographic statistics for these data are given in~\cref{tbl:mimic}. In \cref{tbl:mimic} we observe stark differences in admission rates by demographic group and gender, suggesting that the use of a proportional measure of calibration could be appropriate for this task. We trained and evaluated logistic regression (LR) and random forest (RF) models of patient admission, with and without post-processing for MC~\citep{pfistererMcboostMultiCalibrationBoosting2021} or PMC. We tested a number of parameter settings given in~\cref{tbl:params}, running 100 trials with different shuffles of the data. Comparisons are reported on a test set of 20\% of the data for each trial. Additional experiment details are available in~\cref{s:app:results} and code for the experiments is available here: \url{https://github.com/cavalab/proportional-multicalibration}. The PMC-postprocessing method is available as a package as well: \url{https://github.com/cavalab/pmcboost}. \section{Results} \cref{fig:sim} shows the PMC loss of $\alpha$-multicalibrated models under the scenarios described in \cref{s:exp:sim}. Proportional $\alpha$-MC constrains the ratio of the absolute mean error (AME) to the outcome prevalence, for groups defined by a risk interval $(R(x) \in I)$ and subset within a collection of subsets ($x \in S, S\in \mathcal{C})$. Without the proportionality factor $\card{ \E_D [ y | R \in I, x \in S] }^{-1}$ , $\alpha$-multicalibrated models allow a dependence between the group prevalence and the error or privacy loss permitted that is unfair for groups with lower outcome prevalence. Results on the hospital admission prediction task are summarized in \cref{fig:mimic_results} and \cref{tbl:wins}. PMC post-processing has a negligible effect on predictive performance ($<$0.1\% $\Delta$ AUROC, LR and RF) while reducing DC loss by 27\% for LR and RF models, and reducing PMC loss by 40\% and 79\%, respectively. In the case of RF models, PMC post-processing reduces MC loss by 23\%, a significantly larger improvement than MC post-processing itself (19\%, $p$=9e-26). \begin{table} \centering \scriptsize \caption{ Admission prevalence (Admissions/Total (\%)) among patients in the MIMIC-IV-ED data repository, stratified by the intersection of ethnoracial group and gender. } \label{tbl:mimic} \input{tbls/case_control_intersections.tex} \end{table} Due to normalization by outcome rates, the optimal value of $\alpha$ for PMC is likely to differ from the best value for MC (their relationship is shown in \cref{fig:params}). For both methods, setting $\alpha$ too small may result in over-fitting. To account for this, we quantified the number of trials for which a given method produced the best model according to a given metric, over all parameter configurations in \cref{tbl:params}. PMC post-processing (\cref{alg:PMC}) achieves the best fairness the highest percent of the time, according to DC loss (63\%), MC loss (70\%), and PMC loss (72\%), while MC-postprocessed models achieve the best AUROC in 88\% of cases. This provides strong evidence that, over a large range of $\alpha$ values, PMC post-processing is beneficial compared to MC-postprocessing. We characterize the sensitivity of PMC and MC to $\alpha$ and provide a more detailed breakdown of these results in \cref{s:app:results}. \begin{figure} \begin{minipage}{.49\textwidth} \includegraphics[width=\textwidth]{figs/sim_plot2.pdf} \end{minipage} \hspace{.01\textwidth} \begin{minipage}{.49\textwidth} \caption{ The relationship between MC, PMC, and outcome prevalence as illustrated via a simulation study in which the rates of the outcome are associated with group membership. Gray points denote the PMC loss of a (0.1,0.1)-MC model on 1000 simulated datasets, and colored lines denote three specific scenarios in which each group's calibration error ($|\Delta|$) follows specific rules. PMC loss is higher among groups with lower positivity rates in most scenarios unless the groupwise calibration error increases with positivity rate. } \label{fig:sim} \end{minipage} \end{figure} \begin{table}[t] \begin{minipage}[b]{.5\textwidth} \centering \footnotesize \caption{Parameters for the hospital admission prediction experiment.} \label{tbl:params} \input{tbls/pmc_params.tex} \end{minipage} \hspace{.01\textwidth} \begin{minipage}[b]{.44\textwidth} \centering \footnotesize \caption{ The number of times each postprocessing method achieved the best score among all methods, out of 100 trials. } \input{tbls/winning_configs.tex} \label{tbl:wins} \end{minipage} \end{table} \begin{figure} \includegraphics[width=\textwidth]{figs/box_AUROC_MC_PMC_DC.pdf} \caption{ A comparison of LR and RF models, with and without MC and PMC post-processing, on the hospital admission task. From left to right, trained models are compared in terms of test set AUROC, MC loss, PMC loss, and DC loss. Points represent the median performance over 100 shuffled train/test splits with bootstrapped 99\% confidence intervals. We test for significant differences between post-processing methods using two-sided Wilcoxon rank-sum tests with Bonferroni correction. ns: $p <=$ 1; **: 1e-03 $< p <=$ 1e-02; ***: 1e-04 $< p <=$ 1e-03; ****: $p <=$ 1e-04. } \label{fig:mimic_results} \end{figure} \section{Discussion and Conclusion} \looseness=-1 In this paper we have analyzed multicalibration through the lens of suffiency and differential calibration to reveal the sensitivity of this metric to correlations between outcome rates and group membership. We have proposed a measure, PMC, that alleviates this sensitivity and attempts to capture the ``best of both worlds" of MC and DC. PMC provides equivalent percentage calibration protections to groups regardless of their risk profiles, and in so doing, bounds a model's differential calibration. We provide an efficient algorithm for learning PMC predictors by postprocessing a given risk prediction model. On a real-world and clinically relevant task (admission prediction), we have shown that post-processing LR and RF models with PMC leads to better performance across all three fairness metrics, with little to no impact on predictive performance. \looseness=-1 Our preliminary analysis suggests PMC can be a valuable metric for training fair algorithms in resource allocation contexts. Future work could extend this analysis on both the theoretical and practical side. On the theoretical side, the generalization properties of the PMC measure should be established and its sample complexity quantified, as \citet{roseMachineLearningPrediction2018} did with MC. Additional extensions of PMC could establish a bound on the accuracy of PMC-postprocessed models in a similar vein to work by \citet{kimMultiaccuracyBlackboxPostprocessing2019} and \citet{hebert-johnsonMulticalibrationCalibrationComputationallyIdentifiable}. On the empirical side, future works should benchmark PMC on a larger set of real-world problems, and explore use cases in more depth.
{'timestamp': '2022-09-30T02:09:31', 'yymm': '2209', 'arxiv_id': '2209.14613', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14613'}
arxiv
\section{Introduction} The fundamental goal of machine learning algorithms is to identify the conditional distribution given any input and its label. In the training phase, it’s conventional to assume that the underlying classifier or function belongs to a certain class of functions. Therefore presuming that the approximation error is insignificant would be a necessary practice. This practice allows the training to emphasize on what is more practical to reduce the estimation error, which is the major error a classifier develops due to incomplete data training. The estimation error can be further decomposed into optimization and generalization errors, which are greatly complementary. \par Convexity, strong convexity, smoothness, and other features of the objective function (loss function) influence the optimization error. Furthermore, the convergence rate of the optimization problem relies on the algorithm used to solve it. For example, some algorithms have a linear convergence rate, and some have a sublinear or superlinear convergence rate. The computational complexity of an algorithm is a measure of how much computer resources the algorithm utilizes to solve the optimization problem. As a result, computational complexity can be quantified in units of storage, time, dimension, or all three simultaneously. \par A common methodology to quantify the computational complexity of optimization algorithms is by counting entire gradient evaluations required to obtain an optimal solution with a given accuracy $\epsilon$. The Gradient Descent algorithm is the most popular deterministic optimization algorithm with a linear convergence rate assuming $\mu$-strongly convex and $L$-smooth functions and a computational complexity of $\mathcal{O}( \frac{L}{\mu} N \log\frac{1}{\epsilon} )$ for ${N}$ data objective function. On the other hand, the Stochastic Gradient Descent is the most common algorithm that randomly picks a single function every iteration and thus has different computational complexity iteration $\mathcal{O}(\frac{1}{\epsilon} )$. When $N$ is large, the preferred methods for solving the resulting optimization or sampling problem usually rely on stochastic estimates of the gradient of $f$. \par Standard variance reduction techniques used for stochastic optimizations require additional storage or the computation of full gradients. Another approach for variance reduction is through adaptively increasing the sample size used to compute gradient approximations. Some adaptive sampling optimization methods sizes have been studied in \cite{6-samplesize,Raghu-samplesize, daneshmand2016starting, Hashemi-samplesize, mokhtari2017first}. These methods have optimal complexity properties, making them useful for various applications. \cite{Hashemi-samplesize} uses variance-bias ratios to consider a test that is similar to the norm test, which is reinforced by a backup mechanism that ensures a geometric increase in the sample size. \cite{Raghu-samplesize} establishes terms for global linear convergence by investigating methods that sample the gradient and the Hessian. Other noise reduction methods like SVRG, SAG, and SAGA, either compute the full gradient at regular intervals or require storage of the component gradients, respectively \cite{Ayoub-samplesize} . \section{Problem Definition} The ultimate goal of most machine learning algorithms is to estimate the underlying distribution e.g.: $\mathcal{D}(\mathcal{X},\mathcal{Y})$ where $\mathcal{X}$ is the input feature space, and $\mathcal{Y}$ is the label space, in terms of some hypothesis function $h:\mathcal{X} \rightarrow \mathcal{Y}$, further on we assume that $h$ is determined by a parameter $w$ \cite{shalev2014understanding}. Given any set $\mathcal{H}$ (that plays the role of hypotheses space) and domain $\mathbf{Z}:\mathcal{X\times Y}$: let $\ell$ be any function that maps from $\mathcal{H} \times \mathbf{Z}$ to the set of non-negative real numbers e.g. $\ell$ : $\mathcal{H} \times \mathbf{Z} \rightarrow \mathbb{R}_+$ . The ability of the proposed hypothesis to estimate the underlying distribution is assessed by such loss functions. The expected loss of a classifier, $h \in \mathcal{H}$, with regard to a probability distribution $\mathcal{D}$ over $Z$ is measured by the risk function \ref{eq:1}. \begin{equation} \label{eq:1} L_{\mathcal{D}}(h) := \mathbb{E}_{z\sim \mathcal{D}} (\ell(h,z)) \end{equation} Since this Expected Loss is built on the unknown distribution $\mathcal{D}$, the empirical risk over a given sample of the data $S = (z_1,\dots, z_m) \in Z_m$ is proven to be a good estimator of the expected loss, namely, \begin{equation} \label{eq:ERM} L_s(h) := \frac{1}{m} \sum_{i=1}^{m}\ell(h,z_i) \end{equation} \label{sec:Definition} \subsection{Computational complexity} The computational complexity is used to relate an excess error's upper bound (if one exists) to the available computational resources. Not only the convergence rate, but also the computational resources utilized to accomplish that convergence rate is important in order to have a superior algorithm. If we define a family $\mathcal{H}$ of candidates prediction functions, and let $h_s :=\argmin_{h\in\mathcal{H}}L_s(f)\implies$ ERM solution, $h^*:\argmin_{h}L_{\mathcal{D}}(h)\implies$ True solution (unknown) $h_{\mathcal{H}} :=\argmin_{h\in\mathcal{H}}L_{\mathcal{D}}(h)\implies$ Best in class solution (unknown) We can decompose the true loss (excess loss) as follow: \[ \mathcal{E}(h_s,h^*) = \mathbb{E}[L(h^*_{\mathcal{H}})-L(h^*)]+\mathbb{E}[L(h_s)-H(h^*_{\mathcal{H}})] = \mathcal{E}_{app} + \mathcal{E}_{est} \] Where the expectation w.r.t the samples. \begin{itemize} \item The approximation error $ \mathcal{E}_{app} $ measures how closely functions in $\mathcal{H}$ can approximate the optimal solution $h^*$. \item The estimation error $\mathcal{E}_{est}$ measures the effect of minimizing the empirical risk $L_s(f )$ instead of the expected risk $L(f )$. \item The estimation error is determined by the number of training examples and the capacity of the family of functions. \item The estimation error can be bounded using Rademacher Complexity to measure the complexity of a family of functions. \end{itemize} Since the empirical risk $L_s (h )$ is already an approximation of the expected risk $L(h )$, it should not be necessary to carry out this minimization with great accuracy. Assume that our algorithm returns an approximate solution $\hat{h}_s$ such that \begin{equation} \label{eq:rho} L_s(\hat{h}_s) \leq L_s(h_s) +\delta_s \end{equation} where $\delta_s$ is a predefined positive tolerance. The new excess error can be decomposed as follows; \begin{equation} \mathcal{E}(\hat{h}_s,h^*) = \mathbb{E}[L(h^*_{\mathcal{H}})-L(h^*)]+\mathbb{E}[L(h_s)-L(h^*_{\mathcal{H}})]+\mathbb{E}[L(\hat{h}_s)-L(h_s)]= \mathcal{E}_{app}+\mathcal{E}_{est}+\mathcal{E}_{opt} \end{equation} Where the expectation w.r.t the samples. The additional term $\mathcal{E}_{opt}$ is optimization error. It reflects the impact of the approximate optimization on the generalization performance. \subsection{General Model:} The decomposition of the excess error leads to a trade-off minimization taking into account the number samples and allocating computation resources. \begin{equation} \begin{matrix} \min_{\mathcal{H},\rho,m} & \mathcal{E}_{app} + \mathcal{E}_{est} + \mathcal{E}_{opt}\\ s.t. &m \leq m_{max}\\ &T(\mathcal{H},\rho,m) \leq T_{max} \end{matrix} \end{equation} The variables are the size of the family of functions ${F}$, the optimizaton accuracy $\rho$ within the allotted training time $T_{max}$ , and the number of examples ${n}$ altered by using a subset of all available $n_max$ samples.\\ Typically when the size the class increases, the approximation error decreases, but the estimation error increases and nothing happens to optimization error because it's not related, but the computation time increase. When n increases the estimation error decreases and computation time increases, but no relation to approximation error or optimization error. When $\rho$ increases , the optimization error increases by definition, and computation time decreases. \subsection{Statistical Error Minimization}In this paper we investigate the statistical error component of the excess error, which just comprises the difference of expected loss in some class and the empirical loss as shown below. \[ \mathcal{E}_{stat} := \mathcal{E}(\hat{f}_n,f^*_{\mathcal{F}})= \mathbb{E}[E(\hat{f}_n)-E(f^*_{\mathcal{F}})]\] Further we can add and substract some terms to have: \begin{align*} \mathcal{E}_{stat} := \mathcal{E}(\hat{f}_n,f^*_{\mathcal{F}})&= \mathbb{E}[E(\hat{f}_n)-E_n(\hat{f}_n)] +\underbrace{\mathbb{E}[E_n(\hat{f}_n)-E_n(f_n)]}_{\mathbb{E}[E_n(f_n)]=E(f_n)}\\ &+\underbrace{\mathbb{E}[E_n({f}_n)-E_n({f}^*_{\mathcal{F}})]}_{\leq0}+\underbrace{\mathbb{E}[E_n({f}^*_{\mathcal{F}})-E({f}^*_{\mathcal{F}})]}_{=0}\\ &\leq \underbrace{\mathbb{E}[E(\hat{f}_n)-E_n(\hat{f}_n)]}_{\mathcal{E}_{gen}} +\underbrace{\mathbb{E}[E_n(\hat{f}_n)-E_n(f_n)]}_{\mathcal{E}_{opt}}\\ \end{align*} As a result, our primary goal is to minimize statistical error as follows: \begin{equation} \label{eq:min} \begin{matrix} \min_{\rho,m} & \mathcal{E}_{gen} + \mathcal{E}_{opt}\\ s.t. &m \leq m_{max}\\ &T(\rho,m) \leq T_{max} \end{matrix} \end{equation} We list our assumptions below: \begin{assumption}[Lipschits Continuity]\label{ass:Lipschitz continuous} Assume for any $z\in\mathcal{Z}$, the loss function $l(\cdot;z)$ is G-Lipschitz continuous, i.e. $\forall w \in \mathcal{H}$, \begin{align} \nonumber |l(w;z)-l(w';z)|\leq G\left\|w-w'\right\|_2. \end{align} \end{assumption} \begin{assumption}[Convexity]\label{ass:Convexity} Assume for any $z\in\mathcal{Z}$ the loss function $l(\cdot;z)$ is convex function, i.e. $\forall w \in \mathcal{H}$, \begin{align} \nonumber l(w';z) \geq l(w;z) + \nabla l(w;z)^T (w' - w). \end{align} \end{assumption} \begin{assumption}[L-Smooth]\label{ass:Smooth} Assume for any $z\in\mathcal{Z}$ the loss gradient function $\nabla l(\cdot;z)$ is is L-Lipschitz continuous, i.e. $\forall w \in \mathcal{H}$, \begin{equation} \| \nabla \ell(w;z) - \ell(w';z)\| \leq L \| w - w' \| \end{equation} \end{assumption} \section{Methodology} \label{sec:others} The contribution of this work is mainly deriving the computational complexity of sub-linear convergent algorithm with adaptive sample size training. In order to derive that we start by the generalized bound that haven been studied well in literature \cite{boucheron2005theory} : \[ \mathbb{E} \left[\sup_{h\in\mathcal{H}} |L_s(h) - L(h)| \right] \leq V_n \approx \mathcal{O}\left(\frac{1}{n^\alpha}\right) \] where $\alpha \in [0 \; 0.5]$ depends on an algorithm used to solve ERM and other factors. The bound is found by \cite{vapnik1999nature} to be $\mathcal{O}(\sqrt{1/n \log{1/n}})\geq\mathcal{O}(\sqrt{1/n }) $, while in other references e.g. \cite{bartlett2006convexity} the bound is improved to $\mathcal{O}(1/n)$ under extra conditions in the regularizer. In any situation, the bound indicates that regardless of the ERM solution's optimization accuracy, there will always be a bound in the order $\mathcal{O}({1}/{n^\alpha})$, thus solving the ERM optimization problem with accuracy $\delta_s$ = 0 would not be beneficial to the final statistical error (estimation) minimization problem in \ref{eq:min} as illustrated in \cite{daneshmand2016starting}. Thus, solving the ERM with a statistical accuracy of $\delta_s$ in \ref{eq:rho} equal to the $V_ n$ is sufficient to provide a uniformly stable result, namely hypothesis $h$. This solution is denoted in literature by calculating the ERM within its statistical accuracy. \subsection{Adaptive Sample Size} Following the work of \cite{mokhtari2017first}, an adaptive sample size scheme is employed to take advantage of the nature of ERM, namely, the finite sum of functions drawn identically and independently from the same distribution to achieve a higher convergence rate with lesser computational complexities. However, the research in \cite{mokhtari2017first} only focuses into linearly convergent algorithms (strongly convex loss function are implemented with the aid of L-2 norm regularizer). The adaptive sample size scheme starts with a small portion of the training samples and solves the correspoding ERM within its statistical accuracy, then expands to include new samples with the original one and solves the ERM with the initial solution found by the previous sample and repeats until all samples are finished. \\ \par In other words given training data samples $\mathcal{Z}$ with $|\mathcal{Z}|=s$, we initialize the training with small sample $S_m \subset \mathcal{Z}$ and solve ERM in \ref{eq:ERM} within its statistical accuracy namely $\mathcal{O}(1/m^\alpha)$ to find $\hat{h}_m $ defined by some weights $w_m$. Then expand the training sample to include new samples such that $S_m \subset S_n \subset \mathcal{Z}$ and solve the ERM with initial solution of $w_m$ to find the ERM solution $w_n$. Repeat this process until all data in ${s}$ are included . \\ \par The relationship between the consecutive solutions $w_n$ and $w_m$ with ${n = 2m}$ (the increase is discussed in section 4) is established by the following theorem. The bound is expressed in terms of the first sample statistical solution to indicate that solving the first ERM problem with zero accuracy is not required. \begin{theorem} \label{th:th1} Given the solution $w_m$ that solves the ERM with tolerance $\delta_m$ on sample $S_m \subset \mathcal{Z}$ such that in expectation $\mathbb{E}[L_m(w_m) - L_m(w^*_m)] \leq \delta_m$. Assume the there exist an optimal solution $w_n$ on sample $S_n$ such that $S_m \subset \mathcal{Z}$ and its statistical accuracy $V_n$, then in expectation we have the empirical risk difference is bouneded in expctation between the $w_n^*$ and $w_m$ as: \begin{equation} \label{eq:th1} \mathbb{E}[L_n(w_m) - L_n(w_n^*] \leq \delta_m + \frac{n-m}{n} (2V_{n-m} + V_m +V_n) \end{equation} \end{theorem} \begin{proof} Starting by rewrite difference between the empirical losses using two models and denote $S_{n-m}$ the set of samples in $S_n \cap (S_m \cap S_n)^c$ thus: \begin{align} \label{eq:pr1} \mathbb{E}[L_n(w_m) - L_n(w_n^*)] &= \mathbb{E}[\underbrace{(L_n(w_m) - L_m(w_m))}_{1} + \underbrace{(L_m(w_m) - L_m(w_m^*))}_{2} \\ & + \underbrace{(L_m(w_m^*) - L_m(w_n^*))}_{3} + \underbrace{(L_m(w_n^*) - L_n(w_n^*))}_{4}] \end{align} The first difference is bounded by Lemma 5 in \cite{mokhtari2017first} as \[\mathbb{E}[|L_n(w_m) - L_m(w_m)|] \leq \frac{n-m}{n} (V_{n-m} +V_m) \] The second difference us the optimization error which is assumed to be : \[ \mathbb{E}[L_m(w_m) - L_m(w_m^*)] \leq \delta_m \] The third difference is bounde above by zero since $w_m^*$ is the minimizer of the empire risk $L_m$. \[\mathbb{E}[L_m(w_m^*) - L_m(w_n^*)] \leq 0 \] The forth difference is bounded by Lemma 5 in \cite{mokhtari2017first} as \[\mathbb{E}[|L_m(w_n^*) - L_n(w_n^*)|] \leq \frac{n-m}{n} (V_{n-m} +V_n) \] Putting all four bounds back in \ref{eq:pr1} to obtain the result in theorem \ref{eq:1}. \end{proof} Theorem 1 asserts that even with the most accurate $L_m$ ERM solution i.e. $\ delta_m =0$, the subsequent problem $L_n$ with $w_0 = w_m$ will always have an optimal solution that has a dependency on the $V_m$. Thus solving the $L_m$ should be only withing $\mathcal{O}(V_m)$ only to reduce the computational complexity. The results \ref{eq:th1} in theorem \ref{th:th1} can be simplified if we consider $V_n = 1/n^\alpha$ and $n = 2m$ in Lemma \ref{lemma:lemma1}. \begin{lemma} \label{lemma:lemma1} \begin{align} \mathbb{E}[L_n(w_m) - L_n(w_n^*] &\leq \delta_m + \frac{1}{2} \left(\frac{2}{(n-m)^\alpha} + \frac{1}{m^\alpha} +\frac{1}{n^\alpha}\right)\\ & = \delta_m + \frac{1}{2} \left(\frac{2}{m^\alpha} + \frac{1}{m^\alpha} +\frac{1}{(2m)^\alpha}\right)\\ & = \delta_m + \frac{1}{2 } \left(3 +\frac{1}{2^\alpha}\right)V_m \end{align} \end{lemma} \subsection{Computational Complexity} The computational complexity of an algorithm is a measure of the algorithm's recruitment of computer resources, and the less computing required to accomplish one iteration in an iterative process, the simpler the algorithm is. Typically, it's measured in cost units associated with the algorithm; for example, some algorithms are assessed in gradient evaluation or number of iterations, while others require counting the total number of computing activities performed by the machine. First the smooth loss function assumption is stated as below. Theorem \ref{th:th2} provides the minimal number of iterations required to solve the ERM on subset $S_n$ within statistical accuracy, i.e. $\mathbb{E}[L_n(w_n)-L_n(w_n^*)] \leq V_n$ given that the optimization algorithm has a sublinear convergence rate. \begin{theorem} \label{th:th2} Given the initial solution $w_m$ and assuming the optimal solution of the ERM on the subset $S_n \subset \mathcal{Z}$ to be $w^*_n$, the sublinear convergence optimization algorithm needs the following iteration to solve the ERM within its statistical accuracy: \begin{equation} T\geq \left[2^\alpha \left(\frac{5}{2 } +\frac{1}{2^{\alpha+1}}\right) \right]^\frac{1}{\zeta} \end{equation} Where T is the iteration number, and $\zeta$ is a positive constant determined by the optimization setting. \end{theorem} \begin{proof} Given the initial solution $w_m$ and assuming the optimal solution of the ERM on the subset $S_n \subset \mathcal{Z}$ to be $w^*_n$, the sublinear convergence optimization bounds the difference in expectation as: \begin{align} \mathbb{E}[L_n(w_T) - L_n(W_n^*]& \leq \frac{1}{T^\zeta} (L_n(w_m) - L_n(w^*_n))\\ &\underset{a}{\leq}\frac{1}{T^\zeta}\left[V_m + \frac{1}{2 } \left(3 +\frac{1}{2^\alpha}\right)V_m\right] \end{align} Where the inequality (a) comes from the results in lemma \ref{lemma:lemma1} with $\delta_m = V_m$. In order to solve the ERM in $V_n$ accuracy we need to bound the RHS last equation by $V_n$ as follow: \begin{align} \frac{1}{T^\zeta}\left[V_m + \frac{1}{2 } \left(3 +\frac{1}{2^\alpha}\right)V_m\right] &\leq V_n\\ \frac{1}{T^\zeta} \left(\frac{5}{2 } +\frac{1}{2^{\alpha+1}}\right) &\leq \frac{1}{2^\alpha}\\ T\geq \left[2^\alpha \left(\frac{5}{2 } +\frac{1}{2^{\alpha+1}}\right) \right]^\frac{1}{\zeta} \end{align} \end{proof} The number of iterations T in theorem \ref{th:th2} ensures that the solution of any phase (stage) meets the statistical accuracy utilizing this lower constraint based on the iterative optimization algorithm being used. With a batch or sample of data, the ERM problem in equation \ref{eq:ERM} is solved until the statistical accuracy of that batch is guaranteed, and the solution is then employed as an initial solution for the next batch. The requirement of statistical accuracy, on the other hand, necessitates access to the unknown minimizer $w^*_n$, thus Theorem \ref{th:th2} examines the minimum iterations needed such that an iterative method might utilize as a stopping criteria. Now the algorithm of solving the ERM problem in an adaptive way is illustrated in Algorithm 1. \begin{algorithm}[!h] \caption{Adaptive Sample Size iterative ERM solver Algorithm}\label{alg:cap} \begin{algorithmic} \label{alg:alg1} \Require initial Sample size: $m_0$, Initial Solution $w^0$ such that $\mathbb{E}[L_{m_0}(w^0)-L_{m_0}(w^*) \leq V_{m_0}]$, $\alpha$, $\zeta$ \Ensure $w_s \leq w_s^* +V_s$ \State $m \gets m_0$ \While{$n \leq |\mathcal{Z}|$} \State $w_m \gets w^0$ \State $n \gets \min(2m,|\mathcal{Z}|)$ \State $T_{max} \gets \left[2^\alpha \left(\frac{5}{2 } +\frac{1}{2^{\alpha+1}}\right) \right]^\frac{1}{\zeta}\log(n)$ \State Solve ERM problem on $S_n\subset\mathcal{Z}$ with $T_{max}$ and initial solution $w_m$ \State $w^0 = w_n$ \EndWhile \end{algorithmic} \end{algorithm} \section{Experiment} The experiments in this part are carried out with first-order optimization algorithms that have a sub-linear convergence rate on an objective function that meets assumption 1, namely L-smooth and convex. The experiment's purpose is to assess the sub-optimality of these algorithms when adaptive sample size can be used against their fixed sample size counterpart. The gradient descent algorithm is selected from deterministic algorithms, whereas the ADAM algorithm is selected from stochastic algorithms. The logistic function with binary classification is the objective loss function to be minimized.\\ \par We Refer to Gradient Descent with adaptive sample size as adaptive gradient descent (adaGD) and for ADAM with adaptive sample size as adaptive ADAM (adaADAM). The characteristics and total samples attributes of the datasets considered are detailed in table \ref{tab:table1}. Only the digits zero and eight are represented in binary in the MNIST databases. The Gradient Descent algorithm is first ran on every data set for a large number of iteration to obtain the optimal value. Then the ADAM algorithm have fixed parameters as : 1st-order exponential decay $\beta_1 = 0.9$, 2nd-order exponential decay $\beta_2=0.999$, step size $\eta=0.01$ and a small value $\epsilon=1e-8$ to prevent zero-division. The batch size is chosen to be 5 in ADAM and in adaADAM. The gradient descent step size is chosen based on the L-smoothness parameter values: $\gamma =1/L$.\\ \par \begin{table}[h] \centering \caption{Dataset Characteristics} \begin{tabular}{c c c c} \hline Name: & MNIST & RCV1 & a1a \\ \hline training size & 6000 & 20242 & 1,605 \\ testing size & 5774 & 677,399 & 30,956\\ features size & 784 & 123 & 47,236\\ \hline \end{tabular} \label{tab:table1} \end{table} \begin{figure}[!h] \centering \includegraphics[width=\textwidth]{adaGrad.png} \caption{Comparison between Gradient descent and Adaptive sampling of Gradient descent} \label{fig:fig1} \end{figure} \begin{figure}[!h] \centering \includegraphics[width=\textwidth]{adaAdam.png} \caption{Comparison between ADAM and Adaptive sampling of ADAM} \label{fig:fig2} \end{figure} \section{Discussion} This paper presents an adaptive sampling technique to simplify the ERM problem for first-order optimization algorithms with sublinear convergence under terms of convexity and L-smoothness. Based on the carried experiments, we can infer that adaptive sampling generally resulted in faster convergence for sublinear problems. The adaptive Gradient (adaGD) has reduced the computational complexity of minimizing the logistic loss on the three datasets MNIST, RCV1, and a1a, as shown in figure \ref{fig:fig1}. However, the MNIST dataset has the greatest reduction in complexity, which is characterized in gradient evaluations, while the a1a dataset has the least. \\ \par The reduction in computational complexity in adaptive ADAM (adaADAM) is not significant in some datasets, such as MNIST and RCV1, but it has proven to be significant in a1a as shown in figure \ref{fig:fig2}. The explanation for this could be that the ADAM algorithm stochastically shuffles the dataset after each epoch, which could result in the samples being repeated in different batches, which would employ the adaptive sampling technique implicitly. Future work related to exploring dataset characteristics that would limit convergence rate enhancement for sublinear problems through adaptive sampling is of interest. \section*{Acknowledgments} The work in this paper was a continuation of \cite{mokhtari2017first} and it was supported by the course instructor Dr. Bin Gu. \bibliographystyle{apalike} \section{Introduction} \lipsum[2] \lipsum[3] \section{Headings: first level} \label{sec:headings} \lipsum[4] See Section \ref{sec:headings}. \subsection{Headings: second level} \lipsum[5] \begin{equation} \xi _{ij}(t)=P(x_{t}=i,x_{t+1}=j|y,v,w;\theta)= {\frac {\alpha _{i}(t)a^{w_t}_{ij}\beta _{j}(t+1)b^{v_{t+1}}_{j}(y_{t+1})}{\sum _{i=1}^{N} \sum _{j=1}^{N} \alpha _{i}(t)a^{w_t}_{ij}\beta _{j}(t+1)b^{v_{t+1}}_{j}(y_{t+1})}} \end{equation} \subsubsection{Headings: third level} \lipsum[6] \paragraph{Paragraph} \lipsum[7] \section{Examples of citations, figures, tables, references} \label{sec:others} \lipsum[8] \cite{kour2014real,kour2014fast} and see \cite{hadash2018estimate}. The documentation for \verb+natbib+ may be found at \begin{center} \url{http://mirrors.ctan.org/macros/latex/contrib/natbib/natnotes.pdf} \end{center} Of note is the command \verb+\citet+, which produces citations appropriate for use in inline text. For example, \begin{verbatim} \citet{hasselmo} investigated\dots \end{verbatim} produces \begin{quote} Hasselmo, et al.\ (1995) investigated\dots \end{quote} \begin{center} \url{https://www.ctan.org/pkg/booktabs} \end{center} \subsection{Figures} \lipsum[10] See Figure \ref{fig:fig1}. Here is how you add footnotes. \footnote{Sample of the first footnote.} \lipsum[11] \begin{figure} \centering \fbox{\rule[-.5cm]{4cm}{4cm} \rule[-.5cm]{4cm}{0cm}} \caption{Sample figure caption.} \label{fig:fig1} \end{figure} \subsection{Tables} \lipsum[12] See awesome Table~\ref{tab:table}. \begin{table} \caption{Sample table title} \centering \begin{tabular}{lll} \toprule \multicolumn{2}{c}{Part} \\ \cmidrule(r){1-2} Name & Description & Size ($\mu$m) \\ \midrule Dendrite & Input terminal & $\sim$100 \\ Axon & Output terminal & $\sim$10 \\ Soma & Cell body & up to $10^6$ \\ \bottomrule \end{tabular} \label{tab:table} \end{table} \subsection{Lists} \begin{itemize} \item Lorem ipsum dolor sit amet \item consectetur adipiscing elit. \item Aliquam dignissim blandit est, in dictum tortor gravida eget. In ac rutrum magna. \end{itemize} \section{Conclusion} Your conclusion here \section*{Acknowledgments} This was was supported in part by...... \bibliographystyle{unsrt}
{'timestamp': '2022-10-06T02:08:16', 'yymm': '2209', 'arxiv_id': '2209.14558', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14558'}
arxiv
\section{Introduction} \label{sec:introduction} The Weibull distribution is one of the most important probability distributions in analysis of lifetime data. The probability density function and cumulative density function of a Weibull random variable $T$ with shape parameter $k>0$ and scale parameter $\lambda>0$ are \begin{align} \label{eqn:y:complete} p_T(t|k, \lambda) = \left(\frac{k}{\lambda^k}\right) t^{k-1} \exp\left(-\left(\frac{t}{\lambda}\right)^k\right), \quad F_T(t | k, \lambda) = 1 - \exp\left(-\left(\frac{t}{\lambda}\right)^k\right), \end{align} respectively. With lifetime data, we often do not observe complete data and instead have joint realisations of the random variables $(Y = y, \Delta = \delta)$ where \begin{eqnarray} \label{eqn:y:censored} Y &=& \min (T, C) \\ \label{eqn:Delta} \Delta_i &=& {\rm I}(T \leq C) = \begin{cases} 1, & \text{if } T \leq C \; ({\rm observed\; survival})\\ 0, & \text{if } T > C \; ({\rm observed\; censoring}) \end{cases} \end{eqnarray} where the random variables $T$ and $C$ are assumed to be independent and denote the survival time and the censoring time of an item, respectively. In words, we observe the survival time $T=t$ of an item if it is less than the corresponding censoring time $C = c$ (i.e., $t \leq c$) ; otherwise, we only know that the item survived past time $c$ (i.e., $t > c$). The censoring time may be a fixed constant (say, $c$) or a random variable that may depend on other factors. Given $n$ i.i.d. lifetime data points ${\bf y} = (y_1,\ldots,y_n)$ with or without censoring, an important problem is to estimate the unknown parameters $k$ and $\lambda$ and thus learn about the survival distribution of the items. The most common approach to parameter estimation is the method of maximum likelihood, where the unknown parameters are set to values that maximise the (log-) likelihood of the observed data. Unfortunately, in the case of the Weibull shape parameter the corresponding maximum likelihood estimate is known to have large bias with both complete and censored data (see, for example, \cite{Ross94, MackisackStillman96, Hirose99}) and this is especially evident for small sample sizes and/or under large amounts of censoring. This manuscript introduces the Bayesian minimum message length (MML) approach to inductive inference and demonstrates how MML can be used to estimate Weibull parameters in both the complete and censored data setting. We show that with an appropriate choice of prior distributions the MML estimate of the shape parameter improves on the maximum likelihood estimate, given censored or complete data, and is competitive with alternative proposals that modify the maximum likelihood estimate to reduce bias. Furthermore, we demonstrate how the MML principle can be used to discriminate between the lognormal and Weibull distributions with censored data. Empirical experiments suggest that model selection with MML is an excellent alternative to commonly used information criteria such as the Bayesian information criterion. \section{Minimum message length} \label{sec:mml} The minimum message length (MML) principle~\cite{WallaceBoulton68, WallaceFreeman87, WallaceDowe99a, Wallace05} is a Bayesian information-theoretic framework for inductive inference that provides a new, unified approach to parameter estimation and model selection. Given data, the key step in applying MML is the computation of the length of a message that describes (encodes) the data, with the assumption that the message comprises two components: \begin{enumerate} \item the \emph{assertion}, encoding of the structure of the model, including all model parameters $\bm{\theta} \in \bm{\Theta} \in \mathbb{R}^p$; and \item the \emph{detail}, encoding the data $D$ using the model $p(D | \bm{\theta})$ from the assertion. \end{enumerate} The length of the assertion measures the complexity of the model, with simpler models having a shorter assertion compared to more complex models. The length of the detail measures how well the model named in the assertion fits the data; more complex models will have shorter detail lengths compared to simpler models. The length of the combined two-part message, $I(D, \bm{\theta})$, is \begin{equation} \label{eqn:mml:codelength} I(D, \bm{\theta}) = \underbrace{ I(\bm{\theta}) }_{\rm assertion} + \underbrace{I(D | \bm{\theta})}_{\rm detail} \end{equation} i.e., the sum of the length of the assertion, $I(\bm{\theta})$, and the length of detail, $I(D|\bm{\theta})$. Inference in the MML framework proceeds by finding the model \begin{equation} \hat{\bm{\theta}}(D) = \argmin_{\bm{\theta} \in \bm{\Theta}} \left\{ I(D, \bm{\theta}) \right\} \end{equation} that minimises the length of the two-part message message. Minimising the MML codelength requires balancing complexity of a model (assertion) with the corresponding fit to the data (detail) with the preferred model being the simplest model that fits the data sufficiently well. A key advantage of MML is that the unit of measurement, the codelength (generally measured in $\log_e$ digits, called nits or nats), is universal in the sense that allows inference and comparison of models with different model structures (e.g., linear regression vs. decision tree) and parameters within a single, unified framework. Precise computation of codelengths is known to be a NP-hard proble in general. As such, there exist many MML approximations to the codelength (\ref{eqn:mml:codelength})~\cite{WallaceBoulton75,Wallace05}, with the MML87 approximation~\cite{WallaceFreeman87,Wallace05} being the most widely applied due to it's relative computational simplicity. Under suitable regularity conditions, the MML87 codelength approximates (\ref{eqn:mml:codelength}) by \begin{equation} \label{eqn:mml87:codelength} I_{87}(D, \bm{\theta}) = \underbrace{-\log \pi(\bm{\theta}) + \frac{1}{2} \log \abs{J_{\bm{\theta}}(\bm{\theta})} + \frac{p}{2} \log \kappa_p}_{\rm assertion} + \underbrace{\frac{p}{2} - \log p(D|\bm{\theta})}_{\rm detail} \end{equation} where $\pi_{\bm{\theta}}(\bm{\theta})$ is the prior distribution of the parameters $\bm{\theta}$, $\abs{J_{\bm{\theta}}(\bm{\theta})}$ is the determinant of the expected Fisher information matrix, $p(D|\bm{\theta})$ is the likelihood function of the model and $\kappa_p$ is a quantization constant~\cite{ConwaySloane98,AgrellEriksson98}; for small $p$ we have \begin{equation} \kappa_1 = \frac{1}{12}, \quad \kappa_2 = \frac{5}{36 \sqrt{3}}, \quad \kappa_3 = \frac{19}{192 \times 2^{1/3}}, \end{equation} while, for moderate to large $p$, $\kappa_p$ is well-approximated by~\cite{Wallace05}: \begin{equation} \frac{p}{2} (\log \kappa_p + 1) \approx -\frac{p}{2} \log 2\pi + \frac{1}{2} \log p \pi - \gamma, \end{equation} where $\gamma \approx 0.5772$ is the Euler--Mascheroni constant. The MML87 approximation is invariant under smooth one-to-one reparametarizations of the likelihood function and is asymptotically equivalent to the Bayesian information criterion (BIC)~\cite{Schwarz78} as $n \to \infty$ with $p>0$ fixed; that is, \begin{equation} \label{eqn:mml87:bic} I_{87}(D, \bm{\theta}) = - \log p(D|\bm{\theta}) + \frac{p}{2} + O(1) \end{equation} where the $O(1)$ term depends on the prior distribution, the Fisher information and the number of parameters $p$. There exist many successful applications of the MML principle in statistics and machine learning literature, including factor analysis~\cite{WallaceFreeman92}, time series~\cite{Schmidt08a,SchmidtMakalic16a}, linear causal models~\cite{WallaceKorb99} and mixture models~\cite{WallaceDowe00,SchmidtMakalic12}), among others. \section{Complete data} \subsection{Maximum likelihood estimates} \label{sec:complete:mle} Consider first the setting of complete data with no censoring. The negative log-likelihood of data ${\bf y} = (y_1,\ldots,y_n)$ is \begin{equation} \label{eqn:complete:nll} - \log p_T({\bf y} | k, \lambda) = n \log \left(\frac{\lambda^k}{k}\right) - (k-1) \left(\sum_{i=1}^n \log y_i\right) + \sum_{i=1}^n \left(\frac{y_i}{\lambda}\right)^k \end{equation} The maximum likelihood (ML) estimates of $k,\lambda$ are \begin{equation} \hat{\lambda}^{k}({\bf y}) = \frac{1}{n} \sum_{i=1}^n y_i^{k}, \end{equation} where $\hat{k}({\bf y})$ is defined implicitly by \begin{equation} \label{eqn:mle:kscore} \frac{n}{k} + \sum_{i=1}^n \log y_i - \frac{n \sum_i y_i^k \log y_i}{\sum_i y_i^k} = 0 \end{equation} and must be solved for numerically. While the ML estimate of $\lambda$ is reasonable, the ML estimate of $k$ is known to exhibit large bias and perform poorly in terms of squared error risk, especially for small sample sizes~\cite{MackisackStillman96}. Several attempts have been made to construct a modified ML estimate with improved performance. Ross~\cite{Ross94} derives the simple adjustment formula \begin{equation} \label{eqn:mle:kross} \hat{k}_{\rm R}({\bf y}) = \left(\frac{n-2}{n-0.68}\right) \hat{k}_{\rm ML}({\bf y}) \end{equation} for the ML estimate that reduces the bias to typically better than about $0.05$\%, though this adjustment applies to complete data only. Similarly, Hirose~\cite{Hirose99} derives tables with correction coefficients that can be used to obtain modified ML estimates of both $k$ and $\lambda$ with reduced bias. In a somewhat different approach, Yang and Xie~\cite{YangXie03} apply the modified profile likelihood proposed by Cox and Reid~\cite{CoxReid87,CoxReid92} to derive a penalized maximum likelihood estimate of $k$. Specifically, the Yang and Xie estimate of $\lambda$ is equivalent to the ML estimate while the new estimate of the shape parameter $k$ is obtained by numerically solving \begin{equation} \label{eqn:ml:yangxie} \frac{n-2}{k} + \sum_{i=1}^n \log y_i - \frac{n \sum_i y_i^k \log y_i}{\sum_i y_i^k} = 0. \end{equation} which is similar to (\ref{eqn:mle:kscore}), the only difference being $(n-2)$ in the numerator of the first term. Yang and Xie empirically show that their estimate of $k$ is less biased than the ML estimate and is more efficient than the simple modification (\ref{eqn:mle:kross}) proposed by Ross. In the next section, we show how to derive an MML estimate of the Weibull distribution parameters and demonstrate that the Yang and Xie modified maximum likelihood estimate is an MML87 estimate for a particular prior distribution. \subsection{Minimum message length estimates} \label{sec:complete:mml} To derive the MML87 codelength~(\ref{eqn:mml87:codelength}) we require the determinant of the expected Fisher information matrix \begin{equation} | J(k, \lambda) | = \frac{n^2 \pi^2}{6 \lambda ^2}, \end{equation} and prior distributions for both parameters. Assuming that $k$ and $\lambda$ are independent a priori, we opt for the half-Cauchy distributions \begin{equation} \label{eqn:mmlprior:complete} \pi(k, \lambda) = \pi(k) \pi(\lambda), \quad \pi(k) = \frac{2}{\pi (1 + k^2)}, \quad \pi(\lambda) = \frac{2}{\pi (1 + \lambda^2)}. \end{equation} As $\lambda$ is a scale parameter, a heavy tailed distribution like the half-Cauchy is appropriate and recommended in, for example, \cite{PolsonScott12}. Additionally, the half-Cauchy distribution is suitable for the shape parameter $k$ as $k=1$ denotes a fixed (constant) failure rate and decreasing ($k < 1$) and increasing ($k > 1$) failure rate are assumed equally likely a priori; that is, \begin{equation} \int_0^1 \pi(k) dk = \int_1^\infty \pi(k) dk = \frac{1}{2} . \end{equation} The complete MML87 codelength for the Weibull distribution is \begin{equation} \label{eqn:mml87:weibull:codelength} I_{87}(D, k, \lambda) = -\log \left(\frac{4}{\pi^2 (1+k^2)(1+\lambda^2)} \right) + \frac{1}{2} \log \left( \frac{n^2 \pi^2}{6 \lambda ^2} \right) - \log p_T({\bf y} | k, \lambda) + 1 + \log \kappa_2 \end{equation} where the negative log-likelihood function $- \log p_T({\bf y} | k, \lambda)$ is given in (\ref{eqn:complete:nll}) and $\kappa_2 = 5/(36 \sqrt{3})$ (see Section~\ref{sec:mml}). Unfortunately, with this selection of prior distributions, the MML87 estimates of $k$ and $\lambda$ must be obtained by numerically minimising (\ref{eqn:mml87:weibull:codelength}). It is straightforward to see that the modified maximum likelihood estimate of Yang and Xie (\ref{eqn:ml:yangxie}) is the MML87 estimate obtained under the prior distribution \begin{equation} \pi(k, \lambda) = \pi(k) \pi(\lambda), \quad \pi(k) \propto \frac{1}{k^2}, \quad \pi(\lambda) \propto \frac{1}{\lambda}. \end{equation} which is improper unless lower and upper bound limits are imposed on both the shape and scale parameters. The implied prior distribution for $\lambda$ is the usual scale invariant distribution often used to model a scale parameter while the prior distribution for the shape parameter $k$ is heavy tailed and Cauchy-like asymptotically. As the aforementioned implied prior distributions are similar to (\ref{eqn:mmlprior:complete}) in their behaviour, it is expected that both the Yang and Xie modified maximum likelihood estimate and the MML87 estimate proposed in this manuscript will yield similar parameter estimates with virtually identical properties. \section{Censored data} \label{sec:censored} We now examine inference of the Weibull distribution in the presence of Type I fixed as well as random censoring. Consider first the fixed censoring setup where observations are censored after some period of time $c > 0$. In particular, we observe the lifetime of an item only if $T_i \leq c$, otherwise we observe the censoring time $c$. The likelihood function of $n$ observed data points $D = \{(y_1, \delta_1), \ldots, (y_n, \delta_n)\}$ is \begin{equation} p(D) = \prod_{i=1}^n p_{T}(y_i)^{\delta_i} (1 - F_{T}(y_i))^{1 -\delta_i} \end{equation} where $\delta_i = 1$ if the survival time is observed, and $\delta_i = 0$ if the censoring time is observed (see Section~\ref{sec:introduction}). In contrast, under random censoring, both the lifetime $T_i$ and the censoring time $C_i$ are assumed to be mutually independent random variables. Here, the likelihood function of $n$ observed data points $D = \{(y_1, \delta_1), \ldots, (y_n, \delta_n)\}$ can be written as \begin{equation*} p(D) = \left(\prod_{i=1}^n p_{T}(y_i)^{\delta_i} (1 - F_{T}(y_i))^{1 -\delta_i}\right) \left( \prod_{i=1}^n p_C(y_i)^{1-\delta_i} (1 - F_{C}(y_i))^{\delta_i} \right) \end{equation*} where $p_T(t|\theta)$ and $F_T(t|\theta)$ denote the probability density and the cumulative density function of the random variable $T$, respectively. We assume the random censoring setup examined in \cite{DanishAslam12}, where both $T_i$ and $C_i$ are Weibull random variables \begin{equation} \label{eqn:exponential} T_i \sim {\rm Weibull}(\theta, \beta), \quad C_i \sim {\rm Weibull}(\theta, \alpha), \quad i = 1,\ldots,n, \end{equation} where $\alpha,\beta>0$ are the scale parameters and $\theta > 0$ is the common shape parameter. The joint probability density function of $Y_i = {\rm min}(T_i, C_i)$ and $\Delta_i = I(T_i < C_i)$ is \begin{equation} p_{Y,\Delta}(y, \delta | \alpha, \beta, \theta) = \left( \frac{\theta}{\alpha^\theta} \right) \left( \frac{\alpha}{\beta} \right)^{\delta_i \theta} y^{\theta-1} \exp\left(- \left(\frac{1}{\alpha ^{\theta }}+\frac{1}{\beta ^{\theta }}\right) y^{\theta }\right) . \end{equation} Next we derive maximum likelihood estimates for the Weibull distribution under type I and random censoring. \subsection{Maximum likelihood estimates} \label{sec:censored:mle} Consider the type I censoring setup as described in Section~\ref{sec:censored}. The likelihood of $n$ data points $D = \{(y_1, \delta_1), \ldots, (y_n, \delta_n)\}$ is \begin{align} p(D) &= \left(\frac{k}{\lambda^k}\right)^d \exp\left(-\frac{1}{\lambda^k} \sum_{i=1}^n y_i^k \right) \prod_{i=1}^n y_i^{\delta_i (k-1)} \label{eqn:censored:nll} \end{align} The maximum likelihood (ML) estimates of $k,\lambda$ are \begin{equation} \hat{\lambda}^{k}({\bf y}) = \frac{1}{d} \sum_{i=1}^n y_i^{k}, \end{equation} where $d = \sum_{i=1}^n \delta_i$ and $\hat{k}({\bf y})$ is given implicitly by \begin{equation} \label{eqn:mle:censored:kscore} \frac{d}{k} + \sum_{i=1}^n \delta_i \log y_i - \frac{d \sum_i y_i^k \log y_i}{\sum_i y_i^k} = 0 \, . \end{equation} The maximum likelihood estimate of $k$ is known to exhibit large bias in small samples and when the proportion of censoring is high. Sirvanci and Yang~\cite{SirvanciYang84} propose the alternative estimate \begin{equation} \hat{k}^{-1}(D) = \frac{1}{d g(d / n)} \sum_{i=1}^n \delta_i (\log c - \log y_i) , \end{equation} where the function $g(\cdot)$ given by \begin{equation} g(p) = \log \log (1 - p)^{-1} - \frac{1}{p} \int_0^p \log \log (1-t)^{-1} \, dt . \end{equation} is a bias correction factor for the bias in estimating $1/k$. Sirvanci and Yang derive finite sample properties of this estimate and show that it has high relative efficiency in estimating $1/k$ over a range of censoring levels (10\% -- 90\% censoring) provided $0 < d < n$. Using the same strategy as in the complete data case (see Section~\ref{sec:complete:mle}), Yang and Xie~\cite{YangXie03} propose a new modified maximum likelihood estimate of the shape parameter $k$ that is obtained by solving \begin{equation} \label{eqn:ml:yangxie:censored} \frac{d-1}{k} + \sum_{i=1}^n \delta_i \log y_i - \frac{d \sum_i y_i^k \log y_i}{\sum_i y_i^k} = 0. \end{equation} However, this modified profile score function requires $d>1$ to yield a positive estimate for $k$. Next, we examine the random censoring setup described in Section~\ref{sec:censored}. The likelihood of the data under the random censoring model is \begin{equation} p_D(D | \alpha, \beta, \theta) = \left(\frac{\theta }{\alpha^{\theta }}\right)^n \left(\frac{\alpha }{\beta }\right)^{d \theta } \exp\left(- \left(\frac{1}{\alpha ^{\theta }}+\frac{1}{\beta ^{\theta }}\right) \sum_{i=1}^n y_i^{\theta }\right) \prod_{i=1}^n y_i^{\theta - 1} \end{equation} where, as before, $d = \sum_{i=1}^n \delta_i$. From this, the maximum likelihood estimates of $(\alpha,\beta)$ are \begin{equation} \hat{\alpha}_{\rm ML} = \left(\frac{\sum_{i=1}^n y_i^\theta}{n-d}\right)^{1/\theta }, \quad \hat{\beta}_{\rm ML} = \left(\frac{\sum_{i=1}^n y_i^\theta}{d}\right)^{1/\theta } \end{equation} while the maximum likelihood estimate of $\theta$ must be obtained by numerical optimisation. Clearly, the maximum likelihood estimates $(\hat{\alpha}_{\rm ML}, \hat{\beta}_{\rm ML})$ exist only if $d \in (0, n)$. Alternatively, maximum likelihood estimates may be obtained by noting the following. \begin{thm} \label{thm:jointpdf} The joint probability density function of $(Y_i, \Delta_i)$ can be written as \begin{equation} p_{Y,\Delta}(y, \delta | \alpha, \beta, \theta) = p_{\Delta}(\delta | \phi) \, p_{Y}(y | k, \lambda), \end{equation} where $\Delta \sim {\rm binom}(n, \phi)$ and $Y \sim {\rm Weibull} (k, \lambda)$ and \begin{equation} \phi = P(T \leq C) = \frac{\alpha^\theta}{\alpha^\theta+\beta^\theta}, \quad k = \theta, \quad \lambda = \frac{\beta}{(1 + (\beta/\alpha)^\theta)^{1/\theta}}. \end{equation} \end{thm} The proof is straightforward and is omitted. By Lemma~\ref{thm:jointpdf} and invariance of the maximum likelihood estimate, the maximum likelihood estimates of $\alpha,\beta$ and $\theta$ can also be obtained from the usual maximum likelihood estimates for the binomial and Weibull distributions \begin{equation} \hat{\phi}_{\rm ML} = \frac{1}{n} \sum_{i=1}^n \delta_i, \quad \hat{\lambda}^{\hat{k}}_{\rm ML} = \frac{1}{n} \sum_{i=1}^n y_i^{\hat{k}}, \end{equation} where $\hat{k}$ is given implicitly by \begin{equation} \frac{1}{n} \sum_{i=1}^n \log y_i + \frac{1}{k} - \frac{\sum_i y_i^k \log y_i}{\sum_i y_i^k} = 0 \end{equation} and by noting that \begin{equation} \label{eqn:param:transform} \theta = k, \quad \alpha = \lambda (1 - \phi)^{-1/\theta}, \quad \beta = \lambda \phi^{-1/\theta}. \end{equation} These estimates exist only if $\phi_{\rm ML} \in (0, 1)$ or, equivalently, $d \in (0, n)$. \subsection{Minimum message length estimates} \label{sec:censored:mml} We consider first MML inference under the type I censoring setup described in Section~\ref{sec:censored}. Let \begin{equation} p = F_T(c | k, \lambda), \quad q = -\log(1 - p), \quad E_1(z) = \int_1^\infty \exp(-t z) / t \, dt, \end{equation} where $E_1(\cdot)$ is the usual exponential integral function. As with the complete data setting, we assume independent half-Cauchy prior distributions (see (\ref{eqn:mmlprior:complete})) for both the shape and the scale parameters. The expected Fisher information matrix with type I censoring is \begin{equation*} J(k,\lambda) = n \left( \begin{array}{cc} J_{k,k} & J_{k,\lambda} \\ J_{k,\lambda} & J_{\lambda,\lambda} \end{array} \right) \end{equation*} \begin{align*} J_{\lambda,\lambda} &= p \left(\frac{k}{\lambda}\right)^2, \quad J_{k,\lambda} = \frac{E_1(q)-p-(p-1) \log(q)+\gamma }{\lambda } \\ J_{k,k} &= \frac{(\log (q)+1) (p+(p-2) \log (q)-2 E_1(q)-2 \gamma ) + 2 q \, _3F_3(1,1,1;2,2,2;-q)}{k^2} , \end{align*} where $_3F_3(\cdot;\cdot;\cdot)$ is the generalized hypergeometric function and $\gamma \approx 0.5772$ is the Euler--Mascheroni constant. The determinant of the expected Fisher information matrix \begin{equation} | J(k,\lambda) | = \left(\frac{n}{\lambda}\right)^2 \left[ 2 p q \, _3F_3(1,1,1;2,2,2;-q)-(\gamma+\log (q)-\text{li}(1-p))^2 \right], \end{equation} where $\text{li}(\cdot)$ is the logarithmic integral function, is clearly a complicated function of the probability of no censoring, $p$. The second term approaches \begin{eqnarray} \lim_{p \to 1} \left[ 2 p q \, _3F_3(1,1,1;2,2,2;-q)-(\gamma+\log (q)-\text{li}(1-p))^2 \right] = \frac{\pi^2}{6} \end{eqnarray} as $p$ gets closer to 1, and is otherwise always less than ($\pi^2/6$). A simple approximation to the log-determinant using a rational function of $p$ is \begin{equation} \log | J(k,\lambda) | \approx \frac{-89.8213 p^3+194.713 p^2-87.8331 p-10.7758}{-24.0356 p^3+7.79886 p^2+28.0711 p+1} + \log \left(\frac{n}{\lambda}\right)^2 \end{equation} with the absolute approximation error of the order $0.005$ for all $0.1 \leq p \leq 0.9$; a higher order rational approximation can be used if smaller approximation error is desired over the entire range of $p \in (0,1)$. The MML87 codelength for the Weibull distribution with type I censoring is \begin{equation} \label{eqn:mml87:censored:codelength} I_{87}(D, \bm{\theta}) = -\log \left(\frac{4}{\pi^2 (1+k^2)(1+\lambda^2)} \right) + \frac{1}{2} \log | J(k,\lambda) | - \log p_T({\bf y} | k, \lambda) + 1 + \log \kappa_2 \end{equation} where the negative log-likelihood function $- \log p_T({\bf y} | k, \lambda)$ is given in (\ref{eqn:censored:nll}) and $\kappa_2 = 5/(36 \sqrt{3})$ (see Section~\ref{sec:mml}). As with the complete data case the MML87 estimates of $k$ and $\lambda$ must be obtained by numerically minimising (\ref{eqn:mml87:censored:codelength}). Consider next the random censoring setup described in Section~\ref{sec:censored} where the lifetime $T_i$ and the censoring time $C_i$ are mutually independent Weibull random variables with a common shape parameter. From Lemma~\ref{thm:jointpdf}, the joint density of $(Y_i, \Delta_i)$ can be written as a product of a binomial distribution $\Delta \sim (n, \phi)$ and Weibull distribution $Y | \Delta \sim \text{Weibull}(k, \lambda)$. This implies that an MML code for the data $D$ could comprise two messages with the first message encoding the binary censoring indicators $\bm{\delta} = (\delta_1,\ldots,\delta_n)$, followed by another message that encodes the lifetimes ${\bf y} = (y_1,\ldots,y_n)$ given the censoring data $\bm{\delta}$. With this encoding, the total MML codelength for the data $D = \{(y_1, \delta_1), \ldots, (y_n, \delta_n)\}$ is \begin{equation} \label{eqn:cond:codelength} I_{87}(D, \alpha, \beta, \theta) = I_{87}(\bm{\delta}, \phi) + I_{87}({\bf y}, k, \lambda |\bm{\delta}), \end{equation} where $\phi$ is the probability of observing an uncensored datum. As with maximum likelihood, MML87 is invariant under one-to-one parameter transformations implying that MML87 estimates of $(\alpha, \beta, \theta)$ can be obtained from MML87 estimates of $(\phi, k, \lambda)$ using the relations (\ref{eqn:param:transform}). The MML87 codelength of the binomial distribution was derived in, for example, \cite{Wallace05,WallaceDowe00} and, for a uniform prior distribution on $\phi$, is given by \begin{equation} \label{eqn:Idelta} I_{87}(\bm{\delta}, \phi) = -\left(k + \frac{1}{2}\right) \log \phi - \left(n + \frac{1}{2} - k\right) \log (1-\phi) + \frac{1}{2}(1 + \log (n/12) ) \end{equation} where, as before, $k = (\sum_i \delta_i)$. The minimum of the codelength is at the MML87 estimate \begin{equation} \hat{\phi}_{87}(\bm{\delta}) = \frac{k + 1/2}{n + 1} . \end{equation} The conditional codelength of the surivival times ${\bf y}$ given the censoring indicators $\bm{\delta}$, $I_{87}({\bf y}, k, \lambda | \bm{\delta})$ is simply the MML87 codelength for the Weibull distribution discussed in Section~\ref{sec:complete:mml}. Note that it is of course possible to derive the MML87 joint codelength and construct a single message for the data $D$, similar to the complete data case discussed in Section~\ref{sec:complete:mml}. Due to the invariance of the MML87 codelength, both approaches will yield exactly the same inferences. \section{Experiments} \label{sec:experiments} Numerical experiments were performed to measure the performance of the newly proposed MML87 estimates compared to the maximum likelihood estimate and the modified maximum likelihood estimate of Yang and Xie~\cite{YangXie03} with complete (see Section~\ref{sec:experiments:complete}) and type I censored data (see Section~\ref{sec:experiments:censored}). \begin{table*}[tb] \scriptsize \begin{center} \begin{tabular}{ccccccccc} \toprule $n$ & $k$ & \multicolumn{3}{c}{Bias} & & \multicolumn{3}{c}{Mean Squared Error} \\ & & MLE & MMLE & MML87 & ~ & MLE & MMLE & MML87 \\ \cmidrule{1-9} \multirow{4}{*}{10} & 0.5 & 0.085 & {\bf 0.008} & 0.063 & & 0.038 & {\bf 0.023} & 0.029\\ & 1.0 & 0.168 & {\bf 0.015} & 0.085 & & 0.152 & {\bf 0.094} & 0.099\\ & 5.0 & 0.850 & {\bf 0.085} & 0.117 & & 3.836 & 2.352 & {\bf 2.336}\\ & 10.0 & 1.692 & {\bf 0.164} & 0.181 & & 14.973 & 9.143 & {\bf 9.124}\\ \vspace{-2mm} \\ \cmidrule{2-9} \vspace{-2mm} \\ \multirow{4}{*}{20} & 0.5 & 0.038 & {\bf 0.004} & 0.030 & & 0.012 & {\bf 0.009} & 0.011\\ & 1.0 & 0.076 & {\bf 0.008} & 0.040 & & 0.048 & {\bf 0.037} & 0.038\\ & 5.0 & 0.371 & {\bf 0.031} & 0.045 & & 1.194 & 0.927 & {\bf 0.923}\\ & 10.0 & 0.774 & {\bf 0.093} & 0.100 & & 4.881 & 3.761 & {\bf 3.757}\\ \vspace{-2mm} \\ \cmidrule{2-9} \vspace{-2mm} \\ \multirow{4}{*}{50} & 0.5 & 0.015 & {\bf 0.002} & 0.012 & & 0.004 & {\bf 0.003} & 0.003\\ & 1.0 & 0.029 & {\bf 0.004} & 0.016 & & 0.015 & {\bf 0.013} & 0.014\\ & 5.0 & 0.143 & {\bf 0.016} & 0.021 & & 0.366 & 0.329 & {\bf 0.328}\\ & 10.0 & 0.279 & {\bf 0.025} & 0.028 & & 1.456 & 1.311 & {\bf 1.310}\\ \vspace{-3mm} \\ \bottomrule \vspace{+1mm} \end{tabular} \caption{Bias and mean squared error for maximum likelihood (MLE), modified maximum likelihood (MMLE) and MML87 estimates of $k$ computed over $10^5$ simulations runs with $\lambda = 1$.\label{tab:results:complete}} \end{center} \end{table*} \subsection{Complete data} \label{sec:experiments:complete} The MML87 estimate of the shape parameter $k$ derived in Section~\ref{sec:complete:mml} is now compared to the maximum likelihood (MLE) estimate (\ref{eqn:mle:kscore}) and the modified maximum likelihood (MMLE) estimate (\ref{eqn:ml:yangxie}) using simulated data. In each simulation run, $n$ data points were generated from the model Weibull$(k, \lambda = 1)$ where $n = \{10, 20, 50\}$ and the shape parameter was set to $k \in \{0.5, 1, 5, 10\}$. Given the data, MLE, MMLE and MML87 estimates were computed and compared in terms of bias and mean squared error. For each value of $(k, n)$ $10^5$ simulations were performed and the average bias and mean squared error results are shown in Table~\ref{tab:results:complete} for each estimate. It is clear that the MMLE and MML87 estimates improve significantly on the maximum likelihood estimate in terms of both bias and mean squared error for each tested value of $(n,k)$. We further note that the MMLE estimate of $k$ is slightly less biased than the proposed MML87 estimate, though the two estimates are virtually indistinguishable in terms of the average mean squared error. As discussed in Section~\ref{sec:complete:mml}, the MMLE estimate is a special case of the MML87 estimator for a particular choice of the prior distribution with complete data, and it is therefore expected that the two estimates will have similar behaviour. \subsection{Censored data} \label{sec:experiments:censored} We also compared the MML87 estimate (see Section~\ref{sec:censored:mml}) to the maximum likelihood estimate (MLE) (\ref{eqn:mle:censored:kscore}) and the modified maximum likelihood estimate (MMLE) (\ref{eqn:ml:yangxie:censored}) under type I censored data. The experimental setup was identical to that for complete data with the following changes: (i) the proportion of uncensored observations was set to $p \in \{0.3, 0.5, 0.7, 0.9\}$, and (ii) $n \in \{20,30,40\}$ data points were generated during each simulation run. We restricted the experiments to exclude data sets where the number of uncensored observations $d (=\sum_i \delta_i) < 2$, as the MLE and MMLE estimates are not defined for small $d$. In addition to the bias and the mean squared error in estimating the shape parameter, we computed the Kullback--Leibler (KL) divergence~\cite{KullbackLeibler51} between the data generating model and each estimated model (see Appendix~A). The results averaged over $10^5$ simulations runs for each combination of $(n,p,k)$ are shown in Table~\ref{tab:results:censored}. We again observe that the MLE estimate of $k$ is strongly biased particularly for small $k$ and $p$. While the MMLE is less biased than the proposed MML87 estimate, the MML87 estimate achieves smaller mean squared error and smaller KL divergence compared to the MMLE in all experiments. Additionally, we observe that the KL divergence for the MMLE model is similar to the MLE model, despite the significant reduction in bias of estimating the shape parameter $k$ achieved by the MMLE. Clearly the proposed MML87 estimate is an improvement over the MLE and highly competitive against estimators that are primarily designed to reduce bias in the MLE, such as the one proposed by Yang and Xie~\cite{YangXie03}. \begin{table*}[tbph] \scriptsize \begin{center} \begin{tabular}{cccccccccccccccccc} \toprule $n$ & $p$ & $k$ & \multicolumn{3}{c}{Bias} & & \multicolumn{3}{c}{Mean Squared Error} & & \multicolumn{3}{c}{KL Divergence} \\ & & & MLE & MMLE & MML87 & ~ & MLE & MMLE & MML87 & ~ & MLE & MMLE & MML87 \\ \cmidrule{1-14} \multirow{16}{*}{20} & \multirow{4}{*}{ 0.3} & 0.5 & 0.114 & {\bf 0.002} & 0.070 & & 0.158 & 0.077 & {\bf 0.040} & & 0.069 & 0.060 & {\bf 0.042}\\ & & 1.0 & 0.055 & {\bf 0.005} & 0.038 & & 0.042 & 0.031 & {\bf 0.026} & & 0.060 & 0.056 & {\bf 0.043}\\ & & 5.0 & 0.037 & {\bf 0.006} & 0.021 & & 0.020 & 0.017 & {\bf 0.016} & & 0.057 & 0.054 & {\bf 0.044}\\ & & 10.0 & 0.019 & {\bf -0.001} & 0.006 & & 0.011 & 0.010 & {\bf 0.010} & & 0.048 & 0.046 & {\bf 0.039}\\ & \multirow{4}{*}{ 0.5} & 0.5 & 0.114 & {\bf 0.002} & 0.070 & & 0.158 & 0.077 & {\bf 0.040} & & 0.069 & 0.060 & {\bf 0.042}\\ & & 1.0 & 0.055 & {\bf 0.005} & 0.038 & & 0.042 & 0.031 & {\bf 0.026} & & 0.060 & 0.056 & {\bf 0.043}\\ & & 5.0 & 0.037 & {\bf 0.006} & 0.021 & & 0.020 & 0.017 & {\bf 0.016} & & 0.057 & 0.054 & {\bf 0.044}\\ & & 10.0 & 0.019 & {\bf -0.001} & 0.006 & & 0.011 & 0.010 & {\bf 0.010} & & 0.048 & 0.046 & {\bf 0.039}\\ & \multirow{4}{*}{ 0.7} & 0.5 & 0.114 & {\bf 0.002} & 0.070 & & 0.158 & 0.077 & {\bf 0.040} & & 0.069 & 0.060 & {\bf 0.042}\\ & & 1.0 & 0.055 & {\bf 0.005} & 0.038 & & 0.042 & 0.031 & {\bf 0.026} & & 0.060 & 0.056 & {\bf 0.043}\\ & & 5.0 & 0.037 & {\bf 0.006} & 0.021 & & 0.020 & 0.017 & {\bf 0.016} & & 0.057 & 0.054 & {\bf 0.044}\\ & & 10.0 & 0.019 & {\bf -0.001} & 0.006 & & 0.011 & 0.010 & {\bf 0.010} & & 0.048 & 0.046 & {\bf 0.039}\\ & \multirow{4}{*}{ 0.9} & 0.5 & 0.114 & {\bf 0.002} & 0.070 & & 0.158 & 0.077 & {\bf 0.040} & & 0.069 & 0.060 & {\bf 0.042}\\ & & 1.0 & 0.055 & {\bf 0.005} & 0.038 & & 0.042 & 0.031 & {\bf 0.026} & & 0.060 & 0.056 & {\bf 0.043}\\ & & 5.0 & 0.037 & {\bf 0.006} & 0.021 & & 0.020 & 0.017 & {\bf 0.016} & & 0.057 & 0.054 & {\bf 0.044}\\ & & 10.0 & 0.019 & {\bf -0.001} & 0.006 & & 0.011 & 0.010 & {\bf 0.010} & & 0.048 & 0.046 & {\bf 0.039}\\ \vspace{-2mm} \\ \cmidrule{2-14} \vspace{-2mm} \\ \multirow{16}{*}{30} & \multirow{4}{*}{ 0.3} & 0.5 & 0.067 & {\bf 0.002} & 0.048 & & 0.059 & 0.039 & {\bf 0.026} & & 0.042 & 0.039 & {\bf 0.028}\\ & & 1.0 & 0.035 & {\bf 0.003} & 0.024 & & 0.020 & 0.017 & {\bf 0.016} & & 0.038 & 0.036 & {\bf 0.029}\\ & & 5.0 & 0.023 & {\bf 0.004} & 0.013 & & 0.012 & 0.010 & {\bf 0.010} & & 0.036 & 0.035 & {\bf 0.030}\\ & & 10.0 & 0.016 & {\bf 0.003} & 0.008 & & 0.007 & 0.007 & {\bf 0.007} & & 0.034 & 0.033 & {\bf 0.029}\\ & \multirow{4}{*}{ 0.5} & 0.5 & 0.067 & {\bf 0.002} & 0.048 & & 0.059 & 0.039 & {\bf 0.026} & & 0.042 & 0.039 & {\bf 0.028}\\ & & 1.0 & 0.035 & {\bf 0.003} & 0.024 & & 0.020 & 0.017 & {\bf 0.016} & & 0.038 & 0.036 & {\bf 0.029}\\ & & 5.0 & 0.023 & {\bf 0.004} & 0.013 & & 0.012 & 0.010 & {\bf 0.010} & & 0.036 & 0.035 & {\bf 0.030}\\ & & 10.0 & 0.016 & {\bf 0.003} & 0.008 & & 0.007 & 0.007 & {\bf 0.007} & & 0.034 & 0.033 & {\bf 0.029}\\ & \multirow{4}{*}{ 0.7} & 0.5 & 0.067 & {\bf 0.002} & 0.048 & & 0.059 & 0.039 & {\bf 0.026} & & 0.042 & 0.039 & {\bf 0.028}\\ & & 1.0 & 0.035 & {\bf 0.003} & 0.024 & & 0.020 & 0.017 & {\bf 0.016} & & 0.038 & 0.036 & {\bf 0.029}\\ & & 5.0 & 0.023 & {\bf 0.004} & 0.013 & & 0.012 & 0.010 & {\bf 0.010} & & 0.036 & 0.035 & {\bf 0.030}\\ & & 10.0 & 0.016 & {\bf 0.003} & 0.008 & & 0.007 & 0.007 & {\bf 0.007} & & 0.034 & 0.033 & {\bf 0.029}\\ & \multirow{4}{*}{ 0.9} & 0.5 & 0.067 & {\bf 0.002} & 0.048 & & 0.059 & 0.039 & {\bf 0.026} & & 0.042 & 0.039 & {\bf 0.028}\\ & & 1.0 & 0.035 & {\bf 0.003} & 0.024 & & 0.020 & 0.017 & {\bf 0.016} & & 0.038 & 0.036 & {\bf 0.029}\\ & & 5.0 & 0.023 & {\bf 0.004} & 0.013 & & 0.012 & 0.010 & {\bf 0.010} & & 0.036 & 0.035 & {\bf 0.030}\\ & & 10.0 & 0.016 & {\bf 0.003} & 0.008 & & 0.007 & 0.007 & {\bf 0.007} & & 0.034 & 0.033 & {\bf 0.029}\\ \vspace{-2mm} \\ \cmidrule{2-14} \vspace{-2mm} \\ \multirow{16}{*}{40} & \multirow{4}{*}{ 0.3} & 0.5 & 0.047 & {\bf 0.002} & 0.035 & & 0.033 & 0.025 & {\bf 0.018} & & 0.029 & 0.028 & {\bf 0.021}\\ & & 1.0 & 0.025 & {\bf 0.002} & 0.017 & & 0.014 & 0.012 & {\bf 0.011} & & 0.027 & 0.026 & {\bf 0.022}\\ & & 5.0 & 0.017 & {\bf 0.003} & 0.009 & & 0.008 & 0.008 & {\bf 0.007} & & 0.027 & 0.026 & {\bf 0.023}\\ & & 10.0 & 0.014 & {\bf 0.004} & 0.008 & & 0.005 & 0.005 & {\bf 0.005} & & 0.026 & 0.026 & {\bf 0.023}\\ & \multirow{4}{*}{ 0.5} & 0.5 & 0.047 & {\bf 0.002} & 0.035 & & 0.033 & 0.025 & {\bf 0.018} & & 0.029 & 0.028 & {\bf 0.021}\\ & & 1.0 & 0.025 & {\bf 0.002} & 0.017 & & 0.014 & 0.012 & {\bf 0.011} & & 0.027 & 0.026 & {\bf 0.022}\\ & & 5.0 & 0.017 & {\bf 0.003} & 0.009 & & 0.008 & 0.008 & {\bf 0.007} & & 0.027 & 0.026 & {\bf 0.023}\\ & & 10.0 & 0.014 & {\bf 0.004} & 0.008 & & 0.005 & 0.005 & {\bf 0.005} & & 0.026 & 0.026 & {\bf 0.023}\\ & \multirow{4}{*}{ 0.7} & 0.5 & 0.047 & {\bf 0.002} & 0.035 & & 0.033 & 0.025 & {\bf 0.018} & & 0.029 & 0.028 & {\bf 0.021}\\ & & 1.0 & 0.025 & {\bf 0.002} & 0.017 & & 0.014 & 0.012 & {\bf 0.011} & & 0.027 & 0.026 & {\bf 0.022}\\ & & 5.0 & 0.017 & {\bf 0.003} & 0.009 & & 0.008 & 0.008 & {\bf 0.007} & & 0.027 & 0.026 & {\bf 0.023}\\ & & 10.0 & 0.014 & {\bf 0.004} & 0.008 & & 0.005 & 0.005 & {\bf 0.005} & & 0.026 & 0.026 & {\bf 0.023}\\ & \multirow{4}{*}{ 0.9} & 0.5 & 0.047 & {\bf 0.002} & 0.035 & & 0.033 & 0.025 & {\bf 0.018} & & 0.029 & 0.028 & {\bf 0.021}\\ & & 1.0 & 0.025 & {\bf 0.002} & 0.017 & & 0.014 & 0.012 & {\bf 0.011} & & 0.027 & 0.026 & {\bf 0.022}\\ & & 5.0 & 0.017 & {\bf 0.003} & 0.009 & & 0.008 & 0.008 & {\bf 0.007} & & 0.027 & 0.026 & {\bf 0.023}\\ & & 10.0 & 0.014 & {\bf 0.004} & 0.008 & & 0.005 & 0.005 & {\bf 0.005} & & 0.026 & 0.026 & {\bf 0.023}\\ \vspace{-3mm} \\ \bottomrule \vspace{+1mm} \end{tabular} \caption{Bias, mean squared error and Kullback--Leibler (KL) divergence for maximum likelihood (MLE), modified maximum likelihood (MMLE) and MML87 estimates of $k$ computed over $10^5$ simulations runs with $\lambda = 1$; $p$ denotes the proportion of uncensored observations. \label{tab:results:censored}} \end{center} \end{table*} \subsection{Model selection} Recall that the minimum message length principle unifies parameter estimation and model selection within the same framework. In this section, we demonstrate how MML can be used to infer whether observed data was generated by a Weibull distribution or by a lognormal distribution~\cite{SiswadiQuesenberry82,UpadhyayPeshwani03,KimYum08}. To use MML to discriminate between competing models, we need to compute the codelength of each model. For complete data with no censoring, the probability density function of the lognormal distribution with mean $\mu \in \mathbb{R}$ and standard deviation $\sigma > 0$ is \begin{equation} p(y | \mu, \sigma) = \frac{1}{\sqrt{2 \pi } \sigma y} \exp\left(-\frac{(\log (y)-\mu )^2}{2 \sigma ^2}\right) . \end{equation} The negative log-likelihood for data ${\bf y}$ is \begin{equation} \label{eqn:nll:logn:complete} -\log p_T({\bf y} | \mu, \sigma) = \frac{n}{2} \log (2\pi) + n \log \sigma + \sum_{i=1}^n \log y_i + \frac{1}{2\sigma^2} \sum_{i=1}^n (\log y_i - \mu)^2 . \end{equation} The determinant of the expected Fisher information for the lognormal model is well-known \begin{equation} \label{eqn:fisher:logn:complete} |J(\mu,\sigma)| = \frac{2 n^2}{\sigma ^4} . \end{equation} Similar to Section~\ref{sec:complete:mml}, we select heavy-tailed prior distributions for both parameters \begin{equation} \label{eqn:priors:logn} \pi(\mu,\sigma) = \pi(\mu) \pi(\sigma), \quad \pi(\mu) = \frac{1}{\pi (1 + \mu^2)}, \quad \pi(\sigma) = \frac{2}{\pi (1 + \sigma^2)}. \end{equation} Substituting (\ref{eqn:nll:logn:complete}), (\ref{eqn:fisher:logn:complete}) and (\ref{eqn:priors:logn}) into (\ref{eqn:mml87:codelength}) yields the MML87 codelength for the lognormal distribution. Due to this choice of prior distributions, the MML87 estimates of $\mu$ and $\sigma$ must be obtained numerically. To determine whether observed data follows the Weibull or the lognormal distribution, we compute the codelength of the data under each model and select the model with the smallest codelength. An experiment was setup to compare the MML87 model selection performance against the commonly used Bayesian information criterion (BIC)~\cite{Schwarz78} and the scale transformation maximal invariant statistic (SI)~\cite{QuesenberryKent82}. A comparison of BIC and SI on discriminating between the Weibull and lognormal models was examined in~\cite{KimYum08}. Similar to the experimental setup in~\cite{KimYum08}, we generated $n \in (10,25,50,100,200)$ data points from either the Weibull(1,1) or the Lognormal(1,1) model, as both BIC and SI are invariant under scale and shape transformations. Each method was then asked to select the best fitting model for the observed data and the experiment was repeated for $10^5$ iterations. The performance of each method was measured in terms of probability of correct selection and the results are shown in Table~\ref{tab:results:mdl:complete}. While all three methods tested performed similarly for medium to large sample sizes, the average accuracy of MML87 is significantly higher compared to BIC and SI under small sample sizes. Additionally, while the SI statistic tended to favour the lognormal distribution, no such preference was observed for MML or BIC. \begin{table*}[tb] \scriptsize \begin{center} \begin{tabular}{cccccccccccc} \toprule $n$ & \multicolumn{3}{c}{${\bf y} \sim$ Weibull} & & \multicolumn{3}{c}{${\bf y} \sim$ Lognormal} & & \multicolumn{3}{c}{Average accuracy}\\ & MML87 & BIC & SI & ~ & MML87 & BIC & SI & ~ & MML87 & BIC & SI \\ \cmidrule{1-12} 10 & {\bf 0.738} & 0.677 & 0.596 & & 0.714 & 0.663 & {\bf 0.742} & & {\bf 0.726} & 0.670 & 0.669\\ 25 & {\bf 0.838} & 0.807 & 0.783 & & 0.826 & 0.803 & {\bf 0.828} & & {\bf 0.832} & 0.805 & 0.806\\ 50 & {\bf 0.917} & 0.904 & 0.894 & & {\bf 0.913} & 0.904 & 0.913 & & {\bf 0.915} & 0.904 & 0.904\\ 100 & {\bf 0.975} & 0.972 & 0.970 & & {\bf 0.973} & 0.971 & 0.973 & & {\bf 0.974} & 0.971 & 0.971\\ 200 & {\bf 0.997} & 0.997 & 0.997 & & {\bf 0.998} & 0.997 & 0.998 & & {\bf 0.997} & 0.997 & 0.997\\ \vspace{-3mm} \\ \bottomrule \vspace{+1mm} \end{tabular} \caption{Probability of correctly selecting the data generating model for MML87, BIC and SI computed over $10^5$ simulation runs with complete data only. \label{tab:results:mdl:complete}} \end{center} \end{table*} We can of course use the MML principle to discriminate between the Weibull and lognormal distributions based on type I censored data. In this case, the negative log-likelihood function of the data is \begin{eqnarray} -\log p(D|\mu,\sigma) &=& d \log \sigma + \frac{d}{2} \log (2\pi) + \sum_{i=1}^n \delta_i \log(y_i) + \frac{1}{2\sigma^2} \sum_{i=1}^n \delta_i (\log(y_i) - \mu)^2 \nonumber \\ &&- (n-d)\log\left(1 - \Phi\left(\frac{\log(c) - \mu}{\sigma}\right)\right)~\label{eqn:nll:logn:typeI} \end{eqnarray} where $\Phi(\cdot)$ is cumulative density function of the standard normal distribution. Let \begin{eqnarray} z = \left(\frac{\log(c) - \mu}{\sigma}\right), \quad p = \Phi(z), \quad M = \Phi^{-1}(p), \end{eqnarray} where $z$ is the standardised censoring point and $\Phi^{-1}(\cdot)$ is the inverse cumulative density function of the standard normal distribution. The expected Fisher information matrix is \begin{equation*} J(\mu,\sigma) = \frac{n}{\sigma^2} \left( \begin{array}{cc} \frac{e^{-M^2}}{2 \pi (1 - p)}-\frac{e^{-\frac{M^2}{2}} M}{\sqrt{2 \pi }}+p & \frac{e^{-M^2} M}{2 \pi(1 - p)}-\frac{e^{-\frac{M^2}{2}} \left(M^2+1\right)}{\sqrt{2 \pi }} \\ \frac{e^{-M^2} M}{2 \pi (1 - p)}-\frac{e^{-\frac{M^2}{2}} \left(M^2+1\right)}{\sqrt{2 \pi }} & \frac{e^{-M^2} M^2}{2 \pi(1 -p)}-\frac{e^{-\frac{M^2}{2}} \left(M^3+M\right)}{\sqrt{2 \pi }}+2 p \\ \end{array} \right) \end{equation*} with determinant $|J(\mu,\sigma)|$ given by \begin{equation} \frac{2 n^2}{\sigma^4} \left[\frac{e^{-M^2} \left(M^2 (1-2 p)-3 p+1\right)}{4 \pi (p-1)}+\frac{e^{-\frac{1}{2} \left(3 M^2\right)} M}{4\sqrt{2} \pi ^{3/2} (1- p)}-\frac{e^{-\frac{M^2}{2}} M \left(M^2+3\right) p}{2\sqrt{2 \pi }}+ p^2\right]. \label{eqn:fisher:logn:typeI} \end{equation} which is equal to the determinant of the expected Fisher information matrix for complete data multiplied by a correction factor that takes into account the proportion of censoring. We use the same prior distributions for the parameters as in the case of complete data. The MML87 codelength for the lognormal distribution with type I censoring is obtained by substituting (\ref{eqn:nll:logn:typeI}), (\ref{eqn:fisher:logn:typeI}) and (\ref{eqn:priors:logn}) into (\ref{eqn:mml87:codelength}) yields. As with the case of complete data, the MML87 estimates of $\mu$ and $\sigma$ must be obtained by numerical optimisation. We repeated the same model selection experiment as performed with complete data but this time varied the proportion of censoring from $10\%$ to $75\%$, similar to~\cite{KimYum08}. The performance of each method was measured in terms of probability of correct selection and the results are shown in Table~\ref{tab:results:mdl:typeI}. As shown in~\cite{KimYum08}, BIC performs better than SI, with the latter always preferring the Weibull distribution for large amounts of data. In terms of model selection accuracy, it is clear that the proposed MML87 method is superior to both BIC and SI, especially with small sample sizes or large amounts of censoring. Lastly, we note that MML codelengths derived in this paper can also be used in more complex applications such as mixture models and decision trees; for example, we may use the Weibull distribution to model data in the terminal nodes of a tree or the attributes of a class in a finite mixture model. \begin{table*}[btp] \scriptsize \begin{center} \begin{tabular}{ccccccccccccccccc} \toprule $n$ & $p$ & \multicolumn{3}{c}{${\bf y} \sim \text{Weibull}$} & & \multicolumn{3}{c}{${\bf y} \sim \text{Lognormal}$} & & \multicolumn{3}{c}{Average accuracy} \\ & & MML87 & BIC & SI & ~ & MML87 & BIC & SI & ~ & MML87 & BIC & SI \\ \multirow{4}{*}{25} & 0.10 & {\bf 0.723} & 0.685 & 0.645 & & 0.853 & 0.828 & {\bf 0.854} & & {\bf 0.788} & 0.756 & 0.749\\ & 0.30 & {\bf 0.613} & 0.563 & 0.494 & & 0.842 & 0.808 & {\bf 0.856} & & {\bf 0.728} & 0.686 & 0.675\\ & 0.50 & {\bf 0.536} & 0.456 & 0.357 & & 0.833 & 0.795 & {\bf 0.866} & & {\bf 0.685} & 0.625 & 0.612\\ & 0.75 & {\bf 0.603} & 0.289 & 0.146 & & 0.768 & 0.818 & {\bf 0.928} & & {\bf 0.685} & 0.554 & 0.537\\ \vspace{-2mm} \\ \cmidrule{2-13} \vspace{-2mm} \\ \multirow{4}{*}{50} & 0.10 & {\bf 0.830} & 0.810 & 0.790 & & {\bf 0.911} & 0.897 & 0.910 & & {\bf 0.870} & 0.853 & 0.850\\ & 0.30 & {\bf 0.727} & 0.696 & 0.655 & & 0.875 & 0.852 & {\bf 0.880} & & {\bf 0.801} & 0.774 & 0.768\\ & 0.50 & {\bf 0.629} & 0.582 & 0.532 & & {\bf 0.844} & 0.810 & 0.841 & & {\bf 0.736} & 0.696 & 0.686\\ & 0.75 & {\bf 0.589} & 0.409 & 0.419 & & {\bf 0.822} & 0.785 & 0.744 & & {\bf 0.706} & 0.597 & 0.582\\ \vspace{-2mm} \\ \cmidrule{2-13} \vspace{-2mm} \\ \multirow{4}{*}{100} & 0.10 & {\bf 0.925} & 0.917 & 0.909 & & {\bf 0.963} & 0.958 & 0.963 & & {\bf 0.944} & 0.937 & 0.936\\ & 0.30 & {\bf 0.839} & 0.822 & 0.812 & & {\bf 0.919} & 0.907 & 0.914 & & {\bf 0.879} & 0.865 & 0.863\\ & 0.50 & 0.736 & 0.709 & {\bf 0.864} & & {\bf 0.876} & 0.854 & 0.521 & & {\bf 0.806} & 0.781 & 0.692\\ & 0.75 & 0.625 & 0.525 & {\bf 0.954} & & {\bf 0.837} & 0.787 & 0.061 & & {\bf 0.731} & 0.656 & 0.508\\ \vspace{-2mm} \\ \cmidrule{2-13} \vspace{-2mm} \\ \multirow{4}{*}{200} & 0.10 & {\bf 0.983} & 0.981 & 0.979 & & {\bf 0.992} & 0.991 & 0.992 & & {\bf 0.987} & 0.986 & 0.986\\ & 0.30 & 0.935 & 0.929 & {\bf 0.964} & & {\bf 0.968} & 0.964 & 0.896 & & {\bf 0.951} & 0.946 & 0.930\\ & 0.50 & 0.847 & 0.834 & {\bf 0.998} & & {\bf 0.922} & 0.910 & 0.024 & & {\bf 0.884} & 0.872 & 0.511\\ & 0.75 & 0.695 & 0.642 & {\bf 1.000} & & {\bf 0.854} & 0.815 & 0.000 & & {\bf 0.775} & 0.729 & 0.500\\ \bottomrule \vspace{+1mm} \end{tabular} \caption{Probability of correctly selecting the data generating model for MML87, BIC and SI computed over $10^5$ simulation runs with type I censored data. The probability of censoring ($p$) is given in the second column.\label{tab:results:mdl:typeI}} \end{center} \end{table*}
{'timestamp': '2022-09-30T02:08:39', 'yymm': '2209', 'arxiv_id': '2209.14587', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14587'}
arxiv
\section{Introduction} Dense prediction refers to the process of predicting the label for each point in a point cloud. It is widely known that dense prediction plays a pivotal role in 3D robotic perception and autonomy, enabling an array of tasks such as semantic segmentation, depth completion, and scene flow estimation. \begin{figure}[htbp] \centering \includegraphics[width=3.3in]{./figures/qua_scannet.pdf} \caption{In a dense prediction task, i.e., 3D semantic segmentation, we note the segmentation prediction (top), segmentation error (middle) and dense uncertainty map (bottom, estimated by \sysname+) of two scenes from ScanNet validation split. Incorrect predictions tend to have high uncertainties.} \label{fig_qua_scannet} \end{figure} UNet \cite{ronneberger2015u} based network has been the de-facto choice of today's point neural network architecture design for cloud dense prediction \cite{choy2019fully, ao2021spinnet, thomas2019kpconv}. In a UNet-like network, one can observe that the input and the output of two correspondingly linked layers have the same number of points, e.g., if the input point cloud is denoted by a $N \times 3$ tensor, then the output of its correspondingly linked layer is a $N \times D$ tensor. In this regard, the output can also be viewed as an embedding map, and a dense prediction network can then be decomposed as an embedding learning network and a task-specific regressor (or classifier). Therefore, the heart of the dense prediction task is embedding learning. Embedding learning aims to learn a discriminative embedding model that pulls samples of the same class closer and pushes those of different classes away from each other in the embedding space. Successful embedding learning empowers many downstream tasks, including image retrieval \cite{musgrave2020metric}, face recognition \cite{meng2021magface} and zero-shot learning \cite{bucher2016improving}. In addition to improving the embedding model's discriminative capability, quantifying its uncertainty is also attracting much attention. For dense prediction tasks of point clouds, it is desirable that an uncertainty level could be provided in conjunction with the point-wise labels to make its downstream decision-making more information-aware. Consider a scenario where an autonomous vehicle is predicting semantic labels of each point on the road, a prediction with an estimated uncertainty level would be helpful for the computer to decide when to trust its prediction and moreover, utilize the uncertainty to optimize the vehicle's planning and control. Such promising benefits have stimulated the development of various uncertainty estimation methods for different dense prediction tasks. In 3D semantic segmentation tasks, for example, the popular approaches include (1) using the output of the logit layer to calculate softmax entropy~\cite{czolbe2021segmentation}, (2) building a two-head network to predict the mean and variance of an embedding separately \cite{kendall2017uncertainties}, and (3) resorting to a BNN model and approximating posterior weights with MCD \cite{qi2021neighborhood}. However, two major issues remain in existing uncertainty estimation methods for dense prediction of 3D point clouds. First, points can only interact in the limited receptive field of convolution kernels, and they need a shared MLP to realize an implicit interaction among logits (see Fig. \ref{fig_pipeline2}.a). Such under-treatment of cross-point dependencies, unfortunately, often results in sub-optimal uncertainty estimation as evidenced by~\cite{monteiro2020stochastic}. Second, a notable trait of the predominant dense prediction networks is that they are sequential compositions of embedding learning networks and task-specific regressors (or classifiers). While prior arts have shown that enforcing embedding learning in regression or classification tasks can yield better predictive performance \cite{li2021learning,wang2021exploring}, it is largely under-explored if utilizing embedding learning can also give rise to better-calibrated uncertainty. In this paper, we propose a novel and generic uncertainty estimation pipeline, called \sysname\ in the paper for \textbf{C}ross-point embedding \textbf{U}ncertainty \textbf{E}stimation, to bridge the gap between the dense prediction of point clouds and its dense uncertainty quantification. \sysname\ involves building a probabilistic embedding model and enforcing metric alignments of massive points in the embedding space. In view of the aforementioned issues, \sysname\ identifies the importance of embedding learning, and exploits this embedding space via a diagonal multivariate Gaussian model amenable to cross-point interactions. Moreover, we propose \sysname+ that further utilizes cross-point dependencies by a low-rank multivariate Gaussian model. Low-rank covariance matrix in \sysname+ explicitly expresses off-diagonal elements' dependencies while maintaining computational efficiency. Specifically, our contributions are stated as follows: \begin{itemize} \item For the first time we propose a generic dense uncertainty estimation framework for dense prediction tasks of 3D point clouds. \item We propose a novel method that fully explores cross-point information for dense uncertainty estimation. \item We validate our proposed method on two representative dense prediction tasks, with the experimental results consistently showing that our method produces better-calibrated uncertainty than state-of-the-arts without losing any predictive performance. \item Source code of both \sysname\ and \sysname+ is available at: \url{https://github.com/ramdrop/cue}. \end{itemize} \section{Related Work} \begin{figure*}[htbp] \centering \includegraphics[width=6.6in]{./figures/pipeline2.pdf} \caption{An overview of a) traditional probabilistic prediction pipeline (e.g., aleatoric uncertainty \cite{kendall2017uncertainties}) and b) the proposed \sysname\ and \sysname+. We take semantic segmentation for instance where there are $5$ points in the input point cloud and $2$ classes in the labels. A traditional probabilistic prediction pipeline treats logits as distributions where logits can only interact implicitly through a shared MLP (Dashed triangle). In contrast, \sysname\ explores cross-point embeddings by building a probabilistic embedding model (Red curves) and enforcing metric alignments (Blue arrows), and \sysname+ goes further by replacing the diagonal covariance matrix with a low-rank covariance matrix. } \label{fig_pipeline2} \end{figure*} \subsection{Dense Prediction of 3D Point Cloud} With the dense nature of the 3D point cloud, we focus on its dense prediction tasks, e.g., 3D geometric feature learning and 3D semantic segmentation. \textit{3D Geometric Features Learning}: To find the correspondences in the absence of relative transformation information, a series of methods is to convert point clouds from the 3D Euclidean space to a feature space, where the correspondences are the nearest neighbors. Early work focus on hand-crafted features, such as SHOT \cite{salti2014shot} and FPFH \cite{rusu2009fast}, we kindly refer readers to \cite{guo2016comprehensive} for more details about hand-crafted features. Recently deep learned geometric features are becoming popular, which are generally based on volumetric and point-wise operations on point clouds: (1) Volumetric: 3DMatch \cite{zeng20173dmatch} learns patch descriptors by applying a 3D convolutional neural network on volumetric input. FCGF \cite{choy2019fully} directly applies 3D CNN to volumetric point clouds with the hardest contrastive loss, generating dense point features. (2) Point-wise: PointNet \cite{qi2017pointnet} uses multiple parallel shared MLP to learn global or dense features. DGCNN \cite{wang2019dynamic} combines point-wise MLP with dynamic graph neural networks, obtaining flexible and effective feature extractors for unordered point clouds. SpinNet \cite{ao2021spinnet} proposes a reference axis with a spherical voxelization to learn viewpoint-invariant point descriptors. Nevertheless, the above methods focus on improving predictive performance while ignoring the inherent uncertainty in massive points. \textit{3D Semantic Segmentation}: PointNet \cite{qi2017pointnet} is the very first work for 3D point cloud learning, and its shared-MLP architecture shows strong representation capability. However, the perturbation invariance of point clouds is obtained at the cost of ignorance of the local context. Following works propose different solutions to make for this limitation: PointNet++ \cite{qi2017pointnet++} adopts hierarchical sampling strategies, KPConv \cite{thomas2019kpconv} proposes a kernel-based MLP operation mimicking convolution, MinkowskiNet \cite{choy20194d} extends 2D convolution to 3D voxel and specifically design sparse operation python library for point clouds, and recently PointTransformer \cite{zhao2021point} shows the power of Transformer mechanisms in point cloud processing. \subsection{Dense Uncertainty Estimation} \textit{Embedding Learning Uncertainty}: Kendall \cite{kendall2017uncertainties} categorizes uncertainties in deep learning as two types: aleatoric uncertainty and epistemic uncertainty. Aleatoric uncertainty stems from data noises, while epistemic uncertainty refers to model uncertainty, which can be reduced with sufficient training data. Embedding learning is usually applied to image recognition tasks, where most methods focus on estimating aleatoric uncertainty: PFE \cite{shi2019probabilistic} models face embeddings as Gaussian distributions and uses the proposed Mutual Likelihood Score to measure the likelihood of two embeddings belonging to the same class. DUL \cite{chang2020data} proposes to learn aleatoric uncertainty for both regression and classification face recognition tasks. BTL \cite{warburg2021bayesian} proposes a Bayesian loss to learn aleatoric uncertainty in place recognition. RUL \cite{zhang2021relative} uses relative uncertainty measurements to learn aleatoric uncertainty. In the above image recognition tasks, a single feature is learned for a whole image. But in the dense prediction task of the point cloud, a single point cloud will involve learning thousands of features (i.e., equals to the number of points in the point cloud). Furthermore, image recognition is applied to regular-size images, while point clouds are totally unordered and varied-size. The massive features within a batch and irregular input size render it rather challenging to estimate dense uncertainty for a 3D point cloud. \textit{Semantic Segmentation Uncertainty}: Popular uncertainty estimation methods for semantic segmentation include softmax entropy \cite{czolbe2021segmentation} , Bayesian Neural Network (BNN) \cite{kendall2015bayesian}, learned aleatoric uncertainty \cite{kendall2017uncertainties} , auxiliary network \cite{zheng2021rectifying} and variance propagation based on Assumed Density Function (ADF) \cite{cortinhal2020salsanext}. Please refer to \cite{jungo2019assessing} for a thorough overview. However, these dominant approaches for semantic segmentation usually treat pixels or points as independent of each other (see Fig. \ref{fig_pipeline2}.a). Such ignorance of cross-pixel or cross-point dependencies tends to result in noisy uncertainty estimation \cite{monteiro2020stochastic}. Embedding learning has been explored in image segmentation: \cite{wang2021exploring} and \cite{tang2022contrastive} show contrastive learning optimizes embedding space and improve prediction performance in a semantic segmentation task, \cite{li2021learning} proves that optimized embeddings contribute to predictive performance. However, all the above methods exploit embedding learning for improving predictive performance, rather than estimating dense uncertainty. SSN \cite{monteiro2020stochastic} has used a low-rank multivariate Gaussian model to account for cross-pixel dependencies. But it is developed for logits, which does not involve embedding optimization. Our \sysname\ is based on a probabilistic embedding model and enforces metric alignments in the embedding space by using bayesian triplet loss. Bayesian triplet loss has been used in \cite{warburg2021bayesian} in image recognition. The major differences are: (1) the image recognition \cite{warburg2021bayesian} requires a single embedding for an image (i.e., whole pixels), while massive point-wise embeddings are desired in \sysname. Thus, we design additional sophisticated sampling strategies and efficient networks for unordered point clouds; and (2) the probabilistic embedding model of \cite{warburg2021bayesian} ignores the cross-point dependencies. Thus, we propose \sysname+ to alleviate this issue by a low-rank multivariate Gaussian model. \section{Method} \subsection{Preliminary} A dense prediction network maps a batch of points to a set of scalars. The process can be decomposed into a metric learning phase and a task-oriented regression or classification phase. Formally, given a point cloud $\boldsymbol{\mathcal{P}} \in \mathbb{R}^{N \times 3}$, the network $f_{\theta}$ first maps it to a set of embeddings $\boldsymbol{\mathcal{X}} \in \mathbb{R}^{N \times D}$, where $N$ is the number of points, and $D$ is the embedding dimension: \begin{equation} \rm metric \ \ learning:\ \boldsymbol{\mathcal{X}} = f_{\theta}(\boldsymbol{\mathcal{P}}) \end{equation} which is followed by a task-oriented regressor (or classifier) $f_{r}$ that generates predictions $\boldsymbol{\mathcal{Y}} \in \mathbb{R}^{N \times 1}$ (or $\boldsymbol{\mathcal{Y}} \in \mathbb{R}^{N \times C}$ where $C$ is the number of class ) for the set of embedding: \begin{equation} \rm regression \ or\ classification:\ \boldsymbol{\mathcal{Y}} = f_{r}(\boldsymbol{\mathcal{X}}) \end{equation} In the above formulation, predictions are regarded as deterministic, while the inherent noise from data is ignored. A probabilistic prediction model (e.g., probabilistic semantic segmentation~\cite{kendall2017uncertainties}) casts the prediction as a Gaussian distribution, which provides uncertainty level along with prediction (See Fig. \ref{fig_pipeline2}.a). But embeddings are still deterministic and equally weighted, which means each embedding will contribute equally to the regressor (or classifier). Inspired by probabilistic contrastive learning in face recognition \cite{shi2019probabilistic,chang2020data}, we adopt a probabilistic embedding model for a point cloud, where embeddings are represented by a diagonal multivariate Gaussian distribution: \begin{equation} \label{eq_distribution} \boldsymbol{\mathcal{X}} \sim \boldsymbol{\mathcal{N}}\left ( \boldsymbol{\mu}, \boldsymbol{\Lambda^2}\right ) \end{equation} where $\boldsymbol{\mu}=f_\mu(\boldsymbol{\mathcal{P}})\in \mathbb{R}^{N \times D}$ and $\boldsymbol{\Lambda^2}=f_\sigma(\boldsymbol{\mathcal{P}}) \in \mathbb{R}^{(N \times D) \times (N \times D)}$ is a diagonal matrix. $f_\mu$ and $f_\sigma$ represents the mean branch and variance branch of the network $f_\theta$. We will later propose a full-covariance multivariate Gaussian model and show its superiority in Sec. \ref{lrmg}. \subsection{Exploring Cross-point Embeddings} After building the probabilistic embedding model, we now discuss how to optimize the embedding space and derive the uncertainty. An overview of a traditional probabilistic prediction pipeline, the proposed \sysname\ and \sysname+ is presented in Fig. \ref{fig_pipeline2}. A traditional probabilistic prediction only allows logits to interact implicitly through a shared MLP, while \sysname\ explores cross-point embeddings by building a probabilistic embedding model and enforcing metric alignments, and \sysname+ goes further by replacing the diagonal covariance matrix with a low-rank covariance matrix. In what follows we will first describe \sysname\ that is based on the diagonal multivariate Gaussian model. Then an improved version \sysname+ will be introduced, which is based on the low-rank multivariate Gaussian model. \subsubsection{\sysname} Given a triplet $\{\boldsymbol{P_a},\boldsymbol{P_p}, \boldsymbol{P_n} \vert \boldsymbol{P_i} \in \mathbb{R}^{1 \times 3}, i=a, p, n\}$, their embeddings are obtained as $\{\boldsymbol{X_a},\boldsymbol{X_p}, \boldsymbol{X_n} \vert \boldsymbol{X_i} \in \boldsymbol{\mathcal{N}}(\boldsymbol{\mu}_i, \boldsymbol{\Sigma}_i^2), \boldsymbol{\mu}_i \in \mathbb{R}^{1 \times D}, \boldsymbol{\Sigma^2}_i \in \mathbb{R}^{1 \times D}, i=a, p, n\}$, where the subscripts $a, p, n$ denote an anchor, positive and negative sample, respectively. In the probabilistic setting, we are interested in the probability of the positive embedding being closer than the negative to the anchor: \begin{equation} \label{eq_bayesian_triplet} P(\Vert \boldsymbol{X}_a - \boldsymbol{X}_p \Vert - \Vert \boldsymbol{X}_a - \boldsymbol{X}_n \Vert + m < 0) \end{equation} Rewrite it as: \begin{equation} \label{eq_normal} P(\tau<-m) \end{equation} where the new distribution $\tau= \sum_d^D \boldsymbol{T} ^d=\sum_d^D (\boldsymbol{X}_a^d - \boldsymbol{X}_p^d)^2 - (\boldsymbol{X}_a^d - \boldsymbol{X}_n^d)^2$, and $d$ means $d^{th}$ dimension . According to central limit theorem, $\tau$ will approximate a normal distribution when $D$ is large, i.e.,$\frac{\tau - \mu_{\tau}}{\sigma_{\tau}} \thicksim \mathcal{N}(0, 1)$, where $\mu_\tau$ and $\sigma^2_\tau$ are the mean and the variance of the distribution $\tau$. Then Eq. \ref{eq_normal} is solved as: \begin{equation} P(\tau<-m) = \Phi_{\mathcal{N}(0, 1)} (\frac{-m - \mu_{\tau}}{\sigma_{\tau}}) \end{equation} where $\Phi$ is the Conditional Density Function (CDF). Now the task is converted to finding an analytical solution of $\mu_\tau$ and $\sigma_\tau$. The mean $\mathbb{E}^\prime [\tau]$ and variance $\mathbb{D}^\prime[\tau]$ of a single dimension is given as follows (the superscript $d$ at right-hand side is omitted for brevity): \begin{equation} \begin{aligned} \mathbb{E}[\boldsymbol{T}^d] &= \mu_{p}^{2}+\sigma_{p}^{2}-\mu_{n}^{2}-\sigma_{n}^{2}-2 \mu_{a}\left(\mu_{p}-\mu_{n}\right) \\ \mathbb{D}[\boldsymbol{T}^d] &= 2[\sigma_{p}^{4}+2 \mu_{p}^{2} \sigma_{p}^{2}+2\left(\sigma_{a}^{2}+\mu_{a}^{2}\right)\left(\sigma_{p}^{2}+\mu_{p}^{2}\right)- 2 \mu_{a}^{2} \mu_{p}^{2}\\&-4 \mu_{a} \mu_{p} \sigma_{p}^{2}] + 2[\sigma_{n}^{4}+2 \mu_{n}^{2} \sigma_{n}^{2}+2\left(\sigma_{a}^{2}+\mu_{a}^{2}\right)\left(\sigma_{n}^{2}+\mu_{n}^{2}\right)\\&-2 \mu_{a}^{2} \mu_{n}^{2}-4 \mu_{a} \mu_{n} \sigma_{n}^{2}] +4 \mu_{p} \mu_{n} \sigma_{a}^{2} \end{aligned} \end{equation} Since the embedding model is assumed to be isotropic, we arrive at: \begin{equation} \mu_\tau = \sum_d^D \mathbb{E}[\boldsymbol{T} ^d], \quad \sigma _\tau^2 = \sum_d^D \mathbb{D}[\boldsymbol{T} ^d] \end{equation} In summary, after the network generates a set of embeddings for a point cloud, we calculate the probability of the positive embedding being closer than the negative to the anchor, and the goal of training is to minimize the metric loss derived from Eq. \ref{eq_bayesian_triplet}: \begin{equation} \label{eq_metric_loss} L_{M} = -\frac{1}{T} \sum _{t=1}^T P(\Vert \boldsymbol{X}_{t,a} - \boldsymbol{X}_{t,p} \Vert - \Vert \boldsymbol{X}_{t,a} - \boldsymbol{X}_{t,n} \Vert + m < 0) \end{equation} where $T$ is the number of total triplets in a mini-batch. \subsubsection{\sysname+} \label{lrmg} \begin{figure}[t] \centering \includegraphics[width=3.3in]{./figures/network.pdf} \caption{The network architectures of \sysname\ and \sysname+: $\boldsymbol{\mathcal{P}}$ means a 3D point cloud, $\boldsymbol{\mu}$ embeddings' mean, $\boldsymbol{\Lambda}$ diagonal elements of embeddings' covariance matrix, $\boldsymbol{P}$ scale factor of embeddings' covariance matrix.} \label{fig_network} \end{figure} Points usually show spatial correlation with their neighbors. For example, points at the boundaries of an object usually exhibit high uncertainty since the points around the boundary have varied semantic labels. But \sysname\ fails to model point-wise dependencies because the diagonal covariance matrix of \sysname\ (see Eq. \ref{eq_distribution}) is based on the assumption that points are independent of each other. To solve this issue, we propose further capturing the point-wise dependencies by a full-covariance multivariate Gaussian model. Specifically, the diagonal covariance matrix in Eq. \ref{eq_distribution} is replaced with a full covariance matrix $\boldsymbol{\Sigma}^2 \in \mathbb{R}^{(N \times D) \times (N \times D)}$: \begin{equation} \boldsymbol{\mathcal{X}} \sim \boldsymbol{\mathcal{N}}\left ( \boldsymbol{\mu}, \boldsymbol{\Sigma^2}\right ) \end{equation} where $\boldsymbol{\mu} \in \mathbb{R}^{N \times D}$. However, the computational complexity of the full covariance matrix $\boldsymbol{\Sigma}^2$ scales with the square of $N$, and a point cloud usually consists of tens of thousands of points, i.e., $N>10^4$. This makes training networks difficult. To alleviate this issue, we resort to a low-rank parameterization of the covariance matrix \cite{magdon2010approximating}: \begin{equation} \boldsymbol{\Sigma}^2 = \boldsymbol{P}\boldsymbol{P}^T+\boldsymbol{\Lambda}^2 \end{equation} where the scale factor $\boldsymbol{P} \in \mathbb{R}^{(N\times D)\times K}$ and $K$ is the rank of the parameterization, $\boldsymbol{\Lambda}^2 \in \mathbb{R}^{(N\times D) \times (N\times D)}$ and $\boldsymbol{\Lambda}^2$ is a diagonal matrix. Therefore, we refer to the pipeline based on a low-rank covariance matrix as \sysname+. Compared with \sysname, \sysname+ learns parameters of additional elements other than diagonal elements of the covariance matrix. This makes the point-wise dependencies explicitly described by the learned variances. For ease of application, we choose $K=1$. Then the equivalent of the embedding $\boldsymbol{\mathcal{X}}$ is obtained as \begin{equation} \begin{aligned} \boldsymbol{\mathcal{X}} =& \boldsymbol{\mu} + \left(\boldsymbol{P} + \boldsymbol{\Lambda} \right ) \cdot \boldsymbol{\mathcal{N}}\left (\boldsymbol{0}, \boldsymbol{I} \right ) \\ \end{aligned} \end{equation} $L_M$ is then used to train the network. By experimental results we show that \sysname+ generates better-calibrated uncertainty than \sysname\ (see Sec. \ref{experiments}). The network architectures of the proposed \sysname\ and \sysname+ are shown in Fig. \ref{fig_network}, where $\boldsymbol{\mathcal{P}}$ means a 3D point cloud. The backbone encoder and decoder can be chosen from any UNet-like network. We add three branches to predict the mean $\boldsymbol{\mu}$, diagonal covariance matrix $\boldsymbol{\Lambda^2}$ and the scale factor $\boldsymbol{P}$. $\boldsymbol{\mu}$ branch ends with an L2-Normalization layer, while $\boldsymbol{\Lambda^2}$ and $\boldsymbol{P}$ branches with softplus layers. \section{Experimental Results} \label{experiments} \subsection{3D Geometric Feature Learning} While \sysname\ and \sysname+ are generic to dense prediction tasks, sampling strategies for triplets should be adapted according to different downstream tasks. Here, we present practical sampling strategies for two different tasks: 3D geometric feature learning and 3D semantic segmentation. \textit{3D geometric feature learning} aims to learn a discriminative mapping function represented by a deep neural network, such that raw points in the Euclidean space are mapped to the feature space. Ideally, points with similar geometric characteristics should be close to each other in the feature space. \cite{choy2019fully} studies different sampling strategies, including hardest-triplet sampling and random triplet sampling, where triplet loss is adopted. We follow their sampling methods but adapt their conventional triplet loss to our metric loss $L_M$. Specifically, given point clouds $\boldsymbol{\mathcal{P}}_i$ and $\boldsymbol{\mathcal{P}}_j$ and the relative transformation $\boldsymbol{\mathcal{T}}$, we first sample anchor embeddings $\boldsymbol{X}_{i,a}$ and $\boldsymbol{X}_{j,a}$. Then, we randomly choose its positives $\boldsymbol{X}_{i,p}$, $\boldsymbol{X}_{j,p}$ and negatives $\boldsymbol{X}_{i,n}$, $\boldsymbol{X}_{j,n}$. Finally, we calculate the metric loss $L_M$ of the triplets $\{\boldsymbol{X}_{i,a}, \boldsymbol{X}_{i,p}, \boldsymbol{X}_{i,n}\}$ and $\{ \boldsymbol{X}_{j,a}, \boldsymbol{X}_{j,p}, \boldsymbol{X}_{j,n}\}$ for training. \begin{figure}[t] \centering \includegraphics[width=3in]{./figures/ece_fcgf.pdf} \caption{Reliability diagram on the 3D Match Benchmark. \sysname\ and \sysname+ are closer to the ideally-calibrated line than others.} \label{fig_ece_fcgf} \end{figure} \begin{table} \centering \label{table_fcgf} \caption{Predictive performance and uncertainty quality on the 3D Match Benchmark. } \begin{tabular}{l|c|c} \hline Method & FMR@0.05 ↑ & ECE ↓ \\ \hline FPFH$^*$\cite{rusu2009fast} & 36.4 & \textbackslash{} \\ PerfectMatch$^*$\cite{gojcic2019perfect} & 94.9 & \textbackslash{} \\ FCGF$^*$\cite{choy2019fully} & 95.3 & \textbackslash{} \\ SpinNet\cite{ao2021spinnet} & 97.5 & \textbackslash{} \\ FCGF\cite{choy2019fully} & 97.5 & \textbackslash{} \\ \hline FCGF+RG & 97.5 & 0.251 \\ FCGF+MCD & 94.1 & 0.344 \\ \rowcolor[rgb]{1,0.949,0.8} FCGF+\sysname & 97.5 & 0.142 \\ \rowcolor[rgb]{1,0.949,0.8} FCGF+\sysname+ & 97.6 & 0.135 \\ \hline \end{tabular} \begin{tablenotes} \footnotesize \item[1] $^*$ denotes predicting correspondences without a symmetric test \cite{horache20213d}. \end{tablenotes} \end{table} \begin{figure}[htbp] \centering \includegraphics[width=3.3in]{./figures/qua_fcgf.pdf} \caption{Matching results and dense uncertainty map (estimated by \sysname+) of a point cloud from 3D Match Benchmark. Incorrect correspondences ($1$ and $2$ areas) tend to have high uncertainties. } \label{fig_qua_fcgf} \end{figure} \noindent \textbf{Datasets.} We use the 3D Match dataset \cite{zeng20173dmatch}, following the official training and evaluation splits. \noindent \textbf{Model Architectures.} FCGF is the first 3D convolutional network to integrate metric learning in a fully-convolutional setting. We choose FCGF \cite{choy2019fully} as our backbone because it holds state-of-the-art predictive performance with fast training and inferencing. To empower the deterministic FCGF to estimate the uncertainty of each point, we integrate it with our proposed \sysname\ and \sysname+ as is shown in Fig. \ref{fig_network}. \noindent \textbf{Training Details.} We train FCGF following the original paper \cite{choy2019fully}, i.e., Hardest-contrastive loss, $100$ epoches with SGD optimizer and batch size $4$, learning rate starts from $0.1$ with exponetial decay rate $0.99$, dada augmentation includes random scaling $\in [0.8, 1.2]$ and random rotation $\in [0 ^\circ , 360^\circ)$. \noindent \textbf{Competing Methods.} \begin{itemize} \item RG: After training the FCGF, we randomly form ten bins of points and then calculate ECE. \item MCD: We insert dropout layers with dropout rate $p=0.1$ after every convolutional layer. We take $N=40$ samples from the weights' posterior distribution at test time. \item \sysname: To assure original predictive performance, we freeze the $\boldsymbol{\mu}$ branch and train $\boldsymbol{\Lambda^2}$ branches with the metric loss $L_M$. \item \sysname+: We freeze the $\boldsymbol{\mu}$ branch, and train $\boldsymbol{\Lambda^2}$ and $\boldsymbol{P}$ branches with the metric loss $L_M$. \end{itemize} Note that MCD produces epistemic uncertainty, while our methods generate aleatoric uncertainty. We include it here for a comprehensive comparison. \noindent \textbf{Evaluation Metrics.} To evaluate the predictive performance, we use Feature Matching Recall with $0.1m$ inlier distance threshold and $0.05$ inlier recall threshold (FMR@0.05) \cite{choy2019fully}. We adopt the widely used Expected Calibrated Error (ECE) \cite{warburg2021bayesian} and the reliability diagram \cite{warburg2021bayesian} to evaluate uncertainty quality, where we calculate the Hit Ratio \cite{choy2019fully} of points in the same bin. \noindent \textbf{Results.} We evaluate the above methods on the 3D Match Benchmark \cite{zeng20173dmatch}. We establish correspondences by the nearest neighbor search in the embedding space, where each correspondence has an estimated uncertainty.\footnote[1]{We follow the covariance formulation in \cite{warburg2021bayesian} and use the sum of two points' uncertainty as the correspondence's uncertainty.} Table. \ref{table_fcgf} shows the predictive performance and uncertainty quality of different methods on the 3DMatch dataset. MCD shows degraded predictive performance due to the dropout layers significantly harming the network's representation ability. Since the $\boldsymbol{\mu}$ branch is inherited from the backbone network, \sysname\ and \sysname+ do not sacrifice any predictive accuracy. Compared with MCD, \sysname\ reduces ECE by $0.202$. Besides, \sysname+ outperforms \sysname\ with ECE $0.135$. Fig. \ref{fig_ece_fcgf} illustrates the reliability diagram on the 3D Match Benchmark. The ideal line means points with higher uncertainty levels should have lower hit ratios. RG produces a horizontal line, while MCD fails to produce a sensible estimation. \sysname\ and \sysname+ present closer lines to the ideal line. Fig. \ref{fig_qua_fcgf} shows the matching results and dense uncertainty map estimated by \sysname+ of a point cloud. We can observe that incorrect correspondences ($1$ and $2$ areas) tend to have high uncertainties. In summary, the proposed \sysname\ and \sysname+ provide well-calibrated uncertainty that can be used as an effective tool to filter incorrect correspondence. \subsection{3D Semantic Segmentation} \begin{figure}[t] \centering \includegraphics[width=3in]{./figures/ece_scannet.pdf} \caption{Reliability diagram on the ScanNet validation split. \sysname\ and \sysname+ are closer to the ideal calibrated line than other methods.} \label{fig_ece_scannet} \end{figure} \textit{3D semantic segmentaion} aims to learn a classification network that predicts class labels for each point in a point cloud. To optimize the embedding space by enforcing metric alignments, we first randomly sample anchors from a point cloud $\boldsymbol{\mathcal{P}}$, and then, within the neighbors of each anchor $\boldsymbol{X}_{a}$, choose embeddings with the same class label as positives $\boldsymbol{X}_{p}$, and those with different class label as negatives $\boldsymbol{X}_{n}$. Finally, we calculate the metric loss $L_M$ of the triplet $\{ \boldsymbol{X}_{a}, \boldsymbol{X}_{p}, \boldsymbol{X}_{n}\}$ for training. \noindent \textbf{Datasets.} Following \cite{park2022fast}, we use the ScanNet dataset \cite{dai2017scannet} and evaluate models on the ScanNet validation split. \noindent \textbf{Model Architectures.} Considering inference latency and accuracy, we choose MinkowskiNet42 (Mink) \cite{choy20194d, park2022fast} as our 3D semantic segmentation backbone. The semantic segmentation network is the same as that in Fig. \ref{fig_network}, except that we add a convolution layer as the segmentation classfier before the L2-Normalization layer of the $\boldsymbol{\mu}$ branch. \begin{table} \centering \label{table_scannet} \caption{Predictive performance and uncertainty quality on the ScanNet validation split. } \begin{tabular}{l|l|c|c} \hline & Method & mIOU ↑ & ECE ↓ \\ \hline \multirow{5}{*}{\begin{tabular}[c]{@{}c@{}}Training \\without \\uncertainty\end{tabular}} & PointNet\cite{qi2017pointnet} & 0.535 & \textbackslash{} \\ & PointConv\cite{wu2019pointconv} & 0.610 & \textbackslash{} \\ & KPConv deform \cite{thomas2019kpconv} & 0.692 & \textbackslash{} \\ & SparseConvNet\cite{graham20183d} & 0.693 & \textbackslash{} \\ & Mink\cite{choy20194d} & 0.715 & \textbackslash{} \\ & Mink+SE\cite{jungo2019assessing} & 0.715 & 0.251 \\ \hline \multirow{4}{*}{\begin{tabular}[c]{@{}c@{}}Training \\with \\uncertainty\end{tabular}} & Mink+AU\cite{kendall2017uncertainties} & 0.717 & 0.254 \\ & Mink+MCD(p=0.2) & 0.658 & 0.176 \\ & Mink+MCD(p=0.05) & 0.663 & 0.170 \\ & {\cellcolor[rgb]{1,0.949,0.8}}Mink+\sysname\ & {\cellcolor[rgb]{1,0.949,0.8}}0.721 & {\cellcolor[rgb]{1,0.949,0.8}}0.142 \\ & {\cellcolor[rgb]{1,0.949,0.8}}Mink+\sysname+ & {\cellcolor[rgb]{1,0.949,0.8}}0.727 & {\cellcolor[rgb]{1,0.949,0.8}}0.141 \\ \hline \end{tabular} \end{table} \begin{figure}[htbp] \centering \includegraphics[width=3.3in]{./figures/qua_compare.pdf} \caption{Segmentation errors (left column) and dense uncertainty maps (right column) on a scene from ScanNet validation split. \sysname\ and \sysname+ produce better-calibrated dense uncertainty maps than others. For correct predictions (rectangular area $1$), \sysname\ is under-confident while \sysname+ is more confident than \sysname.} \label{fig_qua_compare} \end{figure} \noindent \textbf{Training Details.} We train the model for $10^5$ steps with an SGD optimizer, learning rate starting from $0.1$ with a cosine annealing schedule and a linear warmup. We use a batch size of $8$. For more training details, we kindly refer readers to \cite{park2022fast}. \noindent \textbf{Competing Methods.} We compare \sysname\ and \sysname+ with the following popular uncertainty estimation methods from image segmentation: \begin{itemize} \item Softmax Entropy \cite{jungo2019assessing} (SE): \begin{equation} H = -\sum_c^Cp_c\log(p_c)/log(C) \in [0,1] \end{equation} where $C$ is the number of classes, $p_c$ is a probability by the softmax layer. \item Aleatoric Uncertainty \cite{kendall2017uncertainties, jungo2019assessing} (AU): Logits are modeled as Gaussian distribution, whose mean and variance are predicted by two heads of the network. We use MC sampling ($n=10$ ) to draw samples from the logits distribution and optimize the network with Cross Entropy Loss. \item MCD \cite{jungo2019assessing}: MCD estimates epistemic uncertainty because dropout at test time approximates random sampling of the model's weights. Test time inference is obtained by $ p_c = \frac{1}{N}\sum_n^Np_{n,c} $, where $p_c$ denotes the output of the Softmax layer. We set the number of MC samples $N=40$ as suggested by \cite{kendall2016modelling}. We evaluate MCD with two dropout probability settings: $p=0.2$ and $p=0.05$. Aleatoric uncertainty and MCD uncertainty generates high-dimensional variance vectors, which are converted to uncertainty levels by $y(1-0.5q)+(1-y)(0.5q)$, where $q\in[0,1]$ is the normalized variance\cite{jungo2019assessing}. \item \sysname\ / \sysname+: We train the \sysname\ / \sysname+ network from scratch with a weighted sum of cross entropy loss and the metric loss $L = L_{CR} + \lambda L_M$, where we set $\lambda=1$ for all experiments. \end{itemize} \noindent \textbf{Evaluation Metrics.} We use the mean IOU (mIOU) to evaluate the predictive performance. mIOU refers to the ratio of the intersection of ground-truth labels and predicted labels to their union, and a higher mIOU indicates better performance. The reliability diagram \cite{warburg2021bayesian} and ECE \cite{warburg2021bayesian} are adopted to evaluate uncertainty quality, where we calculate the precision of points in each bin. \noindent \textbf{Results.} Table. \ref{table_scannet} presents the predictive performance and uncertainty quality on the ScanNet validation split. In terms of predictive performance, we observe that AU, \sysname\ produce comparable results to Mink, while MCD shows degraded performance due to dropout layers decreasing representative power. \sysname+ promotes the Mink's predictive power with $0.13$ boost in mIOU. From the perspective of uncertainty quality, SE achieves a $0.251$ ECE, outperformed by MCD (p=0.05) with a $0.170$ ECE, while \sysname\ and \sysname+ provide significantly improved uncertainty with ECE $0.142$ and $0.141$, i.e., \sysname+ reduces ECE of SE by $43.8\%$. Fig. \ref{fig_ece_scannet} shows the reliability diagram on the ScanNet validation split. It can be seen that \sysname\ is close to the ideal calibrated line, while \sysname+ improves \sysname\ in the low-uncertainty region. Fig. \ref{fig_qua_scannet} presents the qualitative results of \sysname+, where we can observe a significant correlation between segmentation prediction error and estimated uncertainty, i.e., Incorrect predictions tend to have high uncertainties. Fig. \ref{fig_qua_compare} presents segmentation errors and dense uncertainty maps by different methods on the ScanNet validation split. For incorrect predictions (black points in the magnified area), we can observe that SE fails to detect them and shows high confidence, while \sysname\ and \sysname+ are uncertain about those incorrect predictions. AU is under-confident in most areas, while MCD (p=0.05) cannot produce sensible results. For correct predictions (Rectangular area $1$), \sysname\ is under-confident while \sysname+ is more confident than \sysname. The above results indicate that \sysname\ and \sysname+ provide better-calibrated uncertainty than existing methods without compromising any predictive performance. \sysname+ outperforms \sysname\ in both predictive performance and uncertainty quality. This shows that embedding learning contributes to uncertainty estimation of dense prediction tasks and low-rank multivariate Gaussian model is more effective than a diagonal one. \section{Conclusion} \label{conclusion} Observing the fact that dense prediction networks are sequential compositions of embedding learning networks and task-specific regressors (or classifiers), we propose \sysname\ that estimates dense uncertainty by building a probabilistic embedding model and enforcing metric alignments with a diagonal multivariate Gaussian model. Besides, we propose \sysname+ that further enhances cross-point interactions with a low-rank multivariate Gaussian model, which explicitly expresses off-diagonal elements' dependencies while maintaining computational efficiency. Experimental results on the 3D Match Benchmark and the ScanNet dataset prove that \sysname\ and \sysname+ are generic and effective tools for 3D dense uncertainty estimation.
{'timestamp': '2022-09-30T02:09:07', 'yymm': '2209', 'arxiv_id': '2209.14602', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14602'}
arxiv
\section{Introduction} Distributional reinforcement learning~\citep{bellemare2017distributional, dabney2017distributional, dabney2018implicit, yang2019fully, zhou2020non, nguyen2020distributional,luo2021distributional, sun2022distributional} characterizes the intrinsic randomness of returns within the framework of Reinforcement Learning~(RL). When the agent interacts with the environment, the intrinsic uncertainty of the environment seeps in the the stochasticity of rewards the agent receives and the inherently chaotic state and action dynamics of physical interaction, increasing the difficulty of the RL algorithm design. Distributional RL is aimed at representing the entire distribution of returns in order to capture more intrinsic uncertainty of the environment, and therefore to use these value distributions to evaluate and optimize the policy. This is in stark contrast to the classical RL that only focuses on the expectation of the return distributions, such as temporal-difference~(TD) learning~\citep{sutton2018reinforcement} and Q-learning~\citep{watkins1992q}. As a promising branch of RL algorithms, distributional RL has demonstrated the state-of-the-art performance in a wide range of environments, e.g., Atari games, in which the representation of return distributions and the distribution divergence between the current and target return distributions within each Bellman update are pivotal to its empirical success~\citep{dabney2018implicit, sun2021interpreting, sun2022distributional}. Specifically, categorical distributional RL, e.g., C51~\citep{bellemare2017distributional, rowland2018analysis}, integrates a categorical distribution by approximating the density probabilities in pre-specified bins with a bounded range and Kullback-Leibler~(KL) divergence, serving as the first successful distributional RL family in recent years. Quantile Regression~(QR) distributional RL, e.g., QR-DQN~\citep{dabney2017distributional}, approximates Wasserstein distance by the quantile regression loss and leverages quantiles to represent the whole return distribution. Other variants of QR-DQN, including Implicit Quantile Networks~(IQN)~\citep{dabney2018implicit} and Fully parameterized Quantile Function~(FQF)~\citep{yang2019fully}, can even achieve significantly better performance across plenty of Atari games. Moment Matching distributional RL~\citep{nguyen2020distributional} learns deterministic samples to evaluate the distribution distance based on Maximum Mean Discrepancy, while a more recent work called Sinkhorn distributional RL~\citep{sun2022distributional} interpolates Maximum Mean Discrepancy and Wasserstein distance via Sinkhorn divergence~\citep{sinkhorn1967diagonal}. Meanwhile, distributional RL also inherits other benefits in risk-sensitive control~\citep{dabney2018implicit}, policy exploration settings~\citep{mavrin2019distributional, rowland2019statistics} and robustness~\citep{sun2021exploring}. Despite the remarkable empirical success of distributional RL, the illumination on its theoretical advantages is still less studied. A distributional regularization effect~\citep{sun2021interpreting} stemming from the additional value distribution knowledge has been characterized to explain the superiority of distributional RL over classical RL, but the benefit of the proposed regularization on the optimization of algorithms has not been investigated as the optimization plays a key role in RL algorithms. In the literature of strategies that can help the learning in RL, a recent progress mainly focuses on the policy gradient methods~\citep{sutton2018reinforcement}. \cite{mei2020global} show that the policy gradient with a softmax parameterization converges at a $\mathcal{O}(1/t)$ rate, with constants depending on the problem and initialization, which significantly expands the existing asymptotic convergence results. Entropy regularization~\citep{haarnoja2017reinforcement,haarnoja2018soft} has gained increasing attention as it can significantly speed up the policy optimization with a faster linear convergence rate~\citep{mei2020global}. \cite{ahmed2019understanding} provide a fine-grained understanding on the impact of entropy on policy optimization, and emphasize that any strategy, such as entropy regularization, can only affect learning in one of two ways: either it reduces the noise in the gradient estimates or it changes the optimization landscape. These commonly-used strategies that accelerate RL learning inspire us to further investigate the optimization impact of distributional RL arising from the exploitation of return distributions. In this paper, we study the theoretical superiority of distributional RL over classical RL from the optimization standpoint. We begin by analyzing the optimization impact of different strategies within the Neural Fitted Z-Iteration~(Neural FZI) framework and point out two crucial factors that contribute to the optimization of distributional RL, including the distribution divergence and the distribution parameterization error. The smoothness property of distributional RL loss function has also be revealed leveraging the categorical parameterization, yielding its stable optimization behavior. The uniform stability in the optimization process can thus be more easily achieved for distributional RL in contrast to classical RL. In addition to the optimization stability, we also elaborate the acceleration effect of distributional RL algorithms based on the value distribution decomposition technique proposed recently. It turns out that distributional RL can be shown to speed up the convergence and perform favorably if the value distribution is approximated appropriately, which is measured by the variance of gradient estimates. Empirical results collaborate that distributional RL indeed enjoys a stable gradient behavior by observing smaller gradient norms in terms of the observations the agent encounters in the learning process. Besides, the variance reduction of gradient estimates for distributional RL algorithms with respect to network parameters also provides strong evidence to demonstrate the smoothness property and acceleration effects of distributional RL. Our study opens up many exciting research pathways in this domain through the lens of optimization, paving the way for future investigations to reveal more advantages of distributional RL. \section{Preliminary Knowledge}\label{sec:preliminary} \paragraph{Classical RL.} In a standard RL setting, the interaction between an agent and the environment is modeled as a Markov Decision Process~(MDP) ($\mathcal{S}, \mathcal{A}, R, P, \gamma$), where $\mathcal{S}$ and $\mathcal{A}$ denote state and action spaces. $P$ is the transition kernel dynamics, $R$ is the reward measure and $\gamma \in (0,1)$ is the discount factor. For a fixed policy $\pi$, the return, $Z^{\pi}=\sum_{t=0}^{\infty} \gamma^t R_t$, is a random variable representing the sum of discounted rewards observed along one trajectory of states while following the policy $\pi$. Classical RL focuses on the value function and action-value function, the expectation of returns $Z^{\pi}$. The action-value function $Q^\pi(s, a)$ is defined as $Q^{\pi}(s, a)=\mathbb{E}\left[Z^{\pi}(s, a)\right]=\mathbb{E}\left[\sum_{t=0}^{\infty} \gamma^t R\left(s_t, a_t\right) \right]$, where $s_0=s$, $a_0=a$, $s_{t+1}\sim P(\cdot|s_t, a_t)$, and $a_t \sim \pi(\cdot|s_t)$. \paragraph{Distributional RL.} Distributional RL, on the other hand, focuses on the action-value distribution, the full distribution of $Z^{\pi}(s, a)$ rather than only its expectation, i.e., $Q^\pi(s, a)$. Leveraging knowledge on the entire value distribution can better capture the uncertainty of returns and thus can be advantageous to explore the intrinsic uncertainty of the environment~\citep{dabney2018implicit,mavrin2019distributional}. The scalar-based classical Bellman updated is therefore extended to distributional Bellman update, which allows a flurry of distributional RL algorithms, mainly including Categorical distributional RL~\citep{bellemare2017distributional} and Quantie Regression Distributional RL~\citep{dabney2017distributional,dabney2018implicit}. \paragraph{Categorical Distributional RL.} As the first successful distributional RL family, Categorical distributional RL~\citep{bellemare2017distributional} approximates the action-value distribution $\eta$ by a categorical distribution $\hat{\eta}=\sum_{i=1}^{k}f_i \delta_{l_i}$ where $l_1, l_2, ..., l_k$ is a set of fixed supports and $\{f_i\}_{i=1}^k$ are learnable probabilities, normally parameterized by a neural network. A projection is also introduced to have the joint support with a newly distributed target probabilities, equipped by a KL divergence to compute the distribution distance between the current and target value distribution within each Bellman update. In practice, C51~\citep{bellemare2017distributional}, an instance of Categorical Distributional RL with $k=51$, performs favorably on a wide range of environments. \paragraph{Quantile Regression~(QR) Distributional RL.} QR Distributional RL~\citep{dabney2017distributional,dabney2018implicit} approximates the value distribution $\eta$ by a mixture of Dirac $\hat{\eta}=\frac{1}{N}\sum_{i=1}^{N}\delta_{\tau_i}$, where $\tau_i=F^{-1}_\eta(\frac{2i-1}{2N})$ are the learnable quantile values at the fixed quantiles $\{\frac{2i-1}{2N}\}$ and $F^{-1}$ is the inverse cumulative distribution function of $\eta$. Since the quantile regression loss proposed in QR distributional RL can be used to approximate the Wasserstein distance, it gains favorable performance on Atari games. Moreover, the performance has been further improved by a series of variants based on quantile regression loss~\citep{dabney2018implicit,yang2019fully,zhou2020non}. For example, Implicit Quantile Network~(IQN)~\citep{dabney2018implicit} utilizes a continuous mapping for the quantile function $F^{-1}_\eta(\frac{2i-1}{2N})$ rather than a fixed set of quantiles, which expands the expressiveness power of function approximators to represent the value distribution. \section{Optimization Effect of Distributional RL}\label{sec:optimization} We consider the function approximation setting to analyze the optimization benefit of distributional RL. In Section~\ref{sec:neuralFZI}, we begin by showing the different roles of components in distributional RL on the entire optimization of RL algorithms within the Neural FZI framework. Further, in Section~\ref{sec:stability} we reveal the desirable smoothness properties of distributional RL loss function as opposed to classical RL, contributing to the stable optimization. Finally, the acceleration effect of distributional RL stemming from the additional value distribution is analyzed in Section~\ref{sec:acceleration}, which is characterized by the variance of gradient estimates. \subsection{How to Optimize Neural Fitted Z-Iteration for Distributional RL?}\label{sec:neuralFZI} In classical RL, \textit{Neural Fitted Q-Iteration}~(Neural FQI)~\citep{fan2020theoretical,riedmiller2005neural} provides a statistical interpretation of DQN~\citep{mnih2015human} while capturing its two key features, i.e., the leverage of target network and the experience replay: \begin{equation}\begin{aligned}\label{eq:Neural_Q_fitting} Q_\theta^{k+1}=\underset{Q_{\theta}}{\operatorname{argmin}} \frac{1}{n} \sum_{i=1}^{n}\left[y_{i}-Q_\theta^k\left(s_{i}, a_{i}\right)\right]^{2}, \end{aligned}\end{equation} where the target $y_{i}=r(s_i, a_i)+\gamma \max _{a \in \mathcal{A}} Q^k_{\theta^*} \left(s_{i}^{\prime}, a\right)$ is fixed within every $T_{\text{target}}$ steps to update target network $Q_{\theta^*}$ by letting $\theta^*=\theta$. The experience buffer induces independent samples $\left\{\left(s_{i}, a_{i}, r_{i}, s_{i}^{\prime}\right)\right\}_{i \in[n]}$ and ideally without the optimization and TD approximation errors, Neural FQI is exactly the updating under Bellman optimality operator~\citep{fan2020theoretical}. Similarly, in distributional RL, \cite{sun2021interpreting,ma2021conservative} proposed \textit{Neural Fitted Z-Iteration}~(Neural FZI), a distributional version of Neural FQI based on the parameterization of $Z_\theta$: \begin{equation} \begin{aligned}\label{eq:Neural_Z_fitting} Z_\theta^{k+1}=\underset{Z_{\theta}}{\operatorname{argmin}} \frac{1}{n} \sum_{i=1}^{n} d_p (Y_{i}, Z_\theta^k\left(s_{i}, a_{i}\right)), \end{aligned} \end{equation} where the target $Y_{i}=R(s_i, a_i)+\gamma Z^k_{\theta^*} \left(s_{i}^{\prime}, \pi_Z(s_i^\prime)\right)$ is a random variable, whose distribution is also fixed within every $T_{\text{target}}$ steps. The target follows a greedy policy rule, where $\pi_Z(s^\prime_i)= \operatorname{argmax}_{a^\prime} \mathbb{E}\left[Z_{\theta^*}^{k}(s_i^\prime, a^\prime)\right]$ and $d_p$ is the choice of distribution distance. Within the Neural FZI process, we can easily perceive that there are mainly two crucial components that determine the comprehensive optimization of distributional RL algorithms. \begin{itemize} \item \textbf{The choice of $d_p$}. $d_p$ in fact has two-fold impacts on the optimization of the whole Neural FZI. Firstly, $d_p$ determines the convergence rate of distributional Bellman update. For instance, distributional Bellman operator under Crámer distance is $\gamma^{\frac{1}{2}}$-contractive, and is a $\gamma$-contraction when $d_p$ is Wasserstein distance. Apart from the impact on the distributional Bellman update speed, $d_p$ also largely affects the continuous optimization problem to estimate parameter $\theta$ in $Z_\theta$ within each iteration of Neural FZI, including the convergence speed and the bad or good local minima issues. \item \textbf{The parameterization manner of $Z_\theta$}. The distribution representation way of $d_p$ plays an integral part of the optimization for deep RL algorithms. For example, with more expressiveness power on quantile functions, IQN outperforms QR-DQN on a wider range of Atari games, which is intuitive as a more informative representation way can approximate the true value distribution more reasonably. A smaller value distribution parameteriation error is also potential to help the optimization albeit in an indirect avenue. \end{itemize} Owing to the fact that convergence rates of distributional Bellman update under typical $d_p$ are basically known, our optimization analysis mainly focuses on the impact of $d_p$ and the paramterization error of $Z_\theta$ on the continuous optimization within Neural FZI of distributional RL by comparing Neural FQI of classical RL. In Sections~\ref{sec:stability} and \ref{sec:acceleration}, we attribute the optimization benefits of distributional RL to its distribution objective function, consisting of the aforementioned two factors, as opposed to the vanilla least squared loss in classical RL. \subsection{Stable Optimization Analysis based on Categorical Parameterization}\label{sec:stability} To allow for a theoretical analysis, we resort to the categorical parameterization equipped with KL divergence in categorical distributional RL~\citep{bellemare2017distributional}, e.g., C51, in order to investigate the stable optimization properties within each iteration in Neural FZI. Concretely, we assume $Z_\theta$ is absolutely continuous and the current and target value distributions under KL divergence within a bounded range have joint supports~\citep{arjovsky2017towards}, under which the KL divergence is well-defined. Note that this analysis strategy is slightly different from vanilla Categorical distributional RL, which also introduces a projection to redistribute probabilities of target value distribution by the neighboring smoothing without the joint support assumption. We slightly simplify Categorical distributional RL by assuming that the target distribution is still within the pre-specified support, which is still easy to satisfy in practice given a relative large bounded range $[l_0, l_k]$ in advance. To approximate the categorical distribution, we leverage the \textit{histogram function} $f^{s, a}$ with $k$ uniform partitions on the support to parameterize the approximated probability density function of $Z(s, a)$. With KL divergence as $d_p$, we can eventually derive the distribution objective function to be optimized within each update in Neural FZI, which is similar to the histogram distributional loss proposed in \citep{imani2018improving}. In particular, we denote $\mathbf{x}(s)$ as the state feature on each state $s$, and we let the support of $Z(s, a)$ be uniformly partitioned into $k$ bins. The output dimension of $f^{s,\cdot}$ can be $|\mathcal{A}| \times k$, where we use the index $a$ to focus on the function $f^{s, a}$. Hence, the function $f^{s, a}: \mathcal{X} \rightarrow[0,1]^{k}$ provides a k-dimensional vector $f^{s, a}(\mathbf{x}(s))$ of the coefficients, indicating the probability that the target is in this bin given the state feature $\mathbf{x}(s)$ and action $a$. Next, we use \textit{softmax} based on the linear approximation $\mathbf{x}(s)^{\top} \theta_{i}$ to express $f^{s, a}$, i.e., $f_{i}^{s, a, \theta}(\mathbf{x}(s))=\exp \left(\mathbf{x}(s)^{\top} \theta_{i}\right) / \sum_{j=1}^{k} \exp \left(\mathbf{x}(s)^{\top} \theta_{j}\right)$. For simplicity, we use $f_{i}^{\theta}(\mathbf{x}(s))$ to replace $f_{i}^{s, a, \theta}(\mathbf{x}(s))$. Note that the form of $f^{s, a}$ is similar to that in Softmax policy gradient optimization~\citep{mei2020global,sutton2018reinforcement}, but here we focus on the value-based RL rather than the policy gradient RL. Our prediction probability $f_i^{s, a}$ is redefined as the probability in the $i$-th bin over the support of $Z(s, a)$, thus eventually serving as a density function. While the linear approximator is clearly limited, this is the setting where so far the cleanest results have been achieved and understanding this setting is a necessary first step towards the bigger problem of understanding distributional RL algorithms. Under this categorical parameterization equipped with KL divergence, the resulting distributional objective function $\mathcal{L}_\theta(s, a)$ for the continuous optimization for each $s, a$ pair in each iteration of Neural FZI~(Eq.~\ref{eq:Neural_Z_fitting}) can be expressed as: \begin{equation}\begin{aligned}\label{eq:histogram} \mathcal{L}_\theta(s, a) = -\sum_{i=1}^{k} \int_{l_{i}}^{l_{i}+w_{i}} p^{s, a}(y) \log \frac{f_{i}^\theta(\mathbf{x}(s))}{w_{i}} d y \propto -\sum_{i=1}^{k} p^{s, a}_{i} \log f_{i}^\theta(\mathbf{x}(s)), \end{aligned}\end{equation} where $\theta=\{\theta_1, ..., \theta_{k}\}$ and $p^{s, a}_i$ is the probability in the $i$-th bin of the true density function $p^{s, a}(x)$ for $Z(s, a)$ defined in Eq.~\ref{eq:decomposition}. $w_i$ is the width for the $i$-th bin $(l_i, l_{i+1}]$. The derivation of the categorical distributional loss under the categorical parameterization is given in Appendix~\ref{appendix:histogram}. To attain the stable optimization property of distributional RL, we firstly derive the appealing properties of the new categorical distributional loss in Eq.~\ref{eq:histogram}, as shown in Proposition~\ref{prop:lipschitz}. \begin{prop}\label{prop:lipschitz} (Properties of Categorical Distributional Loss) Assume the state features $\Vert \mathbf{x}(s) \Vert \leq l$ for each state $s$, then $\mathcal{L}_\theta$ is $kl$-Lipschitz continuous, $kl^2$-smooth and convex w.r.t. the parameter $\theta$. \end{prop} Please refer to Appendix~\ref{appendix:lemma_lipschitz} for the proof. The derived smoothness properties of $d_p$ under the categorical distributional loss plays an integral role in the stable optimization for distributional RL. In stark contrast, classical RL optimizes a least squared loss function~\citep{sutton2018reinforcement} in Neural FQI. It is known that the least squared estimator has no bounded Lipschitz constant in general and is only $\lambda_\text{max}$-smooth, where $\lambda_\text{max}$ is the largest singular value of the design or data matrix. More specifically, for the categorical distributional loss in distributional RL, we have $\Vert \nabla_\theta \mathcal{L}_\theta \Vert \le kl$, while the gradient norm in classical RL is $|y_i - Q_\theta^k(s, a)|\Vert \mathbf{x}(s) \Vert$, where $Q_\theta^k(s, a)=\sum_{i=1}^{k} (l_i+l_{i+1})f_{i}^\theta(\mathbf{x}(s)) / 2 w_{i}$ under the same categorical parameterization for a fair comparison. Clearly, $Q_\theta^k(s, a)$ can be sufficiently large if the support $[l_0, l_k]$ is specified to be large, which is common in environments where the agent is able to attain a high level of expected returns~\citep{bellemare2017distributional}. As such, $|y_i - Q_\theta^k(s, a)|$ can vary significantly more than $k$ and therefore classical RL with the potentially larger upper bound of gradient norms is prone to the instability optimization issue. After providing the intuitive comparison in terms of gradient norms above, we next show that distributional RL loss can induce an uniform stability property under the desirable smoothness properties analyzed in Proposition~\ref{prop:lipschitz}. We recap the definition of uniform stability for an algorithm while running \textit{Stochastic Gradient Descent}~(SGD) in Definition~\ref{def:stability}. \begin{myDef}\label{def:stability}(Uniform Stability)~\citep{hardt2016train} Consider a loss function $g_w(z)$ parameterized by $w$ encountered on the example $z$, a randomized algorithm $\mathcal{M}$ is uniformly stable if for all data sets $\mathcal{D}, \mathcal{D}^\prime$ such that $\mathcal{D}, \mathcal{D}^\prime$ differ in at most one example, we have \begin{equation}\begin{aligned}\label{eq:uniform_stable} \sup_{z} \mathbb{E}_{\mathcal{M}}\left[g_{\mathcal{M}(\mathcal{D}) }(z)-g_{\mathcal{M}\left(\mathcal{D}^{\prime}\right) }\left(z\right)\right] \leq \epsilon_{\text {stab }}. \end{aligned}\end{equation} \end{myDef} In Theorem~\ref{theorem:lipschitz}, we show that while running SGD to solve the categorical distributional loss within each Neural FZI, the continuous optimization process in each iteration is $\epsilon_{\text{stab}}$-uniformly stable. \begin{theorem}\label{theorem:lipschitz} (Stable Optimization for Distributional RL) Suppose that we run SGD under $\mathcal{L}_\theta$ in Eq.~\ref{eq:histogram} with step sizes $\lambda_t \le 2 / kl^2$ for $T$ steps. Assume $\Vert \mathbf{x}(s) \Vert \leq l$ for each state $s$ and action $a$, then we have $\mathcal{L}_\theta$ satisfies the uniform stability in Definition~\ref{def:stability} with $\epsilon_{\text {stab }} \leq \frac{4kT}{n}$, i.e., \begin{eqnarray} \begin{aligned} \mathbb{E}\left|\mathcal{L}_{\theta_T}(s, a) - \mathcal{L}_{\theta_T^\prime}(s, a)\right| \leq \frac{4kT}{n}, \end{aligned} \end{eqnarray} where $\theta_T$ and $\theta_T^\prime$ are the minimizers after $T$ steps under the dataset $\mathcal{D}$ and $\mathcal{D}^\prime$, respectively. \end{theorem} Please refer to the proof of Theorem~\ref{theorem:lipschitz} in Appendix~\ref{appendix:lipschitz}. The stable optimization has multiple advantages. In deep learning optimization literature~\citep{hardt2016train}, an uniform stability can guarantee $\epsilon_{\text {stab }}$-bounded generalization gap. In reinforcement learning, algorithms with more stability tend to achieve a better final performance~\citep{bjorck2021towards,li2021functional,ahmed2019understanding}. In summary, under the categorical parameterization equipped with KL divergence, the continuous optimization objective function within each update of Neural FZI for distributional RL is uniformly stable with the stability errors shrinking at the rate of $O(n^{-1})$, and the immediately obtained bounded generalization gap also guarantees a desirable local minima. This advantage can be owing to the desirable smoothness property of categorical distributional loss with a potentially smaller upper bound of gradient norms compared with classical RL. Empirically, in Section~\ref{sec:experiments}, we validate the stable gradient behaviors of categorical distributional RL, and similar results are also observed in Quantile Regression distributional RL. By contrast, without these smooth properties, classical RL may not yield the stable optimization property directly. For example, $\lambda_\text{max}$-smooth may be of less help for the optimization given a bad conditional number of the design matrix where $\lambda_\text{max}$ could be sufficiently large. The potential optimization instability for classical RL can be used to explain its inferiority to distributional RL in most environments, although it may not explain why distributional RL could not perform favorably in certain games~\citep{ceron2021revisiting}. We leave the comprehensive explanation as future works. \paragraph{Remark on Non-linear Categorical Parameterization.} Although the aforementioned stability optimization conclusions are established on the linear categorical parameterization on the value distribution of $Z^\pi$. Similar conclusions can be extended in the non-convex optimization case with a non-linear categorical parameterization by techniques proposed in \citep{hardt2016train}. We also empirically validate our theoretical conclusions in the experiments by directly applying practical neural network parameterized distributional RL algorithms. \subsection{Acceleration Effect of distributional RL}\label{sec:acceleration} To characterize the acceleration effect of distributional RL, we additionally leverage the recently proposed \textit{value distribution decomposition}~\citep{sun2021interpreting} to decompose the target $p^{s, a}$. \paragraph{Value Distribution Decomposition.} In order to decompose the optimization impact of value distribution into its expectation and the remaining distribution part, we adopt the wisdom from robust statistics via a variant of \textit{gross error model}~\citep{huber2004robust}. Value distribution decomposition~\citep{sun2021interpreting} was successfully applied to derive the distributional regularization effect of distributional RL. We utilize $F^{s, a}$ to express the distribution function of $Z^\pi(s, a)$ and we consider the function class of $F^{s, a}$ that satisfies the following expectation decomposition: \begin{equation}\begin{aligned}\label{eq:decomposition} F^{s, a}(x)=(1-\epsilon)\mathbbm{1}_{\{x \ge \mathbb{E}\left[Z^\pi(s, a)\right]\}}(x) + \epsilon F^{s, a}_{\mu}(x), \end{aligned}\end{equation} where the distribution function $F^{s, a}_{\mu}$ is determined by $F^{s, a}$ and $\epsilon$ to measure the impact of remaining distribution \textit{independent of} its expectation $\mathbb{E}\left[Z^\pi(s, a)\right]$. $\epsilon$ controls the proportion of $F^{s, a}_\mu(x)$ and the indicator function $\mathbbm{1}_{\{x \ge \mathbb{E}\left[Z^\pi(s, a)\right]\}}=1$ if $x \ge \mathbb{E}\left[Z^\pi(s, a)\right]$, otherwise 0. Although the function class of $F^{s, a}$ is restricted to satisfy this decomposition equality, it is still rich with the rationale rigorously demonstrated in \citep{sun2021interpreting}. To reveal the speeding up effect of distributional RL loss, we consider the density function form of Eq.~\ref{eq:decomposition}, i.e., $p^{s, a}(x)=(1-\epsilon)\delta_{\{x=\mathbb{E}\left[Z^\pi(s, a)\right]\}}(x) + \epsilon \mu^{s, a}(x)$, where $\delta_{\{x=\mathbb{E}\left[Z^\pi(s, a)\right]\}}$ is a Dirac function centered at $\mathbb{E}\left[Z^\pi(s, a)\right]$ to characterize the expectation impact and $\mu^{s, a}$ is the density function of $F^{s, a}_\mu$ to measure the addition value distribution information. Within Neural FZI, our goal is to minimize $\frac{1}{n}\sum_{i=1}^{n}\mathcal{L}_\theta(s_i, a_i)$. We denote $G^k(\theta)$ as the expectation of $\mathcal{L}_\theta$, i.e., $G^k(\theta)=\mathbb{E}_{(s, a)\sim \rho^\pi}\left[\mathcal{L}_\theta(s, a)\right]$. Based on the categorical parameterization in Section~\ref{sec:stability}, the convex and smooth properties with respect to the parameter $\theta$ in $f_\theta$ as shown in Proposition~\ref{prop:lipschitz} still hold for $G^k(\theta)$. We use $G(\theta)$ for $G^k(\theta)$ for simplicity and rewrite $\mathcal{L}_\theta(s, a)$ as $\mathcal{L}_\theta(g^{s, a}, f^{s, a}_\theta)$, where the target density function $g^{s, a}$ can be $p^{s, a}$, $\mu^{s, a}$ or $\delta_{\{x=\mathbb{E}\left[Z^\pi(s, a)\right]\}}$, and $f^{s, a, \theta}$ is rewritten as $f^{s, a}_\theta$ for conciseness. As the KL divergence enjoys the property of unbiased gradient estimates, we let the variance of its stochastic gradient over \textit{the expectation} $\delta_{\{x=\mathbb{E}\left[Z^\pi(s, a)\right]\}}$ be bounded, i.e., \begin{equation}\begin{aligned} \mathbb{E}_{(s, a)\sim \rho^\pi}\left[\|\nabla \mathcal{L}_\theta(\delta_{\{x=\mathbb{E}\left[Z^\pi(s, a)\right]\}}, f_\theta^{s, a}))-\nabla G(\theta)\|^{2}\right]=\sigma^{2}. \end{aligned}\end{equation} Next, following the similar label smoothing analysis in \citep{xu2020towards}, we further characterize the approximation degree of $f^{s, a}_\theta$ to the target value distribution $\mu^{s, a}$ by measuring its variance as $\kappa \sigma^2$: \begin{equation}\begin{aligned}\label{eq:acceleration_kappa} \mathbb{E}_{(s, a)\sim \rho^\pi}\left[\|\nabla \mathcal{L}_\theta(\mu^{s, a}, f_\theta^{s, a}))-\nabla G(\theta)\|^{2}\right]=\hat{\sigma}^2:=\kappa \sigma^{2}. \end{aligned}\end{equation} Notably, $\kappa$ can be used to measure the approximation error between $f_\theta^{s, a}$ and $\mu^{s, a}$ and we do not assume $\hat{\sigma}^2$ to be bounded as $\kappa$ can be arbitrarily large. This expression $\kappa \sigma^2$ for $\hat{\sigma}^2$ allows us to utilize $\kappa$ to characterize different acceleration effects for distributional RL given different $\kappa$. Concretely, a favorable approximation of $f_\theta^{s, a}$ to $\mu^{s, a}$ would lead to a small $\kappa$ that contributes to the acceleration effect of distributional RL as shown in Theorem~\ref{theorem:acceleration}. Based on Eq.~\ref{eq:acceleration_kappa}, we immediately have Proposition~\ref{prop:acceleration}. \begin{prop}\label{prop:acceleration} Based on the value distribution decomposition in Eq.~\ref{eq:decomposition}, and Eq.~\ref{eq:acceleration_kappa}, we have: \begin{equation}\begin{aligned}\label{eq:acceleration_kappa_complete} \mathbb{E}_{(s, a)\sim \rho^\pi}\left[\|\nabla \mathcal{L}_\theta(p^{s, a}, f_\theta^{s, a}))-\nabla G(\theta)\|^{2}\right] \le (1-\epsilon)^2\sigma^{2} + \epsilon^2 \kappa \sigma^{2}. \end{aligned}\end{equation} \end{prop} Please refer to Appendix~\ref{appendix:acceleration_lemma} for the proof. Before comparing the sample complexity in the optimization process of both classical and distributional RL, we provide the definition of the first-order $\tau$-stationary point, which is preferred in the optimization of deep learning rather than the a simple stationary point in order to guarantee the generalization. \begin{myDef}\label{definition:acceleration} (First-order $\tau$-Stationary Point) While solving $\min_\theta G(\theta)$, the updated parameters $\mathbb{\theta}_T$ after $T$ steps is a first-order $\tau$-stationary point if $\Vert \nabla G(\theta_T) \Vert \le \tau$, where the small $\tau$ is in $(0, 1)$. \end{myDef} Based on Definition~\ref{definition:acceleration}, we formally characterize the acceleration effects for distributional RL in Theorem~\ref{theorem:acceleration} that depends upon approximation errors between $\mu^{s, a}$ and $f^{s, a}_\theta$ measured by $\kappa$. \begin{theorem}\label{theorem:acceleration} (Sample Complexity and Acceleration Effects of Distributional RL) While running SGD to minimize $\mathcal{L}_\theta$ in Eq.~\ref{eq:decomposition} within Neural FZI, we assume the step size $\lambda=1/kl^2$, $\epsilon=1/(1+\kappa)$ across (2) and (3), and the sample is uniformly drawn from $T$ samples, then: (1) (\textbf{Classical RL}) When minimizing $\mathcal{L}_\theta(\delta_{\{x=\mathbb{E}\left[Z^\pi(s, a)\right]\}}, f_\theta^{s, a})$, $T = O(\frac{1}{\tau^4})$ such that $\mathcal{L}_\theta$ converges to a $\tau$-stationary point in expectation. (2) (\textbf{Distributional RL with $\kappa \le \frac{\tau}{2\sigma}$}) When minimizing $\mathcal{L}_\theta(p^{s, a}, f_\theta^{s, a})$, let $T=\frac{4 G(\theta_0)}{\lambda \tau^2}=O(\frac{1}{\tau^2})$, $\mathcal{L}_\theta$ converges to a $\tau$-stationary point in expectation. (3) (\textbf{Distributional RL with $\kappa > \frac{\tau}{2\sigma}$}) When minimizing $\mathcal{L}_\theta(p^{s, a}, f_\theta^{s, a})$, let $T=\frac{G(\theta_0)}{\lambda \kappa^2 \sigma^2}=O(\frac{1}{\tau^2})$, $\mathcal{L}_\theta$ does not converge to a $\tau$-stationary point, but can guarantee a $O(\kappa^2)$-stationary point. \end{theorem} The proof is provided in Appendix~\ref{appendix:acceleration_theorm}. Theorem~\ref{theorem:acceleration} is inspired by the intuitive connection between the value distribution in distributional RL and the label distribution in label smoothing technique~\citep{xu2020towards}. Importantly, Theorem~\ref{theorem:acceleration} demonstrates that solving categorical distributional loss of distributional RL can speed up the convergence if a distribution approximation error is favorable. Otherwise, the convergence point, albeit stationary, may not guarantee a desirable performance under an agnostic $\kappa$, which may be very large on certain environments. \textit{The results in Theorem~\ref{theorem:acceleration} in fact incorporate the impact of both two key ingredients, including the choice of $d_p$ and parameterization error of $Z_\theta$, analyzed in Section~\ref{sec:neuralFZI} on the optimization of distributional RL.} \textbf{In the first scenario~((2) in Theorem~\ref{theorem:acceleration})}, there is only a small approximation or paramterization error between $f_\theta^{s, a}$ and $p^{s, a}$~(or $\mu^{s, a}$), corresponding to a small $\kappa$ with $\kappa\le \frac{\tau}{2\sigma}$. In this case, solving $\mathcal{L}_\theta$ based on the categorical parameterization can reduce the sample complexity from $O(\frac{1}{\tau^4})$ to $O(\frac{1}{\tau^2})$ compared with classical RL in (1) of Theorem~\ref{theorem:acceleration}, and meanwhile guarantees a $\tau$-stationary point. \textbf{In the second scenario~((3) in Theorem~\ref{theorem:acceleration})} especially for some challenging environments with much intrinsic uncertainty, we can also attain a relatively large approximation error or parameterization error of $Z_\theta$ with a large $\kappa > \frac{\tau}{2\sigma}$ as the distributional TD approximation error could be potentially large in practice. Under this circumstance, distributional RL algorithms may fail to speed up the convergence or achieve the superior performance compared with classical RL as $\mathcal{O}(\kappa^2)$ could be potentially large on some complex environments. If $\mathcal{O}(\kappa^2)$ is proper, distributional RL can still potentially perform reasonably due the to $\mathcal{O}(\kappa^2)$-stationary point guarantee. Theses theoretical results also coincide with past empirical observations~\citep{dabney2017distributional, ceron2021revisiting}, where distributional RL algorithms outperform classical RL in most cases, but are inferior in certain environments. Based on our results in Theorem~\ref{theorem:acceleration}, we contend that these certain environments have much intrinsic uncertainty, the distribution parameterization error between $Z_\theta$ and the true value distribution under the distributional TD approximation is still too large~($\kappa > \frac{\tau}{2\sigma}$) to guarantee a favorable convergence point for distributional RL algorithms with different $d_p$, which is intuitive. \section{Experiments}\label{sec:experiments} \begin{figure*}[t!] \centering \includegraphics[width=1.0\textwidth,trim=0 0 0 0,clip]{0Figure_performance.pdf} \caption{\textbf{Performance.} Learning curve of AC, DAC~(C51) and DAC~(IQN) over 5 seeds with smooth size 5 across eight MuJoCo games.} \label{fig:performance} \end{figure*} We perform extensive experiments on eight continuous control MuJoCo games to validate the theoretical optimization advantage of distributional RL algorithms analyzed in Section~\ref{sec:optimization}, including the stable gradient behaviors of distributional RL to achieve the uniform stability as well as the acceleration effects determined by the distribution parameterization error. \paragraph{Implementation.} Our implementation is based Soft Actor Critic~(SAC)~\citep{haarnoja2018soft} and distributional Soft Actor Critic~\citep{ma2020dsac}. We eliminate the optimization impact of entropy regularization in these algorithm implementations, and thus we denote the resulting algorithms as Actor Critic~(AC) and Distributional Actor Critic~(DAC) for the conciseness. For DAC, we firstly perform the C51 algorithm to the critic to extend the classical critic loss to the distributional version denoted by \textit{DAC~(C51)} as our theoretical analysis in Sections~\ref{sec:stability} and \ref{sec:acceleration} are mainly based on categorical parameterization. We further apply our empirical demonstration on Quantile Regression distributional RL heuristically, i.e., Implicit Quantile Network~(IQN), which is denoted as \textit{DAC~(IQN)}. Hyper-parameters and more implementation details are provided in Appendix~\ref{appendix:implementation}. \begin{figure*}[b!] \centering \includegraphics[width=0.9\textwidth,trim=0 0 0 0,clip]{1Figure_gradient.pdf} \caption{ \textbf{Stable Optimization.} The critic gradient norms in the logarithmic scale regarding \textit{the state} during the training of AC, DAC~(C51), DAC~(IQN) over 5 seeds on eight MuJoCo environments.} \label{fig:optimization} \end{figure*} \subsection{Performance and Uniform Stability in distributional RL Optimization} Figure~\ref{fig:performance} suggests that DAC~(IQN) in orange lines outperforms its classical version AC~(black lines) across all environments, while DAC~(C51) in red lines is inferior to AC on humanoid, walker2d and reacher. This could be explained by a more flexible parameterization of IQN over C51. We then demonstrate the advantage of uniform optimization stability for distributional RL over classical RL. According to Theorem~\ref{theorem:lipschitz}, the stable optimization of distribution loss with Neural FZI is described as a bounded loss difference for a neighboring dataset in terms of each state $s$ and action $a$. In other words, the error bound holds by taking the supreme over each state the agent encounters. To measure this algorithm stability, while far from perfect, we consider to leverage \textit{the average gradient norms with respect to the state feature $\mathbf{x}(s)$} in the whole optimization process as the proxy due to the fact that the gradient could measure the sensitivity of loss function regarding each state the agent observes. From Figure~\ref{fig:optimization}, it turns out that both DAC~(C51) and DAC~(IQN) entail a much smaller gradient norm magnitude as opposed to their classical version AC~(black lines) across all eight MuJoCo environments, which corroborates the theoretical advantage of the uniform optimization stability for distributional RL analyzed in Theorem~\ref{theorem:lipschitz}. \begin{figure*}[t!] \centering \includegraphics[width=0.9\textwidth,trim=0 0 0 0,clip]{2Figure_acceleration.pdf} \caption{ \textbf{Acceleration Effect.} The critic gradient norms in the logarithmic scale regarding \textit{network parameters} in the training of AC, DAC~(C51), DAC~(IQN) over 5 seeds on MuJoCo environments.} \label{fig:acceleration} \end{figure*} \subsection{Smoothness Property and Acceleration Effect of Distributional RL} Theorem~\ref{theorem:acceleration} demonstrates that distributional RL can speed up the convergence if the distribution parameterization is appropriate, characterized by the variance of the gradient estimates with a small $\kappa$ (case (2) in Theorem~\ref{theorem:acceleration}). To demonstrate it, we use the proxy by evaluating the $\ell_2$-norms of gradients \textit{with respect to network parameters} of the critic for AC and DAC. We mainly focus on a direct comparison between vanilla AC and DAC algorithm, although their network architectures are slightly different. Similar results under the same architecture and via the value distribution decomposition of Eq.~\ref{eq:decomposition} are provided in Appendix~\ref{appendix:exp_acceleration_kappa}. Figure~\ref{fig:acceleration} showcases that both DAC~(C51) and DAC~(IQN) have smaller gradient norms in terms of network parameters $\theta$ compared with AC in the whole optimization process, which directly validates that distributional RL loss is more likely to enjoy smoothness properties in Proposition~\ref{prop:lipschitz}. In terms of acceleration effects, the property of stationary points, albeit being different, in cases (2) and (3) of Theorem~\ref{theorem:acceleration} guarantees bounded gradient norms, but the precise evaluation of $\kappa$ is tricky in order to discriminate either case (2) or (3) for each algorithm in a specific environment. Nevertheless, by considering the fact that DAC~(IQN) outperforms DAC~(C51) in most environments in Figure~\ref{fig:performance}, we hypothesize that the inferiority of DAC~(C51) on humanoid, walker2d and reacher could be owing to its larger parameterization errors $\kappa$ in these environments. This results in the worse performance of DAC~(C51) compared with DAC~(IQN) that is more likely to accord with the case (3) in Theorem~\ref{theorem:acceleration} due to its richer distribution expressiveness power than C51. \section{Discussions and Conclusion} Our optimization analysis of distributional RL is based on the categorical parameterization, and the alternative analysis on Wasserstein distance can be an integral complementary for our conclusions. Acceleration effects could be further investigated to explain whether a typical distributional RL algorithm can perform favorably in a specific environment. We leave them as future works. In our paper, we answer the question: \textit{how does value distribution in distributional RL help the optimization} from two perspectives, including the stable optimization analysis based on the smoothness property of categorical distributional loss, as well as the acceleration effects determined by the variance of gradient estimates. We theoretically and empirically show that distributional RL embraces stable gradient behaviors and could speed up the convergence if the distribution approximation is desirable or the parameterization error is sufficiently small. \paragraph{Ethics Statement.} Due to the fact that our study is about the theoretical properties of distributional RL algorithms, we do not think our research is involved with any ethics issues. \paragraph{Reproducibility Statement.} As stated in Section~\ref{sec:experiments}, our implementation is based on the public code of SAC~\citep{haarnoja2018soft} and Distributional SAC~\citep{ma2020dsac}. We also provide implementation details in Appendix~\ref{appendix:implementation} for reproducibility. For the theoretical results, rigorous proof is also given in Appendix from \ref{appendix:histogram} to \ref{appendix:acceleration_theorm}.
{'timestamp': '2022-09-30T02:06:30', 'yymm': '2209', 'arxiv_id': '2209.14513', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14513'}
arxiv
\section{Introduction} \label{Introduction} Recently, Federated Learning (FL) is known as a novel distributed learning methodology for enhancing communication efficiency and ensuring privacy in traditional centralized one \cite{2017-FL-FederatedLearning}. However, the most challenge of this method for client models is non-independent and identically distributed (non-IID) data, which leads to divergence into unknown directions. Inspired by this, various works on handling non-IID were proposed in \cite{2020-FL-FedProx,2021-FL-FedDyne,2021-FL-FedU,2020-FL-Scaffold,2021-FL-FedNova,2021-FL-FedGen,2022-FL-Wasserstein}. However, these works mainly rely on arbitrary configurations without thoroughly understanding the models' behaviors, yielding low-efficiency results. Aiming to fulfil this gap, in this work, we propose a new hierarchical FL framework using information theory by taking a deeper observation of the model's behaviors, and this framework can be realized for various FL systems with heterogeneous data. In addition, our proposed framework can trigger the FL system to be more scalable, controllable, and accessible through hierarchical architecture. Historically, anytime a new segment (i.e., a new group of clients) is integrated into the FL network, the entire network must be retrained from the beginning. Nevertheless, with the assistance of LKD, the knowledge is progressively transferred during the training process without information loss owing to the empirical gradients towards the newly participated clients' dataset. The main contributions of the paper are summarized as follows. \textbf{(1)} We show that conventional FLs performance is unstable in heterogeneous environments due to non-IID and unbalanced data by carefully analyzing the basics of Stochastic Gradient Descent (SGD). \textbf{(2)} We propose a new multi-teacher distillation model, Label-Driven Knowledge Distillation (LKD), where teachers can only share the most certain of their knowledge. In this way, the student model can absorb the most meaningful information from each teacher. \textbf{(3)} To trigger the scalability and robustness against non-IID data in FL, we propose a new hierarchical FL framework, subbed Full-stack Federated Learning (F2L). Moreover, to guarantee the computation cost at the global server, F2L architecture integrates both techniques: LKD and FedAvg aggregators at the global server. To this end, our framework can do robust training by LKD when the FL process is divergent (i.e., at the start of the training process). When the training starts to achieve stable convergence, FedAvg is utilized to reduce the server's computational cost while retaining the FL performance. \textbf{(4)} We theoretically investigate our LKD technique to make a brief comparison in terms of performance with the conventional Multi-teacher knowledge distillation (MTKD), and in-theory show that our new technique always achieves better performance than MTKD. \textbf{(5)} We validate the practicability of the proposed LKD and F2L via various experiments based on different datasets and network settings. To show the efficiency of F2L in dealing with non-IID and unbalanced data, we provide a performance comparison and the results show that the proposed F2L architecture outperforms the existing FL methods. Especially, our approach achieves comparable accuracy when compared with FedAvg (\cite{2017-FL-FederatedLearning}) and higher $7-20\%$ in non-IID settings. \section{Related Work} \label{sec:related-works} \subsection{Federated Learning on non-IID data} \label{sec:fl-non-iid} To narrow the effects of divergence weights, some recent studies focused on gradient regularization aspects \cite{2020-FL-FedProx,2021-FL-FedDyne,2021-FL-FedU,2020-FL-Scaffold,2021-FL-FedNova,2021-FL-FedGen,2022-FL-Wasserstein}. By using the same conceptual regularization, the authors in \cite{2020-FL-FedProx,2021-FL-FedDyne}, and \cite{2021-FL-FedU} introduced the FedProx, FedDyne, and FedU, respectively, where FedProx and FedDyne focused on pulling clients' models back to the nearest aggregation model while FedU's attempted to pull distributed clients together. To direct the updated routing of the client model close to the ideal server route, the authors in \cite{2020-FL-Scaffold} proposed {SCAFFOLD} by adding a control variate to the model updates. Meanwhile, to prevent the aggregated model from following highly biased models, the authors in \cite{2021-FL-FedNova} rolled out FedNova by adding gradient scaling terms to the model update function. Similar to \cite{2021-FL-FedU}, the authors in \cite{2022-FL-Wasserstein} launched the WALF by applying Wasserstein metric to reduce the distances between local and global data distributions. However, all these methods are limited in providing technical characteristics. For example, \cite{2021-FL-FedNova} demonstrated that FedProx and FedDyne are ineffective in many cases when using pullback to the globally aggregated model. Meanwhile, FedU and WAFL have the same limitation on making a huge communication burden. Aside from that, FedU also faces a very complex and non-convex optimization problem. Regarding the aspect of knowledge distillation for FL, only the work in \cite{2021-FL-FedGen} proposed a new generative model of local users as an alternative data augmentation technique for FL. However, the majority drawback of this model is that the training process at the server demands a huge data collection from all users, leading to ineffective communication. Motivated by this, we propose a new FL architecture that is expected to be more elegant, easier to implement, and much more straightforward. Unlike \cite{2021-FL-FedU, 2021-FL-FedDyne,2020-FL-Scaffold}, we utilize the knowledge from clients' models to extract good knowledge for the aggregation model instead of using model parameters to reduce the physical distance between distributed models. Following that, our proposed framework can flexibly handle weight distance and probability distance in an efficient way, i.e., $\Vert p^k(y=c)-p(y=c) \Vert$ (please refer to Appendix~\ref{appendix:SGDissues}). \subsection{Multi-Teacher Knowledge Distillation} \label{sec:multi-teacher-knowledge-distillation} MTKD is an improved version of KD (which is presented in Appendix~\ref{appendix:knowledge-distillation}), in which multiple teachers work cooperatively to build a student model. As shown in \cite{2018-TL-KD-OnFly-NativeEnsemble}, every MTKD technique solves the following problem formulation: \begin{align} \textbf{P1}:\min \mathcal{L}_m^\textit{KL} = \sum^R_{r=1} \sum^C_{l=1}\hat{p}(l|\boldsymbol{X},\boldsymbol{\omega}^r,T)\log{\frac{\hat{p}(l|\boldsymbol{X},\boldsymbol{\omega^r},T)}{\hat{p}(l|\boldsymbol{X},\boldsymbol{\omega}^g,T)}}, \label{eq:general-mtkd} \end{align} here, $r\in \{R\}$ are the teachers' indices. By minimizing \textbf{P1}, the student $\hat{p}^g$ can attain knowledge from all teachers. However, when using MTKD, there are some problems in extracting the knowledge distillation from multiple teachers. In particular, the process of distilling knowledge in MTKD is typically empirical without understanding the teacher's knowledge (i.e., aggregating all KL divergences between each teacher and the student). Therefore, MTKD is unable to exploit teachers' detailed predictions for the KD (e.g., \cite{2021-TL-MultiTeacher-MultiLevel}, \cite{2019-DL-EnsembleKD}, \cite{2018-TL-KD-OnFly-NativeEnsemble}, \cite{2017-DL-EnsembleTeachers}, \cite{2020-TL-HydraKD}). Another version of MTKD, KTMDs can only apply for a better teachers to distill knowledge (e.g., \cite{2019-DL-Customize-Student-HeterogenousTeachers}, \cite{2021-DL-Student-Customized-KD}, \cite{2022-DL-ConfidenceAware-KD}, \cite{2021-DL-DenselyGuidedKD}). For example, as provided in \cite[eq.~6]{2019-DL-Customize-Student-HeterogenousTeachers}, the student only selects the best teacher to operate the knowledge distillation. Visually, this technique is the same as the way of selecting a teacher among a set of teachers to carry out a single teacher distillation. Therefore, the student's performance is always bounded by the best teacher's performance. Another popular research direction in MTKD is to leverage the advantage of the gap between teachers' hidden class features. However, owing to the lack of explanatory knowledge in teachers' hidden layers, the method in \cite{2021-DL-Student-Customized-KD} cannot obtain better student performance when compared to their teachers. Generally, current MTKD techniques cannot extract good knowledge from different customer models, leading to weight divergence in FL. \section{Full-stack Federated Learning} \label{sec:IV-ProposedAlgorithm} \subsection{The F2L framework} \label{sec:IV-C-MultiteacherKD} The main objective of our work is to design a hierarchical FL framework, in which a global server manages a set of distinct regional servers. Utilizing hierarchical FL, our proposed algorithm can achieve computation and computation efficiency. The reason is that Hierarchical FL makes the clients to train sectionally before making the global aggregation \cite{2020-FL-Hierarchical, 2020-FL-HierarchicalClustering}. Consequently, FL inherits every advantage from mobile edge intelligence concept over traditional non-hierarchical networks (e.g., communication efficiency, scalability, controlability) \cite{2020-5G-Survey,2016-IoT-Survey,2020-FLMEC-Survey}. At the end of each knowledge-sharing episode, the regions (which are supervised by regional servers) cooperate and share their knowledge (each region functions as a distinguished FL system, with a set amount of communication rounds per episode). In each episode, each region randomly selects a group of clients from the network to carry out the aggregation process (e.g., FedAvg, FedProx); therefore, each region functions as a small-scale FL network. As a result, there are always biases in label-driven performance by applying random sampling on users per episode (see Appendix~\ref{appendix:proof-on-sampling-and-data-distribution}). Given the random sampling technique applied to the regional client set, the regions always have different regional data distributions. Consequently, various label-driven performances of different teachers might be achieved. At the global server, our goal is to extract good performance from regional teachers while maintaining the salient features (e.g., understanding of the regional data distributions) of all regions. As a result, we can capture useful knowledge from diverse regions in each episode using our proposed innovative knowledge distillation technique (which is briefly demonstrated in Section~\ref{sec:IV-D-LabelDrivenKD}). We train the model on the standard dataset on the central server to extract knowledge from multiple teachers into the global student model. The preset data pool on the server $\mathcal{S}$ is used to verify the model-class reliability and generate pseudo labels. The system model is illustrated in Fig.~\ref{fig:hierarchicalFL}, and thoroughly described in Appendix~\ref{sec:system-model}. \begin{figure*}[t] \centering \includegraphics[width = 0.8\linewidth]{imageLib/LKD-FullStack-FL-2.pdf} \caption{The architecture of our F2L framework.} \label{fig:hierarchicalFL} \end{figure*} The pseudo algorithm for F2L is demonstrated in Algorithm~\ref{alg:F2L}. When the FL process suffers from client-drift \cite{2020-FL-Scaffold} (i.e., the distribution of label-driven accuracies of different regions have large variance), the F2L framework applies LKD to reduce the class-wise performance gaps between regions (i.e., the regions with better performance on a particular class share their knowledge to regions with low performance). As a result, the FL network achieves a significantly faster convergence when utilizing LKD (which is intensively explained in Section~\ref{sec:IV-D-LabelDrivenKD}.) for the global aggregation process. When the generalization gap between regions is considerably reduced (i.e., $\Vert\max_r{\beta^c_r} - \min_r{\beta^c_r}\Vert \leq \epsilon$), our F2L network becomes vanilla FL to reduce computation and communication costs. To this end, our method can achieve computation efficiency while showing robustness to the non-IID data in the network. Additionally, whenever a new set of clients are added into the network and makes positive contributions to the FL system (e.g., $\Vert\max_r{\beta^c_r} - \min_r{\beta^c_r}\Vert \geq \epsilon$ where $\Vert\max_r{\beta^c_r}\Vert$ a corresponding to the new region's performance) the LKD aggregator can be switched back to improve the FL system's performance over again. \subsection{Label-driven Knowledge Distillation} \label{sec:IV-D-LabelDrivenKD} To extract knowledge from multiple teachers to the global student model, we train the model on the standard dataset on the central server. The preset data pool on the server $\mathcal{S}$ is used to verify the model-class reliability and generate pseudo labels. In our work, the MTKD process executes two main tasks: (1) extracting the teachers' knowledge and (2) maintaining the students' previous performance. To comprehend the LKD method, we first revisit the conventional MTKD, where the probabilistic output is calculated by model $\boldsymbol{\omega}$ on $x_i$, the prediction label $c$ is $\hat{p}(l|x_i,\boldsymbol{\omega},T,c)$ and its relation is: \begin{align}\label{LKD-surrogateOutput} \hat{p}(l|x_i,\boldsymbol{\omega},T,c) = \begin{cases} \hat{p}(l|x_i,\boldsymbol{\omega},T), & \text{if } \text{argmax}\left[ \hat{p}(l|x_i,\boldsymbol{\omega},T)\right] = c, \\ 0, & \text{otherwise}. \end{cases} \end{align} On the one hand, we aim to transfer knowledge from different regional models to the global one. Inspired by \cite{2015-DL-KnowledgeDistillation}, we use the Kullback–Leibler (KL) divergence between each regional teacher and the global logits as a method to estimate the difference between two models' performance. The relationship is expressed as follows: \begin{align}\label{LKD-TeaStu-Loss-Weighted} \mathcal{L}_r^\textit{KL} = \sum^C_{c=1} &\beta^c_r \sum^{S^r_c}_{i=1} \sum^C_{l=1} \hat{p}^r(l|x_i,\boldsymbol{\omega}^r,T,c) \times\log{\frac{\hat{p}^r(l|x_i,\boldsymbol{\omega}^r,T,c)}{\hat{p}^g(l|x_i,\boldsymbol{\omega}^g,T,c)}}, \end{align} where $S$ is the number of samples of the fixed dataset $\mathcal{S}$ on the server. $(\boldsymbol{X}^r_\text{alg}, \boldsymbol{Y}^r_\text{alg})$ is the dataset which is pseudo labeled and aligned by regional model $r$ and $(\boldsymbol{X}^r_\text{alg}[c], \boldsymbol{Y}^r_\text{alg}[c])$ represents the set of data with size of $S_c^r$ labeled by the model $r$ as $c$. Although the same preset dataset is utilized on every teacher model, the different pseudo labeling judgments from different teachers lead to the different dataset tuples. The process of identifying $S_c^r$ is demonstrated in Algorithm~\ref{alg:L-SampleAlign}. Because the regional models label on the same dataset $S$, we have $\sum_{c=1}^C S^r_c = S$ for all regional models. $D_\textit{KL}^c(\hat{p}^r||\hat{p}^g)$ is the $c$ label-driven KL divergence between model $r$ and model $g$. On the other hand, we aim to guarantee that the updated global model does not forget the crucial characteristics of the old global model. Hence, to measure the divergence between the old and the updated model, we introduce the following equation: \begin{align}\label{LKD-OldNew-Loss-Weighted} \mathcal{L}_{\boldsymbol{\omega}_\textit{upd}}^\textit{KL} = \sum^C_{c=1} &\beta^c_{\boldsymbol{\omega}_\textit{old}} \sum^{S^r_c}_{i=1} \sum^C_{l=1} \hat{p}^g(l|x_i,\boldsymbol{\omega}^g_\textit{old},T,c) \times\log{\frac{\hat{p}^g(l|x_i,\boldsymbol{\omega}^g_\textit{old},T,c)}{\hat{p}^g(l|x_i,\boldsymbol{\omega}^g_\textit{new},T,c)}}, \end{align} where $\boldsymbol{\omega}_\textit{old}$ is the old parameters set of the global model which is distilled in the last episode of F2L. More details about the label-driven knowledge distillation are discussed in Appendix~\ref{appendix:labeldriven-knowledgedistillation}. To compare the performance between LKD and MTKD, we consider the following assumption and lemmas: \begin{lemma} Given $\tau^c_r$ is the $c$-label driven predicting accuracy on model $r$. Let $\sigma^2_{r,c}, \mu_{r,c}$ be the model's variance and mean, respectively. The optimal value of variance and mean on student model (i) $\sigma^{*2}_{LKD,g,c}, \mu^*_{LKD,g,c}$ yields $\sigma^{*2}_{\textrm{LKD},g,c} = \frac{1}{\sum_{r=1}^{R} e^{\tau^c_r}} \sum^R_{r=1} e^{\tau_r^c}\sigma^2_{r,c}$, and $\mu^{*}_{\textrm{LKD},g,c} = \frac{1}{\sum_{r=1}^{R} e^{\tau^c_r}} \sum^R_{r=1} e^{\tau_r^c}\mu_{r,c}.$. \label{lemma:optimal-LKD} \end{lemma} \textit{Proof:} The proof is provided in Appendix~\ref{appendix:lemma-1}. \begin{assumption} Without loss of generality, we consider $R$ distinct regional models whose accuracy satisfy the following prerequisites $\sigma^2_{1,c} \leq \sigma^2_{2,c} \leq \ldots \leq \sigma^2_{R,c}$, and $|\mu_{1,c} - \Bar{\mu}_c| \leq |\mu_{2,c} - \Bar{\mu}_c| \leq \ldots \leq |\mu_{R,c} - \Bar{\mu}_c|$ ($\Bar{\mu}_c$ is denoted as an empirical global mean of the dataset on class $c$). \end{assumption} \begin{lemma} Given the set of models with variance satisfy $\sigma^2_{1,c} \leq \sigma^2_{2,c} \leq \ldots \leq \sigma^2_{R,c}$, the models' accuracy have the following relationship $\tau^c_1 \geq \tau^c_2 \geq \ldots \geq \tau^c_R$. \label{lemma:relationship-accuracy-variance} \end{lemma} \textit{Proof.} The proof can be found in Appendix~\ref{appendix:relationship-accuracy-variance}. \begin{theorem} Let $\sigma^{*2}_{\textrm{LKD},g,c} $ be the class-wise variance of the student model, and $\sigma^{*2}_{\textrm{MTKD},g,c}$ be the class-wise variance of the model of teacher $r$, respectively. We always have the student's variance using LKD technique always lower than that using MTKD: \begin{align} \sigma^{*2}_{\textrm{LKD},g,c} \leq \sigma^{*2}_{\textrm{MTKD},g,c}. \label{eq:LKD-vs-MTKD} \end{align} \label{theorem:labeldriven-knowledgedistillation-analysis} \end{theorem} \textit{Proof}: For the complete proof see Appendix \ref{appendix:labeldriven-knowledgedistillation-analysis}. \begin{theorem} Let $\mu^{*}_{\textrm{LKD},g,c} $ be the empirical $c$-class-wise mean of the student model, and $\mu^{*}_{\textrm{MTKD},g,c}$ be the empirical $c$-class-wise mean of the model of teacher $r$, respectively. We always have the student's empirical mean using LKD technique always closer to the empirical global dataset's class-wise mean ($\Bar{\mu}_c$) than that using MTKD: \begin{align} |\mu^{*}_{\textrm{LKD},g,c} - \Bar{\mu}_c| \leq |\mu^{*}_{\textrm{MTKD},g,c} - \Bar{\mu}_c|. \label{eq:LKD-vs-MTKD-mean} \end{align} \label{theorem:labeldriven-knowledgedistillation-analysis-mean} \end{theorem} Given Theorems~\ref{theorem:labeldriven-knowledgedistillation-analysis} and \ref{theorem:labeldriven-knowledgedistillation-analysis-mean}, we can prove that our proposed LKD technique can consistently achieve better performance than that of the conventional MTKD technique. Moreover, by choosing the appropriate LKD allocation weights, we can further improve the LKD performance over MTKD. Due to space limitation, we defer the proof to Appendix \ref{appendix:labeldriven-knowledgedistillation-analysis-mean}. \subsection{Class Reliability Scoring} The main idea of class reliability variables $\beta^c_r$, $\beta^c_{\boldsymbol{\omega}_\textit{old}}$ in LKD is to weigh the critical intensity of the specific model. Therefore, we leverage the attention design from \cite{2017-DL-Attention} to improve the performance analysis of teachers' label-driven. For regional models with disequilibrium or non-IID data, the teachers only teach the predictions relying upon their specialization. The prediction's reliability can be estimated by leveraging the validation dataset on the server and using the function under the curve (AUC) as follows: \begin{equation}\label{LKD-teacher_weight} \begin{split} \beta^c_r = \frac{\text{exp}(f_\textit{AUC}^{c,r} T_{\boldsymbol{\omega}})}{\sum^R_{r=1}\text{exp}(f_\textit{AUC}^{c,r} T_{\boldsymbol{\omega}} )}, \end{split} \end{equation} where $f^{c,r}_\text{AUC}$ denotes the AUC function on classifier $c$ of the regional model $r$. Since AUC provides the certainty that a specific classifier can work on a label over the rest, we use the surrogate softmax function to weigh the co-reliability among the same labeling classifiers on different teacher models. For simplicity, we denote $\beta^c_{\boldsymbol{\omega}_\textit{old}}$ as the AUC on each labeling classifier: \begin{equation}\label{LKD-oldModel_weight} \begin{split} \beta^c_{\boldsymbol{\omega}_\textit{old}} = \frac{\text{exp}(f_\textit{AUC}^{c,\boldsymbol{\omega}_\text{old}} T_{\boldsymbol{\omega}})}{\text{exp}(f_\textit{AUC}^{c,\boldsymbol{\omega}_\text{new}} T_{\boldsymbol{\omega}})+\text{exp}(f_\textit{AUC}^{c,\boldsymbol{\omega}_\text{old}} T_{\boldsymbol{\omega}} )}. \end{split} \end{equation} In the model update class reliability, instead of calculating the co-reliability between teachers, \eqref{LKD-oldModel_weight} compares the performance of the previous and current global models. Moreover, we introduce a temperatured value for the class reliability scoring function, denoted as $T_{\boldsymbol{\omega}}$. By applying a large temperatured value, the class reliability variable sets $\beta^c_r$, and $\beta^c_{\boldsymbol{\omega}_\textit{old}}$ make a higher priority on the better performance (i.e., the label-driven performance on class $c$ from teacher $r$, e.g., $f_\textit{AUC}^{c,r}$ in equation~\eqref{LKD-teacher_weight} or class $c$ from old model $\boldsymbol{\omega}_\text{old}$ in equation~\eqref{LKD-oldModel_weight}). By this way, we can preserve the useful knowledge which is likely ignored in the new distillation episode. The more detailed descriptions of class reliability scoring are demonstrated in Algorithm~\ref{alg:C-Reliability}. \subsection{Joint Multi-teacher Distillation for F2L} We obtain the overall loss function for online distillation training by the proposed F2L: \begin{align} \mathcal{L}_\text{F2L} = \lambda_1 \sum^R_{r=1}\mathcal{L}^\textit{KL}_r + \lambda_2\mathcal{L}^{KL}_{\boldsymbol{\omega}_\textit{upd}} + \lambda_3\mathcal{L}^g_\textit{CE}, \end{align} where $\lambda_1, \lambda_2, \lambda_3$ are the scaling coefficients of the three terms in the joint loss function. The first and second terms imply the joint LKD from the regional teacher models and the updating correction step, respectively. Moreover, to ensure that knowledge the student receives from teachers is accurate and can be predicted accurately in practice, we need to validate the quality of the student model on the real data. Thus, we also compute the “standard” loss between the student and the ground-truth labels of the train dataset. This part is also known as the hard estimator, which is different from the aforementioned soft-distillator. The hard loss equation is as follows: \begin{align} \mathcal{L}^g_\textit{CE} &= H(y,\hat{p}(l|\boldsymbol{X},\boldsymbol{\omega}^g,T)) = \sum^C_{l=1} y_l \log{\hat{p}(l|\boldsymbol{X},\boldsymbol{\omega}^g,T)}. \end{align} \begin{algorithm}[h] \caption{F2L framework} \label{alg:F2L} \begin{algorithmic} \State {\bfseries Require:} Initialize clients' weights, global aggregation round, number of regions $R$, arbitrary $\epsilon$. \While{not converge} \For{all regions $r\in \{1,2,\dots,R\}$} \For{all user in regions} \State Apply FedAvg on regions $r$. \EndFor \State Send regional model $\boldsymbol{\omega}^r$ to the global server. \EndFor \If{reach global aggregation round} \If{$\Vert\max_r{\beta^c_r} - \min_r{\beta^c_r}\Vert \geq \epsilon$ where $\beta = \{\beta^1_r,\dots,\beta^C_r\}\vert^R_{r=1}$ from Algorithm~\ref{alg:C-Reliability}} \State Apply LKD as described in Algorithm~\ref{alg:LD-KD} \Else \State $\boldsymbol{\omega}^g = 1/R \sum^R_{r=1} \boldsymbol{\omega}^r$. \EndIf \EndIf \EndWhile \end{algorithmic} \end{algorithm} We use the temperature coefficient $T = 1$ to calculate the class probability for this hard loss. The overall training algorithm for LKD is illustrated in Algorithm~\ref{alg:LD-KD}. In terms of value selection for scaling coefficients, the old global model can be considered as an additional regional teacher's model in the same manner, in theory. Therefore, $\lambda_2$ should be chosen as: \begin{align}\label{LKD-lambda2-choice} \lambda_2 = \begin{cases} \frac{1}{R}\lambda_1, & \text{if update distillation in \eqref{LKD-OldNew-Loss-Weighted} is considered,} \\ 0, & \text{otherwise}, \end{cases} \end{align} where $R$ is the number of regions decided by our hierarchical FL settings. With respect to $\lambda_3$, the value is always set as: \begin{align}\label{LKD-lambda1-choice} \lambda_3 = \begin{cases} 1 - \frac{R+1}{R}\lambda_1, & \text{if update distillation in \eqref{LKD-OldNew-Loss-Weighted} is considered,} \\ 1 - \lambda_1, & \text{otherwise}. \end{cases} \end{align} \subsection{Discussions on the extent of protecting privacy} In its simplest version, our proposed F2L framework, like the majority of existing FL approaches, necessitates the exchange of models between the server and each client, which may result in privacy leakage due to, for example, memorization present in the models. Several existing protection methods can be added to our system in order to safeguard clients against enemies. These include adding differential privacy \cite{2017-FL-DifferentiallyPrivate} to client models and executing hierarchical and decentralized model fusion by synchronizing locally inferred logits, for example on random public data, as in work \cite{2019-FL-Cronus}. We reserve further research on this topic for the future. \section{Experimental Evaluation} \label{sec:V-ExperimentalEvaluation} \subsection{Comparison with FL methods} \label{sec:V-B-Comparison} \begin{table*}[t] \addtolength{\tabcolsep}{-3pt} \centering \caption{The top-1 test accuracy of different baselines on different data settings. The $\alpha$ indicates the non-IID degree of the dataset (the lower value of $\alpha$ means that the data is more heterogeneous).\\} \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|} \hline Dataset & FedAvg & FedGen & FedProx & Fed- & F2L & FedAvg & FedGen & FedProx & Fed- & F2L \\ & & & & Distill & (Ours) & & & & Distill & (Ours) \\ \hline \hline \cline{1-11} & \multicolumn{5}{|c|}{Dirichlet ($\alpha=1$)} & \multicolumn{5}{|c|}{Dirichlet ($\alpha=0.1$)} \\ \cline{1-11} EMNIST & $71.66$& $78.70$& $70.77$ & $75.56$& $\textbf{81.14}$ & $59.10$ & $68.24$& $58.88$ & $46.03$ & $\textbf{68.31}$ \\ CIFAR-10 & $60.48$& $59.21$& $63.72$ & $62.36$& $\mathbf{71.22}$ & $47.07$& $47.08$& $47.05$ & $45.67$ & $\mathbf{55.22}$ \\ CIFAR-100 & $36.17$& $40.26$ & $36.3$ & $34.88$ & $\mathbf{50.33}$ & $21.31$& $28.96$& $20.43$ & $16.15$ & $\mathbf{31.07}$ \\ CINIC-10 & $65.23$& $71.61$& $65.15$ & $67.77$ & $\mathbf{74.85}$ & $47.55$& $52.35$& $48.2$ & $47.1$ & $\mathbf{57.12}$\\ CelebA & $70.82$& $75.43$& $71.07$ & $68.59$ & $\mathbf{81.65}$ & $63.58$& $70.14$& $66.33$ & $62.91$ & $\mathbf{74.14}$\\ \hline \end{tabular} \label{tab:F2L-Comparisons} \end{table*} We run the baselines (see Section~\ref{sec:V-A-ExperimentSetup}) and compare with our F2L. Then, we evaluate the comparisons under different non-IID ratio. More precisely, we generate the IID data and non-IID data with two different Dirichlet balance ratio: $\alpha = \{1, 10\}$. The comparison results are presented in Table~\ref{tab:F2L-Comparisons}. As shown in Table~\ref{tab:F2L-Comparisons}, the F2L can outperform the four baselines with a significant increase in accuracy. The reason for this phenomenon is that the LKD technique selectively draws the good features from regional models to build a global model. Hence, the global model predicts the better result on each different class and the entire accuracy of the global model then increases tremendously. The significant impact when applying LKD to distill different teachers to one student is shown in Table~\ref{tab:LKD-Distillation-Efficiency}. \subsection{Computation Efficiency of F2L} \label{sec:V-C-F2L-CommCompEfficiency} To evaluate the computation efficiency of our proposed F2L process, we compare our F2L process with 3 benchmarks: (i) F2L-noFedAvg (aggregator only consists of LKD), (ii) vanilla FL (FL with flatten architecture and FedAvg as an aggregator), and (iii) flatten LKD (FL with flatten architecture based with LKD as an alternate aggregator). Fig.~\ref{fig:F2L-performance} shows that the F2L system can achieve convergence as good as the F2L-noFedAvg. The reason is that: after several communication rounds, the distributional distance between regions is reduced thanks to the LKD technique. Hence, the efficiency of the LKD technique on the data is decreased. As a consequence, the LKD technique shows no significant robustness over FedAvg aggregator. In the non-hierarchical settings, the flatten LKD and FedAvg reveal under-performed compared to the proposed hierarchical settings. We assume that the underperformance above comes from the data shortage of clients' training models. To be more detailed, the clients' dataset are considerably smaller than that of the \say{regional dataset}. Thus, the regional models contain more information than the clients' models. We believe that: in the LKD technique, teachers' models require a certain amount of knowledge to properly train a good student (i.e., the global model). \begin{figure}[!h] \centering \subfigure[\label{fig:F2L-performance}]{\includegraphics[width=0.3\linewidth]{imageLib/F2L-performance.pdf}} \subfigure[\label{fig:F2L-compcost}]{\includegraphics[width=0.25\linewidth]{imageLib/F2Lcompcost.pdf}} \subfigure[\label{fig:F2L-scalability}]{\includegraphics[width=0.3\linewidth]{imageLib/F2L-scalability.pdf}} \caption{Performance benchmarks of F2L under different settings. Fig.~\ref{fig:F2L-performance} reveals the convergence. Fig.~\ref{fig:F2L-compcost} shows the computational cost, and Fig.~\ref{fig:F2L-scalability} demonstrates the F2L convergence when a new set of clients are added into the FL system (i.e., at communication round $100$).} \label{fig:F2Ltest} \end{figure} Given the convergence rate from Fig.~\ref{fig:F2L-performance} and the computation cost at the server on Fig.~\ref{fig:F2L-compcost}, we can see that, by using the adaptive switch between LKD and FedAvg in F2L, we can achieve significant computational efficiency at the aggregation server. Note that F2L can substantially increase performance and computation efficiency compared with non-hierarchical architecture. \subsection{Scalability} \label{sec:V-C-F2L-Scalability} This section evaluates the F2L scalability. To do so, we inject a group of clients with non-IID data into our FL system after $100$ rounds (when the convergence becomes stable). Note that the FL system has never trained these data. The detailed configurations of our experimental assessments can be found in Appendix~\ref{sec:V-A-ExperimentSetup}. As it can be seen from Fig.~\ref{fig:F2L-scalability}, when a new group of clients are added to the FL system, the vanilla FL shows a significant drop in terms of convergence. The reason is because of the distribution gap between the global model's knowledge and knowledge of the clients' data. Whenever new data with unlearned distribution is added to a stable model, the model will make considerable gradient steps towards the new data distribution. Thus, the FedAvg takes considerable learning steps to become stable again. In contrast, in F2L system, the learning from newly injected regions does not directly affect the learning of the whole FL system. Instead, the knowledge from the new domains is selectively chosen via the LKD approach. Thus, the LKD process does not suffer from information loss when new clients with non-IID data are added to the FL system. \subsection{LKD Analysis} \label{sec:V-C-LKD-Analysis} In this section, we evaluate the LKD under various settings to justify the capability of LKD to educate the good student from the normal teachers. Our evaluations are as follows. \textbf{Can student outperform teachers?} To verify the efficiency of LKD with respect to enhancing student performance, we first evaluate F2L on MNIST, EMNIST, CIFAR-$100$, CINIC-$10$, CelebA dataset. The regions are randomly sampled from the massive FL network. In this way, we only evaluate the performance of LKD on random teachers. Table~\ref{tab:LKD-Distillation-Efficiency} shows top-1 accuracy on the regional teacher and student models. The results reveal that LKD can significantly increase the global model performance compared with that of the regional models. Moreover, the newly distilled model can work well under each regional non-IID data after applying the model update. \begin{table}[t] \renewcommand{\arraystretch}{1.25} \caption{Top-1 accuracy of F2L on $5$ datasets MNIST, EMNIST, CIFAR-100, , CINIC-$10$ and CelebA. The data's heterogeneity is set at $\alpha = 0.1$ on CIFAR-100, MNIST, CINIC-$10$ and CelebA. We use EMNIST ``unbalanced'' to evaluate in this test. The ``before update'' and ``after update'' denote the teacher models' accuracies before and after the global distillation, respectively.} \centering \small\addtolength{\tabcolsep}{-3pt} \begin{tabular}{|l|c|c|c|c|c|c|c|c|c|c|} \hline \multirow{3}{*}{\begin{tabular}[c]{@{}c@{}} \\ \end{tabular}} & \multicolumn{2}{c|}{MNIST} & \multicolumn{2}{c|}{EMNIST} & \multicolumn{2}{c|}{CIFAR-100} & \multicolumn{2}{c|}{CINIC-10} & \multicolumn{2}{c|}{Celeb-A} \\ \cline{2-11} & before & after & before & after & before & after & before & after & before & after \\ \hline & update & update & update & update & update & update & update & update & update & update \\ \hline Teacher 1 & $61.02$ & $\mathbf{95.19}$ & $73.27$ & $\mathbf{84.09}$ & $20.11$ & $\mathbf{35.41}$ & $43.8$ & $\mathbf{46.59}$ & $62.37$ & $\mathbf{67.98}$ \\ \hline Teacher 2 & $92.49$ & $\mathbf{98.22}$ & $78.80$ & $\mathbf{83.62}$ & $18.82$ & $\mathbf{31.2}$ & $42.15$ & $\mathbf{46.01}$ & $63.79$ & $\mathbf{72.33}$ \\ \hline Teacher 3 & $81.60$ & $\mathbf{97.63}$ & $80.5$ & $\mathbf{84.10}$ & $22.40$ & $\mathbf{34.93}$ & $40.02$ & $\mathbf{42.15}$ & $64.05$ & $\mathbf{69.44}$ \\ \hline G-student & $\mathbf{98.71}$ & & $\mathbf{84.11}$ & & $\mathbf{37.68}$ & & $\mathbf{47.65}$ & & $\mathbf{70.12}$ & \\ \hline \end{tabular} \label{tab:LKD-Distillation-Efficiency} \end{table} \newline To make a better visualization for the LKD's performance, we reveal the result of LKD on EMNIST dataset in terms of confusion matrix as in Fig.~\ref{fig:ConfusionMatrix}. As it can be seen from the figure, the true predictions is represented by a diagonals of the matrices. A LKD performance is assumed to be well predicted when the value on diagonals is high (i.e., the diagonals' colors is darker), and the off-diagonals is low (i.e., the off-diagonals' colors are lighter). As we can see from the four figures, there are a significant reduce in the off-diagonals' darkness in the student performance (i.e., Fig.~\ref{fig:student-later-distill-evaluation}) comparing to the results in other teachers (i.e., Figures~\ref{fig:teacher1-prior-distill-evaluation}, \ref{fig:teacher2-prior-distill-evaluation}, and \ref{fig:teacher3-prior-distill-evaluation}). Therefore, we can conclude that our proposed MTKD techniques can surpass the teachers' performance as we mentioned in Section~\ref{sec:related-works}. \begin{figure}[!h] \centering \subfigure[\label{fig:teacher1-prior-distill-evaluation}]{\includegraphics[width=0.235\linewidth]{imageLib/Teacher1-preUpdate.pdf}} \subfigure[\label{fig:teacher2-prior-distill-evaluation}]{\includegraphics[width=0.235\linewidth]{imageLib/Teacher2-preUpdate.pdf}} \subfigure[\label{fig:teacher3-prior-distill-evaluation}]{\includegraphics[width=0.235\linewidth]{imageLib/Teacher3-preUpdate.pdf}} \subfigure[\label{fig:student-later-distill-evaluation}]{\includegraphics[width=0.235\linewidth]{imageLib/Student-postUpdate.pdf}} \caption{The illustrative results of LKD on EMNIST dataset. Confusion matrices show the effectiveness of joint distillation on regional models. Figures (a), (b), and (c) are the confusion matrix before distillation of teacher's predictions in region $1$, $2$, and $3$, respectively (see Appendix~\ref{sec:V-A-ExperimentSetup}). Fig.~(d) is the confusion matrix of predictions after distillation of student. The matrix diagonal demonstrates the true-predicted label of the model.} \label{fig:ConfusionMatrix} \end{figure} \textbf{Teachers can really educate student?} We evaluate LKD under different soft-loss coefficients $\lambda_1$ while the hard-loss factor is set at $\lambda_3 = 1-\lambda_1$ (the scaling value $\lambda_2$ is set to $0$). Thus, we can justify whether the robust performance of LKD comes from the joint distillation from teachers or just the exploitation of data-on-server training. We evaluate LKD on six scaling values $\lambda_1 = \{0, 0.001, 0.01, 0.1, 0.5, 1\}$. We evaluate on three dataset, including EMNIST, CIFAR-10, and CIFAR-100, and summarize the results in Tables~\ref{tab:LKD-DistillationTest-EMNIST}, \ref{tab:LKD-DistillationTest-CIFAR10} and \ref{tab:LKD-DistillationTest-CIFAR100} in \textbf{Appendices}. We can see from the three tables that the LKD cap off with $\lambda_3=0.01$. Especially, when $\lambda_3=1$ (which means the LKD acts as a vanilla cross-entropy optimizer), the model accuracy reduces notably. This means that the LKD only uses hard-loss as a backing force to aid the distillation. Thus, our LKD is appropriate and technically implemented. \textbf{Required training sample size for joint distillation.} To justify the ability of LKD under a shortage of training data, we evaluate LKD with six different data-on-server settings: $\sigma = \{1, 1/2, 1/4, 1/6, 1/8, 1/10\}$, where $\sigma$ is the sample ratio when compared with the original data-on-server as demonstrated in Table~\ref{tab:data-configuration}. As we can see from the implementation results in three Tables~\ref{tab:LKD-SampleTrainTest-EMNIST}, \ref{tab:LKD-SampleTrainTest-CIFAR10}, and \ref{tab:LKD-SampleTrainTest-CIFAR100} in \textbf{Appendices}, the F2L is demonstrated to perform well under a relatively small data-on-server. To be more specific, we only need the data-on-server to be $4$ times lower than the average data-on-client to achieve a robust performance compared with the vanilla FedAvg. However, we suggest using the data-on-server to be larger than the data from distributed clients to earn the highest performance for LKD. Moreover, due to the ability to work under unlabeled data, the data-on-server does not need to be all labeled. We only need a small amount of labeled data to aid the hard-loss optimizer. Thus, the distillation data on the server can be updated from distributed clients gradually. \section*{Broader Impact and Limitation} Due to the hierarchical framework of our proposed F2L, each sub-region acts like an independent FL process. Therefore, our F2L is integrable with other current methods, which means that we can apply varying FL techniques (e.g., FedProx, FedDyne, FedNova, HCFL \cite{2022-FL-HCFL}) into distinct sub-regions to enhance the overall F2L framework. Therefore, architecture search (e.g., which FL technique is suitable for distinct sub FL region) for the entire hierarchical network is essential for our proposed framework, which is the potential research for the future work. Moreover, the hierarchical framework remains unearthed. Therefore, a potentially huge amount of research directions is expected to be investigated (e.g., resource allocation \cite{2022-FL-ResourceAllocation-Compression, 2022-FL-StragglingPrivacy, 2021-FL-CodedFL,2021-FL-LargeScale}, and task offloading in hierarchical FL \cite{2021-FL-EnergyEfficiency}). However, our LKD technique still lacks of understanding about the teachers' models (e.g., how classification boundaries on each layer impact on the entire teachers' performance). By investigating in explainable AI, along with layer-wise performance, we can enhance the LKD, along with reducing the unlabeled data requirements for the distillation process in the future work. \section{Conclusion} In this research, we have proposed an FL technique that enables knowledge distillation to extract the-good-feature-only from clients to the global model. Our model is capable of tackling the FL's heterogeneity efficiently. Moreover, experimental evaluations have revealed that our F2L model outperforms all of the state-of-the-art FL baselines in recent years.
{'timestamp': '2022-10-03T02:05:31', 'yymm': '2209', 'arxiv_id': '2209.14520', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14520'}
arxiv
\section{Introduction} Legal information retrieval is a specialized task in natural language processing (NLP) that involve retrieving relevant legal documents \footnote{In this paper, "text" and "document" are used interchangeably} given a query. Compared with traditional text retrieval, legal text retrieval is more difficult since legal documents are often long and complicated. On the other hand, questions are often highly complex and need a person with good expertise to give the correct answer. Legal information retrieval for English documents has received a lot of attentions. COLIEE \footnote{\url{https://sites.ualberta.ca/~rabelo/COLIEE2022/}} is an annual competition about legal information extraction/entailment or JURIX \footnote{\url{http://jurix.nl/conferences/}} is an annual conference on legal AI. However, there are very few studies on Vietnamese legal information retrieval. Recent studies of Vietnamese legal text retrieval have been mainly on CNN architecture combined with attention mechanism \cite{kien-etal-2020-answering,nguyen2022toward}, using fine-tuned Multilingual transformer model like XLM-RoBERTa \cite{nguyen2022toward}. In recent years, monolingual transformer models like PhoBERT \cite{nguyen-tuan-nguyen-2020-phobert}, ViBERT \cite{tran2020improving} have beat the state-of-the-art (SOTA) in many NLP tasks in Vietnamese like Part-of-Speech(POS tagging), Named-Entity Recognition(NER), and Dependency Parsing(DP). Sentence-BERT(SBERT) \cite{reimers2019sentence} and models evolved from it \cite{thakur-etal-2021-augmented} have recently reached significant results on several tasks like semantic searching or information retrieval. In this paper, we focus on exploring fine-tuned sentence-transformer monolingual models for Vietnamese legal text retrieval. The contribution of this paper is two-fold. First, we propose a novel pipeline of multi-stage information retrieval based on sentence-transformer for Vietnamese legal texts. Experiments were conducted and the results show that the proposed pipeline significantly outperforms existing models. Second, empirical analyses of the effects of multiple factors including language models(LM), word segmentation methods, and ranking scores on the performance of information retrieval are performed. The results show that SPhoBERT-large language model, word-based segmentation, and system with combine ranking scores yield the best result in information retrieval for Vietnamese legal documents. \section{Background and Related Work} In this paper, we focus on answering legal queries at the article level. Given a legal query, our goal is to retrieve all the relevant articles, that can be used as the fundamental to answer the query. Many approaches, especially for ad-hoc text retrieval have been proposed, from past decades to recent years. \subsubsection{Non-neural approaches} These methods, decide relevance based on the frequency and occurrence of the words in the query and the documents. Non-neural approaches do not perform well in the semantic searching problem due to lexical mismatching in the answers. However, they are still useful for current SOTA models. BM25 \cite{10.1145/1031171.1031181} and tf-idf \cite{SALTON1988513} are well-known among all while BM25+\cite{robertson1994some} is currently the most effective in the approach. To overcome the lexical mismatching challenge, dense embedding is used to represent queries and documents. The main idea of this method was proposed with the LSI approach \cite{Deerwester1990IndexingBL}. \subsubsection{Attention mechanism approaches} Attention mechanism makes the model able to focus more on the main keywords or informative sentences in the original text. Kien and Nguyen et al. signed a simple attentive convolution neural network for Vietnamese legal text retrieval {\cite{kien-etal-2020-answering}}. Nguyen also used this method in his dissertation{\cite{nguyen2022toward}}. Their retrieval system can capture both local and global contexts to construct to build representation vectors. \subsubsection{Transformer cross-encoder approaches} BERT \cite{devlin2018bert} brings breakthroughs in NLP. The cross-encoder approach is the first widely approach of BERT in information retrieval. Both query and document will be passed simultaneously to the BERT network. Birch \cite{akkalyoncu-yilmaz-etal-2019-applying} - the system combines lexical matching and the cross-encoder approach for better performance. Several other studies \cite{lee-etal-2019-latent,karpukhin-etal-2020-dense,laskar-etal-2020-contextualized} applied the cross-encoder approach and reached significant results. BERT-PLI \cite{shao2020bert} is a retrieval system based on these approaches. However, these approaches require lots of time for training and costly computation resource. \subsubsection{Transformer bi-encoder approaches} Cross-encoder approaches are costly and time-consuming for training. Motivated by this, Reimers and Gurevych presented SBERT which uses SiameseBERT-network to represent semantically meaningful sentence embeddings. SBERT produce vector embedding for each sentence independently. When we want to compare two sentences, we just need to calculate the cosine similarity of the two existing vectors. The authors of SBERT train the bi-encoder from BERT and compare two input sentences using cosine similarity. For question answering(QA) or IR tasks, many studies developed from or applied SBERT \cite{SBERT-WK,condor2021automatic} and get high performance.According to recent research by Gao and Callan \cite{gao-callan-2021-Condenser} standard LMs' internal attention structure is not ready to use for dense encoders. The authors proposed a new transformer architecture, Condenser as an improvement for the bi-encoder approach. For applying bi-encoder approach for Vietnamese, to the best of our knowledge, there is only one paper \cite{ha2021utilizing} on bi-encoder approach and the solution \footnote{\url{https://github.com/CuongNN218/zalo_ltr_2021}} for an annual competition of artificial intelligence. \section{Sentence-transformers based Multi-stage information retrieval for Vietnamese legal text} The general idea of our approach is to use both lexical matching and semantic searching to improve the performance of our system. For lexical matching, we used BM25+ in package rank\_bm25 library \footnote{\url{https://pypi.org/project/rank-bm25/}}. For semantic searching, we trained sentence-transformer models by contrastive learning. For each query in training dataset, the label of the relevant article to query is 1 while the negative sample is 0. To get the negative samples, we took the top-k highest ranking score in the previous training round. Then the samples for each query was k+(number of positive articles)as positive(pos) and negative(neg) pairs. We used BM25+ and then trained the sentence-transformer model for three rounds. Our pipeline for training are shown in Figure \ref{pipeline for training} \begin{figure} \raggedright \centering \includegraphics[scale=0.6]{figures/training_process.png \caption{Our proposed pipeline for training} \label{pipeline for training} \end{figure} \section{Experiments} \subsection{Datasets} The dataset used in our paper is from the original dataset in the paper published by Kien et al. \cite{kien-etal-2020-answering}. We clean the data to reduce the noise in the legal corpus. The removed laws and articles do not appear in QA dataset while QA dataset remains the original so that data cleaning does not affect the evaluation results. Finally, we obtained the legal corpus containing 8,436 documents with 114,177 articles. In legal corpus, we concatenated title and text in each article as a "very long" sentence. \begin{table} \parbox{.45\linewidth}{ \centering \caption{Distribution of articles length by syllables} \label{len_syl} \begin{tabular}{ccc} \hline Length & Amount & Proportion\\ \hline < 100 & 32950 & 28.86\% \\ \hline 101 - 256 & 43923 & 38.47\% \\ \hline 257 - 512 & 23799& 20.84\%\\ \hline 513+ & 9483 & 11.83\% \\ \hline \end{tabular} } \hfill \parbox{.45\linewidth}{ \centering \caption{Distribution of articles length by words} \label{len_word} \begin{tabular}{ccc} \hline Length & Amount & Proportion\\ \hline < 100 & 43763 & 38.33\% \\ \hline 101 - 256 & 42800 & 37.48\% \\ \hline 257 - 512 & 18636& 16.33\%\\ \hline 513+ & 6111 & 7.86\% \\ \hline \end{tabular} } \end{table} Not like English, Vietnamese syllables and word tokens are different. For example, 4-syllable written text "Bài báo khoa học" (scientific paper) form 2 words "Bài\_báo \raisebox{-0.4ex}{\footnotesize{paper}} khoa\_học \raisebox{-0.4ex}{\footnotesize{scientific}}". We used VNCoreNLP \cite{vu-etal-2018-vncorenlp} for word segmentation. We divided the corpus into 4 types of lengths: < 100, 101-256,257-512, and 513+. 256 is the maximum number of tokens supported by PhoBERT while 512 is the maximum number of tokens supported by ViBERT. Table \ref{len_syl} and table \ref{len_word} show percentage of articles based on length. For QA dataset, we found that only 1,709 articles (about 1.5\% of the whole articles) in the legal corpus appear and about 95\% of questions in both training and testing datasets have one to three relevant articles. \subsection{Experimental procedure} We use a single NVIDIA Tesla P100 GPU via Google Colaboratory to train all the models. Figure \ref{experiment procedure} presents an overview of the experimental procedure in this paper. \begin{figure}[!h] \raggedright \centering \includegraphics[scale=0.6]{figures/procedure.png \caption{Experiment procedure} \label{experiment procedure} \end{figure} \subsubsection{Monolingual pre-trained models} \begin{itemize} \item PhoBERT pre-training approach is based on RoBERTa \cite{Liu2019RoBERTaAR} which is using Dynamic Masking to create masked tokens. Because two PhoBERT versions are trained on large-scale Vietnamese dataset, they perform great results on several NLP tasks in Vietnamese like NER, POS tagging, and DP. \item ViBERT leverages checkpoint from mBERT \cite{devlin2018bert} and continues training on 10 GB of Vietnamese news data. ViBERT pre-training approach based on BERT which has model architecture is a multilayer bidirectional Transformer encoder. ViBERT now is supporting sequence lengths up to 512 tokens, this is an advantage compared to only 256 tokens supported by PhoBERT. \end{itemize} \subsubsection{Word-level and syllable-level approaches} In a field that contains many semantic challenges such as law, we want to evaluate how words and syllables of Vietnamese affect the results of models. We trained transformer models on both word-level and syllable-level independently in every below step. \subsubsection{Fine-tuning monolingual language models} We used our legal corpus to fine-tune masked language modeling of monolingual language models. We set gradient\_accumulation\_steps = 4, train\_batch\_size = 8, eval\_batch\_size = 8 and epochs = 20. \subsubsection{Fine-tuning Condenser} After training mask language modeling, we used both versions of PhoBERT to train Condenser. We used source code \footnote{\url{ https://github.com/luyug/Condenser}} for creating data in Condenser's form and fine-tuning Condenser from PhoBERT. \subsubsection{Lexical matching} For lexical matching, we used BM25+. VNCoreNLP was used for word segmentation. Stopwords were also removed to make the model focus on important words. Our goal after this step is to get the list of the top highest lexical similarity articles for each query. \subsubsection{Training sentence-transformer } We trained 3 rounds for sentence-transformer. The choosing method we mentioned above, for short, we will call the number of negative sample each round is k. In the first round, we picked 35 negative samples from BM25+. These negative samples almost are high lexical similarity to queries but low semantic similarity. In the second round, we picked 20 negative samples from the first round. These negative samples have better semantic similarity to queries. In the third round, we pick 15 negative samples from the second round. These negative samples are really close semantic to queries. We set batch\_size=8, epochs = 4, learning\_rate = 1e-5. For loss function, we used contrastive loss \cite{hadsell2006dimensionality} \subsubsection{Evaluation metrics} The first measure we use to evaluate the performance of the system is (macro)recall@20, where 20 is the number of the top selected articles. The second evaluation metric we use is F2. The F2-measure is shown below: \[Precision\raisebox{-0.7ex}{\footnotesize{i-th}} = \frac{\text{the number of correctly retrieved articles of query i-th}}{\text{the number of retrieved articles of query i-th}} \] \[Recall\raisebox{-0.7ex}{\footnotesize{i-th}} = \frac{\text{the number of correctly retrieved articles of query i-th}}{\text{the number of relevant articles of query i-th}} \] \[F2\raisebox{-0.7ex}{\footnotesize{i-th}} = \frac{\text{5*Precision\raisebox{-0.7ex}{\footnotesize{i-th}}*Recall\raisebox{-0.7ex}{\footnotesize{i-th}}}}{\text{4*Precision\raisebox{-0.7ex}{\footnotesize{i-th}}+Recall\raisebox{-0.7ex}{\footnotesize{i-th}}}} \] \[F2= \text{average of (F2\raisebox{-0.7ex}{\footnotesize{i-th}})} \] \subsection{Results of BM25+ and sentence-transformer} The models we selected can only compute scores between query-rule pairs. The performance of the model on F2 will decrease if we choose too many articles. In order to get good results on the F2 measure, we have to set a suitable threshold. Let the highest score between each query and all articles as highest\_score. The articles would be chosen if their scores in range [highest\_score-threshold, highest\_score]. For short, we rewrite sentence-transformer Condenser trained from PhoBERT-base and PhoBERT-large respectively SConPBB and SConPBL in the below table. \begin{table} \caption{Results of BM25+ and sentence-transformer} \label{single model} \centering \begin{tabular}{|l|l|l|l|c|l|c|} \hline \textbf{Model} & \textbf{Recall@20} & \textbf{F2} \\ \hline BM25+ & 0.557 & 0.221 \\ \hline SPhoBERT-base(syl) & 0.944 & 0.700\\ \hline SConPBB(syl) & 0.953 & 0.697 \\ \hline SPhoBERT-large(syl) & 0.940 & 0.715\\ \hline SConPBL(syl) & 0.953 & 0.719 \\ \hline SViBERT(syl) & 0.942 & 0.679\\ \hline SPhoBERT-base(word) & 0.954 & 0.721\\ \hline SConPBB(word) & 0.957 & 0.704 \\ \hline SPhoBERT-large(word) & 0.954 & 0.727\\ \hline SConPBL(word) & 0.954 & 0.724 \\ \hline SViBERT(word) & 0.921 & 0.669\\ \hline \end{tabular} \end{table} The result in Table \ref{single model} shows that: sentence-transformer models outperform BM25+. However, we want to build a retrieval system with both lexical matching and semantic searching approaches. We consider the combining score of these two approaches. More than 95\% of questions have one to three relevant articles. We visualized the average score of the top 3 highest scores of BM25+. \begin{figure}[!h] \centering \includegraphics[scale=0.7]{figures/bm25_top3.png} \caption{Average score of top 3 highest scores of BM25+} \label{fig:top3_BM25_avg} \end{figure} \subsection{Retrieval system using BM25+ and sentence-transformer} Sentence-transformer uses the cosine similarity(cos\_sim) of the two vectors query and article to rank.Cos\_sim is always in range [-1,1]. According to Figure \ref{fig:top3_BM25_avg} average score of BM25+ is much larger than cos\_sim while semantic approach makes a big gap. Combining score for ranking in previous work like (1- $\alpha $)*lexical\_score + $\alpha$ * semantic\_score will not work or take much time to fine the $\alpha$. We proposed two combining score: sqrt(BM25\_score)*cos\_sim and BM25\_score*cos\_sim to rank our retrieval systems. Similar to single model, we used suitable threshold for retrieval system to get best results on F2. For short, we named the retrieval system by a name of sentence-transformer model within it. \begin{table}[!h] \caption{Results of retrieval systems } \label{retrieval_sys} \centering \begin{tabular}{|l|c|c|c|c|c|c|} \hline &\multicolumn{2}{| c |}{sqrt(BM25\_score)*cos\_sim} &\multicolumn{2}{| c |}{BM25\_score*cos\_sim}\\ \hline \textbf{System} & \textbf{Recall@20} & \textbf{F2} & \textbf{Recall@20} & \textbf{F2} \\ \hline SPhoBERT-base(syl) & 0.958 & 0.715 & 0.960 & 0.703\\ \hline SConPBB(syl) & 0.967 & 0.712 & 0.965 & 0.692 \\ \hline SPhoBERT-large(syl) & 0.951 & 0.726 & 0.955 & 0.706\\ \hline SConPBL(syl) & 0.953 & 0.729 & 0.956 & 0.710 \\ \hline SViBERT(syl) & 0.951 & 0.695 & 0.963 & 0.684\\ \hline \hline SPhoBERT-base(word) & 0.963 & 0.725 & 0.964 & 0.706\\ \hline SConPBB(word) & 0.962 & 0.719 & 0.964 & 0.700 \\ \hline SPhoBERT-large(word) & 0.967 & \textbf{0.741} & \textbf{0.970} & 0.721\\ \hline SConPBL(word) & 0.960 & 0.738 & 0.967 & 0.718 \\ \hline SViBERT(word) & 0.948 & 0.683 & 0.950 & 0.661\\ \hline \end{tabular} \end{table} Based on the results from Tables \ref{single model}, \ref{retrieval_sys}, we had three observations: \begin{itemize} \item If LMs were pre-trained on word-level data like PhoBERT and CondenserPhoBERT, trained sentence-transformer models on word-level data bring better results. \item If LM were pre-trained on syllable-level data like ViBERT, trained sentence-transformer model on syllable-level data bring better results. \item The system with both lexical matching and semantic searching performances better than sentence-transformer model within it. \item Sqrt(BM25\_score)*cos\_sim is the best ranking score for the system on F2 while BM25\_score*cos\_sim is the best on recall@20. \end{itemize} \subsection{Comparison with previous Vietnamese legal text retrieval systems} Our best performing system on F2 is SPhoBERT-large(word) system with ranking score: sqrt(BM25\_score)*cos\_sim. On Recall@20, our best performing system is SPhoBERT-large(word) system with ranking score: BM25\_score*cos\_sim. For short, we call our best retrieval system on F2 is our best system 1 and our best retrieval system on Recall@20 is our best system 2. \begin{table} \parbox{.45\linewidth}{ \centering \caption{Comparison with previous Vietnamese legal text retrieval systems on F2} \label{CompareF2} \begin{tabular}{|l|c|} \hline \textbf{System} & \textbf{F2} \\ \hline Our best system 1 & \textbf{0.741}\\ \hline Attentive CNN \cite{nguyen2022toward} & 0.4774 \\ \hline XLM-RoBERTa \cite{nguyen2022toward} & 0.2006\\ \hline \end{tabular} } \hfill \parbox{.45\linewidth}{ \centering \caption{Comparison with previous Vietnamese legal text retrieval systems on Recall@20} \label{CompareRecall@20} \begin{tabular}{|p{3.5cm}|c|} \hline \textbf{System} & \textbf{Recall@20} \\ \hline Our best system 2 & \textbf{0.970}\\ \hline ElasticSearch + Attentive CNN \cite{kien-etal-2020-answering} & 0.825 \\ \hline Birch(256 first words) \cite{kien-etal-2020-answering} & 0.763\\ \hline Birch(title) \cite{kien-etal-2020-answering} & 0.783\\ \hline \end{tabular} } \end{table} Table \ref{CompareF2} and Table \ref{CompareRecall@20} illustrate the results of our best systems compared with the previous systems \cite{kien-etal-2020-answering,nguyen2022toward}. It is proved that our system yields the best performance on both metrics. \subsection{Analysis by the number of relevant articles related to queries} We used best retrieval system from each sentence-transformer model to analysis effect of the number of relevant articles to queries in both metrics. \begin{figure}[!h] \raggedright \centering \includegraphics[scale=0.45]{figures/F2_num_art.png \caption{Effect of the number of relevant articles to queries on F2} \label{F2_num} \end{figure} \begin{figure}[!h] \raggedright \centering \includegraphics[scale=0.45]{figures/recall20_num_art.png \caption{Effect of the number of relevant articles to queries on recall@20} \label{recall_num} \end{figure} Our observations based on the results from Figures \ref{F2_num}, \ref{recall_num}: \begin{itemize} \item The more relevant articles relate to the query, the lower F2 of the systems there. Part of the reason for this is because we set the threshold pretty low. So the range [highest\_score-threshold, highest\_score] would not be large enough to cover many the relevant articles. \item Queries with (3,5,7) relevant articles make the systems with recall@20 significantly lower than queries with (2,4,6) relevant articles. Most of the recall@20 results of systems are pulled down because of queries with (2,4,6) relevant articles. \item SViBERT system achieves much better results than other systems on the recall@20 measure in queries with (5,6) relevant articles. \item SPhoBERT-large achieved the best results because it outperformed other systems in queries with (3,5,7) relevant articles. \end{itemize} \subsection{Data-driven error analysis} There are two main errors we found during the experiment. First, wrong crawling relevant articles for query in the dataset. After a thorough discussion, we all agreed that the answer to this question was wrong. The example in Table \ref{tab:wrong_crawling} shows that relevant article was wrongly collected. The question is about person who is obliged to execute the judgment returns the non-implementation papers while relevant article is about principles of auction of land use rights. We did not find any correlation between the question and the answer. \begin{table} \caption{Example of wrong crawling relevant articles} \centering \begin{tabularx}{\textwidth}{|>{\hsize=.15\hsize\centering\arraybackslash}X|X|>{\hsize=.1\hsize\centering\arraybackslash}X|} \cline{1-2} \textbf Q/A/AC & \multicolumn{1}{c|}{\textbf{Content}}\\ \cline{1-2} Query(Q) & Người có nghĩa vụ phải thi hành án trả giấy tờ không thực hiện thì cơ quan thi hành án dân sự cưỡng chế như thế nào ? \textit({If the person who is obliged to execute the judgment returns the non-implementation papers, how does the civil judgment enforcement agency coerce ?)}\\ \cline{1-2} Answer(A) & Article 117 in law id:45/2013/QH13 \\ \cline{1-2} Article content (AC) & Nguyên tắc đấu giá quyền sử dụng đất \textit({Principles of auction of land use rights)} \newline 1 . Đấu giá quyền sử dụng đất được thực hiện công khai , liên tục , khách quan , trung thực , bình đẳng , bảo vệ quyền và lợi ích hợp pháp của các bên tham gia. \textit({Auction of land use rights is conducted publicly, continuously, objectively, honestly, equally, protecting the legitimate rights and interests of the participating parties)} \newline 2. Việc đấu giá quyền sử dụng đất phải đúng trình tự , thủ tục theo quy định của pháp luật về đất đai và pháp luật về đấu giá tài sản\textit({The auction of land use rights must comply with the order and procedures prescribed by the law on land and the law on asset auction.)} \\ \cline{1-2} \end{tabularx} \label{tab:wrong_crawling} \end{table} Second, very hard semantic queries and relevant articles. These queries often miss-matching lexical with their relevant articles. Both of them are also long and contain difficult specialized words. To be able to understand the semantic of these queries and articles will still be a big challenge for retrieval systems. \begin{table}[!h] \centering \caption{Example of very hard semantic query and relevant articles} \label{tab:hard_semantic} \begin{tabularx}{\textwidth}{|>{\hsize=.15\hsize\centering\arraybackslash}X|X|>{\hsize=.1\hsize\centering\arraybackslash}X|} \cline{1-2} \textbf Q/A/AC & \multicolumn{1}{c|}{\textbf{Content}}\\ \cline{1-2} Query(Q) & Có thể kê biên tài sản riêng của giám đốc để đảm bảo trả nợ cho công ty không ? \textit({Can the director's personal assets be distraint to ensure the repayment of the company's debt ?)}\\ \cline{1-2} Answer(A) & Article 74 in law id:91/2015/QH13 \\ \cline{1-2} Article content (AC) & Pháp nhân \newline 1. Một tổ chức được công nhận là pháp nhân khi có đủ các điều kiện sau đây \textit{(An organization is recognized as a "pháp nhân" when the following conditions are satisfied)} a ) Được thành lập theo quy định của Bộ Luật này , luật khác có liên quan; \textit({a) Established under the provisions of this law and other relevant laws;)} b ) Có cơ cấu tổ chức theo quy định tại Điều 83 của bộ luật này;\textit{(b) Having an organizational structure as prescribed in Article 83 of this law;)} c) Có tài sản độc lập với cá nhân , pháp nhân khác và tự chịu trách nhiệm bằng tài sản của mình ; \textit{(c) Having assets independent of other individuals or legal entities and taking responsibility for their own property;)} \textbf{c) Có tài sản độc lập với cá nhân , pháp nhân khác và tự chịu trách nhiệm bằng tài sản của mình ; \textit{(c) Having assets independent of other individuals or legal entities and taking responsibility for their own property;)}} d ) Nhân danh mình tham gia quan hệ pháp luật một cách độc lập. \textit{(d) Independently participate in legal relations in their own name.)} \newline 2 . Mọi cá nhân , pháp nhân đều có quyền thành lập pháp nhân , trừ trường hợp luật có quy định khác . \textit{(2 . Every individual and juridical person has the right to establish a juridical person, unless otherwise provided for by law.)}\\ \cline{1-2} \end{tabularx} \end{table} In Table \ref{tab:hard_semantic}, "pháp nhân" is a specialized word in Vietnamese legal. To the best of our knowledge, the word has the closest meaning to it in English is corporation. We found the answer for the query in clause c) of this article. This article and query are lexical mismatching, so retrieval system will not work as well as sentence-transformer model. We used SPhoBERT-large which is the best semantic searching model to evalute cos\_sim between question and clause c) only. The result is 0.351. This shows that our model is still limited in the face of questions and answers with high semantic difficulty. \section{Conclusion and future work} In this paper, we proposed multi-stage information retrieval based on sentence-transformers for Vietnamese legal texts. We also compare the best performance model to the Attentive CNN model (previous SOTA in this QA dataset). The results indicate that our models outperform previous SOTA in both evaluation metrics. In future work, we will try other techniques for long articles like summary, and keyword extraction. We will also improve the models to learn the to learn the relationship between queries and rules of very high semantic complexity. \bibliographystyle{splncs04}
{'timestamp': '2022-09-30T02:05:47', 'yymm': '2209', 'arxiv_id': '2209.14494', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14494'}
arxiv
\section{Introduction} The sharing of medical datasets is essential in enabling the cross-hospital flow of medical information and improving the quality of medical services~\cite{kumar2021integration}. However, sharing healthcare datasets between different hospitals faces several thorny issues. Firstly, privacy protection has been a severe issue hindering the process when sharing medical image datasets from different hospitals~\cite{kaissis2020secure}. Second, sharing large-scale high-resolution medical image datasets increases transmission and storage costs~\cite{zhou2021models}. Therefore, the solution to these problems will significantly promote the development of medical dataset sharing. \par Dataset distillation can synthesize a small dataset such that models trained on it achieve comparable performance with the original large dataset~\cite{wang2018datasetdistillation}. Although dataset distillation has been proposed for distilling some simple datasets, such as MNIST and CIFAR10, its effectiveness in high-resolution complex medical datasets has not yet been proved~\cite{zhao2021datasetcondensation}. Medical dataset distillation may have potential advantages for solving the existing medical dataset sharing problems~\cite{li2020soft}. For example, the size of distilled medical image datasets can be significantly compressed, and distilled images generated from noise are automatically anonymized~\cite{dong2022privacy}. Therefore, it is desirable to explore the potential of dataset distillation for medical dataset sharing and contribute to real-world applications. \par In this paper, we propose a novel dataset distillation-based method for medical dataset sharing. COVID-19 and its variants have rapidly spread worldwide, influencing the health and life of billions of people~\cite{mofijur2021impact}. X-ray is widely used in clinical because of its high speed and low cost. Detecting COVID-19 from chest X-ray images is perhaps one of the fastest and easiest ways~\cite{minaee2020deep}. However, sharing COVID-19 datasets between different hospitals also has the above-mentioned problems. We perform experiments on a COVID-19 chest X-ray image dataset to prove the effectiveness of the proposed method. Experimental results show that we can achieve high COVID-19 detection performance even using scarce anonymized chest X-ray images, hopeful of solving existing medical dataset sharing problems. The concept of this study is shown in Figure~\ref{fig1}. \begin{figure}[t] \centering \includegraphics[width=13.5cm]{Image/Concept1.png} \caption{The concept of this study.} \label{fig1} \end{figure} \section{Methodology} \begin{table}[t] \centering \caption{COVID-19 detection accuracy when using different numbers of distilled images. IPC denotes images per class.} \label{tab1} \begin{tabular}{lcccccc} \hline IPC & 1 & 2 & 3 & 5 & 10 & 20 \\\hline Accuracy & 52.5\% & 76.4\% & 77.0\% & 79.3\% & 82.2\% & \bfseries{82.7\%} \\\hline \end{tabular} \end{table} The objective of our method is to have the parameters of the student network trained on the distilled dataset match the parameters of the teacher networks trained on the original dataset. Before the distillation process, we first train $T$ teacher networks on the original COVID-19 dataset $\mathcal{D}$ and obtain their parameters~\cite{cazenavette2022dataset}. These time sequences of parameters $\{\theta_{i}\}^{I}_{0}$ are defined as teacher parameters. Also, network parameters trained on the distilled dataset $\mathcal{D}_{c}$ at each training step $i$ are defined as student parameters $\tilde{\theta}_{i}$. Our method aims to distill chest X-ray images that induce network parameters similar to those learned from the original COVID-19 dataset (given the same initial values). In the distillation process, student parameters are initialized as $\tilde{\theta}_{i}=\theta_{i}$ by sampled from one of the teacher parameters at a random step $i$. Then we perform gradient descent updates on the student parameters $\tilde{\theta}$ with respect to the cross-entropy loss $\ell$ of the distilled dataset $\mathcal{D}_{c}$ as follows: \begin{equation} \tilde{\theta}_{i+j+1} = \tilde{\theta}_{i+j} - \alpha\nabla\ell(\mathcal{A}(\mathcal{D}_{c});\tilde{\theta}_{i+j}), \end{equation} where $j$ and $\alpha$ represent the number of gradient descent updates and the trainable learning rate, respectively. $\mathcal{A}$ represents a differentiable data augmentation module that can improve the distillation performance, which was proposed in~\cite{zhao2021differentiatble}. Since the data augmentation used during distillation is differentiable, it can be propagated back through the augmentation layers to the distilled dataset. Then we get the teacher parameters $\theta_{i+K}$ from $K$ gradient descent updates after the parameters used to initialize the student network. The final loss $\mathcal{L}$ calculate the normalized $L_{2}$ loss between updated student parameters $\tilde{\theta}_{i+J}$ and teacher parameters $\theta_{i+K}$ as follows: \begin{equation} \mathcal{L} = \frac{|| \tilde{\theta}_{i+J}-\theta_{i+K} ||^{2}_{2}} {|| \theta_{i}-\theta_{i+K} ||^{2}_{2}}, \end{equation} Finally, we minimize the loss $\mathcal{L}$ and backpropagate the gradient through all $J$ updates to the student network for obtaining the optimized distilled dataset $\mathcal{D}^{\ast}_{c}$. Since the distilled chest X-ray images are generated from noise and have different distribution or visual similarities from the original images, they are automatically anonymized. After obtaining the distilled dataset $\mathcal{D}^{\ast}_{c}$, we can share it with different hospitals and train neural networks for high-accuracy COVID-19 detection. \section{Experiments} \begin{table}[t] \centering \caption{COVID-19 detection accuracy of different methods.} \label{tab2} \begin{tabular}{lccccccc} \hline Method & \bfseries{Ours} & SKD & BYOL & SimSiam & MAE & Transfer & From Scratch \\\hline Accuracy & \bfseries{82.7\%} & 74.2\% & 68.3\% & 66.8\% & 62.3\% & 53.9\% & 28.4\% \\\hline \end{tabular} \end{table} \begin{figure}[t] \centering \includegraphics[width=12cm]{Image/Distilled_Images.png} \caption{Examples of real and distilled images.} \label{fig2} \end{figure} The dataset used in our study has four classes, i.e., COVID-19 (C), Lung Opacity (L), Normal (N), and Viral Pneumonia (V)~\cite{rahman2021exploring}. The number of images in each class is 3616, 6012, 10192, and 1345, respectively. The resolution of chest X-ray images is 224 $\times$ 224, and we resized it to 112 $\times$ 112 for distillation or training networks. The number of pre-trained teacher networks $T$ was set to 100. And we set the number of distilled images as 1, 2, 3, 5, 10, and 20 images per class. The network structure used in this study is a simple ConvNet with depth-5 and width-128, which is often used in the dataset distillation task. For comparative methods, we used several SOTA self-supervised learning methods, including SKD~\cite{li2022self}, BYOL~\cite{grill2020bootstrap}, SimSiam~\cite{chen2021exploring} and MAE~\cite{he2022masked}. We also used transfer learning from ImageNet~\cite{deng2009imagenet} and training from scratch as baseline methods. We randomly selected 42 images per class (1\% of the training set) for these comparative methods. Except for the MAE method used ViT-Large~\cite{dosovitskiy2020vit}, all other methods used ResNet50~\cite{he2022masked} as the backbone network. \par The test accuracy of COVID-19 detection are shown in Tables~\ref{tab1} and~\ref{tab2}. From Table~\ref{tab1}, we can see that the accuracy of our method increased accordingly as the number of distilled images grew. Table~\ref{tab2} shows that our method achieved high COVID-19 detection accuracy even when using scarce distilled chest X-ray images. Furthermore, our method drastically outperformed other SOTA methods with a simpler network and fewer training images. Figure~\ref{fig2} shows some examples of real and distilled images. We can see that the distilled images are entirely visually different from the original images, which shows the anonymization effectiveness of the proposed method. \section{Conclusion} We have proposed a novel dataset distillation-based method for medical dataset sharing. Since the size of the distilled medical image dataset has been significantly compressed and the images are also anonymized, the sharing of medical datasets between different hospitals will be more efficient and secure. Experimental results on a COVID-19 chest X-ray image dataset show the advantage of our method compared to other SOTA methods. \section*{Potential Negative Societal Impact} The findings of this paper show the effectiveness of dataset distillation for medical dataset sharing. Although the experimental results are promising, the proposed method should be verified on other medical datasets of different diseases for any potential bias. Additionally, since the computational overhead of training and storing teacher parameters is relatively high, which may not necessarily be available in low-resource settings. \section*{Acknowledgement} This study was supported in part by AMED Grant Number JP21zf0127004, the Hokkaido University-Hitachi Collaborative Education and Research Support Program, and the MEXT Doctoral Program for Data-Related InnoVation Expert Hokkaido University (D-DRIVE-HU) Program. This study was conducted on the Data Science Computing System of Education and Research Center for Mathematical and Data Science, Hokkaido University. \bibliographystyle{plainnat}
{'timestamp': '2022-10-03T02:07:19', 'yymm': '2209', 'arxiv_id': '2209.14603', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14603'}
arxiv
\section{Introduction} \label{sec:Introduction} \begin{figure}[t] \centering \includegraphics[width=0.9\linewidth]{Figures/Fig1.pdf} \caption{ Motion transfer results. (a) is generated by traditional motion transfer model trained on source domain videos only and (b) is generated by our proposed MAA model} \label{fig:figure-1} \end{figure} Given a source image and a driving video of the same object, motion transfer~(\textit{a.k.a.} image animation) aims to generate a synthesized video that mimics the motion of the driving video while preserving the appearance of the source image. It recently received increasing attention, due to its potential applications in real-world scenarios, such as face swapping\cite{wiles2018x2face,siarohin2019first,xu2021move}, dance transferring\cite{chan2019everybody}, \emph{etc}\onedot} \def\vs{\emph{vs}\onedot. Many works in this field focus on the single-domain motion transfer \cite{siarohin2019animating,siarohin2019first,siarohin2021motion}, where the driving video and source image come from the same domain. However, in real applications, there are often requirements to transfer motion among different domains. For example, as shown in Fig~\ref{fig:figure-1}, the e-commerce companies might be interested in animating a fashion model to attract consumers by learning the robot dance from a Mixamo character. However, due to the differences in shape and cloth between the Mixamo character and the fashion model, traditional single-domain motion transfer approaches often produce notable artifacts in the synthesized image (\emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, failing to preserve the human shape of the fashion model (\emph{cf}\onedot} \def\Cf{\emph{C.f}\onedot~Fig.~\ref{fig:figure-1} (a))). To this end, in the present work, we study the cross-domain motion transfer problem and propose a novel Motion and Appearance Adaptation (MAA) approach to address this issue. Specifically, traditional motion transfer methods usually take two arbitrary frames of the same video as source image and driving frame for learning motion with a reconstruction loss, because the two frames share the same appearance and shape. However, such training mode cannot be directly applied to the cross-domain motion transfer because no ground-truth is available. In our proposed MAA approach, we build a cyclic reconstruction pipeline inspired by CycleGAN\cite{zhu2017unpaired} and cross-identity\cite{jeon2020cross}. In particular, given a source image and a driving frame obtained from different domains, we first obtain a synthesized image using a basic motion transfer (MT) model, \emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, the model in\cite{siarohin2019first} or\cite{siarohin2021motion}. We next arbitrarily take another frame from the driving video as the source image and the synthesized image as a driving frame, and input them into the basic MT model to produce the second synthesized image. Because the second synthesized image should mimic both the motion and appearance of original driving frame, a cyclic reconstruction loss can be applied for training. In this way, we obtain a motion transfer model for cross-domain motion transfer. Moreover, since the source image and driving frame are drawn from different domains, while the topology of the object structure (\emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, the skeleton) is similar, the configurations of the object structure (\emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, the human body shape) often deviate. When doing motion transfer, we should be aware of such difference and keep the object shape of synthesized image be similar to the source image while unaffected by the driving frame. For this purpose, we design a shape-invariant motion adaptation module and a structure-guided appearance consistency module to regularize the basic motion transfer model. Specifically, in the shape-invariant motion adaptation module, we design an angle consistency loss to enforce the angles of the corresponding object parts in the synthesized image to be similar to those of the driving frame, such that the motion of this frame can be mimicked well without changing the object shape. In the structure-guided appearance consistency module, we extract image patches from the synthesized image and the source images based on the object structure and enforce the corresponding patches to be similar; this ensures that the appearance of the synthesized image and the source image are consistent, even though the motions of the two images are different. The entire process can be trained in an end-to-end manner, and finally our MAA model can effectively perform motion transfer across domains while also properly preserving the shape and appearance of the object (\emph{cf}\onedot} \def\Cf{\emph{C.f}\onedot Fig.~\ref{fig:figure-1} (b)). We validate our proposed approach on two pairs of datasets: the human body datasets Mixamo-Video to Fashion-Video\cite{zablotskaia2019dwnet} and the human face datasets Vox-Celeb\cite{nagrani2017voxceleb} to Cufs\cite{wang2008face}. Extensive experimental results demonstrate the effectiveness of our proposed approach. Our source code will be released soon. \section{Related Work} \label{sec:Related Work} \textbf{Motion Transfer}: Current motion transfer approaches can be categorized into two types: model-based and model-free approaches. The model-based approaches mainly focus on human body pose transfer\cite{ma2017pose,ma2018disentangled,balakrishnan2018synthesizing}, which utilize a pre-trained pose estimator or key point detector to extract the pose of driving image as a guidance information. And a number of researchers followed such setting\cite{liu2019liquid,ren2020deep,zhu2019progressive,li2019dense,huang2021few,kappel2021high}. Moreover, a series of works apply this model-based pattern on human facial expression transfer\cite{burkov2020neural,chen2020puppeteergan,gu2020flnet}. Like body pose transfer, they also employ a pre-trained facial landmark detector to model the facial expression. The model-free approaches\cite{siarohin2019animating,siarohin2019first,jeon2020cross,siarohin2021motion,tao2022structure} does not rely on pre-trained third-party models, and extend the model-based method to arbitrary objects. Aliaksandr \emph{et al}\onedot\cite{siarohin2019animating} proposed a model-free motion transfer model Monky-Net that can apply motion transfer on arbitrary objects with an unsupervised key point detector trained by reconstruction loss \cite{jakab2018unsupervised}. Aliaksandr \emph{et al}\onedot\cite{siarohin2019first} further improved Monkey-Net to FOMM to solve the large motion problem. The unsupervised key point detector is also utilized in FOMM, with local affine transformations being added for motion modeling. A generator module is utilized to generate final result with the warped source image feature. Subin \emph{et al}\onedot\cite{jeon2020cross} proposed pose attention mechanism with an unsupervised key point detector to model motion. Recently, Aliaksandr \emph{et al}\onedot\cite{siarohin2021motion} improved FOMM with an advanced motion model and background motion model to MRAA. Although promising results are achieved for the single domain motion transfer, these methods might suffer from performance degradation when the source image and driving video come from different domains, where a considerable appearance difference often exists. Recently, Wang \emph{et al}\onedot\cite{wang2020self} used encoder based motion transfer approach which can be applied to the cross-domain scenario, and better results are achieved compared with the single domain motion transfer Monkey-Net model. In contrast, our proposed MAA approach is a general framework, and can integrate traditional motion transfer model like FOMM and MRAA to produce excellent results for large motion. \textbf{Domain Adaptation:} Many works have been proposed to handle the scenario where the training and test data comes from different domains for different computer vision tasks , \emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, classification~\cite{DMCD}, semantic segmentation~\cite{Liu_2022_CVPR,Liu_2021_ICCV,9616392_Dong,What_Transferred_Dong_CVPR2020}, object detection~\cite{chen2018domain,deng2021unbiased}, pose estimation\cite{li2021synthetic,zhang2021keypoint}, \emph{etc}\onedot} \def\vs{\emph{vs}\onedot. A majority of works were developed to learn domain-invariant features using the domain adversarial learning~\cite{tzeng2017adversarial,ganin2015unsupervised}. Cross-domain motion transfer is more complicated, since we need to capture motion from the the driving video while preserving the appearance from the source domain. Nevertheless, the strategies proposed in traditional domain adaptation works might be useful to help motion transfer. For example, we apply the cyclic training pipeline inspired by CycleGAN~\cite{zhu2017unpaired}, and build our patch-based appearance consistency module based on Patch-GAN~\cite{isola2017image}. \section{Methodology} \label{sec:Methodology} In this section, we present our Motion and Appearance Adaptation approach for cross-domain motion transfer. Formally, let us denote a driving video as $V_d = \{I_d^{i}|_{i=1}^T\}$, where each $I_d^i$ is a driving frame, while a source image is denoted as $I_s$; thus, the task of motion transfer is to synthesize a new video $\hat{V}_d = \{\hat{I}_d^{i}|_{i=1}^T\}$, where each $\hat{I}_d$ adequately captures the object motion in the corresponding driving frame $I_d^i$ while also preserving the object appearance of the source image $I_s$. The appearance of an object roughly consists of two aspects, \emph{shape} and \emph{texture}. The shape largely refers to its geometric property (\emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, length, slimness, etc.), while the texture usually means how the object looks like regardless of its shape (\emph{e.g}\onedot} \def\Eg{\emph{E.g}\onedot, dresses with different colors). Traditional motion transfer methods generally assume that the driving frame and the source image are derived from the same domain, where they implicitly suppose the object shapes are similar. Consequently, when the source image is derived from a new domain with different object shapes, these methods often fail to preserve the shape of the object in the source image. In this work, we study the cross-domain motion transfer problem, in which the source image and driving frame are from different domains. In other words, there might be considerable differences in appearance between them in terms of both shape and texture. An example is given in Fig.~\ref{fig:figure-1}, where both the clothes and body shapes of the fashion model and the Mixamo character exhibit notable differences. In what follows, we first present an overview of the pipeline of our proposed MAA approach in \cref{sec:overview}, after which we present the shape-invariant motion adaptation (SIMA) module and structure-guided appearance consistency~(SGAC) module in \cref{sec:SIMA} and \cref{sec:SGAC} respectively; these effectively learning the motion and appearance from the driving frame and source image, respectively. \begin{figure*} \centering \includegraphics[width=0.9\linewidth]{Figures/Fig2.pdf} \caption{The pipeline of our proposed method. The left-hand side is the architecture of the traditional single domain motion transfer model FOMM\cite{siarohin2019first}, which is used as a basic motion transfer model in our approach. Moreover, the right-hand side is the framework of our proposed MAA method where we design a cyclic reconstruction loss (CYC), a shape-invariant motion adaptation (SIMA) and a structure-guided appearance consistency (SGAC) module} \label{fig:fig-pipeline} \end{figure*} \subsection{Overview} \label{sec:overview} We design a cyclic training pipeline for cross-domain motion transfer, as shown in the right-hand part of \cref{fig:fig-pipeline}. The pipeline consists of a basic motion transfer model, our proposed shape-invariant motion adaptation module and structure-guided appearance consistency module, and a cyclic loss. \textbf{Basic Motion Transfer Model:} The basic motion transfer (MT) model follows the traditional motion transfer model\cite{siarohin2019first,siarohin2021motion}. We here illustrate the basic MT model by taking FOMM\cite{siarohin2019first} as an example, and other models like\cite{siarohin2021motion} can be similarly integrated into our pipeline. As shown in the left-hand part of \cref{fig:fig-pipeline}, traditional motion transfer methods typically employ a reconstruction training mode for learning and synthesizing motion. During the training phase, they select two arbitrary frames from the driving video as the source image and driving frame, which are used as input of the MT model. For each image, the motion keypoints and their local affine transformation are extracted using a motion estimator, where the motion keypoints can be conceptualized as the centroids of moving object parts. The dense motion flow from the source image to the driving frame can therefore be estimated using their motion keypoints and affine transformations. In the next step, the dense motion flow is used to warp the feature map of the source image, and produce the synthesized image $\hat{I}_d^i$ using the image generator. A perceptual loss is used as the reconstruction loss after the image generator to ensure that the synthesized image $\hat{I}_d^i$ fully reconstructs the driving frame $I_d^i$ as in\cite{siarohin2019first}: \begin{equation} \mathcal{L}_{r} = \sum_{l=k}^{K} | F_{l}(\hat{I}_d^i) - F_{l}(I_d^i)| \label{eq:reconstruction loss} \end{equation} where $ F_{l}(\cdot) $ is feature map output by the $l$-th layer of a pre-trained VGG-19 network\cite{simonyan2014very}. Researchers have proposed different method\cite{siarohin2021motion} to improve the motion estimator in order to more precisely extract motion information, yet the motion representation (\emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot, motion keypoints and affine transformations) remains similar. In the interests of simplicity, we depict only the motion keypoints in \cref{fig:fig-pipeline}, which are related to our MAA approach. Readers can refer to\cite{siarohin2019first} for further details. \textbf{Cyclic Training Pipeline:} In cross-domain motion transfer, the source image and driving video are obtained from different domains. So it is undesirable to pick a frame in the driving video as a source image and apply the reconstruction loss after the image generator, as the model will inevitably be overfitted to the driving video, which will lead to artifacts in the synthesized image. To address this issue, we build a cyclic reconstruction framework inspired by the CycleGAN\cite{zhu2017unpaired} and cross-identity\cite{jeon2020cross}. As shown in the right-hand side of Fig~\ref{fig:fig-pipeline}, we employ two basic basic MT models that share the same parameters. Given a source image $I_s$ and a driving frame $I_d^{i}$, we first obtain a synthesized image $I_p$ using the basic MT model. Since there is no ground-truth for the synthesized image, the reconstruction loss cannot be used for $I_p$. We then take the synthesized image $I_p$ as a driving frame, along with an arbitrary frame $I_d^{j}$ as the source image, and these are input again into the basic MT model to produce another synthesized image $I_c$. Intuitively, $I_c$ should mimic the motion of $I_p$, as well as $I_d^{i}$, since we expect $I_p$ to mimic the motion of $I_d^{i}$. At the same time, $I_c$ should also preserve the appearance of $I_d^{j}$, as well as $I_d^{i}$, which is derived from the same driving video as $I_d^{j}$. This allows us to employ $I_d^{i}$ and the cyclically generated $I_c$ to create a reconstruction loss for training. More specifically, we employ the perceptual loss similarly as in \cref{eq:reconstruction loss}: \begin{equation} \mathcal{L}_{c} = \sum_{l=k}^{K} | F_{l}(I_c) - F_{l}(I_d^i)| \label{eq:cyclic reconstruction loss} \end{equation} While the cyclic reconstruction loss enables us to train the motion transfer model in the cross-domain setting, this is only a weak supervision that cannot fully guarantee a satisfactory result. We therefore further introduce the shape-invariant motion adaptation module and patch-based appearance model to regularize the motion transfer process, which will be explained in more detail below. \subsection{Shape-invariant Motion Adaptation} \label{sec:SIMA} \begin{figure} \centering \includegraphics[width=0.5\linewidth]{Figures/Fig3.pdf} \caption{Illustration of our shape-invariant motion adaptation module. The top row show the structure topology, and the bottom two rows represents the motion adaptation stage using structured and unstructured keypoints} \label{fig:skeleton} \end{figure} Due to the significant appearance difference between the source image $I_s$ and the driving frame $I_d$, the generated synthesized image $I_p$ often fails to adequately capture the object motion in the driving frame $I_d$. We therefore propose to directly regularize the object pose in $I_p$ with that in $I_d$ based on the extracted motion keypoints. However, due to the diversity of the object shapes in $I_p$ and $I_d$, it is undesirable to directly regularize the consistency of their keypoint positions. We therefore propose to discover the intrinsic topology of the object, then regularize the included angles between adjacent object parts of two objects. \textbf{Structure Topology Discovery:} To discover the intrinsic object topology, for each driving video, we employ a pre-trained basic MT model to extract the motion keypoints of all frames in the video. Because the motion keypoints roughly describe the objects' moving body parts, two keypoints can be considered to be adjacent if their distance does not change substantially between different frames. Formally, given a driving frame $I_d$, we denote its motion keypoints as $ \mathcal{K}_d = \{{\k_{d}^{i}}|_{i=1}^K\}$, where $K$ is the number of motion keypoints. For each pair of keypoints $\k_{d}^{i}$ and $\k_{d}^j$, we calculate their $\ell_2$ distance $d_{i,j} = \ell_2(\k_{d}^i, \k_{d}^j)$, where $i \neq j$. The average distance across all frames of all driving videos can then be computed as $\bar{d}_{i,j} = \frac{1}{T}\sum_{t=1}^T d^{(t)}_{i,j}$, where $d^{(t)}_{i,j}$ is the distance in the $t$-th frame, while $T$ is the total number of video frames. Finally, we calculate the total distance diversity of $\k_{d}^{i}$ and $\k_{d}^j$ as follows: \begin{equation} \begin{split} &v_{i,j} = \sum_{t=1}^T | d^{(t)}_{i,j} - \bar{d}_{i,j} | \end{split} \end{equation} Intuitively, the distance diversity describes the stability of the connection between two keypoints. The smaller the distance diversity $v_{i,j}$, the higher the likelihood that the two keypoints will be adjacent. We then use the distance diversities to construct a structure topology graph $G$, where the nodes are keypoints, and the edges are defined according to the distance diversities. Specifically, we define the edge value as follows: \begin{equation} e_{i,j}= \begin{cases} \frac{(v_{i,j} - \eta)^{2}}{\eta^{2}}, & v_{i,j}<\eta,\\ 0, & \mbox{otherwise} \end{cases} \end{equation} where $\eta$ is a threshold, and we filter out the edges with high distance diversities, as these imply that the two keypoints are unlikely to be adjacent. Note that the edge value $e_{i,j}$ is within the range of $[0, 1]$. It can be seen as a measurement of the strength of the connection between two keypoints. We will demonstrate that it can also be used as a weight when we regularize the keypoints between driving frame and synthesized image. Moreover, it is possible that not all keypoints are connected in a single graph; we select the largest graph as our structure topology graph $G$. We refer to the keypoints in $G$ as the structured keypoints and the others as unstructured keypoints. For improved convenience of presentation, we denote the set of structured keypoints as $\cS$ and their edges as $\cE$, the structure topology graph can be presented as $G = \{\cS, \cE\}$. For unstructured keypoints, we retain only the keypoints and discard their edges, since their connectivities are weak, and denote the set of unstructured keypoints as $\cU$. We present an illustration of the structure topology discovery in the top row of \cref{fig:skeleton}. \textbf{Regularizing Structured Keypoints:} Given a driving frame $I_d$ and the synthesized $I_p$, we extract their keypoints $\cK_d = \{\k_d\}$ and $\cK_p=\{\k_p\}$ using the basic MT model. To regularize the keypoints in the driving frame $I_d$ and the synthesized $I_p$, we instantiate the structure topology $G$ using the extracted keypoints $\cK_d$ and $\cK_p$, respectively. Taking the driving frame as an example, the instantiated graph is presented as $G_d = \{\cS_d, \cE_d\}$; here, $\cS_d$ is the set of structured keypoints in $I_d$, while $\cE_d$ is the set of corresponding edges which are calculated based on the Euclidean distances between keypoints. The instantiated graph of the synthesized image $G_p = \{\cS_d, \cE_d\}$ can be similarly defined. We illustrate the instantiated graphs in the top of Fig~\ref{fig:skeleton}. When examining the structured keypoints, we can observe that considerable differences exist in terms of object shape; this validates our analysis that it is not preferable to directly regularize the keypoint positions. However, the pose can be portrayed as the included angle of each triplet of the connected keypoints in the structure graph. Specifically, taking the driving frame as an example, let us define a triplet of connected keypoints as $\t_d = \{\k_d^{i}, \k_d^{j}, \k_d^{k}\}$, where both $\k_d^j$ and $\k_d^k$ are connected to $\k_d^{i}$. We further denote the set of all keypoint triplets in $G_d$ as $\cT_d = \{\t_d^{n}|_{n=1}^N\}$, where $N$ is the total number of triplets. Similarly, we define the set of triplets for the synthesized image as $\cT_p = \{\t_p^{n}|_{n=1}^N\}$. For each triplet $\t_d^{n}$ (\emph{resp.}, $\t_p^{n}$ ), we calculate its included angle and denote it by $\alpha(\t_d^n)$ (\emph{resp.}, $\alpha(\t_p^n)$). We then regularize the consistency of the corresponding included angles for structured keypoints in the driving frame and the synthesized image as follows: \begin{equation} \begin{split} \cL_{rs} = \frac{1}{N}\sum_{n=1}^N \gamma_n| \alpha(\t_{d}^n) - \alpha(\t_{p}^n) | \end{split} \end{equation} where $\gamma_n$ is the weight for the $n$-th triplet. We calculate $\gamma_n$ using the edge values in the topology graph $G$. Specifically, given any triplet $\t = \{\k^{i}, \k^{j}, \k^{k}\}$ in the topology graph, the weight is computed as $\gamma = e_{i,j}e_{i,k}$. As the edge represents the strength of the connections between two keypoints, it is reasonable to employ the multiplication of the two edges that formed the included angle as the weight for regularization. \textbf{Regularizing Unstructured Keypoints:} Similarly, given a driving frame $I_d$ and the synthesized $I_p$, we identify their unstructured keypoints $\cU_d$ and $\cU_p$, respectively. Since these unstructured keypoints are disjoint, we constrain them by encoding their included angles with the object centroid. Taking the driving frame as an example, for each pair of keypoints $(\k_d^i, \k_d^j)$ in $\cU_d$, we construct a triplet $\hat{\t}_d = (\k_d^i, \k_d^c, \k_d^j)$ in which $\k_d^c$ is the object centroid, and further denote the included angle as $\beta(\hat{\t}_d)$. We similarly define the corresponding included angle for the synthesized image as $\beta(\hat{\t}_p)$. We then regularize the consistency of the corresponding included angles for the structured keypoints in the driving frame and the synthesized image as follows: \begin{equation} \begin{split} \cL_{ru} = \frac{1}{\hat{N}}\sum_{n=1}^{\hat{N}}|\beta(\hat{\t}_{d}^n) - \beta(\hat{\t}_p^n) | \end{split} \end{equation} where $\hat{N}$ is the number of constructed triplets using structured keypoints in each image. Combining the loss of structured and unstructured keypoints, the total loss of our shape-invariant motion adaptation loss can be written as follows: \begin{equation} L_{ma} = L_{rs} + L_{ru} \end{equation} \begin{figure} \centering \includegraphics[width=0.6\linewidth]{Figures/Fig4.pdf} \caption{Illustration of our structure-guided appearance consistency module} \label{fig:patch} \end{figure} \subsection{Structure-Guided Appearance Consistency Module} \label{sec:SGAC} We now consider how the appearance of the synthesized image $I_p$ might be enforced to be similar to that of the source image $I_s$. Note that the object poses in $I_p$ and $I_s$ are different, as we have enforced $I_p$ to mimic the pose of the driving frame. We therefore propose structure-guided appearance consistency module to regularize the appearance consistency of object parts in $I_p$ and $I_c$ to avoid impacting the learned object pose of $I_p$ In particular, we use the predicted motion keypoints to extract image patches of fixed size from both images. After collecting the patches from $ {I}_{p}$ (\emph{resp.}, $I_s$), a discriminator $\cD$ is then introduced to enforce the appearance consistency between the corresponding patches by means of an adversarial training strategy, as shown in \cref{fig:patch}. The aim of the discriminator is to determine whether the input patches are from ${I}_{p}$ or $I_s$ by minimizing a cross-entropy loss, while the generation model $\cB$ (\emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot, the basic MT model) aims at generating pseudo-images $\cB(I_{s}) $, which are difficult to distinguish from the source image $ I_{s}$ by maximizing the cross-entropy loss. Formally, we express the loss of our patch-based appearance consistency module as follows: \begin{equation} \begin{split} L_{ac} = & \log \cD(V(I_s)) +\log(1-\cD(V(\cB(I_s)))) \end{split} \end{equation} where $V(\cdot) $ represents the patch extraction operation. \subsection{Summary} We combine all losses together to train our proposed MAA model in an end-to-end manner. The overall objective function can be written as follows, \begin{equation} \cL = \cL_{r} + \cL_{c} + \lambda_{ma}\cL_{ma} - \lambda_{ac}L_{ac} \end{equation} where $\lambda_{ma}$ and $\lambda_{ac}$ are tradeoff parameters used to balance the losses. Due to the existence of the discriminator, we optimize the overall loss in an adversarial training manner, \emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot, $\min_{\cB}\max_{\cD}\cL$. Detailed training loop is presented in Supplementary materials. \section{Experiment} \label{sec:Experiment} \subsection{Datasets} We conduct experiments for two types of object including human body and human face. For the human body animation, we transfer motion from Mixamo-Video to Fashion-Video, and for human face animation we transfer motion from Vox-Celeb to CUHK Face Sketch~(Cufs). \textbf{Mixamo-Video Dataset} is a synthetic human dancing video dataset newly constructed by ourselves. We collect $15$ characters of 3D human body models and $46$ dancing sequences from the mixamo~\cite{mixamo.com} website, then render dancing videos for these characters and dancing sequences, leading to $ 15\times 46 = 690 $ videos in total with resolution of $ 256\times 256 $. We split ten of the characters as training set and the rest as test set, \emph{i.e}\onedot} \def\Ie{\emph{I.e}\onedot $460$ and $230$ videos, respectively. Details of the dataset are presented in supplementary materials, and we will release the dataset soon. \textbf{Fashion-Video Dataset} is a video dataset for showing clothes. It contains $500$ training videos and $100$ testing videos with size of $ 256\times 256 $.Although it is a video dataset, We use it as an image dataset by selecting one frame per video randomly in training stage. \textbf{Vox-Celeb} is a video dataset of human talking. It consists of $12,331$ training videos and $444$ testing videos resized to $ 256\times 256 $. \textbf{CUHK Face Sketch~(Cufs)} is an image dataset of human face sketches. The dataset contains $305$ images where training set and test set have $250$ and $45$ images \emph{resp.}. Each image is a sketch drawn by an artist based on a photo taken in a frontal pose with a natural expression. We also resize those images into the size of $ 256\times 256 $. \begin{table}[] \centering \caption{ Quantity results comparison of our method with source only FOMM model and MRAA model. The lower FID and AED values are the better} \begin{tabular}{c|cc|cc} \hline & \multicolumn{2}{l|}{Mixamo $\longrightarrow$ Fashion} & \multicolumn{2}{l}{Vox $\longrightarrow$ Cufs} \\ & FID $\downarrow$ & AED $\downarrow$ & FID $\downarrow$ & AED $\downarrow$ \\ \hline MRAA & 177.3 & 0.376 & 127.1 & 0.764 \\ \hline FOMM & 175.9 & 0.359 & 112.5 & 0.693 \\ \hline Ours~(MRAA) & 72.1 & 0.289 & 86.5 & 0.627 \\ \hline Ours~(FOMM) & \textbf{61.7} & \textbf{0.274} & \textbf{50.1} & \textbf{0.573} \\ \hline \end{tabular} \label{tab:FID-AED} \end{table} \subsection{Quantitative Results} \textbf{Metrics:} As the ground-truth video are not available in cross-domain motion transfer, to quantitatively assess the synthesized videos, we employ two metrics for evaluate generative models as follows \begin{itemize} \item \textbf{Fr\'{e}chet Inception distance (FID)\cite{heusel2017gans}} This score indicates the overall quality of generated frames, it compares the feature statistics of generated frames and real images, then calculates the distance between them. \item \textbf{Average Euclidean Distance (AED)}\cite{siarohin2019first} Considering the generated images share the same identity with source images, we utilize AED to evaluate the identity similarity between them. It also computes the feature distance between two input images. Specifically, a pre-trained person re-identification network~\cite{hermans2017defense} and a pre-trained facial identification network~\cite{amos2016openface} are used to extract identity feature representations for human body and human face dataset, respectively. \end{itemize} \textbf{Results:} As aforementioned, unsupervised motion transfer models like FOMM\cite{siarohin2019first} or MRAA\cite{siarohin2021motion} can be integrated into our MAA framework as the basic motion transfer model. We conduct experiments by respectively using FOMM and MRAA as our basic motion transfer model, and take the original FOMM and MRAA as the corresponding baseline for comparison. For both methods, the baseline models are trained on the driving video dataset without considering the cross-domain issue. Note that the newly proposed modules in our MAA model are only used in training stage, and the model in the test stage share the same architecture with the baseline FOMM or MRAA model. We report the results for Mixamo-Video $ \rightarrow $ Fashion-Video and Vox $ \rightarrow $ Cufs in~\cref{tab:FID-AED}. Comparing with the FOMM and MRAA model, our proposed MAA approach achieves a much better performance. In particular, compared with FOMM, we achieve a FID of $61.7$ and an AED of $0.274$ for Mixamo-Video $ \rightarrow $ Fashion-Video, and $50.1$ \vs $112.5$ and $0.573$ \vs $0.693$ for Vox $ \rightarrow $ Cufs, respectively. Compared with MRAA, we achieve a FID of $72.1$ and an AED of $0.289$ for Mixamo-Video $ \rightarrow $ Fashion-Video, and $86.5$ \vs $127.1$ and $0.627$ \vs $0.764$ for Vox $ \rightarrow $ Cufs, respectively. Note that, for both FID and AED metrics, smaller value is better. The large improvement indicates that the cross-domain motion transfer is challenging for the traditional FOMM and MRAA method, while our MAA model works well on the cross-domain scenario. We observe that MRAA performs worse than FOMM in the cross-domain motion transfer task, although the previous work shows MRAA usually performs better than FOMM in the traditional single-domain motion transfer\cite{siarohin2021motion}. This possibly dues to that the PCA based motion estimation in the MRAA method is non-parametric and less flexible for cross-domain motion transfer. \begin{figure} \centering \includegraphics[width=0.9\linewidth]{Figures/Fig5.pdf} \caption{Visualization results of FOMM,MRAA and ours method on human body datasets} \label{fig:body-result} \end{figure} \begin{figure} \centering \includegraphics[width=0.9\linewidth]{Figures/Fig6.pdf} \caption{Visualization results of FOMM,MRAA and ours method on human face datasets} \label{fig:face-result} \end{figure} \subsection{Qualitative Results} We visualize the generated results to gain an intuitive assessment of FOMM, MRAA and our MAA models for cross-domain human body and human face animation in \cref{fig:body-result} and \cref{fig:face-result}, respectively. In each figure, two pairs of results are visualized in the left and right parts, respectively. Driving frames extracted from the test video are displayed on the top row, while the source images are showed at the most left column of each part. For human body animation, as shown in \cref{fig:body-result}, the results generated by the FOMM and MRAA model obviously suffer from domain shift problem. Although the motion of driving video is roughly captured, the human body shape of source image is rarely preserved, and notable artifacts can be observed in almost all frames of the synthesized video. In contrast, our MAA model is able to capture the motion of the driving frames while properly preserving the appearance of the source image. For human face animation, as shown in \cref{fig:face-result}, the FOMM and MRAA model could generate results with a rough motion of driving frames and a similar facial appearance with source image. However, the quality of synthesized image are not satisfactory where artifacts are obvious to observe. For example, artifacts on glasses and heads can be observed for FOMM results as highlighted in the red bounding boxes. These differences in qualitative results clearly demonstrate the effectiveness of our proposed MAA model for cross-domain motion transfer. \subsection{Ablation Study} To study the impact of our proposed modules, we further conduct ablation study on both human body and human face datasets. The FOMM is used as the basic motion transfer model. The quantitative results are shown in \cref{tab:ablation}, where 'w/o CYC', 'w/o SIMA' and 'w/o SGAC' means removing the cyclic training pipeline, shape-invariant motion adaptation and structure-guided appearance consistency of FOMM model, respectively. \begin{table}[] \centering \caption{Ablation results comparison of FOMM and our ablated models.} \begin{tabular}{c|cc|cc} \hline & \multicolumn{2}{l|}{Mixamo $\longrightarrow$ Fashion} & \multicolumn{2}{l}{Vox $\longrightarrow$ Cufs} \\ & FID $\downarrow$ & AED $\downarrow$ & FID $\downarrow$ & AED $\downarrow$ \\ \hline FOMM & 175.9 & 0.359 & 112.5 & 0.693 \\ \hline w/o CYC & 136.9 & 0.354 & 74.1 & 0.633 \\ \hline w/o SIMA & 80.2 & 0.303 & 60.7 & 0.622 \\ \hline w/o SGAC & 67.7 & 0.284 & 55.2 & 0.603 \\ \hline Ours~(FOMM) & \textbf{61.7} & \textbf{0.274} & \textbf{50.1} & \textbf{0.573} \\ \hline \end{tabular} \label{tab:ablation} \end{table} For both human body and human face animation, as shown in \cref{tab:ablation}, we observe considerable performance drops on both AED and FID for w/o CYC, which again confirms the importance to explicitly consider the cross-domain issue when performing motion transfer across domains. Similar observations can be obtained on human face dataset, which is also confirmed in the qualitative results in \cref{fig:ablation}. Other ablation settings w/o SIMA and w/o SGAC also degrade the performance considerably, which validates the necessity of using the two modules for generating satisfactory synthesized video in cross-domain motion transfer. To show the effect of each module intuitively, we further visualize the synthesized results in \cref{fig:ablation}. We observe that the result of w/o CYC has richer details than that of FOMM model. For example, the face and the clothes are clearer. However, compared with our final MAA result, it still drops important motion and appearance information. Moreover, we observe the result of w/o SIMA are able to preserve relative rich appearance information, however, the pose of driving frames are not transferred properly without the help of motion consistency module. For example, artifacts can be observed for the poses of the arms and heads as highlighted in the blue rectangles. And, on the third row, w/o~SGAC performs well in pose transferring but fails to preserve source image appearance without SGAC, especially for the details of human face as highlighted in red rectangles. These observations confirm the effectiveness of the modules proposed in our MAA approach. \begin{figure} \centering \includegraphics[width=0.45\linewidth]{Figures/Fig7.pdf} \caption{Visualized ablation study results on the human body datasets} \label{fig:ablation} \end{figure} \subsection{User Study} To further evaluate our model, we additionally conduct a user study. In particular, we randomly select 50 pairs of source domain driving videos and target domain source images for both human body animation and human face animation, and generate result videos in an ablation setting. For each dataset, we compare results of our final MAA model with those of FOMM and three ablation methods, respectively. The comparison are evaluated by 25 users according to three aspects, motion, appearance~(denoted as app. in \cref{tab:User-Study}) and overall, respectively. The user preferences are shown in \cref{tab:User-Study}. We observe that all scores are above $0.5$, which means our results are preferred by the majority of users for all aspects in all settings. For motion aspect, fewer users prefer w/o SIMA than other settings when compared with MAA model on both datasets ($0.748$ vs. $0.717$ and $0.679$ for human body, and $0.571$ vs. $0.704$ for human face), which indicates SIMA improves the motion of generated results. For appearance aspect, fewer user prefer w/o SGAC than other ablation settings when compared with MAA model in human body dataset ($0.715$ vs. $0.711$ and $0.699$), which indicates SGAC contributes to appearance of generated results. \begin{table}[] \centering \caption{User study results. We compare the Ours (FOMM) model to every ablation model, and the values represent the user preferences to Ours (FOMM) model} \begin{tabular}{c|ccc|ccc} \hline & \multicolumn{3}{c|}{Mixamo $\longrightarrow$ Fashion} & \multicolumn{3}{c}{Vox $\longrightarrow$ Cufs} \\ & motion & appearance & overall & motion & appearance & overall \\ \hline FOMM & 0.888 & 0.983 & 0.978 & 0.845 & 0.792 & 0.875 \\ \hline w/o CYC & 0.717 & 0.699 & 0.732 & 0.571 & 0.615 & 0.626 \\ \hline w/o SIMA & 0.748 & 0.711 & 0.702 & 0.704 & 0.655 & 0.675 \\ \hline w/o SGAC & 0.679 & 0.715 & 0.725 & 0.593 & 0.617 & 0.575 \\ \hline \end{tabular} \label{tab:User-Study} \end{table} \section{Conclusion} \label{sec:Conclusion} In this paper, we propose a Motion and Appearance Adaptation~(MAA) approach for cross-domain motion transfer. In MAA, we design a shape-invariant motion adaptation module to enforce the consistency of the angles of object parts in two images to capture the motion information. Meanwhile, we introduce a structure-guided appearance consistency module to regularize the similarity between the patches of the synthesized image and the source image. The experimental results demonstrates the effectiveness of our proposed method. \begin{FlushLeft}\textbf{Acknowledgement}. This work is supported by the Major Project for New Generation of AI under Grant No. 2018AAA0100400, the National Natural Science Foundation of China (Grant No. 62176047), Sichuan Science and Technology Program (No. 2021YFS0374, 2022YFS0600), Beijing Natural Science Foundation (Z190023), and Alibaba Group through Alibaba Innovation Research Program. This work is also partially supported by the Science and Technology on Electronic Information Control Laboratory.\end{FlushLeft} \bibliographystyle{splncs04}
{'timestamp': '2022-10-07T02:11:03', 'yymm': '2209', 'arxiv_id': '2209.14529', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14529'}
arxiv
\section{Introduction} Sampling from a probability distribution given its score function, i.e., the gradient of the log-density, is an active area of research in machine learning. Its applications range far and wide, from Bayesian learning \citep{welling2011} to learning energy-based models \citep{song2021ebm}, synthesizing new high-quality data \citep{dhariwal2021}, and so on. Typical examples of traditional score-based samplers are Markov chain Monte Carlo (MCMC) methods such as Langevin dynamics \citep{langevin1908} and Hamiltonian Monte Carlo \citep{neal2011}. Recent developments in score matching with deep neural networks (DNNs) have made it possible to estimate scores of high-dimensional distributions such as those of natural images \citep{song2019score}. However, natural data distributions are often sharp and multi-modal, rendering na\"{i}ve application of traditional MCMC methods impractical. Specifically, MCMC methods tend to skip over or get stuck at local high-density modes, producing biased samples \citep{levy2018}. Diffusion models \citep{dickstein2015,ho2020,song2021ddim} depart from MCMC and use the concept of diffusion, the process of gradually corrupting data into noise, to generate samples. \citet{song2021} observed that for each diffusion process, there is a reverse stochastic differential equation (SDE) and an ordinary differential equation (ODE). Hence, given a noise sample, integrating the reverse-S/ODE produces a data sample. Only a time-dependent score function of the data during the diffusion process is required to simulate the reverse process. This discovery generated great interest in finding better ways to integrate reverse-S/ODEs. For instance, \citet{song2021} uses black-box ODE solvers with adaptive stepsizes to accelerate sampling. Furthermore, multitude of recent works on score-based generative modeling focus on improving reverse-S/ODE integrators \citep{martineau2021,lu2022,karras2022,zhang2022}. In this work, we develop an orthogonal approach to accelerating score-based sampling. Specifically, we propose Denoising MCMC (DMCMC) which combines MCMC with reverse-S/ODE integrators. MCMC is used to generate samples $\{(\bm{x}_n,t_n)\}$ in the product space of data $\bm{x}$ and variance exploding (VE) diffusion time $t$ / noise level $\sigma$ (see Fig.~\ref{fig:dmcmc_example} top panel). Since all modes are connected in the product space, MCMC mixes well. Then, a reverse-S/ODE integrator solves the reverse-S/ODE starting at $\bm{x}_n$ from time $t = t_n$ to $t = 0$. Since MCMC explores high-density regions, the MCMC chain stays close to the data manifold, so $t_n$ tends to be close to $0$, i.e., noise level tends to be small (see Fig.~\ref{fig:dmcmc_example} top and bottom panels). Thus, integrating the reverse-S/ODE from $t = t_n$ to $t = 0$ is much faster than integrating the reverse-S/ODE from maximum time $t = T$ to $t = 0$ starting from noise. This leads to a significant acceleration of the sampling process. \begin{figure}[t] \centering \begin{subfigure}{0.9\linewidth} \includegraphics[width=1.0\linewidth]{figures/diag.png} \end{subfigure} \begin{subfigure}{0.49\linewidth} \includegraphics[width=1.0\linewidth]{figures/1a-min.png} \end{subfigure} \hfill \begin{subfigure}{0.49\linewidth} \includegraphics[width=1.0\linewidth]{figures/1b-min.png} \end{subfigure} \caption{\textbf{Top:} a conceptual illustration of a VE diffusion model sampling process and DMCMC sampling process. VE diffusion models integrate the reverse-S/ODE starting from maximum diffusion time / maximum noise level. So, samples are often noisy with small computation budget due to large truncation error. DMCMC produces an MCMC chain which travels close to the image manifold (compare the noise level $\sigma$). So, the MCMC samples can be denoised to produce high-quality data with relatively little computation. \textbf{Bottom:} Visualization of sampling processes without (left) and with (right) DMCMC on CelebA-HQ-256 under a fixed computation budget.} \label{fig:dmcmc_example} \end{figure} Our contributions can be summarized as follows. \begin{itemize} \item We introduce the product space of data and diffusion time, and develop a novel score-based sampling framework called Denoising MCMC on the product space. Our framework is general, as any MCMC, any VE process noise-conditional score function, and any reverse-S/ODE integrator can be used in a plug-and-play manner. \item We develop Denoising Langevin Gibbs (DLG), which is an instance of Denoising MCMC that is simple to implement and is scalable. The MCMC part of DLG alternates between a data update step with Langevin dynamics and a noise level prediction step, so all that DLG requires is a pre-trained noise-conditional score network and a noise level classifier. \item We verify the effectiveness of DLG by accelerating six reverse-S/ODE integrators. Notably, combined with the integrators of \citet{karras2022}, DLG achieves state-of-the-art results. On CIFAR10 in the limited number of score function evaluation (NFE) setting, we obtain $3.86$ FID with $\approx 10$ NFE and $2.63$ FID with $\approx 20$ NFE. On CelebA-HQ-256, we have $6.99$ FID with $\approx 160$ NFE, which is currently the best result with score-based models. The computation cost of evaluating a noise level classifier is negligible, so we obtain acceleration essentially for free. \end{itemize} \section{Background} \subsection{Denoising Score Matching} Given a distribution $p(\bm{x})$, a noise level $\sigma$, and a perturbation kernel $p_\sigma(\bm{x}\mid\tilde{\bm{x}}) = \mathcal{N}(\bm{x} \mid \tilde{\bm{x}}, \sigma^2 \bm{I})$, solving the denoising score matching objective \citep{vincent2011} \begin{align} \min_\theta \mathbb{E}_{p(\tilde{\bm{x}})} \mathbb{E}_{p_\sigma(\bm{x} \mid \tilde{\bm{x}})} \left[ \| {\boldsymbol s}_\theta(\bm{x}) - \nabla_{\bm{x}} \log p_\sigma(\bm{x} \mid \tilde{\bm{x}}) \|_2^2 \right] \label{eq:dsm_orig} \end{align} yields a score model ${\boldsymbol s}_\theta(\bm{x})$ which approximates the score of $\int p_\sigma(\bm{x} \mid \tilde{\bm{x}}) p(\tilde{\bm{x}}) \, d\tilde{\bm{x}}$. Denoising score matching was then extended to train Noise Conditional Score Networks (NCSNs) ${\boldsymbol s}_\theta(\bm{x}, \sigma)$ which approximate the score of data smoothed at a general set of noise levels by solving \begin{align} \min_\theta \mathbb{E}_{\lambda(\sigma)} \mathbb{E}_{p(\tilde{\bm{x}})} \mathbb{E}_{p_{\sigma}(\bm{x} \mid \tilde{\bm{x}})} \left[ \| {\boldsymbol s}_\theta(\bm{x},\sigma) - \nabla_{\bm{x}} \log p_{\sigma}(\bm{x} \mid \tilde{\bm{x}}) \|_2^2 \right] \label{eq:dsm_cont} \end{align} where $\lambda(\sigma)$ can be a discrete or a continuous distribution over $(\sigma_{\min},\sigma_{\max})$ \citep{song2019score,song2021}. We note $\int p_\sigma(\bm{x} \mid \tilde{\bm{x}}) p(\tilde{\bm{x}}) \, d\tilde{\bm{x}}$ approaches $p(\bm{x})$ as $\sigma \rightarrow 0$, since the perturbation kernel $p_\sigma(\bm{x} \mid \tilde{\bm{x}})$ converges to the Dirac delta function centered at $\bm{x}$. \subsection{Markov Chain Monte Carlo (MCMC)} Given an unnormalized version of $p(\bm{x})$ or the score function $\nabla_{\bm{x}} \log p(\bm{x})$, MCMC constructs a Markov chain in the data space whose stationary distribution is $p(\bm{x})$. An MCMC which uses the unnormalized density is the Metropolis-Hastings MCMC \citep{metropolis1953,hastings1970} that builds a Markov chain by sequentially accepting or rejecting proposal distribution samples according to a density ratio. A popular score-based MCMC is Langevin dynamics \citep{langevin1908}. Langevin dynamics generates a Markov Chain $\{\bm{x}_n\}_{n = 1}^\infty$ using the iteration \begin{align} \bm{x}_{n+1} = \bm{x}_n + (\eta / 2) \cdot \nabla_{\bm{x}} \log p(\bm{x}_n) + \sqrt{\eta} \cdot \bm{\epsilon} \label{eq:langevin} \end{align} where ${\boldsymbol \epsilon} \sim \mathcal{N}(\bm{0},\bm{I})$. $\{\bm{x}_n\}_{n = 1}^\infty$ converges to $p(\bm{x})$ in distribution for an appropriate choice of $\eta$. To sample from a joint distribution $p(\bm{x},\bm{y})$, we may resort to Gibbs sampling \citep{geman1984}. Given a current Markov chain state $(\bm{x}_n,\bm{y}_n)$, Gibbs sampling produces $\bm{x}_{n+1}$ by sampling from $p(\bm{x} \mid \bm{y}_n)$ and $\bm{y}_{n+1}$ by sampling from $p(\bm{y} \mid \bm{x}_{n+1})$. The sampling steps may be replaced with MCMC. Hence, Gibbs sampling is useful when conditional distributions are amenable to MCMC. \textbf{Annealed MCMC.} Despite their diversity, MCMC methods often have difficulty crossing low-density regions in high-dimensional multimodal distributions. For Langevin dynamics, at a low-density region, the score function vanishes in \eqref{eq:langevin}, resulting in a meaningless diffusion. Moreover, natural data often lies on a low-dimensional manifold. Thus, once Langevin dynamics leaves the data manifold, it becomes impossible for Langevin dynamics to find its way back. One way to remedy this problem is to use annealing, i.e., constructing a sequence of increasingly smooth and wide distributions and running MCMC at different levels of smoothness. As smoothness is increased, disjoint modes merge, so MCMC can cross over to other modes. Annealing has been used to empower various types of MCMC \citep{geyer1995,neal2001}. In this work, we shall refer to the collection of MCMC that use annealing as annealed MCMC. An instance of annealed MCMC is annealed Langevin dynamics (ALD) \citep{song2019score}. For a sequence of increasing noise levels $\{\sigma_i\}_{i = 1}^N$, Langevin dynamics is sequentially executed with $\int p_{\sigma_i}(\bm{x} \mid \tilde{\bm{x}}) p(\tilde{\bm{x}}) \, d\tilde{\bm{x}}$ in place of $p(\bm{x})$ in \eqref{eq:langevin} for $i = N, N - 1, \ldots, 1$. Since $p(\bm{x})$ smoothed at a large noise level has wide support and connected modes, ALD overcomes the pitfalls of vanilla Langevin dynamics. However, ALD has the drawback that thousands of iterations are required to produce a single batch of samples. \subsection{Diffusion Models} \textbf{Diffusion models and differential equations.} Diffusion models opened up a new avenue towards fast sampling with score functions via SDEs and ODEs \citep{song2021}. Suppose data is distributed in $\mathbb{R}^d$. Given a diffusion process of data sample $\bm{x}_0 \sim p(\bm{x})$ into a sample from a simple prior noise distribution, the trajectory of data during diffusion can be described with an It\^{o} SDE \begin{align} d\bm{x} = \bm{f}(\bm{x},t) \, dt + g(t) \, d\bm{w} \label{eq:SDE} \end{align} for some drift coefficient $\bm{f} : \mathbb{R}^d \times [0,T] \rightarrow \mathbb{R}^d$, diffusion coefficient $g : [0,T] \rightarrow \mathbb{R}$, and Brownian motion $\bm{w}$. Here, $T$ is the diffusion termination time. With initial condition $\bm{x}(0) = \bm{x}_0$, integrating \eqref{eq:SDE} from time $t = 0$ to $t = T$ produces a sample from the prior distribution. For each diffusion SDE, there exists a corresponding reverse-SDE: \begin{align} d\bm{x} = [\bm{f}(\bm{x},t) - g(t)^2 \nabla_{\bm{x}} \log p_t(\bm{x})] \, dt + g(t) \, d\bar{\bm{w}} \label{eq:RSDE} \end{align} where $p_t(\bm{x})$ is the density of $\bm{x}(t)$ evolving according to \eqref{eq:SDE} and $\bar{\bm{w}}$ is a Brownian motion if time flows from $t = T$ to $t = 0$. Given a sample $\bm{x}_T$ from the prior distribution, integrating \eqref{eq:RSDE} with initial condition $\bm{x}(T) = \bm{x}_T$ from $t = T$ to $t = 0$ results in a sample from $p(\bm{x})$. Moreover, to each reverse-SDE, there exists a corresponding deterministic reverse-ODE \begin{align} d\bm{x} = \left[\bm{f}(\bm{x},t) - (1/2) \cdot g(t)^2 \nabla_{\bm{x}} \log p_t(\bm{x}) \right] \, dt \end{align} which also can be integrated from $t = T$ to $t = 0$ to produce samples from $p(\bm{x})$. Diffusion models generate data by simulating the reverse of the diffusion process, i.e., by solving the reverse-S/ODE of the diffusion process. Initial works on diffusion models \citep{dickstein2015,ho2020} used computationally expensive ancestral sampling to solve the reverse differential equations. Later works discovered that using adaptive numerical integrators to solve the reverse-S/ODE could accelerate the sampling process. This led to great attention on developing better reverse-S/ODE integrators \citep{martineau2021,song2021,lu2022,karras2022,zhang2022}. Our work is orthogonal to such works as focus on finding good initialization points for integration via MCMC. Hence, a better integration technique directly translates to even better generative performance when plugged into Denoising MCMC. \textbf{Variance exploding (VE) diffusion model.} A VE diffusion model considers the diffusion process \begin{align} d\bm{x} = \sqrt{\frac{d[\sigma^2(t)]}{dt}} \, d\bm{w}. \label{eq:VESDE} \end{align} where $\sigma(t)$ increases monotonically with $t$ from $\sigma_{\min}$ to $\sigma_{\max}$. The data distribution evolves as \begin{align} \textstyle p_t(\bm{x}) = \int p_{\sigma(t)}(\bm{x} \mid \tilde{\bm{x}}) p(\tilde{\bm{x}}) \, d\tilde{\bm{x}} \end{align} so if $\sigma_{\min}$ is sufficiently small, $p_0(\bm{x}) \approx p(\bm{x})$, and if $\sigma_{\max}$ is sufficiently large, so variance explodes, $p_T(\bm{x}) \approx \mathcal{N}(\bm{x} \mid \bm{0}, \sigma_{\max}^2 \bm{I})$. If we have a score model ${\boldsymbol s}_\theta(\bm{x},\sigma)$ trained with \eqref{eq:dsm_cont}, $\nabla_{\bm{x}} \log p_t(\bm{x}) \approx {\boldsymbol s}_\theta(\bm{x}, \sigma(t))$. It follows that with $\bm{x}_T \sim \mathcal{N}(\bm{x} \mid \bm{0}, \sigma_{\max}^2 \bm{I})$, we may integrate the reverse-S/ODE corresponding to \eqref{eq:VESDE} with $\bm{x}(T) = \bm{x}_T$ from $t = T$ to $t = 0$ using a score model to generate data. In the next section, we bridge MCMC and reverse-S/ODE integrators with VE diffusion to form a novel sampling framework that improves both MCMC and diffusion models. \section{Denoising Markov Chain Monte Carlo (DMCMC)} \label{sec:dmcmc} From here on, we denote the data distribution as $p(\bm{x})$ and its domain as $\mathcal{X} \subseteq \mathbb{R}^d$. Diffusion runs from time $t = 0$ to $t = T$, and noise scale $\sigma(t)$ increases monotonically from $\sigma_{\min}$ to $\sigma_{\max}$, such that $\sigma(0) = \sigma_{\min}$ and $\sigma(T) = \sigma_{\max}$. We denote the range of $\sigma(t)$ as $\SS = [\sigma_{\min},\sigma_{\max}]$. The Gaussian perturbation kernel is denoted as $p_\sigma(\bm{x} \mid \tilde{\bm{x}}) = \mathcal{N}(\bm{x} \mid \tilde{\bm{x}}, \sigma^2 \bm{I})$. The distribution of $\bm{x}(t)$ following the VE diffusion \eqref{eq:VESDE} is denoted as $p_t(\bm{x})$, and recall that $p_t(\bm{x}) = \int p_{\sigma(t)}(\bm{x} \mid \tilde{\bm{x}}) p(\tilde{\bm{x}}) \, d\tilde{\bm{x}}$. We now develop a general framework called Denoising MCMC (DMCMC) which combines MCMC with reverse-S/ODE integrators. The construction of DMCMC is comprised of two steps. In the first step, we build MCMC on the product space $\mathcal{X} \times \SS$, i.e., $\mathcal{X}$ augmented by the smoothness parameter $\sigma$. Since $\sigma(t)$ is a monotone increasing function, this is equivalent to augmenting the data space with diffusion time $t$. In the second step, we incorporate denoising steps, where we denoise MCMC samples via reverse-S/ODE integrators. \subsection{Construction Step 1: MCMC on the Product Space $\mathcal{X} \times \mathcal{S}$} Suppose $p(\bm{x})$ is a high-dimensional multimodal distribution, supported on a low-dimensional manifold. If the modes are separated by wide low-density regions, MCMC can have difficulty moving between the modes. Indeed, convergence time for such distributions can grow exponential in dimension $d$ \citep{roberts2001}. Intuitively, for MCMC to move between disjoint modes, the Markov Chain would have to step off the data manifold. However, once MCMC leaves the data manifold, the density or the score vanishes. Then, most random directions produced by the proposal distribution do not point to the manifold. Thus, MCMC gets lost in the ambient space, whose volume grows exponentially in $d$. Annealing via Gaussian smoothing, used in both ALD and VE diffusion, circumvents this problem. As $p(\bm{x})$ smoothed with perturbation kernel $p_\sigma(\bm{x} \mid \tilde{\bm{x}})$ of increasing $\sigma$, the modes of $p(\bm{x})$ grow wider and start to connect. Thus, MCMC can easily transition between modes. However, running MCMC in the manner of ALD is inefficient since we do not know how many iterations within each noise level is sufficient. To address this problem, we propose to augment $\mathcal{X}$ with the smoothness scale $\sigma$ and run MCMC in the product space $\mathcal{X} \times \SS$ such that MCMC automatically controls the value of $\sigma$. Below, we formally describe MCMC on $\mathcal{X} \times \SS$. Let us define the $\sigma$-conditional distribution \begin{align} \textstyle \hat{p}(\bm{x} \mid \sigma) \coloneqq \int p_\sigma(\bm{x} \mid \tilde{\bm{x}}) p(\tilde{\bm{x}}) \, d\bm{\tilde{x}}. \label{eq:cond} \end{align} We also define a prior $\hat{p}(\sigma)$ on $\SS$. Then by the Bayes' Rule, \begin{align} \hat{p}(\bm{x},\sigma) = \hat{p}(\bm{x} \mid \sigma) \cdot \hat{p}(\sigma). \end{align} Here, $\hat{p}(\sigma)$ reflects our preference for how much time we want the MCMC chain to stay at a particular level of $\sigma$. MCMC with $\hat{p}(\bm{x},\sigma)$ will produce samples $\{(\bm{x}_n,\sigma_n)\}$ in $\mathcal{X} \times \SS$ such that \begin{align} \sigma_n \sim \hat{p}(\sigma), \qquad \bm{x}_n \sim \hat{p}(\bm{x} \mid \sigma_n). \label{eq:sample_dist} \end{align} Hence, if $\sigma_n \gg \sigma_{\min}$, $\bm{x}_n$ will be a noisy sample, i.e., a sample corrupted with Gaussian noise of variance $\sigma_n^2$, and if $\sigma_n \approx \sigma_{\min}$, $\bm{x}_n$ will resemble a sample from $p(\bm{x})$. Since our goal is to generate samples from $p(\bm{x})$, na\"{i}vely, we can keep samples $(\bm{x}_n,\sigma_n)$ with $\sigma_n \approx \sigma_{\min}$ and discard other samples. However, this could lead to a large waste of computation resources. In the next section, we incorporate reverse-S/ODE integrators to avert this problem. \subsection{Construction Step 2: Incorporating Denoising Steps} Let us recall that integrating the reverse-S/ODE for the VE diffusion SDE Eq. (\ref{eq:VESDE}) from time $t = T$ to $t = 0$ sends samples from $p_T(\bm{x})$ to samples from $p_0(\bm{x}) \approx p(\bm{x})$. In general, integrating the reverse-SDE or ODE from time $t = t_2$ to $t = t_1$ for $t_1 < t_2$ sends samples from $p_{t_2}(\bm{x})$ to samples from $p_{t_1}(\bm{x})$ \citep{song2021}. We use this fact to denoise MCMC samples from $\hat{p}(\bm{x},\sigma)$. Suppose we are given a sample $(\bm{x}_n,\sigma_n) \sim \hat{p}(\bm{x},\sigma)$. With $t_n \coloneqq \sigma^{-1}(\sigma_n)$, \eqref{eq:sample_dist} tells us \begin{align} \bm{x}_n \sim p_{t_n}(\bm{x}) \end{align} so integrating the reverse-S/ODE with initial condition $\bm{x}(t_n) = \bm{x}_n$ from $t = t_n$ to $t = 0$ produces a sample from $p_0(\bm{x}) \approx p(\bm{x})$. Here, we note that any reverse-S/ODE solver may be used to carry out the integration. Given an MCMC chain $\{(\bm{x}_n,\sigma_n)\}$ in $\mathcal{X} \times \SS$, MCMC is biased towards high-density regions of $\mathcal{X}$, so the sequence $\{\bm{x}_n\}$ will generally stay close to the data manifold, except when traversing between disjoint modes. This means $\sigma_n \ll \sigma_{\max}$ for most $n$, or in other words, $t_n \ll T$ for most $n$. So, the average length of integration intervals will tend to be much shorter than $T$. Thus, a numerical integrator can integrate the reverse-S/ODE with less truncation error given the same computation budget \citep{numanalysis}. Equivalently, less computation budget is required to reach the same truncation error level. This idea is illustrated in Figure \ref{fig:dmcmc_example}. \section{Denoising Langevin Gibbs (DLG)} In Section \ref{sec:dmcmc}, we described an abstract framework, DMCMC, for accelerating score-based sampling by combining MCMC and reverse-S/ODE integrators. We now develop a concrete instance of DMCMC. As the second construction step of DMCMC is simple, we only describe the first step. Na\"{i}vely, we could extend denoising score matching \eqref{eq:dsm_orig} to estimate the score $\hat{s}_\theta(\bm{x},\sigma) : \mathbb{R}^d\times\mathbb{R} \rightarrow \mathbb{R}^d\times\mathbb{R}$ of $\hat{p}(\bm{x},\sigma)$ and apply Langevin dynamics in the first step of DMCMC. But, this would prevent us from using pre-trained score models, as we would have to solve (for some small $\nu > 0$) \begin{align} \min_\theta \mathbb{E}_{\bm{\epsilon} \sim \mathcal{N}(\bm{0}_{d+1},\nu^2 \bm{I}_{d+1})} \mathbb{E}_{\hat{p}(\bm{x}, \sigma)} [\|\hat{s}_\theta(\bm{x}-\epsilon_{1:d},\sigma-\epsilon_{d+1}) - \bm{\epsilon}/\nu^2\|_2^2] \end{align} which differs from \eqref{eq:dsm_cont}. Gibbs sampling provides a simple path around this problem. Let us recall that given a previous MCMC iterate $(\bm{x}_n,\sigma_n)$, Gibbs sampling proceeds by alternating between an $\bm{x}$ update step $\bm{x}_{n+1} \sim \hat{p}(\bm{x} \mid \sigma_n)$ and a $\sigma$ update step $\sigma_{n+1} \sim \hat{p}(\sigma \mid \bm{x}_{n+1})$. Below, we describe our score-based sampling algorithm, Denoising Langevin Gibbs (DLG). \textbf{Updating $\bm{x}$.} Suppose we are given an MCMC iterate $(\bm{x}_n,\sigma_n)$ and a score model $s_\theta(\bm{x},\sigma)$ from \eqref{eq:dsm_cont}. We generate $\bm{x}_{n+1}$ by a Langevin dynamics step on $\hat{p}(\bm{x} \mid \sigma_n)$. Specifically, by \eqref{eq:cond}, \begin{align} \nabla_{\bm{x}} \log \hat{p}(\bm{x} \mid \sigma_n) \approx s_\theta(\bm{x}, \sigma_n) \label{eq:dlg_lang} \end{align} and so an Langevin dynamics update on $\bm{x}$, according to \eqref{eq:langevin} is \begin{align} \bm{x}_{n+1} = \bm{x}_n + (\eta/2) \cdot s_\theta(\bm{x}_n,\sigma_n) + \sqrt{\eta} \cdot \bm{\epsilon} \end{align} for $\bm{\epsilon} \sim \mathcal{N}(\bm{0},\bm{I})$. Here, we call $\eta$ the step size. \textbf{Updating $\sigma$.} We now have $\bm{x}_{n+1}$ and need to sample $\sigma_{n+1} \sim \hat{p}(\sigma \mid \bm{x}_{n+1})$. To this end, we first train a DNN noise level classifier $q_{\phi}(\sigma \mid \bm{x})$ to approximate $\hat{p}(\sigma \mid \bm{x})$ by solving \begin{align} \max_{\phi} \mathbb{E}_{\hat{p}(\bm{x},\sigma)} [\log q_{\phi}(\sigma \mid \bm{x})]. \end{align} Specifically, we discretize $[\sigma_{\min},\sigma_{\max}]$ into $M$ levels $\tau_1 = \sigma_{\min} < \tau_2 < \cdots < \tau_M = \sigma_{\max}$. Given $\tau_m$ where $1 \leq m \leq M$, $m$ serves as the label and clean training data corrupted by Gaussian noise of variance $\tau_m^2$ serves as the classifier input. The classifier is trained to predict $m$ by minimizing the cross entropy loss. Having trained a noise level classifier, we sample $\sigma_{n+1}$ by drawing an index $m$ according to the classifier output probability for $\bm{x}_{n+1}$ and setting $\sigma_{n+1} = \tau_m$. In practice, using the index of largest probability worked fine. We denote this process as $\sigma_{n+1} \sim q_{\phi}(\sigma \mid \bm{x}_{n+1})$. \subsection{Practical Considerations} \textbf{Computation cost of $\sigma$ prediction.} We found that using shallow neural networks for the noise classifier $q_{\phi}$ was sufficient to accelerate sampling. Concretely, using a neural net with four convolution layers and one fully connected layer as the classifier, one evaluation of $q_{\phi}$ was around $100 \sim 1000$ times faster than one evaluation of the score model ${\boldsymbol s}_\theta$. So, when comparing sampling methods, we only count the number of score function evaluations (NFE). We also note that the training time $q_{\phi}$ was negligible compared to the training time of $s_\theta$. For instance, on CelebA-HQ-256, training $q_{\phi}$ with the aforementioned architecture for 100 epochs took around 15 minutes on an RTX 2080 Ti. \textbf{Initialization points for DLG.} Theoretically, MCMC chain $\{(\bm{x}_n,\sigma_n)\}_{n = 1}^\infty$ will converge to $\hat{p}(\bm{x},\sigma)$ regardless of the initialization point $(\bm{x}_0,\sigma_0)$. However, we found it was beneficial to set $\bm{x}_0$ close to the image manifold and set $\sigma_0 \sim q_{\phi}(\sigma \mid \bm{x}_0)$. Indeed, theory also shows that setting initialization points close to the stationary distribution could significantly accelerate convergence of the Markov chain \citep{dalalyan2017,dwivedi2019}. In practice, we set $\bm{x}_0$ by generating a sample starting from a noise distribution, adding Gaussian noise of variance $0.25$, and running Gibbs sampling for a few iterations. The NFE involved in generating $\bm{x}_0$ is included in the final per-sample average NFE computation for DLG when comparing methods in Section \ref{sec:exp}. But, we note that this cost vanishes in the limit of infinite sample size. \textbf{Reducing autocorrelation.} Autocorrelation in MCMC chains, i.e., correlation between consecutive samples in the MCMC chain, could reduce the sample diversity of MCMC. A typical technique to reduce autocorrelation is to use every $n_{skip}$-th samples of the MCMC chain for some $n_{skip} > 1$. For DMCMC, this means we denoise every $n_{skip}$-th sample. So, if we use $n_{den}$ NFE to denoise MCMC samples, the average NFE for generating a single sample is around $n_{skip} + n_{den}$. \textbf{Choosing iterates to apply denoising.} The MCMC chain can be partitioned into blocks which consist of $n_{skip}$ consecutive samples. Using every $n_{skip}$-th sample of the MCMC chain corresponds to denoising the last iterate of each block. Instead, to further shorten the length of integration, within each block, we apply denoising to the sample of minimum noise scale $\sigma$. \textbf{Choice of prior $\hat{p}(\sigma)$.} We use $\hat{p}(\sigma) \propto 1/\sigma$ to drive the MCMC chain towards small values of $\sigma$. \begin{figure}[t] \centering \includegraphics[width=1.0\linewidth]{figures/mix.png} \\ \caption{Mixing analysis of DLG with a mixture of Gaussians.} \label{fig:mixing} \end{figure} \begin{figure}[t] \centering \includegraphics[width=1.0\linewidth]{figures/4.png} \caption{Sampling acceleration of DLG on CIFAR10. FID of notable points are written in the corresponding color. \textbf{Top row}: deterministic integrators. \textbf{Bottom row}: stochastic integrators.} \label{fig:cifar10_acc} \end{figure} \section{Experiments} \label{sec:exp} \subsection{Mixing of DMCMC Chains} For DMCMC to successfully generate diverse high-quality data, DMCMC must mix, i.e., traverse between disjoint modes of $p(\bm{x})$. We provide experimental evidence that DMCMC indeed mixes as a consequence of running MCMC in the product space $\mathcal{X} \times \SS$. Specifically, we run fifty Langevin dynamics chains and fifty DLG chains on a mixture of Gaussians (MoG) with $1k$ modes at CIFAR10 images. All chains are initialized at a single mode. For each method, we compute the mode coverage of the samples, the class distribution of the samples, and the autocorrelation of sample image class sequence. Since the noise conditional score function can be calculated analytically for MoGs, this setting decouples sampler performance from score model approximation error. Figure \ref{fig:mixing} shows the results. In the left panel, we observe that Langevin dynamics is unable to escape the initial mode. Increasing the step size $\eta$ of Langevin dynamics caused the chain to diverge. On the other hand, DLG successfully captures all modes of the distribution. DLG samples cover all $1k$ modes at chain length $432$. Middle panel provides evidence that DLG samples correctly reflect the statistics of the data distribution. Finally, the right panel indicates that the DLG chain moves freely between classes, i.e., distant modes. These observations validate our claim that DLG mixes well. \subsection{Accelerating Image Generation with Score Networks} We compare six integrators with and without DLG on CIFAR10 and CelebA-HQ-256 image generation. The deterministic integrators are: the deterministic integrator of \citet{karras2022} (KAR1), the probability flow integrator of \citet{song2021}, and the RK45 solver. The stochastic integrators are: the stochastic integrator of \citet{karras2022} (KAR2), the reverse diffusion integrator of \citet{song2021}, and the Euler-Maruyama method. We use the Fr\'{e}chet Inception Distance (FID) \citep{heusel2017} to measure sample quality. For CIFAR10, we generate $50k$ samples, and for CelebA-HQ-256, we generate $10k$ samples. We use pre-trained score models of \citet{song2021}. \begin{figure}[t] \centering \includegraphics[width=1.0\linewidth]{figures/5.png} \caption{Sampling acceleration of DLG on CelebA-HQ-256. A dot indicates an integrator without DLG, and a cross of the same color indicates corresponding integrator combined with DLG. Dotted lines indicate performance improvement due to DLG.} \label{fig:celeba_acc} \end{figure} \begin{figure}[t] \centering \includegraphics[width=0.497\linewidth]{figures/sample_van.png} \hspace{0.5mm} \includegraphics[width=0.485\linewidth]{figures/sample_dlg.png} \caption{Non-cherry-picked samples on CelebA-HQ-256 using the settings for Fig. \ref{fig:celeba_acc}. Each row shows samples for an integrator without (left col.) and with (right col.) DLG.} \label{fig:samples} \end{figure} \textbf{CIFAR10.} Figure \ref{fig:cifar10_acc} shows the results on CIFAR10. We make two important observations. First, DLG successfully accelerates all six integrators by a non-trivial margin. In particular, if an integrator without DLG already performs well, the integrator combined with DLG outperforms other integrators combined with DLG. For instance, compare the results for KAR1 with those of other deterministic integrators. Second, DLG improves the performance lower bound for some deterministic integrators. Specifically, while the performance of KAR1 and RK45 saturates at around $4$ FID, KAR1 and RK45 combined with DLG achieve better results around $2.4$ FID. \textbf{CelebA-HQ-256.} Figure \ref{fig:celeba_acc} shows the results on CelebA-HQ-256. We observe that DLG improves computational efficiency and sample quality simultaneously. Indeed, in Figure \ref{fig:samples}, we observe remarkable improvements in sample quality despite using fewer NFE. This demonstrates the scalability of DLG to generating high-resolution images. We also note that we did not perform an exhaustive search of DLG hyper-parameters for CelebA-HQ-256, so fine-tuning could yield better results. \textbf{Achieving SOTA.} DLG combined with KAR1 sets a new SOTA record for CIFAR10 in the limited number of NFE setting: $3.86$ FID with $10.11$ NFE and $2.63$ FID with $20.11$ NFE which beats the results of \citet{zhang2022}, $4.17$ FID with $10$ NFE and $2.86$ FID with $20$ NFE. DLG combined with KAR2 sets a new record on CelebA-HQ-256 among score-based models: $6.99$ FID with $158.96$ NFE which beats the current best result of \citet{kim2022}, $7.16$ FID with $4000$ NFE. \begin{figure}[t] \centering \includegraphics[width=1.0\linewidth]{figures/3.png} \caption{Ablation study of DLG with the deterministic integrator of \citet{karras2022}. Dots indicate the points of lowest FID.} \label{fig:ablation} \end{figure} \subsection{Ablation Study} In this section, we perform an ablation study of the components of DLG. Based on the observations, we construct a generic strategy for choosing the hyper-parameters. Given a reverse-S/ODE integrator, DLG is determined by three hyper-parameters: total NFE per sample $n$, NFE spent on denoising samples $n_{den}$, and Langevin dynamics step size $\eta$. We fix the integrator to be the deterministic sampler of \citet{karras2022} and observe the effect of each hyper-parameter on CIFAR10 image generation. We observed the same general trend with other samplers. \textbf{$\bm{\eta}$ vs. $\bm{n}_{\bm{den}}/ \bm{n}$.} In the left panel of Figure \ref{fig:ablation}, we fix NFE and vary $\eta$ and $n_{den}/n$. $n_{den}$ governs individual sample quality, and $n_{skip} = n - n_{den}$ governs sample diversity. Thus, we observe optimal FID is achieved when $n_{den}/n$ has intermediate values, not extreme values near $0$ or $1$. Also, lower $n_{den}/n$ is needed to attain optimality for lower $\eta$. This is because lower $\eta$ means the MCMC chain travels closer to the image manifold at the cost of slower mixing. \textbf{NFE vs. $\bm{n}_{\bm{den}}/ \bm{n}$.} In the middle panel of Figure \ref{fig:ablation}, we fix $\eta$ and vary NFE and $n_{den}/n$. We observe two trends. First, in the small NFE regime, where $10 \leq \text{NFE} \leq 50$, it is beneficial to decrease $n_{den}/n$ as NFE increases. Second, in the large NFE regime, where $\text{NFE} > 50$, it is beneficial to increase $n_{den}/n$ as NFE increases. This is because if $n_{skip}$ is sufficiently large, MCMC chain starts producing essentially independent samples, so increasing $n_{skip}$ further provides no gain. Also, as we increase NFE, the set of $n_{den}/n$ which provides near-optimal performance becomes larger. Moreover, we see that most of the time, optimal FID is achieved when $n_{den} / n > 0.5$, i.e., when $n_{den} > n_{skip}$. So, a reasonable strategy for choosing $n_{den}$ given $\eta$ and NFE budget $n$ is to find smallest $n_{skip}$ which produces visually distinct samples, and then allocate $n_{den} = n - n_{skip}$. \textbf{$\bm{\eta}$ vs. NFE.} In the right panel of Figure \ref{fig:ablation}, we choose optimal (in terms of FID) $n_{den}/n$ for each combination of $\eta$ and NFE. We see choosing overly small or large $\eta$ leads to performance degradation. If $\eta$ is within a certain range, we obtain similarly good performance. In the case of CIFAR10, we found it reasonable to set $\eta \in [0.05,1.0]$. To choose $\eta$ for data of general dimension $d$, we define a value $\kappa \coloneqq \eta / \sqrt{d}$ called displacement per dimension. If we see \eqref{eq:dlg_lang}, Gaussian noise of zero mean and variance $\eta$ is added to the sample at each update step. Gaussian annulus theorem tells us that a high-dimensional Gaussian noise with zero mean and variance $\eta$ has Euclidean norm approximately $\eta \sqrt{d}$. So, the average displacement of the sample per dimension by the random noise is around $\eta / \sqrt{d}$. Since $\kappa$ is a dimension-independent value, given $\kappa$ and $d$, we can set $\eta = \sqrt{d} \kappa$. On CIFAR10, we have $\eta \in [0.05,1.0]$, which translates to $\kappa \in [0.0009, 0.018]$. This means, on CelebA-HQ-256, we can choose $\eta \in [0.4,8.0]$. If the sampler was inefficient, we chose a smaller $\kappa$ to trade-off diversity for sample quality. \section{Conclusion} In this work, we proposed DMCMC which combines MCMC with reverse-S/ODE integrators. This has led to significant improvements for both MCMC and diffusion models. For MCMC, DMCMC allows Markov chains to traverse between disjoint modes. For diffusion models , DMCMC accelerates sampling by reducing the average integration interval length of reverse-S/ODE. We developed a practical instance of DMCMC, called DLG, which uses Langevin dynamics along with Gibbs sampling as the choice of MCMC. We demonstrated the practicality and scalability of DLG through various experiments. In particular, DLG achieved state-of-the-art results on CIFAR10 and CelebA-HQ-256. Overall, our work opens up an orthogonal approach to accelerating score-based sampling. We leave exploration of other kinds of MCMC or diffusion process in DMCMC as future work. \newpage
{'timestamp': '2022-09-30T02:08:47', 'yymm': '2209', 'arxiv_id': '2209.14593', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14593'}
arxiv
\section{Introduction} \section{Minimum message length} \label{sec:mml} Introduced in the late 1960s by Wallace and Boulton, the minimum message length (MML) principle~\cite{WallaceBoulton68, WallaceFreeman87, WallaceDowe99a, Wallace05} is a framework for inductive inference rooted in information theory. The key idea underlying MML is that both parameter estimation and model selection problems can be interpreted as examples of data compression. It is well known that a random data string is not compressible. Conversely, if we have managed to compress a string of data we have (with high probability) learned something about the underlying structure of the data. Given data ${\bf y} \in \mathbb{R}^n$, the MML principle provides a method for computing the minimum length of a message that describes this data. In the MML approach, this message length is the single necessary inferential quantity. For the MML message to be decodable by a receiver, we require that the message encodes both a model for the data as well as the data itself. Formally, a MML message comprises two parts: \begin{enumerate} \item the \emph{assertion}: describes the structure of the model, including all model parameters $\bm{\theta} \in \bm{\Theta} \in \mathbb{R}^p$. Let $I(\bm{\theta})$ denote the codelength of the assertion. \item the \emph{detail}: describes the data ${\bf y}$ using the model $p({\bf y} | \bm{\theta})$ nominated in the assertion. Let $I({\bf y} | \bm{\theta})$ denote the codelength of the detail. \end{enumerate} The total length of the MML message, $I({\bf y}, \bm{\theta})$, measured in units of information (for example, bits) is the sum of the lengths of the assertion and the detail: \begin{equation} \label{eqn:mml:codelength} I(D, \bm{\theta}) = \underbrace{ I(\bm{\theta}) }_{\rm assertion} + \underbrace{I({\bf y} | \bm{\theta})}_{\rm detail} . \end{equation} The length of the assertion measures the complexity of the model, with longer assertions able to state more parameters with high accuracy or describe more complicated model structures. In contrast, a short assertion may encode the model parameters imprecisely and describe only simple models. The length of the detail tells us how well the model stated in the assertion is able to fit or describe the data. A complex model, that is one with a long assertion, will have lots of explanatory power and be able to encode more data strings using fewer bits compared to a simple model. MML seeks the model \begin{equation} \hat{\bm{\theta}}({\bf y}) = \argmin_{\bm{\theta} \in \bm{\Theta}} \left\{ I({\bf y}, \bm{\theta}) \right\} \label{eqn:mml} \end{equation} that minimises the length of the two-part message message. The key point is that minimising the two part message requires balancing the complexity of the model (assertion) with how well the model describes the data (detail). Ideally, we wish to find the simplest model that fits the observed data well enough; essentially, a formalisation of the famous razor of Occam. An advantage of MML is that the message length, measured in (say) bits, is a universal gauge that allows comparison across models with different model structures and numbers of parameters. As long as we can compute the MML codelengths of models, we can compare them. In this fashion, an MML practitioner is able to compare, for example, a linear regression model~\cite{SchmidtMakalic09c}, to a finite mixture model~\cite{WallaceDowe00} to a decision tree~\cite{WallacePatrick93} via their codelengths for some observed data set. The aim of this article is to introduce the MML principle of inductive inference to readers that may not be overly familiar with information theoretic statistics. We will examine two key MML codelength solutions to (\ref{eqn:mml}): the exact, or the so called Strict MML codelength (see Section~\ref{sec:smml}), and a practical approximation to the exact codelength (see Section~\ref{sec:mml87}). We will demonstrate how to perform MML analysis of two common statistical problems: the two-sample $t$-test problem (see Section~\ref{sec:mml:ttest}) and testing of the correlation coefficient (see Section~\ref{sec:mml:corr}). Lastly, we compare MML to minimum description length (MDL), an alternative approach to inductive inference developed independently by Rissanen and colleagues~\cite{Rissanen78,Rissanen96,RissanenRoos07a,Rissanen09b}. \subsection{Strict Minimum Message Length} \label{sec:smml} The exact solution to (\ref{eqn:mml}) is usually called Strict MML~\cite{WallaceBoulton75, Wallace05}, and may be viewed as a ``gold standard' which more tractable formulae seek to approximate. To describe Strict MML we shall closely follow the notation in~\cite{Wallace05} (pp. 154--155). Let \begin{equation} r({\bf y}) = \int \pi(\bm{\theta}) p({\bf y} | \bm{\theta}) \, d\bm{\theta} , \end{equation} denote the marginal distribution of the $n$ data points ${\bf y}$ given a prior distribution $\pi(\bm{\theta})$ over the model parameters $\bm{\theta} \in \mathbb{R}^p$. We note that MML is strictly Bayesian and requires a prior distribution for the model parameters in order to perform inference. Next we define the subset $\Theta^* = \{\bm{\theta}^*_1, \bm{\theta}^*_2, \ldots\} \subset \Theta$ as the set of parameters that can be used to encode the data ${\bf y}$, where each $\bm{\theta}_j^*$ may be encoded with different codelength. Recall that the assertion describes the model structure and all model parameters $\bm{\theta} \in \Theta$. To encode the assertion we require that $\Theta^*$ be a countable set as the assertion is finite and can encode only a countable subset of $\Theta$. Clearly, in many inference problems the parameter set $\Theta$ is continuous and not countable and the question of how to quantize the parameter space $\Theta$ into a countable set $\Theta^*$ is a key issue in MML inference. Assuming we have somehow obtained the quantized parameter set $\Theta^*$, the code for $\Theta^*$ implies a probability distribution over the set $\Theta^*$ since \begin{equation*} p(\bm{\theta}^*_j) = q_j > 0, \quad \sum_{j: \bm{\theta}_j^* \in \Theta^*} q_j = 1, \quad (j = 1,2,\ldots). \end{equation*} The assertion is completely determine by the set $\Theta^*$ and a distribution (code) over the set implying that a $\bm{\theta}_j^*$ should be optimally encoded with length $-\log q_j$. The second part of the message, the detail, is the encoding of the data given the model $\hat{\bm{\theta}} (\equiv \bm{\theta}_j^*)$ specified in the assertion. Once we have chosen the model $\hat{\bm{\theta}}$, the data ${\bf y}$ can be encoded with length $-\log p({\bf y} | \hat{\bm{\theta}})$. Let $t_j = \{{\bf y} \in \mathbb{R}^n: m({\bf y}) = \bm{\theta}^*_j\}$ denote the set of data values ${\bf y}$ that will be encoded using some parameter $\bm{\theta}^*_j \in \Theta^*$ in the detail component of the message. Similarly, denote by $q_j = q(\bm{\theta}^*_j)$ the probability mass associated with parameter $\bm{\theta}^*_j \in \Theta^*$ used to construct the assertion codeword for $\bm{\theta}^*_j$. Strict MML seeks the mapping $m(\cdot)$ which minimizes the expected codelength of the message~\cite{Wallace05} (pp. 155) \begin{align} I_S &= \sum_{{\bf y} \in \mathbb{R}^n} r({\bf y}) \left[ - \log q(m({\bf y})) - \log p({\bf y} | m({\bf y}) \right], \label{eqn:smml:codelength1} \end{align} where the expectation is taken with respect to the marginal distribution of the data. The first term in the expectation, $-\log q(m({\bf y}))$, is the length of the codeword stating parameter $\bm{\theta}^*_j \in \Theta^*$ in the assertion, while the second term, $-\log p({\bf y} | m({\bf y}))$, denotes the codelength of a data set ${\bf y}$ encoded using parameter $\bm{\theta}^*_j$. \begin{table*}[tb] \footnotesize \begin{center} \begin{tabular}{cllc} \toprule[1pt] $n$ & SMML PARTITION & $\Theta^*$ & $I_S$ (bits) \\ \cmidrule{1-4} 1 &\{0..1\} &\{0.500\} & 1.000\\ 2 &\{0..0, 1..2\} &\{0.000, 0.750\} & 1.667\\ 3 &\{0..0, 1..3\} &\{0.000, 0.667\} & 2.085\\ 4 &\{0..0, 1..3, 4..4\} &\{0.000, 0.500, 1.000\} & 2.454\\ 5 &\{0..0, 1..4, 5..5\} &\{0.000, 0.500, 1.000\} & 2.704\\ 6 &\{0..0, 1..5, 6..6\} &\{0.000, 0.500, 1.000\} & 2.962\\ 7 &\{0..3, 4..7\} &\{0.214, 0.786\} & 3.165\\ 8 &\{0..2, 3..7, 8..8\} &\{0.125, 0.625, 1.000\} & 3.337\\ 9 &\{0..0, 1..5, 6..9\} &\{0.000, 0.333, 0.833\} & 3.491\\ 10 &\{0..0, 1..4, 5..9, 10..10\} &\{0.000, 0.250, 0.700, 1.000\} & 3.647\\ 11 &\{0..0, 1..5, 6..10, 11..11\} &\{0.000, 0.273, 0.727, 1.000\} & 3.762\\ 12 &\{0..0, 1..6, 7..11, 12..12\} &\{0.000, 0.292, 0.750, 1.000\} & 3.887\\ 13 &\{0..0, 1..6, 7..12, 13..13\} &\{0.000, 0.269, 0.731, 1.000\} & 3.998\\ 14 &\{0..3, 4..10, 11..14\} &\{0.107, 0.500, 0.893\} & 4.107\\ 15 &\{0..0, 1..5, 6..12, 13..15\} &\{0.000, 0.200, 0.600, 0.933\} & 4.204\\ 16 &\{0..0, 1..5, 6..12, 13..16\} &\{0.000, 0.188, 0.563, 0.906\} & 4.289\\ 17 &\{0..0, 1..6, 7..13, 14..17\} &\{0.000, 0.206, 0.588, 0.912\} & 4.372\\ 18 &\{0..0, 1..5, 6..12, 13..17, 18..18\} &\{0.000, 0.167, 0.500, 0.833, 1.000\} & 4.457\\ 19 &\{0..0, 1..5, 6..12, 13..18, 19..19\} &\{0.000, 0.158, 0.474, 0.816, 1.000\} & 4.531\\ 20 &\{0..0, 1..6, 7..14, 15..19, 20..20\} &\{0.000, 0.175, 0.525, 0.850, 1.000\} & 4.601\\ 21 &\{0..0, 1..6, 7..14, 15..20, 21..21\} &\{0.000, 0.167, 0.500, 0.833, 1.000\} & 4.665\\ 22 &\{0..0, 1..6, 7..15, 16..21, 22..22\} &\{0.000, 0.159, 0.500, 0.841, 1.000\} & 4.737\\ 23 &\{0..3, 4..11, 12..19, 20..23\} &\{0.065, 0.326, 0.674, 0.935\} & 4.801\\ 24 &\{0..2, 3..9, 10..17, 18..23, 24..24\} &\{0.042, 0.250, 0.563, 0.854, 1.000\} & 4.863\\ 25 &\{0..0, 1..6, 7..15, 16..22, 23..25\} &\{0.000, 0.140, 0.440, 0.760, 0.960\} & 4.920\\ 26 &\{0..0, 1..6, 7..14, 15..22, 23..26\} &\{0.000, 0.135, 0.404, 0.712, 0.942\} & 4.974\\ 27 &\{0..0, 1..6, 7..15, 16..23, 24..27\} &\{0.000, 0.130, 0.407, 0.722, 0.944\} & 5.025\\ 28 &\{0..3, 4..12, 13..21, 22..27, 28..28\} &\{0.054, 0.286, 0.607, 0.875, 1.000\} & 5.080\\ 29 &\{0..4, 5..13, 14..22, 23..28, 29..29\} &\{0.069, 0.310, 0.621, 0.879, 1.000\} & 5.129\\ 30 &\{0..0, 1..5, 6..14, 15..23, 24..29, 30..30\} &\{0.000, 0.100, 0.333, 0.633, 0.883, 1.000\} & 5.176\\ \vspace{-3mm} \\ \bottomrule[1pt] \vspace{+1mm} \end{tabular} \caption{SMML partitions for a binomial distribution under a uniform prior on the probability of success. The countable set $\Theta^*$ denotes the parameters that would be used to code the data.\label{tab:smml:binomial}} \end{center} \end{table*} First, note that (\ref{eqn:smml:codelength1}) minimizes the expected codelength over all possible data values because the map $m(\cdot)$ depends on unobserved data values that could be generated by $r({\bf y})$, and not just on the particular data set that has been observed. Second, the expression for the expected codelength includes a sum over all possible data sets of size $n$ as SMML considers the space of data to be countable. This is reasonable since we are interested in computing the length of a message that transmits the observed data and this message must be finite. The expected codelength can be written as \begin{align} \nonumber I_S &= -\sum_{\bm{\theta}^*_j \in \Theta^*} \sum_{{\bf y}_i \in t_j} r({\bf y}_i) \left( \log q(\bm{\theta}^*_j) + \log p({\bf y}_i | \bm{\theta}^*_j) \right),\\ \label{eq:smml:optim} &= \underbrace{-\sum_{\bm{\theta}^*_j \in \Theta^*} q(\bm{\theta}_j) \log q(\bm{\theta}^*_j) }_{\text{assertion}} \underbrace{-\sum_{\bm{\theta}^*_j \in \Theta^*} \sum_{y_i \in t_j} r({\bf y}_i) \log p({\bf y}_i | \bm{\theta}^*_j) }_{\text{detail}}, \end{align} where the coding probability of $\bm{\theta}^*_j \in \Theta^*$ is \begin{equation} q(\bm{\theta}^*_j) = \sum_{{\bf y}_i \in t_j} r({\bf y}_i) , \end{equation} which is the sum of the marginal probabilities of the data values that result in the estimate $\bm{\theta}^*_j\in \Theta^*$ being used in the detail. The first term in the expected Strict MML codelength is the \emph{expected} length of the assertion, while the second term gives the expected length of the detail. Strict MML seeks to minimize the expected codelength since the map $m(\cdot)$ depends on all data values ${\bf y} \in \mathbb{R}^n$ and not just the observed data. By seeking the optimal map $m(\cdot)$, Strict MML partitions the data space into disjoint regions $t_j$, such that all data sets that fall within a particular region $t_j$ are encoded with the same parameter value $\bm{\theta}^*_j \in \Theta^*$. This partitioning of the data space yields the quantized parameter set $\Theta^*$ where members of $\Theta^*$ are the feasible parameter estimates, with $m({\bf y})$ being the point estimate associated with data string ${\bf y}$. The countable set $\Theta^*$ that minimises (\ref{eq:smml:optim}) is not necessarily unique; however this is of no practical consequence as all optimal $\Theta^*$ result in an efficient encoding, and hence feasible parameter values~\cite{Wallace05} (pp. 161). The Strict MML codelength is invariant to data and model representation and represents the shortest two-part codelength for a message that conveys the data and a model for the data. Strict MML has very close links to fundamental concepts such as Turing machines and Kolmolgorov complexity~\cite{WallaceDowe99c}. We note that, while as have assumed the data space to be discrete in our exposition of Strict MML, this is not necessary and the Strict MML code for continuous data is a straightforward extension of the codelength (\ref{eq:smml:optim}); see~\cite{Wallace05}, pp. 166--169. Unfortunately, the computational complexity of partitioning the data space and obtaining $\Theta^*$ is NP complete in general and only practically computable for simple models~\cite{FarrWallace02}. To see this, we note that the Strict MML data space partitioning problem is an example of the well-known set partitioning problem (also known as the coalition structure generation problem in the artificial intelligence research community) provided the data space is countably finite~\cite{LamarchePerrin14,RahwanEtAl15}. The set partitioning problem is known to be NP complete in general and cannot be solved by brute-force search as the total number of possible partitions, assuming a finite data space of size $n$, is the $n$-th Bell number $B_n$~\cite{Bell34} and satisfies $\alpha n^n \leq B_n \leq n^n$ for some $\alpha > 0$~\cite{SandholmEtAl99}. In some cases, constraints that impose structure and reduce the search space can be assumed. For example, if the data space is one-dimensional and ordered like in the example below, this is know as the ordered set partitioning problem and is identical to the shortest path problem that can be solved in $O(n^2)$ polynomial time. \\ {\noindent \bf Example: } Consider data $y$ representing the number of successes in $n$ trials which follows the binomial distribution with unknown success probability $\theta \in \Theta = [0,1]$; that is, \begin{equation} \label{eqn:pdf:binomial} p(y | \theta) = \binom{n}{y} \theta^y (1 - \theta)^{n - y} . \end{equation} Suppose that the success probability $\theta$ is assumed equally likely to take on any value in the parameter space $\Theta$ a priori; in other words, we assume the uninformative prior distribution $\pi(\theta) = 1$. The marginal distribution of the data is \begin{equation*} r(y) = \int_0^1 p(y | \theta) \pi(\theta) d\theta = \int_0^1 \binom{n}{y} \theta^y (1 - \theta)^{n - y} d\theta = \frac{1}{n+1} . \end{equation*} To construct a Strict MML code for the binomial distribution we require the map $m(\cdot)$ that minimizes the expected codelength (\ref{eq:smml:optim}) over all possible data sets $y \in \mathbb{N} = \{0,1,\ldots,n\}$, where the expectation is taken with respect to $r(y)$. This optimal codelength will be based on an optimal partitioning of the data space which implicitly yields the quantized parameter set $\Theta^*$. The expected Strict MML codelength for the binomial distribution is \begin{equation*} I_S = -\sum_{\theta^*_j \in \Theta^*} q(\theta_j^*) \log q(\theta^*_j) -\sum_{\theta^*_j \in \Theta^*} \sum_{y_i \in t_j} \left(\frac{1}{n+1} \right) \log \binom{n}{y_i} (\theta_j^*)^{y_i} (1 - \theta_j^*)^{n - y_i} , \quad % q(\theta^*_j) = \sum_{y_i \in t_j} \frac{1}{n+1}, \end{equation*} and $t_j$ is the set of data values $y_i$ that will be encoded using $\theta_j^* \in \Theta^*$. For a given partition $\Theta^*$, the contribution each estimate $\theta_j^*$ makes to the expected codelength is part of the detail only and does not influence the codelength of the assertion. To minimize the expected codelength for a particular $\theta_j^*$, we therefore only need to minimize the second part of the message \begin{equation*} - \sum_{y_i \in t_j} r(y_i) \log \binom{n}{y_i} (\theta_j^*)^{y_i} (1 - \theta_j^*)^{n - y_i} . \end{equation*} Clearly, the $\hat{\theta}^*_j$ that minimizes the above is \begin{equation*} \hat{\theta}_j^* = \frac{\sum_{y_i \in t_j} r(y_i) y_i}{n \sum_{y_i \in t_j} r(y_i)} = \frac{1}{n |t_j|} \sum_{y_i \in t_j} y_i, \quad j = 1,2,\ldots , \end{equation*} where $|t_j|$ denotes the size of the set $t_j$; i.e., the number of data values that are encoded with parameter $\theta_j^*$. It remains to determine the optimal data space partitions $t_j$ and hence the quantized set $\Theta^*$. Before we look at the optimal Strict MML partitioning, we shall look at two examples with suboptimal codelengths. The simplest possible partitioning of the data space $\{0,1,\ldots, n\}$ assumes that all data values are in the same partition, say, $t_1 = \{0, 1, \ldots, n\}$, where the size of the partition is $|t_1| = (n+1)$. This implies that the quantized parameter set $\Theta^* = \{ \theta^*\}$ consists of a single member \begin{equation*} \hat{\theta}^* = \frac{1}{n |t_1|} \sum_{y_i \in t_1} y_i = \frac{1}{2} . \end{equation*} which has probability $q(\theta^*) = 1$. The expected codelength of the assertion is then 0 bits and the expected codelength of the detail, and hence the total codelength, is \begin{equation*} I_S = n \log 2 - \left(\frac{1}{n+1}\right)\sum_{i=0}^n \log \binom{n}{i} . \end{equation*} For example, for $n = 10$ and assuming a single partition that contains all possible data of size $n$, the Strict MML codelength for some observed data $y$ is approximately 5.01 bits; here, the estimate of the success probability is $\hat{\theta} = 0.5$. Alternatively, consider the more complex partitioning where the data space is divided into $(n+1)$ partitions with each datum $y_i \in \mathbb{N}$ belonging to its own partition. In this case, there are $(n+1)$ possible estimates and $\Theta^* = \{ \theta^*_j: \theta^*_j = j / n, j=0,1,\ldots,n\}$. The probability of each estimate is \begin{equation*} q_j = q(\theta^*_j) = \sum_{y_i \in t_j} r(y_i) = \frac{1}{n+1}, \quad j = 0, \ldots, n. \end{equation*} The expected Strict MML codelength is now \begin{equation*} I_S = \log(n+1) -\frac{1}{n+1}\sum _{i=0}^n \log \binom{n}{i} \left(\frac{i}{n}\right)^i \left(1-\frac{i}{n}\right)^{n-i} . \end{equation*} For the $n=10$ example, the total codelength of this partitioning is approximately 9.84 bits. This codelength is significantly worse than the single partition Strict MML code. It is possible to compute the optimal Strict MML solution for the binomial distribution using the dynamic programming algorithm of Farr and Wallace~\cite{FarrWallace02}. The results of the algorithm are shown in Table~\ref{tab:smml:binomial} for all $1 \leq n \leq 30$; a MATLAB implementation of this algorithm can be downloaded from the Mathworks File Exchange website (ID: 80167). When $n=10$, for example, Strict MML partitions the data space into four partitions $\{0, 1..4, 5..9, 10\}$ yielding the parameter set $\Theta^* = \{ 0.00, 0.25, 0.70, 1.00 \}$. This implies that if we observe between 5 and 9 success counts, the estimated probability of success is 0.7. In contrast, if $0$ or $10$ success counts were observed, we would estimate the probability of success as 0 and 1, respectively. The Farr and Wallace algorithm is applicable to any one dimensional Strict MML problem with discrete data and is of polynomial complexity in terms of the sample size $n$. \\ An algorithm to obtain optimal Strict MML codelengths for one dimensional continuous data from exponential families with continuous sufficient statistics was developed by Dowty~\cite{Dowty15a}. Unfortunately, there exists no general algorithm for computing optimal Stict MML partitions outside of the one dimensional (continuous or discrete) data setting. In the case of the $k$-nomial distribution with $k>2$, the Strict MML data partitioning problem is an instance of the set partitioning (coalition structure generation) over graphs. While a dynamic programming algorithm exists to solve this problem, it runs in exponential time and is only practical for small sample sizes~\cite{MichalakEtAl16}. We note that many anytime exact algorithms and heuristic algorithms have also been proposed for this setting; see Rahwan et. al for a recent survey~\cite{RahwanEtAl15}. \subsection{A practical approximation to the Strict MML codelength} \label{sec:mml87} Due to the high computational complexity of deriving the exact Strict MML codelength, Strict MML is mostly of interest from a theoretical standpoint. There exist several approximations to the Strict MML codelength with the MML87 approximation~\cite{WallaceFreeman87,Wallace05} being the most popular. Under some regularity conditions~\cite{Wallace05}) (pp. 226), the MML87 codelength for data $D$ is \begin{equation} \label{eqn:mml87:codelength} \mathcal{I}_{87}({\bf y}, \bm{\theta}) = \underbrace{-\log \pi(\bm{\theta}) + \frac{1}{2} \log \abs{J_{\bm{\theta}}(\bm{\theta})} + \frac{p}{2} \log \kappa_p}_{\rm assertion} + \underbrace{\frac{p}{2} - \log p({\bf y}|\bm{\theta})}_{\rm detail} \end{equation} where $\pi_{\bm{\theta}}(\bm{\theta})$ is the prior distribution for the parameters $\bm{\theta}$, $\abs{J_{\bm{\theta}}(\bm{\theta})}$ is the determinant of the expected Fisher information matrix, $p({\bf y}|\bm{\theta})$ is the likelihood function of the model and $\kappa_p$ is a quantization constant~\cite{ConwaySloane98,AgrellEriksson98}; for small $p$ we have \begin{equation} \kappa_1 = \frac{1}{12}, \quad \kappa_2 = \frac{5}{36 \sqrt{3}}, \quad \kappa_3 = \frac{19}{192 \times 2^{1/3}}, \end{equation} while, for large $p$, $\kappa_p$ is well-approximated by~\cite{Wallace05}: \begin{equation} \frac{p}{2} (\log \kappa_p + 1) \approx -\frac{p}{2} \log 2\pi + \frac{1}{2} \log p \pi - \gamma, \end{equation} where $\gamma \approx 0.5772$ is the Euler--Mascheroni constant. In contrast to SMML, which quantizes the parameter space by associating a single parameter estimate with a number of different data strings, the MML87 approximation achieves computational tractability by instead associating a set of models, deemed ``indistinguishable'' in an information sense, with the observed data string ${\bf y}$. This set of parameter estimates can be thought of as the range of possible parameter estimates that a plausible choice of $m(\cdot)$ would associate with the data string ${\bf y}$. The volume of this set of models, which is called the \emph{uncertainty region} in MML parlance, explicitly determines the accuracy to which the continuous model parameters should be stated (i.e., the degree of quantization). We can re-write the codelength of the assertion in terms of the volume of the uncertainty region $w(\bm{\theta})$ as follows \begin{equation} \underbrace{-\log \pi(\bm{\theta}) w(\bm{\theta})}_{\rm assertion}, \quad w(\bm{\theta}) = \left( \abs{J_{\bm{\theta}}(\bm{\theta})} \kappa_p^p \right)^{-1/2} . \end{equation} It is clear that the volume of the uncertainty region depends on the variation of the negative log-likelihood function. If a small change in $\bm{\theta}$ results in a large change in the log-likelihood, the volume of the uncertainty region will be relatively small, implying that the parameters must be stated with higher precision. In contrast, if the negative log-likelihood is not particularly sensitive to small changes in $\bm{\theta}$, the volume of the uncertainty region will be fairly large. Under suitable regularity conditions, the volume of the uncertainty region is $O(n^{-p/2})$. For many sufficiently well-behaved models, the MML87 codelength is virtually identical to the Strict MML codelength while being simpler to compute, requiring only the prior distribution for the model parameters and the determinant of the expected Fisher information matrix. Unlike the Strict MML codelength $I_S$ (\ref{eqn:smml:codelength1}) which must be found via minimization of an expectation, taken over all possible data with respect to the marginal distribution $r(\cdot)$, the MML87 codelength is computed using the observed data only. For large sample sizes $n \to \infty$, it is easy to show that the MML87 codelength is asymptotically equivalent to the well-known Bayesian information criterion (BIC)~\cite{Schwarz78} \begin{equation} \label{eqn:mml87:bic} \mathcal{I}_{87}({\bf y}, \bm{\theta}) = - \log p({\bf y}|\bm{\theta}) + \frac{p}{2} + O(1) , \end{equation} where the $O(1)$ term depends on the prior distribution, the Fisher information and the number of parameters $p$. In fact, as the MML87 codelength $\mathcal{I}_{87}({\bf y}, \bm{\theta})$ can be interpreted as the negative logarithm of the posterior probability mass attached to a dataset ${\bf y}$ and model $\bm{\theta}$, the difference in message lengths admits the interpretation as the logarithm of the posterior-odds of two models, e.g., \[ \mathcal{I}_{87}({\bf y}, \bm{\theta}_0) - \mathcal{I}_{87}({\bf y}, \bm{\theta}_1) \] can be interpretated as the posterior log-odds in favour of model $\bm{\theta}_1$ against $\bm{\theta}_0$. The MML87 codelength results in estimates that are invariant under (smooth) one-to-one reparametarization, just like the maximum likelihood estimate. MML87 has been applied to a wide range of statistical models including decision tress~\cite{WallacePatrick93}, factor analysis~\cite{WallaceFreeman92} and mixture models~\cite{WallaceDowe00}. \\ \noindent {\bf Example:} We will compute the MML87 codelength for the binomial distribution and compare it to the Strict MML code~\cite{Wallace05} (pp. 246). Let $y \in [0, n]$ be the count of successes which follows a binomial distribution with probability density function (\ref{eqn:pdf:binomial}) where $0 < \theta < 1$ is the probability of observing a success. Suppose we assume a uniform prior distribution for the success probability $\pi(\theta) = 1$. The determinant of the expected Fisher information matrix for a binomial distribution is $J(\theta) = n/(\theta(1-\theta))$. The volume of the uncertainty region is \begin{equation*} w(\theta) = \left(\frac{12 (1-\theta ) \theta }{n}\right)^{1/2} \end{equation*} which gets smaller as $n \to \infty$, or as the success probability $\theta$ approaches $\theta \to 0$ or $\theta \to 1$. Substituting into the MML87 codelength (\ref{eqn:mml87:codelength}) we obtain \begin{align} \mathcal{I}_{87}(y, \theta) &= \frac{1}{2} \log \left( \frac{n}{\theta(1-\theta)} \right) + \frac{1}{2} \log \frac{1}{12} - \log \binom{n}{y} \theta^y (1 - \theta)^{n - y} + \frac{1}{2} \nonumber \\ &= -\left(y + \frac{1}{2}\right) \log \theta - \left(n - y + \frac{1}{2}\right) \log (1 - \theta) + \frac{1}{2} \left(1 + \log \frac{n}{12 \binom{n}{y}^2}\right) \end{align} This codelength is minimized by choosing $\theta$ to be the MML87 estimate \begin{equation} \hat{\theta}(y) = \frac{y + 1/2}{n + 1} , \end{equation} which results in the optimal MML87 codelength for data $y$ being \begin{align*} \mathcal{I}_{87}(y)= -\left(y + \frac{1}{2}\right) \log \hat{\theta}(y) - \left(n - y + \frac{1}{2}\right) \log (1 - \hat{\theta}(y)) + \frac{1}{2} \left(1 + \log \frac{n}{12 \binom{n}{y}^2}\right) . \end{align*} As an example, if $n = 10$ and $y = 3$, the MML87 estimate of the success probability is $\hat{\theta}(y) = 7/22 \approx 0.32$, the volume of the uncertainty region is $w(\theta) \approx 0.51$ and the MML87 codelength is approximately 3.61 bits. In contrast, the SMML estimate of the success probability is $\hat{\theta}(y) = 0.25$ resulting in a codelength of 3.647 bits. We can empirically show that the expected MML87 codelength with respect to the marginal distribution $r(y) = 1/(n+1)$ falls within 0.1 bits of the expected Strict MML codelength for all $n \geq 5$, while being significantly simpler to compute. \section{Minimum message length $t$-test} \label{sec:mml:ttest} Perhaps the most popular hypothesis test in practice is the frequentist two-sample $t$-test for comparison of two means. As an example of the $t$-test popularity, a search for the term `paired $t$-tests' returns approximately 12,000 articles from 1990 onwards in PubMed. Similarly, articles published in peer reviewed psychology journals feature, on average, more than three $t$-tests per article~\cite{WetzelsEtAl11}. Formally, the $t$-test assumes that we observe normally distributed data from two, possibly different, populations: \begin{equation} Y_{1i} \sim \mathcal{N}\left(\mu + \frac{\sigma \delta}{2}, \sigma^2\right), \quad Y_{2j} \sim \mathcal{N}\left(\mu - \frac{\sigma \delta}{2}, \sigma^2\right) , \end{equation} for $i=1,\ldots,n_1$ and $j = 1, \ldots, n_2$. Here, the unknown parameter $\mu \in \mathbb{R}$ is the overall (grand) mean, $\sigma > 0$ is a standard deviation that is common to both groups, $\delta>0$ is the standardised effect size and $(n_1, n_2)$ are the sample sizes of the two groups. This formulation of the $t$-test in terms of the overall mean and standardised effect size is due to \cite{GonenEtAl05}. The usual null hypothesis says that the mean is the same in both groups while the alternative hypothesis specifies a different mean for each group; formally, we have \begin{equation} \mathcal{H}_0: \delta = 0, \quad \mathcal{H}_1: \delta \neq 0 . \end{equation} Let $\bm{\theta}_0 = \{\mu, \sigma\} \in (\mathbb{R} \times \mathbb{R}_+) \equiv \Theta_0$ and $\bm{\theta}_1 = \{\mu, \sigma, \delta\} \in (\mathbb{R}^2 \times \mathbb{R}_+) \equiv \Theta_1$ denote the parameter set under the two models. Given data ${\bf y} = \{{\bf y}_1, {\bf y}_2\}$ where ${\bf y}_1 = (y_{1,1}, \ldots, y_{n_1,1})^\prime$ and ${\bf y}_2 = (y_{2,1}, \ldots, y_{n_2,1})^\prime$, the task is estimate the effect size $\delta > 0$ and thus determine whether the population means of the two groups are equal ($\delta = 0$). Recently, there has been a great deal of interest in Bayesian alternatives to the frequentist $t$-test~\cite{GonenEtAl05,RouderEtAl09,WangLiu16,GronauEtAl19,Kelter21}. A key quantity in Bayesian analysis is the Bayes factor \begin{equation} \underbrace{ \frac{P(\mathcal{H}_1 | {\bf y})}{P(\mathcal{H}_0 | {\bf y})} }_{\text{Posterior odds}} = \underbrace{ \frac{p({\bf y} | \mathcal{H}_1)}{p({\bf y} | \mathcal{H}_0)} }_{\text{Bayes factor}} \underbrace{ \frac{P(\mathcal{H}_1)}{P(\mathcal{H}_0} }_{\text{Prior odds}} , \end{equation} which is the ratio of the marginal likelihoods of the data obtained by integrating the parameters out with respect to their prior distribution; that is, \begin{equation} p({\bf y} | \mathcal{H}_i) = \int p({\bf y} | \bm{\theta}_i) \pi_i(\bm{\theta}_i) \, d\bm{\theta}, \quad i = 0, 1 , \end{equation} where $\pi_i(\bm{\theta}_i)$ is the prior distribution of the parameters under model $i$. The Bayes factor, henceforth denoted by BF$_{10}$, measures the amount of evidence in support of hypothesis $\mathcal{H}_1$ over hypothesis $\mathcal{H}_0$, where BF$_{10} > 3$ indicates substantial evidence in favour of $\mathcal{H}_1$~\cite{KassRaftery95}. Given a proper prior $\pi(\delta)$ on the effect size $\delta$, Gronau et al.~\cite{GronauEtAl19}, generalizing the work of \cite{GonenEtAl05,RouderEtAl09}, showed that the Bayes factor for the $t$-test problem can be expressed as \begin{equation} \text{BF}_{10} = \frac{\int T_\nu(t | \sqrt{n_\delta} \delta ) \pi(\delta) \, d\delta }{T_{\nu}(t)} \end{equation} where $t$ is the observed $t$-statistic \begin{equation} t = \sqrt{n_\delta} (\bar{\bf y}_1 - \bar{\bf y}_2) / s_p, \quad \nu s_p = (n_1 - 1) s_1^2 + (n_2 - 1) s_2^2, \end{equation} and $s_j$ ($j=1,2)$ are the usual unbiased sample variance estimates. Here, $\nu = n_1 + n_2 - 2$ denotes the degrees of freedom, $n_\delta = (1/n_1+1/n_2)^{-1}$ is the effective sample size, and $T_\nu(\cdot|a)$ is the non-central Student $t$ distribution with degrees of freedom $\nu$ and non-centrality parameter $a$. For most prior distributions $\pi(\delta)$, the integral in the Bayes factor must be computed by numerical integration. In order to perform the two-sample $t$ test within the MML framework, we require the codelengths of the data under the null distribution $(\delta = 0)$ and under the alternative hypothesis $(\delta \neq 0)$. Under the null model, the negative log-likelihood of the data ${\bf y}$ is \begin{eqnarray} -\log \ell_0(\bm{\theta}_0) &=& \frac{n_1}{2} \log(2 \pi \sigma^2) + \frac{1}{2 \sigma^2} \sum_{i=1}^{n_1} \left(y_{1i} - \mu\right)^2 + \frac{n_2}{2} \log(2 \pi \sigma^2) + \frac{1}{2 \sigma^2} \sum_{j=1}^{n_2} \left(y_{2j} - \mu\right)^2, \nonumber \\ &=& \frac{n}{2} \log(2 \pi \sigma^2) + \frac{1}{2 \sigma^2} \sum_{i=1}^{n} \left(y_{i} - \mu\right)^2, \nonumber \end{eqnarray} where ${\bf y} = (y_1, \ldots, y_n)$ denotes the two-samples stacked into a single data vector of length $n = (n_1 + n_2)$. Let $\pi_0(\bm{\theta}_0)$ denote the prior distributions for the parameters under the null hypothesis. We use the usual right Haar prior for the mean and standard deviation: \begin{equation} \pi_0(\bm{\theta}_0) = (\Omega \sigma)^{-1} \end{equation} defined over some suitable parameter range $\Omega$ implying a location and scale invariant distribution of the mean and standard deviation, respectively. The determinant of the expected Fisher information matrix for the normal distribution is $|J(\bm{\theta}_0)| = 2n^2/\sigma^4$ leading to the MML87 codelength: \begin{align*} \mathcal{I}_0({\bf y}, \bm{\theta}_0) &= -\log \ell_0(\bm{\theta}_0) + \frac{1}{2} \log |J(\bm{\theta}_0)| - \log \pi_0(\bm{\theta}_0) + \log \kappa_2 + 1 \\ &= \frac{1}{2 \sigma^2} \sum_{i=1}^{n} \left(y_{i} - \mu\right)^2 + (n-1) \log (\sigma ) + \frac{1}{2} \log \left( 2^{n+1} \pi^n \left(n e \kappa _2 \Omega \right)^2\right) \end{align*} where $\kappa_2 = 5/36/\sqrt{3} \approx 0.0802$. MML estimates that minimize the codelength $\mathcal{I}_0({\bf y}, \bm{\theta}_0)$ correspond to the usual sample mean and the unbiased sample variance estimates \begin{equation} \hat{\mu}({\bf y}) = \frac{1}{n} \sum_{i=1}^n y_i = \bar{\bf y}, \quad \hat{\sigma}^2({\bf y}) = \frac{1}{n-1} \sum_{i=1}^n (y_i - \bar{\bf y})^2 . \end{equation} The minimum MML87 codelength for the data under the null hypothesis is then \begin{equation} \mathcal{I}_0({\bf y}) = \frac{n-1}{2} \left( 1 + \log \hat{\sigma}^2({\bf y}) \right) + \frac{1}{2} \log \left( 2^{n+1} \pi^n \left(n e \kappa _2 \Omega \right)^2\right) \end{equation} We observe that the MML principle allows for automatic parameter estimation and model selection, as long as we can compute codelengths of the candidate models. Next, we derive the MML87 codelength for the alternative hypothesis where the two means are different at population level ($\delta \neq 0$). Recall that $\bm{\theta}_1 = \{\mu, \sigma, \delta\} \in (\mathbb{R}^2 \times \mathbb{R}_+) \equiv \Theta_1$ denotes the parameter set of the alternative hypothesis, which compared to the null model also includes the effect size parameter $\delta$. The negative log-likelihood of the data ${\bf y}$ under the alternative hypothesis, $-\log \ell_1({\bf y} | \bm{\theta}_1)$, is \begin{equation} \label{eqn:h1:nll} \frac{n}{2} \log(2 \pi \sigma^2) + \frac{1}{2 \sigma^2} \sum_{i=1}^{n_1} \left(y_{1i} - \mu - \frac{\sigma \delta}{2}\right)^2 + \frac{1}{2 \sigma^2} \sum_{j=1}^{n_2} \left(y_{2j} - \mu + \frac{\sigma \delta}{2}\right)^2 \end{equation} where, as before, $n = (n_1+n_2)$ is the total sample size. Let \begin{equation} S_j = \sum_{i=1}^{n_j} y_{ji}, \quad S^2 = \sum_{j=1}^2 \sum_{i=1}^{n_j} y_{ji}^2 = {\bf y}^\prime {\bf y}, \quad j = 1,2 \end{equation} denote the sufficient statistics. For reference, the maximum likelihood estimates of the model parameters are easily shown to be \begin{align*} \hat{\mu}_{\rm ML}({\bf y}) &= \frac{1}{2} \left(\frac{S_1}{n_1}+\frac{S_2}{n_2}\right) = \frac{1}{2} \left(\bar{\bf y}_1 + \bar{\bf y}_2\right), \\ % \hat{\sigma}_{\rm ML}^2({\bf y}) &= \frac{1}{n} \left( S^2 - \left(\frac{S_1^2}{n_1}+\frac{S_2^2}{n_2} \right) \right) = \frac{1}{n} \left( S^2 - \left( n_1 \bar{\bf y}_1^2 + n_2 \bar{\bf y}_2^2\right) \right), \\ % \hat{\delta}_{\rm ML}({\bf y}) &= \frac{1}{\hat{\sigma}_{\rm ML}} \left(\frac{S_1}{n_1}-\frac{S_2}{n_2}\right) = \frac{1}{\hat{\sigma}_{\rm ML}} \left(\bar{\bf y}_1 - \bar{\bf y}_2\right). \end{align*} Next we derive the MML87 codelength for the model and the corresponding MML87 estimates. For the MML codelength of the data under the alternative hypothesis, we again require a prior distribution for all the model parameters and the determinant of the expected Fisher information matrix. Following~\cite{GronauEtAl19}, the prior distribution for the parameters $\bm{\theta}_1$ is chosen to be \begin{equation} \label{eqn:h1:prior} \pi_1(\bm{\theta}_1) = \pi_0(\bm{\theta}_0) \pi(\delta), \quad \pi(\delta) = \frac{1}{\gamma_{\delta}} T_{\kappa} \left( \frac{\delta - \mu_{\delta}}{\gamma_{\delta}}\right) \end{equation} where $\pi(\delta)$ is a student $t$ distribution with $\kappa > 0$ degrees of freedom, and location and scale hyperparameters $\mu_{\delta}$ and $\gamma_{\delta} > 0$, respectively. This prior density for the effect size is a symmetric, heavy-tailed flexible distribution allowing experts to incorporate prior knowledge via the hyperparameters $(\mu_{\delta}, \gamma_{\delta})$. Note that the prior distribution for the mean and standard deviation parameters is the same under the null and alternative hypotheses, which implies that the choice of the range of parameters $\Omega$ will have no effect on MML inference as it contributes equally to the codelengths of both hypotheses. The determinant of the expected Fisher information matrix under the alternative hypothesis is \begin{equation} \label{eqn:h1:fisher} | J(\bm{\theta}_1) | = \frac{2 n_1 n_2 (n_1+n_2)}{\sigma^4} . \end{equation} Substituting (\ref{eqn:h1:nll}), (\ref{eqn:h1:prior}) and (\ref{eqn:h1:fisher}) into (\ref{eqn:mml87:codelength}) yields the MML87 codelength $\mathcal{I}({\bf y}, \bm{\theta}_1)$ of the data under the alternative hypothesis model. Under this choice of the prior distribution, MML87 estimates of the parameters $\bm{\theta}_1$ are unavailable in closed form and must be obtained via numerical optimisation \begin{equation} \hat{ \bm{\theta} }_1({\bf y}) = \argmin_{\bm{\theta}_1 \in \Theta_1} \mathcal{I}({\bf y}, \bm{\theta}_1) . \end{equation} To perform a MML $t$-test, we compute the codelength of the null model $\mathcal{I}({\bf y}, \hat{\bm{\theta}}_0)$ and the alternative model $\mathcal{I}({\bf y}, \hat{\bm{\theta}}_1)$, with the preferred model being the one with the shorter codelength. As with standard Bayesian analysis, a codelength difference of about $2.3$ nits or more indicates substantial preference of the model with the smaller codelength. Recall that we can interpret the difference in MML codelengths as the log posterior probability in favour of the model with the shorter codelength. A brief simulation was performed to compare the behaviour of the MML87 estimate of the standardised effect size $\delta$ to the ML estimate. Data with sample sizes $(n_1, n_2) \in \{5, 10, 20, 50\}$ was generated from the model $(\mu = 0, \sigma = 1)$ with $0.1 \leq \delta \leq 5$ and both ML and MML87 were asked to nominate an estimate of $\delta$. The experiment was repeated for $10^5$ iterations and the estimates were compared using the normalized mean squared error metric \begin{equation} \text{NMSE} = \frac{ (\delta - \hat{\delta}({\bf y}))^2 }{\delta} , \end{equation} averaged over all $10^5$ iterations for each experiment. Results for sample sizes $n_1 = n_2 = 5$ and $n_1 = n_2 = 10$ are shown in Figure~\ref{fig:delta:nmse}. Behaviour of the ML and MML87 estimates for moderate to large sample sizes was indistinguishable, as predicted by asymptotic analysis. When the sample size was small, ML tends to overestimate $\delta$ and underestimate $\sigma$. This is in contrast to MML87 which tends to underestimate $\delta$ and is more conservative. \begin{figure*}[t] \begin{center} \subfigure[$n_1=n_2=5$]{ \includegraphics[width=6.0cm]{figs/lognmsen5.pdf} }% \subfigure[$n_1=n_2=10$]{ \includegraphics[width=6.0cm]{figs/lognmsen10.pdf} } \\ \end{center} \caption{Normalised mean square error for the maximum likelihood and MML estimates of $\delta$ with $n_1=n_2=5$ and $n_1=n_2=10$ data samples averaged over $10^5$ simulations. In all cases, the mean and standard deviation of the data generating model were $\mu=0, \sigma = 1$. \label{fig:delta:nmse}} \end{figure*} In terms of model (hypothesis) selection, unlike the frequentist methodology, neither the Bayes factor nor MML approach are designed to explicitly control type I error. Empirically, we observe that both the Bayes factor derived by Gronau et al~\cite{GronauEtAl19} and the MML87 $t$-test derived in Section~\ref{sec:mml:ttest} control type I error rate at approximately 0.10 for all $0.1 < \delta < 2$, if the alternative model is chosen whenever $\mathcal{I}_1(y) < \mathcal{I}_0(y)$, or equivalently, whenever the Bayes factor BF$_{10} > 1$. To control the type I error rate at $0.05$, we would need to select the alternative model for all BF$_{10} > 1.87$ or whenever $(\mathcal{I}_1(y) + \log(1.65)) < \mathcal{I}_0(y)$. Under this setup, all three methods were virtually indistinguishable in terms of type I error rate for all $0.1 < \delta < 2$. \section{Minimum message length testing of the correlation coefficient} \label{sec:mml:corr} Suppose that a pair of random variables $(Y_1, Y_2)$ follows a bivariate normal distribution with means $(\mu_1, \mu_2)$, variances $(\sigma^2_1, \sigma^2_2)$ and correlation coefficient $\rho \in (0,1)$. We have $n$ observations ${\bf y} = \{(y_{1,i}, y_{2,i})\}$ ($i=1,\ldots,n$) and wish to test the hypothesis \begin{equation*} H_0: \rho = \rho_0 \quad \text{versus} \quad H_1: \rho \neq \rho_0 \end{equation*} where $\rho_0 \in (0,1)$ is a fixed, user-specified value. Let $\bm{\theta}_0 = \{\mu_1,\mu_2,\sigma_1,\sigma_2\} \in \mathbb{R}^2 \times \mathbb{R}^2_+ \equiv \Theta_0$ and $\bm{\theta}_1 = \{\mu_1,\mu_2,\sigma_1,\sigma_2,\rho\} \in \mathbb{R}^2 \times \mathbb{R}^2_+ \times (0,1) \equiv \Theta_1$ denote the parameter sets under the null and alternative hypothesis models, respectively. A large number of frequentist as well as Bayesian procedures exist for this hypothesis testing problem. A good summary of the recent literature is in \cite{PengWang21}, which also introduces a new Bayesian procedure for testing the correlation coefficient under divergence-based priors~\cite{BayarriGarciaDonato08}. Under the null model, the negative log-likelihood of the data ${\bf y}$ is \begin{equation} -\log \ell_0(\bm{\theta}_0) = n \log(2\pi) + n \log(\sigma_1 \sigma_2) + \frac{n}{2} \log(1 - \rho_0^2) + \frac{ 1 }{2 \left(1-\rho_0^2\right)} \sum_{i=1}^n Q_i({\bf y},\bm{\theta}_0) \end{equation} where \begin{equation} Q_i({\bf y},\bm{\theta}) = \frac{\left(y_{1,i}-\mu _1\right){}^2}{\sigma _1^2}-\frac{2 \rho \left(y_{1,i}-\mu _1\right) \left(y_{2,i}-\mu _2\right)}{\sigma _1 \sigma _2}+\frac{\left(y_{2,i}-\mu _2\right){}^2}{\sigma _2^2} . \end{equation} Let \begin{equation} \bar{y}_j = \frac{1}{n} \sum_{i=1}^n y_{j,i},\quad s_j^2 = \frac{1}{n} \sum_{i=1}^n (y_{j,i} - \bar{y}_j)^2, \quad r = \frac{1}{n s_1 s_2} \sum_{i=1}^n (y_{1,i} - \bar{y}_1)(y_{2,i} - \bar{y}_2), \end{equation} for j = 1,2 denote the usual sufficient statistics. Maximum likelihood estimates of the model parameters are \begin{equation} \hat{\mu}_j({\bf y})_{\text{ML}} = \bar{y}_j, \quad \hat{\sigma}_j^2({\bf y})_{\text{ML}} = s_j^2 \left(\frac{ 1-\rho_0 \, r}{1-\rho_0 ^2} \right), \quad (j=1,2) . \end{equation} For the MML codelength, we again use the right Haar prior for the means and standard deviations \begin{equation} \pi_0(\bm{\theta}_0) = (\Omega_0 \sigma_1 \sigma_2)^{-1} \end{equation} where $\Omega_0$ is a normalisation constant. The determinant of the expected Fisher information matrix for a bivariate normal distribution with a fixed (known) correlation coefficient $\rho_0$ is \begin{equation} |J(\bm{\theta}_0)| = \frac{4 n^4}{\left(1 - \rho _0^2\right){}^2 \sigma _1^4 \sigma _2^4} \end{equation} and the MML87 codelength for the data ${\bf y}$ is \begin{align*} \mathcal{I}_0({\bf y}, \bm{\theta}_0) &= -\log \ell_0(\bm{\theta}_0) + \frac{1}{2} \log |J(\bm{\theta}_0)| - \log \pi_0(\bm{\theta}_0) + 2 (1 + \log \kappa_4) \\ &= (n-1) \log(\sigma_1 \sigma_2) + \frac{n-2}{2} \log(1 - \rho_0^2) + \frac{ 1 }{2 \left(1-\rho_0^2\right)} \sum_{i=1}^n Q_i({\bf y},\bm{\theta}_0) \\ & + \log \left(\Omega _0 \pi ^n 2^{n+1} (\kappa \, n)^2\right) + 2 \end{align*} where $\kappa_4 \approx 0.076603$. MML estimates that minimise the codelength under the null hypothesis are \begin{equation} \hat{\mu}_j({\bf y}) = \bar{y}_j, \quad \hat{\sigma}_j^2({\bf y}) = s_j^2 \left(\frac{ n (1-\rho_0 \, r)}{(n-1) \left(1-\rho_0 ^2\right)} \right), \quad (j=1,2) . \end{equation} We observe that the MML estimates of the mean parameters are the same as the usual maximum likelihood estimates. However, MML estimates of the variances include the extra term $n/(n-1)$. If the null hypothesis corresponds to the no correlation model ($\rho_0 = 0)$, MML estimates of the variances are unbiased unlike the corresponding maximum likelihood estimates. Under the alternative hypothesis, the correlation coefficient $\rho$ is unknown and must be estimated from the data along with the means and variances. The negative log-likelihood of the data ${\bf y}$ is now \begin{equation} -\log \ell_1(\bm{\theta}_1) = n \log(2\pi) + n \log(\sigma_1 \sigma_2) + \frac{n}{2} \log(1 - \rho^2) + \frac{ 1 }{2 \left(1-\rho^2\right)} \sum_{i=1}^n Q_i({\bf y},\bm{\theta}_1) \end{equation} Maximum likelihood estimates of the parameters are \begin{equation} \hat{\mu}_j({\bf y})_{\text{ML}} = \bar{y}_j, \quad \hat{\sigma}_j^2({\bf y})_{\text{ML}} = s_j^2, \quad \hat{\rho}({\bf y})_{\text{ML}} = r, \quad (j=1,2) . \end{equation} We use the same right Haar prior for the means and standard deviations and opt for the uniform prior distribution over the correlation coefficient leading to \begin{equation} \pi_1(\bm{\theta}_1) = (\Omega_1 \sigma_1 \sigma_2)^{-1} \end{equation} where $\Omega_1$ is a normalisation constant. The determinant of the expected Fisher information matrix for a bivariate normal distribution with an unknown correlation coefficient is \begin{equation} |J(\bm{\theta}_1)| = \frac{4 n^5}{\left(1 - \rho ^2\right)^4 \sigma _1^4 \sigma _2^4} . \end{equation} MML codelength of the alternative hypothesis is \begin{align*} \mathcal{I}_1({\bf y}, \bm{\theta}_1) &= -\log \ell_1(\bm{\theta}_1) + \frac{1}{2} \log |J(\bm{\theta}_1)| - \log \pi_1(\bm{\theta}_1) + \frac{5}{2} (1 + \log \kappa_5) \\ &= (n-1) \log(\sigma_1 \sigma_2) + \frac{n-4}{2} \log(1 - \rho^2) + \frac{ 1 }{2 \left(1-\rho^2\right)} \sum_{i=1}^n Q_i({\bf y},\bm{\theta}_1) \\ & + \log \left( \Omega _1 \pi ^n 2^{n+1} (n \, \kappa _5)^{5/2} \right) + \frac{5}{2} \end{align*} where $\kappa_5 \approx 0.075625$. MML estimates that minimise the codelength are \begin{align*} \hat{\mu}_j({\bf y}) &= \bar{y}_j, \\ \hat{\sigma}^2_j ({\bf y}) &= s_j^2 \left(\frac{n (n + 2 + \sqrt{(n+2)^2 - 12 r^2 (n-1)} )} {2(n+2)(n-1)} \right) = s_j^2 \left( \frac{n (n-3 \hat{\rho} r+2)}{(n-1) (n+2)} \right) \\ \hat{\rho}({\bf y}) &= \frac{n + 2 - \sqrt{(n+2)^2 - 12 r^2 (n-1)} }{6 r} = \frac{(n+2)}{3 r} \left(1-\left(1-\frac{1}{n}\right) \left(\frac{\hat{\sigma}_j}{s_j}\right)^2 \right) . \\ &= r \left( \frac{ n-1 } {n+2} \right) + O\left(n^{-1}\right) \end{align*} for $j= 1,2$. It is easy to show that the MML estimate of the correlation parameter is always smaller in magnitude compared to the sample correlation coefficient; ie, $|\hat{\rho}({\bf y})| < |r|$. Figure~\ref{fig:mserisk:rho} shows the mean squared error (MSE) risk for $n \in \{20, 50\}$ for the MML, maximum likelihood and the unique minimum variance unbiased estimator~\cite{OlkinPratt58} \begin{equation*} \hat{\rho}({\bf y})_{\text{Unbiased}} = r \, _2F_1\left(\frac{1}{2},\frac{1}{2};\frac{n-1}{2};1-r^2\right) \end{equation*} of the correlation parameter $\rho$; here, $_2 F_1(\cdot)$ is Gaussian hypergeometric function. When $n=20$, the MML estimate dominates the maximum likelihood estimate in terms of MSE risk for all $|\rho| < 0.64$. As $|\rho| \to 1$, all three estimates are virtually indistinguishable. When $n=50$, the MML estimate again dominates the maximum likelihood estimate for all $|\rho| < 0.6$. \begin{figure*}[tbh] \begin{center} \subfigure[$n=20$]{ \includegraphics[height=6cm]{figs/mseriskn20.pdf} }% \subfigure[$n=50$]{ \includegraphics[height=6cm]{figs/mseriskn50.pdf} } \\ \end{center} \caption{Expected mean squared error for the MML, maximum likelihood and the unbiased minimum variance estimators of the correlation parameter $\rho$. \label{fig:mserisk:rho}} \end{figure*} \begin{table*}[tbph] \scriptsize \begin{center} \begin{tabular}{ccccccccccccc} \toprule $\rho_0$ & $\rho$ & $n$ & \multicolumn{7}{c}{Relative frequency of rejecting $H_0: \rho = \rho_0$} & & \multicolumn{2}{c}{KL Divergence} \\ & & & $\text{DB}^S$ & $\text{DB}^M$ & Fisher Z & HP & Mud & Rud & MML & ~ & MLE & MML \\ \cmidrule{1-13} \multirow{8}{*}{-0.30} & \multirow{2}{*}{-0.75} & 15 & 0.730 & {\bf 0.812} & 0.704 & 0.730 & 0.702 & 0.679 & 0.570 & & {\bf 0.408} & 0.414 \\ & & 30 & 0.921 & {\bf 0.950} & 0.936 & 0.938 & 0.936 & 0.932 & 0.890 & & {\bf 0.129} & 0.145 \\ & \multirow{2}{*}{-0.30} & 15 & 0.073 & 0.124 & 0.060 & 0.068 & 0.059 & 0.058 & {\bf 0.050} & & 0.262 & {\bf 0.230} \\ & & 30 & 0.043 & 0.081 & 0.046 & 0.050 & 0.046 & 0.046 & {\bf 0.035} & & 0.132 & {\bf 0.124} \\ & \multirow{2}{*}{0.00} & 15 & 0.236 & {\bf 0.329} & 0.184 & 0.206 & 0.178 & 0.193 & 0.245 & & 0.229 & {\bf 0.190} \\ & & 30 & 0.354 & {\bf 0.465} & 0.371 & 0.382 & 0.371 & 0.382 & 0.358 & & 0.092 & {\bf 0.083} \\ & \multirow{2}{*}{0.50} & 15 & 0.908 & {\bf 0.934} & 0.883 & 0.893 & 0.881 & 0.887 & 0.904 & & 0.278 & {\bf 0.223} \\ & & 30 & 0.995 & {\bf 0.998} & 0.995 & 0.996 & 0.995 & 0.995 & 0.994 & & 0.105 & {\bf 0.097} \\ \vspace{-2mm} \\ \cmidrule{2-13} \vspace{-2mm} \\ \multirow{8}{*}{0.00} & \multirow{2}{*}{-0.75} & 15 & 0.969 & {\bf 0.988} & 0.953 & 0.960 & 0.950 & 0.950 & 0.938 & & 0.298 & {\bf 0.252} \\ & & 30 & 0.998 & 0.998 & 0.998 & 0.998 & 0.998 & 0.998 & {\bf 0.999} & & 0.106 & {\bf 0.099} \\ & \multirow{2}{*}{-0.30} & 15 & 0.262 & {\bf 0.362} & 0.207 & 0.224 & 0.204 & 0.204 & 0.198 & & 0.277 & {\bf 0.237} \\ & & 30 & 0.352 & {\bf 0.476} & 0.356 & 0.368 & 0.356 & 0.356 & 0.322 & & 0.126 & {\bf 0.118} \\ & \multirow{2}{*}{0.00} & 15 & 0.074 & 0.130 & 0.055 & 0.060 & 0.055 & 0.055 & {\bf 0.051} & & 0.217 & {\bf 0.189} \\ & & 30 & 0.050 & 0.106 & 0.053 & 0.057 & 0.053 & 0.053 & {\bf 0.037} & & 0.087 & {\bf 0.080} \\ & \multirow{2}{*}{0.50} & 15 & 0.613 & {\bf 0.700} & 0.559 & 0.580 & 0.554 & 0.548 & 0.508 & & 0.330 & {\bf 0.277} \\ & & 30 & 0.809 & {\bf 0.893} & 0.820 & 0.057 & 0.053 & 0.053 & 0.791 & & 0.126 & {\bf 0.120} \\ \vspace{-2mm} \\ \cmidrule{2-13} \vspace{-2mm} \\ \multirow{8}{*}{0.70} & \multirow{2}{*}{-0.75} & 15 & {\bf 1.000} & 1.000 & 1.000 & 1.000 & 1.000 & 1.000 & 1.000 & & 0.273 & {\bf 0.232} \\ & & 30 & {\bf 1.000} & 1.000 & 1.000 & 1.000 & 1.000 & 1.000 & 1.000 & & 0.106 & {\bf 0.098} \\ & \multirow{2}{*}{-0.30} & 15 & 0.984 & 0.987 & 0.985 & 0.986 & 0.985 & 0.986 & {\bf 0.992} & & 0.264 & {\bf 0.221} \\ & & 30 & {\bf 1.000} & 1.000 & 1.000 & 1.000 & 1.000 & 1.000 & 1.000 & & 0.105 & {\bf 0.096} \\ & \multirow{2}{*}{0.00} & 15 & 0.834 & 0.875 & 0.850 & 0.865 & 0.849 & 0.867 & {\bf 0.910} & & 0.242 & {\bf 0.207} \\ & & 30 & 0.992 & 0.998 & 0.998 & 0.998 & 0.998 & {\bf 0.999} & 0.993 & & 0.104 & {\bf 0.095} \\ & \multirow{2}{*}{0.50} & 15 & 0.131 & 0.182 & 0.150 & 0.167 & 0.149 & 0.173 & {\bf 0.258} & & 0.328 & {\bf 0.287} \\ & & 30 & 0.275 & 0.397 & 0.403 & 0.412 & 0.401 & {\bf 0.417} & 0.354 & & {\bf 0.176} & 0.178 \\ \vspace{-3mm} \\ \bottomrule \vspace{+1mm} \end{tabular} \caption{Relative frequency of rejecting the null hypothesis and Kullback--Leibler (KL) divergence from the data generating model for maximum likelihood (MLE) and minimum message length (MML) estimates. \label{tab:results:corr}} \end{center} \end{table*} \section{Discussion} \label{sec:sim} An advantage of MML over alternative approaches is that it allows conceptually straightforward comparison of models with different structures and parameters as long as we can compute their codelengths. The codelength is measured in the unit of information (e.g., bits) and is therefore a universal yardstick for model comparison. It is then easy to extend the MML $t$-test to, for example, handle the case of unequal variances in the two groups, a version of the so-called Behrens--Fisher problem. The setup is now \begin{equation} Y_{1i} \sim \mathcal{N}\left(\mu_1, \sigma_1^2\right), \quad Y_{2j} \sim \mathcal{N}\left(\mu_2, \sigma_2^2\right) , \end{equation} for $i=1,\ldots,n_1$ and $j = 1, \ldots, n_2$ and the task is, given data ${\bf y}$, to determine whether the two means are equal $\mu_1 = \mu_2$. MML87 codelengths for this setup were derived in \cite{MakalicSchmidt13} and can be compared to the codelengths of the null and alternative hypotheses under the equal variance assumption derived in Section~\ref{sec:mml:ttest} to discriminate between the four candidate models. Of course, we can also include other models in the comparison, as long as we can compute the corresponding codelengths. \subsection{Minimum description length} Minimum description length (MDL)~\cite{Rissanen78,Rissanen96,RissanenRoos07a,Rissanen09b,GrunwaldRoos19,BruniEtAl22} is a closely related approach to inductive inference that was developed around the same time as MML by Rissanen and colleagues and has gone through various refinements. MDL seeks a model class $\mathcal{M}$ that results in the shortest codelength of the data (ie, a model that best compresses the data), where a model class is defined as a set of parametric distributions indexed by parameter $\bm{\theta}$: \begin{equation*} \mathcal{M} = \{ p(\cdot | \bm{\theta}): \bm{\theta} \in \Theta\} . \end{equation*} A popular version of MDL is the general normalized maximum likelihood (NML) code whose codelength is given by \begin{equation} -\log p_{\text{NML}}({\bf y} | v, \mathcal{M}) = \underbrace{-\log \left[\max_{\bm{\theta} \in \Theta} p({\bf y} | \bm{\theta}({\bf y}), \mathcal{M}) \, v(\bm{\theta}) \right] }_{\rm model\; fit} + \underbrace{\log \left[\sum_{{\bf x}} \max_{\bm{\theta} \in \Theta} p({\bf x} | \bm{\theta}({\rm x}), \mathcal{M}) \, v(\bm{\theta}) \right]}_{\rm parametric\; complexity} \end{equation} where $v: \Theta \to [0, \infty)$ is a user-specified function, referred to as the \emph{luckiness} function in MDL terminology, and the sum (integral) is over the entire data space in the case of discrete (continuous) data. This is the general NML codelength for data ${\bf y}$ with respect to some model class $\mathcal{M}$ parameterised by models $\bm{\theta} \in \Theta \in \mathcal{M}$. We observe that the NML codelength is a sum of two terms: \begin{enumerate} \item the (penalized) negative log-likelihood of the data evaluated at the maximum, and % \item the so-called parametric complexity of the model class $\mathcal{M}$ which measures how well models $\bm{\theta} \in \mathcal{M}$ approximate random data sequences. \end{enumerate} The first term in the NML codelength represents how well the model $\hat{\theta} \in \mathcal{M}$ fits the observed data with smaller codelengths indicating better data fit. In contrast, a low (high) parametric complexity implies that a few (many) data sequences can be modelled sufficiently well by models in class $\mathcal{M}$. The parametric complexity denotes the logarithm of the number of distinguishable distributions in the model class~\cite{Balasubramanian05} and is similar in spirit to the assertion in the MML code, accounting for the complexity of the model class from which the maximum likelihood estimate is derived. A detailed discussion of the NML distribution and the corresponding optimality properties is available in~\cite{Rissanen01,Rissanen07,GrunwaldRoos19}. Originally, Risannen advocated the use of the NML distribution for $v(\theta) = 1$ only. Unfortunately, the parametric complexity in this case is easily shown to be infinite for many model classes rendering a straightforward application of the NML codelength impossible. Subsequently, Rissanen and colleagues suggested other forms of the luckiness function as well as variations of the NML code such as the restricted approximate normalized maximum likelihood (ANML), the two-part ANML or the objective Bayesian code, among others~\cite{RooijGrunwald06,GrunwaldRoos19}. \\ \noindent {\bf Example:} Assuming $v(\theta) = 1$, the NML codelength for the binomial distribution is \begin{equation} -\log p_{\text{NML}}(y | \mathcal{M}) = -\log \binom{n}{y} \hat{\theta}^y (1-\hat{\theta})^{n-y}+ \log \mathcal{C}(n) \end{equation} where \begin{equation} \mathcal{C}(n) = \sum_{x = 0}^n \binom{n}{x} \left( \frac{x}{n}\right)^{x} \left(\frac{n - x}{n}\right)^{n - x} \end{equation} and $\hat{\theta}(y) = (y/n)$ is the maximum likelihood estimate of the success probability. An efficient linear-time algorithm to compute the parametric complexity of a general multinomial distribution is available in~\cite{KontkanenMyllymaki07b}. As an example, if $n = 10$ and $y = 3$, the maximum likelihood estimate is $\hat{\theta}(y) = 0.3$, the parametric complexity is $\log \mathcal{C}(n) \approx 2.22$ bits and the total NML codelength is approximately 4.13 bits. For the original NML distribution with $v(\theta) = 1$, Rissanen~\cite{Rissanen96} showed that \begin{equation} -\log p_{\text{NML}}({\bf y} | \mathcal{M}) = -\log p({\bf y} | \hat{\bm{\theta}}({\bf y}), \mathcal{M}) + \log \int_\Theta \sqrt{|J_1(\bm{\theta}) | } + \frac{p}{2} \log \left( \frac{n}{2\pi} \right) + o(1) \end{equation} where $J_1(\cdot)$ is the per-sample Fisher information matrix. Additionally, Rissanen proved that the NML codelength reduces to the well-known Bayesian information criterion (BIC) in the limit as the sample size $n \to \infty$ and demonstrated that the asymptotic approximation is accurate for large sample sizes. Other, somewhat shaper, approximations to this NML codelength exist, see for example, Mera et al.~\cite{MeraEtAl2020}. Rissanen's asymptotic expansion was recently generalized to include arbitrary luckiness functions and a novel methodology for evaluation of the general, non-asymptotic NML codelength for exponential family models~\cite{SuzukiYamanishi18}. Although there are many similarities between MML and MDL, there exist some important differences in their inherent inference philosophies. Unlike MML, MDL is non-Bayesian and does not allow for the use of prior information in inference. While MML provides new means of parameter estimation, MDL was originally based on the maximum likelihood estimator and aimed to discover the best model class, rather than the best single model, for a given data set. However, the recent inclusion of luckiness functions in the NML code allows for new MDL-based penalized maximum likelihood estimation procedures. Lastly, the NML codelength is not a two-part code as Strict MML and is instead derived to minimize the worst-case excess codelength relative to an ideal code. For a more detailed discussion of MML and MDL, we recommend~\cite{BaxterOliver94} and \cite{Wallace05} (pp. 413--415). \bibliographystyle{amsplain}
{'timestamp': '2022-09-30T02:08:07', 'yymm': '2209', 'arxiv_id': '2209.14571', 'language': 'en', 'url': 'https://arxiv.org/abs/2209.14571'}
arxiv
\section{Introduction}\label{sec:introduction}} \IEEEPARstart{I}{ncreasing} availability and sophistication of digital image editing tools cause a major problem of that we even can not believe what we see \cite{liu2018image}. Image forgery is becoming a global epidemic which deeply affects our daily life for that some forgers use elaborately forged images to spread fake news or do other unscrupulous businesses \cite{wu2018busternet}. Copy-move forgery is a kind of image forgery in which one or several regions are pasted elsewhere in the same image in order to hide or duplicate objects of interest. Copy-move forgery detection techniques have always been a hot topic in image forensics \cite{ryu2010detection,christlein2012evaluation,li2015segmentation,cozzolino2015efficient}, and play important roles in cybersecurity and multimedia security \cite{qian2016separable,qiao2019adaptive}. Conventional copy-move forgery detection methods adopt handcrafted features, and can be broadly divided into two categories, i.e., block-based approaches \cite{bashar2010exploring,ryu2013rotation,li2013image,li2013efficient,cozzolino2015efficient,mahmood2016copy,bi2018fast}, and keypoint-based approaches \cite{pan2010region,amerini2011sift,kakar2012exposing,pun2015image,li2015segmentation,ardizzone2015copy}. Their major difference is that block-based methods aim at exploring local features from abundant overlapping patches, while keypoint-based methods concentrate on patches of keypoints \cite{zandi2016iterative}. Nowadays, deep learning techniques have dominated various image processing tasks including image forensics \cite{cozzolino2017recasting,wu2017deep,liu2018image,cozzolino2018forensictransfer,zhou2018learning,cun2018image,cozzolino2019noiseprint,liu2019adversarial,yu2019attributing,mayer2019forensic,rossler2019faceforensics++}. Deep learning based copy-move forgery detection has also been investigated in \cite{wu2018image,wu2018busternet}. In \cite{wu2018image}, Wu et al. proposed an end-to-end deep neural network for predicting copy-move forgery masks. They construct a convolutional neural network for feature extraction, then compute self-correlation maps of convolutional features, and finally reconstruct forgery masks through a deconvolutional network. In \cite{wu2018busternet}, Wu et al. extended their network to a two-branch architecture: one branch localizes potential manipulation regions via visual inconsistencies; the other branch detects copy-move regions via visual similarities. According to the observations in \cite{korus2017multi,liu2018image,cozzolino2019noiseprint}, it is a very chanllenging task to localize forged regions in realistic forged images which barely have visual inconsistencies. As for the branch for detecting visual similarities, it tries to explore high-level low-resolution convolutional features \cite{simonyan2014very}, limiting the ability to detect accurate boundaries and small forged regions. Hence, we focus on digging deeper into visual similarity clues in our work. \begin{figure*}[htp] \centering \includegraphics[width=15cm]{twostageframework.eps} \caption{Overview of our two-stage copy-move forgery detection with self deep matching and Proposal SuperGlue. The first stage is a backbone self deep matching network based on atrous convolution, skip matching, and self-correlation with spatial attention. Red, blue, yellow blocks denote three convolutional blocks with the same scale, which are re-constructed by atrous convolution and skip matching. The second stage is named as Proposal SuperGlue. Proposal selection is conducted based on generated proposals and the backbone score map. Pairwise SuperGlue is conducted among candidate highly suspected proposals. Then, integrated score maps are generated by integrating matched keypoint scores and backbone scores. ConvCRF is constructed to refine integrated score maps.} \label{fig:framework} \end{figure*} In this paper, we propose a novel two-stage copy-move forgery detection framework which integrates end-to-end deep matching with proposal based keypoint matching. The pipeline of this two-stage framework is shown in Fig.~\ref{fig:framework}. \textbf{In the first stage}, a backbone self deep matching network is constructed to generate backbone score maps which indicate suspicious probabilities of pixels. Our backbone network integrates atrous convolution, skip matching, and spatial attention. Atrous convolution can increase the resolution of feature maps, and skip matching can invesitgate hierarchical information. Particularly, we discover the inherent connections between spatial attention and self-correlation, and propose a self-correlation module with spatial attention. Previous copy-move forgery detection methods \cite{wu2018image,wu2018busternet} only adopt VGG16 \cite{simonyan2014very}, we further study the feasibility of constructing deep matching based on deeper networks (ResNet50, ResNet101 \cite{he2016deep}) and light-weight networks (MobileNet \cite{howard2017mobilenets,sandler2018mobilenetv2,howard2019searching}, ShuffileNet \cite{zhang2018shufflenet,ma2018shufflenet}). The backbone network is regarded as a filter to efficiently detect suspected forged regions, while the results may inevitably contain false-alarmed regions or incomplete regions. Thus, we propose the second stage to remove false-alarmed regions and remedy incomplete regions. \textbf{In the second stage}, a proposal based keypoint matching method is proposed and named as Proposal SuperGlue. Proposal SuperGlue mainly consists of two components: (1) A proposal selection module obtains several highly suspected proposals from a large number of bounding boxes provided by a proposal generation method \cite{pinheiro2015learning}. Proposal selection takes advantage of both backbone score maps and appearance clues, bridging the gap between deep matching and keypoint matching. (2) Proposal matching and label generation are devised to remove false alarms, remedy incomplete regions, and generate pixel labels from score maps. Deep-learning keypoint extraction (SuperPoint \cite{detone2018superpoint}) and matching (SuperGlue \cite{sarlin2020superglue}) are conducted among candidate proposals. An integrated score map generation method is designed to integrate keypoint matching results and backbone score maps. And an integrated score map refinement method is presented based on an improved fully connected CRF, i.e., ConvCRF (Convolutional Conditional Random Field) \cite{teichmann2018convolutional}. Specifically, our main contributions of this paper can be summarized as follows: \begin{itemize} \item An innovative two-stage copy-move forgery detection framework is proposed based on self deep matching and Proposal SuperGlue. We imaginatively integrate end-to-end deep matching with keypoint matching through highly suspected proposals. \item A backbone self deep matching network is constructed based on atrous convolution, skip matching and spatial attention. Inherent connections between self-correlation and spatial attention are elaborately investigated. \item Proposal SuperGlue, which incorporates proposal generation and deep-learning keypoint matching with a series of postprocessing procedures, is proposed to effectively remove false-alarmed regions and remedy incomplete regions. \end{itemize} The structure of this paper is as follows: In Section \ref{sec:rw}, we discuss related work. In Section \ref{sec:methodology}, we elaborate the proposed framework. In Section \ref{sec:experiment}, experiments are conducted. In Section \ref{sec:conclusion}, we draw conclusions. \section{Related Work} \label{sec:rw} In this section, we briefly review the state-of-the-art copy-move forgery detection methods, attention mechanism, proposal generation and local feature matching which are the key techniques researched in our work. \textbf{Copy-move forgery detection}. Conventional copy-move forgery detection methods mainly consist of three components \cite{cozzolino2015efficient}: (1) feature extraction: extracting suitable features from pixels of interest; (2) matching: computing their best matching based on their associated features; (3) post-processing: processing and filtering vague detections to reduce false alarms. According to the formulations of feature extraction and subsequent matching schemes, these methods can be classified into two categories, i.e., block-based and keypoint-based methods. In block-based methods, a variety of features have been investigated for describing overlapping blocks and dense matching, e.g., DCT (Discrete Cosine Transform) \cite{mahmood2016copy}, DWT (Discrete Wavelet Transform) and KPCA (Kernel Principal Component Analysis) \cite{bashar2010exploring}, Zernike moments \cite{ryu2013rotation}, PCT (Polar Cosine Transform) \cite{yap2010two,li2013image}, PCET (Polar Complex Exponential Transform) \cite{bi2018fast}, LBP (Local Binary Patterns) \cite{li2013efficient}, Circular Harmonic Transforms (CHT) \cite{cozzolino2015efficient}. In keypoint-based methods, the commonly used features are SIFT (Scale Invariant Feature Transform) \cite{pan2010region,amerini2011sift,li2015segmentation,pun2015image} and SURF (Speeded-Up Robust Features) \cite{ardizzone2015copy,silva2015going}. Although great progress has been made in the study of copy-move forgery detection, it is still an unresolved challenging task for that duplicate regions may be small or smooth, and have gone through complicated rotation, resizing, compression and noise addition \cite{bi2018fast}. Besides, all the above conventional copy-move forgery detection methods rely on hand-crafted features and each module is optimized independently \cite{wu2018busternet}. Consequently, two kinds of end-to-end deep learning based copy-move forgery detection methods were proposed by Wu et al. in \cite{wu2018image,wu2018busternet}. \textbf{Attention mechanism}. In \cite{sutskever2014sequence}, Sutskever et al. constructed a multi-layer long short term memory (LSTM) to map the input sequence to a fixed-length vector, and another deep LSTM to decode the target sequence from the vector. In \cite{bahdanau2014neural}, Bahdanau et al. adopted the attention mechanism to dynamically generate the vectors. Since then, the attention mechanism has been widely applied to solve sequential decision tasks \cite{lin2017structured}, and numerous attention-based models have been proposed \cite{xu2015show,luong2015effective,vaswani2017attention}. The attention mechanism can bias the allocation of available processing resources to the most informative components of input signals \cite{hu2018squeeze}, and has also been applied to solve multimedia problems, e.g., image classification \cite{hu2018squeeze,wang2017residual}, object detection \cite{woo2018cbam}, image super-resolution \cite{zhang2018image}, video classification \cite{wang2018non}. In these tasks, consistent improvements have been gained by adopting attention mechanisms to recalibrate informative convolutional features. \textbf{Proposal generation}. In our work, we try to generate bounding boxes enclosing suspected regions. Proposal generation is a kind of technique that has been widely researched before the arrival of end-to-end object detection \cite{ren2015faster}. It aims to find out a set of (ranging from hundreds to thousands per image) proposal regions or bounding boxes which may contain objects \cite{liu2017listnet}. Since we can get hundreds of proposals which are near to contours in images, they cover suspected regions with high probability. Proposal generation approaches can be divided into two categories: conventional methods and deep-learning methods. Conventional methods leverage low-level grouping and saliency clues, e.g., objectness scoring \cite{alexe2012measuring,zitnick2014edge}, seed segmentation \cite{humayun2014rigor,krahenbuhl2014geodesic,krahenbuhl2015learning}, superpixel merging \cite{uijlings2013selective,pont2016multiscale}. Deep-learning approaches construct deep-network architectures to obtain proposals. For example, Deepbox \cite{kuo2015deepbox} learns a convolutional network to rerank proposals generated by EdgeBox \cite{zitnick2014edge}. Multibox \cite{erhan2014scalable} constructs a deep network to generate bounding box proposals. DeepMask \cite{pinheiro2015learning} and SharpMask \cite{pinheiro2016learning} can generate and refine segmentation proposals with high efficiency. These deep-learning approaches give us an opportunity to efficiently generate suspected boxes enclosing forged regions from a small set of candidate proposals. \textbf{Local feature matching}. It mainly consists of five steps, (1) detecting interest points, (2) computing visual descriptors, (3) matching visual descriptors with a nearest neighbor (NN) search, (4) filtering incorrect matches, (5) estimating a geometric transformation \cite{sarlin2020superglue}. In recent years, researchers have been trying to learn better sparse detectors and local descriptors \cite{detone2018superpoint,dusmanu2019d2,DBLP:conf/nips/RevaudSHW19,ono2018lf,yi2016lift} from data using Convolutional Neural Networks (CNNs), and attempting to improve their discriminative ability by using various strategies, e.g., a wider context using regional features, log-polar patches, unsupervised learning. Although tremendous progress has been made in this field, these sets of matches are still estimated by NN search. In \cite{sarlin2020superglue}, a novel approach based on graph neural networks, i.e., SuperGlue, is proposed to establish pointwise correspondences from off-the-shelf local features: it acts as a middle-end between hand-crafted or learned front-end and back-end. SuperGlue outperforms other learned approaches and achieves state-of-the-art results on pose estimation. In keypoint-based copy-move forgery detection approaches \cite{pan2010region,amerini2011sift,kakar2012exposing,pun2015image,li2015segmentation,ardizzone2015copy}, hand-crafted local features and NN search have been widely researched. In our work, we try to integrate learning based detector, discriptor and matching into a unified copy-move forgery detection framework. \section{Methodology} \label{sec:methodology} Our two-stage copy-move forgery detection framework consists of self deep matching and Proposal SuperGlue, as shown in Fig. \ref{fig:framework}. The first stage is a backbone self deep matching network, which generates score maps in an end-to-end manner. Firstly, we introduce the main architecture of our backbone network, including several alternative formulations in section \ref{sssec:FEAC}. Then, we introduce self-correlation with spatial attention in section \ref{sssec:SCSA}. The second stage is called Proposal SuperGlue, which is proposed to remove false-alarmed regions and remedy incomplete regions. In section \ref{sssec:psel}, we introduce our proposal selection strategy based on deep-learning proposal generation. In section \ref{sssec:PMLG}, we introduce proposal-based point matching, integrated score map generation and refinement. \subsection{Self Deep Matching} \label{ssec:sdmarch} \subsubsection{Backbone Network Architecture} \label{sssec:FEAC} In our work, we adopt VGG16 as our basic feature extractor, remove pooling operatons in the fourth and fifth convolutional blocks \cite{simonyan2014very}, and adjust the fifth block by adopting atrous convolution to keep their original field-of-views. Atrous convolution can generalize standard convolution, adjust filter’s field-of-view and control the resolution of convolutional features \cite{chen2018deeplab,chen2018encoder,chen2017rethinking}. Let $\mathbf{y}(i_c,j_c)$ denote the output of the atrous convolution of a $2$-D input signal $\mathbf{x}(i_c,j_c)$, and the atrous convolution can be computed as: \begin {equation}\label{eq:yij} \mathbf{y}(i_c,j_c)=\sum_{k_1,k_2}\mathbf{w}(k_1,k_2)\times \mathbf{x}(i_c+r_\mathrm{ac} k_1,j_c+r_\mathrm{ac} k_2) \end {equation} where $k_1,k_2\in[-fl(\frac{K}{2}),fl(\frac{K}{2})]$ ($fl(\cdot)$ is a floor function), $\mathbf{w}(k_1,k_2)$ denotes a $K\times K$ filter, atrous rate $r_\mathrm{ac}$ determines the stride with which we sample the input signal. In the fifth block of our basic architecture, atrous rate $r_\mathrm{ac}$ is set to $2$. Consequently, we generate three groups of larger feature maps with the same size, i.e., $\mathbf{F}_3$, $\mathbf{F}_4$ and $\mathbf{F}_5$ in Fig. \ref{Figure:ADMarch}. These hierarchical feature maps are all fed into our self-correlation module with spatial attention to compute the correlation maps. This kind of skip connections between multi-level feature maps and correlation computation is named as skip matching, and can effectively leverage rich hierarchical information provided by the feature extractor. And in the next section, we will introduce our self-correlation with spatial attention in detail. \begin{figure}[htbp] \centering \includegraphics[width=0.86\columnwidth]{SelfDMarchitecture.eps} \caption{The architecture of backbone network with VGG16.} \label{Figure:ADMarch} \end{figure} Based on the computed correlation maps, we construct an Atrous Spatial Pyramid Pooling (ASPP) module to capture their multiscale information. As shown in Fig.~\ref{Figure:ADMarch}, we construct $3$ parallel atrous convolutional layers with $3\times 3$ filters and atrous rates of $\{6,12,18\}$. Besides, we construct a convolutional layer with $1\times 1$ filters, and a global average pooling layer followed by a convolutional layer with $1\times 1$ filters to capture local features and image-level features respectively. All these convotional layers output $48$-channel feature maps, and the five groups of feature maps are concatenated and fed into subsequent layers which are constituted of convolutional and upsampling layers. \textbf{Alternative formulations}. Previous end-to-end copy-move forgery detection approaches \cite{wu2018image,wu2018busternet} adopt VGG16 for feature extraction, and we do not know the performance of deeper or light-weight networks. Thus, we formulate the popular ResNet50 and ResNet101 \cite{he2016deep} as deeper feature extractor, decrease the strides of fourth and fifth convolutional blocks, and set the atrous rates as $2$ and $4$ respectively. Light-weight networks are specifically tailored for mobile and resource constrained environments \cite{sandler2018mobilenetv2}. We reformulate three popular and competitive light-weight networks, i.e., MobileNetV2 \cite{sandler2018mobilenetv2}, MobileNetV3 \cite{howard2019searching} and ShuffleNetV2 \cite{ma2018shufflenet}. We enlarge feature maps of the last two convolutional blocks by decreasing strides and adopting atrous convolution. In these formulations, we still can get $3$ sets of feature maps with the same size. And these features are fed into correlation layers and subsequent score map generation layers. \subsubsection{Self-Correlation with Spatial Attention} \label{sssec:SCSA} In this section, we detailedly introduce the proposed self-correlation with spatial attention, and discuss the conections between self-correlation and spatial attention. Let $\mathbf{F}_{l}$ denote the $l$-th block feature maps, and $\mathbf{F}_{l}(i,j)$ denotes a $c$-dimensional descriptor at $(i,j)$. Note that $\mathbf{F}_{l}\in\mathbb{R}^{h\times w \times c}$, $i\in[1,h]$, $j\in[1,w]$, $h$ and $w$ indicate the height and width of the feature map, and $h=w$ in our work. Before the attention and correlation computation, L2-normalization is conducted, $\bar{\mathbf{F}}_{l}(i,j)=\mathrm{L2\_norm}(\mathbf{F}_{l}(i,j))={\mathbf{F}_{l}(i,j)}/{||\mathbf{F}_{l}(i,j)||_2}$. By adopting L2-normalization, we can restrict the value ranges of descriptors, and obtain normalized feature maps, i.e., $\bar{\mathbf{F}}_{l}$. Spatial attention is a kind of self-attention module which calculates response at a position as a weighted sum of the features at all positions \cite{vaswani2017attention}. It can capture long-range dependences and allocate attention according to similarity of color and texture. In our work, spatial attention is constructed to reinforce $\bar{\mathbf{F}}_{l}$. $\bar{\mathbf{F}}_{l}$ is first transformed into two feature spaces $\bm{f}(\bar{\mathbf{F}}_{l})=\bar{\mathbf{F}}_{l}\bm{W}_{l,\bm{f}}+\bm{b}_{l,\bm{f}}$ and $\bm{g}(\bar{\mathbf{F}}_{l})=\bar{\mathbf{F}}_{l}\bm{W}_{l,\bm{g}}+\bm{b}_{l,\bm{g}}$. Then we compute: \begin {equation}\label{eq:spatialbeta} \beta_l^{(m,n)}=\frac{\mathrm{exp}(s_l^{(m,n)})}{\sum_n\mathrm{exp}(s_l^{(m,n)})} \end {equation} where \begin {equation}\label{eq:spatialbetasmn} s_l^{(m,n)}= \bm{f}(\bar{\mathbf{F}}^{(m)}_{l})^T\bm{g}(\bar{\mathbf{F}}^{(n)}_{l}) \end {equation} $\beta_l^{(m,n)}$ indicates the extent to which the model attends to the $n$-th location when predicting the $m$-th region, $m,n\in[1,h\times w]$. The output of the attention block is computed as: \begin {equation}\label{eq:spatialatten} \mathbf{o}_l^{(m)}=\sum_n\beta_{mn}\bm{h}(\bar{\mathbf{F}}^{(n)}_{l}) \end {equation} where $\bm{h}(\bar{\mathbf{F}}_{l})=\bar{\mathbf{F}}_{l}\bm{W}_{l,\bm{h}}+\bm{b}_{l,\bm{h}}$. Note that $\bm{W}_{l,\bm{f}}\in\mathbb{R}^{c \times \frac{c}{8}}$, $\bm{W}_{l,\bm{g}}\in\mathbb{R}^{c \times \frac{c}{8}}$, $\bm{W}_{l,\bm{h}}\in\mathbb{R}^{c \times c}$, $\bm{b}_{l,\bm{f}}\in \mathbb{R}^{\frac{c}{8}}$, $\bm{b}_{g,\bm{h}}\in \mathbb{R}^{\frac{c}{8}}$, $\bm{b}_{l,\bm{h}}\in \mathbb{R}^{c}$, which are implemented as $1\times 1$ convolutional layers. $\mathbf{O}_l=\{\mathbf{o}_l^{(1)},\mathbf{o}_l^{(2)},\cdots,\mathbf{o}_l^{(h\times w)}\}$ are the attention values for $\bar{\mathbf{F}}_l$. Consequently, the spatial attention reinforced convolutional feature maps can be computed as: \begin {equation}\label{eq:sattwefea} \ddot{\mathbf{F}}_l=\mathrm{Atten}_l(\bar{\mathbf{F}}_l)=\lambda_l\mathbf{O}_l+\bar{\mathbf{F}}_l \end {equation} where $\lambda_l$ is a scale parameter which is initialized as $0$ and gradually learned to assign a proper value. Self-correlation aims to compute the similarity between every two locations in the convolutional feature maps. Scalar product is commonly used: \begin {equation}\label{eq:selfcorr} c_l^{(m,n)}=(\ddot{\mathbf{F}}^{(m)}_{l})^T \ddot{\mathbf{F}}^{(n)}_{l} \end {equation} Thus, we can get a raw correlation map tensor $\mathbf{C}_l=\{c_l^{(m,n)}|m,n\in[1,h\times w]\}\in \mathbb{R}^{h\times w \times (h\times w)}$. In fact, only a small fraction of features has close relations, and the majority of features are dissimilar. This indicates that a subset of $\mathbf{C}_l$ contains sufficient information to decide which feature is matched. Consequently, $\mathbf{C}_l$ is sorted along the $(h\times w)$ channels, and top-$T$ values are selected: \begin {equation}\label{eq:sortpool} \tilde{\mathbf{C}}_l(i,j,1:T)=\mathrm{Top\_T}(\mathrm{Sort}(\mathbf{C}_l(i,j,:))) \end {equation} A monotonic decreasing curve with an abrupt drop at some point should be observed along the $T$ channels, as long as $\tilde{\mathbf{C}}_l(i,j)$ has matched regions. Thus, the $T$ channels should cover the most drops, and the selection of $T$ is discussed in experiments. In theory, our network can process arbitrary-sized images since the adoption of the top-$T$ selection, unless $h\times w<T$. Moreover, zero-out and normalization operations are conducted on $\tilde{\mathbf{C}}_l$ to limit correlation values to certain ranges and filter redundant values: \begin {equation}\label{eq:relunorm} \bar{\mathbf{C}}_l=\mathrm{L2\_norm}(\mathrm{Max}(\tilde{\mathbf{C}}_l,0)) \end {equation} Since we get three groups of feature maps with the same size from feature extractor, i.e., $l\in\{3,4,5\}$, we can get three groups of correlation maps, i.e., $\bar{\mathbf{C}}_3$, $\bar{\mathbf{C}}_4$ and $\bar{\mathbf{C}}_5$. Note that the parameters of spatial attention are not shared for the computation of these three groups of correlation maps. Then, we concatenate the three groups of correlation maps, and get a correlation map tensor $\widehat{\mathbf{C}}=\mathrm{Concat}(\bar{\mathbf{C}}_3,\bar{\mathbf{C}}_4,\bar{\mathbf{C}}_5)$, where $\widehat{\mathbf{C}}\in\mathbb{R}^{h \times w \times 3T}$. Since $\widehat{\mathbf{C}}$ is computed from three groups of hierarchical feature maps, it contains rich correlation relations from coarse to fine. \textbf{Inherent connections between self-correlation and spatial attention.} Both self-correlation and spatial attention attempt to explore correlations between every pair of features in a feature map tensor. Spatial attention conducts a scalar product in transformed spaces as Eq. (\ref{eq:spatialbetasmn}), while self-correlation conducts a scalar product directly on feature maps as Eq. (\ref{eq:selfcorr}). Essentially, they have the same target of finding the close related regions. Spatial attention can allocate attention according to similarity of features, driving correlated regions to have closer feature distributions. Inspired by this inherent connection, we construct spatial attention before self-correlation computation. Consequently, it can reinforce the subsequent self-correlation computation. Additionally, we have also investigated multi-head spatial attention. Multi-head attention allows the model to jointly attend to information from different representation subspaces at different positions \cite{vaswani2017attention}. In fact, it constructs several parallel spatial attention blocks. Furthermore, we also attempt to add channel attention (SE blocks \cite{hu2018squeeze}) before or after spatial attention. Channel attention can highlight channel-wise informative features, and a weighted scalar product can be conducted in the correlation computation procedure. However, they can not achieve better performance with additional parameters which will be discussed in experiments. \subsection{Proposal SuperGlue} \label{ssec:psg} Proposal SuperGlue can be broadly divided into two steps. \textit{In the first step}, a proposal selection method is proposed to obtain highly suspected regions from hundreds of bounding-box proposals. These bounding-box proposals are generated by a proposal generation method which exploits image appearance features to find bounding boxes near to contours. \textit{In the second step}, we devise proposal-based keypoint matching with elaborately designed postprocessing procedures. Firstly, pairwise deep-learning keypoint matching is conducted among candidate proposals. Then, we propose an integrated score map generation method to integrate both self deep matching and keypoint matching results, so that some false-alarmed regions can be removed and incomplete regions can be complemented. Finally, in order to get good score distributions and accurate boundaries, ConvCRF is constructed to refine integrated score maps according to integrated scores and associated apperance similarity in the image. \textit{The first step} is introduced in section \ref{sssec:psel}, and \textit{the second step} is discussed in section \ref{sssec:PMLG}. \subsubsection{Proposal Selection} \label{sssec:psel} Processed by our backbone self deep matching network, we can get a score map $\mathbf{S}\in\mathbb{R}^{h_I\times w_I}$, $h_I$ and $w_I$ denote the size of the score map which is the same as the size of input image $\mathbf{I}$. $\mathbf{S}(i_I,j_I)\in[0,1]$, and $i_I\in [1,h_I],j_I\in [1,w_I]$. Since the feature maps of the backbone network have lower resolutions than original images, and the self-correlation is built on primitive scalar product instead of intricate similarity computing, $\mathbf{S}$ may have false-alarmed or incomplete regions. In order to get rid of false-alarmed regions and complement incomplete regions, a proposal selection strategy is proposed to obtain highly suspected boxes for further matching. Our motivation is that $\mathbf{S}$ always has some isolated meaningless regions in some complicated images according to our observation. Whether we can enclose meaningful regions while ignore meaningless regions may affect the performance. However, how can we obtain several well enclosed bounding boxes based on score map $\mathbf{S}$ and input image $\mathbf{I}$? After all, there are too many bounding boxes can be generated from a single image, e.g., different scales, aspect ratios and positions. In fact, the majority of copy-move forged regions have clear contours, and might be possible to be covered by genereted proposals which are relied on edges or saliency features \cite{liu2017listnet}. Thus, we propose to conduct proposal generation on the input image, and select several high-quality boxes from hundreds of proposals. Our proposal selection strategy relies on score map $\mathbf{S}$, and consists of selecting and merging operations. We assume that there is a proposal generation function $\mathcal{P}(\cdot)$ with image $\mathbf{I}$ as input, we can get $P$ proposals $\mathbf{P}=\{\bm{p}_p|p\in[1,P]\}$. $\bm{p}_p=\{(x^p_1,y^p_1),(x^p_2,x^p_2)\}$ contains the coordinates of top left and bottom right corners. With score map $\mathbf{S}$ at hand, we can get the average score in proposal $\bm{p}_p$, i.e., $s_p = \mathnormal{f}_{\mathrm{avgs}}(\mathbf{S},\bm{p}_p)$. According to $s_p$ and its relations with other proposals, we can obtain the final proposals. Our proposal selection strategy can be summarized as Algorithm~\ref{pssalg}. \begin{algorithm}[htp] \caption{Proposal selection strategy.} \label{pssalg} \hspace*{0.02in} {\bf Input:} Image $\mathbf{I}$ and score map $\mathbf{S}$\\ \hspace*{0.02in} {\bf Output:} Selected proposals $\mathbf{P}_{s}$ \begin{algorithmic}[1] \State $\mathbf{P}=\mathcal{P}(\mathbf{I})$; \State $\mathbf{P}_{t}=\{\}$; \For{$p=1$ to $P$} \State $s_p = \mathnormal{f}_{\mathrm{avgs}}(\mathbf{S},\bm{p}_p)$; \If{$s_p > s_{t}$} \State $flag=1$; \For{$i_{ps}=1$ to $\mathrm{len}(\mathbf{P}_{t})$} \State $v_{iou}=\mathrm{IoU}(\mathbf{P}_{t}(i_{ps}),\bm{p}_p)$; \State $v_{inter}=\mathrm{Inter}(\mathbf{P}_{t}(i_{ps}),\bm{p}_p)$; \If{$v_{iou}>iou_{t}$} \If {$s_p>\mathnormal{f}_{\mathrm{avgs}}(\mathbf{S},\mathbf{P}_{t}(i_{ps}))$} \State $\mathbf{P}_{t}(i_{ps})=\bm{p}_p$; $flag=0$; Break; \EndIf \EndIf \If {$v_{inter}/\mathrm{Size}(\bm{p}_p)>inter_t$ or \\\hspace*{0.8in}$v_{inter}/\mathrm{Size}(\mathbf{P}_{t}(i_{ps}))>inter_t$} \State $\bm{p}_{m}=\mathrm{Merge}(\bm{p}_p,\mathbf{P}_{t}(i_{ps}))$; \If {$\mathnormal{f}_{\mathrm{avgs}}(\mathbf{S},\bm{p}_{m})>s_{t}$} \State $\mathbf{P}_{t}(i_{ps})=\bm{p}_{m}$; $flag=0$; Break; \EndIf \EndIf \EndFor \If{$flag=1$} \State $\mathbf{P}_{t}=\mathbf{P}_{t}\cup\bm{p}_p$; \EndIf \EndIf \EndFor \State $\mathbf{P}_{s}=\{\}$; \While{$\mathrm{len}(\mathbf{P}_{s})\ne \mathrm{len}(\mathbf{P}_{t})$} \If {$\mathbf{P}_{s}\ne\oslash$} \State $\mathbf{P}_{t}=\mathbf{P}_{s}$; \EndIf \State $\mathbf{P}_{s}=\{\}$; \For{$i_{ps1}=1$ to $\mathrm{len}(\mathbf{P}_{t})$} \For{$i_{ps2}=i_{ps1}+1$ to $\mathrm{len}(\mathbf{P}_{t})$} \State $v_{inter}=\mathrm{Inter}(\mathbf{P}_{t}(i_{ps1}),\mathbf{P}_{t}(i_{ps2}))$; \If {$v_{inter}/\mathrm{Size}(\mathbf{P}_{t}(i_{ps1}))>inter_t$ or\\\hspace*{0.6in} $v_{inter}/\mathrm{Size}(\mathbf{P}_{t}(i_{ps2}))>inter_t$} \State $\bm{p}_{m}=\mathrm{Merge}(\mathbf{P}_{t}(i_{ps1}),\mathbf{P}_{t}(i_{ps2}))$; \If {$\mathnormal{f}_{\mathrm{avgs}}(\mathbf{S},\bm{p}_{m})>s_{t}$} \State $\mathbf{P}_{s}=\mathbf{P}_{s}\cup\bm{p}_{m}$; \Else \State Insert $\mathbf{P}_{t}(i_{ps1})$ or $\mathbf{P}_{t}(i_{ps2})$ \\\hspace*{1.0in}with higher intersection rate; \EndIf \EndIf \EndFor \EndFor \EndWhile \end{algorithmic} \end{algorithm} In Algorithm~\ref{pssalg}, there are some basic functions: $\mathrm{len}(\cdot)$ returns the item number of input list, $\mathrm{IoU}(\cdot,\cdot)$ computes the Intersection over Union (IoU) \cite{liu2017listnet} of two boxes, $\mathrm{Inter}(\cdot,\cdot)$ computes their intersection, and $\mathrm{Size}(\cdot)$ indicates the size of the input box. $\mathrm{Merge}(\cdot,\cdot)$ is used to merge two input boxes, in other words, it generates the smallest box which can cover the two input boxes. The proposal generation function $\mathcal{P}(\cdot)$ is implemented based on DeepMask \cite{pinheiro2015learning}. The basic idea of Algorithm~\ref{pssalg} is that we try to reject proposals with small average scores, select proposals with higher scores from proposals which have high IoU with each other, and merge proposals or select larger boxes when they have large intersection rates. And there are some parameters need to set, proposal threshold score $s_{t}=0.4$, threshold IoU $iou_t=0.5$, threshold intersection rate $inter_t=0.8$. Besides, all proposals or merged boxes should meet the basic requirement that they should be smaller than the half of the input image. Last but not least, iterations are conducted to avoid merged boxes with large intersection rates. By using Algorithm~\ref{pssalg}, we can get $\tilde{P}$ (generally less than $10$) high-quality proposals $\mathbf{P}_{s}=\{\bm{p}_{\tilde{p}}|\tilde{p}\in[1,\tilde{P}]\}$ ($\mathbf{P}_{s}(\tilde{p})$ indicates $\bm{p}_{\tilde{p}}$ in $\mathbf{P}_{s}$). \subsubsection{Keypoint Matching and Label Generation} \label{sssec:PMLG} \textbf{Proposal-based keypoint matching}. With high-qualtiy proposals $\mathbf{P}_{s}$ at hand, we can extract interest points from them and conduct keypoint matching. As we discussed in Section \ref{sec:rw}, CNN-based interest point detection and discription show a good prospect in numerous applications. Thus, we extract keypoints with corresponding descriptors from each proposal using SuperPoint \cite{detone2018superpoint}. It is a fully-convolutional model which operates on full-sized images and jointly computes pixel-level interest point locations and associated descriptors in one forward pass. It can be denoted as $\mathbf{K}_{\tilde{p}}=\mathrm{SuperPoint}(\bm{p}_{\tilde{p}},\mathbf{I})$, where $\mathbf{K}_{\tilde{p}}$ denotes the extracted keypoints set from proposal $\bm{p}_{\tilde{p}}$, and the $k_p$-th elements is $\mathbf{K}_{\tilde{p}}(k_p)=\{(x_{k_p},y_{k_p}),\mathbf{d}_{k_p}\}$, $\mathbf{d}_{k_p}$ denotes the corresponding descriptor. Then for each pair of point sets $\mathbf{K}_{\tilde{p}}(k_{p1})$ and $\mathbf{K}_{\tilde{p}}(k_{p2})$, we conduct SuperGlue \cite{sarlin2020superglue} to get matched points and corresponding matching scores $\mathbf{M}_{\tilde{p}1},\mathbf{M}_{\tilde{p}2}=\mathrm{SuperGlue}(\mathbf{K}_{\tilde{p}1},\mathbf{K}_{\tilde{p}2})$. SuperGlue uses a graph neural network and attention to solve an assignment optimization problem. Instead of learning better task-agnostic local features followed by simple matching heuristics and tricks, SuperGlue learns the matching process from pre-existing local features using a novel neural architecture for the first time. It matches two sets of local features by jointly finding correspondences and rejecting non-matchable points. Finally, we can get $M$ matched points and their matching scores $\mathbf{M}=\{\mathbf{M}_{\tilde{p}}|\tilde{p}\in[1,\tilde{P}]\}=\{(x_m,y_m),s_m|m\in[1,M]\}$. \textbf{Integrated score map generation}. In order to map the matching scores to each pixel, we adopt a superpixel algorithm, i.e., SEEDS \cite{van2012seeds,van2015seeds}. By conducting superpixel segmentation, we get the superpixel labels $\mathbf{L}_{sp} = \mathrm{SuperPixel}(\mathbf{I})$. Let $\mathbf{L}_{sp}(x_m,y_m)$ denote pixels whose superpixel labels are the same as $(x_m,y_m)$. We set scores of these pixels the same as the score of matched point $(x_m,y_m)$, i.e., $\mathbf{S}_{sp}(\mathbf{L}_{sp}(x_m,y_m))=s_m$. Thus, we get our pixel-level scores $\mathbf{S}_{sp}$ from superpixel and matched points. Besides, we also generate a pixel-level score map $\mathbf{S}_{p}$ from backbone scores $\mathbf{S}$ and candidate proposals which have matched points. Concretely, we set $\mathbf{S}_{p}(x,y)=\mathbf{S}(x,y)$ for $(x,y)$ in the scope of $\bm{p}_{\tilde{p}}$ which contains matched points, otherwise $\mathbf{S}_{p}(x,y)=0$. Thus, our integrated score map $\mathbf{S}_{in}$ is computed based on $\mathbf{S}_{sp}$ and $\mathbf{S}_{p}$ as follows: \begin {equation}\label{eq:finalscore} \mathbf{S}_{in}=\frac{1}{1+\mathrm{exp}(-\phi(\alpha\cdot\mathbf{S}_{sp}+\beta\cdot\mathbf{S}_{p}+\gamma))} \end {equation} where $\alpha$, $\beta$ and $\gamma$ are three parameters to balence $\mathbf{S}_{sp}$ and $\mathbf{S}_{p}$. We set $\alpha=\beta=1$ to make $\mathbf{S}_{sp}$ and $\mathbf{S}_{p}$ have the same contribution. We set $\gamma=-0.5$ to make sure it has the same distribution when $\mathbf{S}_{sp}(i)=0$. $\phi$ indicates the amplifying factor to control score distribution of $\mathbf{S}_{in}$, and is set to $4$. \textbf{Integrated score map refinement for label generation}. The directly computed $\mathbf{S}_{in}$ has some small isolated regions or holes inside detected regions, because there are some false-alarmed or missing-detected regions. In order to neglect regions with lower matching probability and refine contours according to image content, we formulate fully connected CRF (Conditional Random Field) \cite{krahenbuhl2011efficient} based on $\mathbf{S}_{in}$ and image $\mathbf{I}$, to get final labels. Our problem is that we have an image $\mathbf{I}$ which has $N$ pixels, and we try to fulfill a segmentation task with two classes. A segmentation of $\mathbf{I}$ is modelled as a random field $\mathbf{X}=\{X_1,\cdots,X_N\}$ where each random variable $X_n$ takes values of $\{0,1\}$. ``$1$" is used to label forged locations and corresponding genuine ones, while ``$0$" is for remaining parts. A conditional random field $(\mathbf{I}, \mathbf{X})$ is characterized by a Gibbs distribution $P(\mathbf{X}|\mathbf{I})=\frac{1}{Z(\mathbf{I})}\mathrm{exp}(-E(\mathbf{X}|\mathbf{I}))$, where the energy function $E(\mathbf{X}|\mathbf{I})$ is given by: \begin {equation}\label{eq:crfenergy} E(\mathbf{X}|\mathbf{I})=\sum_{i\le N}{\psi_u(X_i|\mathbf{I})} + \sum_{i\ne j\le N}{\psi_p(X_i,X_j|\mathbf{I})} \end {equation} where $\psi_u(X_i|\mathbf{I})$ is called unary potential. In our work, our computed $\mathbf{S}_{in}$ is treated as the unary potential: \begin {equation}\label{eq:unarypotential} \psi_u(X_i|\mathbf{I})=\mathbf{S}_{in}(i) \end {equation} And $\psi_p(X_i,X_j|\mathbf{I})$ is called pairwise potential. It accounts for the joint distribution of pixels $i$ and $j$. It allows us to explicitly model interactions between pixels, such as pixels with similar colour are likely the same class. And $\psi_p$ is formulated as weighted sum of Gaussian kernels: \begin {equation}\label{eq:pairpotential} \psi_p(X_i,X_j|\mathbf{I})=\mu(X_i,X_j)k(\mathbf{f}_i,\mathbf{f}_j) \end {equation} where $\mu(X_i,X_j)$ is a simple label compatibility function, which is given by the Potts model $\mu(X_i,X_j)=[X_i\ne X_j]$. It penalizes nearby similar pixels that are assigned different labels. $k(\mathbf{f}_i,\mathbf{f}_j)$ denotes Gaussian kernels with feature vectors $\mathbf{f}_i$ and $\mathbf{f}_j$ in an arbitrary feature space. Specifically, contrast-sensitive two-kernel potentials are formulated in our model: \begin {equation}\label{eq:gaussiankernel} \begin{aligned} k(\mathbf{f}_i,\mathbf{f}_j)=&\underbrace{w^{(1)}\mathrm{exp}(-\frac{|\mathrm{p}_i-\mathrm{p}_j|^2}{2\theta_{\alpha}^2}-\frac{|\mathrm{I}_i-\mathrm{I}_j|^2}{2\theta_{\beta}^2})}_{\text{appearance kernel}}\\&+\underbrace{w^{(2)}\mathrm{exp}(-\frac{|\mathrm{p}_i-\mathrm{p}_j|^2}{2\theta_{\gamma}^2})}_{\text{smoothness kernel}} \end{aligned} \end {equation} where $\mathrm{I}_i$ and $\mathrm{I}_j$ are color vectors, $\mathrm{p}_i$ and $\mathrm{p}_j$ are positions. $w^{(1)}$ and $w^{(2)}$ are linear combination weights. $\theta_{\alpha}$, $\theta_{\beta}$ and $\theta_{\gamma}$ are controlling parameters. The appearance kernel drives nearby pixels with similar color to be in the same class. The smoothness kernel removes small isolated regions. In our implementation, we adopt ConvCRF \cite{teichmann2018convolutional} for inference. ConvCRF adds the assumptions of conditional independence fully-connected CRF, and reformulates the inference in terms of convolutions which are implemented highly efficiently on GPUs. \section{Experimental Evaluation} \label{sec:experiment} \subsection{Implementation Details} \label{ssec:impledetails} Real-world copy-move forgery needs forgers to manually manipulate images and pasted regions. Therefore, the available copy-move forgery datasets are not sufficient for training an end-to-end deep matching network. Thus, we automatically generate a synthetic training set and a synthetic testing set from MS COCO 2014 training images and testing images respectively. For each image, we resize it to $512\times 512$, randomly select one annotated region under different transformations, and paste it to a random position of this image. All pasted regions randomly suffer four types of transformations, i.e., rotation changes in $\mathbb{U}(-60,60)$, scale changes in $\mathbb{U}(0.5,4)$, luminance changes in $\mathbb{U}(-32,32)$, and deformation changes in $\mathbb{U}(0.5,2)$ (decrease or increase the width of a tampered region). Following this strategy, we generate $120,000$ training images and $1,000$ testing images. The self deep matching network is trained with a single spatial cross entropy loss, and parameters in the basic feature extraction network are initialized using VGG16 \cite{simonyan2014very} which is trained for image classification. Similarly, alternative formulations are initilized using corresponding classification networks. We conduct $16$-epoch training, and adopt the Adadelta optimizer \cite{zeiler2012adadelta}. The input images are randomly resized in the range of $[256\times 256,512\times 512]$. Limited by our GPU memory, the batch size is set to $6$ (a larger batch size may further improve our performance). As for the Proposal SuperGlue stage, no further training is needed. We directly adopt their trained DeepMask \cite{pinheiro2015learning}, SuperPoint \cite{detone2018superpoint}, SuperGlue \cite{sarlin2020superglue} models. \subsection{Backbone Network Ablation Study} \label{ssec:ablation} \begin{table*}[htp] \renewcommand{\arraystretch}{1.3} \caption{Step-by-step analyses on the synthetic testing set.} \label{table:combstep} \centering \footnotesize \setlength{\tabcolsep}{1.6mm}{ \begin{tabular}{c | c c c c | c c c c | c c } \hline \multirow{2}{*}{Variant} & \multicolumn{4}{c|}{Protocol-All} & \multicolumn{4}{c|}{Protocol-Detected} & \multirow{2}{*}{$T$} & \multirow{2}{*}{Trainable params} \\\cline{2-9} & IoU & Precision & Recall & F1-score & IoU & Precision & Recall & F1-score & & \\ \hline encoder-decoder & 0.4982 & 0.5930 & 0.7905 & 0.6328 & 0.4992 & 0.5942 & 0.7921 & 0.6341 & 48 & 7,772,209 \\ encoder-decoder-skip & 0.5523 & 0.6523 & 0.7927 & 0.6835 & 0.5529 & 0.6530 & 0.7935 & 0.6841 & 48 & 14,985,265 \\ encoder-decoder-skip-normfeas & 0.6822 & 0.7793 & 0.8332 & 0.7897 & 0.6822 & 0.7793 & 0.8332 & 0.7897 & 48 & 14,985,265\\ SelfDM & 0.6959 & 0.7813 & 0.8506 & 0.7999 & 0.6959 & 0.7813 & 0.8506 & 0.7999 & 48 & 14,985,265 \\ \hline SelfDM-16 & 0.6818 & 0.7703 & 0.8427 & 0.7891 & 0.6832 & 0.7719 & 0.8444 & 0.7907 & 16 & 14,851,633 \\ SelfDM-32 & 0.6881 & 0.7899 & 0.8255 & 0.7927 & 0.6881 & 0.7899 & 0.8255 & 0.7927 & 32 & 14,918,449 \\ SelfDM-48 & 0.6959 & 0.7813 & 0.8506 & 0.7999 & 0.6959 & 0.7813 & 0.8506 & 0.7999 & 48 & 14,985,265 \\ SelfDM-64 & 0.6942 & 0.8038 & 0.8221 & 0.7970 & 0.6949 & 0.8046 & 0.8229 & 0.7978 & 64 & 15,052,081 \\ \hline SelfDM-SA & 0.7233 & 0.8458 & 0.8227 & 0.8216 & 0.7240 & 0.8467 & 0.8235 & 0.8225 & 48 & 15,724,148 \\ SelfDM-MSA & 0.7119 & 0.8466 & 0.8064 & 0.8096 & 0.7126 & 0.8475 & 0.8072 & 0.8104 & 48 & 17,940,797 \\ SelfDM-SACA & 0.7129 & 0.8370 & 0.8204 & 0.8136 & 0.7129 & 0.8370 & 0.8204 & 0.8136 & 48 & 15,799,236 \\ SelfDM-CASA & 0.7195 & 0.8472 & 0.8164 & 0.8182 & 0.7195 & 0.8472 & 0.8164 & 0.8182 & 48 & 15,799,236 \\ \hline \end{tabular}} \end{table*} \begin{table*}[htp] \renewcommand{\arraystretch}{1.3} \caption{Feature extractor comparisons on the synthetic testing set.} \label{table:combmodel} \centering \footnotesize \setlength{\tabcolsep}{2.35mm}{ \begin{tabular}{c | c c c c | c c c c | c } \hline \multirow{2}{*}{Variant} & \multicolumn{4}{c|}{Protocol-All} & \multicolumn{4}{c|}{Protocol-Detected} & \multirow{2}{*}{Trainable params} \\\cline{2-9} & IoU & Precision & Recall & F1-score & IoU & Precision & Recall & F1-score & \\ \hline SelfDM-SA & 0.7233 & 0.8458 & 0.8227 & 0.8216 & 0.7240 & 0.8467 & 0.8235 & 0.8225 & 15,724,148 \\ SelfDM-SA-ResNet50 & 0.7372 & 0.7809 & 0.9191 & 0.8312 & 0.7372 & 0.7809 & 0.9191 & 0.8312 & 30,664,372 \\ SelfDM-SA-ResNet101 & 0.7176 & 0.8246 & 0.8359 & 0.8059 & 0.7183 & 0.8254 & 0.8368 & 0.8067 & 49,656,500 \\ SelfDM-SA-MobileNetV2 & 0.7126 & 0.7957 & 0.8584 & 0.8118 & 0.7126 & 0.7957 & 0.8584 & 0.8118 & 4,557,012 \\ SelfDM-SA-MobileNetV3 & 0.7512 & 0.8575 & 0.8467 & 0.8412 & 0.7512 & 0.8575 & 0.8467 & 0.8412 & 4,092,268 \\ SelfDM-SA-ShuffleNetV2 & 0.6676 & 0.7692 & 0.8137 & 0.7745 & 0.6676 & 0.7692 & 0.8137 & 0.7745 & 2,920,602 \\ \hline \end{tabular}} \end{table*} Our backbone self deep matching network incorporates encoder-decoder architecture with atrous convolution, skip matching, feature normalization, correlation normalization and spatial attention. In TABLE~\ref{table:combstep}, step-by-step analyses are provided on the synthetic testing set. We compute the pixel-level IoU, precision, recall and F1-score for each image, and caculate their average scores. Two protocols are adopted: ``Protocol-All" means we compute the average scores of all evaluated images, and ``Protocol-Detected" only computes average scores of detected images. It shows that each component of our backbone network plays an important role in improving its localization performance. Specifically, ``encoder-decoder" denotes a pure architecture with a feature extractor and a decoder, there is no skips, normalization and attention; In ``encoder-decoder-skip", we add skip matching; In ``encoder-decoder-skip-normfeas", input feature maps before correlation computation are normalized; In ``SelfDM", correlation maps are followed by ReLU and L2-normalization. Besides, we make a discussion on the selection of $T$ in Eq.~(\ref{eq:sortpool}). We find that it can even achieve comparable performance when $T=16$. When we set $T=48$, it can get higher scores. There is no further improvement with $T=64$. More importantly, we test four types of attention-based self-correlation formulations, i.e., ``SelfDM-SA" with spatial attention, ``SelfDM-MSA" with multi-head spatial attention \cite{vaswani2017attention}, ``SelfDM-SACA" with spatial attention before channel attention and ``SelfDM-CASA" with spatial attention after channel attention \cite{hu2018squeeze}. Although, ``SelfDM-MSA", ``SelfDM-SACA" and ``SelfDM-CASA" have more parameters, their performance is barely satisfactory. We guess the main reasons are that: (1) single spatial attention can already reinforce correlated regions, while multiple spatial attention with redundant information may mislead our model; (2) SE blocks \cite{hu2018squeeze} (channel attention) improve the classification performance by densely adding them into convolutional blocks, while we only add them into self-correlation which is not sufficient enough. After comprehensive comparison, we select the version with spatial attention, i.e., ``SelfDM-SA". In section \ref{sssec:FEAC}, alternative formulations are discussed. Two deeper networks (ResNet50, ResNet101) and three light-weight networks (MobileNetV2, MobileNetV3, ShuffleNetV2) are consturcted. We find that ``SelfDM-SA-ResNet50" can slightly improve the performance of our backbone network, while the performance of deeper ``SelfDM-SA-ResNet101" is even worse. It shows that high-level features with richer semantic information are not as important as discriminative features with rich spatial information, in a deep matching task. Furthermore, light-weight networks are compared. The performance of ``SelfDM-SA-MobileNetV3" is even better. So we finally select the default ``SelfDM-SA" with VGG, ``SelfDM-SA-ResNet50" and ``SelfDM-SA-MobileNetV3" for further comparison in the next section. \subsection{Comparison with State-of-the-art Methods} \label{ssec:csms} \begin{table*}[hbtp] \renewcommand{\arraystretch}{1.3} \caption{Comparisons with the state-of-the-art methods on the synthetic testing set.} \label{table:comparecomb} \centering \footnotesize \setlength{\tabcolsep}{3.2mm}{ \begin{tabular}{c | c c c c | c c c c } \hline \multirow{2}{*}{Methods} & \multicolumn{4}{c|}{Protocol-All} & \multicolumn{4}{c}{Protocol-Detected} \\\cline{2-9} & IoU & Precision & Recall & F1-score & IoU & Precision & Recall & F1-score \\ \hline LiJ \cite{li2015segmentation} & 0.3188 & 0.3620 & 0.3723 & 0.3597 & 0.6826 & 0.7752 & 0.7972 & 0.7702 \\ Cozzolino \cite{cozzolino2015efficient} & 0.2377 & 0.3105 & 0.2584 & 0.2728 & 0.6911 & 0.9027 & 0.7513 & 0.7931 \\ BusterNet \cite{wu2018busternet} & 0.3349 & 0.5814 & 0.3764 & 0.4213 & 0.4412 & 0.7660 & 0.4959 & 0.5550 \\ \hline SelfDM-SA & 0.7233 & 0.8458 & 0.8227 & 0.8216 & 0.7240 & 0.8467 & 0.8235 & 0.8225 \\ SelfDM-SA+PS & 0.7198 & 0.8445 & 0.8232 & 0.8186 & 0.7205 & 0.8453 & 0.8239 & 0.8194 \\ SelfDM-SA+PS+CRF & 0.7403 & 0.8785 & 0.8176 & 0.8308 & 0.7433 & 0.8820 & 0.8209 & 0.8342 \\ \textit{SelfDM-SA+CRF}$\star$ & \textit{0.7317} & \textit{0.8921} & \textit{0.7958} & \textit{0.8252} & \textit{0.7376} & \textit{0.8993} & \textit{0.8024} & \textit{0.8309} \\ \hline SelfDM-SA-ResNet50 & 0.7372 & 0.7809 & 0.9191 & 0.8312 & 0.7372 & 0.7809 & 0.9191 & 0.8312 \\ SelfDM-SA-ResNet50+PS & 0.7247 & 0.7742 & 0.9112 & 0.8232 & 0.7247 & 0.7742 & 0.9112 & 0.8232 \\ SelfDM-SA-ResNet50+PS+CRF & 0.7438 & 0.8066 & 0.8986 & 0.8358 & 0.7438 & 0.8066 & 0.8986 & 0.8358 \\ \hline SelfDM-SA-MobileNetV3 & 0.7512 & 0.8575 & 0.8467 & 0.8412 & 0.7512 & 0.8575 & 0.8467 & 0.8412 \\ SelfDM-SA-MobileNetV3+PS & 0.7364 & 0.8488 & 0.8391 & 0.8302 & 0.7364 & 0.8488 & 0.8391 & 0.8302 \\ SelfDM-SA-MobileNetV3+PS+CRF & 0.7531 & 0.8848 & 0.8281 & 0.8394 & 0.7538 & 0.8856 & 0.8289 & 0.8403 \\ \hline \end{tabular}} \end{table*} We adopt four datasets for comprehensive comparisons: our synthetic testing set, CoMoFoD dataset \cite{tralic2013comofod}, CASIA CMFD dataset \cite{wu2018busternet}, and MICC-F220 dataset \cite{amerini2011sift}. Pasted regions in our synthetic testing set have gone through multiple changes with greater extent. Besides, there is only one pair of similar regions in each image, and there is no obvious ``disturbance" (similar but genuine regions) for the most cases. So it can indicate the capability and robustness of algorithms to detect appearance similar regions under different transformations. We select a representative keypoint-based method (LiJ \cite{li2015segmentation}), an advanced block-based method (Cozzolino \cite{cozzolino2015efficient}), and an end-to-end deep learning method (BusterNet \cite{wu2018busternet}) for comparison. Scores in TABLE~\ref{table:comparecomb} are generated by their codes provided by the authors. It clearly shows that classical methods (``LiJ" and ``Cozzolino") are not robust enough against different transformations, while their detected regions mostly are accurate (comparable scores in ``Protocol-Detected"). Our backbone network has strong ability to detect similar regions. Since there are few ``disturbances", the ability of Proposal SuperGlue to remove false-alarmed regions is not obvious in this dataset. However, it still can be seen that precisions are increased and overall scores are higher. Specifically, ``SelfDM-SA+PS" indicates the two-stage version without ConvCRF optimization, ``SelfDM-SA+PS+CRF" adds ConvCRF, and ``SelfDM-SA+CRF$\star$" directly conducts ConvCRF on the backbone network which is used to demonstrate the effectiveness of Proposal SuperGlue. Furthermore, visual comparions are provided in Fig.~\ref{Figure:cocovis}. In rows 1 and 2, we provide images with obvious scale changes, SelfDM-SA can already achieve satisfied performance. In the column of ``SelfDM-SA+PS", proposals (light blue rectangular regions with lower scores) can enclose suspected regions, and further SuperGlue with SuperPoint can be conducted. With the help of ConvCRF, the score distribution can be optimized. BusterNet only detects their approximate locations without accurate boundaries. And it is difficult for classical methods to detect regions under severe transformations like scale or rotation changes. In rows 3 to 6, we provide four challengable cases. Our backbone network detects some false-alarmed regions or only detects partial regions, while proposal SuperClue can enclose those regions and clearly optimize the detected regions. In the last two rows, we also provide two failure cases. SelfDM-SA can already generate an accurate result while Proposal SuperGlue causes some false-alarmed regions around boundaries in row 7. Or no meaningful proposals are obtained in row 8. \begin{figure}[htbp] \centering \includegraphics[width=0.99999\columnwidth]{cocovis.eps} \caption{Example copy-move forgery detection results on the synthetic testing set. In the ``GT" column, red regions indicate forged regions and green regions are original regions.} \label{Figure:cocovis} \end{figure} The CoMoFoD dataset consists of $200$ copy-move forged images with resolution $512\times 512$. Besides the version with no postprocessing, these images are processed under $6$ kinds of postprocessing respectively, namely brightness change (BC), contrast adjustments (CA), color reduction (CR), image blurring (IB), JPEG compression (JC), and noise adding (NA). In TABLE~\ref{table:CoMoFoDnoattack}, two measure protocols are used. ``Correctly Detected Average" only computes the average score of correctly detected images. An image is referred as correctly detected if its pixel-level F1-score is higher than $0.5$. ``Overall Average" computes their average scores of all images. We find that although our backbone network can achieve excellent performance on synthetic testing images, there is no obvious advantage on CoMoFoD. The main reason is that pasted regions in CoMoFod have gone through only slight changes, compared methods can already achieve good performance. Besides, limited by the training set, the majority of synthetic images only have a pair of similar objects. In another word, there are few of disturbances with similar appearance. Our backbone network has strong ability to detect similar objects under severe transformations, so that there are inevitably some false-alarmed regions (rows 1, 3, 4, 5, 6, 8 in Fig.~\ref{Figure:comovis}), which affect the scores on CoMoFoD. With the help of Proposal SuperGlue, it can be clearly seen that we can remove some false-alarmed regions and complement miss-detected regions (Fig.~\ref{Figure:comovis}). Thus, the performance can be obviously improved. Besides, the robustness against different postprocessing is evaluated and shown in Fig.~\ref{Figure:f1scorescomofodattacks}. Our two-stage version, i.e., SelfDM-SA+PS+CRF, can achieve consistently higher scores under different attacks, which also demonstrate the high robustness of our method. As for the alternative networks, i.e., SelfDM-SA-ResNet50 and SelfDM-SA-MobileNetV3, our Proposal SuperGlue can also notably improve their performance. Especially, the precision scores are improved. \begin{figure}[htbp] \centering \includegraphics[width=0.99999\columnwidth]{comovis.eps} \caption{Example copy-move forgery detection results on CoMoFoD.} \label{Figure:comovis} \end{figure} CASIA CMFD dataset is selected from CASIA TIDEv2.0 dataset by Wu et al. \cite{wu2018busternet}. There are $1313$ CMFD samples and their authentic counterparts. They provide $256\times 256$ images and masks as a HDF dataset. In our experiments, both pixel-level and image-level scores are computed. Pixel-level scores are the overall average scores of all CMFD samples (the same as ``Overall Average" in TABLE~\ref{table:CoMoFoDnoattack}). Our backbone network based on VGG, i.e., SelfDM-SA, can already achieve higher scores, and Proposal SuperGlue with ConvCRF can further improve its performance. Dramatically, the MobileNetV3 version can achieve the best performance. It further demonstrates that the discriminative capability of features are more important in the deep matching task, and it is different from image understanding tasks (e.g. image classification, object detection, semantic segmentation) in which high-level features with more semantic informantion play a more important role. \begin{table*}[htp] \renewcommand{\arraystretch}{1.3} \caption{Comparisons on CoMoFoD dataset with no attack.} \label{table:CoMoFoDnoattack} \centering \footnotesize \setlength{\tabcolsep}{3.55mm}{ \begin{tabular}{c | c c c c | c c c } \hline \multirow{2}{*}{Method} & \multicolumn{4}{c|}{Correctly Detected Average} & \multicolumn{3}{c}{Overall Average} \\\cline{2-8} & Detected Rate & Precision & Recall & F1-score & Precision & Recall & F1-score \\ \hline Ryu2010\cite{ryu2010detection} & 0.450 & 0.9627 & 0.6984 & 0.7993 & 0.4578 & 0.3435 & 0.3737 \\ LiJ \cite{li2015segmentation} & 0.510 & 0.8042 & 0.9586 & 0.8616 & 0.4247 & 0.6633 & 0.4644 \\ Cozzolino \cite{cozzolino2015efficient} & 0.505 & 0.8132 & 0.9384 & 0.8591 & 0.4174 & 0.5042 & 0.4440 \\ Wu2018 \cite{wu2018image} & 0.265 & 0.6111 & 0.7148 & 0.6313 & 0.3629 & 0.4041 & 0.3113 \\ BusterNet \cite{wu2018busternet} & 0.585 & 0.8352 & 0.7875 & 0.8009 & 0.5734 & 0.4939 & 0.4926\\ \hline SelfDM-SA & 0.475 & 0.7086 & 0.8210 & 0.7350 & 0.5722 & 0.5216 & 0.4660 \\ SelfDM-SA+PS & 0.575 & 0.7895 & 0.8087 & 0.7641 & 0.6086 & 0.5624 & 0.5151 \\ SelfDM-SA+PS+CRF & 0.545 & 0.8139 & 0.8282 & 0.7943 & 0.6375 & 0.5444 & 0.5172 \\ \hline SelfDM-SA-ResNet50 & 0.520 & 0.7518 & 0.7394 & 0.7208 & 0.5340 & 0.5467 & 0.4753 \\ SelfDM-SA-ResNet50+PS & 0.545 & 0.8439 & 0.7668 & 0.7786 & 0.5910 & 0.5631 & 0.5108 \\ SelfDM-SA-ResNet50+PS+CRF & 0.555 & 0.8728 & 0.7432 & 0.7773 & 0.6231 & 0.5342 & 0.5088 \\ \hline SelfDM-SA-MobileNetV3 & 0.465 & 0.6526 & 0.8468 & 0.7096 & 0.4833 & 0.5198 & 0.4299 \\ SelfDM-SA-MobileNetV3+PS & 0.530 & 0.7488 & 0.8137 & 0.7438 & 0.5170 & 0.5260 & 0.4645 \\ SelfDM-SA-MobileNetV3+PS+CRF & 0.505 & 0.7885 & 0.8202 & 0.7742 & 0.5600 & 0.5049 & 0.4695 \\ \hline \end{tabular}} \end{table*} \begin{figure}[htp] \begin{minipage}[b]{0.8\linewidth} \centering \centerline{\includegraphics[width=5cm]{comolegend.eps}} \end{minipage} \begin{minipage}[b]{0.48\linewidth} \centering \centerline{\includegraphics[width=5cm]{comoBC.eps}} \centerline{\footnotesize{Brightness change (BC)}} \end{minipage} \hfill \begin{minipage}[b]{0.48\linewidth} \centering \centerline{\includegraphics[width=5cm]{comoCA.eps}} \centerline{\footnotesize{Contrast adjustments (CA)}} \end{minipage} \vfill \begin{minipage}[b]{0.48\linewidth} \centering \centerline{\includegraphics[width=5cm]{comoCR.eps}} \centerline{\footnotesize{Color reduction (CR)}} \end{minipage} \hfill \begin{minipage}[b]{0.48\linewidth} \centering \centerline{\includegraphics[width=5cm]{comoIB.eps}} \centerline{\footnotesize{ Image blurring (IB)}} \end{minipage} \vfill \begin{minipage}[b]{0.48\linewidth} \centering \centerline{\includegraphics[width=5cm]{comoJC.eps}} \centerline{\footnotesize{JPEG compression (JC)}} \end{minipage} \hfill \begin{minipage}[b]{0.48\linewidth} \centering \centerline{\includegraphics[width=5cm]{comoNA.eps}} \centerline{\footnotesize{Noise adding (NA)}} \end{minipage} \caption{Pixel-level F1 scores (y-axis) on CoMoFoD under attacks (x-axis).} \label{Figure:f1scorescomofodattacks} \end{figure} \begin{table*}[htp] \renewcommand{\arraystretch}{1.3} \caption{Performance analysis on CASIA CMFD dataset.} \label{table:casia} \centering \footnotesize \setlength{\tabcolsep}{5.3mm}{ \begin{tabular}{c | c c c | c c c} \hline \multirow{2}{*}{Method} & \multicolumn{3}{c|}{Pixel Level} & \multicolumn{3}{c}{Image Level} \\\cline{2-7} & Precision & Recall & F1-score & Precision & Recall & F1-score \\ \hline Ryu2010 \cite{ryu2010detection} & 0.2271 & 0.1336 & 0.1640 & 0.9701 & 0.2447 & 0.3908 \\ Christlein \cite{christlein2012evaluation} & 0.3709 & 0.0014 & 0.0023 & 0.6849 & 0.6782 & 0.6815 \\ Cozzolino \cite{cozzolino2015efficient} & 0.2492 & 0.2681 & 0.2543 & 0.9951 & 0.3061 & 0.4682 \\ Wu2018 \cite{wu2018image} & 0.2397 & 0.1379 & 0.1464 & 0.6637 & 0.7359 & 0.6980 \\ BusterNet-simi \cite{wu2018busternet} & 0.4723 & 0.4844 & 0.4372 & 0.7153 & 0.8073 & 0.7585 \\ BusterNet \cite{wu2018busternet} & 0.5571 & 0.4383 & 0.4556 & 0.7822 & 0.7389 & 0.7598 \\ \hline SelfDM-SA & 0.6551 & 0.4353 & 0.4635 & 0.7707 & 0.7807 & 0.7757 \\ SelfDM-SA+PS & 0.6485 & 0.4531 & 0.4709 & 0.7860 & 0.7609 & 0.7732 \\ SelfDM-SA+PS+CRF & 0.6494 & 0.4520 & 0.4782 & 0.7860 & 0.7609 & 0.7732 \\ \hline SelfDM-SA-ResNet50 & 0.5358 & 0.4500 & 0.4356 & 0.6038 & 0.9238 & 0.7303 \\ SelfDM-SA-ResNet50+PS & 0.5359 & 0.4676 & 0.4464 & 0.6164 & 0.9018 & 0.7323 \\ SelfDM-SA-ResNet50+PS+CRF & 0.5729 & 0.4679 & 0.4595 & 0.6164 & 0.9018 & 0.7323 \\ \hline SelfDM-SA-MobileNetV3 & 0.6248 & 0.4778 & 0.4843 & 0.6914 & 0.8294 & 0.7542\\ SelfDM-SA-MobileNetV3+PS & 0.6272 & 0.4856 & 0.4891 & 0.7040 & 0.8096 & 0.7531 \\ SelfDM-SA-MobileNetV3+PS+CRF & 0.6362 & 0.4752 & 0.4918 & 0.7040 & 0.8096 & 0.7531 \\ \hline \end{tabular}} \end{table*} \begin{table}[!t] \renewcommand{\arraystretch}{1.3} \caption{Image-level performance on MICC-F220 dataset.} \label{table:miccf220} \centering \footnotesize \begin{tabular}{c | c c c} \hline Method & TPR & FPR & F1-score \\ \hline Cozzolino \cite{cozzolino2015efficient} & 0.8455 & 0.1727 & 0.8378 \\ LiJ \cite{li2015segmentation} & 0.7091 & 0.1727 & 0.7536 \\ GoDeep \cite{silva2015going} & 0.4545 & 0.4182 & 0.4854 \\ Zandi \cite{zandi2016iterative} & 0.7818 & 0.4818 & 0.6908 \\ BusterNet \cite{wu2018busternet} & 0.4909 & 0.2000 & 0.5806 \\ SelfDM-SA & 0.9273 & 0.2545 & 0.8500 \\ SelfDM-SA+PS+CRF & 0.9182 & 0.2272 & 0.8559 \\ SelfDM-SA-ResNet50 & 0.9727 & 0.6909 & 0.7304 \\ SelfDM-SA-ResNet50+PS+CRF & 0.9545 & 0.6454 & 0.7343 \\ SelfDM-SA-MobileNetV3 & 0.9636 & 0.4182 & 0.8092 \\ SelfDM-SA-MobileNetV3+PS+CRF & 0.9545 & 0.3909 & 0.8140 \\ \hline \end{tabular} \end{table} MICC-F220 is composed by $220$ images: $110$ tampered images and $110$ originals. There is no ground truth, and we evaluate the image-level performance. All the methods are evaluated by True Positive Rate (TPR), False Positive Rate (FPR) and corresponding F1-score, which are computed as: $TPR=TP/(TP+FN)$, $FPR=FP/(TN+FP)$, $F_1=2TP/(2TP+FP+FN)$, where $TP$ denotes true positive, $TN$ denotes true negtive, $FN$ denotes false negative and $FP$ denotes false positive. SelfDM-SA and the corresponding Proposal SuperGlue version can achieve better performance than many other state-of-the-art methods. Especially, we can achieve higher TPRs. However, the alternative formulations have higher FPRs, FPRs of the ResNet50 version are even greater than $0.6$. Considering all the experimental results on four datasets, we do not recommend the use of deeper networks for feature extraction, because they have more parameters, low efficiency and high false-alarmed rates. The VGG version is more stable and robust. The MobileNetV3 version has less parameters to learn and can achieve comparable performance on different datasets. Even so, we find that our two-stage framework can be applied to backbone networks with different feature extractors to achieve better performance. \section{Conclusion} \label{sec:conclusion} In this paper, we propose a two-stage framework for deep learning based copy-move forgery detection. Our two-stage framework integrates self deep matching and keypoint matching by obtaining highly suspected proposals. The first stage is a backbone network which adopts atrous convolution, skip matching, and spatial attention. In the second stage, our Proposal SuperGlue is proposed to remove false alarms and complement incomplete regions. Specifically, we build a proposal selection module to enclose suspected regions, and conduct pairwise matching based on SuperPoint and SuperGlue. Integrated score map generation and refinement methods are proposed to obtain final results. Our two-stage framework can achieve consistently better performance on different public datasets. The two-stage framework relies on the performance of the backbone network. In the future, our two-stage framework can be further improved by designing a more powerful backbone network. \ifCLASSOPTIONcaptionsoff \newpage \fi \bibliographystyle{IEEEtran}
{'timestamp': '2020-12-17T02:07:14', 'yymm': '2012', 'arxiv_id': '2012.08697', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08697'}
arxiv
\section{Introduction} Object detection, as a hot topic of computer vision, is to find out the objects of interest on the image and to determine their locations and categories. In the era of deep learning~\cite{NIPS2012_4824}, many deep convolutional neural network (DNN)-based methods~\cite{girshick2015fast,ren2015faster,Redmon_2016_CVPR,Redmon_2017_CVPR,redmon2018yolov3,liu2016ssd} have been proposed to make the detection models with excellent performance in natural image benchmark datasets~\cite{everingham2010pascal, lin2014microsoft}. While in reality, there is an obvious distributional gap between the training set (source domain) and the testing set (target domain), which may lead to a significant reduction in the generalization ability of models in target domain. Therefore, many unsupervised domain adaptive object detection~(DAOD) methods~\cite{DAfaster, saito2019strong, Xinge2019Adapting, kim2019diversify, cai2019exploring, Chen2020Harmonizing} are proposed to solve the problem of domain distributional shifts. Most unsupervised DAOD methods are nested adversarial training module within advanced object detection frameworks, such as Faster R-CNN~\cite{ren2015faster}. By minimizing the domain shifts of multi-level feature maps, domain adaption is achieved to improve the detection accuracy in the target domain. Numerous DAOD methods are proposed and most of them focus on image-level~\cite{DAfaster}, instance-level~\cite{DAfaster,Chen2020Harmonizing}, pixel-level~\cite{kim2019diversify, Chen2020Harmonizing}, region-level~\cite{Xinge2019Adapting} and strong-local \& weak-global-level~\cite{saito2019strong} alignments. Whereas, the existing multi-level alignment modules may cause three issues: Firstly, they only focus on the mapping of the source and target domain, and less consider other distractive information that is unnecessary to be aligned, \eg, background information. Secondly, we should concern over the regions where the object needs to be aligned on the image, and ignore background noise that is useless for detection. However, the current region searching algorithm \cite{Xinge2019Adapting} in region-level alignment restrict the category numbers of candidate region. Since there is no label for the target domain, we cannot exactly determine the object region numbers. Lastly, for the existing instance alignment modules, they are all based on ROI-Pooling~\cite{ren2015faster} feature alignment. While the training of region proposal network (RPN)~\cite{ren2015faster} mainly depends on the labels of the source domain, and there may be abundant redundancy or noise in region of interests (ROIs) on the target domain. Resultly, when the instance is aligned, there will be an extra alignment of background features or multiple alignments of instance-level features for some certain objects. In order to solve the above mentioned issues, we propose a DAOD method based on the architecture of Faster R-CNN~\cite{ren2015faster}, called feature separation and alignment network (FSANet). The network consists of a gray-scale feature separation (GSFS) module, a local-global feature alignment module (LGFA) and a region-instance-level alignment (RILA) module. The feature separation module separates the distractive information containing the features that do not need to be aligned and the shared information related to the object detection through the difference loss, so that the feature alignment module can concentrate on the object information. LGFA and RILA are domain adaptation components, which reduce the distributional gaps of the multi-level features. Our contributions can be divided into two-fold: (1) The dual-stream network~\cite{bousmalis2016domain, zhaoijcai2020} can extract multi-model information of different domain images. Inspired by this, we design a dual-stream auto-encoder network for the GSFS. The distractive information of the image is separated by a private encoder, and the object detection backbone network acts as a shared information extractor to obtain useful features for detection. When aligning high-dimensional features, we use shared features instead of the whole image features to reduce the impact of distractive information that is not related to detection, so as to improve domain adaptability. Particularly, in order to reduce the impact of image color differences and the difficulty of reconstruction, we use the gray-scale image to extract the distractive features. This operation can make the private encoder focus on detection-related/irrelevant features of the objects rather than the image color, and while simplifying the reconstruction task. (2) We design the RAIL module, which can effectively solve the negative effects caused by the redundancy of the region proposals and background noise, and determine the category number for candidate region adaptively. Initially, by exploiting Scale-Space Filtering algorithm (SSF)~\cite{895974}, we cluster the center coordinate of the bounding boxes predicted by RPN, to implement an adaptive region selection. Thus the traditional clustering region number uncertainty problem is well solved. Then, after obtaining the cluster centers and scale by SSF, the outliers of ROIs can be found. We believe that these abnormal ROIs have a high probability of containing background information. So we exclude them before region grouping, thereby reducing the effect of ROIs noise. Finally, through global pooling layer, the instance-level features of each group (\ie, candidate region) are refined and instance alignment is performed to figure out the problem of ROIs redundancy. In summary, the adaptability and transferability of adversarial-based adaptive detection methods are enhanced by separating the shared and distractive information of the source/target domain and aligning the region-instance-level features. Extensive experiments illustrate that the proposed FSANet has reached an outstanding level of cross-domain detection performance on multiple benchmark datasets. For example, the FSANet achieves $42.7\%$ mAP for transfer task on PASCAL $\to$ Clipart1k, which surpassing the state-of-the-art (SOTA) adversarial-based adaptive methods~\cite{DAfaster,Xinge2019Adapting,saito2019strong,kim2019diversify,Chen2020Harmonizing,sindagi2019prior,he2020domain}. \section{Related Work} \noindent {\bf Object Detection.} Nowadays, with the rapid development of deep neural convolutional networks (DNN), lots of methods have been proposed to solve the object detection task. They can be divided into two-stage object detection methods based on region proposals and end-to-end one-stage methods. The pioneering work of the two-stage methods is R-CNN~\cite{girshick2014rich}, which first utilizes a selective search method~\cite{uijlings2013selective} to extract region proposals from images, and then trains a network to classify each ROIs. SPP-Net~\cite{he2015spatial} and Fast R-CNN~\cite{girshick2015fast} exploited DNNs to propose region proposals and significantly improved detection accuracy and speed. As DNNs were extended to share convolutional feature maps among all ROIs~\cite{ren2015faster} , the end-to-end two-stage methods (\eg, Faster R-CNN~\cite{ren2015faster} and RetinaNet~\cite{lin2017focal}) were proposed. On the other hand, typical methods of one-stage object detection algorithms are YOLO~\cite{Redmon_2016_CVPR, Redmon_2017_CVPR, redmon2018yolov3} and SSD~\cite{liu2016ssd}, which extract the feature maps from the original image based on the convolutional network, and then directly perform object classification and bounding box regression. \medskip\\ {\bf Domain Adaptive Object Detection.} The existing unsupervised DAOD methods can be divided into three categories~\cite{li2020deep}: adversarial-based, reconstruction-based and hybrid adaptive methods. For the adversarial-based adaptive methods, Chen \etal~\cite{DAfaster} first applied the unsupervised domain adaptive method to object detection. By combining with the gradient reversal layer and domain classifier, an adversarial-based method~\cite{ganin2015unsupervised} is proposed to solve the domain shift in the real scene. At the same time, it is pointed out that the core issue of unsupervised DAOD is to solve the domain gaps in image and instance level. For example, Zhu \etal~\cite{Xinge2019Adapting} indicated that the object detection needs to concern with the object rather than the entire image features, and then a regional-level domain adaptive network based on GAN~\cite{goodfellow2014generative} is established to solve the region proposal redundancy problem. Saito \etal~\cite{saito2019strong} proposed a local domain classifier network based on FCN~\cite{Long2017Fully} to achieve the alignment of low-level features. For the reconstruction-based adaptive methods, Arruda \etal~\cite{Arruda2019Cross} firstly generated pseudo samples similar to the target domain from the source samples by CycleGAN~\cite{Zhu2017Unpaired}, and added them to the training set to improve detection accuracy. The hybrid adaptive methods aim at combining the above two categories to improve the model performance. In order to realize the adaptative object detection from natural images to artistic images, Inoue \etal~\cite{Inoue2018Cross} initially trained a detection model from the source domain samples, then fine-tuned the model on the pseudo samples of source domain, and finally implemented the weak training on the target domain samples. Based on pseudo samples, Kim \etal~\cite{kim2019diversify} proposed an adaptive method for domain diversification and multi-domain invariant representation. Chen \etal~\cite{Chen2020Harmonizing} added the attention mechanism to the network based on~\cite{saito2019strong}. Although the above methods have achieved good performance, they do not concern for separating the distractive information and solving the region proposals redundancy and background noise. So in our paper, we propose a novel DAOD method called FSANet to further figure out the above mentioned issues. \begin{figure*}[t] \begin{center} \includegraphics[width=0.77\linewidth]{net.png} \end{center} \caption{The overall structure of the proposed FSANet.} \label{fig:net} \end{figure*} \section{Method} In this section, we introduce the details of FSANet. The framework is illustrate in Figure~\ref{fig:net}, which consists of four parts, namely the \textit{object detection} module, the \textit{LGFA} module, the \textit{RILA} module and the \textit{GSFS} module. Initially, the paired source/target domain RGB images are input to the detection network, and the detection loss is calculated with the label of the source domain images, and the instance-level features alignment is realized by the RILA module. For the multi-level features $f_{\tau}(\tau=1,2,3)$ extracted by the backbone network $F_{\tau}$, they are input into the LGFA module to complete the multi-level features alignment. In addition, the gray-scale paired images are input into the GSFS module, and the useful/useless features for detection are separated through a specific loss. Here, we use Faster R-CNN~\cite{ren2015faster} as the object detection backbone architecture, and the LGFA module follows the design of~\cite{saito2019strong,Chen2020Harmonizing}. Especially, we focus on the GSFS module and the RILA module. For the notations in this paper, the source domain dataset with labeled samples are denoted by $D_s=\{(x_i^s, b_i^s, y_i^s)\}_{i}^{n_s}$, where $x_i^s$ is the input source image, $b_i^s$ is the coordinates of the bounding box, $y_i^s$ is the object category label, and $n_s$ is the number of samples in the source domain dataset. Meanwhile, unlabeled target domain dataset is represented as $D_t=\{(x_i^t)\}_i^{n_t}$, where $n_t$ is the number of samples in the target dataset. Our task is to transfer the model learned from $D_s$ to $D_t$. \subsection{Gray-Scale Feature Separation Module} As is known to all, domain adversarial loss can reduce the inconsistency between the features distribution of the two domains. However, there will still be some distractive information that cannot be reduced, \eg, the background distractive information of the source/target domain. So we propose a GSFS module based on a dual-stream network, and employ it to separate the distractive/shared information which is useless/useful for object detection with the high-level features through the private encoder $E_s$ and $E_t$, the shared decoder $S_D$ and the features extraction module $F_\tau$, as shown in Figure~\ref{fig:net}. Firstly, $F_3$ extracts high-level features related to object detection via the detection loss. Then domain adversarial loss of LGFA module makes the features $f_\tau$ of the source/target domain aligned. As a result, $f_3$ is the shared high-level features useful for detection. For the GSFS module, we define the different loss to limit the similarity of $\left\lbrace d^s,f_3^s\right\rbrace $ and $\left\lbrace d^t,f_3^t\right\rbrace$: \begin{equation} \mathcal{L}\!_\mathit{diff}\!=\!\frac{1}{n_s}\!\sum_{i=1}^{n_s} \lVert g(d^s_i)^\top\!g(f_{3,i}^s) \rVert _F^2 + \frac{1}{n_t}\!\sum_{i=1}^{n_t}\!\lVert g(d^t_i)^ \top\!g(f_{3,i}^t) \rVert _F^2, \end{equation} where $\lVert \cdot \rVert _F^2$ is the squared Frobenius norm , $g(\cdot)$ is the global pooling layer, $d_i^s$, $d_i^t$, $f_{3,i}^s$, $f_{3,i}^t$ denote distractive information output by private encoder $E_s$/$E_t$ and the shared information $f_3$ of source/target domain for $i$th image, respectively. In addition, considering that simple restrictions will make $d^s$ and $d^t$ meaningless, and the information related to objects cannot include all the information of the input image, we use the fusion features $f_\mathit{fus}^s\!=\![d^s, f_{3}^s]$, $f_\mathit{fus}^t\!=\![d^t, f_{3}^t]$ as the input of the shared decoder $S_D$ to reconstruct the input image, where $[\cdot,\cdot]$ denotes the concatenation of two feature maps in the channel dimension. Through the restriction of image reconstruction, the separated features can possess almost all the information of source/target images. So that the private encoder extracts the distractive information irrelevant to detection in the image. Notably, the private encoder inputs two-domain images in gray-scale, and extract the distractive information which is irrelevant to the color of the two-domain images. If the input is an RGB image, it will not only increase the difficulty of reconstruction, but also make the private encoder disturb by the color difference of the image, while ignoring other distractive information on the two data domains. Finally, the reconstruction loss of the gray-scale images is defined as: \begin{equation} \mathcal{L}_\mathit{rec} = \frac{1}{n_s}\sum_{i=1}^{n_s} \lVert x_{g,i}^s - \hat{x}_{g,i}^s \rVert _1^1 + \frac{1}{n_t}\sum_{i=1}^{n_t} \lVert x_{g,i}^t - \hat{x}_{g,i}^t \rVert _1^1, \end{equation} where $\lVert \cdot \rVert _1^1$ is the $\ell_1$-norm, ${x}_{g,i}^s$, ${x}_{g,i}^t$, $\hat{x}_{g,i}^s$ and $\hat{x}_{g,i}^t$ are the $i$th gray-scale input images and reconstructed images by the shared decoder $S_D$ in source/target domain. \subsection{Region-Instance-Level Alignment} The RILA module consists of a \textit{grouping} component and a \textit{context-aware RILA} component. Please refer to supplemental material to see illustration and more details.\\ \noindent {\bf Grouping.} Some alignment module~\cite{DAfaster, he2019multi, Chen2020Harmonizing} implement the instance-level feature alignment of all region proposals. However, the absence of labels on the target domain leads to the training of RPN mainly guided by the labeled data on the source domain~\cite{ren2015faster}. Therefore, we cannot ensure that the region proposals on the target domain contain the objects, where may contain a lot of background noise. Meanwhile, objects are generally detected by multiple region proposals, which means that some region proposals are redundant. We should perform feature alignments for the instance-level features in the region proposals where the object is most likely to exist, instead of aligning all features. As we all know, the locations of region proposals where contain the same object at multiple scales should be similar if they are predicted by a reliable RPN. A natural idea is to cluster the similar region proposal coordinates to reduce redundancy for ROIs and eliminate the background noises by excluding outliers. In particular, we use RPN to get the predicted bounding box $\{b_{i,x},b_{i,y},w_i,h_i\}_{i=1}^N$ of the region proposals, where $(b_{i,x},b_{i,y})$ is the center coordinate of the $i$th predicted bounding box, $w_i$ is its width, and $h_i$ is its height. Then we plan to exploit the scale-space filtering~(SSF)~\cite{895974} algorithm to cluster the center coordinates to adaptively obtain $K$ cluster centers, which means that ROIs can be divided into $K$ categories, and thereby, the instance-level features can be indirectly divided into $K$ categories. As a result, we only need to align the instance-level features in each category. \\ \noindent {\bf Adaptive candidate region searching.} SSF is a clustering method that adaptive to the category numbers without a manual setting. It is very suitable for the grouping module due to the unknown object numbers in the target domain. Therefore, inspired by~\cite{895974}, we decided to use SSF to improve the traditional K-means algorithm to accomplish the clustering of bounding boxes. By regarding each sample as a ``light point'', the SSF algorithm formulates the clustering issue as finding the ``lighting blob center'' under different blur scales, \ie, different scale-space maps. The specific workflow can be divided into the following steps:\\ \indent (1) \textit{Clustering center iteration.} For a given dataset $\mathcal{X}=\left\{x_{i} \in \mathbb{R}^{2}: i=1, \ldots, N\right\}$ (in this paper, this is a set of center coordinates of predicted bounding boxes by RPN), we define $P(x, \sigma_j)$ as the scale-space map for $\mathcal{X}$ under the blur scale $\sigma_j$. It can be calculated by $P(x, \sigma_j)=p(x) * \phi(x, \sigma_j)$, where $p(x)$ means the scatter image of data samples in $\mathcal{X}$, $\phi(\cdot, \sigma_j)$ is the Gaussian blur kernel with the blur scale $\sigma_j$, and $*$ represents the convolution operator. So the set of clustering centers $\mathcal{C}(\sigma_j)$ under different scales $\sigma_{j}$ is obtained by $\nabla_{x} P(x, \sigma_j)=0$. In iteration steps, $\sigma_j$ is firstly updated, then after $\mathcal{C}(\sigma_j)$ has converged, a larger $\sigma_{j+1}$ is obtained by $\sigma_{j+1}\!=\!k\sigma_{j}$ ($k$ is a hyperparameter and $k\!>\!1$), and $\mathcal{C}(\sigma_{j+1})$ are iterated again until all samples belong to one category. More details can be seen in the supplemental material. (2) \textit{Adaptive category number selection.} With the completion of the above iterations, we have obtained a serious of clustering center, \ie, $\{\mathcal{C}(\sigma_1), \cdots,\mathcal{C}(\sigma_j),\cdots,\mathcal{C}(\sigma_J)\}$. We hope to select the clustering model that best fit for the data distribution. So the ``lifetime''~\cite{895974} is used as a measure of the stability for category number, which is calculated by \begin{equation}\label{eqs:pi} \pi(\sigma_j)=c \log (\sigma_j / \varepsilon), \end{equation} where $\varepsilon=0.01, c=1 / \log (1.05)$. Notably, the interval $ \mathbf{\Sigma}=\left\lbrace \sigma_{J_{inf}}, \sigma_{J_{inf}+1},\dots,\sigma_{J_{sup}} \right\rbrace $ with the longest ``lifetime'' represent the relative appropriate scales. Finally, the most appropriate clustering model $\{\mathcal{C}(\sigma^*),\sigma^*\}$ equals to median of $\mathbf{\Sigma}$, and the adaptive category number $K$ equals to the element number of $\mathcal{C}(\sigma^*)$. (3) \textit{Remove outliers.} After obtaining the optimal $\{\mathcal{C}(\sigma^*),\sigma^*\}$, we can use the model to group the centers $\{(b_{i,x},b_{i,y})\}_{i=1}^N$ of the predicted bounding box of all region proposals. For each bounding box center $b_i=(b_{i,x},b_{i,y})$, if $\lVert b_i-c_k^* \rVert _2>\sigma^*$, we consider $b_i$ to be an outlier, and its corresponding region proposal probably contains the background noise, which should be excluded from grouping. Through this method, we can restrict certain outlier region proposals from participating in instance-level alignment, and find the instance features that need to be aligned in the image more robustly.\\ \noindent {\bf Context-Aware Region-Instance-Level Alignment.} After clustering the proposals, we need to refine the instance-level features of each category for instance alignment. For simplicity, we reshape the features of instances belonging to the same category into the same size and then concatenate them into a feature map as the input of the domain classifier. But the effect of redundant or noisy region proposals is not fundamentally solved. Therefore, we use the global pooling layer to refine the instance-level features in the same category. Let $\Theta_k\in \mathbb{R}^{m_k\times d}$ denote the instance-level features of the $k$th category obtained by SSF, where $m_k$ is the number of the $k$th category , $d$ is the dimension of the instance-level features. Through the global pooling layer, we can get the feature of the $k$th category $\hat{\Theta}_k\in \mathbb{R}^{1\times d}$, which can fully reflect the instance-level features of the $k$ category and thereby reduce the influence of redundancy and noise. Then, we use the context fusion instance-level features~\cite{saito2019strong} as the input of bounding box regression and classification prediction in the instance alignment and object detection module. We acquire three different levels of context vectors $f_l, f_m, f_g$ from the domain classifier $D_l, D_m, D_g$, and get the instance-level features $f_r$ of each region proposals based on ROI-Pooling~\cite{he2017mask}. Through feature concatenation, the fused context instance-level features $f_{ins}=[f_l,f_m,f_g,f_r]$ is input into the global pooling layer and obtain refined feature of each category $f_{ins_e}$, as shown in Figure~\ref{fig:net}. Subsequently, we input the global pooling instance-level features into the domain classifier $G_{ri}$, and output the domain labels to achieve regional instance alignment. For the loss function of this module, we use Focal Loss~\cite{lin2017focal,saito2019strong} as follows: \begin{equation*} \mathcal{L}_\mathit{ri_s}\!=\!-\frac{1}{n_s} \sum_{i=1}^{n_s} \frac{1}{K_i^s}\sum_{k=1}^{K_i^s}(1\!-\!\mathit{D}_\mathit{ri}(\mathit{f}_\mathit{ins_e,i,k}^{s}))^\gamma\log(\mathit{D}_\mathit{ri}(\mathit{f}_\mathit{ins_e,i,k}^{s})), \end{equation*} \begin{equation*} \mathcal{L}_\mathit{ri_t}\!=\!-\frac{1}{n_t} \sum_{i=1}^{n_t} \frac{1}{K_i^t}\sum_{k=1}^{K_i^t}(\mathit{D}_\mathit{ri}(\mathit{f}_\mathit{ins_e,i,k}^{t}))^\gamma\log(1\!-\!\mathit{D}_\mathit{ri}(\mathit{f}_\mathit{ins_e,i,k}^{t})), \end{equation*} \begin{equation} \mathcal{L}_{ri}=\frac{1}{2}(\mathcal{L}_{ri_s}+\mathcal{L}_{ri_t}), \label{kmeansloss} \end{equation} where $K_i^s$ is the number of adaptive categories for $i$th source sample, $f_\mathit{ins_e,k}^{s}$ is the instance-level features of the $k$th region of the source domain after global pooling, and $\gamma$ is the parameter of Focal Loss. In short, this module can solve the redundancy of the region proposals and the influence of the background noise, so that the instance alignment is focused on the features where the object is existing. \subsection{Traing Loss} The loss of object detection includes the classification loss $\mathcal{L}_{c}$ on the source domain and the regression loss $\mathcal{L}_{r}$ of the bounding boxes~\cite{ren2015faster}. For the LGFA module, we use the Local Feature Masks and IWAT-I frameworks mentioned in~\cite{Chen2020Harmonizing}, and the corresponding adversarial loss is $\mathcal{L}_{lg}\!=\!\mathcal{L}_{adv_1}\!+\!\mathcal{L}_{adv_2}\!+\!\mathcal{L}_{adv_3}$ in Figure~\ref{fig:net}. By combining all modules mentioned above, the overall objective function of the model is \begin{equation}\label{loss} \max_{D} \min_{F, E, S} \mathcal{L}_{c} + \mathcal{L}_{r} + \beta(\mathcal{L}_{rec} + \mathcal{L}_{diff}) - \lambda(\mathcal{L}_{lg} + \mathcal{L}_{ri}), \end{equation} where $D,F,E,S$ denote the domain classifier, object detection framework, private encoder and shared decoder, respectively. $\lambda$ and $\beta$ are turning parameters. The sign of gradients for the last item is flipped by a gradient reversal layer proposed by~\cite{ganin2015unsupervised}. \section{Experiments} In this section, we show the effectiveness of FSANet in adaptive object detection experiments on three benchmark domain shifts datasets including real $\to$ artistic, normal $\to$ foggy and synthetic $\to$ real, \ie, PASCAL~\cite{everingham2010pascal} to Clipart1k~\cite{Inoue2018Cross}, Cityscapes~\cite{cordts2016cityscapes} to Foggy-Cityscapes~\cite{sakaridis2018semantic} and Sim10k~\cite{johnson2016driving} to Cityscapes. \begin{table*}[t] \setlength{\tabcolsep}{1.5pt} \begin{center} \resizebox{\textwidth}{!}{ \begin{tabular}{lccccccccccccccccccccc} \toprule Methods & aero & bike & bird & boat & bot & bus & car & cat & chair & cow & table & dog & horse & mbike & persn & plant & sheep & sofa & train & tv & mAP \\ \midrule Source Only & 35.6 & 52.5 & 24.3 & 23.0 & 20.0 & 43.9 & 32.8 & 10.7 & 30.6 & 11.7 & 13.8 & 6.0 & 36.8 & 45.9 & 48.7 & 41.9 & 16.5 & 7.3 & 22.9 & 32.0 & 27.8 \\ SWDA \cite{saito2019strong} & 26.2 & 48.5 & 32.6 & 33.7 & 38.5 & 54.3 & 37.1 & 18.6 & 34.8 & 58.3 & 17.0 & 12.5 & 33.8 & 65.5 & 61.6 & \textbf{52.0} & 9.3 & 24.9 & 54.1 & 49.1 & 38.1 \\ HTCN \cite{Chen2020Harmonizing} & 33.6 & 58.9 & 34.0 & 23.4 & 45.6 & 57.0 & 39.8 & 12.0 & 39.7 & 51.3 & 21.1 & 20.1 & 39.1 & 72.8 & 63.0 & 43.1 & 19.3 & 30.1 & 50.2 & 51.8 & 40.3 \\ DDMRL \cite{kim2019diversify} & 25.8 & 63.2 & 24.5 & \textbf{42.4} & \textbf{47.9} & 43.1 & 37.5 & 9.1 & \textbf{47.0} & 46.7 & 26.8 & 24.9 & \textbf{48.1} & 78.7 & 63.0 & 45.0 & 21.3 & \textbf{36.1} & 52.3 & \textbf{53.4} & 41.8 \\ ATF \cite{he2020domain} & \textbf{41.9} & 67.0 & 27.4 & 36.4 & 41.0 & 48.5 & 42.0 & 13.1 & 39.2 & \textbf{75.1} & \textbf{33.4} & 7.9 & 41.2 & 56.2 & 61.4 & 50.6 & \textbf{42.0} & 25.0 & 53.1 & 39.1 & 42.1 \\ \midrule FSANet & 31.0 & 63.7 & \textbf{34.8} & 29.4 & 43.0 & \textbf{70.7} & 40.8 & 18.7 & 39.6 & 57.4 & 22.2 & \textbf{27.0} & 33.3 & \textbf{85.6} & 63.3 & 45.7 & 21.9 & 24.7 & \textbf{56.7} & 44.5 & \textbf{42.7} \\ \bottomrule \end{tabular} } \end{center} \caption{Results on adpatation from PASCAL VOC to Clipart Dataset (real $\to$ artistic). Source only stands for Faster R-CNN that is trained only using source domain without adaptation. Average precision ($\%$) is evaluated on target images. The backbone network is ResNet-101.} \label{Clipart} \end{table*} \subsection{Datasets} \noindent {\bf PASCAL $\to$ Clipart1k.} We conduct domain adaptive experiments from real images to artistic images to show that FSANet is effective in dissimilar domains, where PASCAL VOC dataset~\cite{everingham2010pascal} and Clipart1k~\cite{Inoue2018Cross} are set as the real source domain and the target artistic domain, respectively. The PASCAL dataset contains 20 categories of images and their bounding boxes. In this experiment, the training and validation splits of PASCAL VOC 2007 and 2012 are used for training, resulting in about 15K images. Clipart1k has a total of 1K images, which contains the same class as PASCAL. All images in it are employed for training (w/o labels) and testing. \\ {\bf Cityscape $\to$ Foggy-Cityscapes.} For experiments in similar domains, we use Cityscapes and Foggy-Cityscapes as the source and target domain dataset, respectively. The Cityscapes~\cite{cordts2016cityscapes} dataset contains street scenes in different cities under normal weather conditions captured by a vehicle-mounted camera. There are 2975 images in the training set and 500 images in the test set. The label data are acquired by~\cite{DAfaster}. In this experiment, we employed the training set of Cityscapes for training. Foggy-Cityscapes~\cite{sakaridis2018semantic} is obtained by adding fog noise to the Cityscapes dataset, and its label is the same as Cityscapes. We set the training set of Foggy-Cityscapes for training and the test set for calculating average accuracy. \\ {\bf Sim10k $\to$ Cityscapes.} In the experiments from synthetic images to real images, we conduct the experiment for Sim10k $\to$ Cityscapes. Sim10k~\cite{johnson2016driving} is acquired in a game scene of a computer game Grand Theft Auto V. It has 10k computer-synthesized driving scene images. According to the protocol of~\cite{DAfaster}, we only evaluated detection accuracy on cars. All images of Sim10k are set for training. \subsection{Implementation Details} In all experiments, the object detection model follows the settings of~\cite{saito2019strong,Xinge2019Adapting,Chen2020Harmonizing}, using Faster R-CNN~\cite{ren2015faster} with ROI-alignment~\cite{he2017mask}, where the shorter side of the images equal to 600 and the hyper-parameters in the object detection are set based on the setting of~\cite{ren2015faster}. For different dataset, the backbone network utilize VGG-16~\cite{simonyan2014very} or ResNet-101~\cite{he2016deep} with the parameter initialization weights following the pre-trained on ImageNet~\cite{deng2009imagenet}. A stochastic gradient descent training model with a momentum of 0.9 is used, and the learning rate for the first 50K iterations is set to 0.001 and then decays to 0.0001. In each iteration, we input a pair of source and target domain images. After 70K iterations, we calculate the mean average precision (mAP) where the IoU threshold is 0.5. We set $\gamma\!=\!5$ in Eq.~(\ref{kmeansloss}) and $\beta\!=\!0.1$ in Eq.~(\ref{loss}) in all experiments. $\lambda$ is set to 1 for PASCAL $\to$ Clipart1k and Cityscapes $\to$ Foggy-Cityscapes while set to 0.1 for Sim10k $\to$ Cityscapes. Our experiments are implemented by the Pytorch~\cite{paszke2017automatic}. \subsection{Performance Comparison} We compare our FASNet with various SOTA DAOD methods, including Domain adaptive Faster-RCNN ({DA-Faster}) \cite{DAfaster}, Selective Cross-Domain Alignment ({SCDA} )~\cite{Xinge2019Adapting}, Strong-Weak Distribution Alignment ({SWDA})~\cite{saito2019strong}, Domain Diversification and Multi-domain-invariant Representation Learning ({DDMRL})~\cite{kim2019diversify}, Hierarchical Transferability Calibration Network ({HTCN})~\cite{Chen2020Harmonizing}, Prior-based Domain Adaptive Object Detection ({PBDA}~\cite{sindagi2019prior}) and Asymmetric Tri-way Faster-RCNN ({ATF})~\cite{he2020domain}. We cite the quantitative results in their original papers for comparison. \noindent {\bf Results on real $\to$ artistic. } The performance of FASNet in the target domain is significantly better than all comparison methods, as displayed in Table~\ref{Clipart}. Compared with SOTAs, mAP is improved by $+0.6\%$ (from $42.1\%$ to $42.7\%$), which fully illustrates that the proposed method can improve the transferability for real $\to$ artistic. \noindent {\bf Results on normal $\to$ foggy.} According to Table~\ref{cstocs_fg}, FASNet achieves the best performance and approaches the upper bound of the transfer task on Cityscape $\to$ Foggy-Cityscapes. \noindent {\bf Results on synthetic $\to$ real.} As shown in Table~\ref{sim2cs}, Our FSANet exceeds all comparison methods in the adaptive task on Sim10k $\to$ Cityscape, which further demonstrates that our method has better transferability and adaptivity. \begin{table}[t] \small \setlength{\tabcolsep}{1pt} \begin{center} \begin{tabular}{lccccccccc} \toprule Method & persn & rider & car & truck & bus & train & mbike & bcycle & mAP \\ \midrule Source Only & 24.1 & 33.1 & 34.3 & 4.1 & 22.3 & 3.0 & 15.3 & 26.5 & 20.3 \\ DA-Faster \cite{DAfaster} & 25.0 & 31.0 & 40.5 & 22.1 & 35.3 & 20.2 & 20.0 & 27.1 & 27.6 \\ SCDA \cite{Xinge2019Adapting} & 33.5 & 38.0 & 48.5 & 26.5 & 39.0 & 23.3 & 28.0 & 33.6 & 33.8 \\ SWDA \cite{saito2019strong} & 29.9 & 42.3 & 43.5 & 24.5 & 36.2 & 32.6 & 30.0 & 35.3 & 34.3 \\ DDMRL \cite{kim2019diversify} & 30.8 & 40.5 & 44.3 & 27.2 & 38.4 & 34.5 & 28.4 & 32.2 & 34.6 \\ ATF \cite{he2020domain} & 34.6 & 47.0 & 50.0 & 23.7 & 43.3 & 38.7 & 33.4 & \textbf{38.8} & 38.7 \\ PBDA \cite{sindagi2019prior} & \textbf{36.4} & 47.3 & \textbf{51.7} & 22.8 & 47.6 & 34.1 & \textbf{36.0} & 38.7 & 39.3 \\ HTCN \cite{Chen2020Harmonizing} & 33.2 & 47.5 & 47.9 & 31.6 & 47.4 & \textbf{40.9} & 32.3 & 37.1 & 39.8 \\ \midrule FSANet & 33.5 & \textbf{47.6} & 45.8 & \textbf{32.0} & \textbf{50.1} & 37.7 & 35.7 & 37.7 & \textbf{40.0} \\ \midrule Oracle & 33.2 & 45.9 & 49.7 & 35.6 & 50.0 & 37.4 & 34.7 & 36.2 & 40.3 \\ \bottomrule \end{tabular} \end{center} \caption{Results on adpatation from Cityscapes to Foggy-Cityscapes (normal $\to$ foggy). The backbone network is VGG-16.} \label{cstocs_fg} \end{table} \begin{table}[t] \begin{center} \begin{tabular}{lclc} \toprule Method & AP on car & Method & AP on car \\ \midrule Source Only & 34.6 & DA-Faster \cite{DAfaster} & 38.9 \\ SWDA \cite{saito2019strong} & 40.1 & HTCN \cite{Chen2020Harmonizing} & 42.5 \\ ATF \cite{he2020domain} & 42.8 & SCDA \cite{Xinge2019Adapting} & 43.0 \\ \midrule FSANet & \textbf{43.2} & & \\ \bottomrule \end{tabular} \end{center} \caption{Results on adpatation from Sim10k to Cityscapes (synthetic $\to$ real). The backbone network is VGG-16.} \label{sim2cs} \end{table} \begin{figure*}[t] \begin{center} \subfigure{\includegraphics[width=0.3\linewidth]{source_zurich_000033_000019_leftImg8bit.jpg}} \subfigure{\includegraphics[width=0.3\linewidth]{target_zurich_000033_000019_leftImg8bit_foggy_beta_s_o.jpg}} \subfigure{\includegraphics[width=0.3\linewidth]{target_zurich_000033_000019_leftImg8bit_foggy_beta.jpg}}\vspace{-2.5mm}\\ \setcounter{subfigure}{0} \subfigure[Original Image]{\includegraphics[width=0.3\linewidth]{source_zurich_000032_000019_leftImg8bit.jpg}} \subfigure[Source Only]{\includegraphics[width=0.3\linewidth]{target_zurich_000032_000019_leftImg8bit_foggy_beta_s_o.jpg}} \subfigure[FSANet]{\includegraphics[width=0.3\linewidth]{target_zurich_000032_000019_leftImg8bit_foggy_beta.jpg}}\vspace{-2.5mm}\\ \subfigure[Clipart1k]{\includegraphics[width=0.3\linewidth]{clipart.png}} \subfigure[Cityscapes]{\includegraphics[width=0.6\linewidth]{sim.png}} \end{center} \caption{Examples of detection results on the target domain. From first to second rows (a): there is not foggy noise in the original images, (b-c): Cityscapes $\to$ Foggy-Cityscapes. (d): PASCAL $\to$ Clipart1k. (e): Sim10k $\to$ Cityscapes.} \label{fig:demo} \end{figure*} \begin{table*}[t] \setlength{\tabcolsep}{1pt} \begin{center} \resizebox{\textwidth}{!}{ \begin{tabular}{lccccccccccccccccccccc} \toprule Method & aero & bike & bird & boat & bot & bus & car & cat & chair & cow & table & dog & horse & mbike & persn & plant & sheep & sofa & train & tv & mAP \\ \midrule Source Only & 35.6 & 52.5 & 24.3 & 23.0 & 20.0 & 43.9 & 32.8 & 10.7 & 30.6 & 11.7 & 13.8 & 6.0 & 36.8 & 45.9 & 48.7 & 41.9 & 16.5 & 7.3 & 22.9 & 32.0 & 27.8 \\ Only LGFA & 25.1 & 45.5 & 26.1 & 26.3 & 37.8 & 48.7 & 39.5 & 13.8 & 34.3 & 43.1 & \textbf{22.4} & 11.2 & 36.5 & 62.4 & 57.1 & 50.4 & 16.0 & 26.4 & 48.9 & 42.3 & 35.7 \\ FSANet w/o CSFS & \textbf{33.6} & 60.9 & 33.5 & \textbf{30.9} & \textbf{43.7} & 56.3 & 39.0 & \textbf{20.7} & 35.5 & 58.2 & 13.7 & 22.4 & 35.6 & 81.2 & 60.8 & 48.0 & \textbf{28.2} & 20.2 & 51.8 & 41.9 & 40.8 \\ FSANet w/o RILA & 32.5 & 62.2 & 32.4 & 30.5 & 42.3 & 53.6 & \textbf{42.8} & 17.0 & 38.3 & \textbf{62.4} & 20.2 & 19.9 & \textbf{36.9} & 79.7 & 62.3 & 48.9 & 19.0 & 24.4 & 53.2 & 41.7 & 41.0 \\ FSANet w/o LGFA & 29.8 & 40.2 & 28.6 & 22.7 & 32.0 & 51.2 & 35.6 & 12.9 & 34.7 & 17.2 & 19.8 & 12.1 & 33.5 & 43.0 & 42.5 & 45.1 & 10.3 & \textbf{27.9} & 42.9 & 40.9 & 31.1 \\ FSANet w/o diff loss & 32.8 & 60.4 & 32.1 & 30.5 & 38.7 & 70.6 & 40.0 & 19.9 & 37.2 & 56.4 & 22.1 & 22.0 & 34.9 & 71.9 & \textbf{63.9} & 46.6 & 23.8 & 27.2 & 52.5 & 45.0 & 41.4 \\ FSANet (RGB S) & 26.8 & 53.4 & 33.0 & 30.6 & 37.1 & \textbf{72.3} & 40.2 & 19.6 & \textbf{40.0} & 59.3 & 21.6 & 13.9 & 32.8 & \textbf{85.7} & 61.0 & \textbf{50.6} & 19.7 & 26.1 & 53.3 & \textbf{45.6} & 41.1 \\ \midrule FSANet & 31.0 &\textbf{63.7} & \textbf{34.8} & 29.4 & 43.0 & 70.7 & 40.8 & 18.7 & 39.6 & 57.4 & 22.2 & \textbf{27.0} & 33.3 & 85.6 & 63.3 & 45.7 & 21.9 & 24.7 & \textbf{56.7} & 44.5 & \textbf{42.7} \\ \bottomrule \end{tabular} } \end{center} \caption{Ablation experiments of FSANet on PASCAL $\to$ Clipart1k. More results on different datasets are shown in supplemental material.} \label{Ablation} \end{table*} \begin{table}[t] \begin{center} \begin{tabular}{lclc} \toprule Method & mAP & Method & mAP \\ \midrule Source Only & 27.8 & K-Means ($K=2$) & 35.6 \\ K-Means ($K=4$) & 41.6 & K-Means ($K=8$) & 39.8 \\ \midrule SSF & \textbf{42.7} & & \\ \bottomrule \end{tabular} \end{center} \caption{Results of domain adaptation for object detection from PASCAL VOC to Clipart Dataset with K-Means or SSF. The $K$ is the numbers of clustering of K-Means.} \label{kmeans} \end{table} \begin{figure}[!] \begin{center} \includegraphics[width=0.6\linewidth]{Figure_4} \end{center} \caption{The mAP with the variation of IoU thresholds on transfer task PASCAL$\to$Clipart1k. $\mathrm{HTCN}^*$ stands for HTCN trained without interpolation (w/o pixel-level alignment via CycleGAN~\cite{Chen2020Harmonizing}).} \label{fig:instance} \end{figure} \begin{figure*}[!] \begin{center} \includegraphics[width=0.8\linewidth]{kmeans} \end{center} \caption{Samples in PASCAL VOC $\to$ Clipart. (a): The change curve of the ``Lifetime'' with the number of iterations. It can be seen that the ``Lifetime'' is the longest when $K=3$, so the number of adaptive categories is 3. (b): Predicting results of cluster centers and scales by SSF. The yellow circled area indicates the cluster center that is used for clustering, and the points outside the circle will be deleted as outliers. Obviously, the category center basically coincides with the regions where the objects are located. (c-e): The clustering results of K-Means method in different $K$. From left to right: $K$=2, 4 and 8, respectively. Compared with the clustering result of SSF, the clustering centers of K-Means are away from the object regions.} \label{fig:kmeans} \end{figure*} \begin{figure}[!] \begin{center} \includegraphics[width=0.65\linewidth]{tsne.png} \end{center} \caption{Visualization of features obtained by transfer task Cityscapes $\to$ Foggy-Cityscapes. Blue/Red dots: source/target samples. (a-b): The distractive and shared features by FSANet, (c): The shared features by FSANet (w/o GSFS).} \label{fig:tsne} \end{figure} \subsection{Further Empirical Analysis} In this section, some ablation experiments are established to show the rationality for different components in FSANet. Furthermore, we contrast the effectiveness between RILA and traditional instance-level alignment module and explain the advantage of SSF in RILA compared with other different clustering methods. \noindent {\bf Example of Detection Results. } Examples of various adaptive object detection tasks on the target domain are exhibited in Figure~\ref{fig:demo}. We find that FSANet has good transferability and adaptivity on different datasets. For instance, from normal to foggy, FSANet can detect the indiscoverable objects in the foggy noise. As for the detection of artistic images, we can also get wonderful object and accurate bounding box predictions. \noindent {\bf Ablation Study.} We design various ablation experiments to prove the contributions of different modules in FSANet. They are shown as follows: {Only LGFA} denotes that we remove the RILA module and the Feature Separation module. {FSANet w/o GSFS} removes the GSFS module. {FSANet w/o RILA} eliminates the RILA module. {FSANet w/o LGFA} removes the LGFA module. {FSANet w/o diff loss} denotes that we do not use different loss in the GSFS module. {FSANet (RGB S)} denotes that we train the feature separation module by RGB images instead of gray-scale images. \indent The results are reported in Table~\ref{Ablation} on PASCAL $\to$ Clipart1k. Compared with Only LGFA, adding RILA module or feature separation module can improve the performance of the model. FSANet w/o GSFS increases from $35.7\%$ to $40.8\%$ and the FSANet w/o RILA increases by $+5.3\%$. As shown in Figure~\ref{fig:tsne}, the GSFS module effectively promotes the features alignment. In addition, the separated distractive information is highly differentiated, demonstrating the rationality of feature separation. While, mAP is only $31.1\%$ in the FSANet w/o LGFA, indicating that high-dimensional feature alignment is essential to avoid excessive separation of high-dimensional features. Then, network performance will decline if different loss is not utilized, indicating that different loss is necessary to limit feature separation component. Moreover, experiment FSANet (RGB S) shows that RGB images will reduce the performance of feature separation module. In short, these experimental results fully demonstrate that the proposed module is more conducive to improving the transferability of the model.\\ \noindent {\bf Region-Instance-level $\boldsymbol{v}$.$\boldsymbol{s}$. Instance-level. } The mAP of different methods with the variation of IoU thresholds is displayed in Figure~\ref{fig:instance}. Noticeably, the mAP reduces as the IoU threshold decreases and that of RILA is significantly improved compared with instance-level alignment on the IoU range of 0.50-0.95, which indicates that RILA can promote the adaptability and make bounding box regression more robustly.\\ {\bf Comparisons with K-Means.} We compare K-Means with our SSF algorithm to test whether the adaptively selecting region is efficient. In Table~\ref{kmeans}, it is obvious that mAP has huge fluctuations when $K$ is changed. In addition, in Figure~\ref{fig:kmeans}, the fixed category number reduces the flexibility for region selection, which shows the superiority for adaptive determination of region categories. \section{Conclusion} In this paper, we propose a feature separation and alignment network (FSANet) for domain adaptive object detection. The FSANet can effectively decompose distractive information which is useless for detection by a feature separation module, and can restrain background noise and redundancy information by a region-instance-level alignment module, which can adaptively extract the regions to be aligned. Compared with existing methods, our novel FSANet can separate the distractive features and make our model focus on the features useful for detection. At the same time, region proposal redundancy and the background noise in feature alignment can be avoided. Extensive experiments demonstrate that our method surpasses other existing models for adaptive object detection and the modules we proposed greatly improve the transferability and adaptability on several benchmark datasets. {\small \bibliographystyle{ieee_fullname}
{'timestamp': '2020-12-17T02:06:56', 'yymm': '2012', 'arxiv_id': '2012.08689', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08689'}
arxiv
\section{Experiments} \label{sec:evaluation} In this section we evaluate the proposed algorithm. First, we present the datasets and evaluation metrics used (Section~\ref{sec:experim:datasets}). Second, we provide both quantitative and qualitative results on several datasets % and compare against state-of-the-art baselines (Section~\ref{sec:experim:quantitative}). Third, we justify the choice of parameters (Section~\ref{sec:experim:ablation}). Finally, we analyze the computational efficiency of our implementation (Section~\ref{sec:experim:computational}) and discuss its limitations (Section~\ref{sec:experim:limitations}). \subsection{Datasets and Evaluation Metrics} \label{sec:experim:datasets} We evaluate Algorithm~\ref{alg: alternating strategy} extensively on datasets accompanying recent publications~\cite{Mitrokhin18iros,Stoffregen19iccv,Mitrokhin19iros,almatrafi2020distance}. We use the same acronym to indicate the method and dataset from a publication, e.g., EMSMC denotes the ``Event-based Motion Segmentation by Motion Compensation'' method and its associated dataset, both presented in~\cite{Stoffregen19iccv}. The distinction is clear from the context. \begin{itemize}[noitemsep,nolistsep] \item The Extreme Event Dataset (EED) \cite{Mitrokhin18iros} is one of the first open-source datasets used for the research of IMO detection and tracking. Besides the camera's ego motion, there are other % IMOs (up to three) in each sequence. It provides manually-annotated bounding boxes for quantitative evaluation. All sequences are collected in a laboratory environment, aiming to demonstrate the outstanding performance of event cameras in HDR scenarios. \item EVIMO \cite{Mitrokhin19iros} is also collected in a lab environment but with better illumination. Up to three IMOs % appear in the sequences. For evaluation, it provides dense segmentation masks of the IMOs. Recently, an extension of the dataset, EVIMO2, has been made available online. \item EMSMC \cite{Stoffregen19iccv} provides a set of real-world sequences captured in both indoor and outdoor environments. Different from the above two datasets, it consists of a larger number of IMOs and even with non-rigid motions. HDR scenarios are also captured in this dataset. \item DistSurf \cite{almatrafi2020distance} is a dataset collected specifically for evaluating event-based optical flow estimation. We find the data is in good quality and can be used for qualitative evaluation of our algorithm. \end{itemize} Table~\ref{talble: dataset summary} summarizes the key characteristics of the datasets. \input{floats/dataset_summary_table} \vspace{0.5ex} \textbf{Evaluation Metrics}. For quantitative evaluation we use two standard metrics. The first one is \textit{detection rate} based on the overlap between the bounding boxes of detected and labeled objects, which was introduced in~\cite{Mitrokhin18iros} and used ever since. It considers the detection result as successful if it meets the following conditions: \begin{equation} \label{eq:detectionrate} \mathcal{B}_D \cap \mathcal{B}_G > 0.5\quad\text{ and }\quad(\mathcal{B}_D \cap \mathcal{B}_G) > (\mathcal{B}_D \cap \overline{\mathcal{B}_G}), \end{equation} where $\mathcal{B}_D$ refers to the estimated bounding box (or convex hull), $\mathcal{B}_G$ the ground truth bounding box, and $\overline{\cdot}$ denotes the complement of a set. The second metric is \emph{Intersection over Union} (IoU), which is the most commonly used metric to evaluate the performance of segmentation methods, and was proposed for event data in \cite{parameshwara2020moms, Mitrokhin19iros}. IoU is typically formulated as \begin{equation} \label{eq:IoUmetric} \text{IoU} = (\cS_D \cap \cS_G) / (\cS_D \cup \cS_G), \end{equation} where $\cS_D$ refers to the resulting segmentation mask and $\cS_G$ the ground truth mask. Note that the result of our algorithm consist of sparse warped events with specific labels. To obtain a dense segmentation mask from a cluster of warped events, we label all pixels in its convex hull identically. \subsection{Quantitative and Qualitative Evaluation} \label{sec:experim:quantitative} \textbf{EED Dataset}. We first evaluate our algorithm on the EED~\cite{Mitrokhin18iros} dataset using the detection rate metric. As reported in Table~\ref{tab: EED detection rate}, without having to specify in advance the number of clusters, our algorithm outperforms other state-of-the-art solutions~\cite{Mitrokhin18iros,Stoffregen19iccv,parameshwara2020moms} in terms of average detection rate (97.45\%). The numbers for the baseline methods are taken from the corresponding publications in the absence of publicly available source code. The numbers are close to those in~\cite{Stoffregen19iccv,parameshwara2020moms} partly because the detection rate~\eqref{eq:detectionrate} is a coarse evaluation metric. Qualitative results are given in Fig.~\ref{fig: qualitative result EED}, where the red rectangles are ground truth bounding boxes. \iflongversion % Since the ground truth bounding boxes are manually annotated on raw images (from the DAVIS sensor) which are temporally close to the evaluation time, thus, a tiny spatio offset is witnessed sometimes. \fi \input{floats/EED_table} \input{floats/EED_IWE_BoundingBox} \textbf{EVIMO Dataset}. A second quantitative evaluation is performed on the EVIMO dataset using the IoU metric~\eqref{eq:IoUmetric}. As shown in Table~\ref{tab: IoU evaluation}, our algorithm performs the second best (only 0.19\% lower than the best one) among all four segmentation methods, and about 2\% better than the next best method. The numbers for the baseline methods are taken from~\cite{parameshwara2020moms}. Note that Tables~\ref{tab: EED detection rate} and~\ref{tab: IoU evaluation} report results using two different metrics and datasets, so they are not directly related. During the experiments we found several issues that may deteriorate the IoU score. First, the ground truth masks are not perfectly aligned with objects in the raw images because of inaccurate CAD models and IMO poses produced by the motion capture system. Second, our labeled IWE and segmentation masks are computed using undistorted events (using camera calibration); then the masks are warped to the raw (distorted) image plane where the IoU score is calculated. Undistortion leads to information loss near image boundaries. % Third, some of the IMOs are hanged by the person who was holding the event camera, thus, the IMOs sometimes undergo the same motion as the camera. In such a case, IMOs are labeled as background motion and no IoU score is calculated. \input{floats/EVIMO_MOD_MASK} \input{floats/EVIMO_IoU_table} \input{floats/real_qualitative_comparison} \input{floats/fig_real_more} Exemplary results are given in Fig.~\ref{fig: qualtitative evaluation EVIMO}, where both labeled IWEs and their corresponding dense segmentation masks are visualized. In the \emph{boxes} sequence, the toy car traverses from right to left and can be continuously detected as a moving object. There are two IMOs in the \emph{table} sequence (toy car and plane). The two move against each other and meet in the middle. They are successfully detected even when they are partially overlapped. The toy plane stays almost still at the end of the sequence, which explains why it is labeled as background. The IWE around the area of the plane looks as sharp as the background, which also indicates that the plane stays still. The figure also includes qualitative comparisons against~\cite{parameshwara2020moms} in terms of the labeled IWEs. Despite the different coordinates used, our results look overall sharper and do not exhibit the rectangular segmentation boundaries present in~\cite{parameshwara2020moms} (caused by naively labeling events according to whether or not they are inside the convex hull of the cluster features). In the middle of the \emph{table} sequence, our method still detects the toy plane as an IMO (before it slows down and merges with the background), whereas \cite{parameshwara2020moms} does not. In addition, the authors of \cite{Mitrokhin19iros} just released a new dataset, EVIMO2, using event-based cameras of VGA resolution ($640\times 480$ pixels). The dataset can be used for evaluation of event-based object segmentation, motion segmentation, and structure from motion. The multi-camera system consists of a Samsung Gen3 DVS~\cite{Son17isscc}, two Prophesee CD Gen3 event cameras~\cite{propheseeevk} and a Flea3 RGB camera. We test our method on the events from the Samsung DVS and provide qualitative results in Fig.~\ref{fig:real:more}. We also compute the IoU score (64.38 \%), and the main reason for the less accurate segmentation than in EVIMO is the motion patterns: the objects in EVIMO2 undergo more frequent 3D rotations than in EVIMO. Consequently, the 2D appearance of the objects on the image plane continuously changes, causing self-occlusions that are difficult to model with current image-plane motion models. To obtain best results in this scenario, knowledge of the 3D shape and appearance of the IMO would be required, which is left as future work. In spite of this, the qualitative results in Fig.~\ref{fig:real:more} (columns 4 and~5) show good segmentation results. \input{floats/fig_ablation_study} \textbf{Other Datasets}. Besides above quantitative results, we also provide an extensive qualitative evaluation on real-world data from EMSMC~\cite{Stoffregen19iccv} dataset, DistSurf~\cite{almatrafi2020distance} dataset, and our own collection. These sequences cover a wide variety of scenes, ranging from indoor lab environments to outdoor traffic scenes with moving vehicles and pedestrians, including non-rigid motion and HDR scenarios. We provide exemplary results in Figs.~\ref{fig:emsmc:compare} and~\ref{fig:real:more}. The first sequence of Fig.~\ref{fig:emsmc:compare} shows a traffic scene captured from above, with three vehicles driving on the road. The two cars moving to the left have very similar velocities, thus, they are clustered in the same group. For visual comparison we provide the segmented, motion-compensated images from~\cite{Stoffregen19iccv}. The second sequence of Fig.~\ref{fig:emsmc:compare} shows an outdoor HDR scene captured with the event camera facing the sun while a pedestrian and a skateboarder pass by. Our algorithm preserves the motion discrepancy among different parts of the non-rigid human bodies while maintaining the compactness of the segmentation due to the applied MDL term. The third sequence shows a vehicle passing by in front of buildings. Our algorithm successfully distinguishes the car from the buildings in the background, which are compactly labeled together, thus identifying the panning camera motion. In Fig.~\ref{fig:real:more}, the first column shows a fan (whose blades rotate at $\approx$\SI{1800}{\degree/\second}) and a free-falling coin, \textit{i}.\textit{e}., a high-speed scenario. Since our algorithm supports multiple motion models, the fan blades and the coin are successfully detected and distinguished. The second column shows a traffic scene captured at street level. The motions of overlapping vehicles can be successfully distinguished. The third column shows a scene with a pair of waving hands. The motions of the hand and arm are sometimes segmented from each other when there is a small wrist motion. The fourth and fifth columns are exemplary results of EVIMO2 dataset, already discussed. The last column shows another sequence of our own data (different from the one in Fig.~\ref{fig:eyecatcher}), in which a nursing pillow is thrown. The pillow is detected as an IMO detached from the hand as soon as the apparent in-plane rotation happens. \subsection{Parameters of the Method} \label{sec:experim:ablation} Let us mention how the parameters of the method are set. First, we process events in packets (\textit{i}.\textit{e}., sliding window fashion). The number of events $N_e$ may be selected based on the scene dynamics or texture~\cite{Liu18bmvc}. However, we found that $N_e \in [15000, 30000]$ is a sensible choice for sequences captured by the DAVIS240 or DAVIS346~\cite{Brandli14ssc}. For sequences acquired by higher resolution sensors (e.g., $640 \times 480$ pixels), $N_e$ is increased proportionally. As shown in the experiments, motion parameters can be assumed to be constant within each sliding window. Second, we set the weights $\lambda_{\text{P}} = 40, \lambda_{\text{M}} = 8,000$. The Potts model weight $\lambda_{\text{P}}$ is set according to the fact that an event typically has at least six spatio-temporal neighbours (At least two edges are linking to the event's pixel location due to the Delaunay triangulation). The maximum discrepancy for an unary term is 255 according to the IWE negative. Thus, $\lambda_{\text{P}} = 255 / 6 \approx 40$ so that local consistency would be sacrificed for spatial coherence. For sequences with relatively small IMOs traversing a textured background, $\lambda_{\text{P}}$ has to be reduced to avoid over-smoothing effects. The MDL weight $\lambda_{\text{M}}$ is set according to an ablation study, as shown in Fig.~\ref{fig:ablation study}. Unsurprisingly, we see the resulting number of IMOs becomes smaller as $\lambda_{\text{M}}$ increases. We observe $\lambda_{\text{M}}$ having a wide range of endurance ($[8000, 16000]$), which makes a good balance between enhancing spatial coherence and circumventing over-smoothing effect. We find 8,000 a reasonable choice that returns the true number of IMOs in most cases. Finally, the number of hierarchy levels $N$, which determines the size of the sub-volumes used during initialization, is set empirically. A good choice (e.g., Fig.~\ref{fig: initialization procedure}) can effectively pick up small IMOs while circumventing cases of bad signal-to-noise ratio (Sec.~\ref{sec:experim:limitations}). We find that $N=4$ is a good choice for sensors with similar spatial resolution to the DAVIS346, and $N$ may be increased to deal with very small IMOs and/or new devices with higher spatial resolution. \subsection{Computational Performance} \label{sec:experim:computational} Algorithm~\ref{alg: alternating strategy} consists of three main steps: ($i$) initialization, ($ii$) creation of event graph, and ($iii$) alternating discrete-continuous optimization. The initialization is the most time-consuming step. Using 15,000 events as input and a 4-level subdivision as an example, it takes about \SI{4}{\second} to compute all motion candidates of the model pool. This time is spent on one motion model type; for multi-model proposals, \textit{e}.\textit{g}., $K$ types, the computation is $K$ times larger. We apply hyper-threading to speed up the process. Initialization may be expensive for the first set of events, but it can be propagated according to the motion and reutilized for the upcoming events. The creation of the space-time event graph is efficient, taking \SI{45}{\milli\second}. The optimization terminates within 3 iterations, and its time is proportional to the size of the motion pool; it takes about \SI{3}{\second}. The discrete-labeling (graph-cut) sub problem takes the majority of the runtime compared to the negligible time spent on continuous model fitting. The proposed method is implemented in C++ on ROS and runs on a laptop with an Intel Core i7-8750H CPU. The code uses two cores and consumes about 400 MB of memory. While there is room for improvement in runtime performance to speed up the method by an optimized implementation and/or dedicated hardware, event cameras are data-driven sensors that produce more events per second the faster the motion, the smaller the contrast sensitivity and the more texture present in the scene. Hence, it is conceivable to modify the above factors to increase the event rate in order to overwhelm any non-trivial event-based method so that it becomes non ``real-time''. This could be mitigated by decreasing the contrast sensitivity and/or by dropping events (randomly or with some control strategy~\cite{Glover18icra}). However, this is out of the scope of this work. In contrast, we think that the most alluring feature of our proposal is the modeling idea of using graph cuts on event-based data, which ($i$) brings well-known principles to the realm of event cameras and ($ii$) allows us to address shortcomings of previous methods, such as the need to either specify the number of clusters in advance or over-segment the scene. \subsection{Limitations} \label{sec:experim:limitations} A limitation observed during initialization entails the size of the IMOs. Small IMOs, \textit{e}.\textit{g}., smaller than $1\%$ of the sensor's spatial resolution (as in the $\emph{multiple objects}$ sequence of~\cite{Mitrokhin18iros}) cast signal-to-noise ratio problems during motion proposal generation and are thus unlikely to be properly initialized. The size of the IMOs in the other datasets is larger than in the EED dataset, hence detecting IMOs is not an issue in them. \emph{Noise}. In addition, the performance of our method is affected by the signal-to-noise ratio of the input events because the topological structure of the ST graph deteriorates with increasing event noise (jitter, bursts, etc.). To alleviate this issue, a pre-processing de-noising step~\cite{czech2016evaluating, wu2020probabilistic} is suggested. % We apply a simple de-noising operation, as proposed in~\cite{zhou2020event}, which filters isolated events in the spatio-temporal domain. To deal with the specific noise in the datasets that is due to ground truth acquisition by the motion capture system (disturbing light from a VICON system's emitters) additional de-noising methods, such as burst filters, are needed. \section{Event-based Motion Segmentation} \input{chapters/02_event_camera_intro} \subsection{The Clustering Nature of the Problem} \label{sec:problem:intro} Assuming constant illumination, events are due to the relative motion between the camera and the scene, and since events represent brightness changes~\eqref{eq:generativeEventCondition}, they are mostly produced by scene edges (contours, texture, etc.). If the camera is stationary, events are solely due to moving objects, whereas if the camera moves, events are due to both: edges of moving objects and moving edges induced by the camera's ego-motion. The problem of \emph{event-based motion segmentation} consists of identifying which events in a given event stream are triggered by the same scene object, and because events are caused by motion, the identification criterion primarily refers to grouping (i.e., \emph{classifying}) events by the type of motion. Hence it is key to realize that event-based motion segmentation is a \emph{clustering problem by nature}: splitting the event stream into different groups of events, with each one representing a coherent motion (classification criterion), as shown in the input-output of Fig.~\ref{fig:eyecatcher}. The problem is most challenging in the moving-camera scenario because events are triggered everywhere on the image plane, not just around the moving objects. As we review next (Section~\ref{sec: related work}), several solution methods have been proposed, and due to the above nature of the problem, they all inherently perform some sort of clustering. However, they differ in the clustering technique developed. \subsection{Related Work} \label{sec: related work} Early works on event-based motion segmentation required prior knowledge on either the shape of IMOs (\textit{e}.\textit{g}., a circle \cite{Glover16iros}) or the correlation between the tracked geometric primitives and the motion of the event camera~\cite{Vasco17icar}. Such prior knowledge is no longer required in recent works \cite{Mitrokhin18iros,Stoffregen17acra,Stoffregen19iccv,parameshwara2020moms,Mitrokhin19iros}. Several of these pipelines follow a sequential strategy, which consists of analyzing the dominant events (\textit{e}.\textit{g}., background), then removing these (by empirical thresholding \cite{Mitrokhin18iros,Stoffregen17acra}) and analyzing the remaining events (\textit{i}.\textit{e}., the IMOs), \emph{greedily}. Instead, using \cite{Stoffregen17acra} as initialization, \cite{Stoffregen19iccv} was the first to tackle the problem \emph{jointly}, analyzing all events while solving the two sub-problems of clustering: event-object association (classification) and object / cluster refinement (model-fitting). By leveraging the idea of motion compensation~\cite{Gallego18cvpr}, it formulated the segmentation problem using an expectation-maximization (EM) approach, which iteratively updated the soft event-cluster associations and the motion model parameters. It provided per-event segmentation rather than classical bounding-box results. Recently, \cite{parameshwara2020moms} proposed a similar joint optimization method, but with differences: ($i$) initialization of IMO models was based on $K$-means clustering of event-based feature tracks, and ($ii$) event-cluster assignments were based on morphological operations via empirical thresholding. In addition to the above methods, \cite{Mitrokhin19iros} proposed a supervised end-to-end learning-based pipeline that simultaneously solved for optical flow, 3D motion and object segmentation. Although \cite{Mitrokhin19iros} is not closely related to the above approaches (neither is to ours), it is mentioned because it provides a state-of-the-art dataset for segmentation evaluation (Section~\ref{sec:evaluation}). \paragraph*{Similarities and Differences with Prior Work} Like previous methods (\textit{e}.\textit{g}., \cite{Stoffregen19iccv}), our method also allows general parametric warps (motion models) and performs per-event segmentation. Besides, we are also able to produce sharp, motion-compensated images as a by-product (Fig.~\ref{fig:eyecatcher}, Right). However, we claim the following fundamental \emph{differences} compared to previous approaches. First, we formulate the problem using Markov Random Fields (MRF) and defining a spatio-temporal graph through the events. This leads us to efficiently solve the problem using \emph{graph cuts}, which is the first time that they are adapted to work on event data. Second, we pose the problem as a joint optimization over the motion parameters and event associations, but in contrast to \cite{Stoffregen19iccv} we introduce two spatial regularizers. In particular, we explicitly minimize the number of clusters and smooth their shape, which is pursued naturally via an energy formulation. This allows us to solve the issue of not knowing the number of moving objects in the scene~\cite{Stoffregen19iccv}. Third, digging into details of the event alignment data-fidelity terms, \cite{Stoffregen19iccv} is based on variance maximization, whereas graph cuts require a minimization formulation with non-negative terms. For this non-trivial adaptation we build on our work~\cite{zhou2020event} and propose negative Images of Warped Events (IWEs), which have not been investigated for clustering. Finally, we do not follow the greedy strategy nor do we need additional methods for initialization (\textit{e}.\textit{g}., feature tracking~\cite{parameshwara2020moms}). We provide a new initialization method, based on a hierarchical subdivision of the volume of events to provide a pool of motion instances. \section{Conclusion} \label{sec:conclusion} We presented a novel method for event-based motion segmentation. Our approach is a multi-model fitting scheme that jointly clusters events and fits motion models to them. The proposed graph-based (MRF) formulation with the additional MDL energy term leads to globally consistent and spatially coherent segmentation results using fewest labels. As a by-product, the method produces labeled, motion-compensated images of warped events that may be used for further processing (\textit{e}.\textit{g}., recognition). A thorough evaluation demonstrated the versatility of our method in scenes with different motion patterns and unknown number of independent motions. We also showed that the method is able to bring the advantages of event-based cameras to tackle traditionally difficult scenarios for standard frame-based cameras, such as segmentation of fast moving objects (that would cause motion blur) or in HDR conditions. Finally, we hope this work inspires new research in the topic of segmentation with event-based cameras, a paramount but rather unexplored topic. \section{Joint Optimization of Motions and Segments} \label{sec:optimization} We now discuss how to minimize the proposed energy function \eqref{eq: overall energy function}. This energy depends on both discrete labeling variables $L$ and continuous motion parameters $\mathcal{M}$, thus leading to a discrete-continuous optimization problem. Inspired by efficient solvers used in classical multi-model fitting methods~\cite{delong2012fast,yang2015dense}, we employ a block-coordinate descent strategy to optimize $L$ and $\mathcal{M}$ in an alternating manner. We present the solution to each sub problem, followed by the initialization strategy. The overall method is summarized in Algorithm.~\ref{alg: alternating strategy}. \input{floats/alg_float} \subsection{Segmentation:\! update labels $L$ given motions~$\mathcal{M}$} \label{subsec: discrete sub problem} The overall energy~\eqref{eq: overall energy function} reduces to the sub-problem of discrete labeling when motion models $\mathcal{M}$ are fixed: \begin{equation} E(L) = E_{\text{D}}(L) + \lambda_{\text{P}}E_{\text{P}}(L) + \lambda_{\text{M}}E_{\text{M}}(L). \label{eq: discrete sub problem} \end{equation} This energy describes a standard % MRF problem plus an additional MDL term. The graph-cut method is one of the most widely adopted techniques for solving MRF problems. The simplest case of graph cut, also known as s-t cut \cite{kolmogorov2004energy}, is typically used for solving a binary classification problem. A graph is defined connecting the unknowns of the problem, that is, the graph vertices, which must be assigned labels. Two additional vertices called source (s) and sink (t) are defined. The minimum s-t cut partitions the vertices of the graph into two disjoint groups (i.e., labels) at the smallest energy cost, which is equivalent to computing the maximum flow from source to sink \cite{ford2015flows}. The generalization of the minimum s-t-cut problem, such as~\eqref{eq: discrete sub problem}, involves more than two terminals (labels). For energy functions consisting of a smoothness term with discontinuity-preserving property (e.g., the applied Potts model), the expansion move algorithm \cite{boykov2001fast} can be used as long as the smoothness term is a metric on the space of labels. The $\alpha$-expansion algorithm loops through the labels $\alpha$ in some order and looks for the lowest energy. In every iteration, it solves a minimum s-t-cut problem which partitions the vertices into the current-labeling group and the $\alpha$-label group. An $\alpha$-expansion movement is made according to the s-t cut that leads to the lowest energy. To minimize \eqref{eq: discrete sub problem}, we apply the $\alpha$-expansion based graph-cut method~\cite{boykov2001fast} combined with the method in~\cite{delong2012fast} to handle the label costs induced by the MDL term. \iflongversion From an implementation point of view, we use bilinear interpolation to count events at non-integer warped positions $\mathbf{x}'_k$ of the IWE~\cite{Rebecq18ijcv}. Then, unary terms are floored before they are passed to graph cut, as it is standard. \fi To accelerate the algorithm, if a motion model is not assigned to any cluster of events, it is removed from the model pool. The remaining models (label ID) are sorted according to the number of events that belong to the corresponding clusters. \subsection{Model Fitting:\! update motions $\mathcal{M}$ given labels~$L$} \label{subsec: continuous sub problem} When the label variables are fixed, the energy~\eqref{eq: overall energy function} simplifies to the data term only. The continuous variables of each motion model can be re-fitted independently from other motion models using the corresponding cluster of events. The original motion compensation scheme \eqref{eq:argmaxMotionModel} % is applied for model fitting. \subsection{Initialization} \label{subsec: initialization} Let us show how to initialize the optimization procedure. Unlike existing solutions, which either greedily initialize motion models $\mathcal{M}$~\cite{Stoffregen17acra, Mitrokhin18iros,Stoffregen19iccv} or apply the K-means method on computed event-based optical flow~\cite{Benosman14tnnls} or feature tracks~\cite{parameshwara2020moms}, we propose a simple, direct and effective initialization based on the original motion compensation scheme. Given a space-time volume $\mathbf{V}$ of events $\cE$, we carry out an $N$-level subdivision operation. At level $n \in [0, N-1]$ of the hierarchy, the volume $\mathbf{V}$ is divided evenly into $4^{n}$ sub-volumes. Let us use $N = 4$ as an example, as shown in Fig.~\ref{fig: initialization procedure}, where the blue dashed rectangle illustrates a sub volume at level $n = 1$, while the green one shows a sub-volume at level $n = 3$. For simplicity, the volume $\mathbf{V}$ is visualized in 2D, namely by accumulating events on the reference time slice. After the division operations, we have % $4^{0} + 4^{1} + \cdots + 4^{3} = 85$ sub-volumes (including the whole volume at the base level of the hierarchy). By feeding the events in these sub-volumes to the motion compensation scheme, we get a pool of 85 motion model candidates~$\mathcal{M}$. This strategy aims at capturing % IMOs of different size. As illustrated in Fig.~\ref{fig: initialization procedure}, the blue dashed sub-volume captures one of the boxes in the background, which leads to an IWE with high contrast at the background structures, whereas the green dashed sub-volume senses part of a smaller IMO, which leads to an IWE with high contrast around that IMO. The resulting model pool is used to compute the data term (Section.~\ref{subsec: data term}). Computational complexity is proportional to the number of event warping operations. Thus we compare our method against the greedy alternative in terms of the number of warped events. Assume there are $N_e$ events involved totally and they are induced by the background motion (bg) as well as $m$ IMOs. Thus, we have $N_e = N_e^{\text{bg}} + \sum_{i=1}^{m} N_e^{\text{IMO}_i}$. The greedy solution assumes a dominance order of motion models, sorted by the number of events: $N_e^{\text{bg}} \gg N_e^{\text{IMO}_1} \gg ... \gg N_e^{\text{IMO}_m}$. Under the reasonable assumption of a predominant background motion, $N_e \approx 2\, N_e^{\text{bg}}$, and IMOs accounting for the other half of the events $N_e \approx 2^{i+1}\, N_e^{\text{IMO}_i}$, the computational complexity of the greedy method is $O((2 - 2^{-m})\,N_e)$, which is bounded by $O(2\, N_e)$. The computational complexity of our initialization method depends on the number of subdivision levels $N$, and it is $ O(N\, N_e)$. While this simplified complexity comparison favors the greedy approach, in practice we found out that our initialization works well by using only the finest level ($n=3$), which has the smallest complexity $O(N_e)$. \input{floats/initialization_procedure} \section{Designed Energy for Motion Segmentation} \label{sec:energy-formualtion} We propose an energy function that considers jointly the sub-problems of labeling (i.e., segmentation) and model fitting. The energy function is defined on both unknowns (labeling configuration $L$ and cluster motions $\mathcal{M}$) as \begin{equation} E(L, \mathcal{M}) \doteq E_{\text{D}}(L, \mathcal{M}) + \lambda_{\text{P}}E_{\text{P}}(L) + \lambda_{\text{M}}E_{\text{M}}(L), \label{eq: overall energy function} \end{equation} where $E_{\text{D}}$ denotes the data term and $E_{\text{P}}$, $E_{\text{M}}$ constitute the regularizer. % Specifically, $E_{\text{P}}$ is the regularizer of the Potts functional \cite{potts1952some} and $E_{\text{M}}$ is a label cost term representing the Minimum Descriptor Length (MDL) principle~\cite{delong2012fast}. The weights $\lambda \geq 0$ balance the contribution of each term. The energy is designed such that its minimizer achieves the best fit to the data while being spatio-temporally smooth and having the fewest labels (i.e., segments). \iflongversion It is thus a constrained optimization problem that is posed in an unconstrained weak optimization manner. \fi We detail the design of each energy term in the upcoming sections. \subsection{Data Fidelity Term} \label{subsec: data term} The data term in~\eqref{eq: overall energy function} is defined on both the discrete labeling variables and the continuous model parameters. If the labeling variables are fixed, the energy reduces to the data term and the optimal motion model for each cluster can be obtained using the motion compensation scheme (see Section~\ref{subsec: continuous sub problem}). Hence, we focus on the design of the data term from the perspective of the discrete labeling variables. To adapt motion compensation~\cite{Gallego18cvpr} to a graph-based energy formulation~\eqref{eq: overall energy function} we need to reformulate it so that: ($i$) energy is minimized instead of maximized, ($ii$) the fitting cost of a group of events is given by the sum of fitting costs of individual events, i.e., the so-called unary terms~\cite{boykov2001fast}. The original motion compensation scheme creates an IWE~\eqref{eq:IWE}, on which image contrast is measured. The IWE is created by warping events according to a certain motion model. % The higher the IWE contrast, the sharper the IWE, and consequently, higher pixel values (i.e., event accumulation) appear around the edge patterns. Therefore, the intensity value at each IWE pixel is a proxy for the consistency (goodness of fit) between the model and the events that are warped to that pixel. To convert the maximization problem into a minimization one and to build the unary costs of the data term, we propose to use the IWE ``negative''~\cite{zhou2020event}. Once an IWE $I$ is computed~\eqref{eq:IWE}, it is normalized to a fixed range, e.g., $\left[0, 255\right]$, and then its negative is calculated as $\bar{I} = 255 - \hat{I}$, where $\hat{\cdot}$ denotes the normalization operation, and $\overline{\cdot}$ the negative operation. We define the unary term for an event $e_k$ as the value at its warped location, $\mathbf{x}'_k$ in~\eqref{eq:warped-events}, on the IWE negative, namely $\bar{I}(\mathbf{x}'_k; \bm_l)$. The data term is defined as the sum of all unary terms: \begin{equation} E_\text{D}(L) \doteq \sum_{l \in \mathcal{L}}\sum_{e_k \in \mathcal{C}_l} \bar{I}(\mathbf{x}'_{k}; \bm_l), \end{equation} where $\mathcal{C}_l$ denotes the cluster of events with label $l$, and $\bar{I}(\cdot\,; \bm_l)$ the IWE negative created using motion model $\bm_l$. \subsection{Spatially Coherent Labeling} \label{subsec: potts model term} As for the regularizer, we simply use a pairwise Potts model term $E_{\text{P}}$ to encourage spatially coherent labeling. This term is defined only on the discrete labeling variables: \begin{equation} E_{\text{P}}(L) \doteq \sum_{e_i, e_j \in \mathcal{N}} \delta_{L(e_i),L(e_j)}, \end{equation} where $\mathcal{N}$ denotes the event neighbourhood in the spatio-temporal graph (Section~\ref{sec:event-graph}), and $\delta_{m,n}$ is the Kronecker delta (1 if the variables $m,n$ are equal, and 0 otherwise). \subsection{Encouraging Few Number of Segments} \label{subsec: MDL term} To discourage redundancy of the assigned motion models we introduce an MDL term: \begin{equation} \label{eq:MDL} E_{\text{M}}(L) \doteq \sum_{l=1}^{N} \psi(l), \;\; \psi(l) \doteq \begin{cases} 1 &\mbox{if } \displaystyle{\sum_{e \in \mathcal{C}_l}\delta_{L(e),l} > 0} \\ 0 & \mbox{otherwise.} \end{cases} \end{equation} This term penalizes the total number of assigned (active) labels (i.e., segments), which encourages it to converge to the actual number of IMOs. % We describe the optimization procedure for solving the proposed energy in the next section. \section{Acknowledgement} We thank Dr. Timo Stoffregen and his co-authors for providing test data from~\cite{Stoffregen19iccv}. We thank Chethan Parameshwara for providing the comparison images in Fig.~\ref{fig: qualtitative evaluation EVIMO}. We thank Chuhao Liu and Hao Xu for their help during data collection. \subsection{Event-based Camera Working Principle} \label{sec:DVS_operation_application} Event-based cameras~\cite{Lichtsteiner08ssc} have independent pixels that continuously monitor their incident light and respond to changes of predefined size $C$, which are called ``events''. Specifically, if $L(\mathbf{x},t)\doteq \log I(\mathbf{x},t)$ is the logarithmic brightness at pixel $\mathbf{x} \doteq (x,y)^\top$ on the image plane, an event $e_k \doteq (\mathbf{x}_k,t_k,p_k)$ is generated at pixel $\mathbf{x}_k$ and time $t_k$ (with microsecond resolution) if the change in log-brightness reaches $C$ (typically 10-15\% relative change): \begin{equation} \label{eq:generativeEventCondition} \Delta L \doteq L(\mathbf{x}_k,t_k) - L(\mathbf{x}_k,t_k-\Delta t_k) = p_{k}\, C, \end{equation} where $\Delta t_k$ is the time since the last event at the same pixel $\mathbf{x}_k$ and $p_k \in \{+1,-1\}$ is the event polarity (i.e., sign of $\Delta L$). Hence, each pixel has its own sampling rate (which depends on the visual input) and outputs data proportionally to the amount of motion or illumination variations in the scene. An event-based camera does not produce images at a constant rate, but rather a stream of \emph{asynchronous}, sparse events in space-time domain. \section*{Multimedia Material} \noindent Project page: {\small \url{https://sites.google.com/view/emsgc}}\\ Code: {\small \url{https://github.com/HKUST-Aerial-Robotics/EMSGC.git}}\\ \section{Introduction} \label{sec: introduction} \input{floats/fig_eye_catcher_page2} Event-based cameras, such as the Dynamic Vision Sensor (DVS) \cite{Lichtsteiner08ssc,Suh20iscas,Finateu20isscc}, are novel bio-inspired visual sensors. Unlike standard cameras that acquire data at a fixed rate, event-based cameras report per-pixel intensity changes asynchronously at the time they occur, with microsecond resolution, called ``events''. This working principle offers potential advantages (low latency, high temporal resolution, high dynamic range and low power consumption) to tackle challenging scenarios in computer vision such as high-speed and/or high dynamic range (HDR) optical flow estimation~\cite{Benosman14tnnls,Zhu18rss}, feature tracking~\cite{Lagorce15tnnls,Valeiras15tnnls,Zhu17icra,Gehrig19ijcv}, stereo depth estimation~\cite{Rogister12tnnls,Lee14tnnls,Osswald17srep,Zhou18eccv}, camera tracking~\cite{Mueggler15rss,Gallego17pami,Chamorro20bmvc}, control~\cite{Conradt09iscas,Delbruck13fns} and Simultaneous Localization and Mapping (SLAM)~\cite{Kim16eccv,Rebecq17ral,Rosinol18ral,Mueggler18tro,zhou2020event}. However, due to the above principle of operation and unconventional output, algorithms designed for standard cameras cannot be directly applied. Novel algorithms are needed to unlock event cameras' potential. The recent survey \cite{Gallego20pami} provides a comprehensive review on event-based cameras, algorithms and applications. In this paper, we consider the problem of event-based motion segmentation, which aims at classifying events occurred during a time interval into several groups that represent coherent moving objects. We tackle the most general case: a possibly moving event camera observing a dynamic scene. It is more challenging than the static camera case because events are no longer solely due to IMOs; they are also induced by the background. We develop a method to jointly classify events and estimate their coherent motion, in an iterative and alternating manner. \textbf{Contributions}. Our contributions can be summarized as: \begin{enumerate} \item A novel event-based motion segmentation method designed in the spirit of motion compensation~\cite{Gallego18cvpr} and built on top of classical multi-model fitting schemes. We propose a space-time event graph representation to exploit the spatio-temporal nature of events, leading to globally consistent and locally coherent labeling results. \item A simple and effective initialization method using the original motion compensation scheme on raw events. \item A formulation that does not require prior knowledge in the form of scene geometry, motion patterns or number of IMOs.% \item An extensive evaluation, qualitative and quantitative, on % available datasets, showing better performance than directly competing baseline methods. \end{enumerate} \vspace{1ex} The rest of the paper is organized as follows: Section~\ref{sec:DVS_operation_application} briefly describes the working principle of event-based cameras. Section~\ref{sec:problem:intro} discusses the nature of the event-based motion segmentation problem and the related work. Section~\ref{sec:problem-statement} more formally states the problem and necessary preliminaries. Sections~\ref{sec:energy-formualtion} and~\ref{sec:optimization} disclose our energy formulation and optimization procedure, respectively. The method is evaluated in Section~\ref{sec:evaluation} and conclusions are drawn in Section~\ref{sec:conclusion}. \section{Problem Statement Preliminaries} \label{sec:problem-statement} The goal of this work is to cluster the events produced by an event-based camera into groups that undergo coherent motions. Such motions aim to represent the unknown number of IMOs in the scene. Once clustered, events are warped according to the estimated motions and produce an overall % IWE with the highest contrast (Fig~\ref{fig:eyecatcher}, Right). In this section we briefly introduce multi-model fitting and discuss how to adapt its components to event data. We introduce the notions of spatio-temporal graph of events and model-fitting metric(s) on the graph. \subsection{Multi-Model Fitting} \label{sec:multi-model-fitting} Multi-model fitting is a category of computer vision problems that aim at explaining data using several model instances. It is a chicken-and-egg problem, often split into two sub-problems: assignment of data to a model instance (i.e., classification or ``labeling'') and model fitting (i.e., parameter estimation). Examples consist of recognizing and segmenting partially occluded objects in 2D~\cite{winn2006layout} or 3D~\cite{hoiem20073d}, optical flow estimation~\cite{trobin2008continuous,roth2009discrete,yang2015dense}, and motion segmentation~\cite{isack2012energy}. These problems aim at assigning a label $l_p$ to each data point $p$, where each label $l \in \mathcal{L}$ corresponds to a model $\mathcal{M}_{l}$ that is consistent with local observations. The solution to the problem is a labeling configuration $L$ that is locally smooth and globally consistent. To find such a solution, multi-model fitting problems are naturally formulated as the minimization of an energy $ E = E_{\text{data}} + E_{\text{reg}},$ comprising a data term $E_{\text{data}}$ that measures the inconsistency between the data and the models, and a regularizer (smoothness term) $E_{\text{reg}}$ that enforces prior knowledge about the models. A successful set of solvers consider a graph through the data points and seek to partition the graph into the optimal labels \cite{Boykov01iccv,boykov2001fast}. We also follow this approach. \subsection{Space-Time Event Graph} \label{sec:event-graph} The data points in our problem consist of events $\{e_k\}$ produced by a DVS~\cite{Lichtsteiner08ssc}. Because events are sparse in the spatio-temporal domain (time-evolving image plane), the underlying graph considered is in general unstructured (as opposed to the regular graph of pixel intensities in an image). To build a spatio-temporal graph for events while keeping a low complexity, we propose to use a Delaunay triangulation~\cite{shewchuk2009general} on the binary image of active events in the space-time volume $\mathbf{V}$ (Fig.~\ref{fig:spatio-temporal-graph}). Specifically, given the events in a volume $\mathbf{V}$ of size $W \times H \times \delta t$ (where $W, H$ refer to the width and height of the image plane, and $\delta t$ denotes the time span), we first compute a binary image % of event activity (i.e., the pixel is 1 if it contains at least one event, illustrated by blue squares in Fig.~\ref{fig:active pixels}, and it is 0 otherwise). Then we compute the Delaunay triangulation on the non-zero pixels of this binary image (black dots in % Fig.~\ref{fig:delaunay triangulation}), which returns a 2D graph (mesh). % This 2D graph is used to build a space-time (3D) graph for the events (see the connection principle in Fig.~\ref{fig:connection principle}). Each event typically has $2 + 2N$ neighbors in the resulting graph (Fig.~\ref{fig:resulting ST graph}), where $N$ denotes the number of edges that link to the event's pixel location in the binary image (black dots in Fig.~\ref{fig:spatio-temporal-graph}). There are many possible graphs that can be used to connect the event data points. The above proposal is inspired in graphs proposed for Markov Random Fields built on sets of sparse 2D features \cite{russell2011energy} and is easy to implement from a data structure point of view. \input{floats/spatio_temporal_graph} \subsection{Goodness of Fit by Motion Compensation} \label{sec:review-motion-compensation} The specification of a metric on the data graph allows us to assess the goodness of fit between the data and the model(s) (\textit{i}.\textit{e}., $E_\text{data}$). Building upon~\cite{Gallego19cvpr}, the goodness of fit is given by the alignment of the events along point trajectories on the image plane, which constitute a motion model and are parametrized by a parameter vector $\bm$. Such event alignment is assessed by the strength of the contours of an IWE. % The contour strength (which is related to image contrast~\cite{gonzalez2004digital}) can be measured with various dispersion metrics, such as variance~\cite{Gallego17ral,Gallego18cvpr,Stoffregen19iccv}, RMS of mean timestamp per pixel~\cite{Zhu19cvpr} We utilize the variance loss \iflongversion introduced by~\cite{Gallego18cvpr}, which has shown advantages against others in terms of accuracy and computational efficiency~\cite{Gallego19cvpr}, \fi as metric for the edges of the event graph. To make the paper self-contained, we briefly review the idea of motion compensation~\cite{Gallego17ral,Gallego18cvpr}, upon which motion models are fitted. \textbf{Motion Model Fitting}. The contrast maximization framework~\cite{Gallego18cvpr} allows us to fit a motion model to a group of events $\cE = \{e_k\}_{k=1}^{N_e}$. First, events are geometrically transformed according to a warping function~$\Warp$, \begin{equation} \label{eq:warped-events} e_k \doteq (\mathbf{x}_k, t_k) \;\mapsto\; e_k^{\prime} \doteq (\mathbf{x}_k^{\prime}, t_{\text{ref}}), \end{equation} leading to a set of warped events $\cE' = \{e_k^{\prime}\}_{k=1}^{N_e}$ at a reference time $t_{\text{ref}}$. The warping function $\Warp(\mathbf{x}_k, t_k; \bm) \doteq \mathbf{x}_k^{\prime}$ implements the image-plane trajectories of a motion model and is parametrized by $\bm$. Secondly, events $\cE'$ are aggregated into an image (or histogram) of warped events (IWE), \begin{equation} \label{eq:IWE} I(\mathbf{x}; \bm) \doteq \sum_{k=1}^{N_e}\delta (\mathbf{x} - \mathbf{x}_{k}^{\prime}(\bm)), \end{equation} where each pixel $\mathbf{x}$ counts the number of warped events that fall within it. In practice, the Dirac function $\delta$ is replaced by a Gaussian $\mathcal{N}(\mathbf{x}; \mathbf{0},\epsilon^2\text{Id})$ of $\epsilon=1$ pixel width. Finally, the variance of the IWE \iflongversion (or other metrics~\cite{Gallego19cvpr}), \fi defines a criterion for model fitting: % \begin{equation} \label{eq:argmaxMotionModel} \bm^\ast = \arg\max_{\bm} \sigma^2(I(\mathbf{x}; \bm)). \end{equation} Like~\cite{Gallego18cvpr}, our formulation supports any type of parametric motion model, such as \mbox{2-DoF} \emph{(degrees-of-freedom)} flow~\cite{Zhu17icra}, \mbox{3-DoF} rotational motion~\cite{Gallego17ral}, \mbox{4-DoF} model~\cite{Mitrokhin18iros}, etc. \vspace{0.5ex} In summary, the above event graph representation and model-fitting criterion allow us to formulate the problem of event-based multi-motion segmentation as joint estimation over two sets of variables: \begin{itemize}[noitemsep,nolistsep] \item \textbf{Discrete labels}. The segmentation (clustering) is represented by the labeling function $L(e) : \SI{}{\Omega} \times \mathcal{T} \rightarrow \mathcal{L} = \{1,...,N\}$, which assigns to each event $e$ a label $l \in \mathcal{L}$ indicating which independently moving object the event belongs to. \item \textbf{Motion models}. The motion of the independently moving object is represented by a collection of warps with parameters $\mathcal{M} = \{\bm_1, ..., \bm_N\}$. Each warp represents the coherent motion of a group of events. \end{itemize}
{'timestamp': '2021-11-01T01:23:34', 'yymm': '2012', 'arxiv_id': '2012.08730', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08730'}
arxiv
\section{Introduction} GNNs \cite{scarselli2008graph}, especially graph convolutional networks \cite{bruna2013spectral,henaff2015deep} have demonstrated remarkable performance in modeling structured data in a wide variety of fields, such as social networks \cite{kipf2016semi,hamilton2017inductive, li2019semi} and graph-based representations of molecules \cite{gilmer2017neural,rong2020self}. The common practice is to recursively update node embeddings by aggregating (or message passing) information from topological neighbors such that the GNNs can capture the local structure of nodes. Subsequently, the learned embeddings can be used in downstream analyses, e.g., node classification \cite{kipf2016semi,hamilton2017inductive,huang2018adaptive,xu2018representation,rong2019dropedge}, link prediction \cite{zhang2018link}, and graph classification \cite{duvenaud2015convolutional,dai2016discriminative,gilmer2017neural}. However, those GNNs fail to capture the hierarchical representations of graphs \cite{ying2018hierarchical}, which is essential for many scenarios. For instance, in order to predict the properties of a given molecule, it would be highly desirable to infer the sub-parts which are important for the molecular properties hierarchically. To this end, various graph pooling methods are recently proposed, aiming to learn the coarse-grained graph structure by either reserving the most informative nodes \cite{gao2019graph,lee2019self} or aggregating nodes belonging to the same cluster \cite{ying2018hierarchical,yuanstructpool,khasahmadi2020memory,wang2019haarpooling,Bianchi2020spectral}. In particular, the latter attracts considerable attention mainly attributed to its remarkable performance. Such kind of methods learn a cluster assignment matrix to map each node to a set of clusters that may correspond to strongly connected communities within a social network or functional groups within a molecule. However, their limitations lie in that (i) simply grouping node features fails to effectively model the part-whole relationship that is crucial in characterizing the hierarchical structure, and (ii) they ignore the entanglement of the latent factors behind node embeddings, resulting in limited capacity in preserving detailed node/graph properties and modeling graph hierarchy. For example, it is of particular importance to consider the interaction of heterogeneous factors (e.g., work, hobby) underlying each node, in order to identify the communities in a social network. Capsule neural networks (CapsNets) have proved its effectiveness in modeling hierarchical relationships on image data by exploiting the fact that while viewpoint changes have complicated effects on pixel intensities, they have linear effects at the part/object level \cite{sabour2017dynamic,hinton2018matrix,kosiorek2019stacked}. In contrast to convolutional neural networks, CapsNets use activity vectors or pose matrices to represent the entities. Moreover, the viewpoint-invariant relationship between the part and the whole is characterized by trainable transformation matrices, which is under the assumption that the human visual system relies on parse tree-like structure to recognize objects. Such representations make CapsNets especially appealing in reasoning the part-whole hierarchy and robust to adversarial attacks \cite{hinton2018matrix,qin2019detecting}. However, how to effectively take advantage of CapsNets to benefit graph classification remains largely unexplored. In this work, we present the hierarchical graph capsule network (HGCN) that is able to jointly learn node embeddings and extract the hierarchical structure of the input graph. Specifically, to preserve detailed node/graph information, we build graph capsules by disentangling heterogeneous factors behind the node embeddings such that each capsule encodes different properties of the same entity. In order to capture the graph hierarchy, multiple graph capsule layers are stacked to get coarser and coarser representations. In each layer, (i) to infer the votes of instantiation parameters of higher-level capsules (wholes), we propose transformation GNNs to reason about the part-whole relationship by explicitly considering the structure information among lower-level capsules (parts); (ii) each of these votes that are weighted by a routing weight, are iteratively routed to the potential wholes that correspond to tight clusters in the votes. We further introduce the auxiliary graph reconstruction to enhance the representation capacity of graph capsules and the training stability. As a consequence, HGCN is capable of modeling hierarchical representations of the input graph and benefits the goal of graph classification. Our main contributions can be summarized as: (i) we propose a novel capsule-based graph neural network to learn node embeddings and hierarchical graph representations simultaneously, (ii) we demonstrate the effectiveness of considering the entanglement of latent factors and the structure information within the parts in modeling part-whole relationships on the graph data; (iii) comprehensive empirical studies demonstrate that our method achieves remarkably superior improvement over the state-of-the-art approaches on 11 commonly used benchmarks. \section{Related Work} \iffalse EigenPool introduced a graph pooling that used the local graph Fourier transform to extract subgraph information. Its potential drawback lies in the inherent computing bottleneck for the Laplacian-based graph Fourier transform, given the high computational cost for the eigendecomposition of the graph Laplacian. EigenPooling \cite{ma2019graph} summarize the subgraph information by also considering the subgraph structure; e local graph Fourier transform MinCutPool \cite{Bianchi2020spectral} spectral clustering; is a well-known clustering technique that leverages the Laplacian spectrum to find strongly connected communities on a graph; eigendecomposition of the Laplacian is expensive; does not require to compute the spectral decomposition; Haar graph pooling \cite{wang2019haarpooling} (ICML 2020): compressive Haar transforms; it is computed by following a sequence of clusterings of the input graph; the compressive Haar transform filters out fine detail information in the Haar wavelet domain. GMN \cite{khasahmadi2020memory}: these models are not efficient as they require an iterative process of message passing after each pooling layer; cluster-based; assignment matrix-based \fi \subsubsection{Graph Neural Networks} GNNs attempt to exploit the structure information underlying graph structured data in order to benefit various downstream tasks \cite{li2015gated,kipf2016semi,hamilton2017inductive,li2018adaptive,xu2018representation,luan2019break,rong2019dropedge,you2019position}. Recent studies have proved GNNs' wide applicability in, for example, drug discovery \cite{yan2020retroxpert,gilmer2017neural,ma2020multi}, protein interface prediction \cite{fout2017protein}, and recommendation system \cite{ying2018graph}. Current GNNs can be mainly summarized as two streams: spectral-based methods and spatial-based methods. The spectral-based methods largely rely on the convolution operation defined in the Fourier domain with spectral filters \cite{bruna2013spectral,henaff2015deep}. This kind of method is further simplified and extended by introducing polynomial spectral filters \cite{defferrard2016convolutional} or linear filters \cite{kipf2016semi}. To deal with arbitrarily structured graphs, the spatial-based methods define convolutions directly on the graph by aggregating features from topological neighbors \cite{atwood2016diffusion,niepert2016learning,hamilton2017inductive,vaswani2017attention}. \subsubsection{Graph Pooling} It is widely recognized that pooling operation plays an important role in graph classification \cite{errica2019fair} which requires the graph level representation. The most straightforward way is, to sum up, or take an average of all node features \cite{hamilton2017inductive,xu2018powerful}. The limitation of such strategy is that the hierarchical information which is crucial in capturing graph structure is not considered. Inspired by the downsampling in convolutional neural networks, recent studies propose to adaptively keep the most informative nodes in a hierarchical manner \cite{gao2019graph,lee2019self}, or aggregate maximal cliques by only using topological information \cite{luzhnica2019clique}. Another line of work focuses on finding strongly connected communities on a graph. This is typically achieved by learning a cluster assignment matrix in order to map each node to a set of clusters \cite{ying2018hierarchical,ranjan2019asap,yuanstructpool,khasahmadi2020memory}. Most recent studies approach this problem by leveraging more advanced clustering techniques, such as local graph Fourier transform \cite{ma2019graph}, spectral clustering \cite{Bianchi2020spectral}, and compressive Haar transforms \cite{wang2019haarpooling}. However, simply grouping node features has limited capacity in modeling the part-whole relationships, especially for biological data. In this work, we reason about the part-whole hierarchy by exploring the interaction of underlying latent factors and structure information among the parts, then use an routing mechanism to assign the parts to wholes. \subsubsection{Capsule Networks} A capsule \cite{hinton2011transforming} is a group of neurons whose orientation represents the instantiation parameters such as pose (position, size) of an entity (e.g., an object). The probability that the entity exists can be represented by the capsule length \cite{sabour2017dynamic} or a logistic unit \cite{hinton2018matrix,kosiorek2019stacked}. Compared to a single neuron, a capsule contains different properties of the same entity and can preserve hierarchical relationships between lower-level capsules (e.g., eyes, mouth) and higher-level capsules (e.g., face). Such part-whole relationships are described by trainable transformation matrices which are viewpoint-invariant. Concretely, a lower-level capsule (part) makes predictions for the pose of each higher-level capsule (whole) by multiplying its own pose by the transformation matrices. Routing-by-agreement is then performed between two adjacent capsule layers to update the probability with which a part is assigned to a whole \cite{sabour2017dynamic,hinton2018matrix}. Inspired by this, GCAPS-CNN \cite{verma2018graph} builds capsules on graphs by considering higher-order statistical moments as instantiation parameters. Normal graph convolution is then carried out to aggregate information from neighbors and the covariance is computed as the permutation invariant feature for graph classification. Its most obvious drawback lies in that the hierarchical structure of the graph is not considered. Different from GCAPS-CNN, we explicitly take into account the hierarchy between two consecutive capsule layers through trainable transformation GNNs. CapsGNN \cite{xinyi2018capsule} uses multiple GNN channels to build graph capsules and follow the same voting strategy as \cite{sabour2017dynamic} to predict higher-level capsules. However, simply using the transformation matrix ignores the local structure information among lower-level capsules and fails to describe part-whole relationships in graphs. Our method introduces transformation GNNs to reason about the pose of each whole in the layer above, which is in contrast to each individual part making its own prediction. A further advantage of transformation GNNs is that they save orders of magnitude of memory compared to transformation matrices used in previous work \cite{xinyi2018capsule,sabour2017dynamic,hinton2018matrix}. Furthermore, different from CapsGNN that reconstructs the histogram of input nodes, we reconstruct the adjacency matrix of the input graph to ensure the quality of graph capsules and enhance the training stability. \iffalse \paragraph{Disentangled Representation Learning} We dynamically disentangle the node representations 1. PAYLESS ATTENTION WITH LIGHTWEIGHT AND DYNAMIC CONVOLUTIONS 2. dynamic convolution: attention over convolution kernels 3. Disentangled graph convolutional networks \cite{ma2019disentangled} \fi \section{Preliminaries} \subsubsection{Graph Classification} A graph $G$ with $N$ nodes is represented as $(\mathbf{A},\mathbf{X})$, where $\mathbf{A}\in\{0,1\}^{N \times N}$ is the adjacency matrix, and $\mathbf{X} \in \mathbb{R}^{N \times d}$ is the node feature matrix with feature dimension $d$. Given a set of labeled graphs $\mathcal{D}=\{(G_1, y_1),(G_2, y_2),...\}$, the goal of graph classification is to learn a mapping $f:\mathcal{G} \rightarrow \mathcal{Y}$, where $G_i \in \mathcal{G}$ and $y_i \in \mathcal{Y}$. For example, each graph is a molecule, and its label indicates whether it is toxic. \subsubsection{Graph Neural Networks} To extract useful information from local neighborhoods, our method is built upon GNNs by following the general "message-passing" paradigm, which is formulated as: \begin{equation} \mathbf{H}^{(l+1)}=\mathcal{M}(\mathbf{A},\mathbf{H}^{(l)};\mathbf{W}^{(l)}), \end{equation} where $\mathcal{M}$ indicates the message passing function with various possible implementations \cite{kipf2016semi, hamilton2017inductive}, $\mathbf{W}^{(l)}$ is learnable weight matrix, $\mathbf{H}^{(l+1)}$ and $\mathbf{H}^{(l)}$ are the node embeddings of layer $l+1$ and $l$, respectively. The input node embeddings $\mathbf{H}^{(1)}$ are initialized using the node feature $\mathbf{X}$, i.e., $\mathbf{H}^{(1)}=\mathbf{X}$. The final node representations are denoted by GNN$(\mathbf{A}, \mathbf{X})=\mathbf{H}^{(L_\text{GNN})}\in \mathbb{R}^{N \times h}$ with $L_\text{GNN}$ iterations. \begin{figure*}[t] \begin{center} \includegraphics[width=1\linewidth]{framework-eps-converted-to.pdf} \end{center} \caption{An overview of the proposed framework. (A) Given an input graph, we build graph capsules by learning disentangled node representations in order to take into account the heterogeneous factors behind each node. TGNNs are established to characterize the part-whole relationship, and a routing strategy is used to predict higher-level capsules that receive a cluster of similar votes. (B) The residual connection that combines fine, low layer information with coarse, high layer information. } \label{fig:framework} \end{figure*} \begin{figure} \begin{center} \includegraphics[width=0.85\linewidth]{routing-eps-converted-to.pdf} \end{center} \caption{Cluster by agreement.} \label{fig:routing} \end{figure} \section{Methodology} In this section, we begin by first briefing the proposed HGCN as shown in Figure~\ref{fig:framework}, then we detail each component in the following sections. The goal of HGCN is to jointly learn node embeddings and coarsen the graph through exploiting hierarchical information. To achieve this, we disentangle node representations to build the graph capsule by considering heterogeneous factors underlying each edge connection. Therefore, each graph capsule is composed of multiple independent latent factors that represent different properties of the same entity. To learn hierarchical graph representations, transformation GNNs (TGNNs) are proposed to encode the part-whole relationship between lower-level and higher-level graph capsules. Specifically, a capsule in one layer votes for the instantiation parameters of each capsule in the layer above through TGNNs which highly depend on the structure information of lower-level capsules. Each of these votes is then routed to a higher-level capsule that receives a cluster of similar votes by a routing-by-agreement strategy. To encourage the graph capsules to encode the instantiation parameters of the input graph and also enhance the training stability, we further introduce the auxiliary graph reconstruction to reconstruct the input adjacency matrix. \subsection{Disentangled Graph Capsules} In most cases, highly complex interactions are involved in the connection between each node pair in a graph. For example, the edges between a node and its neighbors in a social network are driven by heterogeneous factors, since a person connects with others for various reasons such as exercise, work, etc. Therefore, it is necessary to disentangle the explanatory factors of variations underlying the node representations. Furthermore, each node embedding is considered as multiple individual scalar features in existing GNNs, which are proved to have limited capability in preserving the graph properties \cite{verma2018graph,xinyi2018capsule}. To address these two limitations, motivated by \cite{sabour2017dynamic}, we propose graph capsules to describe the given graph. Specifically, we disentangle the latent factors of each node embedding and use the disentangled node representation to represent graph capsules (Figure~\ref{fig:framework}A). In this way, each graph capsule is composed of multiple heterogeneous factors, and each factor describes a specific instantiation parameter of the entity/node. Formally, given $G=(\mathbf{A}, \mathbf{X})$, the node $i$ is denoted by $\mathbf{x}_i \in \mathbb{R}^d$. We project the input node features into $K$ different subspaces, assuming that there are $K$ latent factors/instantiation parameters: \begin{equation} \mathbf{z}_{i,k}=\sigma (\mathbf{W}_k^T \mathbf{x}_i) + \mathbf{b}_k, \end{equation} where $\mathbf{W}_k \in \mathbb{R}^{d \times \frac{h}{K}}$ and $\mathbf{b}_k \in \mathbb{R}^{\frac{h}{K}}$ are learnable parameters, $\sigma$ is a nonlinear activation function, and $\frac{h}{K}$ is the dimension of each factor. Although more sophisticated implementations of node disentanglement are possible \cite{ma2019disentangled}, we use linear projection in our study attributed to its efficiency and remarkable performance. Therefore, each graph capsule is represented by a pose matrix $\mathbf{Z}_i \in \mathbb{R}^{K \times \frac{h}{K}}$ \cite{hinton2018matrix}. For simplicity, we reshape $\mathbf{Z}_i$ to the vector format $\mathbf{z}_i \in \mathbb{R}^h$. Recall that the existence probability of an entity represented by a capsule is measured by the capsule length \cite{sabour2017dynamic}, we thus squash $\mathbf{z_i}$ as follows: \begin{equation} {\mathbf{p}}_{i}= squash(\mathbf{z}_{i}) = \frac{\|\mathbf{z}_{i}\|^2}{1+\|\mathbf{z}_{i}\|^2} \frac{\mathbf{z}_{i}}{\|\mathbf{z}_{i}\|}, \end{equation} where $\mathbf{u}_i^{(1)} = {\mathbf{p}}_{i} \in \mathbb{R}^{h}$ is the primary graph capsule representing the lowest level of entities, such as atoms in the molecular graph. \subsection{Hierarchical Capsule Layers} To obtain hierarchical graph representation, it is essential to capture the part-whole relationship between adjacent capsule layers. Such relationship is measured by viewpoint-invariant transformation matrix $\mathbf{T}^{(l)}_{i,j} \in \mathbb{R}^{d_{l} \times d_{l+1}}$ for each pair of lower-level capsule $\mathbf{u}^{(l)}_i$ and higher-level capsule $\mathbf{u}^{(l+1)}_j$ in previous studies \cite{sabour2017dynamic,hinton2018matrix}, where $d_l$ and $d_{l+1}$ are the capsule dimensions of $\mathbf{u}^{(l)}_i$ and $\mathbf{u}^{(l+1)}_j$, respectively. However, $\mathbf{T}^{(l)}_{i,j}$ totally ignores the structure information within $\mathbf{u}^{(l)}$, which is especially problematic for graph structured data. Furthermore, $\mathbf{T}^{(l)} \in \mathbb{R}^{N_{l} \times N_{l+1} \times d_{l} \times d_{l+1}}$ is extremely memory-consuming for the scenario where a large number of high-dimensional capsules are required. To overcome these difficulties, we propose the transformation GNNs (TGNNs) to vote for the instantiation parameters of higher-level graph capsules (\textbf{voting}). When multiple votes agree, a higher-level capsule that receives a cluster of similar pose votes becomes active (\textbf{routing}). More concretely, we denote the graph capsules at layer $l$ as $\mathbf{u}^{(l)} \in \mathbb{R}^{N_l \times d_l}$, the capsule number as $N_l$, and the adjacency matrix as $\mathbf{A}^{(l)}$. Our goal is to decide which capsules to activate in $\mathbf{u}^{(l+1)} \in \mathbb{R}^{N_{l+1} \times d_{l+1}}$ and how to assign each active lower-level capsule $\mathbf{u}^{(l)}_i$ to one active higher-level capsule $\mathbf{u}^{(l+1)}_j$. In practice, we set $N_{l+1} < N_l$ in order to get coarser and coarser graph representations (Figure~\ref{fig:framework}A). \subsubsection{Voting} For all capsules in $\mathbf{u}^{(l)}$, their poses are transformed by TGNNs to cast votes for the pose of each capsule in $\mathbf{u}^{(l+1)}$ by the following equation, \begin{equation} \mathbf{v}^{(l)}_j = \text{TGNN}_j(\mathbf{A}^{(l)}, \mathbf{u}^{(l)}), \end{equation} where ${\mathbf{v}}^{(l)}_j \in \mathbb{R}^{N_l \times d_{l+1}}$. Specifically, ${\mathbf{v}}^{(l)}_{j|i} \in \mathbb{R}^{d_{l+1}}$ is the vote for the pose of $\mathbf{u}^{(l+1)}_j$ predicted by the capsule $\mathbf{u}^{(l)}_i$. Note, TGNNs are learned discriminatively and could learn to represent part-whole relationships by considering the structure information of capsules in $\mathbf{u}^{(l)}$. This is different from previous studies that use one transformation matrix for each pair of $(\mathbf{u}^{(l)}_i, \mathbf{u}^{(l+1)}_j)$. Compared to transformation matrices, TGNNs also save $N_l$ orders of magnitude memory. \subsubsection{Routing} Each of these votes is then weighted by an routing weight $c^{(l)}_{i,j}$ with which a part is assigned to a whole, where $c^{(l)}_{i,j} \geqslant 0$ and $\sum_{j=1}^{N_{l+1}} c^{(l)}_{i,j}=1$. Here, $c^{(l)}_{i,j}$ is iteratively updated using an "routing-by-agreement" mechanism such that each vote in ${\mathbf{v}}^{(l)}$ is routed to a capsule in $\mathbf{u}^{(l+1)}$ that receives a cluster of similar votes (Figure~\ref{fig:routing}). Formally, $c^{(l)}_{i,j}$ is defined as $c^{(l)}_{i,j} = {\text{exp}(b^{(l)}_{i,j})}/{\sum_k \text{exp}(b^{(l)}_{i,k})}$, where $b^{(l)}_{i,j}$ is initialized as $b^{(l)}_{i,j}=0$. To iteratively search for the vote cluster, in each iteration we have, \begin{equation} \mathbf{u}^{(l+1)}_j = squash(\sum_i c^{(l)}_{i,j}\mathbf{v}^{(l)}_{j|i}) \end{equation} where $\mathbf{u}^{(l+1)}_j$ is the predicted capsule $j$ in layer $l+1$, representing a tight cluster of votes from layer $l$. We update $b^{(l)}_{i,j}$ with $b^{(l)}_{i,j} = b^{(l)}_{i,j} + a^{(l)}_{i,j}$, where $a^{(l)}_{i,j} = \mathbf{v}^{(l)}_{j|i} \cdot \mathbf{u}^{(l+1)}_j$ indicates the agreement between each vote and vote cluster. It is worth mentioning that such top-down feedback also has a beneficial effect on the aggregation in the proposed TGNNs, such that TGNNs can more focus on aggregating information from neighbors that are likely to be in the same cluster. After $R$ iterations, we get higher-level graph capsules $\mathbf{u}^{(l+1)}$ and the coarsened adjacency matrix defined as $\mathbf{A}^{(l+1)}={\mathbf{C}^{(l)}}^T \mathbf{A}^{(l)} \mathbf{C}^{(l)} \in \mathbb{R}^{N_{l+1} \times N_{l+1}}$. As opposed to generating structurally independent higher-level capsules in previous work \cite{sabour2017dynamic, xinyi2018capsule}, the capsule layer we developed is able to explicitly preserve the structure information which is encoded in $\mathbf{A}^{(l+1)}$. Drawing inspiration from \cite{long2015fully}, we add a residual connection at each pair of consecutive capsule layers, aiming to provide fine-grained information to higher-level capsules (Figure~\ref{fig:framework}B). Formally, we have $\mathbf{u}^{(l+1)} \leftarrow \mathbf{u}^{(l+1)} + \text{GA}(\mathbf{u}^{(l)})$, where $\text{GA}$ indicates the global average operation. By stacking multiple capsule layers, we get the class capsules $\mathbf{u}^{(L)} \in \mathbb{R}^{O \times d_L}$ which are intended to encode feature attributes corresponding to the class, where $O$ is the number of graph categories. The classification loss is measured by a margin loss \cite{sabour2017dynamic} which is formulated as: \begin{equation} \begin{aligned} \mathcal{L}_{m}(\mathbf{A}, \mathbf{X}) = {} & \sum\limits_{o \in O} [T_o \hspace{0.1cm} \text{max}(0, m^+ - \|\mathbf{u}^L_o\|)^2 + \\ & \lambda(1-T_o) \hspace{0.1cm} \text{max}(0, \|\mathbf{u}^L_o\|-m^-)^2], \end{aligned} \end{equation} where $m^+=0.9$, $m^-=0.1$, $T_o=1$ iff the input graph has label $o$, and $\lambda$ is ued to stop the initial learning from shrinking the length of class capsules. \subsection{Auxiliary Graph Reconstruction} To encourage the graph capsules to encode the instantiation parameters of the input graph and to improve the training stability, we introduce a reconstruction loss to constraint the capsule reconstruction to closely match the class-conditional distribution. Specifically, we first mask out all but the winning capsule (the capsule corresponds to ground truth) and combine them with primary capsules by following the equation, \begin{equation} \mathbf{Z} = \mathbf{u}^{(1)} + (\mathbf{W}_r^T \Phi(\mathbf{u}^{(L)}) + \mathbf{b}_r), \end{equation} where $\mathbf{Z} \in \mathbb{R}^{N \times d_1}$, $\Phi$ is the mask operation, $\mathbf{W}_r \in \mathbb{R}^{(O \times d_L) \times d_1}$, and $\mathbf{b}_r \in \mathbb{R}^{d_1}$. The reconstruction loss is then defined as, \begin{equation} \mathcal{L}_{r}(\mathbf{A}, \mathbf{X}) = -\frac{1}{N^2}\sum_{j=1}^N \sum_{k=1}^N\sum_{c\in\{0,1\}} \mathbf{A}^{(j,k,c)}log(\mathbf{\tilde{A}}^{(j,k,c)}), \end{equation} where $\mathbf{\tilde{A}}=\mathbf{Z} \mathbf{Z}^T$ is the reconstructed adjacency matrix of the input graph. Taken together, we reach the optimization objective of our method as $\min\limits_{\theta} \sum\limits_{G \in \mathcal{D}} \mathcal{L}_m(\mathbf{A}, \mathbf{X}) + \beta \mathcal{L}_r(\mathbf{A}, \mathbf{X})$, where $\theta$ are all learnable parameters, and $\beta$ leverages the importance of $\mathcal{L}_r$. The whole training process is detailed in Algorithm~\ref{alg:alg_1}. \setlength{\textfloatsep}{10pt}% \begin{algorithm}[t] \SetAlgoLined \textbf{Input:} $G=(\mathbf{A}, \mathbf{X}), \mathbf{A} \in \mathbb{R}^{N \times N}, \mathbf{X} \in \mathbb{R}^{N \times d}$ \\ \KwResult{class capsules $\mathbf{u}^{(L)}$} \For{$i\leftarrow 1$ \KwTo $N$}{ \For{$k\leftarrow 1$ \KwTo $K$}{ $\mathbf{z}_{i,k}=\sigma (\mathbf{W}_k^T \mathbf{x}_i) + \mathbf{b}_k$ \hspace{13pt} \/// $K$ latent factors } } $\mathbf{u}^{(1)}_i=squash(\mathbf{z}_i)$ \hspace{14pt} \/// disentangled graph capsules \For{$l\leftarrow 1$ \KwTo $L$}{ $b^{(l)}_{i,j} = 0$ \\ \For{$j\leftarrow 1$ \KwTo $N_{l+1}$}{ $\mathbf{v}^{(l)}_j = \text{TGNN}_j(\mathbf{A}^{(l)}, \mathbf{u}^{(l)})$ \hspace{1.5cm} \/// votes \\ } \For{$r\leftarrow 1$ \KwTo $R$}{ $c^{(l)}_{i,j} = {\text{exp}(b^{(l)}_{i,j})}/{\sum_k \text{exp}(b^{(l)}_{i,k})}$ \\ $\mathbf{u}^{(l+1)}_j = squash(\sum_i c^{(l)}_{i,j}\mathbf{v}^{(l)}_{j|i})$ \\ $b^{(l)}_{i,j} = b^{(l)}_{i,j} + \mathbf{v}^{(l)}_{j|i} \cdot \mathbf{u}^{(l+1)}_j$ } $\mathbf{A}^{(l+1)}={\mathbf{C}^{(l)}}^T \mathbf{A}^{(l)} \mathbf{C}^{(l)} \in \mathbb{R}^{N_{l+1} \times N_{l+1}}$ } \textbf{return} $\mathbf{u}^{(L)} \in \mathbb{R}^{O \times d_L}$ \hspace{2cm} \/// class capsules \caption{Training process with $K$ latent factors, $L$ capsule layers, and $R$ iterations of routing.} \label{alg:alg_1} \end{algorithm} \begin{table*} \footnotesize \setlength\tabcolsep{4.5pt} \begin{center} \begin{tabular}{ @{} l|c|*{7}{c} @{} } \toprule \bf Algorithm & & \bf MUTAG & \bf NCI1 & \bf PROTEINS & \bf D\&D & \bf ENZYMES & \bf PTC & \bf NCI109 \\ \midrule AWE & \multirow{4}{*}{\rotatebox[origin=c]{90}{Kernel}} & 87.87$\pm$9.76 & \textemdash & \textemdash & 71.51$\pm$4.02 & 35.77$\pm$5.93 & \textemdash &\textemdash \\ GK & & 81.58$\pm$2.11 & 62.49$\pm$0.27 & 71.67$\pm$0.55 & 78.45$\pm$0.26 & 32.70$\pm$1.20 & 59.65$\pm$0.31 & 62.60$\pm$0.19 \\ WL & & 82.05$\pm$0.36 & 82.19$\pm$0.18 & 74.68$\pm$0.49 & 79.78$\pm$0.36 & 52.22$\pm$1.26 & 57.97$\pm$0.49 & 82.46$\pm$0.24 \\ DGK & & 87.44$\pm$2.72 & 80.31$\pm$0.46 & 75.68$\pm$0.54 & 73.50$\pm$1.01 & 53.43$\pm$0.91 & 60.08$\pm$2.55 & 80.32$\pm$0.33 \\ \midrule SAGPool & \multirow{11}{*}{\rotatebox[origin=c]{90}{GNN}} & \textemdash & 67.45$\pm$1.11 & 71.86$\pm$0.97 & 76.45$\pm$0.97 & \textemdash & \textemdash & 67.86$\pm$1.41 \\ CLIQUEPOOL & & \textemdash & \textemdash & 72.59 & 77.33 & 60.71 & \textemdash & \textemdash \\ ASAP & & \textemdash & 71.48$\pm$0.42 & 74.19$\pm$0.79 & 76.87$\pm$0.7 & \textemdash & \textemdash & 70.07$\pm$0.55 \\ HaarPool & & 77.60$\pm$8.94 & 80.17$\pm$2.29 & 73.23$\pm$2.51 & \textemdash & \textemdash & \textemdash & 69.61$\pm$1.49 \\ EigenPooling & & 79.50 & 77.00 & 76.60 & 78.60 & 64.50 & \textemdash & 74.90 \\ DGCNN & & 85.83$\pm$1.66 & 74.44$\pm$0.47 & 75.54$\pm$0.94 & 79.37$\pm$0.94 & 51.00$\pm$7.29 & 58.59$\pm$2.47 & 75.03$\pm$1.72 \\ PSCN & & 88.95$\pm$4.37 & 76.34$\pm$1.68 & 75.00$\pm$2.51 & 76.27$\pm$2.64 & \textemdash & 62.29$\pm$5.68 & \textemdash \\ GIN & & 89.40$\pm$5.60 & 82.70$\pm$1.70 & 76.20$\pm$2.80 & \textemdash & \textemdash & 64.60$\pm$7.00 & \textemdash \\ DIFFPOOL & & \textemdash & \textemdash & 76.25 & 80.64 & 62.53 & \textemdash & 74.10 \\ GCN & & 87.20$\pm$5.11 & 83.65$\pm$1.69 & 75.65$\pm$3.24 & 79.12$\pm$3.07 & 66.50$\pm$6.91 & \textemdash & 70.70 \\ GFN & & 90.84$\pm$7.22 & 82.77$\pm$1.49 & 76.46$\pm$4.06 & 78.78$\pm$3.49 & 70.17$\pm$5.58 & \textemdash & \textemdash \\ \midrule CapsGNN & \multirow{3}{*}{\rotatebox[origin=c]{90}{Caps}} & 86.67$\pm$6.88 & 78.35$\pm$1.55 & 76.28$\pm$3.63 & 75.38$\pm$4.17 & 54.67$\pm$5.67 & \textemdash & \textemdash \\ GCAPS-CNN & & \textemdash & 82.72$\pm$2.38 & 76.40$\pm$4.17 & 77.62$\pm$4.99 & 61.83$\pm$5.39 & 66.01$\pm$5.91 & 81.12$\pm$1.28 \\ \textbf{Ours} & & \textbf{93.16$\pm$6.10} & \textbf{84.87$\pm$1.68} & \textbf{77.99$\pm$3.16} & \textbf{80.99$\pm$2.58} & \textbf{78.00$\pm$4.89} & \textbf{66.54$\pm$7.97} & \textbf{83.91$\pm$1.27} \\ \bottomrule \end{tabular} \end{center} \caption{Performance comparison on biological graphs. "Caps" indicates capsule-based GNNs.} \label{table:biological_c1} \end{table*} \iffalse \begin{table} \caption{Performance comparison on biological graphs ($C^*$).} \label{table:biological_c2} \footnotesize \setlength\tabcolsep{4.5pt} \begin{center} \begin{tabular}{ @{} l|c|*{3}{c} @{} } \toprule \bf Algorithm & & \bf PROTEINS & \bf D\&D & \bf ENZYMES \\ \midrule STRUCTPOOL & \multirow{4}{*}{\rotatebox[origin=c]{90}{GNN}} & 80.36 & 84.19 & 63.83 \\ MemGNN & & 81.35 & 82.92 & 75.50 \\ GMN & & \textbf{82.25} & \textbf{84.40} & 78.66 \\ \textbf{Ours} & & 81.32$\pm$2.23 & 84.04$\pm$2.38 & \textbf{84.17$\pm$4.03} \\ \bottomrule \end{tabular} \end{center} \end{table} \fi \begin{table} \footnotesize \setlength\tabcolsep{1.5pt} \begin{center} \begin{tabular}{ @{} l|c|*{4}{c} @{} } \toprule \bf Algorithm & & \bf COLLAB & \bf IMDB-B & \bf IMDB-M & \bf RE-B \\ \midrule GK & \multirow{4}{*}{\rotatebox[origin=c]{90}{Kernel}} & 72.84$\pm$0.28 & 65.87$\pm$0.98 & 43.89$\pm$0.38 & 65.87$\pm$0.98 \\ AWE & & 73.93$\pm$1.94 & 74.45$\pm$5.83 & 51.54$\pm$3.61 & 87.89$\pm$2.53 \\ WL & & 79.02$\pm$1.77 & 73.40$\pm$4.63 & 49.33$\pm$4.75 & 81.10$\pm$1.90 \\ DGK & & 73.09$\pm$0.25 & 66.96$\pm$0.56 & 44.55$\pm$0.52 & 78.04$\pm$0.39 \\ \midrule PSCN & \multirow{6}{*}{\rotatebox[origin=c]{90}{GNN}} & 72.60$\pm$2.15 & 71.00$\pm$2.29 & 45.23$\pm$2.84 & 86.30$\pm$1.58 \\ DGCNN & & 73.76$\pm$0.49 & 70.03$\pm$0.86 & 47.83$\pm$0.85 & 76.02$\pm$1.73 \\ DIFFPOOL & & 75.48 & \textemdash & \textemdash & \textemdash \\ GCN & & 81.72$\pm$1.64 & 73.30$\pm$5.29 & 51.20$\pm$5.13 & \textemdash \\ GFN & & 81.50$\pm$2.42 & 73.00$\pm$4.35 & 51.80$\pm$5.16 & \textemdash \\ GIN & & 80.20$\pm$1.90 & 75.10$\pm$5.10 & 52.30$\pm$2.80 & 92.40$\pm$2.50 \\ \midrule GCAPS-CNN & \multirow{3}{*}{\rotatebox[origin=c]{90}{Caps}} & 77.71$\pm$2.51 & 71.69$\pm$3.40 & 48.50$\pm$4.10 & 87.61$\pm$2.51 \\ CapsGNN & & 79.62$\pm$0.91 & 73.10$\pm$4.83 & 50.27$\pm$2.65 & \textemdash \\ \textbf{Ours} & & \textbf{82.86$\pm$1.81} & \textbf{77.20$\pm$4.73} & \textbf{52.80$\pm$2.45} & \textbf{93.15$\pm$1.58} \\ \bottomrule \end{tabular} \end{center} \caption{Performance comparison on social graphs.} \label{table:social_c1} \end{table} \iffalse \begin{table} \caption{Performance comparison on social graphs ($C^*$).} \label{table:social_c2} \footnotesize \setlength\tabcolsep{1.4pt} \begin{center} \begin{tabular}{ @{} l|c|*{4}{c} @{} } \toprule \bf Algorithm & & \bf COLLAB & \bf IMDB-B & \bf IMDB-M & \bf RE-B \\ \midrule STRUCTPOOL & \multirow{4}{*}{\rotatebox[origin=c]{90}{GNN}} & 74.22 & 74.70 & 52.47 & \textemdash \\ MemGNN & & 77.0 & \textemdash & \textemdash & 85.55 \\ GMN & & 80.18 & \textemdash & \textemdash & 95.28 \\ \textbf{Ours} & & \textbf{84.80$\pm$1.57} & \textbf{79.80$\pm$3.39} & \textbf{55.80$\pm$2.20} & \textbf{95.30$\pm$1.30} \\ \bottomrule \end{tabular} \end{center} \end{table} \fi \section{Experiments} In this section, we conduct empirical studies on 11 benchmark datasets and demonstrate HGCN's superiority over a number of state-of-the-art graph classification methods. Extensive ablation studies are also performed to evaluate the effectiveness of each component in our model. \subsubsection{Datasets} Eleven commonly used benchmarks including (i) seven biological graph datasets, i.e., MUTAG, NCI1, PROTEINS, D\&D, ENZYMES, PTC, NCI109; and (ii) four social graph datasets, i.e., COLLAB, IMDB-Binary (IMDB-B), IMDB-Multi (IMDB-M), Reddit-BINARY (RE-B), are used in this study. It is noteworthy that the social graphs have no node attributes, while the biological graphs come with categorical node attributes. More details about the data statistics and properties can be found in Supplementary. \subsubsection{Baseline Methods} We compare with two capsule-based methods, i.e., CapsGNN \cite{xinyi2018capsule} and GCAPS-CNN \cite{verma2018graph}. We also conduct a comparison with a number of state-of-the-art GNN-based methods, including PATCHY-SAN (PSCN) \cite{niepert2016learning}, PSCN \cite{niepert2016learning}, GCN \cite{kipf2016semi}, Deep Graph CNN (DGCNN) \cite{zhang2018end}, CLIQUEPOOL \cite{luzhnica2019clique}, DIFFPOOL \cite{ying2018hierarchical}, ASAP \cite{ranjan2019asap}, SAGPool \cite{lee2019self}, EigenPooling \cite{ma2019graph}, GIN \cite{xu2018powerful}, GFN \cite{chen2019powerful}, HaarPool \cite{wang2019haarpooling}, STRUCTPOOL \cite{yuanstructpool}, and MemGNN/GMN \cite{khasahmadi2020memory}. For kernel-based methods, we consider WL \cite{shervashidze2011weisfeiler}, DGK \cite{yanardag2015deep}, AWE \cite{ivanov2018anonymous}, and GK \cite{shervashidze2009efficient}. \subsubsection{Experimental Settings} We set $K=4$, $R=3$, $\lambda=0.5$, $\beta=0.1$, $L=2$, and follow the same settings in previous studies \cite{ying2018hierarchical} to perform 10-fold cross-validation for performance evaluation. For each dataset, we select a single epoch that has the best cross-validation accuracy averaged over the 10 folds, and report the average and standard deviation of test accuracies at the selected epoch. HaarPool \cite{wang2019haarpooling} repeats each experiment 10 times with different random seeds, for a fair comparison, we run HaarPool with 10-fold cross-validation and report the result. STRUCTPOOL \cite{yuanstructpool} and MemGNN/GMN \cite{khasahmadi2020memory} use a different assessment criterion that selects the epoch with the best test accuracy on each fold and then take the average. We name such assessment criterion as $C^*$ and run our method by following the same paradigm for comparison. Unless otherwise indicated, we use the result reported in the original paper for other baseline methods. For TGNNs, we adopt the GCN \cite{kipf2016semi} with $L_\text{GNN}=1$. \iffalse \begin{figure} \begin{center} \includegraphics[width=0.9\linewidth]{Figure/visualize.eps} \end{center} \caption{Visualization of routing weights.} \label{fig:visualization} \end{figure} \fi \begin{table*} \footnotesize \setlength\tabcolsep{4.5pt} \begin{center} \begin{tabular}{ @{} l|c|*{7}{c} @{} } \toprule & & \bf MUTAG & \bf NCI1 & \bf PROTEINS & \bf D\&D & \bf ENZYMES & \bf PTC & \bf NCI109 \\ \midrule A1 & \multirow{3}{*}{\rotatebox[origin=c]{90}{ablation}} & 91.46$\pm$5.77 & 80.24$\pm$1.78 & 76.37$\pm$3.11 & 78.35$\pm$2.73 & 70.00$\pm$4.51 & 63.61$\pm$12.47 & 80.64$\pm$2.09 \\ A2 & & 92.08$\pm$5.10 & \textbf{85.28$\pm$1.37} & 77.63$\pm$3.03 & 80.64$\pm$3.65 & 77.00$\pm$5.82 & 64.24$\pm$8.45 & 83.84$\pm$1.41 \\ A3 & & 92.11$\pm$7.13 & 84.87$\pm$1.07 & 77.54$\pm$3.44 & 79.96$\pm$3.26 & 77.67$\pm$3.70 & 65.10$\pm$8.81 & 83.84$\pm$1.48 \\ \midrule \textbf{Ours} & & \textbf{93.16$\pm$6.10} & 84.87$\pm$1.68 & \textbf{77.99$\pm$3.16} & \textbf{80.99$\pm$2.58} & \textbf{78.00$\pm$4.89} & \textbf{66.54$\pm$7.97} & \textbf{83.91$\pm$1.27} \\ \midrule \midrule 2 & \multirow{2}{*}{\rotatebox[origin=c]{90}{$K$}} & 91.55$\pm$5.64 & 84.50$\pm$1.87 & 77.90$\pm$3.31 & 80.04$\pm$2.77 & 77.50$\pm$5.05 & 64.81$\pm$9.45 & \textbf{84.15$\pm$1.93} \\ 8 & & 93.16$\pm$6.59 & 84.65$\pm$1.17 & 77.18$\pm$2.74 & 78.69$\pm$2.99 & 77.83$\pm$4.97 & 65.71$\pm$7.95 & 84.03$\pm$2.31 \\ \midrule 1 & \multirow{4}{*}{\rotatebox[origin=c]{90}{$R$}} & 91.05$\pm$6.59 & 83.36$\pm$1.62 & 76.64$\pm$2.46 & 79.45$\pm$2.47 & 77.33$\pm$5.34 & 64.23$\pm$8.60 & 82.26$\pm$1.75 \\ 2 & & 92.11$\pm$6.68 & 84.01$\pm$1.68 & 77.45$\pm$2.92 & 79.97$\pm$3.60 & 77.83$\pm$3.77 & 65.13$\pm$8.07 & 83.35$\pm$1.36 \\ 4 & & 92.63$\pm$5.66 & 84.26$\pm$1.20 & 76.92$\pm$2.66 & \textbf{81.15$\pm$3.79} & 77.00$\pm$4.29 & 64.21$\pm$8.31 & 83.60$\pm$2.05 \\ 5 & & 92.08$\pm$6.19 & 84.55$\pm$1.23 & 77.18$\pm$1.99 & 80.64$\pm$3.11 & 77.33$\pm$3.87 & 65.38$\pm$14.31 & 83.11$\pm$1.82 \\ \midrule \textbf{Ours} & & \textbf{93.16$\pm$6.10} & \textbf{84.87$\pm$1.68} & \textbf{77.99$\pm$3.16} & 80.99$\pm$2.58 & \textbf{78.00$\pm$4.89} & \textbf{66.54$\pm$7.97} & 83.91$\pm$1.27 \\ \bottomrule \end{tabular} \end{center} \caption{Ablation studies (upper part) and sensitivity analyses (lower part) on biological graphs.} \label{table:ablation_bio_c1} \end{table*} \begin{table} \footnotesize \setlength\tabcolsep{3.5pt} \begin{center} \begin{tabular}{ @{} l|c|*{4}{c} @{} } \toprule & & \bf COLLAB & \bf IMDB-B & \bf IMDB-M & \bf RE-B \\ \midrule A1 & \multirow{3}{*}{\rotatebox[origin=c]{90}{ablation}} & 81.44$\pm$1.57 & 64.70$\pm$11.65 & 51.00$\pm$3.10 & 91.45$\pm$2.13 \\ A2 & & 82.20$\pm$1.41 & 74.80$\pm$4.18 & 49.80$\pm$6.39 & 92.95$\pm$1.94 \\ A3 & & \textbf{83.08$\pm$1.69} & 75.90$\pm$4.36 & 52.00$\pm$1.54 & 92.70$\pm$1.53 \\ \midrule \textbf{Ours} & & 82.86$\pm$1.81 & \textbf{77.20$\pm$4.73} & \textbf{52.80$\pm$2.45} & \textbf{93.15$\pm$1.58} \\ \midrule \midrule 2 & \multirow{2}{*}{\rotatebox[origin=c]{90}{$K$}} & 82.94$\pm$1.66 & 75.60$\pm$6.69 & 52.20$\pm$2.46 & 92.85$\pm$2.12 \\ 8 & & \textbf{83.10$\pm$1.80} & 74.90$\pm$5.82 & 51.67$\pm$3.99 & \textbf{93.35$\pm$1.73} \\ \midrule 1 & \multirow{4}{*}{\rotatebox[origin=c]{90}{$R$}} & 82.52$\pm$1.87 & 74.50$\pm$4.58 & 51.87$\pm$3.23 & 92.45$\pm$1.82 \\ 2 & & 82.36$\pm$2.03 & 74.80$\pm$4.73 & 51.40$\pm$3.68 & 92.65$\pm$1.73 \\ 4 & & 83.04$\pm$1.92 & 74.70$\pm$2.87 & 51.67$\pm$3.07 & 93.10$\pm$0.91 \\ 5 & & 82.64$\pm$1.44 & 74.50$\pm$6.26 & 51.13$\pm$2.93 & 92.85$\pm$1.67 \\ \midrule \textbf{Ours} & & 82.86$\pm$1.81 & \textbf{77.20$\pm$4.73} & \textbf{52.80$\pm$2.45} & 93.15$\pm$1.58 \\ \bottomrule \end{tabular} \end{center} \caption{Ablation studies (upper part) and sensitivity analyses (lower part) on social graphs.} \label{table:ablation_social_c1} \end{table} \subsubsection{Experimental Results} We first compare HGCN with existing state-of-the-art graph classification methods on seven biological datasets. Our results demonstrate that HGCN achieves the best performance based on the widely used criterion (Table \ref{table:biological_c1}) and competes favorably against three $C^*$- based baselines (Supplementary Table 5). In particular, compared with two capsule-based GNNs (i.e., GCAPS-CNN and CapsGNN), we boost of 16.17\%, 6.49\%, 3.37\%, and 2.79\% improvement on ENZYMES, MUTAG, D\&D, and NCI109, respectively. The reason is that higher-order statistical moments of local neighbors are used in GCAPS-CNN to build graph capsules, this strategy, however, fails to identify the underlying latent factors which are important in preserving node/graph property and extracting the hierarchical representations. Although this limitation can be partially alleviated by using multiple graph channels as reported in CapsGNN, the transformation matrices used in CapsGNN ignore the structure information involved in lower-level capsules. In contrast, we disentangle node representations to explicitly consider the entanglement of heterogeneous factors, and propose transformation GNNs to measure structure-aware part-whole relationships. Furthermore, it should be noted that we achieve the largest performance gains on ENZYMES which has six classes, compared to the rest of datasets with only two classes. This observation implies that HGCN is able to capture more complicated and accurate hierarchy for the multiclass classification problem than other methods. For instance, although assignment matrix-based methods (e.g., DIFFPOOL) are capable of mapping nodes to a set of clusters for structurally simple graphs, its representation power is limited to complex and crowded graphs such as ENZYMES. By contrast, our method performs iterative routing to obtain the cluster of agreement, which jointly learns the hierarchical graph representation and provides the necessary deprecation of assignment ambiguity \cite{sabour2017dynamic}. Table \ref{table:social_c1} and Table 6 (Supplementary) show the performance comparison on four social graph datasets, where the key challenge is to identify strongly connected communities. Similarly, we achieve the significant performance improvement over baseline models, indicating that HGCN can better reason about the part-whole relationships in social networks. This is also consistent with the fact that highly complex interactions are involved in social graphs, which can be modeled by identifying heterogeneous factors underlying each node. Most importantly, considering the entanglement of the latent factors enables more accurate hierarchy learning. \subsubsection{Ablation Studies} Comprehensive ablation studies are carried out in this section to understand the contribution of each component (i.e., disentangled graph capsules, capsule layers, and auxiliary graph reconstruction) in our method. Specifically, we (i) directly use the input node representation to serve as graph capsules, without considering the entanglement of heterogeneous factors (A1); (ii) remove the residual connection between adjacent capsule layers (A2); and (iii) remove the auxiliary graph reconstruction (A3). The results illustrated in Table \ref{table:ablation_bio_c1} and Table \ref{table:ablation_social_c1} (upper part) reveal that (i) disentangling node representation allows us to characterize the latent factors underlying each node and in turn more accurately preserve the node/graph properties and capture the part-whole relationship; (ii) combining fine, low layer information with coarse, high layer information provides us an ability to enhance the final graph-level representation; and (iii) graph reconstruction plays an important role in encoding the instantiation parameters of the input graph and enhancing the training stability. Thus, we reach the conclusion that each component in our method is necessary and contributes to the performance improvement. One exception is NCI1 (A2) and COLLAB (A3), where residual connection and auxiliary graph reconstruction bring inferior performance which may be caused by overfitting. \subsubsection{Sensitivity Analyses} In this section, we analyze the sensitivity of HGCN to the number of latent factors $K=\{2,8\}$ and the number of routing iterations $R=\{1,2,4,5\}$, where our method with setting: $K=4$ and $R=3$. As shown in Table \ref{table:ablation_bio_c1} and Table \ref{table:ablation_social_c1} (lower part), the results demonstrate that HGCN is not very sensitive to these two hyper-parameters. Although $K=8$ brings limited performance improvement on COLLAB and RE-B than $K=4$ (ours), the computational complexity is doubled in calculating the disentangled graph capsules. Similarly, $R=4$ requires more routing iterations, albeit with 0.16\% accuracy boost on D\&D. \section{Conclusion} In this paper, we introduce a novel HGCN framework for graph classification, which is able to explicitly extract hierarchical graph representations. Built upon disentangled graph capsules by identifying heterogeneous factors behind each node, HGCN encodes part-whole relationships by considering the structure information of lower-level parts and iteratively infer the pose of higher-level objects. Empirical studies demonstrate the superiority of our framework over existing graph classification methods on 11 commonly used benchmarks. \section{Acknowledgments} This work was partially supported by US National Science Foundation IIS-1718853, the CAREER grant IIS-1553687 and Cancer Prevention and Research Institute of Texas (CPRIT) award (RP190107).
{'timestamp': '2021-03-30T02:21:28', 'yymm': '2012', 'arxiv_id': '2012.08734', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08734'}
arxiv
\section{Conclusions} \label{sec:conclusions} We explored the To achieve this, a future research direction would be to not just model but also predict cross-device behaviour. \section{Introduction} \label{sec:introduction} Information retrieval (\acs{IR}\acused{IR}) technology is at the heart of today's e-commerce platforms, in the form of search engines, recommenders, and conversational assistants that connect users to the products they may be interested in~\citep{rowley2000product}. To help improve the effectiveness of \ac{IR} technology in an e-commerce context, the problem of analyzing, modeling, and, ultimately, predicting customers' purchase intent has been studied extensively in academia and industry~\citep{bellman1999predictors, agichtein2006learning, lo2016understanding} \header{Purchase intent prediction} Here, purchase intent is defined as a predictive measure of subsequent purchasing behavior~\citep{morwitz1992using}. \begin{figure}[h] \centering \includegraphics[clip,trim=0mm -5mm 0mm 0mm,width=0.8\columnwidth]{user_intents_5_devices.pdf} \caption{Customer journeys across sessions, with multiple interests and devices; the colors indicate different devices.} \label{fig:teaser} \end{figure} Figure~\ref{fig:teaser} illustrates the complexities of customer behavior during a sequence of sessions, when multiple tasks, interests, and devices may play a role. Areas in the back of the figure are meant to signify different user journeys across time, purple for one that is focused on fridges, yellow for one that is focused on a birthday present. Colored rectangular blocks in the front indicate different devices used by the user. Initial exploration of a relatively expensive item (a fridge) starts on a smartphone and continues on a tablet, while the journey ends with a purchase of a fridge on a PC. The purchase of a fridge is interleaved with the purchase of a (lower-priced) birthday present, with initial exploration on a PC, followed by further exploration on a TV and PC, and, ultimately, a purchase on a PC. Online search behavior that targets transactions has been analyzed at scale at least since the work by~\citet{broder-2002-taxonomy}, who identified a class of so-called \emph{transactional} queries, where the user is seeking to reach a page with more interaction opportunities, e.g., to conduct a purchase, download or sign-up. In particular, factors influencing online purchases have been described as early as in 2002~\citep{george2002influences}, and work on predicting purchases goes back to at least to the work of~\citep{ben-shimon-2015-recsys}, where the task was to predict whether a given customer is going to purchase within a given session. \header{Challenges} Despite the many advances, purchase intent prediction still has many challenges~\citep{tsagkias-2020-challenges}. In particular, previous work on purchase intent prediction has focused mostly on customers of an e-commerce platform who are identified or recognized by the platform. A diverse range of models has been considered, from traditional feature-based models such as boosted decision trees to sequence-based neural models such as RNNs. However, based on the analysis of de-identified data from an e-commerce website available to us, more than 50\% of traffic comes from anonymous users. Purchase intent detection for anonymous users is particularly challenging because it cannot rely on historical information about the user on which many of the existing models rely. \header{Features for purchase intent prediction} In this paper, we focus on identifying signals that suggest purchase intent in an anonymous and identified setting. We do this by analyzing purchase vs. non-purchase sessions sampled from a large European e-commerce website and testing the features based on our observations on a production-ready model. We further test the obtained feature sets on five other classifiers to explore the generalizability of our findings. In particular, we include features derived from session-based data such as page dwell time and customer-specific data such as the number of days since the last purchase. Session-based features have the advantage that they are available both during sessions when a user is identified (i.e., the customer has logged-in or is recognized through cookies) and anonymous sessions (when the customer is not known). Customer-related features are only available during identified sessions. Interestingly, many of the features proposed previously~\citep{seippel-2018-customer} apply only to identified sessions: \emph{purchase intent prediction for anonymous sessions has been studied very little}. To fill this gap, we analyze a dataset of more than 95 million sessions, sampled from four weeks of anonymized user interaction data in a European e-commerce platform. We answer the following research questions: {\em RQ1: How do purchase sessions differ from non-purchase sessions?} In Section~\ref{section:characterizingpurchaseintent} we compare purchase vs. \ non-purchase sessions in such aspects as session length, temporal variations, device and channel type, queries. Among others, we find out that purchase sessions tend to be longer than non-purchase ones, customers are more likely to purchase in the evening and during a weekday, and more likely to own more than 1 device. {\em RQ2: What are the important session-based features that allow us to tell purchase sessions apart from non-purchase sessions? What are the important historical features that should inform predictors for identified sessions? How does the importance of features change across the session?} Based on the experiments described in Section~\ref{section:predictingpurchaseintent}, we conclude that historical features related to previous purchasing behavior are highly important for detecting purchases in the identified setting. For the anonymous setting, however, dynamic features related to page dwell time and sequence of pages are most important. Besides, the importance of dynamic features increases as the session continues, while the importance of static features decreases. {\em RQ3: How effective are models used for purchase intent prediction for anonymous vs.\ identified sessions? Furthermore, to which degree do the proposed features help improve performance for anonymous sessions?} In Section~\ref{section:predictingpurchaseintent}, we show that in the anonymous setting, tree-based and neural classifiers demonstrate the best performance, and adding extra features to models improves $F_{1}$ by about 17\%. In contrast, for identified setting all models demonstrate high performance and adding extra features do not provide a significant gain. \noindent% The principal contributions of our research are the following: \begin{itemize}[leftmargin=*,nosep] \item We conduct an in-depth analysis of a real-world customer interaction dataset with more than 95 million sessions, sampled from a large European e-commerce platform. We identify session features such as device type and conversion rate, weekday, channel type, and features based on historic customer data such as number of previous orders and number of devices to distinguish between purchase and non-purchase sessions (see Section~\ref{section:characterizingpurchaseintent}). \item We define two feature sets for purchase prediction, tailored towards anonymous sessions and identified sessions (see~Section~\ref{section:predictingpurchaseintent}). \item We evaluate our proposed features by extending an existing production-ready model and run additional experiments with classifiers generally used for this task. We find $F_{1}$ improvements of up to 17\% in purchase intent prediction for anonymous sessions and reach an $F_{1}$ of 96\% for identified sessions on held-out data collected from a real-world retail platform (see ~Section~\ref{section:predictingpurchaseintent}). \end{itemize} \section{Dataset Description} \label{sec:dataset} In this section, we describe how we extract a dataset consisting of anonymized user interaction data from the search logs of an e-commerce platform, and summarize dataset statistics. \header{Data Collection} Our dataset comprises four weeks (28 days) of anonymized visits sampled from a European e-commerce platform in October 2019. The original sample of the log entries includes a unique non-personal customer identifier (for identified users), the type of browsing device used during the session, as well as a timestamp for every query, and a URL of each clicked page. We convert all the timestamps to the Central European Time Zone (CET). We additionally recorded the price of every product the customers have seen and the prices of the items they ended up buying. In cases where a customer starts a session without logging in and ends up logging in at a later point in the session, we assign the session to the customer. To filter out bot traffic, we apply several measures related to location and device type~\citep{bomhardt-2005-web}. First, we filter out sessions based on location, to only include entries from the European countries from which the majority of the customers come; bots come mostly from non-European IPs, especially North-America. Second, we specify the set of device types we are interested in and remove all the entries from other devices, leaving us with \emph{PC}, \emph{Smartphone}, \emph{Tablet}, \emph{Game Console}, and \emph{TV}; bots often do not specify a device type. \header{Dataset Statistics} Table~\ref{tab:ds_stats} provides descriptive statistics of the resulting dataset. Overall, the dataset contains \numprint{95757177} sessions, out of which \numprint{54144152} (about 56.5\%) are anonymous. In total, the dataset contains \numprint{9663509} identified users. We additionally keep track of the device types used for browsing and distinguish between five such device types: PC, smartphone, tablet, game console, and TV. The table also lists the number of search queries; these are the queries submitted during the sessions captured in the log. \begin{table}[!htb] \caption{Dataset statistics.} \label{tab:ds_stats} \begin{tabular}{lr} \toprule \bf Description & \bf Total \\ \midrule Sessions & \numprint{94402590} \\ \quad Anonymous & \numprint{55305709} \\ \quad Logged-in or recognized & \numprint{39096881} \\ Logged-in or recognized customers & \numprint{6125781} \\ Queries & \numprint{31185176} \\ \multirow{2}{*}{Device types} & \multicolumn{1}{l}{PC, Smartphone, Tablet,} \\ & \multicolumn{1}{l}{Game Console, TV} \\ \bottomrule \end{tabular} \end{table} \section{Predicting Purchase Intent} \label{section:predictingpurchaseintent} Next, we turn to predict purchase intent when a user is anonymous (``anonymous setting'') and when a user is logged-in or recognized (``identified setting''). The goal of our experiments is to evaluate how the features which we discovered during dataset exploration influence purchase predictor performance in both settings. To accomplish this, we derive a feature set for each setting, and evaluate the features by adding them to an existing production-ready model, based on a Random Forest. To showcase the generalizability of our findings, we additionally test the impact of our features on five additional popular classifiers. To investigate how the models' ability to predict purchase evolves throughout a session, we evaluate all models on 11 session steps (corresponding to the visits of 10 pages). We are interested in longer sessions because the outcome of such sessions is more difficult to predict. As we do not want to evaluate the model's performance on the very last step, (where the outcome is clear), we set up a buffer of 2 pages. Therefore, we filter out all the sessions which are shorter than 12 pages. We conclude the section by analyzing the features which contributed most to the model performance in both the anonymous and the identified setting, and explore how dynamic and static feature importance change as the session continues. \subsection{Experimental Setup} \label{subsec:exper_setup} In this section, we discuss the feature sets which we use in the experiments for the anonymous and identified setting, the models on which we test the features, and the evaluation setup. \header{Feature sets} We start by designing a set of features for purchase prediction in identified and anonymous user settings. Since our initial analysis demonstrated that about 56\% of all sessions are anonymous (see Table~\ref{tab:ds_stats}), it is worth to pay special attention to this category. Based on the findings obtained thus far and on an analysis of best-performing features available in the literature \citep{hop2013web, lee2015online, niu2017predictive, seippel-2018-customer}, we compile a feature set presented in the Table~\ref{tab:feature_set}. \begin{table}[!h] \caption{Complete feature set. ``Dynamic'' indicates that a feature may change during a session.} \label{tab:feature_set} \begin{tabular}{llcc} \toprule \multicolumn{2}{l}{\bf Feature} & \bf Dynamic & \bf Baseline \\ \midrule \multirow{8}{*}[-0.1cm]{\rotatebox{90}{Session}} & current page dwell time, mean & \checkmark & \checkmark\\ & current page dwell time, $\sigma$ & \checkmark & \checkmark \\ & page sequence score & \checkmark & \checkmark \\ & number of pages & \checkmark & \checkmark\\ & channel type \\ & start hour \\ & week day \\ & device type \\ & device conversion rate \\ \midrule \multirow{9}{*}[0.5cm]{\rotatebox{90}{History}} & number of orders & & \checkmark \\ & days since last purchase & & \checkmark \\ & number of sessions \\ & number of devices \\ & device sequence score \\ & switch probability \\ \bottomrule \end{tabular} \end{table} We categorize features into two classes: \emph{session features} and \emph{customer history features}. We derive session features from the information of the given session and base customer history features on the information from previous sessions of the given customer. Since we run experiments in the anonymous and the identified setting, we use different feature sets for each setting. In the anonymous setting, the information about the customer is not available and, therefore, we can only use session features. On the other hand, when a customer is identified, we can use both session and customer history features. The feature set contains both static and dynamic features. Dynamic features can change throughout the session, whereas static features remain constant. \header{Models} Next, we select models on which we evaluate the features discovered during the dataset analysis. As our primary model, we use a production-ready classifier. This is a random forest (RF) with a baseline feature set as described in Table~\ref{tab:feature_set}. Additionally, to showcase the general utility of our feature set, we experiment on additional models. After reviewing previous work in the domain of purchase prediction (see Section~\ref{sec:relatedwork}), we choose the following models for our experiments: logistic regression (LR), K-nearest neighbors (KNN), support vector machines (SVM), neural classifier, and gradient boosted decision tree (GBDT). Each model is trained on the baseline and extended feature set in both settings. \header{Prediction setup} Since we want to explore how models' performances change across sessions, we select points of a session for which we predict the probability of purchase. We define a point by the number of pages opened in the session up until the point of prediction. Overall, we select 11 points of measurement. The first point is at the very beginning of the session when the user did not open any pages yet. At this point, the classifier makes a prediction based solely on static features. The following point of measurement is right after the user opened the first page. The subsequent nine points happen after the next nine pages. To make the evaluation possible and to ensure that we do not predict for the very last session page, we filter out sessions with fewer than 12 pages, with 2 pages as a buffer. The buffer is there to avoid the situation when the model predicts at the very end of a session when the outcome is clear. Therefore, we filter out all the sessions which are less than 12 pages long. For example, in step 2 we only have a session with at least 12 actions, which is a hard setting. \header{Evaluation setup} For both settings, we evaluate model performance with 10-fold cross-validation. To account for class imbalance, we set class weights to be inversely proportional to class frequencies and use $F_{1}$ score as a primary evaluation metric. \subsection{Prediction for Anonymous Users} First, we evaluate how the added features influence model performance in the anonymous setting, where the user is not known. \header{Setup} For the anonymous setting, we sampled \numprint{22982} sessions. We use the data to create a feature set for the baseline model and our model. In the anonymous setting, there is no available information about customer history, therefore, we only use session features (see Table~\ref{tab:feature_set}. As can be seen from the table, the baseline feature set comprises four dynamic features, whereas the extended feature set offers five extra features. Since we predict purchase for different points in the session, we compute all dynamic features for a particular session point on which we evaluate. For each session point, we train the baseline and extended model on the obtained feature sets. \header{Results} The results in Figure~\ref{fig:results} show that the additional features boost model performance across all session steps. The performance boost is especially significant at step 0 when a customer has not opened any pages yet. In general, tree-based models (RF and GBDT) and the neural classifier demonstrate the highest scores across all steps. The models are followed by SVM, LR, and KNN classifiers. The performance of all the models with the baseline feature set improved on step 1. The gain can be explained by the introduction of dynamic session features (step 0 means that the user did not open any pages yet, hence, no dynamic session features). Conversely, for models with the extended feature set, the introduction of dynamic features on step 1 does not significantly increase the performance. After step 1, models' performances reach a plateau. \subsection{Prediction of Identified Users} Second, we test models' performances with baseline and extended feature sets in identified setting, when the user is known. \header{Setup} For the identified setting, we sampled \numprint{6319} sessions. The feature set for this setting includes session and customer history features (see Table~\ref{tab:feature_set}). During our experiments, we found out that information about the previous session device (such as device type and conversion rate) decrease model performance, so we excluded those features from the training and evaluation sets. This can be explained by the fact that the information about what kind of device users previously used and what was the probability of purchase on that device is not relevant for predicting purchase on the current device. In analogy with the anonymous setting, we prepare feature sets for each of the eleven session points and train and evaluate the models with the baseline and extended feature sets. \header{Results} Figure~\ref{fig:results} shows the performance of the models. Overall, the performance of all models for both baseline and extended feature sets and across all steps stays around 96\%. The only exception is the k-nearest neighbors classifier where adding extra features on step 0 increases the model's performance by 6.74\%. On step 1, however, the gain from the extended feature set is not present. This can be explained by the introduction of the dynamic session features. \subsection{Feature Importance Analysis} The experimental results raise a natural question that is 'Which features contribute most to model performance in both settings?' To answer this question, we look at the feature importance scores of a production-ready classifier which shows one of the best performances in both settings, random forest. Figure~\ref{fig:rf_anon_feat_imp} (top) demonstrates that in anonymous setting, day of the week is the feature with the highest importance. It is followed by three dynamic features (standard deviation and mean of page dwell time, and Markov page sequence score), and four static features (starting hour, channel type, device type and conversion rate). \begin{figure} \centering \includegraphics[height=4.2cm]{rf_feature_importance_anon} \includegraphics[height=4.2cm]{img/rf_feature_importance_iden} \mbox{}\hspace*{16.6mm} \includegraphics[clip,trim=0mm 0mm 0mm 10mm,height=4.18cm]{img/static_feature_importances_per_step_anonymous_setting_11_steps} \caption{Feature importance for the Random Forest in the anonymous setting (top) and identified setting (center), as well as summed for static features in the anonymous setting (bottom).} \label{fig:evaluation} \label{fig:rf_anon_feat_imp} \label{fig:rf_iden_feat_imp} \label{fig:static_feature_importances} \end{figure} Figure~\ref{fig:rf_iden_feat_imp} (center) shows that in the identified user setting, number of previous orders, and number of days since last order are the features with the highest relative importance. Both features describe user historical purchasing behavior what can explain their high relative importance. The features are followed by three dynamic features (standard deviation and mean of page dwelling time, and Markov page sequence score), which also have relatively high importance in the anonymous setting. The high relative importance of the dynamic session features (standard deviation and mean of page dwelling time, and Markov page sequence score) in both settings explain the gain all models with baseline feature set got on step 1 in the anonymous setting (see Figure~\ref{fig:results}). Next, we determine how static feature importance changes across sessions. We consider the importance in the anonymous setting because the introduction of dynamic features in this setting showed an improvement. Figure~\ref{fig:static_feature_importances} (bottom) shows that static session feature importance decrease as the session evolves, which entails that the importance of dynamic features increases. On step 0 the cumulative importance of static features is 100\% because there are no dynamic features introduced. However, from step 1 the relative importance starts to drop. The figure supports the hypothesis that as the session progresses dynamic features become more important. \begin{figure*}[!h] \includegraphics[clip,trim=2mm 0mm 2mm 0mm,width=\linewidth]{models_performance} \caption{Experimental results in anonymous (anon) and identified (iden) setting, across different session steps, $F_{1}$.} \label{fig:results} \end{figure*} \section{Predicting Purchase} \label{sec:5} In this section, we formally describe our prediction task and outline the features used for prediction. For a given session, we predict whether a user is going to buy or not. We do prediction at several session steps. We define step as number of pages customer seen during session. We conduct experiments in two settings. In the first setting, we assume that users are anonymous. In the second setting, we assume that users are logged in. For a baseline, we use a model currently being deployed in the e-commerce website. After reviewing models available for the task, we choose random forest as model for our experiments. We choose this model because of the transparency feature importance of tree-based models. We analyzed features used in the literature and selected best performing features. The complete feature set is presented in the Table~\ref{tab:feature_set}. \begin{table}[!htb] \caption{Complete feature set. An asterisk * indicates that feature changes throughout the session.} \label{tab:feature_set} \begin{tabular}{ll} \hline \bf Type & \bf Feature \\ \hline \multirow{8}{*}{Session Data} & current page score* \\ & current page dwell time, mean* \\ & current page dwell time, $\sigma$* \\ & number of pages* \\ & channel type \\ & start hour \\ & week day \\ & device type \\ & device conversion rate \\ \addlinespace \multirow{8}{*}{Customer History} & number of orders \\ & days since last purchase \\ & number of sessions \\ & number of devices \\ & device sequence score \\ & switch probability \\ & previous device type \\ & previous device conversion rate \\ \hline \end{tabular} \end{table} \begin{itemize} \item Task definition: given a visit or a customer journey, predict whether the user will end up buying or not. \item data preparation process \end{itemize} \begin{figure}[] \includegraphics[width=0.8\linewidth]{device_feature_importances_per_step_anonymous_setting} \caption{Relative feature importances across session. End is the last page of the session minus buffer.} \label{fig:device_feature_importances} \end{figure} \subsection{Experimental Setup} \begin{itemize} \item model description: Random Forest with several features \item anonymous setting description \item logged-in users description \end{itemize} \subsection{Results} \begin{itemize} \item results table \item results interpretation \item Error pattern analysis \end{itemize} \section{Definitions} \label{sec:definitions} In the study, we operate with the following definitions: \begin{description} \item[Session] is a sequence of requests made by a single-end user during a visit to a particular site. Session ends if user is idle for more than 30 minutes. We define two types of sessions: purchase and non-purchase session. Purchase session is a session during which customer buys something. Non-purchase session is a session during which customer does not buy anything. \item[Session length] is a number of actions taken during given session. \item[Step] is a number of pages customer seen during given session. \item[Actions] include opening a new web page, submitting a search query. \item[Device switch] is the act of changing device type in-between sessions. \item[Moving average] \item[Moving standard deviation] \item[Markov Score] \item[Conversion rate] is a fraction of the number of visits during which a purchase was made~\cite{moe2004dynamic}. We use this metric to compare device popularity in a purchasing context. The conversion rate can be calculated as follows: \begin{equation} \text{\em Conversion rate} = \frac{\text{\em\#purchase\ sessions}}{\text{\em\#all\ sessions}} \end{equation} \item[Standardized conversion rate] is used to protect sensitive information. We present standardized conversion rates for each device; since we are interested in differences across devices types, this suffices for our purposes. The \emph{standardized conversation rate} is computed as follows: \begin{equation} \begin{split} \text{\em Standardized}&\text{\em\ conversion rate} = \\ & \frac{\text{\em Conversion rate} - \overline{\text{\em Conversion rate}}}{\sigma} \end{split} \end{equation} where: \begin{itemize} \item $\overline{\text{\em Conversion rate}}$ is the mean conversion rate per device type \item $\sigma$ is standard deviation of device-specific conversion rates \end{itemize} \end{description} \section{Characterizing Purchase Intent} \label{section:characterizingpurchaseintent} We explore customer behavior and, in particular, the difference in the behavior of purchasing and non-purchasing users. These explorations aim to identify characteristics that may help us improve the effectiveness of purchase intent predictors. We analyze several aspects of sessions, such as the length of purchase and non-purchase sessions, the temporal characteristics of sessions, and device information. Furthermore, we investigate the channels from which customers start sessions and issue queries during purchase sessions and non-purchase sessions. \subsection{Session Length} \label{subsec:sess_len} First, we examine the overall session length for purchase sessions and non-purchase sessions. Figure~\ref{fig:purchase_non_purchase_length} plots the complementary cumulative distribution function (CCDF) of the session lengths of purchase sessions and non-purchase sessions per device type. \begin{figure}[!htb] \includegraphics[width=0.8\linewidth]{cdd_visit_length_5_devices} \caption{CCDF of the session length per device type for purchase sessions (p.s.) and non-purchase sessions (non-p.s.).} \label{fig:purchase_non_purchase_length} \end{figure} As can be seen in the area between the P50 and P90 percentiles in Figure~\ref{fig:purchase_non_purchase_length}, purchase sessions are in general longer than non-purchase sessions. Moreover, the purchase session length per device varies less than the non-purchase session length per device. It can be explained by the fact that non-purchase sessions can be both very short or rather long, depending on the underlying user intents. For instance, a user could quickly look something up or spend some time exploring the catalog. On the other hand, in the case of purchase sessions, user intentions are less ambiguous. Usually, users look for a specific product that they have in mind and, upon finding it, proceed to purchase. From a device perspective, the shortest sessions take place on smartphones, whereas sessions on tablets are generally longer. The longest sessions occur on the PC, TV, and game console. This finding holds for both purchase sessions and non-purchase sessions. However, in the tail of the distributions, the distinction between purchase session length and non-purchase session length is not as clear as between the P50 and P90 percentiles. The non-purchase session length distribution on the PC has an exceptionally long tail. Overall, we can attribute these findings to the fact that smartphones have a smaller screen and are therefore less convenient for longer sessions. Tablet screens are bigger than smartphone screens; hence, the sessions can last longer. The PC screen is the biggest one, and therefore PC users exhibit event longer sessions. \subsection{Temporal Variations} Next, we look into the temporal characteristics of purchase sessions and non-purchase sessions, such as their distribution across days of the week and the sessions' starting hours. \begin{figure}[!htb] \includegraphics[width=0.8\linewidth]{day_of_week_purchase_vs_non_purchase_sessions} \caption{The fraction of purchase sessions and non-purchase sessions across days of the week w.r.t. total amount of purchase and non-purchase sessions. Most activity occurs on weekdays.} \label{fig:day_of_week_purchase_vs_non_purchase_sessions} \end{figure} First, we want to understand customer activity during the days of the week. Figure~\ref{fig:day_of_week_purchase_vs_non_purchase_sessions} shows how the number of purchase and non-purchase sessions varies across days of the week. The three most popular days for purchase sessions are Thursday, Tuesday, and Wednesday. In total, the purchase sessions of these three days amount to $48.55\%$ of all purchase sessions. On the other hand, the least popular purchase days are Sunday, Saturday, Monday, and Friday. They contribute to $51.45\%$ of purchase sessions. The observed pattern of purchase behavior hints at the fact that customers prefer to buy during weekdays, which aligns with their workweek. Besides, we conclude that the lower purchase activity on Monday and Friday attributes to their proximity to weekends. In the case of non-purchase sessions, the most active session days are Wednesday, Monday, and Thursday. Altogether, these days contribute to $58.55\%$ of non-purchase sessions. The least active days are Tuesday, Sunday, Saturday, and Friday. All the sessions of these days amount to $41.44\%$. Just like for purchase sessions, the activity for non-purchase sessions also centers around weekdays. However, the difference between the three most active days and the four least active days for non-purchase sessions is bigger than the corresponding difference for purchase sessions. For purchase sessions, the difference is only $2.9\%$, whereas, for non-purchase sessions, the difference is $17.11\%$. Moreover, Tuesday, the 2-nd most popular day for purchase sessions is the least popular day for non-purchase sessions. On the other hand, Monday, the 2-nd most popular day for non-purchase sessions is the 3-rd least popular day for purchases. The observation indicates that people need time to consider a purchase before making the buying decision. Hence, they spend Monday, the first day of the new week on considering the purchase, and the purchase itself happens on Tuesday or later in the week. In general, the most active day of the week is Wednesday, whereas the least active day is Sunday. These findings strongly suggest that user behavior depends on the day of the week. In general, people are most active on weekdays, during their workweek, their activity peaks in the middle of the week. On the other hand, at the beginning and end of the workweek, user activity is generally lower. Next, we look at user behavior on the level of the hour during which a session starts. As mentioned in Section~\ref{sec:dataset}, all the hours are represented in CET. Figure~\ref{fig:hour_of_day_purchase_vs_non_purchase_sessions} shows how purchase sessions and non-purchase sessions spread across the hours of the day. \begin{figure}[!h] \includegraphics[width=0.8\linewidth]{hour_of_day_purchase_vs_non_purchase_sessions} \caption{The fraction of purchase session and non-purchase sessions across the hours of the day w.r.t. total amount of purchase and non-purchase sessions. Most purchase sessions start in the evening.} \label{fig:hour_of_day_purchase_vs_non_purchase_sessions} \end{figure} As expected, the least active hours are in the early morning, in the period from 1 am to 3 am. That can be explained by the fact that most people sleep during the night. (Note that the majority of the e-commerce platform customers come from Europe; hence, time does not vary that much.) Moreover, the activity on the platform during the period from 10 am till 5 pm is stable both for purchase and non-purchase sessions, whereas the most active hours are in the evening, i.e., from 6 pm till 8 pm. In general, our observations correspond to the established rhythm of the daily life of the majority of people, who sleep during the night, browse e-commerce platforms both during work hours and in the evening after work. \subsection{Channel Types} Next, we look at whether channel types distributions change across purchase and non-purchase sessions. We define the following channel types: \textit{direct} where a user enters the platform directly; \textit{paid} where a user enters the platform through search engine advertisement, and \textit{organic} where a user enters the platform through a web search engine and unpaid results. Table~\ref{tab:channel_type} displays the channel distribution across purchase and non-purchase sessions. \begin{table}[!h] \caption{Channel types for purchase and non-purchase sessions.} \label{tab:channel_type} \begin{tabular}{l c c r} \toprule & \multicolumn{2}{c}{\bf Sessions} & \bf Stand\\ \bf Channel & \bf Purchase (\%) & \bf Non-purchase (\%) & \bf conv. rate \\ \midrule Direct & \textbf{\numprint{71.07}} & \textbf{\numprint{77.30}} & -0.56 \\ Paid & \numprint{16.74} & \numprint{12.92} & 0.54 \\ Organic & \numprint{11.78} & \phantom{0}\numprint{7.83} & \textbf{0.94} \\ Other & \phantom{0}\numprint{0.31} & \phantom{0}\numprint{1.05} & -1.33\\ \bottomrule \end{tabular} \end{table} \noindent% Both for purchase and non-purchase sessions, the direct channel is the most used channel to enter the platform. However, for purchase sessions, the percentage of sessions which start with the direct channel is $8.06\%$ less than the fraction of non-purchase sessions, which started with the direct channel. The second most popular channel for purchase and non-purchase sessions is a paid channel. However, in the case of this channel, the fraction of purchase sessions is $12.92\%$ bigger than the corresponding channel type fraction for non-purchase sessions. The organic channel is the third channel in terms of popularity for both session groups. The organic channel fraction for purchase sessions is $50.40\%$ bigger for purchase sessions when compared with non-purchase sessions. Overall, during purchase sessions, users are more likely to enter the platform through paid or organic channels, whereas for non-purchase sessions the direct channel is more common. It can be explained by the fact that purchasers decide to converge after being offered an advertisement or a search result that matches their interest, whereas non-purchasers may enter the platform directly to explore the catalog. \subsection{Devices} In this subsection, we investigate purchase intent from the perspective of device types. In particular, we look at the device types used by purchasers and non-purchasers and analyze device switches. \subsubsection{Device type} First, we want to understand how many users are using multiple devices and which devices customers use for purchase and non-purchase sessions. \begin{table}[!htb] \caption{User device statistics per session.} \label{tab:ds_user_device} \begin{tabular}{lrr} \toprule \bf Device(s) & \bf Purchasers (\%) & \bf Non-purchasers (\%) \\ \midrule > 1 device & 24.05 & 16.22 \\ \midrule 1 device & 75.95 & 83.78 \\ 2 devices & 22.23 & 15.39 \\ 3 devices & 1.82 & 0.82 \\ 4 devices & $\approx 0$ & $\approx 0$ \\ 5 devices & 0 & 0 \\ \bottomrule \end{tabular} \end{table} \noindent% Table~\ref{tab:ds_user_device} shows how many devices purchasers and non-pur\-chas\-ers own. The majority of users from both groups are single-device users. However, the fraction of single-device purchasers is $9.35\%$ smaller than the corresponding fraction of non-purchasers. On the other hand, the fraction of multi-device users for purchasers is $45.28\%$ bigger than the corresponding fraction for non-purchasers. In general, multi-device users represent almost a quarter of the purchasers. As the number of devices increases, the difference between purchasers and non-purchasers grows. Our observations support the statement that multi-device users tend to be more engaged~\citep{montanez2014cross}. \begin{table}[!h] \caption{Purchase and non-purchase sessions per device type and standardized conversion rates.} \label{tab:ds_device_purchase} \begin{tabular}{l @{} r r r} \toprule \multirow{2}{*}{\bf Device} & \bf Purchase & \bf Non-purchase & \bf Stand.\ \\ & \bf sessions (\%) & \bf sessions (\%) & \bf conv.\ rate \\ \midrule Smartphone & 47.00\phantom{0} & 58.09\phantom{0} & $-$0.56 \\ PC & 44.97\phantom{0} & 34.40\phantom{0} & 1.61 \\ Tablet & 8.03\phantom{0} & 7.50\phantom{0} & 0.61 \\ Game Console & 0.004 & 0.004 & $-$0.40 \\ TV & 0.001 & 0.002 & $-$1.25 \\ \bottomrule \end{tabular} \end{table} Next, we examine the distributions of purchase and non-purchase sessions across device types and device-specific standardized conversion rates; see Table~\ref{tab:ds_device_purchase}. The PC is the device with the highest conversion rate. Indeed, the fraction of purchase sessions is $30.70\%$ bigger than the fraction of non-purchase sessions. The device with the second-highest conversion rate is a tablet. For this device, purchase sessions are $7.12\%$ more frequent than non-purchase sessions. The Smartphone is the device with the second-lowest conversion rate. For this device, the number of purchase sessions is $19.10\%$ less frequent than the number of non-purchase sessions. Game consoles and TVs are relatively new devices in e-commerce; hence, sessions with these devices are relatively less frequent. Nevertheless, based on our observations, we find that the game console is a device with the third-highest conversion rate. Interestingly, its conversion rate is close to that of the smartphone. It can be explained by the fact that device functionalities of smartphones and tablets in e-commerce context blur due to the similarity of their interfaces and screen sized. The number of purchase sessions on a game console is $15.47\%$ less than the number of non-purchase sessions. The TV is the least common device, with the lowest conversion rate. The number of purchase sessions on this device is $34.01$ less than the number of non-purchase sessions. We can explain our findings by the fact that customers use different devices for different purposes. For example, PCs and tablets seem to be used for the purchase, whereas smartphones, game consoles, and TVs for exploration. \subsubsection{Device switches} Next, we analyze how users switch between devices before a purchase session. \begin{figure}[!h] \includegraphics[width=0.9\linewidth]{5_devices_transitions_incl_self_transitions_1} \caption{Device transition probability before a purchase session, including self-transitions. The thickness of an arrow indicates the connection strength; the dashed line is the weakest connection.} \label{fig:device_transitions_incl_self_transitions} \end{figure} Figure~\ref{fig:device_transitions_incl_self_transitions} shows device transition probability, including self-transi\-tions. Generally, the situation when a user remains on the same device is the most likely outcome for all devices, except TV. There, the self-transition probability is lower than the probability of switching from TV to PC, a device with the highest self-transition probability. A probability of remaining on a smartphone is $5.03\%$ lower than a self-transition probability for PC, whereas a probability to remain on a tablet is $17.28\%$ lower than the probability to remain on PC. The game console has the second-lowest self-transition probability. Next, we consider connections between two different devices. We characterize those interconnections based on how likely a user is to switch from one device to another one and vice versa. \paragraph{Strong interconnections} Some pairs of devices have high probability interconnections. The strongest connection is between a smartphone and a PC, the two most popular devices. The second strongest connection is between PC and tablet. There is a bigger discrepancy between probability rates, with the probability of switching to PC being $656.86\%$ higher than of switching to tablet. The third strongest interconnection is between a smartphone and a tablet with a stronger connection switch to a smartphone, a more popular device. The probability of switching to a smartphone is $399.17\%$ higher than switching to a tablet. Overall, the three interconnections form a triangle that includes the three most popular devices: PC, smartphone, and tablet. \paragraph{One-sided interconnections} For a one-sided interconnection there is a high probability of switching from one device to another, but a close to zero probability of switching back. There are six cases of this type in Figure~\ref{fig:device_transitions_incl_self_transitions}. TV is the device with the largest number of one-sided interconnections, with PC, smartphone, tablet, and game console. In all cases, the transition probability is low when TV is a target device, which can be explained by relative difficulty to purchase on TV. The strongest one-sided interconnection is between TV and PC. The probability of switching from TV to PC is $43.75\%$, the highest transition probability for TV, and the highest probability to transition to another device. We explain this by the fact that PC is one of the most popular devices for purchase. The second most likely device people switch to from TV is a smartphone, whereas a probability to switch to a tablet or game console is $6.25\%$. Another device with a significant number of one-sided interconnections is the game console. Apart from the connection with TV discussed above, the device also has this connection type with smartphone and PC. The transition probability is close to zero when a game console is a target device. Unlike the situation with TV, came console has a higher probability of switching to a smartphone, whereas the probability of switching to PC is $1.75\%$ less. In general, all one-sided interconnection cases include switching from a less common device type such as game console or TV to a more conventional device, such as PC, smartphone, or tablet. \paragraph{Weak interconnections} In some cases, the switch between two devices rarely happens, i.e., the transition probability is close to zero. As can be seen in Figure~\ref{fig:device_transitions_incl_self_transitions}, there is only one case of this type. It is a connection between a game console and a tablet. \medskip\noindent% Overall, the analysis of device switches before a purchase session supports the conclusion that users tend to switch from less popular devices such as TV and game console to more popular ones such as PC, smartphone, and tablet. \subsection{Queries} The next aspect of purchase intent that we examine is queries. We look at the number of queries in purchase and non-purchase sessions and per device type. In total, the dataset contains \numprint{31185176} queries, \numprint{1302195} or 4.17\% of which are unique. Given the number of sessions in the dataset, we can conclude that queries are infrequent. \begin{table}[!h] \caption{Queries per session for purchase and non-purchase sessions per device type, percentages are computed w.r.t. total number of queries per purchase or non-purchase session.} \label{tab:ds_device_query} \begin{tabular}{l @{} rr rr} \toprule \multirow{2}{*}{\bf Device} & \multicolumn{2}{c}{\bf Purchase sessions} & \multicolumn{2}{c}{\bf Non-purchase sessions}\\ \cmidrule(r){2-3}\cmidrule{4-5} & \bf query/session & \bf \% & \bf query/session & \bf \% \\ \midrule Smartphone & $ 4 $ & \textbf{52.92} & $ 0.05$ & 42.40 \\ PC & $ 2 $ & 36.38 & $0.09$ & \textbf{57.54} \\ Tablet & $ 4 $ & 10.67 & $0.0003$ & 0.049 \\ Game Console & $\approx 0$ & $\approx 0$ & $\approx 0$ & $\approx 0$ \\ TV & $\approx 0$ & $\approx 0$ & $\approx 0$ & $\approx 0$ \\ \midrule Avg & $3.16$ & 100 & $0.06$ & 100 \\ \bottomrule \end{tabular} \end{table} Table~\ref{tab:ds_device_query} shows the query per session frequencies across five devices for both purchase and non-purchase sessions. Besides, it also demonstrates which devices are most popular for querying during purchase and non-purchase sessions. Overall, queries are more common in purchase sessions. This can be explained by the fact that querying is more likely to happen when customers are determined to buy something. Naturally, queries are most common for smartphones, PCs and tablets, and uncommon for game consoles and TVs. Indeed, the current interface of game console and TV makes it difficult to type queries, especially when compared to a PC or a smartphone. The PC has the highest query per session frequency for non-purchase sessions and second-highest frequency for purchase sessions. A smartphone has the second-highest query per session frequency for non-purchase sessions and the highest query frequency per non-purchase session. Tablet, on the contrary, has the third-highest frequency for non-purchase sessions and the highest frequency for purchase sessions. When it comes to query distributions per device for purchase and non-purchase sessions, the ranking is somewhat consistent for both groups. During purchase sessions, most queries are issued on a smartphone, whereas during non-purchase sessions PC prevails. On the other hand, PC is the second most popular device for purchase sessions, whereas for non-purchase sessions smartphone takes the second place. Tablet is third for both groups. In general, the query distribution across devices correlates with the session distribution across devices (see Table~\ref{tab:ds_device_purchase}). \begin{table}[!h] \caption{Unique query counts for purchase and non-purchase sessions per device type. The percentage is computed w.r.t. total number of queries per purchase or non-purchase session.} \label{tab:ds_device_unique_query} \begin{tabular}{l rr rr} \toprule \multirow{2}{*}{\bf Device} & \multicolumn{2}{c}{\bf Purchase sessions} & \multicolumn{2}{c}{\bf Non-purchase sessions}\\ \cmidrule(r){2-3}\cmidrule{4-5} & \bf count & \bf\% & \bf count & \bf \% \\ \midrule Smartphone & \numprint{180542} & 36.89 & \numprint{321640} & 39.57 \\ PC & \numprint{224763} & 45.92 & \numprint{312855} & 38.49 \\ Tablet & \numprint{83881} & 17.14 & \numprint{175909} & 21.64 \\ Game Console & \numprint{136} & 0.03 & \numprint{1841} & 0.23 \\ TV & \numprint{46} & 0.01 & \numprint{582} & 0.07 \\ \midrule Total & \numprint{489368} & 1.91 & \numprint{812827} & 14.52 \\ \bottomrule \end{tabular} \end{table} \noindent% Next, we look at the number of unique queries for purchase and non-purchase sessions and per device. Table~\ref{tab:ds_device_unique_query} shows unique queries count and their corresponding fractions. The fractions are computed w.r.t. the total number of queries per session type and device. Overall, during purchase sessions users issue less unique queries, it holds for every device class but a PC. This can be explained by the fact that during purchase sessions users may retype a previous query to revisit the results they have seen earlier, whereas non-purchasers want to explore and hence use more unique queries. \subsection{Purchase Intent Characteristics} What have we learned from the log analysis conducted in this section that might help us to devise better models for purchase intent prediction? We found out that purchase sessions tend to be longer what suggests that session length is an essential indicator of purchase intent. Besides, the difference in session length depends on the type of device customer use. Moreover, we discovered how the day of week and hour of the day influence purchase behavior. In particular, customers are more likely to buy during the weekdays and in the evening. From the perspective of channels, there is a difference, too. In particular, for non-purchase sessions, the direct channel is more common, whereas purchase sessions are more likely to start with paid or organic channels. From the device perspective, we found out that multi-device users are more common among purchasers. Besides, we figured the probability of purchase for every device and characterized transitions between devices. After looking into queries in the dataset, we discovered that during purchase sessions, users issue more queries per session. Besides, during purchase session, there are less unique queries. \section{Modeling Purchase Intent} \label{sec:modelingpurchaseintent} Next, we use our insights from the previous section to boost purchase intent prediction performance. Since our initial analysis demonstrated that about 56\% of all sessions are anonymous (see Table~\ref{tab:ds_stats}), it is worth to pay special attention to this category. Thus, we analyze model performance in two settings: when a user is anonymous (the anonymous setting) and when a user is logged in (the identified setting). Based on the findings obtained thus far and on an analysis of best-performing features available in the literature \citep{hop2013web, lee2015online, niu2017predictive, seippel-2018-customer}, we compile a feature set presented in the Table~\ref{tab:feature_set}. Initially, we added information about previous device type and conversion rate, but we subsequently excluded it from the set because the features decreased classifier performance. We categorize features into two classes: session features and customer history features. We derive session features from the information of the given session and base customer history features on the information from previous sessions of the given customer. Since we run experiments in anonymous and identified setting, we use different feature set for each setting. For anonymous setting, when a customer is not known, the information about the customer is not available and, therefore, we can only use session features. On the other hand, when a customer is identified, we can use both session and customer history features. The feature set contains both static and dynamic features. Dynamic features can change throughout the session, whereas static features remain constant. After reviewing previous work in the domain of purchase prediction (see Section~\ref{sec:relatedwork}), we choose several models for our experiments: logistic regression, K-nearest neighbors, support vector machines, neural classifier, gradient boosting decision tree, and random forest. \begin{table}[!h] \caption{Complete feature set. ``Dynamic'' indicates that a feature may change during a session.} \label{tab:feature_set} \begin{tabular}{llcc} \toprule \multicolumn{2}{l}{\bf Feature} & \bf Dynamic & \bf Baseline \\ \midrule \multirow{8}{*}[-0.1cm]{\rotatebox{90}{Session}} & current page dwell time, mean & \checkmark & \checkmark\\ & current page dwell time, $\sigma$ & \checkmark & \checkmark \\ & page sequence score & \checkmark & \checkmark \\ & number of pages & \checkmark & \checkmark\\ & channel type \\ & start hour \\ & week day \\ & device type \\ & device conversion rate \\ \midrule \multirow{9}{*}[0.5cm]{\rotatebox{90}{History}} & number of orders & & \checkmark \\ & days since last purchase & & \checkmark \\ & number of sessions \\ & number of devices \\ & device sequence score \\ & switch probability \\ \bottomrule \end{tabular} \end{table} \section{Discussion \& Conclusion} \label{sec:discussionandimplications} In this paper, we have carried out an analysis of user purchase intent in e-commerce. We have analyzed four weeks of session logs from a European e-commerce platform to identify signals in user behavior that can imply purchase intent. We have considered aspects such as session length, day of the week, and session start hour, as well as information about device, channel, and queries. In the second part of our study, we have analyzed the relevance of the discovered signals by running a series of experiments aimed at purchase intent prediction in the anonymous and identified settings. We tested the features on random forest, the model which fits production requirements. Additionally, we tested the features on five other models. The experiments demonstrated the value of the features that we engineered based on our insights into the data. We explored which features contribute to performance improvement. One of the implications of our study is enhanced understanding of purchasing user behavior in e-commerce. Understanding the behavior is the first step towards modeling it, as we demonstrated in the second part of the paper. Modeling user behavior can contribute towards reducing friction in the customer journey and, therefore, to better customer experience. Besides, we explored the topic of detecting the purchase intent of anonymous users. We showed that, while anonymous users contribute to more than half of the traffic, their user intent is harder to detect because all the predictions have to be made without knowledge about the prior behavior. Our research has several limitations; one of them is limited generalizability. Even though the data we use in our study comes from a dominant e-commerce platform, it is still only one platform. Hence, it would be interesting to verify the findings against other e-commerce platforms and explore the differences. Moreover, we sampled four weeks of data, thereby introducing a sample bias that could make our findings sensitive to unknown temporal or seasonal patterns. Therefore, it would be interesting to explore if expanding our dataset will lead to new insights. For example, if we had several months of data, we could explore how user purchase intent changes across different months or seasons. Furthermore, we evaluated our purchase intent prediction models in an offline setting. The next logical step is to evaluate them in an online setting. Future research on the topic includes several directions. First, there is an opportunity to continue research into general purchase behavior analysis and modeling in e-commerce. It would be interesting to explore more aspects of purchasing behavior and try out more models. Another direction for further research concerns predicting purchase intent for anonymous users. Another exciting direction for further research includes modeling device-specific purchase behavior. It can include both relatively common devices such as PC, smartphone, and tablet, and relatively less popular and studied devices such as TV or game console. \section{Reproducibility} All plots for our paper, as well as the code to regenerate them, can be found in our Git repository:\\ \url{https://github.com/mariyahendriksen/purchase_intent}. \section{Related Work} \label{sec:relatedwork} \header{E-commerce user purchase behavior analysis} Research on understanding online users' purchasing behavior has been ongoing since the very beginning of e-commerce~\citep{bellman1999predictors}. Studies have investigated user motivation~\citep{bellman1999predictors}, factors that influence e-commerce adoption~\citep{o2003web}, as well as purchasing behavior~\citep{brown2003buying, hsu2006longitudinal}, with a focus on perceived security~\citep{salisbury2001perceived, george2002influences}, the decision-making process~\citep{senecal2005consumers}, and purchaser profiles~\citep{swinyard2004activities, hernandez2011age}. Besides, there has also been work on user behavior on content discovery platforms and its relationship to subsequent purchases~\citep{lo2016understanding} as well as work dedicated to the identification of a taxonomy of product search intents and the prediction of user satisfaction~\citep{su2018user}. Unlike previous work, our study focuses on the exploration of user purchasing behavior by comparing purchase vs. non-purchase sessions. Besides, we analyze the data from the perspective of device types, and explore aspects such as session length, price of the seen products from the perspective of different devices. On top of that, we also look into the way customer switches between devices. \header{Purchase prediction in e-commerce} The problem of e-commerce user behavior modeling has been studied from various angles, such as building multiple classifiers based on genetic algorithms~\cite{kim2003combination}, mining purchase patterns with association rules and using those patterns for purchase prediction~\cite{suh2004prediction}. Research has been focused on creating models robust to noise in session data~\cite{agichtein2006learning}, and using a recurrent neural network to predict customer behaviour~\cite{lang2017understanding}. \citet{sismeiro2004modeling} predict purchasing task completion for a given user who completed at least one task earlier, whereas \citet{cheng2017predicting} explore user behavior on a content discovery platform to determine intent specificity and time in the future when a purchase is estimated to take place. Some work in the field focuses on using queries for purchasing behavior modeling. For instance, ~\citet{dai2006detecting} predict purchase based on input query. Besides using general session data, there has been work that incorporates demographic data and perceived attributes~\cite{young2004predicting}, scrolling and mouse movements~\cite{guo2010ready}, payment data~\cite{wen2018customer}, log-trace data~\cite{tao2019log2intent}, and phone touch actions~\cite{guo2019buying}. There has been work on analyzing behavioral patterns and the exploration of different model architectures. In particular, support vector machines, K-nearest neighbor approach, random forest, and logistic regression were used~\citep{lee2015online, suchacka2015k, niu2017predictive}. Unlike previous work in this domain, our study focuses on purchase prediction with two types of users, identified and anonymous. Therefore, we develop two models, run them in two settings, and evaluate their results. The possibility to experiment with identified users also allows us to leverage information from previous user sessions, such as user purchasing history and the number of devices a user owns. In contrast, anonymous users contribute to a higher share of traffic, which makes it important to understand their behavior too. Additionally, we explore how the relevance of dynamic and static features changes as a session progresses. \section{Background and Definitions} \label{sec:backgroundanddefinitions} In our study, we operate with the following definitions. A \textit{session} is a sequence of requests made by a single end-user during a visit to a particular site. A session ends if the user is idle for more than 30 minutes. We define two types of sessions: \textit{purchase sessions}, during which the customer buys an item, and \textit{non-purchase sessions}, during which the customer does not buy anything. In connection to this, we define \emph{purchasers} as customers who had at least one purchase session, whereas \emph{non-purchasers} are customers who were identified but have never purchased anything. We furthermore distinguish between \textit{identified sessions}, where a customer is logged in or recognized with a browser cookie, and \textit{anonymous} sessions where this is not the case. Additionally, we denote the number of actions taken during a given session as the \textit{session length}, where an \textit{action} corresponds to opening a new web page, submitting a search query, or adding/removing an item to/from the shopping basket. \textit{Device switch} is the act of changing the type of browsing device between two consecutive sessions that belong to the same journey. For instance, if a customer first explores the platform on a smartphone and afterward accesses the platform on a PC, she switches from a smartphone to a PC. A \textit{channel} indicates the way through which a customer enters the platform. For example, if the customer comes to the platform via an advertisement, she uses a paid channel. The \textit{conversion rate} denotes the fraction of visits during which a purchase was made~\citep{moe2004dynamic}. We use this metric to compare device popularity in a purchasing context. We calculate the conversion rate by dividing the number of purchasing sessions by the overall number of sessions. In order to protect sensitive information, we only report \textit{standardized conversion rates} for each device; since we are interested in differences across devices types, this suffices for our purposes. The standardized conversion rate is computed by subtracting the mean conversion rate per device type from the desired conversion rate and dividing the result by the standard deviation of the device-specific conversion rate. For instance, if our device specific conversion rates are $\text{\em Conversion Rates} = \{0.5, 0.2, 0.3\}$, the mean of device-specific conversion rates is $\overline{\text{\em Conversion Rate}} = 0.33$ and the standard deviation of conversion rates is $\sigma = 0.12$. Therefore, the resulting standardized conversion rates are $\text{\em Standardized Conversion}$ $\text{\em Rates} = \{1.34, -1.07, -0.27\}$ \section{Dataset Description} \label{sec:3} We start by distinguishing two search schemes and explaining how we define each of the two. Afterward, we describe how exploratory and purchasing sessions were mined from the search logs and summarize dataset statistics. \subsection{Definitions} \label{subsec:definitions} The data set we use comprises 4 weeks of sessions sampled from a European e-commerce website. In the study, we operate with the following definitions: \begin{description} \item[Session] is a sequence of requests made by a single-end user during a visit to a particular site. Session ends if user is idle for more than 30 minutes. We define two types of sessions: purchase and non-purchase session. Purchase session is a session during which customer buys something. Non-purchase session is a session during which customer does not buy anything. \item[Session length] is a number of actions taken during given session. \item[Step] is a number of pages customer seen during given session. \item[Actions] include opening a new web page, submitting a search query. \item[Device switch] is the act of changing device type in-between sessions. \item[Moving average] \item[Moving standard deviation] \item[Markov Score] \item[Conversion rate] is a fraction of the number of visits during which a purchase was made~\cite{moe2004dynamic}. We use this metric to compare device popularity in a purchasing context. The conversion rate can be calculated as follows: \begin{equation} \text{\em Conversion rate} = \frac{\text{\em\#purchase\ sessions}}{\text{\em\#all\ sessions}} \end{equation} \item[Standardized conversion rate] is used to protect sensitive information. We present standardized conversion rates for each device; since we are interested in differences across devices types, this suffices for our purposes. The \emph{standardized conversation rate} is computed as follows: \begin{equation} \begin{split} \text{\em Standardized}&\text{\em\ conversion rate} = \\ & \frac{\text{\em Conversion rate} - \overline{\text{\em Conversion rate}}}{\sigma} \end{split} \end{equation} where: \begin{itemize} \item $\overline{\text{\em Conversion rate}}$ is the mean conversion rate per device type \item $\sigma$ is standard deviation of device-specific conversion rates \end{itemize} \end{description} \subsection{Dataset Sampling} The data set we use comprises 4 weeks (28 days) of anonymized visits sampled from a European e-commerce website for October 2019. Log entries include a unique customer identifier, the class of device the customer used during the session, a timestamp for every query and a URL of each clicked page. Besides, we also keep track of the price of every product the customer has seen and the price of the item(s) he or she ended up buying. In cases where a customer starts a session without logging in and ends up logging in at a later point in the session, we assign the session to the customer. To filter out bots traffic, we apply several measures related to device type, location, and visit length. First, we specify a set of particular device types we are looking for and remove all the entries from different devices. Moreover, we filter out based on location, including only entries from the European countries from which the majority of the customers come from. Besides, we specify visit length, which allows us to get rid of both very short, uninformative visits and abnormally long visits of crawlers~\citep{bomhardt-2005-web}. \subsection{Dataset Statistics} TBA \begin{table}[!htb] \caption{Dataset statistics.} \label{tab:ds_stats} \begin{tabular}{ll} \toprule \bf Description & \bf Total \\ \midrule Sessions (total) & \numprint{95757177} \\ Sessions (logged-in customers) & \numprint{41705176} \\ Sessions (anonymous customers) & \numprint{54144152} \\ Identified customers & \numprint{9663509} \\ Queries & \numprint{42927} \\ Devices & PC, Smartphone, Tablet, Game Console, TV \\ \bottomrule \end{tabular} \end{table} \section{Dataset Description} \label{sec:3} \todo{Due: Dec 6} We start off by distinguishing two search schemes and explaining how we define each of the two. Afterwards, we describe how exploratory and purchasing sessions were mined from the search logs and summarize dataset statistics. \subsection{Definitions} This sections describes all the definitions related to the dataset. Visit is a Conversion rate is a fraction of visits during which purchase was made (CITE). It can be calculated as follows: TBA \begin{equation} Conversion\ rate = \frac{purchase\ visits}{all\ visits} \end{equation} Customer journey We define \textit{distance} between two consecutive sessions $s_t$ and $s_{t+1}$ as the time difference between the last action in the session $s_t$ and the first action of session $s_{t+1}$. \subsection{Dataset Sampling} This section explains how dataset was sampled and preprocessed. \subsection{Dataset Statistics} This section describes general dataset statistics and The dataset statistics is present in the Table~\ref{tab:ds_stats}. From the Table~\ref{tab:ds_stats}, it is clear that an average length of the visits in terms of actions is about six times longer for the sessions where users completed purchase as opposed to the visits where users did not purchase anything. \begin{table}[!htb] \caption{Dataset statistics.} \label{tab:ds_stats} \begin{tabular}{lrrr} \toprule Description & Purchase & Non-purchase & Total \\ \midrule Data size, GB & \numprint{74.12} & \numprint{80.8} & \numprint{0} \\ Sessions & \numprint{3531267} & \numprint{27719626} & \numprint{0} \\ Visits & \numprint{3649993} & \numprint{38055183} & \numprint{0} \\ \addlinespace Rows & \numprint{175725615} & \numprint{234326049} & \\ Avg. visit length & \numprint{48.14} & \numprint{6.16} & \\ Customers & \numprint{0} & \numprint{0} & \\ TBA & \numprint{0} & \numprint{0} & \\ \bottomrule \end{tabular} \end{table} As can be seen form the Table~\ref{tab:ds_device}, the most popular device types are phone and desktop. Interestingly, most purchase visits are from desktop, whereas for most non-purchase visits, phone is prevailed over desktop by $\approx 1\%$. \begin{figure} \includegraphics[width=\linewidth]{purchase_visit_frequency_per_user} \caption{How many purchasing visits one customer had. The plot demonstrates that about 72\% of customers had only 1 purchasing visit, 28\% - more than one.} \label{fig:purchase_visit_freq} \end{figure} \begin{table}[!htb] \caption{Dataset characteristics from the device perspective.} \label{tab:ds_device} \begin{tabular}{lrrrr} \toprule \multirow{2}{*}{Device} & \multicolumn{2}{c}{Purchase visits} & \multicolumn{2}{c}{Non-purchase visits} \\ \cmidrule(r){2-3}\cmidrule{4-5} & size, gb & percentage & size, gb & percentage \\ \midrule Phone & \numprint{29.85} & 40.28 & 37.55 & 46.48 \\ Desktop & 38.40 & 51.81 & 36.56 & 45.25 \\ Tablet & 5.86 & 7.91 & 6.68 & 8.27 \\ Game Console & $4.49 \times 10^{-3}$ & $\approx 0$ & $6.43 \times 10^{-3}$ & $\approx 0$ \\ TV & $9.11 \times 10^{-4}$ & $\approx 0$ & $1.86 \times 10^{-3}$ & $\approx 0$ \\ \addlinespace Total & 74.11 & 100 & 80.79 & 100 \\ \bottomrule \end{tabular} \end{table} \begin{table}[!htb] \caption{User device statistics. \todo{Should I make it bar chart with two variables? It leaves out some data, but shows a clear pattern}} \label{tab:ds_user_device} \begin{tabular}{lrrrr} \toprule \multirow{2}{*}{Device(s)} & \multicolumn{2}{c}{Purchasers} & \multicolumn{2}{c}{Non-purchasers} \\ \cmidrule(r){2-3}\cmidrule{4-5} & users & percentage & users & percentage \\ \midrule Any Device & \numprint{2575877} & 100 & \numprint{5795495} & 100 \\ > 1 device & \numprint{173965} & 6.75 & \numprint{1330202} & 22.95 \\ \addlinespace 1 device & \numprint{2401912} & 93.25 & \numprint{4465293} & 77.05 \\ 2 devices & \numprint{169611} & 6.58 & \numprint{1232975} & 21.27 \\ 3 devices & \numprint{4353} & 0.17 & \numprint{97172} & 1.68 \\ 4 devices & \numprint{1} & $\approx 0$ & \numprint{55} & $\approx 0$ \\ 5 devices & \numprint{0} & 0 & 0 & 0 \\ \bottomrule \end{tabular} \end{table} \begin{comment} \begin{figure} \includegraphics[width=\linewidth]{user_device_chart} \caption{Fraction of users who own 1, 2, 3, 4, 5 devices. Temporary chart.} \label{fig:user_device} \end{figure} \end{comment} Table~\ref{tab:ds_user_device} shows that majority of users from both groups use only one device. What is more a bigger fraction of purchasers stick to one device when compared to non-purchasers. In case with two- and three-device users, the situation is opposite: non-purchasers fraction if bigger. We would like to know what kind of devices users end up buying with. We count purchasing visits per device and compare counts with non-purchasing visits. The answer is present in the Table~\ref{tab:ds_device_purchase}. As can be seen, the most popular device for purchases is mobile phone, however, desktop has highest conversion rate. \begin{table}[!htb] \caption{Purchase visit counts across devices.} \label{tab:ds_device_purchase} \begin{tabular}{l rr rr r} \toprule \multirow{2}{*}{Device} & \multicolumn{2}{c}{Purchase visits} & \multicolumn{2}{c}{Non-purchase visits} & \multirow{2}{*}{Conv. rate} \\ \cmidrule(r){2-3}\cmidrule{4-5} & visits & percentage & visits & percentage \\ \midrule Phone & \numprint{1716976} & 47.00 & \numprint{22121333} & 58.09 & 7.20 \\ Desktop & \numprint{1642820} & 44.97 & \numprint{13102228} & 34.40 & 11.14 \\ Tablet & \numprint{293463} & 8.03 & \numprint{2855728} & 7.50 & 9.32 \\ Game Console & \numprint{145} & $\approx 0$ & \numprint{1788} & $\approx 0$ & 7.50 \\ TV & \numprint{44} & $\approx 0$ & \numprint{695} & $\approx 0$ & 5.95 \\ \addlinespace Total & \numprint{3653448} & 100 & \numprint{38081772} & 100 & 8.75 \\ \bottomrule \end{tabular} \end{table} \section{Tmp data} \todo{Due: Dec 26} \begin{table}[!htb] \caption{Dataset characteristic from device perspective.} \label{tab:ds_device} \begin{tabular}{lrrrr} \toprule \multirow{2}{*}{Device} & \multicolumn{2}{r}{Purchases visits} & \multicolumn{2}{r}{}Non-purchase visits \\ & size, gb & percentage & size, gb & percentage \\ \midrule Phone & \numprint{29.85} & 40.28 & 37.55 & 46.48 \\ Desktop & 38.40 & 51.81 & 36.56 & 45.25 \\ Tablet & 5.86 & 7.91 & 6.68 & 8.27 \\ Game Console & $4.49 \times 10^{-3}$ & $\approx 0$ & $6.43 \times 10^{-3}$ & $\approx 0$ \\ TV & $9.11 \times 10^{-4}$ & $\approx 0$ & $1.86 \times 10^{-3}$ & $\approx 0$ \\ \addlinespace Total & 74.11 & 100 & 80.79 & 100 \\ \bottomrule \end{tabular} \end{table}
{'timestamp': '2020-12-17T02:11:33', 'yymm': '2012', 'arxiv_id': '2012.08777', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08777'}
arxiv
\section{Detailed Results of Greedy Attack} \label{appendix: greedy} \begin{figure*} \centering \begin{subfigure}{.24\textwidth} \centering \includegraphics[width=1\textwidth, height=0.7\textwidth]{figures/warning_lights_MIO-10_greedy.png} \caption{The warning lights.} \label{fig:MIO-10_warning_greedy} \end{subfigure}% \hfill \begin{subfigure}{.24\textwidth} \centering \includegraphics[width=1\textwidth, height=0.7\textwidth]{figures/distance_measurement_MIO-10_greedy.png} \caption{The manipulation on distance.} \label{fig:MIO-10_attack_distance_greedy} \end{subfigure}% \hfill \begin{subfigure}{.24\textwidth} \centering \includegraphics[width=1\textwidth, height=0.7\textwidth]{figures/velocity_measurement_MIO-10_greedy.png} \caption{The manipulation on velocity.} \label{fig:MIO-10_attack_velocity_greedy} \end{subfigure}% \hfill \begin{subfigure}{.24\textwidth} \centering \includegraphics[width=1\textwidth, height=0.7\textwidth]{figures/phase_plot_MIO-10_greedy.png} \caption{The state trajectory.} \label{fig:MIO-10_state_traj_greedy} \end{subfigure}% \caption{Greedy attack on the MIO-10 dataset.} \label{fig:attack_MIO-10_greedy} \end{figure*} \begin{figure*}[t] \begin{subfigure}{.24\textwidth} \centering \includegraphics[width=1\textwidth, height=0.7\textwidth]{figures/warning_lights_MIO+1_greedy.png} \caption{The warning lights.} \label{fig:MIO+1_warning_greedy} \end{subfigure}% \hfill \begin{subfigure}{.24\textwidth} \centering \includegraphics[width=1\textwidth, height=0.7\textwidth]{figures/distance_measurement_MIO+1_greedy.png} \caption{The manipulation on distance.} \label{fig:MIO+1_attack_distance_greedy} \end{subfigure}% \hfill \begin{subfigure}{.24\textwidth} \centering \includegraphics[width=1\textwidth, height=0.7\textwidth]{figures/velocity_measurement_MIO+1_greedy.png} \caption{The manipulation on velocity.} \label{fig:MIO+1_attack_velocity_greedy} \end{subfigure}% \hfill \begin{subfigure}{.24\textwidth} \centering \includegraphics[width=1\textwidth, height=0.7\textwidth]{figures/phase_plot_MIO+1_greedy.png} \caption{The state trajectory.} \label{fig:MIO+1_state_traj_greedy} \end{subfigure}% \caption{Greedy attack on the MIO+1 dataset.} \label{fig:attack_MIO+1_greedy} \end{figure*} In this section, we provide more detailed results of the greedy attack, including warning lights before and after attack, manipulations on measurements, and the trajectory of KF state predictions. We notice that the results are very similar for different lengths of the stealthy interval $\mathcal{T}^s$. Therefore, here we only show the results for $\mathcal{T}^s=2.5$ seconds (i.e., half of the full length) as an example. Fig.~\ref{fig:attack_MIO-10_greedy} shows the greedy attack on MIO-10, where the stealthy interval $\mathcal{T}^s=[50, 97]$. By manipulating the distance and velocity to the maximum possible value, the attacker successfully causes the FCW to output green lights in the target interval $\mathcal{T}^\dagger$. However, the attack induces side effect in $\mathcal{T}^s$, where the original yellow lights are changed to green. In contrast, our MPC-based attack does not have any side effect during $\mathcal{T}^s$. Also note that the trajectory of the KF state prediction enters ``into" the desired green region during $\mathcal{T}^\dagger$. This is more than necessary and requires larger total manipulation ($J_1$) than forcing states just on the boundary of the desired region, as does our attack. In Fig.~\ref{fig:attack_MIO+1_greedy}, we show the greedy attack on MIO+1. The stealthy interval is $\mathcal{T}^s=[51, 99]$. Again, the attack results in side effect during the stealthy interval $\mathcal{T}^s$. Furthermore, the side effect is much more severe (green to red) than that of our MPC-based attack (green to yellow). The KF state trajectory enters ``into" the desired red region, and requires larger total manipulation ($J_1$) than our attack. \section{Velocity Increase in Figure~\ref{fig:MIO+1_attack_velocity}} \label{appendix:increase} In Figure~\ref{fig:attack_MIO+1_appendix}, we show again the manipulation on the velocity measurement for the MIO+1 dataset. The attacker's goal is to cause the FCW to output red warnings in the target interval $[100,139]$. Intuitively, the attacker should decrease the distance and velocity. However, in Figure~\ref{fig:attack_MIO+1_appendix}, the attacker instead chooses to increase the velocity during interval [88,96]. We note that this is because the attacker hopes to force a very negative KF acceleration estimation. To accomplish that, the attacker first strategically increases the velocity from step 88 to 96, and then starting from step 97, the attacker suddenly decreases the velocity dramatically. This misleads the KF to believe that the MIO has a very negative acceleration. In Fig~\ref{fig:MIO+1_acc}, we show the acceleration estimation produced by KF. At step 96, the estimated acceleration is 8.1m/s$^2$. However, at step 97, the estimated acceleration suddenly drops to $-$16m/s$^2$, and then stays near $-$30m/s$^2$ until the target interval. The very negative acceleration in turn causes the KF velocity estimation to decrease quickly. The resulting velocity estimation reached around $-$10m/s during the target interval, which causes FCW to output red lights. \begin{figure}[t] \begin{subfigure}{.23\textwidth} \centering \includegraphics[width=1\textwidth, height=0.6\textwidth]{figures/acceleration_estimation_MIO+1.png} \caption{Acceleration estimation.} \label{fig:MIO+1_acc} \end{subfigure}% \hfill \begin{subfigure}{.23\textwidth} \centering \includegraphics[width=1\textwidth, height=0.6\textwidth]{figures/velocity_measurement_MIO+1.png} \caption{Manipulation on velocity.} \label{fig:attack_MIO+1_appendix} \end{subfigure}% \caption{Acceleration reduces significantly as the velocity measurement drops after step 96. This in turn causes the KF velocity estimation to decrease fast.} \end{figure} \section{Human Behavior Algorithm} \label{appendix: human} In this section, we provide an algorithmic description of the human behavior model. \begin{algorithm} \SetAlgoLined \SetKwInOut{Input}{Input} \Input{light sequence $\ell_t(1\le t\le T)$, reaction time $h^*$.} Initialize $s=0$\; \For{$t\leftarrow 1$ \KwTo $T$}{ \uIf{$t!=1$ and $\ell_{t}!=\ell_{t-1}$} { $s=0$\; } \uElseIf{$\ell_t=\text{red}$} { $s=s+1$\; } \Else { $s=s-1$\; } \uIf{$s\ge h^*$} { human applies pressure on pedal\; } \uElseIf{$s\le -h^*$} { human releases brake\; } \Else{human stays in the previous state\;} } \caption{Human Behavior Algorithm.} \end{algorithm} \section{Simulated Raw Data Processing} \label{appendix:carla-output-processing} CARLA outputs a single RGB image, a depth map image, and variable number of RADAR points for each 0.05 second time step of the simulation. We analyze this data at each time step to produce object detections in the same format of MATLAB FCW \cite{matlab-fcw}: \[ \begin{bmatrix} d^1 & v^1 & d^2 & v^2 \end{bmatrix} \] where $d^1$ and $d^2$ are the distance, in meters, from the vehicle sensor in directions parallel and perpendicular to the vehicle's motion, respectively. $v^1$ and $v^2$ are the detected object velocities, in m/s, relative to the ego along these parallel and perpendicular axes. To produce these detections from vision data, we first find bounding boxes around probable vehicles in each RGB image frame using an implementation of a YOLOv2 network in MATLAB which has been pre-trained on vehicle images \cite{matlab-yolo}. Each bounding box is used to create a distinct object detection. The $d^1$ value, or depth, of each object is taken to be the depth recorded by the depth map at the center pixel of each bounding box. The $d^2$ value of each detection is then computed as \begin{equation} d^2 = u * \frac{d^1}{l_{foc}} \end{equation} where $u$ is the horizontal pixel coordinate of the center of a bounding box in a frame, and $l_{foc}$ is the focal length of the RGB camera in pixels \cite{penn-cam-projection}. $l_{foc}$ is not directly specified by CARLA, but can be computed using the image length, 800 pixels, and the camera field of vision, 90 degrees \cite{edmund-focal-length}. To compute $v^1$ and $v^2$ for detections of the current time step, we also consider detections from the previous time step. First, we attempt to match each bounding box from the current time step to a single bounding box from the previous step. Box pairs are evaluated based on their Intersection-Over-Union (IoU) \cite{simple-real-time-tracking}. Valued between 0 and 1, a high IoU indicates high similarity of size and position of two boxes, and we enforce a minimum threshold of 0.4 for any two boxes to be paired. For two adjacent time steps, A and B, we take the IoU of all possible pairs of bounding boxes with one box from step A, and one from B. These IoU values form the cost matrix for the Hungarian matching algorithm \cite{real-time-mot}, which produces the best possible pairings of bounding boxes from the current time step to the previous. This matching process results in a set of detections with paired bounding boxes, and a set with unpaired boxes. For each detection with a paired box, we calculate its velocity simply as the difference between respective $d^1$ and $d^2$ values of the current detection and its paired observation from the previous time step, multiplied by the frame rate, $fps_{cam}$. For a detection, $a$, paired with a previous detection, $b$: \begin{equation} <v^1_a, v^2_a> = <d^1_b - d^1_a, d^2_b - d^2_a> * fps_{cam} \end{equation} For each detection left unpaired after Hungarian matching, we make no conclusions about $v^1$ or $v^2$ for that detection, and treat each as zero. Each RADAR measurement output by CARLA represents an additional object detection. RADAR measurements contain altitude ($al$) and azimuth ($az$) angle measurements, as well as depth ($d$) and velocity ($v$), all relative to the RADAR sensor. We convert these measurements into object detection parameters as follows \begin{align*} d^1 &= d * \cos az * \cos al & v^1 &= v * \cos az * \cos al \\ d^2 &= d * \sin az * \cos al & v^2 &= v * \sin az * \cos al\\ \end{align*} \section{Preprocessing of CARLA Measurements} \label{appendix: preprocess} In this section, we describe how we preprocess the measurements obtained from CARLA simulation. The measurement in each time step takes the form of $t_t=[y_t^1, y_t^2]\in \{\mathbb{R}\cup \text{NaN}\}^8$, where $y_t^1\in \{\mathbb{R}\cup \text{NaN}\}^4$ is the vision detection produced by ML-based objection detection algorithm YOLOv2, and $y_t^2$ is the detection generated by radar (details in Appendix \ref{appendix:carla-output-processing}). Both vision and radar measurements contain four components: (1) the distance to MIO along driving direction, (2) the velocity of MIO along driving direction, (3) the distance to MIO along lateral direction, and (4) the velocity of MIO along lateral direction. The radar measurements are relatively accurate, and do not have missing data or outliers. However, there are missing data (NaN) and outliers in vision measurements. The missing data problem arises because the MIO sometimes cannot be detected, e.g., in the beginning of the video sequence when the MIO is out of the detection range of the camera. Outliers occur because YOLOv2 may not generate an accurate bounding box of the MIO, causing it to correspond to a depth map reading of an object at a different physical location. As such, a small inaccuracy in the location of the bounding box could lead to dramatic change to the reported distance and velocity of the MIO. In our experiment, we preprocess detections output from CARLA to address missing data and outlier issues. First, we identify the outliers by the Matlab ``filloutliers" method, where we choose ``movmedian" as the detector and use linear interpolation to replace the outliers. The concrete Matlab command is: $$ \text{\small filloutliers($Y$, `linear', `movmedian', 0, `ThresholdFactor', 0.5)}, $$ where $Y\in\mathbb{R}^{T\times 8}$ is the matrix of measurements and $T$ is the total number steps. In our experiment $T=295$. We perform the above outlier detection and replace operation twice to smooth the measurements. Then, we apply the Matlab ``impute" function to interpolate the missing vision measurements. In Fig~\ref{fig:MIO-10_raw_measurement} and~\ref{fig:MIO+1_raw_measurement}, we show the preprocessed distance and velocity measurements from vision and radar compared with the ground-truth for both MIO-10 and MIO+1 datasets. Note that after preprocessing, both radar and vision measurements match with the ground-truth well. \begin{figure} \centering \begin{subfigure}{.23\textwidth} \centering \includegraphics[width=1\textwidth, height=0.85\textwidth]{figures/distance_MIO-10.png} \caption{Distance measurements.} \label{fig:MIO-10_raw_distance} \end{subfigure} \hfill \begin{subfigure}{.23\textwidth} \centering \includegraphics[width=1\textwidth, height=0.85\textwidth]{figures/velocity_MIO-10.png} \caption{Velocity measurements.} \label{fig:MIO-10_raw_velocity} \end{subfigure} \caption{On the MIO-10 dataset, the preprocessed vision measurements and the radar measurements match the ground-truth reasonably well.} \label{fig:MIO-10_raw_measurement} \end{figure} \begin{figure} \centering \begin{subfigure}{.23\textwidth} \centering \includegraphics[width=1\textwidth, height=0.85\textwidth]{figures/distance_MIO+1.png} \caption{Distance measurements.} \label{fig:MIO+1_raw_distance} \end{subfigure} \hfill \begin{subfigure}{.23\textwidth} \centering \includegraphics[width=1\textwidth, height=0.85\textwidth]{figures/velocity_MIO+1.png} \caption{Velocity measurements.} \label{fig:MIO+1_raw_velocity} \end{subfigure} \caption{On the MIO+1 dataset, the preprocessed vision measurements and the radar measurements match the ground-truth reasonably well.} \label{fig:MIO+1_raw_measurement} \end{figure} \section{Derivation of Surrogate Constraints} \label{appendix: surrogate_constraint} The original attack optimization~\eqref{attack_fake_sp2:obj}-\eqref{attack_fake_sp2:stealthy} may not be convex due to that~\eqref{attack_fake_sp2:target} and~\eqref{attack_fake_sp2:stealthy} could be nonlinear. Our goal in this section is to derive convex surrogate constraints that are good approximations to~\eqref{attack_fake_sp2:target} and~\eqref{attack_fake_sp2:stealthy}. Furthermore, we require the surrogate constraints to be tighter than the original constraints, so that solving the attack under the surrogate constraints will always give us a feasible solution to the original attack. Concretely, we want to obtain surrogate constraints to $F(x)=\ell$, where $\ell\in\{\text{green, yellow, red}\}$. We analyze each case of $\ell$ separately: \begin{itemize} \item $\ell=\text{green}$ In this case, $F(x)=\ell$ is equivalent to $v\ge0$ according to~\eqref{eq:FCW}. While this constraint is convex, when we actually solve the optimization, it might be violated due to numerical inaccuracy. To avoid such numerical issues, we tighten it by adding a margin parameter $\epsilon>0$, and the derived surrogate constraint is $v\ge\epsilon$. \item $\ell=\text{red}$ In this case, $F(x)=\ell$ is equivalent to \begin{eqnarray} & v&< 0\label{eq:appendix_red_1}\\ & d&\le -1.2 v+\frac{1}{0.8g}v^2\label{eq:appendix_red_2}. \end{eqnarray} Similar to case 1, we tighten the first constraint as \begin{equation} v\le -\epsilon. \end{equation} Note that by the first constraint, we must have $v<0$. The second constraint is $d\le -1.2v+\frac{1}{0.8g}v^2$. Given $v<0$, this is equivalent to \begin{equation} v\le 0.48g - \sqrt{(0.48g)^2+0.8g d}. \end{equation} We next define the following function \begin{equation} U(d)=0.48g - \sqrt{(0.48g)^2+0.8g d}. \end{equation} The first derivative is \begin{equation} U^\prime(d)=-\frac{0.4g}{\sqrt{(0.48g)^2+0.8g d}}, \end{equation} which is increasing when $d\ge 0$. Therefore, the function $U(d)$ is convex. We now fit a linear function that lower bounds $U(d)$. Specifically, since $U(d)$ is convex, for any $d_0\ge 0$, we have \begin{equation} U(d)\ge U^\prime(d_0)(d-d_0)+U(d_0). \end{equation} Therefore, $v\le U^\prime(d_0)(d-d_0)+U(d_0)$ is a tighter constraint than $v\le U(d)$. The two constraints are equivalent at $d=d_0$. Again, we need to add a margin parameter to avoid constraint violation due to numerical inaccuracy. With this in mind, the surrogate constraint becomes \begin{equation}\label{eq:appendix_cons_surrogate_red} v\le U^\prime(d_0)(d-d_0)+U(d_0)-\epsilon, \end{equation} Or, equivalently: \begin{eqnarray} &v&\le -\epsilon,\\ &v&\le U^\prime(d_0)(d-d_0)+U(d_0)-\epsilon, \end{eqnarray} This concludes the proof of our Proposition~\ref{prop:red_surrogate}. \begin{figure} \centerline{\includegraphics[width=.35\textwidth]{figures/surrogate_cons.png}} \caption{Surrogate light constraints.} \label{fig:red_surrogate} \end{figure} However, we still need to pick an appropriate $d_0$. In our scenario, the distance $d$ has physical limitation $d\in[\underline d, \bar d]$ with $\underline d=0$ and $\bar d=75$. The $U(d)$ curve for $d\in [0,75]$ is shown in Fig~\ref{fig:red_surrogate}. Based on the figure, we select $d_0$ such that $U^\prime(d_0)$ is equal to the slope of the segment connecting the two end points of the curve, i.e., \begin{equation} U^\prime(d_0)=\frac{U(75)-U(0)}{75}=\frac{U(75)}{75}. \end{equation} We now derive the concrete surrogate constraints used in our experiment section. We begin with the following equation: \begin{equation} 0.48g+\frac{0.4g}{U^\prime(d)}=U(d). \end{equation} From which, we can derive $d_0$: \begin{equation} d_0=\frac{1}{0.8g}\left((\frac{30g}{U(75)})^2-(0.48g)^2\right) \end{equation} and \begin{equation} U(d_0)=0.48g+\frac{30g}{U(75)}. \end{equation} By substituting $d_0$ and $U(d_0)$ into~\eqref{eq:appendix_cons_surrogate_red}, we find that the surrogate constraint is \begin{equation} v\le \frac{U(75)}{75}(d-d_0)+0.48g+\frac{30g}{U(75)}+\epsilon. \end{equation} \item $\ell=\text{yellow}$ In this case, $F(x)=\ell$ is equivalent to \begin{eqnarray} & v&< 0\\ & d&\ge -1.2 v+\frac{1}{0.8g}v^2. \end{eqnarray} Similarly, we tighten the first constraint to \begin{equation} v\le -\epsilon. \end{equation} For the second constraint, the situation is similar to $\ell=\text{red}$. $\forall d_0>0$. We have \begin{equation} v\ge \frac{U(d_0)}{d_0}d, \forall d\in [0, d_0] \end{equation} The above inequality is derived by fitting a linear function that is always above the $U(d)$ curve. Next, we select $d_0=75$ and add a margin parameter $\epsilon$ to derive the surrogate constraint: \begin{eqnarray} & v&\le -\epsilon\\ & v&\ge \frac{U(75)}{75}d+\epsilon. \end{eqnarray} To summarize, we have derived surrogate constraints for $F(x)=\ell$, where $l\in \{\text{green, yellow, red}\}$. When we solve the attack optimization, we replace each individual constraint of~\eqref{attack_fake_sp2:target} and~\eqref{attack_fake_sp2:stealthy} by one of the above three surrogate constraints. In Fig~\ref{fig:red_surrogate}, we show the surrogate constraints for red and yellow lights with $\epsilon=10^{-3}$. \end{itemize} \subsection{Attack Setup} We perform preprocessing of CARLA measurements to remove outliers and interpolate missing data (see Appendix~\ref{appendix: preprocess}). Each step of our KF corresponds to one frame of the CARLA simulated video sequence (i.e., 0.05 seconds). We assume that the KF initializes its distance and velocity prediction to the average of the first vision and RADAR measurements. The acceleration is initialized to 0 in both directions. The covariance matrix is initialized to that used by Matlab FCW \cite{matlab-fcw}. Throughout the experiments, we let the effort matrix $R=I$, the margin parameter $\epsilon=10^{-3}$, and $\lambda=10^{10}$. We assume the human reaction time is $h^*=24$ steps (i.e., 1.2 seconds in our simulation). \subsubsection{MIO-10 dataset} We first simulate FCW to obtain the original warning lights without attack. The first red light appears at step 98. Before this step, the lights are all yellow. Without attack, the human driver will notice the red warning at step 98. After 1.2 seconds of reaction time (24 steps), the driver will start braking at step 122. The ground-truth distance to the MIO at the first application of brakes is 14.57m. During braking, the distance between the ego vehicle and the MIO reduces by $10^2/0.8g\approx 12.76$m before stabilizing. Since this is less than the ground-truth distance of 14.58m before braking, the crash can be avoided. This validates the potential effectiveness of FCW. Our attacker aims to cause a crash. To accomplish this, the attacker suppresses the first 10 red warnings, so that the first red warning is delayed to step 108. As a result, the driver starts braking at step 132. The ground-truth distance to MIO at this step is 9.58m, which is below the minimum distance needed to avoid collision (12.76m). As such, a collision will occur. Therefore, we let the target interval be $\mathcal{T}^\dagger=[98, 107]$, and the target lights be $\ell_t^\dagger=\text{green}, \forall t\in \mathcal{T}^\dagger$. \subsubsection{MIO+1 dataset} In this scenario, the original warning lights without attack are all green. There is a trailing vehicle 7 m behind the ego vehicle, driving at the same velocity as the ego vehicle. Our attacker aims at causing the FCW to output red lights, so that the ego vehicle suddenly brakes unnecessarily and causes a rear collision with the trailing vehicle. To this end, the attacker changes the green lights in the interval [100, 139] to red, in which case the ego vehicle driver starts braking at step 124, after 1.2 seconds of reaction time. If the warning returns to green at step 140, the driver will react after 1.2 seconds and stop braking at step 164. Therefore, the driver continuously brakes for at least $(164-124)\times0.05=2$ seconds. Assuming the driver of the trailing vehicle is distracted, then during those 2 seconds, the distance between the trailing and the ego vehicle reduces by $0.2g \times2^2=7.84m>7m$, thus causing a rear-collision. Therefore, we let the target interval be $\mathcal{T}^\dagger=[100,139]$ and the target lights be $\ell_t^\dagger=\text{red}, \forall t\in \mathcal{T}^\dagger$. \section{Acknowledgments} This work was supported in part by the University of Wisconsin-Madison Office of the Vice Chancellor for Research and Graduate Education with funding from the Wisconsin Alumni Research Foundation. XZ acknowledges NSF grants 1545481, 1704117, 1836978, 2041428, 2023239 and MADLab AF CoE FA9550-18-1-0166. \section{Ethics Statement} Our paper studies attacks on advanced driver assistance systems (ADAS) with the goal of initiating research into defenses. We do not intend for the attacks to be deployed in the real world. However, studying attacks is critical to understanding what types of defenses must be built and where defense efforts should be focused. We take a first step towards robust ADAS by studying attacks on Kalman filters that are popularly used in these systems. \section{Attack Problem Formulation} We assume white-box setting where the attacker can access the KF parameters (e.g., through reverse engineering). The attacker can directly manipulate measurements (i.e., false data injection), but only pertaining to the vision component, and not the RADAR data. Our attack framework is agnostic of whether the attacker manipulates camera or RADAR, but we choose to only manipulate camera because of the increasing presence of deep learning techniques in ADAS and their general vulnerability to adversarial examples~\cite{szegedy2013intriguing,roadsigns17,athalye2017synthesizing,glasses}. We envision that future work can integrate our results into adversarial examples to create physical attacks. We further restrict the attacker to only making physically plausible changes to the vision measurements. This is because an anomaly detection system might filter out physically implausible measurements (e.g., change of $10^4$m/s over one second). Concretely, we require that the distance and velocity measurement after attack must lie in $[\underline d,\bar d]$ and $[\underline v,\bar v]$ respectively. We let $[\underline d, \bar d]=[0,75]$ and $[\underline v,\bar v]=[-30,30]$. Finally, we assume that at any time step, the attacker knows the true measurement only for that time step, but does not know future measurements. To address this difficulty of an unknown future, we propose a model predictive control (MPC)-based attack framework that consists of an outer problem and an inner problem, where the inner problem is an instantiation of the outer problem with respect to attacker-envisioned future in every step of MPC. In the following, we first introduce the outer problem formulation. \subsection{Outer Attack Problem} Our attacker has a pre-specified target interval $\mathcal{T}^\dagger$, and aims at changing the warning lights output by FCW in $\mathcal{T}^\dagger$. As a result, the human driver sees different lights and takes unsafe actions. Specifically, for any time $t\in \mathcal{T}^\dagger$, the attacker hopes to cause the FCW to output a desired target light $\ell_t^\dagger$, as characterized by~\eqref{attack_fake_sp2:target}, in which $F(\cdot)$ is the FCW alert logic~\eqref{eq:FCW}. To accomplish this, the attacker manipulates measurements in an attack interval $\mathcal{T}^a$. In our paper, we assume $\mathcal{T}^\dagger\subset \mathcal{T}^a$. Furthermore, we consider only the scenario where $\mathcal{T}^\dagger$ and $\mathcal{T}^a$ have the same last step, since attacking after the target interval is not needed. Let $\delta_t$ be the manipulation at step $t$, and $\tilde y_t=y_t+\delta_t$ be measurement after attack. We refer to the $i$-th component of $\delta_t$ as $\delta_t^i$. We next define the attack effort as the cumulative change over measurements $J = \sum_{t\in \mathcal{T}^a}\delta_t^\top R \delta_t$. where $R\succ 0$ is the effort matrix. The attacker hopes to minimize the attack effort. Meanwhile, the attacker cannot arbitrarily manipulate measurements. We consider two constraints on the manipulation. First, MIO distance and velocity are limited by simple natural physics, as shown in~\eqref{attack_fake_sp2:physical}. Moreover, similar to the norm ball used in adversarial examples, we impose another constraint that restricts the attacker's manipulation $\|\delta_t\|_\infty\le \Delta$ (see~\eqref{attack_fake_sp2:delta_max}). We refer to $\mathcal{T}^s=\mathcal{T}^a\backslash\mathcal{T}^\dagger$, the difference between $\mathcal{T}^a$ and $\mathcal{T}^\dagger$, as the stealthy (or planning) interval. During $\mathcal{T}^s$, the attacker can induce manipulations before the target interval with advance planning, and by doing so, hopefully better achieve the desired effect in the target interval. However, for the sake of stealthiness, the planned manipulation should not change the original lights $\ell_t$ during $\mathcal{T}^s$. This is characterized by the stealthiness constraint~\eqref{attack_fake_sp2:stealthy}. Given all above, the attack can be formulated as: \begin{eqnarray} &\min_{\delta_t} &J=\sum_{t\in \mathcal{T}^a}\delta_t^\top R \delta_t,\label{attack_fake_sp2:obj}\\ &\mbox{s.t.} & \tilde y_t=y_t+\delta_t, \forall t\in\mathcal{T}^a,\label{attack_fake_sp2:attack}\\ & & \tilde x_{t} = A(I-H_{t-1}C)\tilde x_{t-1} +AH_{t-1} \tilde y_t,\label{attack_fake_sp2:KF}\\ & & \delta_t^i=0, \forall i\in\mathcal{I}_{\text{radar}}, \forall t\in \mathcal{T}^a,\label{attack_fake_sp2:only_vision}\\ & & \|\delta_t\|\le \Delta, \forall t\in \mathcal{T}^a,\label{attack_fake_sp2:delta_max}\\ & & \tilde d_t^{1,\nu}\in [\underline d,\bar d], \tilde v_t^{1,\nu}\in [\underline v,\bar v], \forall t\in \mathcal{T}^a,\text{\quad\quad}\label{attack_fake_sp2:physical}\\ & & F(\tilde x_t)=\ell_t^\dagger, \forall t\in \mathcal{T}^\dagger,\label{attack_fake_sp2:target}\\ & & F(\tilde x_t)=\ell_t, \forall t\in \mathcal{T}^s. \label{attack_fake_sp2:stealthy} \end{eqnarray} The constraint \eqref{attack_fake_sp2:KF} specifies the evolution of the state prediction under the attacked measurements $\tilde y_t$.~\eqref{attack_fake_sp2:only_vision} enforces no change on radar measurements, where $\mathcal{I}_{\text{radar}}=\{5,6,7,8\}$ contains indexes of all radar components . The attack optimization is hard to solve due to three reasons: \begin{enumerate}[(1).] \item The problem could be non-convex. \item The problem could be be infeasible. \item The optimization is defined on measurements $y_t$ that are not visible until after $\mathcal{T}^a$, while the attacker must design manipulations $\delta_t$ during $\mathcal{T}^a$ in an online manner. \end{enumerate} We now explain how to address the above three issues. The only potential sources of non-convexity in our attack are~\eqref{attack_fake_sp2:target} and~\eqref{attack_fake_sp2:stealthy}. We now explain how to derive a surrogate convex problem using $\ell_t^\dagger=\ell_t^o=\text{red}$ as an example. The other scenarios are similar, thus we leave the details to Appendix~\ref{appendix: surrogate_constraint}. The constraint $F(\tilde x_t)=\text{red}$ is equivalent to \begin{eqnarray} & \tilde v_t^{1,\nu}&< 0, \label{eq:cons_red_1}\\ & \tilde d_t^{1,\nu}&\le -1.2\tilde v_t^{1,\nu}+\frac{1}{0.8g}(\tilde v_t^{1,\nu})^2.\label{eq:cons_red_2}, \end{eqnarray} The above constraints result in non-convex optimzation mainly because~\eqref{eq:cons_red_2} is nonlinear. To formulate a convex problem, we now introduce surrogate constraints that are tighter than~\eqref{eq:cons_red_1},~\eqref{eq:cons_red_2} but guarantee convexity. \begin{proposition}\label{prop:red_surrogate} Let $U(d)=0.48g-\sqrt{(0.48g)^2+0.8gd}$. Let $\epsilon>0$ be any positive number. Then for any $d_0\ge0$, the surrogate constraints~\eqref{eq:cons_surro_red_1},~\eqref{eq:cons_surro_red_2} are tighter than $F(\tilde x_t)=\text{red}$, and induce convex attack optimization. \begin{eqnarray} &\tilde v_t^{1,\nu}&\le -\epsilon,\label{eq:cons_surro_red_1}\\ &\tilde v_t^{1,\nu}&\le U^\prime(d_0)(\tilde d_t^{1,\nu}-d_0)+U(d_0)-\epsilon.\label{eq:cons_surro_red_2} \end{eqnarray} \end{proposition} We provide a proof and guidance on how to select $d_0$ in Appendix~\ref{appendix: surrogate_constraint}. With the surrogate constraints, the attack optimization becomes convex. However, the surrogate optimization might still be infeasible. To address the feasibility issue, we further introduce slack variables into~\eqref{eq:cons_surro_red_1},~\eqref{eq:cons_surro_red_2} to allow violation of stealthiness and target lights: \begin{eqnarray} &\tilde v_t^{1,\nu}&\le -\epsilon+\xi_t,\label{eq:cons_surro_slack_red_1}\\ &\tilde v_t^{1,\nu}&\le U^\prime(d_0)(\tilde d_t^{1,\nu}-d_0)+U(d_0)-\epsilon+\zeta_t.\quad\label{eq:cons_surro_slack_red_2} \end{eqnarray} We include these slack variables in the objective function: \begin{equation}\label{eq:definitionJ1J2J3} J=\underbrace{\sum_{t\in \mathcal{T}^a}\delta_t^\top R \delta_t}_{\text{total manipulation $J_1$}}+\lambda \underbrace{\sum_{t\in \mathcal{T}^s}(\xi_t^2+\zeta_t^2)}_{\text{stealthiness violation $J_2$}}+\lambda \underbrace{\sum_{t\in \mathcal{T}^\dagger}(\xi_t^2+\zeta_t^2)}_{\text{target violation $J_3$}}. \end{equation} Then, the surrogate attack optimization is \begin{eqnarray} &\min_{\delta_t} &J=J_1+\lambda J_2+\lambda J_3,\label{attack_surrogate_sp2:obj}\\ &\mbox{s.t.} &\text{\eqref{attack_fake_sp2:attack}-\eqref{attack_fake_sp2:physical},~\eqref{eq:cons_surro_slack_red_1},~\eqref{eq:cons_surro_slack_red_2}}.\label{attack_surrogate_sp2:cons} \end{eqnarray} \vspace{-0.5cm} \begin{proposition} The attack optimization~\eqref{attack_surrogate_sp2:obj}-\eqref{attack_surrogate_sp2:cons} with surrogate constraints and slack variables is convex and feasible. \end{proposition} \subsection{Inner Attack Problem: MPC-based Attack} In the outer surrogate attack~\eqref{attack_surrogate_sp2:obj}-\eqref{attack_surrogate_sp2:cons}, we need to assume the attacker knows the measurements $y_t$ in the entire attack interval $\mathcal{T}^a$ beforehand. However, the attacker cannot know the future. Instead, he can only observe and manipulate the current measurement in an online manner. To address the unknown future issue, we adopt a control perspective and view the attacker as an adversarial controller of the KF, where the control action is the manipulation $\delta_t$. We then apply MPC, an iterative control method that progressively solves~\eqref{attack_surrogate_sp2:obj}-\eqref{attack_surrogate_sp2:cons}. By using MPC, the attacker is able to adapt the manipulation to the instantiated measurements revealed over time while accounting for unknown future measurements. Specifically, in each step $t$, the attacker has observed all past measurements $y_{1},...y_{t-1}$ and the current measurement $y_t$. Thus, the attacker can infer the clean state $\hat x_t$ in the case of no attacker intervention. Based on $\hat x_t$, the attacker can recursively predict future measurements by simulating the environmental dynamics without noise, i.e., $\forall \tau>t$: \begin{equation}\label{eq:attack_predict} x_{\tau}^\prime = A x_{\tau -1}^\prime, \hat y_{\tau} = C x_{\tau}^\prime. \end{equation} The recursion starts from $x_t^\prime=\hat x_t$. The attacker then replaces the unknown measurements in the outer attack by its prediction $\hat y_\tau$ $(\tau>t)$ to derive the following inner attack: \begin{eqnarray} &\min_{\delta_{\tau:\tau\ge t}} &J=\sum_{\tau\in \mathcal{T}^a}\delta_\tau^\top R \delta_\tau+\lambda \sum_{\tau\in \mathcal{T}^a}(\xi_\tau^2+\zeta_\tau^2),\quad\quad\label{eq:MPC_red_1}\\ &\mbox{s.t.} &\tilde y_\tau=\hat y_\tau+\delta_\tau, \forall \tau\ge t,\\ & & \text{\text{\eqref{attack_fake_sp2:KF}-\eqref{attack_fake_sp2:physical},~\eqref{eq:cons_surro_slack_red_1},~\eqref{eq:cons_surro_slack_red_2}}}\text{ (defined on $\tau\ge t$)} .\label{eq:MPC_cons_red_1} \end{eqnarray} The attacker solves the above inner attack in every step $t$. Assume the solution is $\delta_\tau (\tau\ge t)$. Then, the attacker only implements the manipulation on the current measurement, i.e., $\tilde y_t=y_t+\delta_t$, and discards the future manipulations. After that, the attacker enters step $t+1$ and applies MPC again to manipulate the next measurement. This procedure continues until the last step of the attack interval $\mathcal{T}^a$. We briefly illustrate the MPC-based attack in algorithm~\ref{alg:MPC}. \begin{algorithm}[t] \SetKwInOut{Input}{Input}\SetKwInOut{Output}{Output} \Input{target interval $\mathcal{T}^\dagger$, target lights $\ell_t^\dagger, t\in \mathcal{T}^\dagger$, stealthy interval $\mathcal{T}^s$, original lights $\ell_t, t\in \mathcal{T}^s$.} Initialize $\hat x_1$ and $\hat \Sigma_1$. Let $\tilde x_1=\hat x_1$, $\mathcal{T}^a=\mathcal{T}^s\cup \mathcal{T}^\dagger$\; \For{$t\leftarrow 2$ \KwTo $T$}{ environment generates measurement $y_t$\; \uIf{$t\in\mathcal{T}^a$} { attacker infers clean state $\hat x_t$ without attack\; attacker predicts future $\hat y_t$ with $\eqref{eq:attack_predict}$\; attacker solves~\eqref{eq:MPC_red_1}-\eqref{eq:MPC_cons_red_1} to obtain $\delta_\tau$ $(\tau\ge t)$\; attacker manipulates $y_t$ to $\tilde y_t=y_t+\delta_t$\; $\tilde x_t$ evolves to $\tilde x_{t+1}$ according to $\tilde y_t$ } \lElse { $\tilde x_t$ evolves to $\tilde x_{t+1}$ according $y_t$ } } \caption{MPC-based attack.} \label{alg:MPC} \end{algorithm} \section{Conclusion} We formulate the adversarial attack of Kalman Filter as an optimal control problem. We demonstrate that our planning-based attack can manipulate the FCW to output incorrect warnings, which mislead human drivers to behave unsafely and cause crash. Our study incorporates human behaviors and applies to general machine-human hybrid systems. \section{Experiments on CARLA Simulation} In this section, we empirically study the performance of the MPC-based attack. We first describe the simulation setup. \input{fcw_simplification} \input{attack_exp_setup} \input{results} \subsection{Simulation Setup} We use CARLA~\cite{carla}, a high-fidelity vehicle simulation environment, to generate measurement data that we input to the Kalman filter-based FCW. CARLA supports configurable sensors and test tracks. We configure the simulated vehicle to contain a single forward-facing RGB camera (800x600 pixels), a forward-facing depth camera of the same resolution, and a single forward-facing RADAR (15$^{\circ}$ vertical detection range, 6000 points/sec, 85 m maximum detection distance). We took this configuration from a publicly-available FCW implementation~\cite{matlab-fcw}. The simulation runs at 20 frames/sec and thus, each sensor receives data at that rate. Furthermore, this configuration is commonly available on production vehicles today~\cite{tesla-adas}, and thus, our simulation setup matches real-world FCW systems from a hardware perspective. For each time step of the simulation, CARLA outputs a single RGB image, a depth map image, and variable number of RADAR points. We use YOLOv2~\cite{yolov2} to produce vehicle bounding boxes, the Hungarian pairwise matching algorithm \cite{hungarian} to match boxes between frames, and the first derivative of paired depth map image readings to produce vehicle detections from vision with location and velocity components. Details of processing and formatting of CARLA output can be found in Appendix~\ref{appendix:carla-output-processing}. This process produces measurements that match ground truth velocity and distance closely. Although there are infinitely many possible physical situations where an FCW alert could occur involving two vehicles, they reside in a small set of equivalence classes. The National Highway Traffic Safety Administration (NHTSA) has outlined a set of testing conditions for assessing the efficacy of FCW alerts~\cite{nhtsa-guidelines}. It involves a two vehicles on a straight test track at varying speeds. Based on these real-world testing guidelines, we develop the following two scenarios: \subsubsection{MIO-10: Collision between two moving vehicles} The ego and MIO travel on a straight road, with a negative relative velocity between the two vehicles. Specifically, the ego travels at 27 m/s (\textasciitilde60 mph) and the MIO at 17 m/s (\textasciitilde38 mph). These correspond to typical freeway speed differences of adjacent vehicles. In the absence of any other action, the ego will eventually collide with the MIO. In our simulations, we let this collision occur and record camera and RADAR measurements throughout. Since the relative velocity of the MIO to the ego is -10m/s, we refer to this dataset as MIO-10. \subsubsection{MIO+1: No collision} The ego and MIO travel on a straight road, with a positive relative velocity between the two vehicles. Specifically, the ego travels at 27 m/s (\textasciitilde60 mph) and the MIO at 28 m/s (\textasciitilde63 mph). A trailing vehicle moving at 27 m/s follows the ego 7 m behind. In the absence of any other action, the ego and trailing vehicle will not collide. We collect measurements until the MIO moves out of sensor range of the ego. We refer to this dataset as MIO+1. The above scenarios correspond to basic situations where the ego vehicle has an unobstructed view of the MIO and represents a best-case for the FCW system. Attacks on these two settings are the hardest to achieve and comprehensively demonstrate the efficacy of our MPC-based attack. \section{Introduction} Advanced Driver Assistance Systems (ADAS) are hybrid human-machine systems that are widely deployed on production passenger vehicles~\cite{nhtsa-adas}. They use sensing, traditional signal processing and machine learning to detect and raise alerts about unsafe road situations and rely on the human driver to take corrective actions. Popular ADAS examples include Forward Collision Warning (FCW), Adaptive Cruise Control and Autonomous Emergency Braking (AEB). Although ADAS hybrid systems are designed to increase road safety when drivers are distracted, attackers can negate their benefits by strategically tampering with their behavior. For example, an attacker could convince an FCW or AEB system that there is no imminent collision until it is too late for a human driver to avoid the crash. We study the robustness of ADAS to attacks. The core of ADAS typically involves tracking the states (e.g., distance and velocity) of road objects using Kalman filter (KF). Downstream logic uses this tracking output to detect unsafe situations before they happen. We focus our efforts on Forward Collision Warning (FCW), a popular ADAS deployed on production vehicles today. FCW uses KF state predictions to detect whether the ego vehicle (vehicle employing the ADAS system) is about to collide with the most important object in front of it and will alert the human driver in a timely manner. Thus, our concrete attack goal is to trick the KF that FCW uses and make it output incorrect state predictions that would induce false or delayed alerts depending on the specific physical situation. Recent work has examined the robustness of road object state tracking for autonomous vehicles~\cite{iclr-mot}. Their attacks create an instantaneous manipulation to the Kalman filter inputs without considering its sequential nature, the downstream logic that depends on filter output, or the physical dynamics of involved vehicles. This leads to temporarily hijacked Kalman filter state predictions that are incapable of ensuring that downstream logic is reliably tricked into producing false alerts. By contrast, we adopt an online planning view of attacking KFs that accounts for: (1) their sequential nature where current predictions depend on past measurements; and (2) the downstream logic that uses KF output to produce warnings. Our attack technique also considers a simplified model of human reaction to manipulated FCW warning lights. We propose a novel Model Predictive Control (MPC)-based attack that can sequentially manipulate measurement inputs to a KF with the goal of stealthily hijacking its behavior. Our attacks force FCW alerts that mask the true nature of the physical situation involving the vehicles until it is too late for a distracted human driver to take corrective actions. We evaluate our attack framework by creating a high-fidelity driving simulation using CARLA~\cite{carla}, a popular tool for autonomous vehicle research and development. We create test scenarios based on real-world driving data~\cite{nhtsa-guidelines,euro-ncap-protocol} and demonstrate the practicality of the attack in causing crashes involving the victim vehicle. Anonymized CARLA simulation videos of our attacks are available at \url{https://sites.google.com/view/attack-kalman-filter}. \noindent\textbf{Main Contributions:} \begin{itemize} \item We develop an optimal control-based attack against the popular FCW driver assistance system. Our attack targets several critical parts of the FCW pipeline -- Kalman filter tracking and prediction, FCW alert logic and human decision making in crash and near-crash scenarios. \item We evaluate our control-based attacks in a high-fidelity simulation environment demonstrating that an attacker can compromise \emph{only} the camera-based measurement data and accomplish their goals of creating end-to-end unsafe situations for an FCW system, even under the constraint of limited manipulation to measurements. \item We show that attack planning in advance of the targeted point is beneficial to the attack compared to without planning. Given 25 steps of planning (or 1.25 seconds based on specific physical situations in our evaluation) before the targeted time point, the attacker can cause the desired effect, while the attack fails without planning. Furthermore, via comparisons against a baseline greedy attack, we show that our attack can find near-optimal planning that achieves better overall performance. \end{itemize} \section{Background} Forward Collision Warning provides audio-visual alerts to warn human drivers of imminent collisions. Fig.~\ref{fig:overview} shows the pipeline of a prototypical FCW hybrid system~\cite{matlab-fcw}: (1) It uses camera and RADAR sensors to perceive the environment; (2) It processes sensor data using a combination of traditional signal processing and machine learning algorithms to derive object velocities and distances; (3) A Kalman filter tracks the Most Important Object (MIO) state and makes predictions about its future states; (4) FCW logic uses Kalman filter predictions to determine whether a collision is about to occur and creates audio-visual warnings; (5) A human driver reacts to FCW alerts. These alerts can be either: green -- indicating no danger, yellow -- indicating potential danger of forward collision, and red -- indicating imminent danger where braking action must be taken. We focus on attacking the core steps of FCW (shaded parts of Fig.~\ref{fig:overview}). Thus, we assume there is a single MIO in front of the ego vehicle and a single Kalman filter actively tracking its state. The steps of measurement assignment and MIO identification will not be considered in this paper. \begin{figure}[t!] \centering \includegraphics[width=1\columnwidth,height=0.443\textwidth]{figures/fcw.png} \caption{Overview of Forward Collision Warning (FCW) hybrid human-machine system. We take a first step to understanding the robustness of this system to attackers who can compromise sensor measurements. Therefore, we filter the problem to its essence (shaded parts) --- the Kalman filter that tracks the most important object (MIO) and the downstream logic that decides how to warn the driver.} \label{fig:overview} \end{figure} We have two attack goals that will comprehensively demonstrate the vulnerability of FCW hybrid systems --- the attacker should trick FCW into showing no red alerts when there is an imminent collision with the most important object (MIO), and vice versa --- the attacker should trick FCW into showing red alerts when there is no collision, inducing a human to react with braking that can potentially lead to a rear-end crash with a trailing vehicle. \subsection{Kalman Filtering} At the core of FCW is the Kalman Filter, which estimates the state of the MIO based on sensor measurements. In this paper, the state of the MIO is represented as $x_t = (d_t^1, v_t^1, a_t^1, d_t^2, v_t^2, a_t^2)$, where $d_t^1$, $v_t^1$, $a_t^1$ are the distance, velocity and acceleration of the MIO along the driving direction, and $d_t^2, v_t^2, a_t^2$ for the lateral direction (perpendicular to driving direction). Then KF models the evolution of $x_t$ as \begin{equation}\label{eq:transition_model} x_{t+1}=Ax_t + \omega_t, t\ge 1, \end{equation} where $A$ is the state-transition matrix and $\omega_t \sim N(0, \Omega)$ is Gaussian noise. The underlying state $x_t$ is unknown, but one can obtain measurements $y_t$ of the state as \begin{equation}\label{eq:measurement_model} y_t = C x_t+\psi_t, t\ge 1, \end{equation} where $C$ is the measurement matrix and $\psi_t \sim N(0, \Psi)$ is the measurement noise. In our paper, $y_t\in\mathbb{R}^8$ contains vision and radar measurements of the MIO distance and velocity along two directions, i.e., $y_t =(d_t^{1,\nu}, v_t^{1,\nu}, d_t^{2,\nu}, v_t^{2,\nu}, d_t^{1,r}, v_t^{1,r}, d_t^{2,r}, v_t^{2,r})$, where we use superscripts $\nu$, $r$ for vision and radar, and numbers 1, 2 for driving and lateral direction, respectively. Given the state dynamics~\eqref{eq:transition_model} and measurement model~\eqref{eq:measurement_model}, KF provides a recursive formula to estimate the state based on sequential measurements obtained over time. Concretely, KF starts from some initial state and covariance prediction $\hat x_1$ and $\hat \Sigma_1$. Then for any $t\ge 2$, KF first applies~\eqref{eq:KF_correction} to correct the predictions based on measurements $y_t$. The corrected state and covariance matrix are denoted by $\bar x_t$ and $\bar \Sigma_t$. \begin{equation}\label{eq:KF_correction} \begin{aligned} \bar x_{t} &= (I-H_{t-1}C)\hat x_{t-1} +H_{t-1} y_t,\\ \bar \Sigma_{t} &= (I - H_{t-1}C)\hat \Sigma_{t-1}. \end{aligned} \end{equation} where $H_{t-1}=\hat \Sigma_{t-1}C^\top (C\hat \Sigma_{t - 1}C^\top+\Psi)^{-1}$. Next, KF applies~\eqref{eq:KF_prediction} to predict state and covariance for the next step. \begin{equation}\label{eq:KF_prediction} \hat x_{t} = A\bar x_{t}, \quad \hat \Sigma_{t}= A\bar \Sigma_{t}A^\top +\Omega. \end{equation} The correction and prediction steps are applied recursively as $t$ grows. Note that the derivation of covariance matrix is independent of $y_t$, thus can be computed beforehand. \subsection{Warning Alert Logic and Human Model} In this paper, we follow the FCW alert logic used in~\cite{matlab-fcw}. Let the state prediction be $\hat x_t=(\hat d_t^1, \hat v_t^1, \hat a_t^1, \hat d_t^2, \hat v_t^2, \hat a_t^2)$, then the warning light $\ell_t$ output by FCW at step $t$ is one of the following three cases: \begin{itemize} \item Safe (Green): The MIO is moving away, or the distance to MIO remains constant, i.e., $\hat v_{t}^1\ge0$. \item Caution (Yellow): The MIO is moving closer, but still at a distance further than the minimum safe distance $d^*(\hat v_t^1)$, i.e., $\hat v_{t}^1<0$ and $\hat d_{t}^1>d^*(\hat v_t^1)$. We define the safe distance as $d^*(\hat v_t^1)=-1.2\hat v_{t}^1+(\hat v_{t}^1)^2/0.8g$, where $g$ is 9.8 $m/s^2$. \item Warn (Red): The MIO is moving closer, and at a distance less than the minimum safe distance, i.e., $\hat v_{t}^1<0$ and $\hat d_{t}^1\le d^*(\hat v_t^1)$. \end{itemize} The FCW alert logic can be summarized as: \begin{equation}\label{eq:FCW} F(\hat x_{t}) = \left\{ \begin{array}{ll} \text{green} & \mbox{if $\hat v_{t}^1\ge0$,} \\ \text{yellow} & \mbox{if $\hat v_{t}^1< 0, \hat d_{t}^1>d^*(\hat v_t^1)$,} \\ \text{red} & \mbox{if $\hat v_{t}^1< 0, \hat d_{t}^1\le d^*(\hat v_t^1)$.} \end{array} \right. \end{equation} Given the FCW warning light, the human driver could be in one of the following two states -- applying the brake pedal, or not applying/releasing the brake. We take into account human reaction time $h^*$; warning lights must sustain at least $h^*$ steps before the human driver switches state. That is, the driver brakes after $h^*$ steps since the first red light, and releases the brake after $h^*$ steps since the first yellow/green light. Note that the yellow and green lights are treated identically in both cases because the MIO is outside the safe distance and no brake is needed. In appendix~\ref{appendix: human}, we provide an algorithmic description of the human model. \section{Related Work} \noindent\textbf{Attacks on Object Tracking.} Recent work has examined the vulnerability of multi-object tracking (MOT)~\cite{iclr-mot}. Although this work does consider the downstream logic that uses the outputs of ML-based computer vision, our work goes beyond in several ways. First, we consider a hybrid system that involves both human and machine. Second, we consider the more realistic case of sensor fusion involving RADAR and camera measurements that is deployed in production vehicles today. Prior work assumed a system that only uses a single camera sensor. Third, we examine a complete FCW pipeline that uses object tracking data to predict collisions and issue warnings. Prior work only considered MOT without any further logic that is necessarily present in realistic systems. Finally, our attack algorithm accounts for the sequential nature of decision making in ADAS. \noindent\textbf{Vision Adversarial Examples.} ML models are vulnerable to adversarial examples~\cite{szegedy2013intriguing}, with a bulk of research in the computer vision space~\cite{goodfellow2014explaining,papernot2016limitations,carlini2017towards,shafahi2018poison,chen2017targeted}. Recent work has demonstrated physical attacks in the real world~\cite{patch,athalye2017synthesizing,yolo,glasses}. For example, attackers can throw inconspicuous stickers on stop signs and cause the model to output a speed limit sign~\cite{roadsigns17}. However, all of this work studies the ML model in isolation without considering the cyber-physical system that uses model decisions. By contrast, we contribute the first study that examines the security of FCW --- a hybrid human-machine system, and we introduce a novel control-based attack that accounts for these aspects while remaining stealthy to the human driver. \noindent\textbf{Control-based Attacks on KF.} Prior work in control theory has studied false data injection attacks on Kalman filters~\cite{bai2017kalman, kung2016performance, zhang2016stealthy, chen2016cyber, yang2016false, chen2017optimal}. Our work assumes a similar attack modality -- the attacker can manipulate measurements. However, prior work does not consider the downstream logic and human behavior that depends on the KF output. By contrast, we provide an attack framework demonstrating end-to-end effects that cause crashes in distracted driving scenarios. \noindent\textbf{Attacks on Sequential Systems.} There are recent works that study attacks of other sequential learning systems from a control perspective~\cite{chen2020optimal,zhang2020online,zhang2020adaptive,jun2018adversarial}. Most of them focus on analyzing theoretical attack properties, while we contribute an application of control-based attacks in a practical domain. \subsection{The MPC-based Attack Is Successful} Our first result shows that the MPC-based attack can successfully cause the FCW to output the desired warning lights in the target interval $\mathcal{T}^\dagger$. In this experiment, we let $\Delta=\infty$ and the stealthy interval $\mathcal{T}^s$ start at step 2. In Fig.~\ref{fig:MIO-10_warning} and~\ref{fig:MIO+1_warning}, we show the warning lights in $\mathcal{T}^\dagger$ (shaded in red). For MIO-10, the attacker achieves the desired red lights in the entire $\mathcal{T}^\dagger$, while maintaining the original yellow lights in $\mathcal{T}^s$. For MIO+1, the attacker failed to achieve the red warning at step 100, but is successful in all later steps. We verified that the attack still leads to a collision. In fact, the attacker can tolerate at most two steps of failure in the beginning of $\mathcal{T}^\dagger$ while still ensuring that the collision occurs. There is an unintended side effect in $\mathcal{T}^s$ where green lights are changed to yellow. However, this side effect is minor since the driver will not brake when yellow lights are produced. In many production vehicles, green and yellow lights are not shown to the driver --- only the red warnings are shown. In Fig.~\ref{fig:MIO-10_attack_distance},~\ref{fig:MIO-10_attack_velocity}, we note that for MIO-10, the manipulation is mostly on velocity, and there are early planned manipulations starting from step 70. A large increase in velocity happens at step 100 (the first step of $\mathcal{T}^\dagger$), which causes the KF's velocity estimation to be positive, resulting in a green light. After that, velocity measurements are further increased to maintain a positive velocity estimation. In Fig.~\ref{fig:MIO+1_attack_distance},~\ref{fig:MIO+1_attack_velocity}, we show manipulations on MIO+1. The overall trend is that the attacker reduces the perceived MIO distance and velocity. As a result, KF estimates the MIO to be close than the safe distance in $\mathcal{T}^\dagger$, thus red lights are produced. During interval [88,96], There is an exceptional increase of velocity. We provide a detailed explanation for that increase in Appendix~\ref{appendix:increase}. In Fig.~\ref{fig:MIO-10_state_traj},~\ref{fig:MIO+1_state_traj}, we show the trajectory of KF state prediction projected onto the distance-velocity space during interval $\mathcal{T}^a$. We partition the 2D space into three regions, green (G), yellow (Y) and red (R). Each region contains the states that trigger the corresponding warning light. The trajectory without attack (blue) starts from location 1 and ends at 2. After attack, the trajectory (dark) is steered into the region of the desired warning light, ending at location 3. Note that during $\mathcal{T}^\dagger$, the state after attack lies on the boundary of the desired region. This is because our attack minimizes manipulation effort. Forcing a state deeper into the desired region would require more effort, increasing the attacker's cost. \subsection{Attack Is Easier with More Planning Space} Our second result shows that the attack is easier when the attacker has more time to plan, or equivalently, a longer stealthy interval $\mathcal{T}^s$. The stealthy interval is initially of full length, which starts from step 2 until the last step prior to $\mathcal{T}^\dagger$. Then, we gradually reduce the length by 1/4 of the full length until the interval is empty. This corresponds to 5, 3.75, 2.5, 1.25 and 0 seconds of planning space before the target interval $\mathcal{T}^\dagger$. We denote the number of light violations in $\mathcal{T}^\dagger$ as $V^\dagger=\sum_{t\in \mathcal{T}^\dagger}\tilde \ell_t\neq \ell_t^\dagger$, and similarly $V^s$ for $\mathcal{T}^s$. We let $\Delta=\infty$. In Table~\ref{table:MIO-10} and~\ref{table:MIO+1}, we show $V^\dagger$, $V^s$ together with $J_1, J_2, J_3$ and $J$ as defined in~\eqref{eq:definitionJ1J2J3} for MIO-10 and MIO+1 respectively. Note that on both datasets, the violation $V^\dagger$ and the total objective $J$ decrease as the length of $\mathcal{T}^s$ grows, showing that the attacker can better accomplish the attack goal given a longer interval of planning. On MIO-10, when $\mathcal{T}^s$ is empty, the attack fails to achieve the desired warning in all target steps. However, given 1.25s of planning before $\mathcal{T}^\dagger$, the attacker forces the desired lights throughout $\mathcal{T}^\dagger$. Similarly, on MIO+1, when $\mathcal{T}^s$ is empty, the attack fails in the first three steps of $\mathcal{T}^\dagger$, and the collision will not happen. Given 1.25s of planning before $\mathcal{T}^\dagger$, the attack only fails in the first step of $\mathcal{T}^\dagger$, and the collision happens. This demonstrates that planning in $\mathcal{T}^s$ benefits the attack. \begin{table} \centering \caption{\small{$V^\dagger$, $V^s$, $J_1$, $J_2$, $J_3$ and $J$ for the MIO-10 dataset.}}\label{table:MIO-10} \small \resizebox{0.48\textwidth}{!}{ \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|} \hline & \multicolumn{6}{|c|}{MPC-based attack} & \multicolumn{6}{|c|}{Greedy attack} \\ \hline $\mathcal{T}^s$ &$V^\dagger$ & $V ^s$ & $J_1$ & $J_2$ & $J_3$ & $J$ &$V^\dagger$ &$V^s$ & $J_1$ & $J_2$ & $J_3$ & $J$ \\ \hline $0$ & 1 & 0 &7.1e3 &0 &7.4 &7.4e10 & 1 & 0 &4.6e3 &98.4 &7.4 &1.1e12 \\ $1.25$ &0 & 0&4.4e3&0 &0&4.3e3 & 0 & 23&1.3e5 &3.3e3 &0 & 3.3e13 \\ $2.5$ &0 & 0 &4.4e3&0 &0 & 4.4e3 & 0 & 47 &2.0e5 &5.4e3 &0 &5.4e13 \\ $3.75$ &0 & 0 &4.4e3&0 &0 & 4.4e3 & 0 & 71 &2.5e5 &7.6e3 &0 &7.5e13\\ $5$ & 0 & 0 &4.4e3&0 &0 & 4.4e3 & 0 & 96 & 2.9e5 &9.2e3 & 0& 9.2e13 \\ \hline \end{tabular}} \end{table} \begin{table} \centering \caption{\small{$V^\dagger$, $V^s$, $J_1$, $J_2$, $J_3$ and $J$ for the MIO+1 dataset.}}\label{table:MIO+1} \small \resizebox{0.48\textwidth}{!}{ \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|} \hline & \multicolumn{6}{|c|}{MPC-based attack} & \multicolumn{6}{|c|}{Greedy attack} \\ \hline $\mathcal{T}^s$ &$V^\dagger$ & $V ^s$ & $J_1$ & $J_2$ & $J_3$ & $J$ &$V^\dagger$ & $V ^s$ & $J_1$ & $J_2$ & $J_3$ & $J$ \\ \hline $0$ & 3 & 0 &3.3e4 &0 &1.2e2 &1.2e12 & 3 & 0 &1.1e5 &0 &1.2e2 &1.2e12 \\ $1.25$ &1 & 14 &7.6e4&6.8 &11.0&1.8e11 & 0 & 25 &1.7e5 &6.1e3 &0 & 6.1e13 \\ $2.5$ &1& 39 &1.1e5&4.2 &6.9 & 1.1e11 & 0 & 49 &2.3e5 &1.1e4 &0 &1.1e14 \\ $3.75$ &1 & 58 &1.5e5&3.5 &5.9 & 9.4e10 & 0 & 74 &3.0e5 &1.6e4 &0 &1.6e14\\ $5$ & 1 & 58 &1.8e5&3.3 &5.6 & 9.0e10 & 0 & 98 & 3.5e5 &2.0e4 & 0& 2.0e14 \\ \hline \end{tabular}} \end{table} \subsection{Attack Is Easier as $\Delta$ Increases} In this section, we show that the attack becomes easier as the upper bound on the manipulation $\Delta$ grows. In this experiment, we focus on the MIO-10 dataset and let $\mathcal{T}^\dagger$ start from step 2. In Fig~\ref{fig:manipulation_MIO-10_delta}, we show the manipulation on measurements for $\Delta=14,16,18$ and $\infty$. The number of green lights achieved by the attacker in the target interval is 0, 4, 10 and 10 respectively. This shows the attack is easier for larger $\Delta$. Note that for smaller $\Delta$, the attacker's manipulation becomes flatter due to the constraint $\|\delta_t\|\le \Delta$. But, more interestingly, the attacker needs to start the attack earlier to compensate for the decreasing bound. We also note that the minimum $\Delta$ to achieve the desired green lights over the entire target interval (to integer precision) is 18. \begin{figure}[H] \begin{subfigure}{.235\textwidth} \centering \includegraphics[width=1\textwidth, height=0.7\textwidth]{figures/distance_measurement_Delta_MIO-10.png} \caption{Manipulation on distance.} \label{fig:MIO-10_distance_Delta} \end{subfigure}% \hfill \begin{subfigure}{.235\textwidth} \centering \includegraphics[width=1\textwidth, height=0.7\textwidth]{figures/velocity_measurement_Delta_MIO-10.png} \caption{Manipulation on velocity.} \label{fig:MIO-10_velocity_Delta} \end{subfigure}% \caption{Manipulation on measurements with different upper bound $\Delta$. As $\Delta$ grows, the attack becomes easier.} \label{fig:manipulation_MIO-10_delta} \end{figure} \subsection{Comparison Against Greedy Attacker} In this section, we introduce a greedy baseline attacker. For MIO-10, since the attack goal is to achieve green lights in $\mathcal{T}^\dagger$, the greedy attacker always increases the distance and velocity to the maximum possible value, i.e., $$\tilde d_t^{1,\nu}=\min\{d_t^{1, \nu}+\Delta, \bar d\}, \tilde v_t^{1,\nu}=\min\{v_t^{1, \nu}+\Delta, \bar v\}, \forall t\in \mathcal{T}^a.$$ Similarly, for MIO+1, the attacker always decreases the distance and velocity to the minimum possible value. In table~\ref{table:MIO-10} and~\ref{table:MIO+1}, we compare the performance of greedy and our MPC-based attack. On both datasets, each attack strategy achieves a small number of violations $V^\dagger$ in $\mathcal{T}^\dagger$. However, the greedy attack suffers significantly more violations $V^s$ in $\mathcal{T}^s$ than does MPC. Furthermore, these violations are more severe, reflected by the much larger $J_2$ of the greedy attack. As an example, on MIO+1, the greedy attack changes the original green lights in $\mathcal{T}^s$ to red, while our attack only changes green to yellow. The greedy attack also results in larger total effort $J_1$ and objective value $J$. Therefore, we conclude that our attack outperforms the baseline greedy attack overall. In appendix~\ref{appendix: greedy}, we provide more detailed results of the greedy attack.
{'timestamp': '2020-12-17T02:07:37', 'yymm': '2012', 'arxiv_id': '2012.08704', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08704'}
arxiv
\section*{Acknowledgment} We thank our shepherd Lorenzo Cavallaro and the anonymous reviewers for their constructive and valuable feedback. This work is sponsored in part by NSF grants CCF-18-45893, CCF-18-22965, CCF-16-19123, CNS-18-42456, CNS-18-01426, CNS-16-18771, CNS-16-17670, CNS-15-64055, and CNS-15-63843; ONR grants N00014-17-1-2010, N00014-16-1-2263, and N00014-17-1-2788; an NSF CAREER award; an ARL Young Investigator (YIP) award; a Google Faculty Fellowship; a JP Morgan Faculty Research Award; a DiDi Faculty Research Award; a Google Cloud grant; a Capital One Research Grant; and an Amazon Web Services grant. Any opinions, findings, conclusions, or recommendations expressed herein are those of the authors, and do not necessarily reflect those of the US Government, ONR, ARL, NSF, Captital One, Google, JP Morgan, DiDi, or Amazon. \subsection{Detailed Model Architecture} \label{subsec:detailed_arch} \vspace{.1cm}\noindent\textbf{Multi-head self-attention.} Given the embeddings of all input token (see Section~\ref{subsec:pretrain_method}) in $l$-th layer, $(E_{l,1},...,E_{l,n})$, the self-attention layer updates each embedding with the following steps. It first maps $E_{l,i}$ to three embeddings, \emph{i.e., } query embedding $q_i$, key embedding $k_i$, and value embedding $v_i$: \begin{equation*} \label{eq:kqv} \centering q_i=f_{q}(W_{q};E_{l,i}); \ k_i=f_{k}(W_{k};E_{l,i}); \ v_i=f_{v}(W_{v};E_{l,i}) \end{equation*} Here $f_{q}$, $f_{k}$, and $f_{v}$ are affine transformation functions (\emph{i.e., } a fully-connected layer) parameterized by $W_{q}$, $W_{k}$, and $W_{v}$, respectively. It then computes attention $a_{ij}$ between $E_{l,i}$ and all other embeddings $E_{l,\{j|j\neq i\}}$ by taking the dot product between the $E_{l,i}$'s query embedding $q_i$ and $E_{l,j}$'s key embedding $k_j$: $a_{ij}=q_i\cdot k_j$. Intuitively, attention $a$ is a square matrix, where each cell $a_{ij}$ indicates how much attention $E_{l,i}$ should pay to $E_{l,j}$ when updating itself. It then divides every row of $a$ by $\sqrt{d_{emb}}$ (the dimension of the embedding vectors) and scale it by softmax to ensure them sum up to 1: \begin{equation*} \label{eq:scale} \centering a'_{ij} = \frac{\exp(a_{ij})}{\sum^n_{j=1}\exp(a_{ij})} \end{equation*} The scaled attention $a'_{ij}$ will be multiplied with value embedding $v_j$ and summed up: \begin{equation*} \label{eq:single_head} \centering E^h_{k+1,i} = \sum^n_{j=1} a'_{ij} v_j \end{equation*} Here $h$ in $E^h_{k+1,i}$ denote the updated embedding belong to attention head $h$. Assume we have total $H$ attention heads, the updated embeddings will finally go through an 2-layer feedforward network $f_{out}$ parameterized by $W_{out}$ with skip connections~\cite{he2016deep} to update embeddings from all heads: \begin{equation} \label{eq:multi_head} \centering E_{l+1,i} = f_{out}(concat(E^0_{l+1,i},...,E^H_{l+1,i});W_{out}) \end{equation} \vspace{.1cm}\noindent\textbf{How to use the embedding.} The learned embeddings $E_{l,i}$ after the last self-attention layer encodes the execution semantics of each instruction and the overall function. Consider predicting masked input in pretraining. Let layer $l$ be the $g_p$'s last self-attention layer. The model will stack a 2-layer multi-layer perceptron (MLP) for predicting the masked codes and values: \begin{equation*} MLP(E_{l,i}) = softmax(tanh(E_{l,i}\cdot W_1)\cdot W_2), i\in\mathbb{MP} \end{equation*} $W_1\in \mathbb{R}^{d_{emb}\times d_{emb}}$ and $W_2\in \mathbb{R}^{d_{emb}\times |V|}$ where $|V|$ is the vocabulary size of the code token or bytes. As shown in Equation~\ref{eq:pretrain}, each embedding will have 9 stacked MLPs (\emph{i.e., } one for predicting code and the rest for predicting bytes). \subsection{\textsc{Trex}\xspace Hyperparameters} \label{subsec:hyperparm} \vspace{.1cm}\noindent\textbf{Network architecture.} We use 12 self-attention layers with each having 8 self-attention heads. The embedding dimension is $d_{emb}=d_{func}=768$, which is also the embedding dimension used in bi-LSTM. We set 3072 as the hidden layer size of MLP in the self-attention layer. We adopt GeLU~\cite{hendrycks2016gaussian}, known for addressing the problem of vanishing gradient, as the activation function for \textsc{Trex}\xspace's self-attention module. We use the hyperbolic tangent (tanh) as the activation function in finetuning MLP. We set the dropout rate 0.1 for pretraining do not use dropout in finetuning. \vspace{.1cm}\noindent\textbf{Pretraining.} We fix the largest input length to 512 and choose the effective batch size for both pretraining and finetuning as 512. As 512 batch size with each sample of length 512 is too large to fit in our GPU memory (11 GB), we aggregate the gradient every 64 batches and then updates the weight parameter. This setting results in the actual batch size as 8 ($64\times8=512$). We pick learning rate $5\times10^{-4}$ for pretraining. Instead of starting with the chosen learning rate at first epoch, we follow the common practice of using small warmup learning rate at first epoch. We use $10^{-7}$ as the initial warmup learning rate and gradually increases it until reaching the actual learning rate ($5\times10^{-4}$) after first epoch. We use use Adam optimizer, with $\beta_1=0.9$, $\beta_2=0.98$, $\epsilon=10^{-6}$, and weight decay $10^{-2}$. \subsection{More Experiments} \label{subsec:more_exp} \vspace{.1cm}\noindent\textbf{Cross-project generalizability.} While we strictly separate the functions for pretraining, finetuning, and testing, the functions of finetuning and testing can come from the same project (but strictly different functions). Therefore, in this section, we further separate the functions in finetuning and testing by extracting them from \emph{different projects}. For example, we can finetune the model on Coreutils while testing on OpenSSL. Specifically, we select 3 projects, \emph{i.e., } Binutils, Coreutils, and OpenSSL, which have the largest number of functions, and evaluate how \textsc{Trex}\xspace performs. We allow the functions to come from different architectures, optimizations, and obfuscations, and follow the same setup as described in Section~\ref{sec:impl}. \begin{table}[!t] \footnotesize \setlength{\tabcolsep}{7pt} \centering \renewcommand{\arraystretch}{1.1} \setlength\aboverulesep{0.4pt} \setlength\belowrulesep{0.4pt} \caption{\textsc{Trex}\xspace results (in AUC score) on function pairs with training and testing functions extracted from different projects. } \label{tab:cross-dataset} \begin{tabular}{r|c|c|c} \toprule[1.1pt] \backslashbox{Train}{Test} & \textbf{Coreutils} & \textbf{Binutils} & \textbf{OpenSSL} \\ \midrule[.9pt] \rowcolor{lightblue} \textbf{Coreutils} & 0.947 & 0.945 & 0.940 \\ \hline \textbf{Binutils} & 0.945 & 0.945 & 0.944 \\ \hline \rowcolor{lightblue} \textbf{OpenSSL} & 0.936 & 0.939 & 0.956 \\ \bottomrule[1.1pt] \end{tabular} \end{table} Table~\ref{tab:cross-dataset} shows that \textsc{Trex}\xspace's AUC score does not drop dramatically ($<2$\%) when the functions are coming from different projects when compared to coming from same projects (the diagonal). This observation indicates \textsc{Trex}\xspace generalizes to unseen function pairs in an entirely different dataset. Note that the functions in each function pair can come from arbitrary architectures, optimizations, and obfuscations (last column in Table~\ref{tab:result}). As we have shown in Section~\ref{subsec:rq2}, the numbers achieved by \textsc{Trex}\xspace in Table~\ref{tab:cross-dataset} even outperforms the existing baselines when their functions can only come from different architectures and within only the same projects. \vspace{.1cm}\noindent\textbf{Effectiveness of bi-LSTM encoding.} As described in Section~\ref{subsec:input_repr}, we treat the numeric values as an 8-byte sequence and use bi-LSTM to combine them into a single representation (embedding). The structure of bi-LSTM is known to capture the potential dependencies between different bytes (with different significance) in the byte-sequence. Indeed, besides bi-LSTM, there are other possible differentiable modules such as multi-layer perceptron (MLP) or simple summation can also combine the input bytes. Therefore, we study the performance of \textsc{Trex}\xspace in predicting masked tokens when we vary the modules for byte-sequence combination. Specifically, we follow the same setting described above by selecting a random 10,000 function binaries as the testing set and evaluate the testing PPL achieved by pretraining \textsc{Trex}\xspace. Figure~\ref{fig:pretrain-loss} shows the validation PPL in 10 epochs of pretraining \textsc{Trex}\xspace based on (1) bi-LSTM, (2) 2-layer (with 1024 hidden size) MLP, and (3) simple summation (SUM), to combine the byte-sequence. We can observe that bi-LSTM is obviously better than other two, achieving the lowest PPL. This indicates that bi-LSTM helps \textsc{Trex}\xspace the most in terms of learning approximate execution semantics. \vspace{.1cm}\noindent\textbf{Vulnerability search performance.} We quantify the accuracy of \textsc{Trex}\xspace in searching vulnerable functions in the firmware images and compare it to that of SAFE. As SAFE does not work for MIPS, we study how it performs on NETGEAR R7000 model, the only model that runs on ARM architecture from Table~\ref{tab:cve_case}. Specifically, we compile OpenSSL to ARM and x64 with \texttt{O3}, and feed both our compiled and firmware's function binaries to \textsc{Trex}\xspace and SAFE to compute embeddings. Based on the function embeddings, we search the compiled OpenSSL functions in the NETGEAR R7000's embedded OpenSSL libraries, and test their top-1/3/5/10 errors. For example, the top-10 error measures when the query function does not appear in the top-10 most similar functions in the firmware. \begin{figure}[!t] \centering \subfloat[Same architecture]{ \includegraphics[width=0.47\linewidth]{./figs/case/vuln_error_same.pdf} \label{subfig:same}} \subfloat[Cross architecture]{ \includegraphics[width=0.47\linewidth]{./figs/case/vuln_error_cross.pdf} \label{subfig:cross}} \caption{Top-1/3/5/10 error of \textsc{Trex}\xspace and SAFE in searching functions in firmware. (a) The query functions and the firmware are from same architecture (ARM). (b) The query functions are from x64 but the firmware are from ARM.} \label{fig:vuln_error} \end{figure} Figure~\ref{fig:vuln_error} shows that \textsc{Trex}\xspace consistently outperforms SAFE, achieving 24.3\% lower error rate on average. Moreover, as shown in Figure~\ref{subfig:cross}, when the query functions are from x64 (the firmware binaries are from ARM), \textsc{Trex}\xspace outperforms SAFE by a greater margin, achieving 25.3\% lower error rate in cross-architecture search. \begin{table*}[!t] \footnotesize \setlength{\tabcolsep}{1.5pt} \centering \renewcommand{\arraystretch}{1} \setlength\aboverulesep{0.4pt} \setlength\belowrulesep{0.4pt} \caption{Details of the real-world 180 firmware images we collected from DD-WRT. } \label{tab:firmware} \begin{tabular}{l|l|l|l?{1.1pt}l|l|l|l?{1.1pt}l|l|l|l} \toprule[1.1pt] \textbf{Vendor} & \textbf{Model} & \textbf{ISA} & \textbf{Year} & \textbf{Vendor} & \textbf{Model} & \textbf{ISA} & \textbf{Year} & \textbf{Vendor} & \textbf{Model} & \textbf{ISA} & \textbf{Year} \\ \midrule[.9pt] \rowcolor{lightblue} 8devices &Carambola 2 &MIPS &2020 &8devices &Carambola 2 8MB &MIPS &2018 &8devices &Lima &MIPS &2020 \\ \hline Actiontec &MI424WR &ARM &2019 &Alfa &AIP-W502U &MIPS &2020 &Alfa &SOLO48 &MIPS &2020 \\ \hline \rowcolor{lightblue} Belkin &F5D8235-4 &MIPS &2020 &Buffalo &BHR-4GRV &MIPS &2020 &Buffalo &WBMR-HP-G300H &MIPS &2020 \\ \hline Buffalo &WHR-1166D &MIPS &2020 &Buffalo &WHR-300HP2 &MIPS &2018 &Buffalo &WHR-600D &MIPS &2018 \\ \hline \rowcolor{lightblue} Buffalo &WXR-1900DHP &ARM &2020 &Buffalo &WZR-1166DHP &ARM &2020 &Buffalo &WZR-600DHP2 &ARM &2020 \\ \hline Buffalo &WZR-900DHP &ARM &2020 &Buffalo &WZR-HP-G450H &MIPS &2020 &Comfast &CF-E325N &MIPS &2020 \\ \hline \rowcolor{lightblue} Comfast &CF-E355AC &MIPS &2020 &Comfast &CF-E380AC &MIPS &2020 &Comfast &CF-WR650AC &MIPS &2020 \\ \hline Compex &WP546 &MIPS &2020 &Compex &WPE72 &MIPS &2020 &D-Link &DAP-2230 &MIPS &2020 \\ \hline \rowcolor{lightblue} D-Link &DAP-2330 &MIPS &2020 &D-Link &DAP-2660 &MIPS &2020 &D-Link &DAP-3320 &MIPS &2020 \\ \hline D-Link &DAP-3662 &MIPS &2020 &D-Link &DHP-1565 A1 &MIPS &2020 &D-Link &DIR-825 C1 &MIPS &2020 \\ \hline \rowcolor{lightblue} D-Link &DIR-825 Rev.B &MIPS &2020 &D-Link &DIR-835 A1 &MIPS &2020 &D-Link &DIR-859 &MIPS &2020 \\ \hline D-Link &DIR-860L A1 &ARM &2020 &D-Link &DIR-860L B1 &MIPS &2020 &D-Link &DIR-862 &MIPS &2020 \\ \hline \rowcolor{lightblue} D-Link &DIR-866 &MIPS &2020 &D-Link &DIR-868l Rev.A &ARM &2020 &D-Link &DIR-868l Rev.B &ARM &2020 \\ \hline D-Link &DIR-868l Rev.C &ARM &2020 &D-Link &DIR-869 &MIPS &2020 &D-Link &DIR-878 A1 &MIPS &2020 \\ \hline \rowcolor{lightblue} D-Link &DIR-880l &ARM &2020 &D-Link &DIR-882 A1 &MIPS &2020 &D-Link &DIR-885l &ARM &2020 \\ \hline D-Link &DIR-890l &ARM &2020 &D-Link &DIR632A &MIPS &2020 &GL.iNet &AR150 &MIPS &2020 \\ \hline \rowcolor{lightblue} Gateworks &GW2382 &ARM &2018 &Gateworks &GW2388 16M &ARM &2018 &Gateworks &GW2391 &ARM &2018 \\ \hline Gateworks &Laguna GW2382 &ARM &2020 &Gateworks &Laguna GW2388 32M &ARM &2020 &Gateworks &Laguna GW2391 &ARM &2020 \\ \hline \rowcolor{lightblue} Gigaset &SX763 &MIPS &2020 &JJPlus &JA76PF &MIPS &2020 &Linksys &E1700 &MIPS &2020 \\ \hline Linksys &E2100L &MIPS &2020 &Linksys &EA6350 &ARM &2020 &Linksys &EA6400 &ARM &2020 \\ \hline \rowcolor{lightblue} Linksys &EA6500 v2 &ARM &2020 &Linksys &EA6700 &ARM &2020 &Linksys &EA6900 &ARM &2020 \\ \hline Linksys &EA8500 &ARM &2020 &Linksys &RE7000 &MIPS &2020 &Linksys &WRT610N v1.0 &MIPS &2020 \\ \hline \rowcolor{lightblue} NETGEAR &AC1450 &ARM &2020 &NETGEAR &EX6200 &ARM &2018 &NETGEAR &R6250 &MIPS &2020 \\ \hline NETGEAR &R6300v2 &ARM &2020 &NETGEAR &R6400 &ARM &2020 &NETGEAR &R6700 &ARM &2020 \\ \hline \rowcolor{lightblue} NETGEAR &R6700v3 &ARM &2020 &NETGEAR &R7000 &ARM &2020 &NETGEAR &R7000P &ARM &2020 \\ \hline NETGEAR &R7500v1 &ARM &2020 &NETGEAR &R7500v2 &ARM &2020 &NETGEAR &R7800 &ARM &2020 \\ \hline \rowcolor{lightblue} NETGEAR &R8500 &ARM &2020 &NETGEAR &R8900 &ARM &2020 &NETGEAR &R9000 &ARM &2020 \\ \hline NETGEAR &WG302v2 &ARM &2020 &NETGEAR &WNDR3700v4 &MIPS &2020 &NETGEAR &WNDR4300 &MIPS &2020 \\ \hline \rowcolor{lightblue} NETGEAR &WNDR4500 &MIPS &2020 &NETGEAR &WNDR4500v2 &MIPS &2020 &NETGEAR &XR450 &ARM &2020 \\ \hline NETGEAR &XR500 &ARM &2020 &NETGEAR &XR700 &ARM &2020 &Pronghorn &SBC &ARM &2020 \\ \hline \rowcolor{lightblue} Senao &ECB3500 &MIPS &2020 &Senao &ECB9750 &MIPS &2019 &Senao &EOC1650 &MIPS &2020 \\ \hline Senao &EOC5510 &MIPS &2020 &Senao &EOC5610 &MIPS &2020 &Senao &EOC5611 &MIPS &2020 \\ \hline \rowcolor{lightblue} Senao &NOP8670 &ARM &2020 &TP-Link &Archer A7 V5 &MIPS &2020 &TP-Link &Archer C1900 &ARM &2020 \\ \hline TP-Link &Archer C25 V1 &MIPS &2020 &TP-Link &Archer C5 V1 &MIPS &2020 &TP-Link &Archer C7 V1 &MIPS &2020 \\ \hline \rowcolor{lightblue} TP-Link &Archer C7 V2 &MIPS &2020 &TP-Link &Archer C7 V3 &MIPS &2020 &TP-Link &Archer C7 V4 &MIPS &2020 \\ \hline TP-Link &Archer C8 V1 &ARM &2020 &TP-Link &Archer C9 V1 &ARM &2020 &TP-Link &Archer C9 V2 &ARM &2020 \\ \hline \rowcolor{lightblue} TP-Link &Archer C9 V3 &ARM &2020 &TP-Link &Deco-M4 &MIPS &2020 &TP-Link &TL-WDR3600 V1 &MIPS &2020 \\ \hline TP-Link &TL-WDR4300 V1 &MIPS &2020 &TP-Link &TL-WDR4310 V1 &MIPS &2020 &TP-Link &TL-WDR4900 V2 &MIPS &2020 \\ \hline \rowcolor{lightblue} TP-Link &TL-WR1043N V5 &MIPS &2020 &TP-Link &TL-WR1043ND &MIPS &2020 &TP-Link &TL-WR1043ND V2 &MIPS &2020 \\ \hline TP-Link &TL-WR1043ND V4 &MIPS &2020 &TP-Link &TL-WR2543ND &MIPS &2020 &TP-Link &TL-WR710N V1 &MIPS &2020 \\ \hline \rowcolor{lightblue} TP-Link &TL-WR710N V2.1.0 &MIPS &2020 &TP-Link &TL-WR810N V1 &MIPS &2020 &TP-Link &TL-WR810N V2 &MIPS &2020 \\ \hline TP-Link &TL-WR842N V1 &MIPS &2020 &TP-Link &TL-WR842N V2 &MIPS &2020 &TRENDnet &TEW-811DRU &ARM &2018 \\ \hline \rowcolor{lightblue} TRENDnet &TEW-812DRU V2 &ARM &2018 &TRENDnet &TEW-818DRU &ARM &2020 &TRENDnet &TEW-828DRU &ARM &2020 \\ \hline Ubiquiti &AirGrid M2 &MIPS &2020 &Ubiquiti &AirGrid M5 &MIPS &2020 &Ubiquiti &AirGrid-M5-XW &MIPS &2020 \\ \hline \rowcolor{lightblue} Ubiquiti &AirRouter &MIPS &2020 &Ubiquiti &AirRouter-HP &MIPS &2020 &Ubiquiti &AirWire &MIPS &2020 \\ \hline Ubiquiti &BulletM2 HP &MIPS &2020 &Ubiquiti &BulletM5 HP &MIPS &2020 &Ubiquiti &LS SR71A &MIPS &2020 \\ \hline \rowcolor{lightblue} Ubiquiti &NanoBeam AC &MIPS &2020 &Ubiquiti &NanoBeam M2 XW &MIPS &2020 &Ubiquiti &NanoBeam M5 XW &MIPS &2020 \\ \hline Ubiquiti &NanoBridge M2 &MIPS &2020 &Ubiquiti &NanoBridge M2 XW &MIPS &2020 &Ubiquiti &NanoBridge M3 &MIPS &2020 \\ \hline \rowcolor{lightblue} Ubiquiti &NanoBridge M365 &MIPS &2020 &Ubiquiti &NanoBridge M5 XW &MIPS &2020 &Ubiquiti &NanoBridge M900 &MIPS &2020 \\ \hline Ubiquiti &NanoStation M2 &MIPS &2020 &Ubiquiti &NanoStation M3 &MIPS &2020 &Ubiquiti &NanoStation M365 &MIPS &2020 \\ \hline \rowcolor{lightblue} Ubiquiti &Pico M5 &MIPS &2020 &Ubiquiti &Power AP N &MIPS &2020 &Ubiquiti &PowerBeam M5 M400 XW &MIPS &2020 \\ \hline Ubiquiti &PowerBridge M10 &MIPS &2020 &Ubiquiti &PowerBridge M5 &MIPS &2020 &Ubiquiti &Rocket M2 Titanium XW &MIPS &2020 \\ \hline \rowcolor{lightblue} Ubiquiti &Rocket M2 XW &MIPS &2020 &Ubiquiti &Rocket M5 Titanium XW &MIPS &2020 &Ubiquiti &Rocket M5 X3 XW &MIPS &2020 \\ \hline Ubiquiti &Rocket M5 XW &MIPS &2020 &Ubiquiti &RocketM2 &MIPS &2020 &Ubiquiti &RocketM3 &MIPS &2020 \\ \hline \rowcolor{lightblue} Ubiquiti &RocketM365 &MIPS &2020 &Ubiquiti &RocketM5 &MIPS &2020 &Ubiquiti &RocketM900 &MIPS &2020 \\ \hline Ubiquiti &RouterStation &MIPS &2020 &Ubiquiti &RouterStation Pro &MIPS &2020 &Ubiquiti &sunMax &MIPS &2020 \\ \hline \rowcolor{lightblue} Ubiquiti &UAP-AC-MESH &MIPS &2020 &Ubiquiti &UAP-AC-PRO &MIPS &2020 &Ubiquiti &UAP-LR &MIPS &2020 \\ \hline Ubiquiti &UAP-LR-v2 &MIPS &2020 &Ubiquiti &UAP-v2 &MIPS &2020 &Ubiquiti &locoM2 &MIPS &2020 \\ \hline \rowcolor{lightblue} Ubiquiti &locoM2 XW &MIPS &2020 &Ubiquiti &locoM5 &MIPS &2020 &Ubiquiti &locoM5 XW &MIPS &2020 \\ \hline Ubiquiti &locoM900 &MIPS &2020 &WiliGear &WBD-500 &MIPS &2020 &YunCore &XD3200 &MIPS &2020 \\ \bottomrule[1.1pt] \end{tabular} \end{table*} \subsection{Probing Learned Execution Semantics} \label{subsec:probe_case} As discussed in Section~\ref{sec:overview}, training the model to predict masked micro-trace codes and values compels the model to learn execution semantics by concrete examples. It thus automates the extraction of the code's dynamic features without manual effort. In this section, we study concrete code examples showing the potential hint in the code that the model likely leverages to predict the masked part. \begin{figure}[!t] \centering \includegraphics[width=\linewidth]{./figs/case/arithmetic.pdf} \caption{The partial micro-trace code and value sequence from function \texttt{BinarySource\_get\_rsa\_ssh1\_pub} in PuTTy-0.74 compiled to x64 with \texttt{O0}. We mask the register \colorbox{lightgray}{\texttt{rax}} at line 3 and the opcode \colorbox{lightgray}{\texttt{add}} at line 4. We also mask their corresponding micro-trace values (where opcode has only dummy values (8 \texttt{\#\#}s) as described in Section~\ref{subsec:input_repr}). We highlight the contextual hint in \colorbox{myblue}{blue} that \textsc{Trex}\xspace leverages to predict the masked \colorbox{lightgray}{\texttt{rax}} and \colorbox{lightred}{red} that \textsc{Trex}\xspace uses to predict the masked \colorbox{lightgray}{\texttt{add}}.} \label{fig:arithmetic} \end{figure} \vspace{.1cm}\noindent\textbf{Predicting arithmetic instructions.} Consider the example in Figure~\ref{fig:arithmetic}, which shows the function's micro-trace (\emph{i.e., } the dynamic value and assembly code). For ease of exposition, the format of micro-trace values (\emph{e.g., } the value of opcode and constants) are not exactly the same as the actual format we handle, as described in Section~\ref{subsec:input_repr}. We mask the register \texttt{rax} and opcode \texttt{add} and their corresponding values in a sequence of arithmetic instructions. To correctly predict the masked value \texttt{0x4c0469a} of \texttt{rax}, the model should understand the approximate execution semantics of \texttt{sub} in line 2, which subtracts \texttt{rax} with \texttt{rcx}. It may also observe the value of \texttt{rax} at line 4, which exactly equals the result of adding \texttt{rax} with 7 at line 3. Therefore, we see the model predicts \texttt{rax} with 96\% confidence and \texttt{rcx} with only 3\%. It also predicts the value of \texttt{rax} correctly (right table). To correctly predict \texttt{add} at line 4, the model should observe that the \texttt{rax} at line 5 has the same exact value with the result of \texttt{rax+rcx} at line 4, so it predicts the opcode at line 4 to be \texttt{add}. As shown in Figure~\ref{fig:arithmetic}, our pretrained model predicts \texttt{add} with 98\% confidence and \texttt{mov} with only 1\%, which implies that the model approximately understands the execution semantics of \texttt{add} and \texttt{mov} so it predicts that \texttt{add} is much more likely. \vspace{.1cm}\noindent\textbf{Predicting stack operations.} Consider the example in Figure~\ref{fig:stack}. We mask the register and constant of the instruction in function epilogue -- it increments the stack pointer \texttt{rsp} by \texttt{0x20} to deallocate the local variable stored on stack. To correctly predict the masked \texttt{rsp} and its value \texttt{0x8b4a3f}, the model should observe the \texttt{rsp} is decremented (due to opcode \texttt{sub}) by \texttt{0x20} from \texttt{0x8b4a3f} at line 3, which is part of the function prologue. Therefore, the model should understand the execution semantics of \texttt{sub} and basic syntax of function prologue and epilogue. To predict the masked constant \texttt{0x20}, the model should notice that line 3 decrements the stack pointer by \texttt{0x20}, which is the size of local variables. As the model predicts \texttt{0x20} with 99\% confidence, this implies the model likely learns patterns of function prologue and epilogue, including the context such as \texttt{push ebp}, \texttt{pop ebp}, etc. This observation indicates that our pretraining task assists in learning common function idiom (function calling convention) beyond execution semantics of individual instructions. Learning such knowledge can potentially help other tasks beyond function similarity, such as identifying function boundaries~\cite{pei2021xda}. \begin{figure}[!t] \centering \includegraphics[width=.95\linewidth]{./figs/case/stack.pdf} \caption{The partial code and micro-trace from function \texttt{closeUnixFile} in SQLite-3.34.0 compiled to x64 with \texttt{O0}. We mask the register \colorbox{lightgray}{\texttt{rsp}} and constant \colorbox{lightgray}{\texttt{0x20}} at line 4. We also mask their corresponding micro-trace values. We highlight the contextual hint in \colorbox{lightred}{red} that \textsc{Trex}\xspace leverages to predict the masked \colorbox{lightgray}{\texttt{rsp}} and \colorbox{lightgray}{\texttt{0x20}}.} \label{fig:stack} \end{figure} \end{appendix} \section{Case Studies} \label{sec:case} In this section, we study how \textsc{Trex}\xspace can help discover new vulnerabilities in a large volume of latest firmware images. \begin{table}[!t] \footnotesize \setlength{\tabcolsep}{4pt} \centering \renewcommand{\arraystretch}{1} \setlength\aboverulesep{0.4pt} \setlength\belowrulesep{0.4pt} \caption{Vulnerabilities we have confirmed (\cmark) in firmware images (latest version) from 4 well-known vendors and products.} \label{tab:cve_case} \begin{tabular}{r?{1.1pt}c|c|c|c} \toprule[1.1pt] \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{CVE}}} & \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{\begin{tabular}[c]{@{}c@{}}Ubiquiti\\ sunMax\end{tabular}}}} & \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{\begin{tabular}[c]{@{}c@{}}TP-Link\\ Deco-M4\end{tabular}}}} & \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{\begin{tabular}[c]{@{}c@{}}NETGEAR\\ R7000\end{tabular}}}} & \multicolumn{1}{c}{\multirow{2}{*}{\textbf{\begin{tabular}[c]{@{}c@{}}Linksys\\ RE7000\end{tabular}}}} \\ \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c}{} \\ \midrule[.9pt] CVE-2019-1563 & \cmark & \cmark & \cmark & \xmark \\ \hline \rowcolor{lightblue} CVE-2017-16544 & \xmark & \cmark & \xmark & \xmark \\ \hline CVE-2016-6303 & \cmark & \cmark & \cmark & \cmark \\ \hline \rowcolor{lightblue} CVE-2016-6302 & \cmark & \cmark & \cmark & \cmark \\ \hline CVE-2016-2842 & \cmark & \cmark & \cmark & \cmark \\ \hline \rowcolor{lightblue} CVE-2016-2182 & \cmark & \cmark & \cmark & \cmark \\ \hline CVE-2016-2180 & \cmark & \cmark & \cmark & \cmark \\ \hline \rowcolor{lightblue} CVE-2016-2178 & \cmark & \cmark & \cmark & \cmark \\ \hline CVE-2016-2176 & \cmark & \cmark & \xmark & \cmark \\ \hline \rowcolor{lightblue} CVE-2016-2109 & \cmark & \cmark & \xmark & \cmark \\ \hline CVE-2016-2106 & \cmark & \cmark & \xmark & \cmark \\ \hline \rowcolor{lightblue} CVE-2016-2105 & \cmark & \cmark & \xmark & \cmark \\ \hline CVE-2016-0799 & \cmark & \cmark & \xmark & \cmark \\ \hline \rowcolor{lightblue} CVE-2016-0798 & \cmark & \cmark & \xmark & \cmark \\ \hline CVE-2016-0797 & \cmark & \cmark & \xmark & \cmark \\ \hline \rowcolor{lightblue} CVE-2016-0705 & \cmark & \cmark & \xmark & \cmark \\ \bottomrule[1.1pt] \end{tabular} \end{table} Firmware images often include third-party libraries (\emph{i.e., } BusyBox, OpenSSL). However, these libraries are frequently patched, but the manufacturers often fall behind to update them accordingly~\cite{OWASP}. Therefore, we study whether our tool can uncover function binaries in firmware images similar to known vulnerable functions. We find existing state-of-the-art binary similarity tools (\emph{i.e., } SAFE~\cite{massarelli2019safe}, Asm2Vec~\cite{ding2019asm2vec}, Gemini~\cite{xu2017neural}) all perform their case studies on the firmware images and vulnerabilities that have already been studied before them~\cite{costin2014large, feng2016scalable, david2016statistical, chen2016towards}. Therefore, we decide to collect our own dataset with more updated firmware images and the latest vulnerabilities, instead of reusing the existing benchmarks. This facilitates finding new (1-day) vulnerabilities in most recent firmware images that are not disclosed before. We crawl firmware images (in their latest version) in 180 products including WLAN routers, smart cameras, and solar panels, from well-known manufacturers' official releases and third-party providers such as DD-WRT~\cite{ddwrt}, as shown in Table~\ref{tab:firmware}. We collect firmware images with only the latest version, which are much more updated than those studied in the state-of-the-art (dated before 2015, which are all patched before their studies). For each function in the firmware images, we construct function embedding and build a firmware image database using Open Distro for Elasticsearch~\cite{elastic}, which supports vector-based indexing with efficient search support based on NMSLIB~\cite{boytsov2013engineering}. We extract the firmware images using binwalk~\cite{binwalk}. In total, we collect 180 number of firmware images from 22 vendors. These firmware images are developed by the original vendors, or from third-party providers such as DD-WRT~\cite{ddwrt}. Most of them are for WLAN routers, while some are deployed in other embedded systems, such as solar panels and smart cameras. Among the firmware images, 127 of them are compiled for MIPS 32-bit and 53 are compiled for ARM 32-bit. 169 of them are 2020 models, and the rest are 2019 and 2018 models. \begin{table}[!t] \footnotesize \setlength{\tabcolsep}{7pt} \centering \renewcommand{\arraystretch}{1} \setlength\aboverulesep{0.4pt} \setlength\belowrulesep{0.4pt} \caption{We study 16 vulnerabilities from OpenSSL and BusyBox, two widely-used libraries in firmware images.} \label{tab:cve} \begin{tabular}{r|l|l} \toprule[1.1pt] \textbf{CVE} & \textbf{Library} & \textbf{Description} \\ \midrule[.9pt] CVE-2019-1563 & OpenSSL & Decrypt encrypted message \\ \hline \rowcolor{lightblue} CVE-2017-16544 & BusyBox & Allow executing arbitrary code \\ \hline CVE-2016-6303 & OpenSSL & Integer overflow \\ \hline \rowcolor{lightblue} CVE-2016-6302 & OpenSSL & Allows denial-of-service \\ \hline CVE-2016-2842 & OpenSSL & Allows denial-of-service \\ \hline \rowcolor{lightblue} CVE-2016-2182 & OpenSSL & Allows denial-of-service \\ \hline CVE-2016-2180 & OpenSSL & Out-of-bounds read \\ \hline \rowcolor{lightblue} CVE-2016-2178 & OpenSSL & Leak DSA private key \\ \hline CVE-2016-2176 & OpenSSL & Buffer over-read \\ \hline \rowcolor{lightblue} CVE-2016-2109 & OpenSSL & Allows denial-of-service \\ \hline CVE-2016-2106 & OpenSSL & Integer overflow \\ \hline \rowcolor{lightblue} CVE-2016-2105 & OpenSSL & Integer overflow \\ \hline CVE-2016-0799 & OpenSSL & Out-of-bounds read \\ \hline \rowcolor{lightblue} CVE-2016-0798 & OpenSSL & Allows denial-of-service \\ \hline CVE-2016-0797 & OpenSSL & NULL pointer dereference \\ \hline \rowcolor{lightblue} CVE-2016-0705 & OpenSSL & Memory corruption \\ \bottomrule[1.1pt] \end{tabular} \end{table} Table~\ref{tab:cve_case} shows 16 vulnerabilities (CVEs) we use to search in the firmware images. We focus on the CVEs of OpenSSL and BusyBox, as they are widely included in the firmware. For each CVE, we compile the corresponding vulnerable functions in the specified library version and computes the vulnerable function embeddings via \textsc{Trex}\xspace. As the firmware images are stripped so that we do not know with which optimizations they are compiled, we compile the vulnerable functions to both MIPS and ARM with \texttt{-O3} and rely on \textsc{Trex}\xspace's capability in cross-architecture and optimization function matching to match functions that are potentially compiled in different architectures and with different optimizations. We then obtain the firmware functions that rank top-10 similar to the vulnerable function and manually verify if they are vulnerable. We leverage \texttt{strings} command to identify the OpenSSL and BusyBox versions indicative of the corresponding vulnerabilities. Note that such information can be stripped for other libraries so it is not a reliable approach in general. As shown in Table~\ref{tab:cve_case}, we have confirmed all 16 CVEs in 4 firmware models developed by well-known vendors, \emph{i.e., } Ubiquiti, TP-Link, NETGEAR, and Linksys. These cases demonstrate the practicality of \textsc{Trex}\xspace, which helps discover real-world vulnerabilities in large-scale firmware databases. Table~\ref{tab:cve} shows the details of the 16 vulnerabilities that \textsc{Trex}\xspace uncover in the 4 firmware images shown in Table~\ref{tab:cve_case}. The description of ``allow denial-of-service'' usually refers to the segmentation fault that crashes the program. The cause of such error can be diverse, which is not due to the other typical causes shown in the table (\emph{e.g., } integer overflow, buffer over-read, etc.). \section{Conclusion} \label{sec:conclusion} We introduced \textsc{Trex}\xspace to match semantically similar functions based on the function execution semantics. Our key insight is to first pretrain the ML model to explicitly learn approximate execution semantics based on the functions' mico-traces and then transfer the learned knowledge to match semantically similar functions. Our evaluation showed that the learned approximate execution semantics drastically improves the accuracy of matching semantically similar functions -- \textsc{Trex}\xspace excels in matching functions across different architectures, optimizations, and obfuscations. We plan to explore in our future work how the learned execution semantics of the code can further boost the performance of broader (binary) program analysis tasks such as decompilation. \section{Discussion} \label{sec:discussion} \vspace{.1cm} \noindent\textbf{Definition of pretraining and finetuning.} A typical difference between pretraining and finetuning in NLP is pretraining is often self-/un-supervised while finetuning is supervised. Besides, pretraining is often believed responsible for heavy-lifting, with huge amount of training corpus and parameter updates. While in finetuning, the training process often does not significantly update the ``knowledge'' of the pretrained model. Instead, it is often light-weight with small extra layers and number of training epochs. In general, pretraining learns task-agnostic general knowledge while finetuning learns for task-specific downstream tasks. In the setting of this project, such distinction becomes not so obvious, as our finetuning task (function similarity) does not necessarily requires any labeling effort. Particularly, we can cheaply collect the same source code and compile into different architectures, optimizations, and obfuscations. Therefore, we believe our finetuning task can also be leveraged to learn general semantic representation of the code. By encouraging the model to produce similar embeddings for same functions with different transformations, we teach the model invariances of underlying code semantics. We plan to explore this direction in the future work. \section{Evaluation} \label{sec:eval} Our evaluation aims to answer the following questions. \begin{itemize} \item RQ1: How accurate is \textsc{Trex}\xspace in matching semantically similar function binaries across different architectures, optimizations, and obfuscations? \item RQ2: How does \textsc{Trex}\xspace compare to the state-of-the-art? \item RQ3: How fast is \textsc{Trex}\xspace compared to other tools? \item RQ4: How much does pretraining on micro-traces help improve the accuracy of matching functions? \end{itemize} \begin{table}[!t] \footnotesize \setlength{\tabcolsep}{5.5pt} \centering \renewcommand{\arraystretch}{1} \setlength\aboverulesep{0.4pt} \setlength\belowrulesep{0.4pt} \caption{\textsc{Trex}\xspace results (in AUC score) on function pairs across architectures, optimizations, and obfuscations. } \label{tab:result} \begin{tabular}{r?{1.1pt}ccccc} \toprule[1.1pt] \multirow{2}{*}{} & \multicolumn{5}{c}{\textbf{Cross-}} \\ \cline{2-6} & \multicolumn{1}{c|}{\textbf{ARCH}} & \multicolumn{1}{c|}{\textbf{OPT}} & \multicolumn{1}{c|}{\textbf{OBF}} & \multicolumn{1}{c|}{\textbf{\begin{tabular}[c]{@{}l@{}}ARCH+\\ OPT\end{tabular}}} & \multicolumn{1}{c}{\textbf{\begin{tabular}[c]{@{}l@{}}ARCH+\\ OPT+\\ OBF\end{tabular}}} \\ \midrule[.9pt] \rowcolor{lightblue} \textbf{Binutils} & \multicolumn{1}{c|}{0.993} & \multicolumn{1}{c|}{0.993} & \multicolumn{1}{c|}{0.991} & \multicolumn{1}{c|}{0.959} & 0.947 \\ \hline \textbf{Coreutils} & \multicolumn{1}{c|}{0.991} & \multicolumn{1}{c|}{0.992} & \multicolumn{1}{c|}{0.991} & \multicolumn{1}{c|}{0.956} & 0.945 \\ \hline \rowcolor{lightblue} \textbf{Curl} & \multicolumn{1}{c|}{0.993} & \multicolumn{1}{c|}{0.993} & \multicolumn{1}{c|}{0.991} & \multicolumn{1}{c|}{0.958} & 0.956 \\ \hline \textbf{Diffutils} & \multicolumn{1}{c|}{0.992} & \multicolumn{1}{c|}{0.992} & \multicolumn{1}{c|}{0.990} & \multicolumn{1}{c|}{0.970} & 0.961 \\ \hline \rowcolor{lightblue} \textbf{Findutils} & \multicolumn{1}{c|}{0.990} & \multicolumn{1}{c|}{0.992} & \multicolumn{1}{c|}{0.990} & \multicolumn{1}{c|}{0.965} & 0.963 \\ \hline \textbf{GMP} & \multicolumn{1}{c|}{0.992} & \multicolumn{1}{c|}{0.993} & \multicolumn{1}{c|}{0.990} & \multicolumn{1}{c|}{0.968} & 0.966 \\ \hline \rowcolor{lightblue} \textbf{ImageMagick} & \multicolumn{1}{c|}{0.993} & \multicolumn{1}{c|}{0.993} & \multicolumn{1}{c|}{0.989} & \multicolumn{1}{c|}{0.960} & 0.951 \\ \hline \textbf{Libmicrohttpd} & \multicolumn{1}{c|}{0.994} & \multicolumn{1}{c|}{0.994} & \multicolumn{1}{c|}{0.991} & \multicolumn{1}{c|}{0.972} & 0.969 \\ \hline \rowcolor{lightblue} \textbf{LibTomCrypt} & \multicolumn{1}{c|}{0.992} & \multicolumn{1}{c|}{0.994} & \multicolumn{1}{c|}{0.991} & \multicolumn{1}{c|}{0.981} & 0.970 \\ \hline \textbf{OpenSSL} & \multicolumn{1}{c|}{0.992} & \multicolumn{1}{c|}{0.992} & \multicolumn{1}{c|}{0.989} & \multicolumn{1}{c|}{0.964} & 0.956 \\ \hline \rowcolor{lightblue} \textbf{PuTTy} & \multicolumn{1}{c|}{0.992} & \multicolumn{1}{c|}{0.995} & \multicolumn{1}{c|}{0.990} & \multicolumn{1}{c|}{0.961} & 0.952 \\ \hline \textbf{SQLite} & \multicolumn{1}{c|}{0.991} & \multicolumn{1}{c|}{0.994} & \multicolumn{1}{c|}{0.993} & \multicolumn{1}{c|}{0.980} & 0.959 \\ \hline \rowcolor{lightblue} \textbf{Zlib} & \multicolumn{1}{c|}{0.990} & \multicolumn{1}{c|}{0.991} & \multicolumn{1}{c|}{0.990} & \multicolumn{1}{c|}{0.979} & 0.965 \\ \midrule[.9pt] \textbf{Average} & \multicolumn{1}{c|}{0.992} & \multicolumn{1}{c|}{0.993} & \multicolumn{1}{c|}{0.990} & \multicolumn{1}{c|}{0.967} & 0.958 \\ \bottomrule[1.1pt] \end{tabular} \end{table} \subsection{RQ1: Accuracy} \label{subsec:rq1} We evaluate how accurate \textsc{Trex}\xspace is in matching similar functions across different architectures, optimizations, and obfuscations. As shown in Table~\ref{tab:result}, we prepare function pairs for each project (first column) with 5 types of partitions. (1) ARCH: the function pairs have \emph{different architectures} but same optimizations without obfuscations (2nd column). (2) OPT: the function pairs have \emph{different optimizations} but same architectures without obfuscations (3rd column). (3) OBF: the function pairs have \emph{different obfuscations} with same architectures (x64) and no optimization (4th column). (4) ARCH+OPT: the function pairs have \emph{both different architectures and optimizations} without obfuscations (5th column). (5) ARCH+OPT+OBF: the function pairs can come from arbitrary architectures, optimizations, and obfuscations (6th column). Table~\ref{tab:result} reports the mean testing AUC scores of \textsc{Trex}\xspace on each project with 3 runs. On average, \textsc{Trex}\xspace achieves $>0.958$ (and up to 0.995) AUC scores, even in the most challenging setting where the functions can come from different architectures, optimizations, and obfuscations at the same time. We note that \textsc{Trex}\xspace performs the best on cross-optimization matching. This is intuitive as the syntax of two functions from different optimizations are not changed significantly (\emph{e.g., } the name of opcode, operands remain the same). Nevertheless, we find the AUC scores for matching functions from different architectures is only 0.001 lower, which indicates the model is robust to entirely different syntax between two architectures. On matching functions with different obfuscations, \textsc{Trex}\xspace's results are 0.026, on average, lower than that of cross-optimizations, which indicates the obfuscation changes the code more drastically. Section~\ref{subsec:rq2} will show the specific results of \textsc{Trex}\xspace on each obfuscations. \subsection{RQ2: Baseline Comparison} \label{subsec:rq2} \vspace{.1cm}\noindent\textbf{Cross-architecture search.} As described in Section~\ref{sec:impl}, we first compare \textsc{Trex}\xspace with SAFE and Gemini on OpenSSL-1.0.1f and OpenSSL-1.0.1u with their reported numbers (as they only evaluate on these two projects). We then run SAFE's released model on our dataset and compare to \textsc{Trex}\xspace. We use our testing setup (see Section~\ref{sec:impl}) to evaluate SAFE's trained model, where 90\% of the total functions of those in Table~\ref{tab:dataset} are used to construct the testing set. These testing sets are much larger than that in SAFE, where they only evaluate on 20\% of the OpenSSL functions. Note that the dataset used in SAFE are all compiled by \texttt{GCC-5.4} at the time when it is publicized (November 2018), while ours are compiled by \texttt{GCC-7.5} (April 2020). We find these factors (the more diverse dataset and different compilers) can all lead to the possible dataset distribution shift, which often results in the decaying performance of ML models when applied in the security applications~\cite{jordaney2017transcend}. To study the distribution shift, we measure the KL-divergence~\cite{kullback1951information} between SAFE's dataset (OpenSSL compiled by \texttt{GCC-5.4}) and our dataset. Specifically, we use the probability distribution of the raw bytes of the compiled projects' binaries, and compute their KL-divergence between SAFE and ours. As OpenSSL is also a subset of our complete dataset, we compute the KL-divergence between our compiled OpenSSL and that of SAFE as the baseline. We find the KL-divergence is 0.02 between SAFE's dataset and ours, while it decreases to 0.0066 between our compiled OpenSSL and that of SAFE. This indicates that the underlying distribution of our test set shifts from that of SAFE's. Moreover, the KL-divergence of 0.0066 between the same dataset (OpenSSL) but only compiled by different GCC versions implies that the compiler version has much smaller effect to the distribution shift than the different software projects. \begin{figure}[!t] \centering \includegraphics[width=0.8\linewidth]{./figs/compare/roc-drawio-safe-gemini.pdf} \caption{ROC curves of matching functions in OpenSSL across different architectures. \textsc{Trex}\xspace outperforms the reported results of SAFE and Gemini and the results of running SAFE's trained model on our testing set.} \label{fig:cross-arch-roc} \end{figure} As shown in Figure~\ref{fig:cross-arch-roc}, our ROC curve is higher than those reported in SAFE and Gemini. While SAFE's reported AUC score, 0.992, is close to ours, when we run their trained model on our testing set, its AUC score drops to 0.976 -- possibly because our testing set is much larger than theirs. This observation demonstrates the generalizability of \textsc{Trex}\xspace -- when pretrained to approximately learn execution semantics explicitly, it can quickly generalize to match unseen (semantically similar) functions with only a minimal training set. \begin{figure}[!t] \centering \includegraphics[scale=.4]{./figs/compare/cross-arch-auc-legend.pdf} \vspace{.1cm} \includegraphics[width=\linewidth]{./figs/compare/cross-arch-auc.pdf} \caption{Comparison between \textsc{Trex}\xspace and SAFE on matching functions in each project compiled to different architectures (see Table~\ref{tab:dataset}).} \label{fig:cross-arch-auc-safe} \end{figure} Figure~\ref{fig:cross-arch-auc-safe} shows that \textsc{Trex}\xspace consistently outperforms SAFE on all projects, \emph{i.e., } by 7.3\% on average. As the SAFE's model is only trained on OpenSSL, we also follow the same setting by training \textsc{Trex}\xspace on only OpenSSL, similar to the cross-project setting described in Section~\ref{subsec:rq1}. \vspace{.1cm}\noindent\textbf{Cross-optimization search.} We compare \textsc{Trex}\xspace with Asm2Vec and BLEX on matching functions compiled by different optimizations. As both Asm2vec and Blex run on single architecture, we restrict the comparison on x64. Besides, since Asm2Vec uses Precision@1 and Blex uses accuracy as the metric (discussed in Section~\ref{sec:impl}), we compare with each tool separately using their metrics and on their evaluated dataset. \begin{table}[!t] \footnotesize \setlength{\tabcolsep}{8pt} \centering \renewcommand{\arraystretch}{1} \setlength\aboverulesep{0.4pt} \setlength\belowrulesep{0.4pt} \caption{Comparison between \textsc{Trex}\xspace and Asm2Vec (in Precision@1) on function pairs across optimizations. } \label{tab:result-asm2vec} \begin{tabular}{r?{1.1pt}cccc} \toprule[1.1pt] \multicolumn{1}{c?{1.1pt}}{} & \multicolumn{4}{c}{Cross Compiler Optimization} \\ \cline{2-5} \multicolumn{1}{l?{1.1pt}}{} & \multicolumn{2}{c?{1.1pt}}{\texttt{O2} and \texttt{O3}} & \multicolumn{2}{c}{\texttt{O0} and \texttt{O3}} \\ \cline{2-5} \multicolumn{1}{c?{1.1pt}}{\textbf{}} & \multicolumn{1}{c|}{\textsc{Trex}\xspace} & \multicolumn{1}{c?{1.1pt}}{Asm2Vec} & \multicolumn{1}{c|}{\textsc{Trex}\xspace} & Asm2Vec \\ \midrule[.9pt] \rowcolor{lightblue} Coreutils & \multicolumn{1}{c|}{\textbf{0.955}} & \multicolumn{1}{c?{1.1pt}}{0.929} & \multicolumn{1}{c|}{\textbf{0.913}} & 0.781 \\ \hline Curl & \multicolumn{1}{c|}{\textbf{0.961}} & \multicolumn{1}{c?{1.1pt}}{0.951} & \multicolumn{1}{c|}{\textbf{0.894}} & 0.850 \\ \hline \rowcolor{lightblue} GMP & \multicolumn{1}{c|}{\textbf{0.974}} & \multicolumn{1}{c?{1.1pt}}{0.973} & \multicolumn{1}{c|}{\textbf{0.886}} & 0.763 \\ \hline ImageMagick & \multicolumn{1}{c|}{\textbf{0.971}} & \multicolumn{1}{c?{1.1pt}}{0.971} & \multicolumn{1}{c|}{\textbf{0.891}} & 0.837 \\ \hline \rowcolor{lightblue} LibTomCrypt & \multicolumn{1}{c|}{\textbf{0.991}} & \multicolumn{1}{c?{1.1pt}}{0.991} & \multicolumn{1}{c|}{\textbf{0.923}} & 0.921 \\ \hline OpenSSL & \multicolumn{1}{c|}{\textbf{0.982}} & \multicolumn{1}{c?{1.1pt}}{0.931} & \multicolumn{1}{c|}{\textbf{0.914}} & 0.792 \\ \hline \rowcolor{lightblue} PuTTy & \multicolumn{1}{c|}{\textbf{0.956}} & \multicolumn{1}{c?{1.1pt}}{0.891} & \multicolumn{1}{c|}{\textbf{0.926}} & 0.788 \\ \hline SQLite & \multicolumn{1}{c|}{\textbf{0.931}} & \multicolumn{1}{c?{1.1pt}}{0.926} & \multicolumn{1}{c|}{\textbf{0.911}} & 0.776 \\ \hline \rowcolor{lightblue} Zlib & \multicolumn{1}{c|}{\textbf{0.890}} & \multicolumn{1}{c?{1.1pt}}{0.885} & \multicolumn{1}{c|}{\textbf{0.902}} & 0.722 \\ \midrule[.9pt] Average & \multicolumn{1}{c|}{\textbf{0.957}} & \multicolumn{1}{c?{1.1pt}}{0.939} & \multicolumn{1}{c|}{\textbf{0.907}} & 0.803 \\ \bottomrule[1.1pt] \end{tabular} \end{table} Table~\ref{tab:result-asm2vec} shows \textsc{Trex}\xspace outperforms Asm2Vec in Precision@1 (by 7.2\% on average) on functions compiled by different optimizations (\emph{i.e., } between \texttt{O2} and \texttt{O3} and between \texttt{O0} and \texttt{O3}). As the syntactic difference introduced by optimizations between \texttt{O0} and \texttt{O3} is more significant than that between \texttt{O2} and \texttt{O3}, both tools have certain level of decrease in AUC scores (5\% drop for \textsc{Trex}\xspace and 14\% for Asm2Vec), but \textsc{Trex}\xspace's AUC score drops much less than that of Asm2Vec. To compare to Blex, we evaluate \textsc{Trex}\xspace on Coreutils between optimizations \texttt{O0} and \texttt{O3}, where they report to achieve better performance than BinDiff~\cite{bindiff}. As Blex show the matched functions of each individual utility in Coreutils in a barchart without including the concrete numbers of matched functions, we estimate their matched functions using their reported average percentage (75\%) on all utilities. \begin{figure}[!t] \centering \includegraphics[width=.95\linewidth]{./figs/compare/cross-opt-blex.pdf} \caption{Cross-optimization function matching between \texttt{O0} and \texttt{O3} on Coreutils by \textsc{Trex}\xspace and Blex. We sort the 109 utility binaries in Coreutils by their number of functions, and aggregate the matched functions every 10 utilities.} \label{fig:cross-opt-blex} \end{figure} Figure~\ref{fig:cross-opt-blex} shows that \textsc{Trex}\xspace consistently outperforms Blex in number of matched functions in all utility programs of Coreutils. Note that Blex also executes the function and uses the dynamic features to match binaries. The observation here thus implies that the learned execution semantics from \textsc{Trex}\xspace is more effective than the hand-coded features in Blex for matching similar binaries. \vspace{.1cm}\noindent\textbf{Cross-obfuscation search.} We compare \textsc{Trex}\xspace to Asm2Vec on matching obfuscated function binaries with different obfuscation methods. Notably, Asm2Vec is evaluated on obfuscations including bogus control flow (\texttt{bcf}), control flow flattening (\texttt{cff}), and instruction substitution (\texttt{sub}), which are subset of our evaluated obfuscations (Table~\ref{tab:dataset}). As Asm2Vec only evaluates on 4 projects, \emph{i.e., } GMP, ImageMagic, LibTomCrypt, and OpenSSL, we focus on these 4 projects and \textsc{Trex}\xspace's results for other projects are included in Table~\ref{tab:result}. \begin{table}[!t] \footnotesize \setlength{\tabcolsep}{2.5pt} \centering \renewcommand{\arraystretch}{1} \setlength\aboverulesep{0.4pt} \setlength\belowrulesep{0.4pt} \caption{Comparison between \textsc{Trex}\xspace and Asm2Vec (in Precision@1) on function pairs across differet obfuscations. } \label{tab:cross-obf-asm2vec} \begin{tabular}{r|r?{1.1pt}l|l|l|l?{1.1pt}l} \toprule[1.1pt] & & GMP & LibTomCrypt & ImageMagic & OpenSSL & Average \\ \midrule[.9pt] \rowcolor{lightblue} & \textsc{Trex}\xspace & \textbf{0.926} & \textbf{0.938} & \textbf{0.934} & \textbf{0.898} & \textbf{0.924} \\ \cline{2-7} \rowcolor{lightblue} \multirow{-2}{*}{\texttt{bcf}} & Asm2Vec & 0.802 & 0.920 & 0.933 & 0.883 & 0.885 \\ \midrule[.9pt] \multirow{2}{*}{\texttt{ccf}} & \textsc{Trex}\xspace & \textbf{0.943} & \textbf{0.931} & \textbf{0.936} & \textbf{0.940} & \textbf{0.930} \\ \cline{2-7} & Asm2Vec & 0.772 & 0.920 & 0.890 & 0.795 & 0.844 \\ \midrule[.9pt] \rowcolor{lightblue} & \textsc{Trex}\xspace & \textbf{0.949} & \textbf{0.962} & \textbf{0.981} & \textbf{0.980} & \textbf{0.968} \\ \cline{2-7} \rowcolor{lightblue} \multirow{-2}{*}{\texttt{sub}} & Asm2Vec & 0.940 & 0.960 & 0.981 & 0.961 & 0.961 \\ \midrule[.9pt] \multirow{2}{*}{All} & \textsc{Trex}\xspace & \textbf{0.911} & \textbf{0.938} & \textbf{0.960} & \textbf{0.912} & \textbf{0.930} \\ \cline{2-7} & Asm2Vec & 0.854 & 0.880 & 0.830 & 0.690 & 0.814 \\ \bottomrule[1.1pt] \end{tabular} \end{table} Table~\ref{tab:cross-obf-asm2vec} shows \textsc{Trex}\xspace achieves better Precision@1 score (by 14.3\% on average) throughout all different obfuscations. Importantly, the last two rows show when multiple obfuscations are combined, \textsc{Trex}\xspace performance is not dropping as significant as Asm2Vec. It also shows \textsc{Trex}\xspace remains robust under varying obfuscations with different difficulties. For example, instruction substitution simply replaces very limited instructions (\emph{i.e., } arithmetic operations as shown in Section~\ref{sec:overview}) while control flow flattening dramatically changes the function code. Asm2Vec has 12.2\% decreased score when the obfuscation is changed from \texttt{sub} to \texttt{ccf}, while \textsc{Trex}\xspace only decreases by 4\%. \subsection{RQ3: Execution Time} \label{subsec:rq3} We evaluate the runtime performance of generating function embeddings for computing similarity. We compare \textsc{Trex}\xspace with SAFE and Gemini on generating functions in 4 projects on x64 compiled by \texttt{O3}, \emph{i.e., } Binutils, Putty, Findutils, and Diffutils, which have disparate total number of functions (see Table~\ref{tab:dataset}. This tests how \textsc{Trex}\xspace scales to different number of functions compared to other baselines. Since the offline training (\emph{i.e., } pretraining \textsc{Trex}\xspace) of all the learning-based tools is a one-time cost, it can be amortized in the function matching process so we do not explicitly measure the training time. Moreover, the output of all tools are function embeddings, which can be indexed and efficiently searched using locality sensitive hashing (LSH)~\cite{gionis1999similarity, rajaraman2011mining}. Therefore, we do not compare the matching time of function embeddings as it simply depends on the performance of underlying LSH implementation. Particularly, we compare the runtime of two procedures in matching functions. (1) Function parsing, which transforms the function binaries into the format that the model needs. (2) Embedding generation, which takes the parsed function binary as input and computes function embedding. We test the embedding generation using our GPU (see Section~\ref{sec:impl}). \begin{figure}[!t] \centering \includegraphics[scale=.4]{./figs/runtime/runtime_bar_legend.pdf} \subfloat[Function parsing]{ \includegraphics[width=0.47\linewidth]{./figs/runtime/runtime_bar_parse.pdf} \label{subfig:runtime_bar_parse}} \subfloat[Embedding generation]{ \includegraphics[width=0.47\linewidth]{./figs/runtime/runtime_bar_emb.pdf} \label{subfig:runtime_bar_emb}} \caption{Runtime performance (lower is better) of \textsc{Trex}\xspace, SAFE, and Gemini on (a) function parsing and (b) embedding generation. The time is log-scaled.} \label{fig:runtime} \end{figure} Figure~\ref{fig:runtime} shows that \textsc{Trex}\xspace is more efficient than the other tools in both function parsing and embedding generation for functions from 4 different projects with different number of functions (Table~\ref{tab:dataset}). Gemini requires manually constructing control flow graph and extracting inter-/intra-basic-block feature engineering. It thus incurs the largest overhead. For generating function embeddings, our underlying network architectures leverage Transformer self-attention layers, which is more amenable to parallezation with GPU than the recurrent (used by SAFE) and graph neural network (used by Gemini)~\cite{vaswani2017attention}. As a result, \textsc{Trex}\xspace runs up to 8$\times$ faster than SAFE and Gemini. \subsection{RQ4: Ablation Study} \label{subsec:rq4} In this section, we aim to quantify how much each key component in \textsc{Trex}\xspace's design helps the end results. We first study how much does pretraining, argued to assist learning approximate execution semantics, help match function binaries. We then study how does pretraining \emph{without micro-traces} affect the end results. We also test how much does incorporating the micro-traces in the pretraining tasks improve the accuracy. \vspace{.1cm}\noindent\textbf{Pretraining effectiveness.} We compare the testing between AUC scores achieved by \textsc{Trex}\xspace (1) with pretraining (except the target project that will be finetuned), (2) with 66\% of pretraining functions in (1), (3) with 33\% of pretraining functions in (1), and (4) without pretraining (the function embedding is computed by randomly-initialized model weights that are not pretrained). The function pairs can come from arbitrary architectures, optimizations, and obfuscations. \begin{figure}[!t] \centering \includegraphics[scale=.4]{./figs/ablation/ablation-pretrain-effective-legend.pdf} \includegraphics[width=.95\linewidth]{./figs/ablation/ablation-pretrain-effective.pdf} \caption{Comparison of testing AUC scores between models pretrained with different fraction of the pretraining set.} \label{fig:ablation-pretrain} \end{figure} Figure~\ref{fig:ablation-pretrain} shows that the model's AUC score drops significantly (on average 15.7\%) when the model is not pretrained. Interestingly, we observe that the finetuned models achieve similar AUC scores, \emph{i.e., } with only 1\% decrease when pretrained with 33\% of the functions compared to pretraining with all functions. This indicates that we can potentially decrease our pretraining data size to achieve roughly the same performance. However, since our pretraining task does not require collect any label, we can still collect unlimited binary code found in the wild to enrich the semantics that can be observed. \vspace{.1cm}\noindent\textbf{Pretraining w/o micro-traces.} We try to understand whether including the micro-traces in pretraining can really help the model to learn better execution semantics than learning from only static assembly code, which in turn results in better function matching accuracy. Specifically, we pretrain the model on the data that contains only dummy value sequence (see Section~\ref{sec:method}), and follow the same experiment setting as described above. Besides replacing the input value sequence as dummy value, we accordingly remove the prediction of dynamic values in the pretraining objective (Equation~\ref{eq:pretrain}). We also compare to SAFE in this case. Figure~\ref{fig:ablation-pretrain-finetune-trace} shows that the AUC scores decrease by 7.2\% when the model is pretrained without micro-trace. The AUC score of pretrained \textsc{Trex}\xspace without micro-traces is even 0.035 lower than that of SAFE. However, the model still performs reasonably well, achieving 0.88 AUC scores even when the functions can come from arbitrary architectures, optimizations, and obfuscations. Moreover, we observe that pretraining without micro-traces has less performance drop than the model simply not pretrained (7.2\% vs. 15.7\%). This demonstrates that even pretraining with only static assembly code is indeed helpful to improve matching functions. One possible interpretation is that similar functions are statically similar in syntax, while understanding their inherently similar execution semantics just further increases the similarity score. \begin{figure}[!t] \centering \includegraphics[scale=.3]{./figs/ablation/ablation-pretrain-finetune-trace-legend.pdf} \includegraphics[width=\linewidth]{./figs/ablation/ablation-pretrain-finetune-trace.pdf} \caption{Comparison of testing AUC scores between models pretrained \emph{with} micro-trace and pretrained \emph{without} micro-trace.} \label{fig:ablation-pretrain-finetune-trace} \end{figure} \vspace{.1cm}\noindent\textbf{Pretraining accuracy.} We study the testing perplexity (PPL defined in Section~\ref{sec:impl}) of pretraining \textsc{Trex}\xspace to directly validate whether it indeed helps \textsc{Trex}\xspace to learn the approximate execution semantics. The rationale is the good performance, \emph{i.e., } the low PPL, on unseen testing function binaries indicates that \textsc{Trex}\xspace highly likely learns to generalize based on its learned approximate execution semantics. \begin{figure}[!t] \centering \includegraphics[width=0.85\linewidth]{./figs/pretrain/input-combine.pdf} \caption{Testing PPL of pretraining \textsc{Trex}\xspace in 10 epochs. We compare different designs of combining byte-sequence in the micro-trace (see Section~\ref{subsec:input_repr}).} \label{fig:pretrain-loss} \end{figure} The green line in Figure~\ref{fig:pretrain-loss} shows the validation PPL in 10 epochs of pretraining \textsc{Trex}\xspace. The testing set is constructed by sampling 10,000 random functions from the projects used in pretraining (as described in Section~\ref{sec:impl}). We observe that the PPL of \textsc{Trex}\xspace drops to close to 2.1, which is far below that of random guessing (\emph{e.g., } random guessing PPL is $2^{-\log(1/256)}=256$), indicating that \textsc{Trex}\xspace has around 0.48 confidence on average on the masked tokens being the correct value. Note that a random guessing has only 1/256=0.004 confidence on the masked tokens being the correct value. \section{Implementation and Experimental Setup} \label{sec:impl} We implement \textsc{Trex}\xspace using fairseq, a sequence modeling toolkit~\cite{ott2019fairseq}, based on PyTorch 1.6.0 with CUDA 10.2 and CUDNN 7.6.5. We run all experiments on a Linux server running Ubuntu 18.04, with an Intel Xeon 6230 at 2.10GHz with 80 virtual cores including hyperthreading, 385GB RAM, and 8 Nvidia RTX 2080-Ti GPUs. \vspace{.1cm}\noindent\textbf{Datasets.} To train and evaluate \textsc{Trex}\xspace, we collect 13 popular open-source software projects. These projects include Binutils-2.34, Coreutils-8.32, Curl-7.71.1, Diffutils-3.7, Findutils-4.7.0, GMP-6.2.0, ImageMagick-7.0.10, Libmicrohttpd-0.9.71, LibTomCrypt-1.18.2, OpenSSL-1.0.1f and OpenSSL-1.0.1u, PuTTy-0.74, SQLite-3.34.0, and Zlib-1.2.11. We compile these projects into 4 architectures \emph{i.e., } x86, x64, ARM (32-bit), and MIPS (32-bit), with 4 optimization levels (OPT), \emph{i.e., } \texttt{O0}, \texttt{O1}, \texttt{O2}, and \texttt{O3}, using \texttt{GCC-7.5}. Specifically, we compile the software projects based on its makefile, by specifying \texttt{CFLAGS} (to set optimization flag), \texttt{CC} (to set cross-compiler), and \texttt{--host} (to set the cross-compilation target architecture). We always compile to dynamic shared objects, but resort to static linking when we encounter build errors. We are able to compile all projects with these treatments. We also obfuscate all projects using 5 types of obfuscations (OBF) by Hikari~\cite{hikari} on x64 -- an obfuscator based on \texttt{clang-8}. The obfuscations include bogus control flow (\texttt{bcf}), control flow flattening (\texttt{cff}), register-based indirect branching (\texttt{ibr}), basic block splitting (\texttt{spl}), and instruction substitution (\texttt{sub}). As we encounter several errors in cross-compilation using Hikari (based on Clang)~\cite{hikari}, and the baseline system (\emph{i.e., } Asm2Vec~\cite{ding2019asm2vec}) to which we compare only evaluates on x64, we restrict the obfuscated binaries for x64 only. As a result, we have 1,472,066 functions, as shown in Table~\ref{tab:dataset}. \begin{table*}[!t] \footnotesize \setlength{\tabcolsep}{2.2pt} \centering \renewcommand{\arraystretch}{1} \setlength\aboverulesep{0.2pt} \setlength\belowrulesep{0.2pt} \caption{Number of functions for each project across 4 architectures with 4 optimization levels and 5 obfuscations. } \label{tab:dataset} \rowcolors{1}{}{lightblue} \begin{tabular}{c|c|l|l|l|l|l|l|l|l|l|l|l|l|l?{1.1pt}r} \toprule[1.1pt] \multirow{2}{*}{ARCH} & \multirow{2}{*}{\begin{tabular}[c]{@{}l@{}}OPT\\ OBF\end{tabular}} & \multicolumn{14}{c}{\bf \# Functions} \\ \cline{3-16} & & \multicolumn{1}{c|}{Binutils} & \multicolumn{1}{c|}{Coreutils} & \multicolumn{1}{c|}{Curl} & \multicolumn{1}{c|}{Diffutils} & \multicolumn{1}{c|}{Findutils} & \multicolumn{1}{c|}{GMP} & \multicolumn{1}{c|}{ImageMagick} & \multicolumn{1}{c|}{Libmicrohttpd} & \multicolumn{1}{c|}{LibTomCrypt} & \multicolumn{1}{c|}{OpenSSL} & \multicolumn{1}{c|}{PuTTy} & \multicolumn{1}{c|}{SQLite} & \multicolumn{1}{c?{1.1pt}}{Zlib} & \multicolumn{1}{c}{\textbf{Total}} \\ \midrule[.9pt] & \texttt{O0} & 25,492 & 19,992 & 1,067 & 944 & 1,529 & 766 & 2,938 & 200 & 779 & 11,918 & 7,087 & 2,283 & 157 & 75,152 \\ \cline{2-16} & \texttt{O1} & 20,043 & 14,918 & 771 & 694 & 1,128 & 704 & 2,341 & 176 & 745 & 10,991 & 5,765 & 1,614 & 143 & 60,033 \\ \cline{2-16} & \texttt{O2} & 19,493 & 14,778 & 765 & 693 & 1,108 & 701 & 2,358 & 171 & 745 & 11,001 & 5,756 & 1,473 & 138 & 59,180 \\ \cline{2-16} & \texttt{O3} & 17,814 & 13,931 & 697 & 627 & 983 & 680 & 2,294 & 160 & 726 & 10,633 & 5,458 & 1,278 & 125 & 55,406 \\ \cline{2-16} \multirow{-5}{*}{ARM} & \multicolumn{14}{c?{1.1pt}}{Total \# Functions of ARM} & \textbf{249,771} \\ \midrule[.5pt] \multirow{5}{*}{MIPS} & \texttt{O0} & 28,460 & 18,843 & 1,042 & 906 & 1,463 & 734 & 2,840 & 200 & 779 & 11,866 & 7,003 & 2,199 & 153 & 76,488 \\ \cline{2-16} & \texttt{O1} & 22,530 & 13,771 & 746 & 653 & 1,059 & 670 & 2,243 & 176 & 745 & 10,940 & 5,685 & 1,530 & 139 & 60,887 \\ \cline{2-16} & \texttt{O2} & 22,004 & 13,647 & 741 & 653 & 1,039 & 667 & 2,260 & 171 & 743 & 10,952 & 5,677 & 1,392 & 135 & 60,081 \\ \cline{2-16} & \texttt{O3} & 20,289 & 12,720 & 673 & 584 & 917 & 646 & 2,198 & 161 & 724 & 10,581 & 5,376 & 1,197 & 121 & 56,187 \\ \cline{2-16} & \multicolumn{14}{c?{1.1pt}}{Total \# Functions of MIPS} & \textbf{253,643} \\ \midrule[.5pt] & \texttt{O0} & 37,783 & 24,383 & 1,335 & 1,189 & 1,884 & 809 & 3,876 & 326 & 818 & 12,552 & 7,548 & 2,923 & 204 & 95,630 \\ \cline{2-16} & \texttt{O1} & 32,263 & 20,079 & 1,013 & 967 & 1,516 & 741 & 3,482 & 280 & 782 & 11,578 & 6,171 & 2,248 & 196 & 81,316 \\ \cline{2-16} & \texttt{O2} & 32,797 & 21,082 & 1,054 & 1,006 & 1,524 & 728 & 3,560 & 265 & 784 & 11,721 & 6,171 & 2,113 & 183 & 82,988 \\ \cline{2-16} & \texttt{O3} & 34,055 & 22,482 & 1,020 & 1,052 & 1,445 & 707 & 3,597 & 284 & 760 & 11,771 & 5,892 & 1,930 & 197 & 85,192 \\ \cline{2-16} \multirow{-5}{*}{x86} & \multicolumn{14}{c?{1.1pt}}{Total \# Functions of x86} & \textbf{358,261} \\ \midrule[.5pt] \multirow{5}{*}{x64} & \texttt{O0} & 26,757 & 17,238 & 1,034 & 845 & 1,386 & 751 & 2,970 & 200 & 782 & 12,047 & 7,061 & 2,190 & 151 & 73,412 \\ \cline{2-16} & \texttt{O1} & 21,447 & 12,532 & 739 & 600 & 1,000 & 691 & 2,358 & 176 & 745 & 11,120 & 5,728 & 1,523 & 137 & 58,796 \\ \cline{2-16} & \texttt{O2} & 20,992 & 12,206 & 734 & 596 & 976 & 689 & 2,374 & 171 & 742 & 11,136 & 5,703 & 1,380 & 132 & 57,831 \\ \cline{2-16} & \texttt{O3} & 19,491 & 11,488 & 662 & 536 & 857 & 667 & 2,308 & 160 & 725 & 10,768 & 5,390 & 1,183 & 119 & 54,354 \\ \cline{2-16} & \multicolumn{14}{c?{1.1pt}}{Total \# Functions of x64} & \textbf{244,393} \\ \midrule[1.1pt] & \texttt{bcf} & 27,734 & 17,093 & 998 & 840 & 1,388 & 746 & 2,833 & 200 & 782 & 10,768 & 7,069 & 2,183 & 151 & 72,785 \\ \cline{2-16} & \texttt{cff} & 27,734 & 17,093 & 998 & 840 & 1,388 & 746 & 2,833 & 200 & 782 & 10,903 & 7,069 & 2,183 & 151 & 72,920 \\ \cline{2-16} & \texttt{ibr} & 27,734 & 17,105 & 998 & 842 & 1,392 & 746 & 2,833 & 204 & 782 & 12,045 & 7,069 & 2,183 & 151 & 74,084 \\ \cline{2-16} & \texttt{spl} & 27,734 & 17,093 & 998 & 840 & 1,388 & 746 & 2,833 & 200 & 782 & 10,772 & 7,069 & 2,183 & 151 & 72,789 \\ \cline{2-16} & \texttt{sub} & 27,734 & 17,093 & 998 & 840 & 1,388 & 746 & 2,833 & 200 & 782 & 11,403 & 7,069 & 2,183 & 151 & 73,420 \\ \cline{2-16} \multirow{-5}{*}{x64} & \multicolumn{14}{c?{1.1pt}}{Total \# Obfuscated Functions} & \textbf{365,998} \\ \midrule[1.1pt] \multicolumn{15}{c?{1.1pt}}{Total \# Functions} & \textbf{1,472,066} \\ \bottomrule[1.1pt] \end{tabular} \end{table*} \vspace{.1cm}\noindent\textbf{Micro-tracing.} We implement micro-tracing by Unicorn~\cite{quynh2015unicorn}, a cross-platform CPU emulator based on QEMU~\cite{bellard2005qemu}. We micro-execute each function 3 times with different initialized registers and memory, generating 3 micro-traces (including both static code and dynamic values) for pretraining (masked LM). We leverage multi-processing to parallelize micro-executing each function and set 30 seconds as the timeout for each run in case any instruction gets stuck (\emph{i.e., } infinite loops). For each function (with 3 micro-traces), we append one additional dummy trace, which consists of only dummy values (\texttt{\#\#}). This setting encourages the model to leverage its learned execution semantics (from other traces with concrete dynamic values) to predict the masked code with \emph{only} code context, which helps the finetuning task as we only feed the functions' static code as input (discussed in Section~\ref{sec:intro}). \vspace{.1cm}\noindent\textbf{Baselines.} For comparing cross-architecture performance, we consider 2 state-of-the-art systems. The first one is SAFE~\cite{massarelli2019safe} that achieves state-of-the-art function matching accuracy. As SAFE's trained model is publicly available, we compare \textsc{Trex}\xspace with both SAFE's reported results on their dataset, \emph{i.e., } OpenSSL-1.0.1f and OpenSSL-1.0.1u, and running their trained models on all of our collected binaries. The second baseline is Gemini~\cite{xu2017neural}, which is shown outperformed by SAFE. As Gemini does not release their trained models, we compare our results to their reported numbers directly on their evaluated dataset, \emph{i.e., } OpenSSL-1.0.1f and OpenSSL-1.0.1u. For cross-optimization/obfuscation comparison, we consider Asm2Vec~\cite{ding2019asm2vec} and Blex~\cite{egele2014blanket} as the baselines. Asm2Vec achieves the state-of-the-art cross-optimization/obfuscation results, based on learned embeddings from static assembly code. Blex, on the other hand, leverages functions' dynamic behavior to match function binaries. As we only find a third-party implementation of Asm2Vec that achieves extremely low Precision@1 (the metric used in Asm2Vec) from our testing (\emph{e.g., } 0.02 vs. their reported 0.814), and we have contacted the authors and do not get replies, we directly compare to their reported numbers. Blex is not publicly available either, so we also compare to their reported numbers directly. \vspace{.1cm}\noindent\textbf{Metrics.} As the cosine similarity between two function embeddings can be an arbitrary real value between -1 and 1, there has to be a mechanism to threshold the similarity score to determine whether the function pairs are similar or dissimilar. The chosen thresholds largely determine the model's predictive performance~\cite{pagani2018beyond}. To avoid the potential bias introduced by a specific threshold value, we consider the receiver operating characteristic (ROC) curve, which measures the model's false positives/true positives under different thresholds. Notably, we use the area under curve (AUC) of the ROC curve to quantify the accuracy of \textsc{Trex}\xspace to facilitate benchmarking -- the higher the AUC score, the better the model's accuracy. Certain baselines do not use AUC score to evaluate their system. For example, Asm2Vec uses Precision at Position 1 (Precision@1), and Blex uses the number of matched functions as the metric. Therefore, we also include these metrics to evaluate \textsc{Trex}\xspace when needed. Specifically, given a sequence of query functions and the target functions to be matched, Precision@1 measures the percentage of matched query functions in the target functions. Here ``match'' means the query function should have the \emph{top-1 highest} similarity score with the ground truth function among the target functions. To evaluate pretraining performance, we use the standard metric for evaluating the language model -- perplexity (PPL). The lower the PPL the better the pretrained model in predicting masked code. The lowest PPL is 1. \vspace{.1cm}\noindent\textbf{Pretraining setup.} To strictly separate the functions in pretraining, finetuning, and testing, we pretrain \textsc{Trex}\xspace on all functions in the dataset, \emph{except the functions in the project going to be finetuned and evaluated for similarity.} For example, the function matching results of Binutils (Table~\ref{tab:result}) are finetuned on the model pretrained on all other projects without Binutils. Note that pretraining \emph{is agnostic to any labels} (\emph{e.g., } ground-truth indicating similar functions). Therefore, we can always pretrain on large-scale codebases, which can potentially include the functions for finetuning (this is the common practice in transfer learning~\cite{devlin2018bert}). It is thus worth noting that our setup of separating functions for pretraining and finetuning makes our testing significantly more challenging. We keep the pretrained model weights that achieve the best validation PPL for finetuning. The validation set for pretraining consists of 10,000 random functions selected from Table~\ref{tab:dataset}. \vspace{.1cm}\noindent\textbf{Finetuning setup.} We choose 50,000 random function pairs for each project and randomly select \emph{only 10\%} for training, and the remaining is used as the testing set. We keep the training and testing functions \emph{strictly non-duplicated} by ensuring the functions that appear in training function pairs not appear in the testing. As opposed to the typical train-test split (\emph{e.g., } 80\% training and 20\% testing~\cite{massarelli2019safe}), our setting requires the model to generalize from few training samples to a large number of unseen testing samples, which alleviates the possibility of overfitting. Moreover, we keep the ratio between similar and dissimilar function pairs in the finetuning set as roughly 1:5. This setting follows the practice of contrastive learning~\cite{saunshi2019theoretical,chen2020simple}, respecting the actual distribution of similar/dissimilar functions as the number of dissimilar functions is often larger than that of similar functions in practice. \vspace{.1cm}\noindent\textbf{Hyperparameters.} We pretrain and finetune the models for 10 epochs and 30 epochs, respectively. We choose $\alpha=0.125$ in Equation~\ref{eq:pretrain} such that the cross-entropy loss of code prediction and value prediction have the same weight. We pick $\xi=0.1$ in Equation~\ref{eq:cosembloss} to make the model slightly inclined to treat functions as dissimilar because functions in practice are mostly dissimilar. We fix the largest input length to be 512 and split the functions longer than this length into subsequences for pretraining. We average the subsequences' embeddings during finetuning if the function is split to more than one subsequences. In this paper, we keep most of the hyperparameters fixed throughout the evaluation if not mentioned explicitly (complete hyperparameters are defined in Appendix~\ref{subsec:hyperparm}). While we can always search for better hyperparameters, there is no principled method to date~\cite{bergstra2012random}. We thus leave as future work a more thorough study of \textsc{Trex}\xspace's hyperparameters. \section{Introduction} \label{sec:intro} Semantic function similarity, which quantifies the behavioral similarity between two functions, is a fundamental program analysis capability with a broad spectrum of real-world security usages, such as vulnerability detection~\cite{brumley2008automatic}, exploit generation~\cite{avgerinos2014automatic}, tracing malware lineage~\cite{jang2013towards, bayer2009scalable}, and forensics~\cite{luo2014semantics}. For example, OWASP lists ``using components with known vulnerabilities'' as one of the top-10 application security risks in 2020~\cite{OWASP}. Therefore, identifying similar vulnerable functions in massive software projects can save significant manual effort. When matching semantically similar functions for security-critical applications (\emph{e.g., } vulnerability discovery), we often have to deal with software at \emph{binary level}, such as commercial off-the-shelf products (\emph{i.e., } firmware images) and legacy programs. However, this task is challenging as the functions' high-level information (\emph{i.e., } data structure definitions) are removed during the compilation process. The problem aggravates when the functions are compiled to run on different instruction set architectures with various compiler optimizations or even simple obfuscations. There has been a growing interest in using Machine Learning (ML) to tackle these challenges~\cite{xu2017neural, massarelli2019safe, ding2019asm2vec}. Notably, ML models learn function representations (\emph{i.e., } embeddings) from instructions in function binaries and match the functions based on the learned representation. These approaches have obtained the state-of-the-art results~\cite{xu2017neural, massarelli2019safe, ding2019asm2vec}, outperforming the traditional signature-based approaches~\cite{bindiff} that rely on the hand-coded features (\emph{e.g., } number of basic blocks) extracted by domain experts. The ML-based approaches are also amenable to large-scale function matching as computing similarity score as embedding distance is exceptionally efficient (\emph{e.g., } taking around 0.1 seconds searching over one million functions)~\cite{feng2016scalable}. \vspace{0.01cm}\noindent\textbf{Execution semantics.} Despite the impressive progress, it remains challenging for these approaches to match semantically similar functions with disparate syntax and structure~\cite{mckee2019software}. An inherent cause is that the code semantics is characterized by \emph{its execution effects}. However, all existing learning-based approaches are \emph{agnostic to program execution semantics}, taking the static code as the only input. Such a setting can easily lead a model into learning simple pattern matching, limiting their accuracy when such patterns are absent or changed~\cite{payer2014similarity, aghakhani2020malware}. Take a pair of x86 instructions as an example. \texttt{mov eax,2;lea ecx,[eax+4]} are semantically equivalent to \texttt{mov eax,2;lea ecx,[eax+eax*2]}. To determine their similarity statically, the most salient pattern is their common substring (both sequences share the tokens \texttt{mov}, \texttt{eax}, \texttt{lea}, \texttt{ecx}), which does not encode the key reason of equivalence. Without grasping the execution semantics, an ML model can easily learn such spurious patterns without understanding the inherent cause of the equivalence: \texttt{[eax+eax*2]} computes the same exact address as \texttt{[eax+4]} when \texttt{eax} is 2. \vspace{0.01cm}\noindent\textbf{Limitations of existing dynamic approaches.} Conceptually, dynamic analysis captures the perfect execution semantics. However, traditional dynamic analysis is inappropriate here as it is hard to find a concrete program input exercising a certain function of interest. While symbolic execution can help, it is known for poor scalability to large programs. Therefore, existing dynamic approaches~\cite{egele2014blanket} \emph{relax} the function initial states with random values that are often under-constrained -- they may not be feasible from executing the program regularly. For example, a function \texttt{bar()} can only be executed when called by function \texttt{foo()}. When directly executing \texttt{bar()}, the constraints of \texttt{bar()}'s initial states imposed in \texttt{foo()} is ignored. While these approaches can directly execute individual functions and compare their execution behavior, such a relaxation introduces \emph{noisy and incomplete traces}. For example, for functions taking only values from specified range, \emph{e.g., } $\sqrt{x}$ and $arcsin(x)$, the randomized function inputs (\emph{e.g., } negative numbers for $\sqrt{x}$ and numbers outside $[-1,1]$ for $arcsin(x)$) often trigger the similar behavior such as the exception handling. Therefore, existing dynamic approaches suffer from false positives~\cite{ding2019asm2vec}. \vspace{0.01cm}\noindent\textbf{Our approach.} This paper presents \textsc{Trex}\xspace (\emph{TRansfer-learning EXecution semantics}) that matches semantically similar functions based on their static instructions but augmented with execution semantics. Instead of using noisy and incomplete dynamic trace to directly determine similarity, \textsc{Trex}\xspace first pretrains the model to observe and understand how each instruction executes in a function. It then \emph{transfers} and \emph{composes} the learned knowledge from pretrained model to match semantically similar functions. Our extensive experiments suggest that the learned knowledge of executions in pretraining significantly boosts the performance of matching semantically similar function binaries -- \textsc{Trex}\xspace excels in matching functions from different architectures, optimizations, and obfuscations. \begin{figure*}[!t] \centering \includegraphics[width=\linewidth]{./figs/general.pdf} \caption{ The workflow of \textsc{Trex}\xspace. We first pretrain the model on the function code and its micro-traces (\emph{i.e., } dynamic register values) using the masked LM task. We then finetune the pretrained model on the function pairs (\emph{e.g., } same source function compiled to different architectures with different optimizations/obfuscations) by stacking new neural network layers for function similarity tasks. Finetuning updates both the pretrained model and the stacked layers. During inference, the finetuned model computes the function embedding, whose distance encodes the function similarity.} \label{fig:general} \end{figure*} Our key insight is that the function's behavior can be \emph{composed} by each instruction's execution semantics, which can be learned by observing and understanding how each instruction executes in the dynamic traces. For example, given instructions \texttt{mov eax,2;sub eax,1;add eax,3} and their dynamic traces, we can train the model to predict the value of \texttt{eax} after executing these instructions. This training objective is designed to force the model to understand the execution semantics of \texttt{mov}, \texttt{sub}, and \texttt{add}, \emph{i.e., } how they manipulate the operands and updates the results, and learn to \emph{compose their execution effects} to understand their overall behavior. We can then \emph{transfer} the model's learned knowledge to compose instructions' execution semantics to match semantically similar functions. As a result, our approach is not constrained by noisy and incomplete traces -- it matches functions based \emph{only} on their \emph{complete} static instructions but \emph{augmented} with rich knowledge of execution semantics. Such a design also saves significant runtime overhead as we do not need to execute any function on-the-fly when matching them~\cite{kapravelos2013revolver}. Given a sequence of assembly instructions and their micro-traces (\emph{i.e., } register values), we pretrain the model with the masked language modeling (masked LM) task. Notably, it masks random parts in the sequence and asks the model to predict masked parts based on their context. This design forces the model to learn how a function executes to correctly infer the missing values. It thus \emph{automates} learning execution semantics without any manual feature engineering. It also enables learning more \emph{comprehensive} execution semantics of diverse instructions, as we can mask various parts of the function, imposing the model to learn different aspects of execution semantics to make correct prediction. Moreover, this task is fully \emph{unsupervised}. Therefore, \textsc{Trex}\xspace can be trained and further improved using arbitrary binaries found in the wild. To encode both the static and dynamic information as the model inputs, we design a hierarchical Transformer~\cite{vaswani2017attention} that supports modeling concrete micro-trace values. By contrast, existing approaches often treat the numerical values as a dummy token~\cite{massarelli2019safe, ding2019asm2vec} to avoid prohibitively large vocabulary size, which cannot effectively learn the rich dependencies between concrete values that likely encode key function semantics. Moreover, our architecture's self-attention layer is designed to model long-range dependencies in a sequence~\cite{vaswani2017attention} efficiently. Therefore, \textsc{Trex}\xspace can support roughly 170$\times$ longer sequence and runs 8$\times$ faster than existing neural architectures, essential to learning embeddings of long function execution traces. We evaluate \textsc{Trex}\xspace on 1,472,066 functions collected from 13 popular open-source software projects across 4 architectures (x86, x64, ARM, and MIPS) and compiled with 4 optimizations (\texttt{O0}-\texttt{O3}), and 5 obfuscation strategies~\cite{hikari}. \textsc{Trex}\xspace outperforms the state-of-the-art systems by 7.8\%, 7.2\%, and 14.3\% in matching functions across different architectures, optimizations, and obfuscations, respectively. Our ablation studies show that the pretraining task significantly improves the accuracy of matching semantically similar functions (by 15.7\%). We also apply \textsc{Trex}\xspace in searching vulnerable functions in 180 real-world firmware images developed by well-known vendors and deployed in diverse embedded systems, including WLAN routers, smart cameras, and solar panels. Our case study shows that \textsc{Trex}\xspace assists in finding 16 real-world CVEs in these firmware images, which have not been disclosed in any previous studies. We make the following contributions. \begin{itemize} \item We propose a new approach to matching semantically similar functions: we first train the model to learn program execution semantics and then transfer the learned knowledge to match semantically similar functions. \item We implement micro-execution to collect dynamic traces on different architectures. We then develop a novel neural architecture -- hierarchical Transformer -- that can efficiently learn execution semantics from micro-traces. \item We implement \textsc{Trex}\xspace and evaluate it on 1,472,066 functions from 13 popular software projects and libraries. \textsc{Trex}\xspace outperforms the state-of-the-art tools by 7.8\%, 7\%, and 14.3\%, in cross-architecture, optimization, and obfuscation function matching, respectively, while running up to 8$\times$ faster. Moreover, \textsc{Trex}\xspace helps uncover 16 vulnerabilities in 180 real-world firmware images with latest version that are not disclosed by previous studies. We release \textsc{Trex}\xspace at \url{anonymous.4open.science/r/644f4ceb-ab22-4f04-a91c-0565e091ca31}. \end{itemize} \section{Introduction} \label{sec:intro} Semantic function similarity, which quantifies the behavioral similarity between two functions, is a fundamental program analysis capability with a broad spectrum of real-world security usages, such as vulnerability detection~\cite{brumley2008automatic}, exploit generation~\cite{avgerinos2014automatic}, tracing malware lineage~\cite{jang2013towards, bayer2009scalable}, and forensics~\cite{luo2014semantics}. For example, OWASP lists ``using components with known vulnerabilities'' as one of the top-10 application security risks in 2020~\cite{OWASP}. Therefore, identifying similar vulnerable functions in massive software projects can save significant manual effort. When matching semantically similar functions for security-critical applications (\emph{e.g., } vulnerability discovery), we often have to deal with software at \emph{binary level}, such as commercial off-the-shelf products (\emph{i.e., } firmware images) and legacy programs. However, this task is challenging, as the functions' high-level information (\emph{e.g., } data structure definitions) are removed during the compilation process. Establishing semantic similarity gets even harder when the functions are compiled to run on different instruction set architectures with various compiler optimizations or obfuscated with simple transformations. Recently, Machine Learning (ML) based approaches have shown promise in tackling these challenges~\cite{xu2017neural, massarelli2019safe, ding2019asm2vec} by learning robust features that can identify similar function binaries across different architectures, compiler optimizations, or even some types of obfuscation. Specifically, ML models learn function representations (\emph{i.e., } embeddings) from function binaries and use the distance between the embeddings of two functions to compute their similarity. The smaller the distance, the more similar the functions are to each other. Such approaches have achieved state-of-the-art results~\cite{xu2017neural, massarelli2019safe, ding2019asm2vec}, outperforming the traditional signature-based methods~\cite{bindiff} using hand-crafted features (\emph{e.g., } number of basic blocks). Such embedding distance-based strategy is particularly appealing for large-scale function matching---taking only around 0.1 seconds searching over one million functions~\cite{feng2016scalable}. \vspace{.1cm}\noindent\textbf{Execution semantics.} Despite the impressive progress, it remains challenging for these approaches to match semantically similar functions with disparate syntax and structure~\cite{mckee2019software}. An inherent cause is that the code semantics is characterized by \emph{its execution effects}. However, all existing learning-based approaches are \emph{agnostic to program execution semantics}, training only on the static code. Such a setting can easily lead a model into matching simple patterns, limiting their accuracy when such spurious patterns are absent or changed~\cite{payer2014similarity, aghakhani2020malware}. For instance, consider the following pair of x86 instructions: \texttt{mov eax,2;lea ecx,[eax+4]} are semantically equivalent to \texttt{mov eax,2;lea ecx,[eax+eax*2]}. An ML model focusing on syntactic features might pick common substrings (both sequences share the tokens \texttt{mov}, \texttt{eax}, \texttt{lea}, \texttt{ecx}) to establish their similarity, which does not encode the key reason of the semantic equivalence. Without grasping the approximate execution semantics, an ML model can easily learn such spurious patterns without understanding the inherent cause of the equivalence: \texttt{[eax+eax*2]} computes the same exact address as \texttt{[eax+4]} when \texttt{eax} is 2. \vspace{.1cm}\noindent\textbf{Limitations of existing dynamic approaches.} Existing dynamic approaches try to avoid the issues described above by directly comparing the dynamic behaviors of functions to determine similarity. As finding program inputs reaching the target functions is an extremely challenging and time-consuming task, the prior works perform under-constrained dynamic execution by initializing the function input states (\emph{e.g., } registers, memory) with random values and executing the target functions directly~\cite{egele2014blanket}. Unfortunately, using such under-constrained execution traces directly to compute function similarities often result in many false positives~\cite{ding2019asm2vec}. For example, providing random inputs to two different functions with strict input checks might always trigger similar shallow exception handling codes and might look spuriously similar. \vspace{.1cm}\noindent\textbf{Our approach.} This paper presents \textsc{Trex}\xspace (\emph{TRansfer-learning EXecution semantics}) that trains ML models to learn the approximate execution semantics from under-constrained dynamic traces. Unlike prior works, which use such traces to directly measure similarity, \textsc{Trex}\xspace pretrains the model on diverse traces to learn each instruction's execution effect in its context. \textsc{Trex}\xspace then finetunes the model by \emph{transferring} the learned knowledge from pretraining to match semantically similar functions (see Figure~\ref{fig:general}). Our extensive experiments suggest that the approximately learned knowledge of execution semantics in pretraining significantly boosts the accuracy of matching semantically similar function binaries -- \textsc{Trex}\xspace excels in matching functions from different architectures, optimizations, and obfuscations. \begin{figure*}[!t] \centering \includegraphics[width=\linewidth]{./figs/general.pdf} \caption{ The workflow of \textsc{Trex}\xspace. We first pretrain the model on the functions' micro-traces, consisting of both instructions and dynamic values, using the masked LM task. We then finetune the pretrained model on the semantically similar function (only static instruction) pairs by stacking new neural network layers for function similarity tasks. Finetuning updates both the pretrained model and the stacked layers. During inference, the finetuned model computes the function embedding, whose distance encodes the function similarity.} \label{fig:general} \end{figure*} Our key observation is that while under-constrained dynamic execution traces tend to contain many infeasible states, they still encode precise execution effects of many individual instructions. Thus, we can train an ML model to observe and learn the effect of different instructions present across a large number of under-constrained dynamic traces collected from diverse functions. Once the model has gained an approximate understanding of execution semantics of various instructions, we can train it to match semantically similar functions by leveraging its learned knowledge. As a result, during inference, we do not need to execute any functions on-the-fly while matching them~\cite{kapravelos2013revolver}, which saves significant runtime overhead. Moreover, our trained model does not need the under-constrained dynamic traces to match functions, it only uses the function instructions, but they are \emph{augmented} with rich knowledge of execution semantics. In this paper, we extend micro-execution~\cite{godefroid2014micro}, a form of under-constrained dynamic execution, to generate \emph{micro-traces} of a function across multiple instruction set architectures. A micro-trace consists of a sequence of aligned instructions and their corresponding program state values. We pretrain the model on a large number of micro-traces gathered from diverse functions as part of training data using the masked language modeling (masked LM) task. Notably, masked LM masks random parts in the sequence and asks the model to predict masked parts based on their context. This design forces the model to learn approximately how a function executes to correctly infer the missing values, which automates learning execution semantics without manual feature engineering. Masked LM is also fully \emph{self-supervised}~\cite{devlin2018bert} -- \textsc{Trex}\xspace can thus be trained and further improved with arbitrary functions found in the wild. To this end, we design a hierarchical Transformer~\cite{vaswani2017attention} that supports learning approximate execution semantics. Specifically, our architecture models micro-trace values explicitly. By contrast, existing approaches often treat the numerical values as a dummy token~\cite{massarelli2019safe, ding2019asm2vec} to avoid prohibitively large vocabulary size, which cannot effectively learn the rich dependencies between concrete values that likely encode key function semantics. Moreover, our architecture's self-attention layer is designed to model long-range dependencies in a sequence~\cite{vaswani2017attention} efficiently. Therefore, \textsc{Trex}\xspace can support roughly 170$\times$ longer sequence and runs 8$\times$ faster than existing neural architectures, essential to learning embeddings of long function execution traces. We evaluate \textsc{Trex}\xspace on 1,472,066 functions collected from 13 popular open-source software projects across 4 architectures (x86, x64, ARM, and MIPS) and compiled with 4 optimizations (\texttt{O0}-\texttt{O3}), and 5 obfuscation strategies~\cite{hikari}. \textsc{Trex}\xspace outperforms the state-of-the-art systems by 7.8\%, 7.2\%, and 14.3\% in matching functions across different architectures, optimizations, and obfuscations, respectively. Our ablation studies show that the pretraining task significantly improves the accuracy of matching semantically similar functions (by 15.7\%). We also apply \textsc{Trex}\xspace in searching vulnerable functions in 180 real-world firmware images developed by well-known vendors and deployed in diverse embedded systems, including WLAN routers, smart cameras, and solar panels. Our case study shows that \textsc{Trex}\xspace helps find 16 CVEs in these firmware images, which have not been disclosed in previous studies. We make the following contributions. \begin{itemize} \item We propose a new approach to matching semantically similar functions: we first train the model to learn approximate program execution semantics from micro-traces, a form of under-constrained dynamic traces, and then transfer the learned knowledge to identify semantically similar functions. \item We extend micro-execution to support different architectures to collect micro-traces for training. We then develop a novel neural architecture -- hierarchical Transformer -- to learn approximate execution semantics from micro-traces. \item We implement \textsc{Trex}\xspace and evaluate it on 1,472,066 functions from 13 popular software projects and libraries. \textsc{Trex}\xspace outperforms the state-of-the-art tools by 7.8\%, 7\%, and 14.3\%, in cross-architecture, optimization, and obfuscation function matching, respectively, while running up to 8$\times$ faster. Moreover, \textsc{Trex}\xspace helps uncover 16 vulnerabilities in 180 real-world firmware images with the latest version that are not disclosed by previous studies. We release the code and dataset of \textsc{Trex}\xspace at \url{https://github.com/CUMLSec/trex}. \end{itemize} \section{Methodology} \label{sec:method} This section describes \textsc{Trex}\xspace's design specifics, including our micro-tracing semantics, our learning architecture's details, and pretraining and finetuning workflow. \subsection{Micro-tracing Semantics} \label{subsec:microx-semantics} We implement micro-execution by Godefroid~\cite{godefroid2014micro} to handle x64, ARM, and MIPS, where the original paper only describes x86 as the use case. In the following, we briefly explain how we micro-execute an individual function binary, highlighting the key algorithms in handling different types of instructions. \vspace{.1cm}\noindent\textbf{IR Language.} To abstract away the complexity of different architectures' assembly syntax, we introduce a low-level intermediate representation (IR) that models function assembly code. We only include a subset of the language specifics to illustrate the implementation algorithm. Figure~\ref{fig:microx-syntax} shows the grammar of the IR. Note that the IR here only serves to facilitate the discussion of our micro-tracing implementation. In our implementation, we use real assembly instructions and tokenize them as model’s input (Section~\ref{subsec:input_repr}). Notably, we denote memory reads and writes by \texttt{load($e$)} and \texttt{store($e_{v},e_{a}$)} (\emph{i.e., } store the value expression $e_v$ to address expression $e_a$), which generalize from both the load-store architecture (\emph{i.e., } ARM, MIPS) and register-memory architecture (\emph{i.e., } x86). Both operations can take as input $e$ -- an expression that can be an explicit hexadecimal number (denoting the address or a constant), a register, or a result of an operation on two registers. We use \texttt{jmp} to denote the general jump instruction, which can be both direct or indirect jump (\emph{i.e., } the expression $e_a$ can be a constant $c$ or a register $r$). The jump instruction can also be unconditional or conditional. Therefore, the first parameter in \texttt{jmp} is the conditional expression $e_c$ and unconditional jump will set $e_c$ to \texttt{true}. We represent function invocations and returns by \texttt{call} and \texttt{ret}, where \texttt{call} is parameterized by an expression, which can be an address (direct call) or a register (indirect call). \begin{figure}[!t] \centering \includegraphics[width=\linewidth]{./figs/microx-semantics/language.pdf} \caption{Low-level IR for representing assembly code. The IR abstracts away the actual assembly syntax that are disparate across different architectures.} \label{fig:microx-syntax} \end{figure} \vspace{.1cm}\noindent\textbf{Micro-tracing algorithm.} Algorithm~\ref{alg:microx} outlines the basic steps of micro-tracing a given function $f$. First, it initializes the memory to load the code and the corresponding stack. It then initializes all registers except the special-purpose register, such as the stack pointer or the program counter. Then it starts linearly executing instructions of $f$. We map the memory address \emph{on-demand} if the instruction access the memory (\emph{i.e., } read/write). If the instruction reads from memory, we further initialize a random value in the specific memory addresses. For call/jump instructions, we first examine the target address and skip the invalid jump/call, known as ``forced execution''~\cite{peng2014x}. By skipping unreachable jumps and calls, it can keep executing the function till the end of the function and exposes more behaviors, \emph{e.g., } skipping potential input check exceptions. Since the \texttt{nop} instructions can serve as padding between instructions within a function, we simply skip \texttt{nop}. We terminate the micro-tracing when it finishes executing all instructions, reaches \texttt{ret}, or times out. Figure~\ref{fig:arithmetic} and~\ref{fig:stack} demonstrate sample micro-traces of real-world functions. \subsection{Input Representation} \label{subsec:input_repr} Formally, given a function $f$ (\emph{i.e., } assembly code) and its micro-trace $t$ (by micro-executing $f$), we prepare the model input $x$, consisting of 5 types of token sequence with the same size $n$. Figure~\ref{fig:arch} shows the model input example and how they are masked and processed by the hierarchical Transformer to predict the corresponding output as a pretraining task. \input{microx} \vspace{.1cm}\noindent\textbf{Micro-trace code sequence.} The first sequence $x_f$ is the assembly code sequence: $x_f=\{mov, eax, +, ...\}^n$, generated by tokenizing the assembly instructions in the micro-trace. We treat all symbols appear in the assembly instructions as tokens. Such a tokenization aims to preserve the critical hint of the syntax and semantics of the assembly instructions. For example, we consider even punctuation to be one of the tokens, \emph{e.g., } ``,'', ``['', ``]'', as ``,'' implies the token before and after it as destination and source of \texttt{mov} (in Intel syntax), respectively, and ``['' and ``]'' denote taking the address of the operands reside in between them. We take special treatment of numerical values appear in the assembly code. Treating numerical values as regular text tokens can incur prohibitively large vocabulary size, \emph{e.g., } $2^{32}$ number of possibilities on 32-bit architectures. To avoid this problem, we move all numeric values to the micro-trace value sequence (that will be learned by an additional neural network as detailed in the following) and replace them with a special token \texttt{num} (\emph{e.g., } last token of input in Figure~\ref{fig:arch}). With all these preprocessing steps, the vocabulary size of $x_f$ across all architectures is 3,300. \vspace{.1cm}\noindent\textbf{Micro-trace value sequence.} The second sequence $x_t$ is the micro-trace value sequence, where each token in $x_t$ is the dynamic value from micro-tracing the corresponding code. As discussed in Section~\ref{sec:overview}, we keep \emph{explicit} values (instead of a dummy value used by existing approaches) in $x_t$. Notably, we use the dynamic value for each token (\emph{e.g., } register) in an instruction before it is executed. For example, in \texttt{mov eax,0x8; mov eax,0x3}, the dynamic value of the second \texttt{eax} is \texttt{0x8}, as we take the value of \texttt{eax} before \texttt{mov eax,0x3} is executed. For code token without dynamic value, \emph{e.g., } \texttt{mov}, we use dummy values (see below). \vspace{.1cm}\noindent\textbf{Position sequences.} The position of each code and value token is critical for inferring binary semantics. Unlike natural language, where swapping two words can roughly preserve the same semantic meaning, swapping two operands can significantly change the instructions. To encode the inductive bias of position into our model, we introduce \emph{instruction position sequence} $x_c$ and \emph{opcode/operand position sequence} $x_o$ to represent the relative positions between the instructions and within each instruction. As shown in Figure~\ref{fig:arch}, $x_c$ is a sequence of integers encoding the position of each instruction. All opcodes/operands within a single instruction share the same value. $x_o$ is a sequence of integers encoding the position of each opcode and operands within a single instruction. \vspace{.1cm}\noindent\textbf{Architecture sequence.} Finally, we feed the model with an extra sequence $x_a$, describing the input binary's instruction set architecture. The vocabulary of $x_a$ consists of 4 architectures: $x_a=\{$x86, x64, ARM, MIPS$\}^n$. This setting helps the model to distinguish between the syntax of different architecture. \begin{figure}[!t] \centering \includegraphics[width=\linewidth]{./figs/arch-pretrain.pdf} \caption{Model architecture with input-output example. The masked input is marked in gray. In pretraining, the loss function consists of the cross-entropy losses of both (1) code prediction and (2) value prediction, where the value prediction consists of predicting each of the 8 bytes of the micro-trace value.} \label{fig:arch} \end{figure} \vspace{.1cm}\noindent\textbf{Encoding numeric values.} As mentioned above, treating concrete values as independent tokens can lead to prohibitively large vocabulary size. We design a \emph{hierarchical input encoding scheme} to address this challenge. Specifically, let $x_{t_i}$ denote the $i$-th value in $x_t$. We represent $x_{t_i}$ as an (padded) 8-byte fixed-length byte sequence $x_{t_i}=$\{\texttt{0x00}, ..., \texttt{0xff}\}$^8$ ordered in Big-Endian. We then feed $x_{t_i}$ to a 2-layer bidirectional LSTM (bi-LSTM) and take its last hidden cell's embedding as the value representation $t_i=bi$-$LSTM(x_{t_i})$. Here $t_i$ denotes the output of applying the embedding to $x_{t_i}$. To make the micro-trace code tokens without dynamic values (\emph{e.g., } opcode) align with the byte sequence, we use a dummy sequence (\texttt{\#\#}) with the same length. Figure~\ref{fig:arch} (right-hand side) illustrates how bi-LSTM takes the byte sequence and computes the embedding. Such a design significantly reduces the vocabulary size as now we have only 256 possible byte values to encode. Moreover, bi-LSTM encodes the potential dependencies between high and low bytes within a single value. This setting thus supports learning better relationships between different dynamic values (\emph{e.g., } memory region and offset) as opposed to treating all values as dummy tokens~\cite{shi2019learning}. \subsection{Pretraining with Micro-traces} \label{subsec:pretrain_method} This section describes the pretraining task on the function binaries and their micro-traces, focusing on how the model masks its input $x$ (5 sequences) and predicts the masked part to learn the approximate execution semantics. \vspace{.1cm}\noindent\textbf{Learned embeddings.} We embed each token in the 5 sequences with the same embedding dimension $d_{emb}$ so that they can be summed as a single sequence as input to the Transformer. Specifically, let $E_f(x_f)$, $E_t(x_t)$, $E_c(x_c)$, $E_o(x_o)$, $E_a(x_a)$ denote applying the embedding to the tokens in each sequence, respectively. We have $E_{i}$, the embedding of $x_i$: \begin{equation*} E_{i} = E_f(x_{f_i})+E_t(x_{t_i})+E_c(x_{c_i})+E_o(x_{o_i})+E_a(x_{a_i}) \label{eq:pos} \end{equation*} Here $x_{f_i}$ denote the $i$-th token in $x_f$, where other sequence (\emph{i.e., } $x_t$, $x_c$, $x_o$, $x_a$) follow the similar denotation. Note that $E_t(x_{t_i})$ leverages the bi-LSTM to encode the byte sequences (see Section~\ref{subsec:input_repr}), while the others simply multiplies the token (\emph{i.e., } one-hot encoded~\cite{harris2010digital}) with an embedding matrix. Figure~\ref{fig:arch} (right-hand side) illustrates the two embedding strategies. \vspace{.1cm}\noindent\textbf{Masked LM.} We pretrain the model using the masked LM objective. Formally, for each sequence $(x_1,x_2,...,x_n)$ in a given training set, we randomly mask out a selected percentage of tokens in each sequence. Specifically, we mask the code token and value token in $x_f$ and $x_t$, respectively, and replace them with a special token \texttt{<MASK>} (marked gray in Figure~\ref{fig:arch}). As masked LM trains on micro-traces without requiring additional labels, it is fully unsupervised. Let $m(E_i)$ denote the embedding of the masked $x_i$ and $\mathbb{MP}$ a set of positions on which the masks are applied. The model $g_p$ (to be pretrained) takes as input a sequence of embeddings with random tokens masked: $(E_1,..., m(E_i),...,E_n), i\in \mathbb{MP}$, and predicts the code and the values of the masked tokens: $\{\hat{x}_{f_i}, \hat{v}_i|i\in \mathbb{MP}\}=g_p(E_1,..., m(E_i),...,E_n)$. Let $g_p$ be parameterized by $\theta$, the objective of training $g_p$ is thus to search for $\theta$ that minimizes the cross-entropy losses between (1) the predicted masked code tokens and the actual code tokens, and (2) predicted masked values (8 bytes) and the actual values. For ease of exposition, we omit summation over all samples in the training set. \begin{equation} \label{eq:pretrain} \centering \argmin_{\theta} \sum\limits_{i=1}^{|\mathbb{MP}|} (-x_{f_i}\log(\hat{x}_{f_i})+ \alpha\sum\limits_{j=1}^{8}-x_{t_{ij}}\log(\hat{x}_{t_{ij}})) \end{equation} $\hat{x}_{t_{ij}}$ denotes the predicted $j$-th byte of $x_{t_i}$ (the $i$-th token in $x_t$). $\alpha$ is a hyperparameter that weighs the cross-entropy losses between predicting code tokens and predicting values. \vspace{.1cm}\noindent\textbf{Masking strategy.} For each chosen token to mask, we randomly choose from the masking window size from $\{1,3,5\}$, which determines how many consecutive neighboring tokens of the chosen tokens are also masked~\cite{joshi2020spanbert}. For example, if we select $x_5$ (the 5-th token) in Figure~\ref{fig:arch} to mask and the masking window size is 3, $x_4$ and $x_6$ will be masked too. We then adjust accordingly to ensure the overall masked tokens still account for the initially-chosen masking percentage. \vspace{.1cm}\noindent\textbf{Contextualized embeddings.} We employ the self-attention layers~\cite{vaswani2017attention} to endow contextual information to each embedding $E_i$ of the input token. Notably, let $E_{l}=(E_{l,1},...,E_{l,n})$ denote the embeddings produced by the $l$-th self-attention layer. We denote the embeddings before the model ($E_i$ as defined in Section~\ref{subsec:input_repr}) as $E_{0,i}$. Each token's embedding at each layer will attend to all other embeddings, aggregate them, and update its embedding in the next layer. The embeddings after each self-attention layer are known as \emph{contextualized embeddings}, which encodes the context-sensitive meaning of each token (\emph{e.g., } \texttt{eax} in \texttt{mov eax,ebx} has different embedding with that in \texttt{jmp eax}). This is in contrast with static embeddings, \emph{e.g., } word2vec commonly used in previous works~\cite{duandeepbindiff, ding2019asm2vec}, where a code token is assigned to a fixed embedding regardless of the changed context. The learned embeddings $E_{l,i}$ after the last self-attention layer encodes the approximate execution semantics of each instruction and the overall function. In pretraining, $E_{l,i}$ is used to predict the masked code. While in finetuning, it will be leveraged to match similar functions (Section~\ref{subsec:finetuning_method}). \subsection{Finetuning for Function Similarity} \label{subsec:finetuning_method} Given a function pair, we feed each function's \emph{static code} (instead of micro-trace as discussed in Section~\ref{sec:intro}) to the pretrained model $g_p$ and obtain the pair of embedding sequences produced by the last self-attention layer of $g_p$: $E^{(1)}_{k}=(E^{(1)}_{k,1},...,E^{(1)}_{k,n})$ and $E^{(2)}_{k}=(E^{(2)}_{k,1},...,E^{(2)}_{k,n})$ where $E^{(1)}_{k}$ corresponds to the first function and $E^{(2)}_{k}$ corresponds to the second. Let $y=\{-1,1\}$ be the ground-truth indicating the similarity (1 -- similar, -1 -- dissimilar) between two functions. We stack a 2-layer Multi-layer Perceptrons $g_t$, taking as input the average of embeddings for each function, and producing a function embedding: \begin{equation*} g_t(E_{k})=tanh((\sum\limits_{i=1}^n E_{k,i})/n)\cdot W_1)\cdot W_2 \end{equation*} Here $W_1\in \mathbb{R}^{d_{emb}\times d_{emb}}$ and $W_2\in \mathbb{R}^{d_{emb}\times d_{func}}$ transforms the average of last self-attention layers embeddings $E_k$ with dimension $d_{emb}$ into the function embedding with the dimension $d_{func}$. $d_{func}$ is often chosen smaller than $d_{emb}$ to support efficient large-scale function searching~\cite{xu2017neural}. Now let $g_t$ be parameterized by $\theta$, the finetuning objective is to minimize the cosine embedding loss ($l_{ce}$) between the ground-truth and the cosine distance between two function embeddings: \begin{equation*} \argmin_{\theta}\ l_{ce}(g_t(E^{(1)}_{k}),g_t(E^{(2)}_{k}), y) \end{equation*} where \begin{equation} \label{eq:cosembloss} l_{ce}(x_1,x_2,y) = \left\{\begin{matrix} 1-cos(x_1,x_2) & y=1\\ max(0,cos(x_1,x_2)-\xi) & y=-1 \end{matrix}\right. \end{equation} $\xi$ is the margin usually chosen between 0 and 0.5~\cite{paszke2019pytorch}. As both $g_p$ and $g_t$ are neural nets, optimizing Equation~\ref{eq:pretrain} and Equation~\ref{eq:cosembloss} can be guided by gradient descent via backpropagation. After finetuning $g_t$, the 2-layer multilayer perceptrons, and $g_p$, the pre-trained model, we compute the function embedding $f_{emb}=g_t(g_p(f))$ and the similarity between two functions is measured by the cosine similarity between two function embedding vectors: $cos(f^{(1)}_{emb},f^{(2)}_{emb})$. \section{Overview} \label{sec:overview} In this section, we use the real-world functions as motivating examples to describe the challenges of matching semantically similar functions. We then overview our approach, focusing on how our pretraining task (masked LM) addresses the challenges. \subsection{Challenging Cases} \begin{figure*}[!t] \centering \subfloat[Cross-architecture]{ \includegraphics[width=0.3\linewidth]{./figs/challenges/x86_arm.pdf} \label{subfig:x86_arm}} \subfloat[Cross-optimization]{ \includegraphics[width=0.33\linewidth]{./figs/challenges/O0_O3.pdf} \label{subfig:O0_O3}} \subfloat[Cross-obfuscation]{ \includegraphics[width=0.33\linewidth]{./figs/challenges/subobf.pdf} \label{subfig:subobf}} \caption{Challenging cases of matching semantically similar functions across different instruction architectures, optimizations, and obfuscations. (\textbf{Left}) the function \texttt{priv\_encode\_gost} is from \texttt{libcrypto.a} in \texttt{openssl-1.0.1f}. The upper function is compiled to x86 while the lower is compiled to ARM. (\textbf{Middle}) the function \texttt{<wd\_comparator>} is from \texttt{basenc} in \texttt{coreutils-8.32}. The upper and lower function is compiled by GCC-7.5 with \texttt{-O0} and \texttt{-O3}, respectively. (\textbf{Right}) the function \texttt{<CMS\_add0\_cert>} is from \texttt{libcrypto.a} in \texttt{openssl-1.0.1u}. The upper function is compiled using \texttt{clang} with default options. The lower function is compiled by turning on the instruction substitution using Hikari~\cite{hikari}, \emph{e.g., } \texttt{-mllvm -enable-subobf}.} \label{fig:challenge} \end{figure*} We use three semantically equivalent but syntactically different function pairs to demonstrate some challenges of learning from only static code. Figure~\ref{fig:challenge} shows the (partial) assembly code of each function. \vspace{.1cm}\noindent\textbf{Cross-architecture example.} Consider the functions in Figure~\ref{subfig:x86_arm}. Two functions have the same execution semantics as both functions take the lower 12-bit of a register and compare it to \texttt{0x80}. Detecting this similarity requires understanding the approximate execution semantics of \texttt{and} in x86 and \texttt{lsl}/\texttt{lsr} in ARM. Moreover, it also requires understanding how the values (\emph{i.e., } \texttt{0xfff} and \texttt{0x14}) in the code are manipulated. However, all existing ML-based approaches~\cite{massarelli2019safe} only learn on static code without observing each instruction's real execution effect. Furthermore, to mitigate the potentially prohibitive vocabulary size (\emph{i.e., } all possible memory addresses), existing approaches replace all register values and memory addresses with an abstract dummy symbol~\cite{massarelli2019safe,duandeepbindiff}. They thus cannot access the specific byte values to determine inherent similarity. \vspace{.1cm}\noindent\textbf{Cross-optimization example.} Now consider two functions in Figure~\ref{subfig:O0_O3}. They are semantically equivalent as \texttt{[ebp+8]} and \texttt{[esp+4]} access the same memory location, \emph{i.e., } the function's first argument pushed on the stack by the caller. To detect such similarity, the model should understand \texttt{push} decreases the stack pointer \texttt{esp} by 4. The model should also notice that \texttt{mov} at line 2 assigns the decremented \texttt{esp} to \texttt{ebp} such that \texttt{ebp+8} in the upper function equals \texttt{esp+4} in the lower function. However, such dynamic information is not reflected in the static code. \vspace{.1cm}\noindent\textbf{Cross-obfuscation example.} Figure~\ref{subfig:subobf} demonstrates a simple obfuscation by instruction substitution, which essentially replaces \texttt{eax+1} with \texttt{eax-(-1)}. Detecting the equivalence requires understanding approximately how arithmetic operations such as \texttt{xor}, \texttt{sub}, and \texttt{add}, executes. However, static information is not enough to expose such knowledge. \subsection{Pretraining Masked LM on Micro-traces} \label{subsec:overview_pretrain} This section describes how the pretraining task, masked LM, on functions' micro-traces encourages the model to learn execution semantics. Although it remains an open research question to explicitly prove certain knowledge is encoded by such language modeling task~\cite{saunshi2019theoretical}, we focus on describing the intuition behind the masked LM -- why predicting masked codes and values in micro-traces can help address the challenging cases in Figure~\ref{fig:challenge}. \vspace{.1cm}\noindent\textbf{Masked LM.} Recall the operation of masked LM: given a function's micro-trace (\emph{i.e., } values and instructions), we mask some random parts and train the model to predict the masked parts using those not masked. Note that pretraining with masked LM does not need any manual labeling effort, as it only predicts the masked part in the input micro-traces without any additional labeling effort. Therefore, \textsc{Trex}\xspace can be trained and further improved with a substantial number of functions found in the wild. The benefit of this is that a certain instruction not micro-executed in one function is highly likely to appear in at least one of the other functions’ micro-traces, supporting \textsc{Trex}\xspace to approximate diverse instructions' execution semantics. \vspace{.1cm}\noindent\textbf{Masking register.} Consider the functions in Figure~\ref{subfig:subobf}, where they essentially increment the value at stack location \texttt{[rbp-0x2c]} by 1. The upper function directly loads the value to \texttt{eax}, increments by 1, and stores the value in \texttt{eax} back to stack. The lower function, by contrast, takes a convoluted way by first letting \texttt{ecx} to hold the value -1, and decrements \texttt{eax} by \texttt{ecx}, and stores the value in \texttt{eax} back to stack. We mask the \texttt{eax} at line 3 in the upper function. We find that our pretrained model can correctly predict its name and dynamic value. This implies the model understands the semantics of \texttt{add} and can deduce the value of \texttt{eax} in line 3 after observing the value of \texttt{eax} in line 2 (before the addition takes the effect). We also find the model can recover the values of masked \texttt{ecx} in line 4 and \texttt{eax} in line 5, implying the model understands the execution effect of \texttt{xor} and \texttt{sub}. The understanding of such semantics can significantly improve the robustness in matching similar functions -- when finetuned to match similar functions, the model is more likely to learn to attribute the similarity to their \emph{similar execution effects}, instead of their syntactic similarity. \vspace{.1cm}\noindent\textbf{Masking opcode.} Besides masking the register and its value, we can also mask the opcode of an instruction. Predicting the opcode requires the model to understand the execution effect of each opcode. Consider Figure~\ref{subfig:O0_O3}, where we mask \texttt{mov} in line 2 of upper function. We find our pretrained model predicts \texttt{mov} with the largest probability (larger than the other potential candidates such as \texttt{add}, \texttt{inc}, etc.). To correctly predict the opcode, the model should have learned several key aspects of the function semantics. First, according to its context, \emph{i.e., } the value of \texttt{ebp} at line 3 and \texttt{esp} at line 2, it learns \texttt{mov} is most probable as it assigns the value of \texttt{esp} to \texttt{ebp}. Other opcodes are less likely as their execution effect conflicts with the observed resulting register values. This also implicitly implies the model learns the approximate execution semantics of \texttt{mov}. Second, the model also learns the common calling convention and basic syntax of x86 instructions, \emph{e.g., } only a subset of opcodes accept two operands (\texttt{ebp,esp}). It can thus exclude many syntactically impossible opcodes such as \texttt{push}, \texttt{jmp}, etc. The model can thus infer \texttt{ebp} (line 3 of upper function) equals to \texttt{esp}. The model may have also learned \texttt{push} decrements stack pointer \texttt{esp} by 4 bytes, from other masked samples. Therefore, when the pretrained model is finetuned to match the two functions, the model is more likely to learn that the semantic equivalence is due to that \texttt{[ebp+8]} in the upper function and \texttt{[esp+4]} in the lower function refer to the same address, instead of their similar syntax. \vspace{.1cm}\noindent\textbf{Other masking strategies.} Note that we are not constrained by the number or the type of items (\emph{i.e., } register, opcode, etc.) in the instructions to mask, \emph{i.e., } we can mask complete instructions or even a consecutive sequence of instructions, and we can mask dynamic values of random instructions’ input-output. Moreover, the masking operation dynamically selects random subsets of code blocks and program states at each training iteration and on different training samples. As a result, it enables the model to learn the diverse and composite effect of the instruction sequence, essential to detecting similarity between functions with various instructions. In this paper, we adopt a completely randomized strategy to choose what part of the micro-trace to mask with a fixed masking percentage (see Section~\ref{subsec:pretrain_method} for details). However, we envision a quite interesting future work to study a better (but still cheap) strategy to dynamically choose where and how much to mask. \section{.5pt}{5pt plus 2pt minus 2pt}{5pt plus 2pt minus 2pt} \begin{document} \title{\textsc{Trex}\xspace: Learning Execution Semantics from\\ Micro-Traces for Binary Similarity} \makeatletter \newcommand{\linebreakand}{% \end{@IEEEauthorhalign} \hfill\mbox{}\par \mbox{}\hfill\begin{@IEEEauthorhalign} } \makeatother \author{\IEEEauthorblockN{Kexin Pei} \IEEEauthorblockA{Columbia University\\ kpei@cs.columbia.edu} \and \IEEEauthorblockN{Zhou Xuan} \IEEEauthorblockA{University of California, Riverside\\ zxuan004@ucr.edu} \linebreakand \IEEEauthorblockN{Junfeng Yang} \IEEEauthorblockA{Columbia University\\ junfeng@cs.columbia.edu} \and \IEEEauthorblockN{Suman Jana} \IEEEauthorblockA{Columbia University\\ suman@cs.columbia.edu} \and \IEEEauthorblockN{Baishakhi Ray} \IEEEauthorblockA{Columbia University\\ rayb@cs.columbia.edu}} \date{} \maketitle \input{abst} \input{intro} \input{overview} \input{threat} \input{methodology} \input{impl} \input{eval} \input{case} \input{related} \input{conclusion} \input{ack} \bibliographystyle{plain} \section{Related Work} \label{sec:related} \subsection{Binary Similarity} \vspace{.1cm}\noindent\textbf{Traditional approaches.} Existing static approaches often extract hand-crafted features by domain experts to match similar functions. The features often encode the functions' syntactic characteristics. For example, BinDiff~\cite{bindiff} extracts the number of basic blocks and the number of function calls to determine the similarity. Other works~\cite{myles2005k, khoo2013rendezvous, crussell2013andarwin, farhadi2014binclone} introduce more carefully-selected static features such as n-gram of instruction sequences. Another popular approach is to compute the structural distance between functions to determine the similarity~\cite{bindiff, bourquin2013binslayer, david2014tracelet, pewny2014leveraging, eschweiler2016discovre, david2017similarity, huang2017binsequence}. For example, BinDiff~\cite{bindiff} performs graph matching between functions' call graphs. TEDEM~\cite{pewny2014leveraging} matches the basic block expression trees. BinSequence~\cite{huang2017binsequence} and Tracelet~\cite{david2014tracelet} uses the edit distance between functions' instruction sequence. As discussed in Section~\ref{sec:intro}, both static features and structures are susceptible to obfuscations and optimizations and incur high overhead. \textsc{Trex}\xspace automates learning approximate execution semantics without any manual effort, and the execution semantics is more robust to match semantically similar functions. In addition to the static approaches, dynamic approaches such as iLine~\cite{jang2013towards}, BinHunt~\cite{ming2012ibinhunt}, iBinHunt~\cite{ming2012ibinhunt}, Revolver~\cite{kapravelos2013revolver}, Blex~\cite{egele2014blanket}, Rieck \textit{et al.~}\cite{rieck2011automatic}, Multi-MH~\cite{pewny2015cross}, BinGo~\cite{chandramohan2016bingo}, ESH~\cite{david2016statistical}, BinSim~\cite{ming2017binsim}, CACompare~\cite{hu2017binary}, Vulseeker-pro~\cite{gao2018vulseeker}, and Tinbergen~\cite{mckee2019software} construct hand-coded dynamic features, such as values written to stack/heap~\cite{egele2014blanket} or system calls~\cite{ming2017binsim} by executing the function to match similar functions. These approaches can detect semantically similar (but syntactically different) functions by observing their similar execution behavior. However, as discussed in Section~\ref{sec:intro}, these approaches can be expensive and can suffer from false positives due to the under-constrained dynamic execution traces~\cite{jiang2009automatic, ding2019asm2vec}. By contrast, we only use these traces to learn approximate execution semantics of individual instructions and transfer the learned knowledge to match similar functions without directly comparing their dynamic traces. Therefore, we are much more efficient and less susceptible to the imprecision introduced by these under-constrained dynamic traces. \vspace{.1cm}\noindent\textbf{Learning-based approaches.} Most recent learning-based works such as Genius~\cite{feng2016scalable}, Gemini~\cite{xu2017neural}, Asm2Vec~\cite{ding2019asm2vec}, SAFE~\cite{massarelli2019safe}, DeepBinDiff~\cite{duandeepbindiff} learn a function representation that is supposed to encode the function syntax and semantics in low dimensional vectors, known as function embeddings. The embeddings are constructed by learning a neural network that takes the functions' structures (control flow graph)~\cite{feng2016scalable,xu2017neural,duandeepbindiff} or instruction sequences~\cite{ding2019asm2vec, massarelli2019safe} as input and train the model to align the function embedding distances to the similarity scores. All existing approaches are based only on static code, which lacks the knowledge of function execution semantics. Moreover, the learning architectures adopted in these approaches require constructing expensive graph features (attributed CFG~\cite{feng2016scalable, xu2017neural}) or limited in modeling long-range dependencies (based on Word2Vec~\cite{ding2019asm2vec, duandeepbindiff}). By contrast, \textsc{Trex}\xspace learns approximate execution semantics to match functions. Its underlying architecture is amenable to learning long-range dependencies in sequences without heavyweight feature engineering or graph construction. \subsection{Learning Program Representations} There has been a growing interest in learning neural program representation as embeddings from ``Big Code''~\cite{allamanis2018survey}. The learned embedding of the code encodes the program's key properties (\emph{i.e., } semantics, syntax), which can be leveraged to perform many applications beyond function similarity, such as program repair~\cite{parihar2017automatic, wang2017semantics}, recovering symbol names and types~\cite{chua2017neural, patrick2020probabilistic}, code completion~\cite{raychev2014code}, decompilation~\cite{fu2019coda, katz2018using}, prefetching~\cite{shi2019learning}, and many others that we refer to Allamanis \textit{et al.~}\cite{allamanis2018survey} for a more thorough list. Among these works, the most closest work to us is XDA~\cite{pei2021xda}, which also leverages the transfer learning to learn general program representations for recovering function and instruction boundaries. However, XDA only learns from static code at the raw byte level, which lacks the understanding of execution semantics. The core technique proposed in this paper -- learning approximate execution semantics from micro-traces -- is by no means limited to only function similarity task but can be applied to any of the above tasks. Indeed, we plan to explore how the learned semantics in our model can transfer to other (binary) program analysis tasks in our future work. \section{Threat Model} \label{sec:threat} We assume no access to the debug symbols or source while comparing binaries. Indeed, there exist many approaches to reconstruct functions from stripped binaries~\cite{bao2014byteweight, shin2015recognizing, andriesse2017compiler, di2017rev, pei2021xda}. Moreover, we assume the binary can be readily disassembled, \emph{i.e., } it is not packed nor transformed by virtualization-based obfuscator~\cite{vmprotect, ugarte2015sok}. \vspace{.1cm}\noindent\textbf{Semantic similarity.} We consider two semantically similar functions as having the same input-output behavior (\emph{i.e., } given the same input, two functions produce the same output). Similar to previous works~\cite{xu2017neural, massarelli2019safe, ding2019asm2vec}, we treat functions compiled from the same source as similar, regardless of architectures, compilers, optimizations, and obfuscation transforms.
{'timestamp': '2021-04-28T02:05:56', 'yymm': '2012', 'arxiv_id': '2012.08680', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08680'}
arxiv
\section{\label{Introduction}Introduction} Although FL is born for high efficient distributed model building, it’s not as efficient enough as we thought. Many existing methods may perform well for IID data setting, but non-ideal for non-IID data setting. In these methods,thier continuous global model sharing strategy, which makes them over focusing on global data distribution fitting but ignoring local data distribution. In FL, the methodology for this kind of problem is called personalization. To improve the personalization performance of FL, we bring the double head design in this paper. This idea is inspired from the multi-task learning, where multiple heads design \citep{DBLP:journals/corr/LiH16e, DBLP:journals/corr/abs-1905-07835} is introduced to remember the model info from history missions. Similarly, we expect our double head design will achieve a good balance for model optimization between global and local data distribution. Communication efficiency is another concerned topic in FL. Here we create the gradual sharing design to handle it. We get this idea from the analysis of model convergence rules. As we know, clients’ models share a similar convergence direction during their initial rounds of training. So it is not necessary to share model in this stage during this stage. In addition, we notice that once a frozen model restarts to share, it could recover to the normal performance effectively. All this gives us confidence to try the gradual sharing design instead of always model sharing in FL to save communication cost. We summarize three main contributions of our method as below. \begin{itemize}[leftmargin=*] \item We propose a double head design for FL, which makes our FL model benefit from the local and global data simultaneously. \item We introduce a gradual model sharing strategy for FL to save its communication cost greatly. \item We split the data distribution setting over train and test data, which contributes to better evaluation for FL methods over various data distribution settings. \end{itemize} The rest of our paper is organized as follow. In Sec.\ref{RelatedWork} we overview existing methods towards FL efficient problems. In Sec.\ref{OurDesign} we introduce our creative designs in detail. In Sec.\ref{Experiments} extensive experiments are made to evaluate our method. Finally, in Sec.\ref{Conclusion}, we summarize our method. \section{\label{RelatedWork}Related Work} Since the concept of FL was proposed by Google \citep{mcmahan2017communication}, personalization effectiveness and communication efficiency have always been concerned by researchers. \subsection{Personalization Effectiveness} As mentioned before, the classic FL method has the drawback of handling non-IID data \citep{10.1145/3286490.3286559}. Roughly speaking, the principle idea for this problem is located at heterogeneous model parameter optimization, which is attempting to adapt a global model by fine-tuning, data-sharing or model-mixture. For the fine-tuning method \citep{wang2019federated, li2020lotteryfl}, a global model is given to each client in FL, then each cliect retrains the model with a new objective function based on their local data.. In the data-sharing method, some researchers \citep{DBLP:journals/corr/abs-1806-00582} try to upload a small part of local data to the server to tackle the non-IID problem, although it’s an obvious violation of data privacy. Other researchers attempt to build a generative model \citep{DBLP:journals/corr/abs-1811-11479} to cope with clients’ sample insufficient problem under the non-IID setting. As to the model-mixture method, researchers \citep{hanzely2020federated, deng2020adaptive, huang2020personalized} try to optimize the FL’s overall performance on global and local data distributions by ensembling models on server and clients. Other researchers attempt to achieve this by freezing data sharing on the last layer \citep{yang2020heterogeneity} of clients’ model. Currently, most of methods achieve better personalization performance at the price of more complicated computation cost and a sacrifice of performance on the IID data setting. \subsection{Communication Efficiency} In the field of multi-task learning, some researchers aim to alleviate communication cost by compressing the communication content or reducing model update frequency \citep{tang2020communication}. Similar ideas continue in the FL area. At first, researchers \citep{DBLP:journals/corr/KonecnyMYRSB16, DBLP:journals/corr/Alistarh0TV16} propose to compress the model through a combination of quantization, subsampling, or encoding before sending it to the server. Then, other researchers \citep{DBLP:journals/corr/abs-1804-03235, DBLP:journals/corr/abs-1811-11479, yu2020salvaging} try to implement knowledge distillation \citep{hinton2015distilling} to save communication cost for the model aggregation. Recently, besides choosing sketched info to communicate over clients and server \citep{DBLP:journals/corr/abs-1903-04488}, more researchers start to optimize the communication efficient in FL by only synchronizing sub-model of the base model \citep{liang2020think, yang2020heterogeneity, li2020lotteryfl}. Several methods bear similar ideas with us. In method \citep{yang2020heterogeneity}, the last layer of the model is locked while training. As for method \citep{liang2020think}, the local model is divided into local and global part, the local part's model sharing is forbidden while training. In our method, we take similar measures of constraining the model sharing across layers, while our specific freeze strategy is quite different from them. In addition, our method achieves better stable performance across various data distribution settings than those two methods. The method \citep{wang2020federated} also has a layer-wise model sharing strategy, which seems like our gradual sharing design. However, it is optimized for the probabilistic model and can be seen as an extension for the bayesian nonparametric FL \citep{yurochkin2019bayesian} in CNN and LSTM setting. As a contrast, our method aims for a general model setting, and owns a completely different communication saving strategy. \section{\label{OurDesign}Our Design} \begin{figure*}[htbp] \subfigure{ \begin{minipage}[t]{0.47\linewidth} \centering \includegraphics[width=1\linewidth]{pic/DoubleHeadDesignNew.png} \setcounter{figure}{0}\caption{\label{fig:DoubleHeadDesign}Double Head Design} \end{minipage} } \quad \subfigure{ \begin{minipage}[t]{0.45\linewidth} \centering \includegraphics[width=1\linewidth]{pic/GradualSharingDesignNew.png} \caption{\label{fig:GradualSharingDesign}Gradual Sharing Design}\setcounter{figure}{3} \end{minipage} } \end{figure*} \subsection{Double Head} As discussed before, our double head design is originated from the multiple head design in multi-task learning. These two heads are responsible for fitting the global and local data distribution respectively. For the sake of convenience, we take a sketch map of a classification task's network as an example to illustrate our theory in the follow-up, as shown in Figure \ref{fig:DoubleHeadDesign}. In our design, the network of the model could be divided into two main parts: the base part and the specific part.In the specific part, there're two tracks of network structure, each of which is consisted with several full connected layers and a softmax layer. These tracks are called the global and the local head respectively. Only the local head is forbidden model sharing while training, other parts of the model will always join model sharing. We formula the global and local heads’ output as \begin{equation} f_g(\overrightarrow{u})_i = \frac{e^{u_i}}{\sum_{j=1}^Ce^{u_j}}, \mbox{ for } i = 1, ..., C \mbox{ and } j = 1, ..., C \end{equation} \begin{equation} f_l(\overrightarrow{v})_i = \frac{e^{v_i}}{\sum_{j=1}^Ce^{v_j}}, \mbox{ for } i = 1, ..., C \mbox{ and } j = 1, ..., C \end{equation} where the \(f_g\) and \(f_l\) are the output of a client model’s global and local head. \(\overrightarrow{u}\) and \(\overrightarrow{v}\) represent the penultimate output from the two heads. \(u_i\) and \(v_i\) mean the \(i\)-th element of vector \(\overrightarrow{u}\) and \(\overrightarrow{v}\). Parameter \(i\) and \(j\) are index of classes range from \(1\) to \(C\). The final prediction result of the model is extracted from the output of these two heads’ softmax layers. We take the index of max value in the two output vectors as result, which is formulated as \begin{equation} {pred} = \mathop{\arg\max}_i(f_g(\overrightarrow{u})_i \oplus f_l(\overrightarrow{v})_i) \end{equation} where \(f_g\), \(f_l\), \(\overrightarrow{u}\) and \(\overrightarrow{v}\) bear the same meaning as in previous formulas; \(\oplus\) represents for the concatenation operation. The complete pseudo-code of our double head design is given in Algorithm \ref{algorithmDHFL}, where \(K\) is clients' quantity in out FL system, \(T\) is the round number of model training, \(E\) is the number of local epochs, \(\eta\) represent the learning rate, \(w\) is the weight of server's model, \(wb, wg\) represent for the model weights of the base part and the global part, and \(w'\) is the weight of clients' model. \begin{figure} \begin{minipage}{0.5\textwidth} \begin{algorithm}[H] \caption{\label{algorithmDHFL}Double Head Design} \SetKwProg{ServerExecutes}{Server executes}{:}{end} \SetKwProg{ClientUpdate}{ClientUpt}{:}{end} \SetKwProg{ClientInit}{ClientInit}{:}{end} \SetKwFunction{ClientUpdateFn}{ClientUpt} \SetKwFunction{ClientInitFn}{ClientInit} \SetKwFunction{concat}{concat} \SetKwFunction{split}{split} \SetKwFunction{valueFn}{value} \ServerExecutes{}{ initialize \(w_0 \rightarrow\) \concat{\(wb_0, wg_0\)} \\ \ForEach{client \(k = 1, ..., K\) in parallel}{ \ClientInitFn{\(k, w_0\)} \\ } \For{\(t = 1, 2, ..., T\)}{ \(s_t \leftarrow (\mbox{random set of } m \mbox{ clients})\) \\ \ForEach{client \(k \in s_t\)}{ \(w_{t+1}^k \leftarrow\) \ClientUpdateFn{\(k, w_t\)} \\ } \(w_{t+1} \leftarrow \sum_{k=1}^K\frac{n_k}{n}w_{t+1}^k\) \\ } } \ClientUpdate{\((k, w_t)\)}{ \(wb_t, wg_t \leftarrow\) \split{\(w_t\)} \\ \({wb'}_{t-1}^k, {wg'}_{t-1}^k, {wl'}_{t-1}^k \newline \leftarrow\) \split{\({w'}_{t-1}^k\)} \\ \({w'}_t^k \leftarrow\) \concat{\(wb_t, wg_t, {wl'}_{t-1}^k\)} \\ \For{local epoch \(i = 1, 2, ..., E\)}{ \({w'}_t^k \leftarrow {w'}_{t}^k - \eta \nabla l({w'}_t^k; D_k)\) \\ } \({wb'}_{t}^k, {wg'}_{t}^k, {wl'}_{t}^k \leftarrow\) \split{\({w'}_{t}^k\)} \\ \({w'}_t^{t+1} \leftarrow\) \concat{\({wb'}_{t}^k, {wg'}_{t}^k\)} \\ \Return \(w_{t+1}^k\) to server \\ } \ClientInit{\((k, w_0)\)}{ \(wb_0, wg_0 \leftarrow\) \split{\(w_0\)} \\ \({wb'}_0^k, {wg'}_0^k, {wl'}_0^k \leftarrow\) \valueFn{\(wb_0, wg_0, wl_0\)} \\ \({w'}_0 \leftarrow\) \concat{\({wb'}_0^k, {wg'}_0^k, {wl'}_0^k\)} \\ } \end{algorithm} \end{minipage} \quad \begin{minipage}{0.5\textwidth} \begin{algorithm}[H] \caption{\label{algorithmGSFL}Gradual Sharing Design} \SetKwProg{ServerExecutes}{Server executes}{:}{end} \SetKwProg{ClientUpdate}{ClientUpt}{:}{end} \SetKwProg{GetMask}{GetMask}{:}{end} \SetKwFunction{ClientUpdateFn}{ClientUpt} \SetKwFunction{GetMaskFn}{GetMask} \SetKwFunction{concat}{concat} \ServerExecutes{}{ initialize \(w_0\) \\%\tcp*[l]{initialize server model} \ForEach{phase \(p = 1, 2, ..., P\)}{ \(m_p \leftarrow\) \GetMaskFn{\(p\)} \\ \For{\(t = 1, 2, ..., T\)}{ \(s_t \leftarrow (\mbox{random set of } m \mbox{ clients})\) \\ \ForEach{client \(k \in s_t\)}{ \(ws_t \leftarrow m_p \otimes w_t\) \\ \(ws_{t+1}^k \leftarrow\) \ClientUpdateFn{\(k, p, ws_t\)} \\ \(w_{t+1}^k \leftarrow\) \concat{\newline\(ws_{t+1}^k, (1 - m_p) \otimes w_t\)} \\ } \(w_{t+1} \leftarrow \sum_{k=1}^K\frac{n_k}{n}w_{t+1}^k\) \\ } } } \ClientUpdate{\((k, p, ws_t)\)}{ \(m_p \leftarrow\) \GetMaskFn{\(p\)} \\ \({w'}_t^k \leftarrow\) \concat{\(ws_t, (1-m_p) \otimes {w'}_{t-1}^k\)} \\ \For{local epoch \(i = 1, 2, ..., E\)}{ \({w'}_t^k \leftarrow {w'}_t^k - \eta\nabla l({w'}_t^k; D_k)\) \\ } \(ws_{t+1}^k \leftarrow m_p \otimes {w'}_t^k\) \\ \Return \(ws_{t+1}^k\) to server \\ } \GetMask{\((p)\)}{ \(m \leftarrow (\mbox{initialize model size mask with } 0)\) \\ \ForEach{layer \(l = 1, 2, ..., p\)}{ \(m \leftarrow (\mbox{turn } l \mbox{ part of mask into } 1)\) } \Return \(m\) } \end{algorithm} \end{minipage} \end{figure} \subsection{Gradual Sharing} Unlike other FL methods' full size model sharing, our method implements a new gradual sharing design, which is actually a model gradual sharing strategy for FL. This design helps us achieve more communication saving without hurting FL’s accuracy performance. As shown in Figure \ref{fig:GradualSharingDesign}, we will freeze clients sharing model with the server in initial training stages. Then, along with the training, clients could be allowed to share their model in layer-wise manner from shallower to deeper at certain frequency. Similarly, to better illustrate our idea, we give its pseudo-code in Algorithm \ref{algorithmGSFL}, in which \(K, E, \eta, w, w'\) are same to Algorithm \ref{algorithmDHFL}, and \(P\) indicates the current model sharing phase, which is calculated from the gradual sharing frequency, with value ranges from 1 to number of layers. \section{\label{Experiments}Experiments} \subsection{Experimental Detail} \paragraph{Datasets} Two challenge datasets are used here to evaluate our method: the FEMINIST dataset \citep{DBLP:journals/corr/abs-1812-01097} and the TCP Traffic Classification (hereinafter called the ‘TTC’) dataset. FEMINIST is a public dataset of image classification, containing over 800k samples of 62 classes. Each sample (\(28 \times 28 \times 1\) pic) has its own writers and there are more than 3k writers in the dataset. Its data characteristics like: with plentiful enough classes; samples of the same class with various label types, are quite suitable for federated learning simulation. As for TTC dataset, it is a proprietary dataset from Huawei for traffic classification task. There are about 900k samples (\(10 \times 1\) vector) of 34 classes in it. It offers TCP traffic data which is captured and desensitized from two various data scenarios. This makes the evaluation on it more believable for industrial application. According to industrial scenarios might met, we set three kinds of data distribution: \begin{itemize}[leftmargin=*] \item The \textbf{IID} setting: dataset distribution across clients is same. For FEMINIST, each client owns a dataset with the same amount of every writer’s samples. For TTC, each client is equally allocated data from two scenarios. \item The \textbf{non-IID} setting: dataset distribution over clients is different, but each client’s data could cover the whole labels. For FEMINIST, clients are given whole label included data from different writers. For TTC, clients’ dataset are distributed from different data scenarios. \item The \textbf{dispatch} setting: different clients own samples of uncrossed classes. This is a relative extreme non-IID setting for FL, but it is common for industrial scenario and discriminative enough for FL methods evaluation. \end{itemize} It's worth noting that, for most of current FL methods, the test data distribution will follow as the train data. But in real industrial scenarios, future data distribution is unknown, thus makes us to extend our test data into two basic modes, as follows. \begin{itemize}[leftmargin=*] \item The global mode: a new added test mode, where the distribution of test data will be close to the combination of all training data, and all clients model share the same test data. \item The local mode: the classic test mode, where the distribution of test data on each client will inherit their local train data, and therefore each client’s test data is different. \end{itemize} \paragraph{Implementations} To simplify compuation, we take a 5 layer network as the basic network, consisted of 2 convolution (conv) layers, 2 fully connected (fc) layers and a softmax layer in sequential. In our method, the first two conv + pooling layers are set as the base part and the rest layers are duplicated twice as the specific part. As a contrast, we take the Google’s FedAvg method \citep{mcmahan2017communication} as baseline, and also make a comparison with the HDAFL method \citep{yang2020heterogeneity}, who also declared itself better than FedAvg over non-IID data setting. All methods are implemented by Tensorflow v1.14 on Ubuntu 16.04. All models will be trained for over 400 rounds, and communication frequency is set at every 2 model iterations. In FEMINIST dataset, we simulate 10 clients, each has 10k samples. In TCC dataset, we have 2 clients, each owns around 200k samples. \subsection{Double Head Effect} \begin{figure}[htbp] \centering \subfigure[IID + global test]{ \begin{minipage}[t]{0.24\linewidth} \label{fig:DBHeadGIid} \centering \includegraphics[width=1.1\linewidth]{pic/DBHeadGIid.png} \end{minipage} } \subfigure[non-IID + global test]{ \begin{minipage}[t]{0.24\linewidth} \label{fig:DBHeadGNonIid} \centering \includegraphics[width=1.1\linewidth]{pic/DBHeadGNonIid.png} \end{minipage} } \subfigure[dispatch + global test]{ \begin{minipage}[t]{0.24\linewidth} \label{fig:DBHeadGDispatch} \centering \includegraphics[width=1.1\linewidth]{pic/DBHeadGDispatch.png} \end{minipage} } \subfigure[IID + local test]{ \begin{minipage}[t]{0.24\linewidth} \label{fig:DBHeadLIid} \centering \includegraphics[width=1.1\linewidth]{pic/DBHeadLIid.png} \end{minipage} } \subfigure[non-IID + local test]{ \begin{minipage}[t]{0.24\linewidth} \label{fig:DBHeadLNoniid} \centering \includegraphics[width=1.1\linewidth]{pic/DBHeadLNoniid.png} \end{minipage} } \subfigure[dispatch + local test]{ \begin{minipage}[t]{0.24\linewidth} \label{fig:DBHeadLDispatch} \centering \includegraphics[width=1.1\linewidth]{pic/DBHeadLDispatch.png} \end{minipage} } \caption{\label{fig:DoubleHeadEffect}Compare of model accuracy performance over FEMNIST dataset} \end{figure} We firstly explore the advantages of double head design. As shown in Figure \ref{fig:DBHeadGIid} and \ref{fig:DBHeadGNonIid}, under the global test mode, with IID and non-IID data setting, our method has similar accuracy performance with FedAvg and performs better than HDAFL. This result can be explained by the global test data includes all clients' data distribution. Methods with more global model sharing power will gain more effective info while training. Likewise, method with less global sharing ability will achieve less in this setting.The result for IID and non IID data setting under local test mode is shown in Figure \ref{fig:DBHeadLIid} and \ref{fig:DBHeadLNoniid}. Our method performs a bit worse than HDAFL, but better than FedAvg. This might due to local test data mode setting, where methods with stronger fitting for local data distribution could perform better. In Figure \ref{fig:DBHeadGDispatch} and \ref{fig:DBHeadLDispatch}, the result of the dispatch data setting further supports above conclusions. In global test mode, FedAvg gets much better performance than others. While on local test mode, our method and HDAFL have similar performance and outperform FedAvg greatly. All this turns out our double head design enhance FL's fitting power for global and local data distribution simultaneously. Although it didn't get best accuracy result in all data settings, it performs more stable than other methods, which is more favorable in industry. After all, in industrial application, a better generalization performance is foremost, especially when future data distribution is unknown. \subsection{\label{GradualSharingEffect}Gradual Sharing Effect} We further explore the effectiveness of our gradual sharing design for FL. First of all, we want to evaluate the impact of gradual sharing frequency. For FEMNIST dataset, according to our preliminary estimate, client’s model may reach convergence status after around 400 rounds of training. Accordingly, we set three types of sharing frequencies: release one layer every 10 rounds, every 20 rounds, and every 80 rounds respectively. \begin{figure}[htbp] \centering \subfigure[IID + global test]{ \begin{minipage}[t]{0.23\linewidth} \label{fig:GSGIid} \centering \includegraphics[width=1.1\linewidth]{pic/GSGIid.png} \end{minipage} } \subfigure[non-IID + global test]{ \begin{minipage}[t]{0.23\linewidth} \label{fig:GSGNonIid} \centering \includegraphics[width=1.1\linewidth]{pic/GSGNonIid.png} \end{minipage} } \subfigure[dispatch + global test]{ \begin{minipage}[t]{0.23\linewidth} \label{fig:GSGDispatch} \centering \includegraphics[width=1.1\linewidth]{pic/GSGDispatch.png} \end{minipage} } \subfigure[IID + local test]{ \begin{minipage}[t]{0.23\linewidth} \label{fig:GSLIid} \centering \includegraphics[width=1.1\linewidth]{pic/GSLIid.png} \end{minipage} } \subfigure[non-IID + local test]{ \begin{minipage}[t]{0.23\linewidth} \label{fig:GSLNoniid} \centering \includegraphics[width=1.1\linewidth]{pic/GSLNoniid.png} \end{minipage} } \subfigure[dispatch + local test]{ \begin{minipage}[t]{0.23\linewidth} \label{fig:GSLDispatch} \centering \includegraphics[width=1.1\linewidth]{pic/GSLDispatch.png} \end{minipage} } \subfigure[FEMINST]{ \begin{minipage}[t]{0.23\linewidth} \label{fig:GSEffectTransmissionRate} \centering \includegraphics[width=1.1\linewidth]{pic/GSEffectTransmissionRate.png} \end{minipage} } \subfigure[TTC]{ \begin{minipage}[t]{0.23\linewidth} \label{fig:TTCGSEffectTransmissionRate} \centering \includegraphics[width=1.1\linewidth]{pic/TTCGSEffectTransmissionRate.png} \end{minipage} } \caption{\label{fig:GradualSharingEffect}Evaluation of Gradual Sharing Effectiveness: (a)-(f) are compare of convergence over various sharing frequencies; (g) and (h) are communication saving compare over two datasets} \end{figure} Results in Figure \ref{fig:GradualSharingEffect} has shown that, no matter in what kind of data setting or test mode, the gradual sharing applied model would resume to the normal accuracy performance quickly, although there would be a temporary decline once a layer sharing was relaxed. It’s worth noting that the frequency is an experimental parameter ranges from 0 to N (various according to dataset scenario). Once it's set too big, the model would be risky to resume to the normal accuracy within limited training rounds. We also provide the comparison results for communication saving evaluation. In Figure \ref{fig:GSEffectTransmissionRate}, our method could achieve over 50\% communication saving than other two methods when gradual sharing frequency is set at 80 rounds/layer. This proves that our gradual sharing design would help FL system to save communication cost greatly without obvious accuracy performance decline. \subsection{\label{ComprehensiveCompareInTTCDataset}Evalutaion on TTC dataset} The TTC dataset is extracted from the telecom scenario, so an evaluation on this dataset could give a better reflect of our method’s performance in real industrial scenarios. The quantitative results in Table \ref{tab:QCOfModelAccPerfOverTTCDataset} show that our method's good accuracy performance across different data settings. And the result in Figure \ref{fig:TTCGSEffectTransmissionRate} further proves that our method have an obvious advantage in communication saving. Besides, our method even performs better in TTC dataset than it is in FEMNIST dataset. This might due to its bigger model complexity induced by the double head design, which improves model’s ability to tackle a complex dataset like TTC. \begin{table} \centering \caption{\label{tab:QCOfModelAccPerfOverTTCDataset}Quantitative compare of model accuracy performance over TTC dataset} \begin{tabular}{l|lll|lll} \toprule & \multicolumn{3}{c}{Global Test} & \multicolumn{3}{c}{Local Test} \\ \cmidrule(r){2-7} Name & IID & non-IID & dispatch & IID & non-IID & dispatch \\ \midrule FedAvg & 0.8375 & 0.8341 & \textcolor{red}{0.7994} & 0.8503 & 0.8385 & 0.7374 \\ HDAFL & 0.8370 & 0.8021 & 0.4420 & 0.8498 & 0.8583 & 0.8792 \\ Our\_DH & \textcolor{red}{0.8544} & \textcolor{red}{0.8512} & 0.7495 & \textcolor{red}{0.8680} & \textcolor{red}{0.8722} & 0.8723 \\ Our\_DH+GS & 0.8430 & 0.8444 & 0.7472 & 0.8562 & 0.8704 & \textcolor{red}{0.8818} \\ \bottomrule \end{tabular} \end{table} \section{\label{Conclusion}Conclusion} Improving the personalization effectiveness and the communication efficient are always the research focus in FL. In this paper, we propose the double head design and the gradual sharing design to tackle these challenges. Our experimental results show that the double head design effectively enhance FL's accuracy performance under the non-IID data setting. And the gradual sharing design could save communication cost hugely without impeding model convergence. Although our method didn't get the best accuracy result over all data settings, it achieves a more stable performance across various test data settings compared to other SOTAs. This helps it to be more industry attractive. \bibliographystyle{plainnat}
{'timestamp': '2020-12-17T02:13:02', 'yymm': '2012', 'arxiv_id': '2012.08809', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08809'}
arxiv
\section{Introduction} The recent rapid progress of information technologies, including machine learning, has led to studies on novel computing concepts and hardware, such as neuromorphic processing \cite{Markovic2020,Rabinovich2006,Furber2016,Merolla2014,Feldmann2019,Tait2017}, reservoir computing \cite{Versraeten2007,Jaeger2004,Tanaka2019,Appeltant2011,Brunner2013,Inubushi2020}, and deep learning \cite{LeCun2015,Xu2018,Lin2018,Shen2017}. In particular, deep learning has become a groundbreaking tool for data processing owing to its high-level performance \cite{LeCun2015}. Furthermore, the energy-efficient computing for deep learning is gaining importance with the rising need for processing large amounts of data \cite{XChen2014}. An underlying key factor of deep learning is its high expressive power, which is the result of the layer-to-layer propagation of information in the deep network. This expressive power enables the representation of extremely complex functions in a manner that cannot be achieved using shallow networks with the same number of neurons \cite{Poole2016,Montufar2014}. Interestingly, recent studies have reported that the information propagation in multilayer systems can be expressed as the time evolution of dynamical systems \cite{Liu2019,Chen2018,Benning2019,Haber2017}. From the point of view of dynamical systems, the learning process of networks can be regarded as the optimal control of the dynamical systems \cite{Liu2019,Chen2018}. This viewpoint suggests that there is a connection between deep neural networks and dynamical systems and indicates the possibility of using dynamical systems as physical deep-learning machines. In this paper, we reveal the potential of dynamical systems with optimal control for the physical implementation. We propose a deep neural network-like architecture using dynamical systems with delayed feedback and show that delayed feedback allows for the virtual construction of a deep network structure in a {\it physically single node} using a time-division multiplexing method. In the proposed approach, the virtual deep network for information propagation comes from the time evolution of delay systems; the systems are optimally controlled such that information processing, including classification, is facilitated. The significant difference between our deep network and ordinary deep neural network architectures is that the learning via optimal control is realized by only a few control signals and minimal weight parameters, whereas the learning by conventional deep neural networks requires a large number of weight parameters \cite{Shen2017,Lin2018}. The proposed approach using optimal control is applicable for a wide variety of experimentally controllable systems; it allows for simple but large-scale deep networks in physical systems with a few control parameters. \section{Multilayer neural networks and dynamical systems} First, we briefly discuss the relationship between multilayer neural networks and dynamical systems. Let a dataset to be learned be composed of $K$ inputs, ${\bm x}_{k} \in {\mathbb R}^M$ and their corresponding target vectors, ${\bm t}_k\in{\mathbb R}^{L}$, where $k \in \{1,2,\cdots,K\}$. $M$ and $L$ are dimensions of the inputs and target vectors, respectively. The goal of supervised learning is to find a function that maps inputs onto corresponding targets, $\mbox{\boldmath $G$}: {\bm x}_k \rightarrow {\bm t}_k$. To this end, we consider an output function, ${\bm y} = \tilde{\mbox{\boldmath $G$}}({\bm x},{\bm w}) \in {\mathbb R}^L$, parameterized by the $M_w$-dimensional vector, ${\bm w} \in {\mathbb R}^{M_w}$, and the following loss function: \begin{align} J = \sum_{k=1}^K \Psi({\bm t}_k,{\bm y}_k), \label{cost-eq1} \end{align} where $\Psi({\bm t}_k,{\bm y}_k)$ is a function of the distance between the target ${\bm t}_k$ and the output, ${\bm y}_k = \tilde{\mbox{\boldmath $G$}}({\bm x}_k,{\bm w})$. ${\bm w}$ is determined such that loss function $J$ is minimized, i.e., output ${\bm y}_k$ corresponds to target ${\bm t}_k$. It is well-known that a neural network model with an appropriate activation function is a good candidate for representing function $\mbox{\boldmath $G$}$ owing to its universal approximation capability \cite{Cybenko1989,Funahashi1989,Sonoda2017}. In multilayer neural networks, the output, ${\bm y}_k = (y_{0,k},y_{1,k},\cdots,y_{L-1,k})^\mathrm{T}$, is given by the layer-to-layer propagation of an input, ${\bm x}_k$ [Fig.~\ref{fig_ds}(a)]. The layer-to-layer propagation based on multilayer network structures plays a crucial role in increasing expressivity \cite{Poole2016} and enhancing learning performance. In this study, instead of standard multilayer networks, we utilize information propagation in a continuous-time dynamical system, \begin{align} \dev{{\bm r}(t)}{t}{} = \mbox{\boldmath $F$}\left[{\bm r}(t),{\bm u}(t) \right], \label{eq1} \end{align} where ${\bm r}(t) \in {\mathbb R}^M$ is the state vector at time $t$ and ${\bm u}(t) \in {\mathbb R}^{M_u}$ represents a control signal vector. Based on the correspondence between a multilayer network [Fig.~\ref{fig_ds}(a)] and a dynamical system [Fig.~\ref{fig_ds}(b)], we suppose that an input ${\bm x}_k$ is set as an initial state ${\bm r}(0)$. Additionally, the corresponding output, ${\bm y}_k$, is given by the time evolution (feedforward propagation) of the state vector, ${\bm r}_k(T) = {\bm r}(T,{\bm x}_k)$, up to the end time $t = T$, i.e., ${\bm y}_k = {\bm y}[{\bm r}_k(T),\mbox{\boldmath $\omega$}]$, where $\mbox{\boldmath $\omega$} \in {\mathbb R}^{L\times M}$ is a parameter matrix determined in the training process. Loss function $J$ is obtained by repeating the aforementioned feedforward propagation for all training data instances and using their outputs. The goal of the learning is to find an optimal control vector, ${\bm u}^*(t)$, and a parameter vector, $\mbox{\boldmath $\omega$}^*$, such that $J$ is minimized, i.e., ${\bm w}^* = (\{{\bm u}^*(t)\}_{0 < t \le T}, \mbox{\boldmath $\omega$}^*) = \mbox{argmin}_{{\bm w}} J$. It should be noted that learning using a discretized version of Eq. (\ref{eq1}) directly corresponds to that using a residual network (ResNet) \cite{Chen2018,Benning2019}. One strategy for finding optimal controls and parameters is to compute the gradients of the loss function, i.e., the direction of the steepest descent, and to update control and parameter vectors in an iterative manner, i.e, ${\bm u}(t) \rightarrow {\bm u}(t) + \delta {\bm u}(t)$ and $\mbox{\boldmath $\omega$} \rightarrow \mbox{\boldmath $\omega$} + \delta \mbox{\boldmath $\omega$}$, respectively. In a simple gradient descent method, $\delta {\bm u}(t)$ and $\delta \mbox{\boldmath $\omega$}$ are chosen such that the largest local decrease of $J$ is obtained. $\delta \mbox{\boldmath $\omega$}$ is simply selected in the opposite direction of the gradient $\pdev{J}{\mbox{\boldmath $\omega$}}{}$, e.g., $\delta \mbox{\boldmath $\omega$} = -\alpha_{\omega}\pdev{J}{\mbox{\boldmath $\omega$}}{} = -\alpha_{\omega}\sum_k(\pdel{\Psi}{{\bm y}_k}{}\pdel{{\bm y}_k}{\mbox{\boldmath $\omega$}}{})$, where $\alpha_{\omega}$ is the learning rate, which is usually a small positive number. $\delta {\bm u}(t)$ is obtained using the adjoint method developed in the context of optimal control problems \cite{Kirk2004,Sage1977} as follows: \begin{align} \delta{\bm u}(t) = -\alpha_{u} \sum_{k=1}^K \left( {\bm p}_{k}^\mathrm{T}(t)\del{\mbox{\boldmath $F$}_{k}}{{\bm u}}{} \right)^\mathrm{T}, \label{eq1-j} \end{align} where $\alpha_u$ is a small positive number, $\mbox{\boldmath $F$}_k = \mbox{\boldmath $F$}[{\bm r}_k(t),{\bm u}(t)]$ and ${\bm r}_k(t) = {\bm r}(t,{\bm x}_k)$. ${\bm p}_{k}(t) \in {\mathbb R}^M$ is the adjoint state vector that satisfies the end condition at $t = T$, ${\bm p}_{k}(T) = \pdel{\Psi[{\bm t}_k,{\bm y}_k(\mbox{\boldmath $\omega$},{\bm r}_k)]}{{\bm r}_k}{}|_{t = T}$. For $0 \le t < T$, the time evolution of ${\bm p}_{k}(t)$ is given by \begin{align} \dev{{\bm p}_{k}^\mathrm{T}(t)}{t}{} = - {\bm p}_{k}^\mathrm{T} (t)\del{\mbox{\boldmath $F$}_{k}}{{\bm r}_{k}}{}. \label{eq1-p} \end{align} The derivation of Eqs. (\ref{eq1-j}) and (\ref{eq1-p}) is shown in Appendix \ref{app1}. We note that integrating Eq. (\ref{eq1-p}) in the backward direction (from $t=T$ to $t=0$) corresponds to backpropagation in neural networks. In summary, the algorithm for computing optimal ${\bm u}^*$ and $\mbox{\boldmath $\omega$}^*$ is as follows:\\ \noindent (i) Set the input, ${\bm x}_k$, for the $k$th data instance as an initial state, i.e., ${\bm r}(0) = {\bm x}_k$.\\ \noindent (ii) Forward propagation: Starting from initial state ${\bm x}_k$, integrate Eq. (\ref{eq1}) and obtain the end state, ${\bm r}_k(T) = {\bm r}(T,{\bm x}_k)$. Then, compute the output, ${\bm y}_k = {\bm y}[{\bm r}_k(T),\mbox{\boldmath $\omega$}]$. \\ \noindent (iii) Repeat the forward propagation for all data instances and compute loss function $J$. \\ \noindent (iv) Backpropagation: Integrate adjoint Eq. (\ref{eq1-p}) for ${\bm p}_{k}(t)$ in the backward direction from $t = T$ with ${\bm p}_{k}(T) = \pdel{\Psi}{{\bm r}_{k}(T)}{}$. \\ \noindent (v) Compute $\delta\mbox{\boldmath $\omega$}$ and $\delta{\bm u}(t)|_{0 < t < T}$ using Eq. (\ref{eq1-j}) with appropriate learning rates, $\alpha_{\omega}$ and $\alpha_{u}$.\\ \noindent (vi) Update control signal ${\bm u}(t)$ and parameter $\mbox{\boldmath $\omega$}$. For the updates, one can use different optimization algorithms \cite{Ruder2016}. \begin{figure}[htbp] \centering\includegraphics[width=7.5cm]{figure1.eps} \caption{\label{fig_ds} Schematics of (a) multilayer neural network and (b) dynamical system. In (b), the output, ${\bm y}_k = (y_{0,k},y_{1,k},\cdots,y_{L-1,k})^\mathrm{T}$, is given by the end state ${\bm r}(T)$ and weight parameter $\mbox{\boldmath $\omega$}$. ${\bm u}(t)$ and $\mbox{\boldmath $\omega$}$ can be updated using a gradient-based optimization algorithm. } \end{figure} \subsection{Binary classification problem \label{sec_ode}} Here, we use an abstract dynamical system for solving a typical fundamental problem, the binary classification problem. The goal of the binary classification is to classify a given dataset into two categories labeled as, for example, ``0'' or ``1''. For this, we here consider a simple dynamical model, $\dot{{\bm r}} = \tanh[{\bm a}(t){\bm r}+{\bm b}(t)]$, where the state vector is two-dimensional, ${\bm r} =(\xi,\eta)^\mathrm{T}$. Weight ${\bm a}(t) \in {\mathbb R}^{2\times 2}$ and bias ${\bm b}(t) \in {\mathbb R}^2$ are used as control signals. We apply this model to the binary classification problem for a spiral dataset, $\{{\bm x}_k,c_k\}_{k=1}^K$, where ${\bm x}_k \in {\mathbb R}^2$ is distributed around one of two spirals in the $\xi\eta$-plane, as shown in Fig.~\ref{fig_ode1}(a), and ${\bm x}_k$ is labeled by $c_k$ as ``0'' or ``1'' according to the classes. For the classification, we used one-hot encoding, i.e., target ${\bm t}_k$ corresponding to input ${\bm x}_k$ was set as ${\bm t}_k = (t_{0,k},t_{1,k})^\mathrm{T} = (1,0)^\mathrm{T}$ if $c_k = 0$ and ${\bm t}_k = (0,1)^\mathrm{T}$ if $c_k = 1$. For the output, ${\bm y}_k = (y_{0,k},y_{1,k})^\mathrm{T}$, the softmax function was used: $y_{l,k}= \exp(z_{l,k})/\sum_l\exp(z_{l,k})$, where $z_{l,k} = \mbox{\boldmath $\omega$}_l^\mathrm{T}{\bm r}_k(T) + \omega^{bias}_{l}$, $\mbox{\boldmath $\omega$}_l \in {\mathbb R}^2$, and $\omega^{bias}_{l} \in {\mathbb R}$. If $z_{0,k} \gg z_{1,k}$, ${\bm y}_k$ approaches $(1,0)^\mathrm{T}$, whereas if $z_{0,k} \ll z_{1,k}$, ${\bm y}_k$ approaches $(0,1)^\mathrm{T}$. $J$ was selected as a cross-entropy loss function, $J = -1/K\sum_{k=1}^K \sum_{l=0}^1t_{l,k}\ln y_{l,k}$. A training set of $K = 1000$ data points was used to train ${\bm u}(t)=\{{\bm a}(t),{\bm b}(t)\}$ and $\mbox{\boldmath $\omega$} = \{\mbox{\boldmath $\omega$}_l,\omega^{bias}_{l}\}_{l=0,1}$. The classification accuracy was evaluated using a test set of $1000$ data points. For the gradient-based optimization, we used the Adam optimizer \cite{Kingma2014} with a batch size of $K$. Figures \ref{fig_ode1}(b) and \ref{fig_ode1}(c) show the learning curve and classification accuracy for the training and test datasets, respectively. The loss function monotonically decreases, and the classification accuracy approaches 100 $\%$. For sufficient training over 300 training epochs, the classification accuracy was over 99 $\%$ when end time $T$ is set as $200\Delta t$, where $\Delta t \approx 0.01$ is the time step used in the simulation. Figure \ref{fig_ode2} shows the time evolution of the two distributions constituting the spiral dataset. During the evolution, the distributions of the initial states are disentangled [Figs.~\ref{fig_ode2}(a-d)] and become linearly separable at end time $T$ [Fig.~\ref{fig_ode2}(d)] to aid the classification at the softmax output layer. As a result, any input state can be classified into either of two classes [Fig.~\ref{fig_ode2}(e)]. We note that the classification based on disentanglement is different from that of other schemes utilizing dynamical systems, e.g., reservoir computing, whose classification is based on the mapping of input information onto a high-dimensional feature space \cite{Tanaka2019}. In addition, we note that the disentanglement is facilitated as end time $T$ increases, i.e., the number of layers increases, and high classification accuracy is achieved for $T \le 400\Delta t$, as shown in Fig. \ref{fig_ode2}(f). A slight decrease in classification accuracy at $T = 600 \Delta t$ is attributed to slowdown of the training due to a local plateau of loss function $J$, which is occasionally caused in a non-convex optimization problem \cite{Dauphin2014}. At $T =600\Delta t$, we confirmed that a classification accuracy of over 99 $\%$ was obtained when the number of training epochs is extended to 400. \begin{figure}[htbp] \centering\includegraphics[width=8.8cm]{figure2.eps} \caption{\label{fig_ode1} (a) Spiral dataset for binary classification. The dataset consists of the two data groups labeled as ``0'' or ``1'', colored purple or green, respectively. (b) Loss function $J$ and (c) classification accuracy as a function of the training (test) epoch. } \end{figure} \begin{figure}[htbp] \centering\includegraphics[width=8.8cm]{figure3.eps} \caption{\label{fig_ode2} (a--d) Configuration of the states constituting the two spirals over the time evolution in the trained system up to the end time $T=200\Delta t$. $t/\Delta t$ effectively represents the number of layers from the viewpoint of a neural network. The initial spiral distribution is disentangled according to the time evolution (layer-to-layer propagation) and becomes linearly separable at end time $t = T$. In (d), the dotted line represents the decision boundary for separating the two distributions. (e) Result of binary classification. The inputs can be classified into two regions indicated by pink and blue colors. (f) Classification accuracy for a test dataset as a function of end time $T$. } \end{figure} \section{Physical implementation in delay systems} In the previous section, we showed binary classification based on optimal control in a two-dimensional dynamical model, where weight ${\bm a}(t) \in {\mathbb R}^{2\times 2}$ and bias ${\bm b}(t) \in {\mathbb R}^2$ were used as control signals. The excellent performance of this demonstration suggests the realization of deep learning in various physical systems, such as coupled oscillators, fluids, and elastic bodies. However, for processing high-dimensional data, a number of signals must be used to control the high-dimensional degrees of freedom in the systems; this may be difficult in terms of physical implementation in an actual system. To overcome the difficulty, we propose the use of delay systems to achieve feasible optimal control of numerous degrees of freedom with limited control signals. It is known that delay systems can be regarded as infinite-dimensional dynamical systems, as visualized in a time--space representation \cite{Arecchi1992}. Furthermore, delay systems can support numerous virtual neurons using a time-division multiplexing method \cite{Appeltant2011}. In addition, they can exhibit various dynamical phenomena, including stable motion, periodic motion, and high dimensional chaos, with experimentally controllable parameters, e.g., delay time and feedback strength \cite{Uchida,Soriano2013}. Thus, their high expressivity as well as controllability are promising. \subsection{Learning by optimal control in a delay system \label{sec_delay}} We introduce a training method based on the optimal control of a delay system, the time evolution of which is governed by the following equation: \begin{align} \dev{{\bm r}(t)}{t}{} = \mbox{\boldmath $F$}\left[{\bm r}(t),{\bm r}({t-\tau}),{\bm u}(t) \right], \label{delay-eq} \end{align} where ${\bm r}(t) \in {\mathbb R}^{M_r}$ and ${\bm u}(t) \in {\mathbb R}^{M_u}$ represent the state vector and control signal vector at time $t$, respectively, and $\tau$ is the delay time. The aforementioned equation can be integrated by setting ${\bm r}(t)$ for $-\tau \le t \le 0$ as an initial condition. The information dynamics can intuitively be interpreted by a space--time representation \cite{Arecchi1992} based on the time discretization of Eq. (\ref{delay-eq}), ${\bm r}_{n}^{j+1} = {\bm r}_n^j +\Delta t\mbox{\boldmath $F$}({\bm r}_n^j,{\bm r}_{n-1}^j,{\bm u}_n^j)$, where $t = n\tau + j\Delta t$, ${\bm r}_n^j = {\bm r}(n\tau + j\Delta t)$, $n \in \{-1,0,1,\cdots, N-1\}$, $j \in \{0,1,\cdots, M_{\tau}-1\}$, and $M_{\tau} = \tau/\Delta t$. In this representation, ${\bm r}_n^j$ can be regarded as the $j$th network node in the $n$th layer, which is affected by an adjacent node, ${\bm r}_n^{j-1}$, and node ${\bm r}_{n-1}^j$ in the $(n-1)$th layer, as shown in Fig. \ref{fig_dn}. Feedforward propagation is carried out as follows: First, an input, ${\bm x}_{k} = (x_{1,k},\cdots,x_{M,k})^\mathrm{T}$, is encoded as ${\bm r}_{-1}^{j} = {\bm r}_{-1}^j({\bm x}_{k})$ for $j \in \{0,1,\cdots, M_{\tau}\}$ in the initial condition. Then, Eq. (\ref{delay-eq}) is numerically solved to obtain ${\bm r}_{N-1}^j$ in the $(N-1)$th layer (corresponding to $\{{\bm r}_k(t)\}_{T-\tau \le t < T}$ in continuous time). The output, ${\bm y}_k \in {\mathbb R}^L$, is computed using the nodes in the $(N-1)$th layer, $\{{\bm r}_{N-1}^j\}_{j=0}^{M_\tau-1}$, as shown in Fig. \ref{fig_dn}. In the continuous time representation, the output is defined as ${\bm y}_k = {\bm y}\left( {\bm z}_{k} \right) $, where ${\bm z}_{k} = \int_{T-\tau}^T\mbox{\boldmath $\omega$}(t) {\bm r}_{k}(t)dt + {\bm b}$. $\mbox{\boldmath $\omega$}(t) \in {\mathbb R}^{L\times M_{r}}$ and ${\bm b} \in {\mathbb R}^L$ are the weight and bias parameters to be trained, respectively, and ${\bm r}_k(t)$ is the state vector starting from the initial state $\{{\bm r}(t,{\bm x}_k)\}_{-\tau \le t \le 0}$. Finally, loss function $J$ [Eq. (\ref{cost-eq1})] is computed. To minimize loss function $J$, a gradient-based optimization is used, where ${\bm u}(t)$, $\mbox{\boldmath $\omega$}(t)$, ${\bm b}$ are updated in an iterative manner. In a gradient descent method, the update variations, $\delta{\bm u}(t)$, $\delta\mbox{\boldmath $\omega$}(t)$, and $\delta{\bm b}$, can be chosen as follows: \begin{align} \delta{\bm u}(t) = -\alpha_{u}\sum_{k=1}^K \left( {\bm p}_{k}^\mathrm{T}(t)\del{\mbox{\boldmath $F$}_{k}}{{\bm u}}{} \right)^T, \label{update-delayeq1} \end{align} \begin{align} \delta\mbox{\boldmath $\omega$} = -\alpha_{\omega} \sum_{k=1}^K \left( {\bm r}_k \del{\Psi}{{\bm z}_{k}}{} \right)^\mathrm{T}, \hspace{1mm} \delta{\bm b}_l = -\alpha_{b} \sum_{k=1}^K \left( \del{\Psi}{{\bm z}_{k}}{} \right)^\mathrm{T}. \end{align} The details of these derivations are provided in Appendix~\ref{app2}. In the aforementioned equations, $\mbox{\boldmath $F$}_{k} = \mbox{\boldmath $F$}[{\bm r}_{k}(t),{\bm r}_{k}(t-\tau), {\bm u}(t)]$, $\Psi = \Psi({\bm t}_k,{\bm y}({\bm z}_k))$ is a function of ${\bm z}_k$, and $\alpha_{i}$ for $i \in \{u,\omega,b\}$ is the learning rate which is a small positive number. In Eq. (\ref{update-delayeq1}), ${\bm p}_{k}(t)$ is the adjoint state vector, which satisfies ${\bm p}_k(T)=0$. ${\bm p}_k(t)$ can be obtained by solving the following adjoint equations in the backward direction, \begin{align} \del{{\bm p}_{k}^\mathrm{T} (t)}{t}{} = -\del{\Psi}{{\bm z}_{k}}{}\mbox{\boldmath $\omega$}(t) - {\bm p}_{k}^{\mathrm{T}}(t) \dfrac{\partial \mbox{\boldmath $F$}_{k}}{\partial {\bm r}_{k}}, \label{delay-eqp1} \end{align} for $T-\tau \le t < T$, and \begin{align} \dev{{\bm p}_{k}^\mathrm{T} (t)}{t}{} = -{\bm p}^\mathrm{T} (t) \dfrac{\partial \mbox{\boldmath $F$}_{k}}{\partial {\bm r}_{k}} -{\bm p}_{k}^\mathrm{T} (t+\tau) \dfrac{\partial \mbox{\boldmath $F$}_{k}(t+\tau)}{\partial {\bm r}_{k}}, \label{delay-eqp2} \end{align} for $0 \le t < T-\tau$. \begin{figure}[htbp] \centering\includegraphics[width=8cm]{figure4.eps} \caption{\label{fig_dn} Schematic of virtual network of a delay system.} \end{figure} \subsection{Optoelectronic delay system} As an effective and feasible example, we consider the use of an optoelectronic delay system, as shown in Fig.~\ref{fig_delaysys}. The delay system is composed of a laser, optoelectronic intensity modulator, photodetector, and electrical filter to construct a time-delay feedback loop. The time evolution of the system state, ${\bm r}(t) = (\xi(t),\eta(t))^\mathrm{T}$, is given by the following equations \cite{Murphy2010}: \begin{align} \tau_L\dfrac{d\xi}{dt} = -\left( 1 + \dfrac{\tau_L}{\tau_H} \right)\xi - \eta + \beta \cos^2 \left[ u_1(t)\xi(t-\tau) +u_2(t) \right], \label{eq-optdelay1} \end{align} \begin{align} \tau_H\dfrac{d\eta}{dt} = \xi, \label{eq-optdelay2} \end{align} where $\xi(t)$ is the normalized voltage, and $\tau_H$ and $\tau_L$ are the time constants of the low-pass and high-pass filters, respectively. $\beta$ represents the feedback strength. $u_1(t)$ and $u_2(t)$ are electronic signals added to the feedback loop, which are used as control signals in the system. \begin{figure}[htbp] \centering\includegraphics[width=8cm]{figure5.eps} \caption{\label{fig_delaysys} Schematic of optoelectronic delay system. MZM, Mach--Zehnder modulator; Delay line, optical fiber delay line; PD, photodetector; Amp, electric amplifier; Filter, a two-pole band-pass filter (consisting of low-pass and high-pass filters). } \end{figure} \subsection{Results} \subsubsection{Binary classification} We demonstrate binary classification for a spiral dataset, as shown in Fig.~\ref{fig_ode1}(a), with the aforementioned optoelectronic delay system. The goal of binary classification is to classify two categories labeled as ``0'' or ``1'' for the spiral dataset, $\{{\bm x}_k, c_k\}_{k=1}^K$. In the same manner as that described in Sec. \ref{sec_ode}, target ${\bm t}_k$ is set as ${\bm t}_k = (1,0)^\mathrm{T}$ if $c_k = 0$, whereas ${\bm t}_k = (0,1)^\mathrm{T}$ if $c_k =1$. Output $y_{l,k}$ is set as the softmax function, i.e., $y_{l,k} = \exp{z_{l,k}}/\sum_{l^{'}}\exp{z_{l^{'},k}}$, where $z_{l,k} = \int_{T-\tau}^T \omega_l(t)\xi_k(t) dt + b_l$, $\omega_l(t) \in {\mathbb R}$ and $b_l \in {\mathbb R}$. Then, $J$ is defined as the cross-entropy loss function, $-1/K\sum_{k=1}^K\sum_{l=0}^{L-1}t_{l,k}\log{y_{l,k}}$. In this simulation, the following parameters settings were applied: $\tau_H = 1.59$ ms, $\tau_L = 15.9$ $\mu$s, and $\tau = 230$ $\mu$s. The input, ${\bm x}_k = (x_{1,k},x_{2,k})^\mathrm{T}$, is encoded as the initial state of $\xi$, i.e., $\xi_k(t) = x_{1,k}$ for $-\tau \le t < -\tau/2$ and $\xi_k(t) = x_{2,k}$ for $-\tau/2 \le t \le 0$. We set $u_1(t) = 1.0$ and $u_2(t) = -\pi/4$ as the initial control signals and $\omega_l(t) = 0$ and $b_l = 0$ ($l \in \{0, 1\}$) as the initial weight and bias parameters. We used the Adam optimizer \cite{Kingma2014} with a batch size of $K$ for the gradient-based optimization. The update equations for $u_1(t)$, $u_2(t)$, $\omega_l$, and $b_l$ are shown in Appendix~\ref{sec_app2-2}. In the aforementioned conditions, the classification accuracy at training epoch 100 was 99.1$\%$ when the feedback strength was $\beta = 3.0$ and the end time was $T = 5\tau$. To gain insight into the classification mechanism, we investigated the effect of the control signals, $u_1(t)$ and $u_2(t)$, and weights, $\omega_l(t)$, $l \in \{0,1\}$, on the delay dynamics. Figures~\ref{fig_dbr1}(a--e) show the trained control signals, $u_1(t)$ and $u_2(t)$, weights, $\omega_0(t)$ and $\omega_1(t)$, and four instances of $\xi_k(t)$ at training epoch 100. $\xi_k(t)$ in a range of $T-\tau \le t \le T$ is used for computing the (softmax) outputs, $y_{l,k}$, which represents the probability that the input ${\bm x}_k$ is classified as class $l \in \{0,1\}$. Considering that $y_{l,k}$ is a function of $z_{l,k} = \int_{T-\tau}^T\omega_l\xi_k(t)dt + b_l$, we computed $\tilde{z}_{l,k_{l'}} = \int_{T-\tau}^T\omega_l(t)\xi_{k_{l'}}(t) dt$. $\tilde{z}_{l,k_{l'}}$ corresponds to the correlation between (softmax) weights $\omega_l(t)$ used for the classification as class $l$ and the $k_{l'}$th instance, $\xi_{k_{l'}}(t)$, which starts from the initial states labeled as $l' \in \{0,1\}$. Figures~\ref{fig_dbr1}(f) and \ref{fig_dbr1}(g) show the histograms of the correlation values, $\tilde{z}_{l,k_{l'}}$, for 500 instances. The correlation values are positive for $l = l'$ in most cases, whereas they are negative for $l \ne l'$. In other words, $\tilde{z}_{l,k_{l}} > \tilde{z}_{l,k_{l'}} (l \ne l')$ in most cases. Thus, the softmax output $y_{l,k_{l}}$ for classification as $l$ is activated by $\xi_{k_l}(t)$ starting from the initial states with the same class $l$. These results reveal that the trained control signals control each trajectory such that it is positively correlated to the weight $\omega_l(t)$ and $y_{l,k_l}$ is maximized. Figure \ref{fig_dbr2} shows the classification accuracy at training epoch 100 as a function of feedback strength $\beta$ and end time $T/\tau$. As seen in this figure, classification performance is low for $\beta < 2.0$. In this regime, the system exhibits transient behavior to stable limit cycle motion, which is insensitive to external perturbations [Figs.~\ref{fig_dbr3}(a) and \ref{fig_dbr3}(b)]. This means that it is difficult to control the system. When $\beta$ increases ($\beta > 2.5$), the system starts to exhibit complex behavior and becomes sensitive to the control signals for a large end time, $T$, as shown in Figs. \ref{fig_dbr3}(c) - \ref{fig_dbr3}(f). Sensitivity plays a role in aiding the classification. However, extremely high sensitivity makes it difficult to control the system and decreases classification performance, as observed for $\beta > 4.0$ and $T > 7.0\tau$ in Fig.~\ref{fig_dbr2}. Consequently, a high classification performance of over 99$\%$ is achieved with moderate values of $T$ and $\beta$, suggesting that the transient behavior around the edge of chaos plays a crucial role in classification. \begin{figure}[htbp] \centering\includegraphics[width=8.8cm]{figure6.eps} \caption{\label{fig_dbr1} (a,b) Control signals, $u_1(t)$ and $u_2(t)$ at training epoch 100. (c,d) Weight parameters, $\omega_0(t)$ and $\omega_1(t)$, at training epoch 100. (e) Four instances of $\xi_k(t)$ starting from different initial states labeled as ``0'' or ``1'', which are within a distance $|{\bm x}_k-{\bm x}_{k^{'}}| < 0.1$. The end time is set as $T = 5\tau$. $\xi_k(t)$ for $4\tau \le t < 5\tau$ (indicated by light yellow color) is used to obtain $z_{l,k} = \int_{T-\tau}^T\omega_l(t)\xi_k(t)dt + b_l$. (f,g) Histograms of correlation values, $\tilde{z}_{l,k_{l'}}$, between softmax weights, $\omega_l(t)$, and the $k_{l'}$-th instance, $\xi_{k_{l'}}$. } \end{figure} \begin{figure}[htbp] \centering\includegraphics[width=8.8cm]{figure7.eps} \caption{\label{fig_dbr2} Classification accuracy as a function of feedback strength $\beta$ and end time $T$. } \end{figure} \begin{figure}[htbp] \centering\includegraphics[width=8.8cm]{figure8.eps} \caption{\label{fig_dbr3} Typical examples of $\xi_k(t)$ starting from an initial state at training epochs 0 and 100 for various values of $\beta$ and $T$. } \end{figure} \subsubsection{MNIST handwritten digit classification} To investigate the classification performance for a higher dimensional dataset, we use the MNIST handwritten digit dataset, commonly used as a standard benchmark for learning \cite{MNIST,LeCun1998}. The dataset has a training set of 60,000 28$\times$28 pixel grayscale images of ten handwritten digits, along with a test set of 10,000 images. To set an initial state of the system state, an input image of $28\times 28$ pixels is enlarged to double its length and width; it is transformed to a $m$-dimensional vector, where $m = (28\times 2)^2$. The vector components are sequentially set as $\xi_k(t_j)$ at time $t_j = -\tau + j\Delta t$ with a time interval of $\Delta t = \tau/M_{\tau} \approx 0.07$ $\mu$s. The input process is repeated $M_{\tau}/m$-times to encode the information of the input image as $\xi_k(t_j)$ for all $j \in \{0,1,\cdots,M_{\tau}\}$. The training of the delay system is based on the gradient-based optimization using the Adam optimizer with a batch size of 100. The maximum number of epochs to train was set as 50 to ensure the convergence of the training process. As a demonstration of the classifications at epoch 50, we show four examples of the softmax outputs, which represents the probability that the input image belongs to one of the 10-classes, in Figs. \ref{fig_dmr}(a)--(d). Figures \ref{fig_dmr}(e) and \ref{fig_dmr}(f) show the classification accuracy for various values of feedback strength $\beta$ and delay time $\tau$, where $T/\tau = 3$ is fixed. For this image dataset, the delay system with $\beta = 3.0$ exhibits relatively high classification performance. The best classification accuracy for this system is 97 $\%$. We emphasize that accurate classification is achieved with two training signals, $u_1(t), u_2(t)$, and minimal weight parameters, $\omega_l(t)$, and $b_l$, $l \in \{0,1,\cdots,9\}$, owing to the time-division multiplexing encoding method based on the delay structure, as discussed in Sec. \ref{sec_delay}. This is in contrast to conventional neural networks, where more than hundreds or thousands of weight parameters need to be trained. We can see that classification accuracy improves as delay time $\tau$ increases [Fig.\ref{fig_dmr}(f)]. As discussed in Sec. \ref{sec_delay}, the effective number of the network nodes, $M_{\tau}$, depends on $\tau$ in the delay system, i.e., $M_{\tau} \approx \tau/\Delta t$. This suggests that larger-scale networks, i.e., systems with a longer delay, play an important role in achieving better classification for this large dataset. \begin{figure}[htbp] \centering\includegraphics[width=8.8cm]{figure9.eps} \caption{\label{fig_dmr} (a-d) Examples of softmax outputs, $\{y_{l,k}\}_{l=0}^9$, for the MNIST handwritten images. Each inset shows the input handwritten image corresponding to (a) ``$2$'', (b) ``$3$'', (c) ``$7$'', and (d) ``$9$''. The softmax output, $y_{l,k}$, represents the probability that the input image $k$ belongs to class $l$. In (a--d), $\beta = 3.0$, $\tau = 1610$ $\mu$s, and $T = 3\tau$. (e--f) Classification accuracy for the MNIST dataset (10,000 test images) as a function of (e) feedback strength $\beta$ and (f) delay time $\tau$ in the delay system. In (e), $\tau = 3220$ $\mu$s and $T = 3\tau$. In (f), $\beta = 3.0$ and $T = 3\tau$. } \end{figure} \section{Conclusion} We discussed the applicability of optimally-controlled dynamical systems to information processing. The dynamics-based processing provides insight into the mechanism of information processing based on deep network structures, and it can be easily implemented in physical systems. As a particular example, we introduced an optoelectronic delay system. The delay system can be trained to perform nonlinear classification and image recognition with only a few control signals and classification weights based on the time-division multiplexing method. This feature of delay systems is an advantage to hardware implementation of the systems and is distinctively different from conventional neural networks, which require a large number of training parameters. The dynamics-based processing based on optimal control can be applied to various physical systems to construct not only feedforward networks but also recurrent neural networks, including reservoir computing. This provides a novel direction for physics-based computing. \begin{acknowledgements} This work was supported, in part, by JSPS KAKENHI (Grant No. 20H042655) and JST PRESTO (Grant No. JPMJPR19M4). The authors thank Profs. Kazutaka Kanno and Atsushi Uchida for valuable discussions on optoelectronic delay systems. \end{acknowledgements}
{'timestamp': '2021-04-02T02:18:32', 'yymm': '2012', 'arxiv_id': '2012.08761', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08761'}
arxiv
\section{Introduction} \subsection{Mobile Edge Computing} \label{MEC} The exponential growth in smart device adoption is accelerating the ubiquitous Internet of Things (IoT) \cite{7488250, 7786106}, and catalyzing the development of computation-intensive applications, including augmented reality (AR), face recognition, interactive online gaming, and autonomous driving. However, a computationally tedious task is unlikely to be executed at the local mobile device due to its resource constraint. Instead, such tasks can be offloaded to the remote cloud with abundant computation, storage, and energy resources \cite{5445167, zhang2010cloud, 6897914}. Despite the computational efficiency, the long communication distance between smart devices and the remote cloud inevitably introduces a high transmission latency, resulting in an unsatisfactory user quality of experience (QoE), especially for numerous real-time delay-sensitive applications. To enable computationally intensive applications with sensitive delay requirements, mobile edge computing (MEC) \cite{hu2015mobile, 7901477, 7883826} has recently emerged as a promising paradigm. Compared with its cloud counterpart, MEC pushes the computing and storage capability to the network edge that is much closer to devices. As a result, a device can offload its tasks to a proximal MEC server at a base station (BS) or access point (AP), and then collect the subsequent results from the MEC server. This generates the benefits of low latency and reduced mobile device energy consumption. Essentially, task offloading involves joint radio-and-computation resource allocation among multiple users. A variety of specific task offloading policies have been designed in recent years. Most of them are focused on small-scale synchronous MEC systems, where tasks for a limited number of different users arrive simultaneously. In this context, the computational resources are relatively abundant, and the policy design was usually formulated as a static centralized optimization problem, where the energy consumption and latency serve as the principal performance indicators \cite{7227025, 8327930, 8611399}. For example, to minimize the weighted sum of energy consumption and end-to-end delay, the authors in~\cite{7227025} formulated the task offloading problem into a non-convex quadratically constrained quadratic program (QCQP), and semi-definite relaxation and randomization mapping based algorithms were proposed to achieve a near-optimal offloading performance. A joint radio and computational resource allocation scheme was investigated in \cite{8327930}, and the offloading was formulated as a mixed-integer nonlinear programming problem (MINLP). A game theory-based approach was proposed to handle this problem. Recently, the offloading problem was formulated in~\cite{8611399} as a nonconvex optimization one, which aimed to maximize the weighted sum computation efficiency by imposing the constraints on local computation capability and energy resources. \subsection{Task Offloading for Large-Scale Asynchronous MEC} A wide range of emerging massive machine type communication applications, such as industrial automation, and smart transportation~\cite{6774858}, introduce the concept of large-scale asynchronous MEC systems. Typically, these applications involve a variety of tasks each with its own execution deadline. Furthermore, task arrival patterns for a massive number of users exhibit notable stochasticity, featured by random and asynchronous task arrivals, distinct workloads, and diverse deadlines (see Fig.~\ref{fig: system state}). Due to the deadline constraints on tasks and limited computational resources (with respect to a massive number of users), task offloading policy design for large-scale asynchronous MEC systems becomes extremely challenging. Task offloading policy should focus on the user selection and be implemented on a dynamic and real-time basis, considering both the task criticality and energy consumption. To the best of our knowledge, the offloading policy design in a large-scale asynchronous MEC system is still an open challenge. \textcolor{black}{ In this paper, we aim to address this challenge and propose an index-based task offloading policy. To adapt to the dynamic nature of task arrivals, we deviate from the classical static centralized optimization techniques with hard constraints, and turn to the bandit theory to capture the stochastic behavior in tasks. We formulate the offloading policy design as a restless multi-armed bandit (RMAB) problem. Mathematically, MAB is a sequential decision model with a set of arms to choose from for the total reward maximization~\cite{5398950, 6035799, whittle1988restless}. At each round, only a subset of arms can be selected and their states will change, while the others remain frozen. Removing such restrictions in the MAB, the RMAB allows the states of all arms to evolve over time regardless of the actions. In our setting, we treat each user as an independent restless arm, and the arm state is represented by user task criticality including the remaining number of subtasks and remaining time to deadline. We then design a reward function to strike a promising balance between two conflicting goals, i.e., minimizing the energy consumption and maximizing the task completion ratio. In this case, ``playing" an arm at each time slot is equivalent to selecting a user to offload its tasks. } Our goal is to maximize the total discounted reward over the time horizon for the formulated RMAB, resulting in a new task offloading policy. However, the RMAB is generally PSPACE-hard and intractable~\cite{papadimitriou1999complexity}. To address this issue, we develop a novel method based on Whittle index (WI)~\cite{whittle1988restless}, so that multiple arms can be decoupled and the original $N$-dimensional problem reduces to $N$ independent $1$-dimensional ones. The key advantage of our WI offloading policy lies in its excellent scalability and low computational complexity, enabling fast user selection in task offloading. At each time slot, each user only needs to separately calculate its scalar WI in closed form which provides a proxy to measure its task criticality. Each user then reports its WI to the BS, and the users with the highest indices are selected for task offloading. Besides, the WI policy can be implemented in a totally distributed manner. Specifically, we first consider the scenario where the perfect knowledge of the user offloading energy consumption is available at users. We exploit the WI theory and rigorously establish the indexability of the RMAB through the inductive method, which theoretically guarantees the existence of WI for our RMAB. On this basis, we derive a closed-form expression in terms of the task state and energy consumption for the WI computation. Furthermore, when the task completion ratio becomes the focus, the shorter slack time less remaining workload (STLW) priority rule is introduced into the WI offloading policy for performance improvement, referred to as STLW-WI policy. On the other hand, when the knowledge of user offloading energy consumption is not available prior to the offloading, the WI policy can not be directly applicable. To address this challenge, we develop Bayesian learning-enabled WI policies. In specific, we first integrate the WI policy with the maximum likelihood estimation (MLE) technique. Then, to further improve the performance, we propose a novel Bayesian learning with WI policy (BL-WI) given the conjugate prior. Finally, a refinement mechanism (PSBL-WI) based on prior-swapping is proposed for a fast inference given the non-conjugate prior. It is verified by simulation that the proposed WI policy can achieve much better performance in terms of the total discounted reward, compared with several existing offloading policies. For the completion ratio-oriented task offloading, our STLW-WI policy achieves a higher task completion ratio. When the user offloading energy consumption is unknown, our Bayesian learning-enabled WI policy can also achieve a favorable performance compared to the original WI policy. \color{black} \subsection{Contribution} The main contributions of this paper can be summarized as follows. \begin{itemize} \item We develop an RMAB framework to enable task offloading for large-scale asynchronous MEC in a realistic setting. We propose a novel WI offloading policy through establishing the WI indexability and deriving a scalable solution with closed-form expression. When the knowledge of user offloading energy consumption is unknown prior to offloading, novel MLE-WI, BL-WI and PSBL-WI offloading policies from the Bayesian learning perspective are developed. \item The developed WI method offers a potential low-complexity solution to a series of communication/computation resource scheduling problems (e.g., scheduling in a power-aware server farm \cite{5703092}), which typically involves complicated combinatorial optimizations. The developed WI method also addresses a challenging general RMAB problem in a dynamic environment with heterogeneous rewards and non-identical transition probabilities. \end{itemize} \subsection{Related Work} In addition to the work introduced in Section \ref{MEC}, task offloading policy for MEC has been extensively studied in the literature. Two comprehensive surveys on various task offloading policy designs were provided in \cite{8016573, 7879258}. The work in \cite{8638800} designed a new MEC system to satisfy the ultra-reliable low-latency requirements in mission-critical applications. Specifically, a two-timescale association between user and server was proposed by utilizing the Lyapunov optimization and matching theory. For both time division multiple access (TDMA) and orthogonal frequency division multiple access (OFDMA), corresponding offloading policies have been developed in \cite{7762913}, aiming to minimize the user weighted sum energy consumption given the constraints of the user average latency. As a special case of reinforcement learning \cite{sutton2011reinforcement}, the stateless MAB techniques have been applied to MEC systems \cite{8058414, 8627987, 8790775, 9082866, 8762108, 8887222}. In stateless MAB, the arms do not have any specific state. Each arm, when played, offers an i.i.d random reward drawn from a distribution with an unknown mean. The authors in \cite{8058414} developed an energy-aware mobility management scheme based on MAB to perform MEC selection. In \cite{8627987}, an adaptive learning task offloading policy was proposed for vehicle edge computing based on the MAB theory. In \cite{8790775}, the authors considered an edge service replacement problem, where they applied contextual combinatorial MAB to estimate users' demand based on side information. An MAB online learning algorithm referred to as utility-table learning was proposed in \cite{9082866} to determine the optimal workload balance among MEC servers. In \cite{8762108}, the authors proposed an online task offloading policy based on the non-stationary MAB model, aiming to minimize the long-term total costs including latency, energy consumption and switching cost. Under the MAB framework, a two-stage resource sharing and task offloading strategy were developed in \cite{8887222}. By contrast, the RMAB in this paper can be categorized into the stateful bandit model \cite{7498076}, where every arm is associated with some finite state space and the state evolves as a Markov process. When an arm is selected, the reward is drawn from some stationary distributions based on the current arm state. There are several other works leveraging the WI theory first established in \cite{whittle1988restless}. According to \cite{gittins2011multi, ayesta2019unifying}, the WI solution in \cite{whittle1988restless} does not hold in general, and there is no unified solution that can cover all the RMAB problems. Consequently, the establishment of indexability needs to be studied for the individual problem. For example, the problem formulation in \cite{5605371} suits a restless Bernoulli bandit with a two-state Markov chain, and the establishment of indexability highly depends on the transition probability of wireless channel occupancy. In contrast, the formulation in \cite{8295041} suits an RMAB problem with a static reward and identical state transition probability for each arm. In this paper, we aim to solve a new RMAB problem with heterogeneous rewards and a non-identical transition probability for each arm. \subsection{Organization} The rest of the paper is organized as follows. In Sections \ref{section2} and \ref{sec: RMAB Formulation}, we discuss the MEC system model and formulate the offloading problem as an RMAB, respectively. In Section \ref{sec: WI}, we establish the indexability of the RMAB and develop a WI offloading policy. A Bayesian learning enabled WI offloading policy is proposed in Section \ref{sec: learning}. Simulation results are presented in Section \ref{sec: Numerical Results} followed by conclusions in Section \ref{section 7}. \color{black} \textit{Notation}: $\mathcal{N}(\mu,\Sigma)$ denotes the Gaussian distribution with a mean $\mu$ and a variance $\Sigma$. $\Gamma(\cdot)^{-1}$ denotes the Gamma inverse function. $x^{+} = \max(x,0)$. $\mathbbm{1}(\cdot)$ is the indicator function. $\binom{N}{M}$ denotes the combinations of selecting distinct $M$ items out of $N$. For convenience, we also list most important symbols in Table \uppercase\expandafter{\romannumeral1}. \begin{table*}[t] \renewcommand\arraystretch{2} \centering \caption{TABLE OF SYMBOLS} \begin{tabular}{|c|c|} \hline Variable & Description \\ \hline $\beta$ & the discount factor \\ \hline $B_{i,j}$ & the total number of subtasks for the $i$-th user in the $j$-th task \\ \hline $b_{i,t}$ & the number of unfinished tasks in the $i$-th user at the $t$-th time slot \\ \hline $C_i$ & the number of CPU cycles required to process $1$ bit data by the $i$-th user \\ \hline $\epsilon_i$ & $\epsilon_i \sim \mathcal{N}(0, \Sigma_i)$; the measurement noise with noise variance $\Sigma_i$ \\ \hline $E_{i}^{\text{loc}}$ & the local computing energy consumption by the $i$-th user \\ \hline $E_{i, j}^{\text{off}}$ & the offloading energy consumption by the $i$-th user during the $j$-th task \\ \hline $E_{i, j}^{\text{sav}}$ & $E_{i, j}^{\text{sav}} = k_i E_{i}^{\text{loc}} - E_{i, j}^{\text{off}}$; the energy consumption saving from the offloading for $k_i$ subtasks \\ \hline $e_{i,j}^{\text{sav}}$ & $e_{i,j}^{\text{sav}} = E_{i,j}^{\text{sav}} + \epsilon$; a noisy observation version of the actual energy saving $E_{i,j}^{\text{sav}}$ \\ \hline $\gamma_{i,j}$ & the number of observations for the $i$-th user during $j$-th task \\ \hline $h_{i,j}$ & the channel gain of the $i$-th user during the $j$-th task \\ \hline $k_i$ & the number of subtasks which can be processed by the MEC server in each time slot \\ \hline $\kappa_{i,j}$ & small-scale fading channel power gain for the $i$-th user during $j$-th task \\ \hline $l_{i,t}$ & $l_{i,t} \triangleq \tau_{i,t} - b_{i,t} / k_i$; the slack time of the $i$-th user at the $t$-th time slot \\ \hline $M$ & the number of MEC servers in the system \\ \hline $N$ & the number of users in the system \\ \hline $r_{i,j}$ & the achievable transmission rate of the $i$-th user during $j$-th task \\ \hline $U_i$ & the CPU frequency of the $i$-th user \\ \hline $s_{i,t}$ & $s_{i,t} = \left(\tau_{i,t}, b_{i,t} \right)$; the state of the $i$-th user at the $t$-th time slot \\ \hline $\textbf{S}_t$ & $\textbf{S}_t = \left(s_{1,t}, \cdots, s_{N, t}\right)$; the system state at the $t$-th time slot \\ \hline $t_{i,j}^{d}$ & the deadline of the $i$-th user's $j$-th task \\ \hline $\tau_{i,t}$ & $\tau_{i,t} \triangleq t_{i,j}^{d} - t + 1$; the number of remaining time slots to $t_{i,j}^{d}$ \\ \hline $u_{i,t}$ & $u_{i,t} \in \left\{0, 1\right\}$; the offloading action on the $i$-th user at the $t$-th time slot \\ \hline $\textbf{u}_t$ & $\textbf{u}_t = \left(u_{1,t}, \cdots, u_{N, t}\right)$; the actions taken by the BS for each user at the $t$-th time slot \\ \hline $\omega_i(s_{i,t})$ & the WI of the $i$-th user given its current state $s_{i,t}$ \\ \hline $X_{i,j}(t)$ & $X_{i,j}(t) = \left\{e_{i,j,1}^{\text{sav}}, \cdots, e_{i,j,\gamma_{i,j}}^{\text{sav}}\right\}$ the $i$-th user's energy saving observation set up to the $t$-th time slot \\ \hline \end{tabular}\\ \label{tab:1} \end{table*} \color{black} \section{System Model} \label{section2} \color{black} \subsection{Large-Scale Asynchronous Task Arrival Model} \textcolor{black}{Consider a large-scale asynchronous MEC system consisting of a BS and $N$ static users (indexed by $i \in \left\{1, \cdots, N\right\}$) shown in Fig. \ref{fig: system state}, where $N$ is reasonably large. The system operates in a time-slotted structure, indexed by $t$. The BS is equipped with $M (M < N)$ independent MEC servers, and we assume that each MEC server can serve at most one user at each time slot. Each user is running computation-intensive and delay-sensitive tasks with stochastic arrival patterns to be elaborated later. Each task is relatively large and can be further partitioned into a number of subtasks to be processed sequentially \cite{8663994}. It is assumed that the local computation capability of each user is not powerful enough to complete a task on time. Therefore, a user seeks assistance from the MEC server by offloading some subtasks for faster execution. As we only have $M$ MEC servers (limited computational resources), at most $M$ users can be selected to perform task offloading at each time slot. The number of possible combinations is $\binom{N}{M}$, which is usually extremely huge to handle\footnote{For example, when $M=30$, $N=100$, we have $\binom{N}{M} \approx 3 \times 10^{25}$.}.} \begin{figure}[t] \centering {\includegraphics[width=0.5\textwidth]{Task_Arrival_Pattern}} \caption{A large-scale asynchronous MEC system (left) with an illustrative asynchronous task arrival pattern (right). The area of the shaded rectangular indicates the size of the task $B_{i,j}$.} \label{fig: system state} \end{figure} Next, we specify the asynchronous task arrival pattern with an example shown in Fig.~\ref{fig: system state} (a more detailed example is shown in Fig.~\ref{fig: offloading result}). The task arrival time and its deadline vary for each user. For the $i$-th user, at the $t_{i,j}^{a}$-th time slot, a new task $j$ arrives and reveals the number of subtasks $B_{i,j}$ and the task deadline $t_{i,j}^{d}$. Without loss of generality, a user's subtasks are assumed to have equal size ($l_i$ bits). Upon arrival, the task starts to be processed and will be removed from the user buffer at the end of the $t_{i,j}^{d}$-th time slot. It is worth noting that $t_{i,j}^{a}$, $t_{i,j}^{d}$, and $B_{i,j}$ are discrete random variables. At the beginning of the $t$-th time slot, if the $i$-th user is idle, a new task will arrive with the probability $Q_i$. \subsection{Computation Model} Each user is assumed to be able to locally process one subtask in each time slot. For the $i$-th user, the number of CPU cycles required to process $1$ bit data is denoted by $C_i$, which may be different for various users~\cite{miettinen2010energy}. We denote the CPU frequency of the $i$-th user by $U_i$, then the local execution cycles for one subtask with $l_i$ bits can be calculated by $C_{\text{loc}} = C_i l_i / U_i$. Since the user is usually operating at a constant $U_i$ for the sake of energy efficiency~\cite{burd1996processor, 8606442}, the computing power for each CPU cycle can be calculated as $P_{0,i} = \lambda U_i^2$, where $\lambda$ is a power coefficient depending on the chip architecture~\cite{8606442}. In this case, the local computing energy consumption $E_{\text{loc}, i}$ for the $i$-th user to process one subtask can be calculated as \begin{equation} E_{i}^{\text{loc}} = \lambda U_i C_i l_i. \end{equation} For MEC servers, we assume that their CPU frequency is a constant $U_{s}$. Accordingly, $k_i = \left \lfloor \frac{U_s}{U_i} \right \rfloor$ is the number of subtasks which can be processed in each time slot by an MEC server. That is, if the $i$-th user is selected to perform task offloading, it can transmit $k_{i}$ subtasks to the server. \subsection{Communication Model} Following~\cite{7762913}, the offloading process at each time slot can be divided into three steps: 1) a selected user uploads some subtasks to the MEC server; 2) the MEC server processes the subtasks; 3) the results are transmitted back to the user. As the results are usually of small size~\cite{7563449}, the downloading time and associated energy consumption can be omitted. Therefore, in the whole process, the user offloading energy consumption mainly comes from the uploading phase. As at most $M$ users can be selected at each time slot, we adopt OFDMA scheme for data transmission. For the $i$-th user during the $j$-th task, the achievable transmission rate can be calculated as \begin{equation} r_{i,j} = W_i \log_2\left(1+\frac{P_{i}^{tx} h_{i,j}}{N_0 W_i}\right), \end{equation} where $W_i$ is the bandwidth, $P_{i}^{tx}$ is the transmission power, $N_0 W_i$ is the noise power. In addition, $h_{i,j} = \kappa_{i,j} g_0 (d_0/d_{i,j})^{\iota}$ denotes the channel gain of the $i$-th user~\cite{7956189} with $\kappa_{i,j}$ being the small-scale fading channel power gain. In this paper, we adopt a widely used block fading channel model~\cite{ 8611399, 7541539}, and $\kappa_{i,j}$ keeps constant during the $j$-th task but varies independently from task to task, where $g_0$ is the path-loss constant, $\iota$ is the path-loss exponent, $d_0$ is the reference distance, and $d_{i,j}$ is the transmission distance between the $i$-th user to the BS. Therefore, the required transmission time $t$ for sending $k_i$ subtasks can be calculated as $t_i = (k_i) l_i / r_{i,j} $. We assume that the length of a time slot is relatively large, so that it is always larger than the transmission time $t_i$. As a result, the offloading energy consumption of the $i$-th user during the $j$-th task is calculated as \begin{equation} E_{i, j}^{\text{off}} = t_i P_{i, j}^{tx} = \frac{k_i l_i}{r_{i,j}} P_{i, j}^{tx}. \end{equation} \color{black} We need to consider both the task completion ratio and user's energy consumption under the limited computational resource ($M < N$). At this point, our goal is to strike a promising balance between energy consumption and task completion ratio. Furthermore, the large-scale stochastic task arrivals require the offloading policy to perform user selection dynamically at each time slot with a low computational complexity, which is quite challenging. \section{Restless Multi-armed Bandit Formulation} \label{sec: RMAB Formulation} To address the above challenges, we develop a novel WI policy that enables fast user selection at each time slot, in which offloading priorities are indicated by the value of WI. For the specific implementation, we first formulate the offloading policy design as an RMAB \cite{whittle1988restless} to capture the randomness in tasks arrivals, workload and their deadlines. Essentially, we treat the remaining number of subtasks and remaining time to deadline of each task as the state of an arm. The restless nature of the state naturally follows, because the state will also change even though the user is not selected for offloading. Under this formulation, we also create a new reward function as the performance metric, taking into account both deadline requirements and user offloading energy consumption. In the following subsections, we elaborate on the RMAB with five key factors, including the system state, action, state transition, reward function, and objective function. \subsubsection{System State} For the $i$-th user, its state $s_{i,t}$ is represented by its current $j$-th task state at the beginning of the $t$-th time slot, i.e., $s_{i,t} = (\tau_{i,t}, b_{i,t})$, where $\tau_{i,t} \triangleq t_{i,j}^{d} - t + 1$ is the remaining time slots to the task deadline $t_{i,j}^{d}$, and $b_{i,t}$ is the number of the unfinished subtasks. If there is no task, then $s_{i,t} = (0,0)$. Accordingly, $s_{i,t}$ can be written in a compact form as \begin{equation} s_{i,t} = \begin{cases} (0,0), & \mbox{no task}; \\ (\tau_{i,t}, b_{i,t}), & \mbox{otherwise}. \end{cases} \label{eq:state} \end{equation} Collecting the states of $N$ users, the system state ${\bf{S}}_t$ at the $t$-th time slot is denoted by ${\bf{S}}_t \triangleq \left(s_{1,t}, \cdots, s_{N,t}\right)$. \subsubsection{Action} At the beginning of each time slot, the action taken by the BS determines $M$ users (among $N$) which could offload their subtasks to the MEC. We define the action as ${\bf{u}}_t = \left(u_{1,t}, \ldots, u_{N,t}\right)$, where $u_{i,t}\in \left\{0,1\right\}$. % When $u_{i,t} = 0$, task offloading is not allowed. When $u_{i,t} = 1$, the user will be selected to perform task offloading. \subsubsection{State Transition} As mentioned before, an MEC server can process at most $k_{i}$ subtasks compared to one subtask processed locally at the $i$-th user each time slot. Therefore, if a user can perform task offloading, the remaining number of subtasks will be reduced by $k_{i}$ maximally. If the user is idle at the $t$-th time slot, i.e., $s_{i,t}=(0,0)$ , a new task will arrive with probability $Q_i$ at the $(t+1)$-th time slot. Given the current state $s_{i,t}$ and the action $u_{i,t}$, the next state $s_{i,t+1}$ can be expressed by \begin{itemize} \item If $\tau_{i,t} \ge 2$, \begin{equation} s_{i,t+1}= \begin{cases} \left(\tau_{i,t}-1,(b_{i,t} - k_i)^{+}\right), \hspace{0.5cm} \mbox{if } u_{i,t} = 1; \\ \left(\tau_{i,t}-1,(b_{i,t} - 1)^{+}\right), \hspace{0.65cm} \mbox{if } u_{i,t} = 0; \\ \end{cases} \end{equation} \item If $\tau_{i,t} = 1$, \begin{equation} s_{i,t+1}= \begin{cases} \left(t_{i, j+1}^{d} - t, B_{i, j+1}\right), & \mbox{with Prob. } Q_i \\ (0,0), & \mbox{with Prob. } 1-Q_i; \end{cases} \end{equation} \item If $s_{i,t} = (0,0)$, (assuming the index of the last task is $j$), \begin{equation} s_{i,t+1}= \begin{cases} \left(t_{i, j+1}^{d} - t, B_{i, j+1}\right), & \mbox{with Prob. } Q_i \\ (0,0), & \mbox{with Prob. } 1-Q_i; \end{cases} \end{equation} \end{itemize} where $x^{+} = \max(x,0)$. Note that when $\tau_{i,t} = 1$, the task of the $i$-th user will reach its deadline and be removed from the user at the end of the $t$-th time slot. Then, at the beginning of the $(t+1)$-th time slot, the $j+1$-th task with $B_{i, j+1}$ subtasks and deadline $t_{i,j+1}^{d}$ will arrive with probability $Q_i$. \subsubsection{Reward Function} Here, we create a reward function in \eqref{eq: Reward} to balance the user offloading energy consumption and deadline requirements, \begin{figure*}[t] \begin{equation} \begin{aligned} & R(s_{i,t}, u_{i,t}) \\ & = \begin{cases} E_{i,j}^{\text{sav}}u_{i,t} , &\mbox{if } \tau_{i,t} > 1, b_{i,t} > 0; \\ E_{i,j}^{\text{sav}} u_{i,t} - F\left( \left[b_{i,t}-k_{i}u_{i,t} - (1-u_{i,t})\right]^{+}\right), &\mbox{if } \tau_{i,t} = 1, b_{i,t} > 0; \\ 0, \hspace{5.95cm} &\mbox{otherwise.} \end{cases} \label{eq: Reward} \end{aligned} \end{equation} \hrulefill \end{figure*} where $E_{i,j}^{\text{sav}} = \left(k_i E_{i}^{\text{loc}} - E_{i,j}^{\text{off}} \right)$ is the energy consumption saving from the offloading for the $k_i$ subtasks. The penalty function is denoted by $F(x) = \alpha x^2 $ with $x$ indicating the number of unfinished subtasks, and $\alpha$ is the penalty parameter used to adjust penalty for unfinished tasks. \textcolor{black}{\footnote{The penalty function is widely used in Markov decision problem settings with specific form varying from case to case.}} The key points can be highlighted as follows. \begin{itemize} \item When $\tau_{i,t} > 1$ and $b_{i,t} > 0$, the task has not reached its deadline, the reward is related to energy consumption saving $E_{i,j}^{\text{sav}}$ if performing task offloading ($u_{i,t}=1$). \item When $\tau_{i,t} = 1$, the task will be removed at the end of the $t$-th time slot. If the task cannot be completed by its deadline, a penalty measured by the number of unfinished subtasks is imposed. \item The benefit of the reward function is to strike a balance between the energy consumption and deadline requirements. For example, putting a priority on the deadline leads to a larger $\alpha$. By contrast, reducing $\alpha$ can increase energy savings for the battery-powered IoT devices to prolong their lifetime. \end{itemize} \subsubsection{Objective} Our objective is to find a policy $\mathcal{G}$ to maximize the expected total discounted system reward with the constraint of the limited computational resources, which is defined by \begin{equation*} \begin{aligned} ({\bf P1}) ~~& \max_{\mathcal{G}}~\mathbbm{E}_{\mathcal{G}} \left[\sum_{t=0}^{\infty}\sum_{i=1}^{N}\beta^t R(s_{i,t}, u_{i,t}) \right] \\ & s.t. ~~~~ \sum_{i=1}^{N}u_{i,t} = M, ~ \forall t, \label{eq:objective} \end{aligned} \end{equation*} where $\beta~(0 < \beta \le 1)$ is the discount factor. The solution to ${\bf P1}$ forms the offloading policy that determines which users are selected to offload in each time slot. Note that for the task offloading problem under consideration, in every slot, the user task continues to move one slot closer to their deadline, whether or not the task is offloaded in that slot. This makes the task offloading problem a restless bandit one. However, the formulated RMAB is a PSPACE-hard sequential decision-making problem, which is intractable in general \cite{papadimitriou1999complexity}. The complexity in deriving the optimal solution is exponential with the number of users. This undesirable condition is further exacerbated by the extremely large dimension of the system state space. Therefore, the development of a scalable and low-complexity solution enabling fast and effective user selection at each time slot is a compelling necessity. \section{Whittle index Based Task offloading Policy} \label{sec: WI} Mathematically, WI \cite{whittle1988restless} provides a potential avenue to obtaining an asymptotically optimal solution to a class of RMABs with the knowledge of reward and state information. The key idea is to decouple the arms through Lagrangian relaxation, and then prove that each arm is indexable. On this basis, a complex $N$-dimensional problem can be translated into $N$ independent $1$-dimensional ones, resulting in a scalable solution with a significant reduction in the computational complexity. This motivates us to exploit the WI theory to solve the formulated RMAB when the user offloading energy consumption are available. However, the major challenge lies in how to establish the indexability (existence) and derive the WI in an easily computed form (complexity in computation). In this section, we first rigorously establish the indexability of the RMAB by considering a single arm reward maximization. Based on the induction method, we then prove that the formulated RMAB can admit a simple WI with closed-form expression. Finally, we elaborate on the practical implementation of the proposed policy. \subsection{Whittle Relaxation} A promising method, known as the Whittle relaxation, replaces the hard constraint $\sum_{i=1}^{N}u_{i,t} = M$ in $({\bf P1})$ by a soft one \begin{equation} \mathbbm{E}_{\mathcal{G}} \left[\sum_{t=0}^{\infty} \beta^{t} \sum_{i=1}^{N} u_{i,t}\right] = \frac{M}{1-\beta}, \end{equation} which only requires that the expected discounted number of selected arms is equal to $M$. In other words, the number of selected arms at each time slot can be larger or less than $M$. In this case, the relaxed RMAB can be shown as \begin{equation*} \begin{aligned} ({\bf P2})~~ & \max_{\mathcal{G}}~\mathbbm{E}_{\mathcal{G}} \left[\sum_{t=0}^{\infty}\sum_{i=1}^{N}\beta^t R(s_{i,t}, u_{i,t}) \right] \\ & s.t. ~~~~ \mathbbm{E}_{\mathcal{G}} \left[\sum_{t=0}^{\infty} \beta^{t} \sum_{i=1}^{N} u_{i,t}\right] = \frac{M}{1-\beta}. \label{eq:relaxed equation} \end{aligned} \end{equation*} % Leveraging the Lagrangian method, we can rewrite ${\bf P2}$ as the following unconstrained problem \begin{equation} \begin{aligned} \max_{\mathcal{G}} \mathbbm{E}_{\mathcal{G}} \left\{\sum_{t=0}^{\infty} \left[ \sum_{i=1}^{N}\beta^t R(s_{i,t}, u_{i,t}) - \right. \right. \hspace{2cm} \\ \left. \left. \delta \beta^t\left(\sum_{i=1}^{N} u_{i,t} - \frac{M}{1-\beta}\right)\right] \right\}, \label{eq:unconstrined} \end{aligned} \end{equation} where $\delta$ is the Lagrange multiplier and will be referred to as subsidy hereafter. At this point, \eqref{eq:unconstrined} can be readily decoupled into $N$ subproblems (one for each arm) given by \color{black} \begin{equation} \begin{aligned} & \max_{\mathcal{G}} \mathbbm{E}_{\mathcal{G}} \left\{\sum_{t=0}^{\infty} \beta^t \left[ R(s_{i,t}, u_{i,t}) - \delta \left(u_{i,t} - \frac{M}{1-\beta}\right)\right] \right\}, \forall i. \\ & = \max_{\mathcal{G}} \mathbbm{E}_{\mathcal{G}} \left\{\sum_{t=0}^{\infty} \beta^t \left[ R(s_{i,t}, u_{i,t}) - \delta u_{i,t} \right] + \delta \frac{M}{1-\beta} \right\}, \forall i. \label{eq:single unconstrained} \end{aligned} \end{equation} It is clear that the $N$ separate optimization problems interact with each other \eqref{eq:single unconstrained} through a scalar Lagrange multiplier $\delta$. Taking a close look at \eqref{eq:single unconstrained} and neglecting the last constant term $\delta \frac{M}{1-\beta}$, our objective for each single arm $i$ is to maximize the following objective \begin{equation} \max_{\mathcal{G}} \mathbbm{E}_{\mathcal{G}} \left\{\sum_{t=0}^{\infty} \beta^t \left[ R(s_{i,t}, u_{i,t}) - \delta u_{i,t} \right] \right\}, \forall i. \end{equation} Then, following \cite{whittle1988restless}, we can define a modified reward of this single arm system as an equivalence to $\left[R(s_{i,t}, u_{i,t}) - \delta u_{i,t}\right]$ as follows \begin{equation} R^{\delta}(s_{i,t}, u_{i,t}) = R(s_{i,t}, u_{i,t}) + \delta \mathbbm{1}(u_{i,t}=0), \label{eq:modified reward} \end{equation} \color{black} where the indicator function $\mathbbm{1}(\cdot)$ gives $1$ if $u_{i,t}=0$. We can interpret \eqref{eq:modified reward} as follows: (a) we select an arm and obtain an immediate reward $R(s_{i,t}, u_{i,t})$; (b) if the arm is not selected, we do not obtain an immediate reward (i.e., $R(s_{i,t}, u_{i,t})=0$) but receive an immediate subsidy $\delta$ (a virtual compensation from the economic view \cite{whittle1988restless}). Given the initial state $s_{i,0}$, we use $V_{i,\beta}^{\delta}(s_{i,0})$ to denote the value function that represents the maximum expected total discounted reward with subsidy $\omega$. From the Bellman equation \cite{sutton1998introduction} we have \begin{equation} V_{i,\beta}^{\delta}(s_{i,0}) = \max_{u_i \in \left\{ 0,1 \right\}} \left\{ R^{\delta}(s_{i,0}, u_{i}) + \beta Q_{i, \beta}^{\delta} (s_{i,0}, u_{i}) \right\}. \end{equation} Here, $Q_{i, \beta}^{\omega} (s_{i,t}, u_{i,t})$ is defined as \begin{equation} Q_{i, \beta}^{\delta} (s_{i,t}, u_{i,t}) \triangleq \sum_{s_{i,t+1}^{\prime} \in {\bf{S}}_i} p(s_{i,t+1}^{\prime} |s_{i,t}, u_{i,t})V_{i,\beta}^{\delta}(s_{i,t+1}^{\prime}), \end{equation} where $p(s_{i,t+1}^{\prime} |s_{i,t},u_{i,t})$ is the state transition probability from the current state $s_{i,t}$ to the next state $s_{i,t+1}^{\prime}$ given action $u_{i,t}$. We use $\mathcal{I}(\delta)$ to represent the set of states where the optimal action $u_i^{\star}$ is not selecting the $i$-th arm, i.e., \begin{equation} \mathcal{I}(\delta) \triangleq \left\{s_i:u_i^{\star}(s_i) = 0\right\}. \end{equation} \subsection{Whittle Index Based Policy} \label{Subsection: Indexability and Whittle index} Now we can formally introduce the concept of indexability and WI. \begin{definition}[Indexability\cite{whittle1988restless}] The $i$-th arm is indexable if, as $\delta$ increases from $-\infty$ to $\infty$, $\mathcal{I}(\delta)$ expands monotonically from empty to the entire space. The RMAB problem is indexable if every arm is indexable. \end{definition} % Essentially, the existence of indexability means that there is a priority order on each arm state $s_{i,t}$ in \eqref{eq:state}. Accordingly, when linking $\delta$ to $s_{i,t}$, the WI $\omega_i(s_{i,t})$, to be defined shortly, is used to quantify this order. \begin{theorem} The task offloading policy design in the MEC system formulated by the RMAB is indexable. \end{theorem} Given the definition of the indexability, we now prove the indexability of the formulated RMAB. The detailed proof can be found in Appendix A. If the indexability holds, we can assign a WI $\omega_i(s_{i,t})$ for $s_{i,t}$ to measure the criticality of each task (user), which severs as the core indicator for the user task offloading selection. The formal definition of the WI can be provided as follows. \begin{definition}[Whittle index\cite{whittle1988restless}] If an indexable arm $i$ is in state $s_{i,t}$ at the $t$-th time slot, its WI $\omega_i(s_{i,t})$ is the least value of $\delta$ for which it is optimal to make the arm passive, that is \begin{equation} \begin{split} & \omega_i(s_{i,t}) \triangleq \\ & \inf_{\delta} \left\{ R(s_{i,t},0) + \delta + \sum_{s_{i,t+1}^{\prime} \in {\bf{S}}_i}\beta p(s_{i,t+1}^{\prime} |s_{i},0)V_{i, \beta}^{\delta}(s_{i,t+1}^{\prime}) \right. \\ & \ge \left. R(s_{i,t},1) + \sum_{s_{i,t+1}^{\prime} \in {\bf{S}}_i}\beta p(s_{i,t+1}^{\prime} |s_{i},1) V_{i, \beta}^{\delta}(s_{i,t+1}^{\prime}) \right\}, \end{split} \end{equation} where $p(s_{i,t+1}^{\prime} |s_{i,t},u_{i,t})$ is the state transition probability from the current state $s_{i,t}$ to the next state $s_{i,t+1}^{\prime}$ given action $u_{i,t}$. \end{definition} After establishing the indexability of the RMAB and providing the definition of the WI, the remaining problem is how to compute the WI, which usually proves very difficult. For our RMAB, as the deadline and workload information become available once a task arrives, the arm state can be accurately captured. In the following, we will show that the unique structure of the RMAB can result in a closed-form expression for the WI. \begin{figure*}[t] \centering {\includegraphics[width=0.9\textwidth]{Offloading_Result}} \caption{An example of the proposed WI policy for a large-scale asynchronous MEC system.} \label{fig: offloading result} \end{figure*} \begin{theorem} The closed-form expression for the WI of the $i$-th user with task state $s_{i,t}=(\tau_{i,t},b_{i,t})$ is calculated as \begin{equation} \begin{aligned} & \omega_i(\tau_{i,t},b_{i,t}) \\ & = \begin{cases} 0, \hspace{2.5cm} \mbox{if } b_{i,t} = 0; \\ E_{i,j}^{\text{sav}}, \hspace{2.0cm} \mbox{if } 1 \le b_{i,t} \le (\tau_{i,t} -1) k_{i} + 1; \\ E_{i,j}^{\text{sav}} + \beta^{\tau_{i,t}-1}F(b_{i,t}-k_{i}\tau_{i,t} + k_{i} - 1), \\ \hspace{2.7cm} \mbox{if } k_{i} \tau_{i,t} - k_{i} + 2 \le b_{i,t} \le k_{i} \tau_{i,t}; \\ E_{i,j}^{\text{sav}} + \beta^{\tau_{i,t}-1}F(b_{i,t}-k_{i}\tau_{i,t}+ k_{i} -1) \\ ~~- \beta^{\tau_{i,t}-1}F(b_{i,t}-k_{i}\tau_{i,t}), \\ \hspace{2.7cm} \mbox{if } b_{i,t} \ge k_{i} \tau_{i,t} + 1. \end{cases} \label{eq: Closed form Whittle} \end{aligned} \end{equation} \label{theorem2} \end{theorem} \begin{proof} Please find the proof of Theorem 2 in Appendix B. \end{proof} \color{black} Here, we provide some insights behind \eqref{eq: Closed form Whittle}. \begin{itemize} \item If $b_{i,t} = 0$, it means that the user has no task to offload. The WI is equal to $0$ which is also the minimal value. \item If $1 \le b_{i,t} \le (\tau_{i,t} - 1)k_{i} + 1$, it means that the $i$-th user's task can be finished at least one time slot ahead of the deadline. The WI is equal to the $i$-th user's energy saving $E_{i,j}^{\text{sav}}$. \item If $k_{i} \tau_{i,t} - k_{i} + 2 \le b_{i,t} \le k_{i} \tau_{i,t}$, it means that the user should always be selected across all the time slots to finish its task. The WI takes into account both the energy savings and the non-completion penalty $F(b_{i,t}-k_{i}\tau_{i,t}+ k_{i} -1)$. \item Finally, when it is impossible to finish the task (i.e., $b_{i,t} \ge k_i \tau_{i,t} + 1$), the WI is decreased by subtracting an extra non-completion penalty $F(b_{i,t}-k_{i}\tau_{i,t})$. \item Note that the selection of tasks (users) depends on the penalty parameter $\alpha$. If we focus on task completion ratio by setting a large $\alpha$, the penalty term will dominate the WI in (17). In this case, those tasks with urgent deadline (i.e., $k_{i} \tau_{i,t} - k_{i} + 2 \le b_{i,t} \le k_{i} \tau_{i,t}$) are given higher priority. On the other hand, when we focus on the energy consumption by setting a small $\alpha$, those tasks with higher energy savings $E_{i,j}^{\text{sav}}$ have higher priority. \end{itemize} \color{black} \subsection{Implementations} \textbf{Theorem 2} indicates that the developed task offloading can be implemented in a very efficient manner. The whole procedure in its entirety can be summarized as follows. \begin{enumerate} \item At each $t$-th time slot, following \eqref{eq: Closed form Whittle} each user first calculates its WI $\omega_i(\tau_{i,t}, b_{i,t})$ based on the task state $\tau_{i,t}$, $b_{i,t}$ and energy saving $E_{i,j}^{\text{sav}}$. \item In the message-passing phase prior to the computation offloading, each user then reports its WI $\omega_i(\tau_{i,t}, b_{i,t})$ to the BS. As $\omega_i(\tau_{i,t}, b_{i,t})$ is a scalar, the communication overhead is quite small. \item Finally, the BS selects $M$ users with the largest WI for task offloading. \end{enumerate} \color{black} An example is provided in Fig. \ref{fig: offloading result}, where we have $N=4$ users and $M=2$ MEC servers, and at each time slot only $2$ users can be selected to perform task offloading. Take a closer look at User 1, it has 3 tasks (indicated by red, black and green) arriving sequentially. Task $1$ with $15$ subtasks (squares) arrives at time slot $1$, revealing time slot $6$ as its deadline\footnote{The square is blank in the time slot $11$ to indicate that not task is at User 1. }. The computation capability of User 1 and the MEC server is $1$ and $4$ subtasks per time slot, respectively\footnote{For different users, the computation capability of an MEC may different. }. More specifically, from time slot $1$ to time slot $3$, User 1 will process its task locally with 1 subtask per time slot as the other users (User 2 and User 3) have larger WI. Then from the time slot $4$ to time slot $6$, User 1 gets permission for task offloading, thereby $4$ subtasks are processed per time slot through offloading. \color{black} The developed policy features very low computational complexity and communication overhead. The key element is to calculate the WI in a distributed manner \eqref{eq: Closed form Whittle}. For the specific implementation, it takes $\mathcal{O}(N)$ time to calculate the Whittle indices of all users in Step 1). In Step 2), the sorting process has the average time complexity $\mathcal{O}(N\log (N))$. Therefore, the total time complexity is only $\mathcal{O}(N\log (N))$. The overhead of collecting Whittle indices and delivering the decision by the MEC are only $\mathcal{O}(N)$ for $N$ users. \begin{remark} Another operation is that each user reports its task state $s_{i,t}=\left(\tau_{i,t}, b_{i,t} \right)$ and the transmission cost $E_i$ to the MEC server at each time slot for the WI computation. However, this will incur the additional communication overhead. \end{remark} \textcolor{black}{On the other hand, let us denote the average reward of the proposed policy, the optimal solution to $({\bf P1})$, and the solution to $({\bf P2})$ by $R_{\rm{WI}}$, $R_{\rm{Opt}}$, and $R_{\rm Relax}$, respectively. We have the following proposition to qualitatively indicate the performance of the proposed policy.} \begin{proposition} The reward performance of the proposed policy can be shown as \begin{equation} R_{\rm{WI}}\leq R_{\rm{Opt}}\leq R_{\rm Relax} \end{equation} \end{proposition} \begin{proof} \textcolor{black}{The first inequality naturally holds because $R_{\rm{Opt}}$ corresponds to the optimal solution to the original problem $({\bf P1})$ with hard constraints. In terms of the second inequality, note that $R_{\rm Relax}$ is the average return under the relaxed constraint in $({\bf P2})$ (does not meet the hard constraint).} \end{proof} \textcolor{black}{ Given \textbf{Proposition 1}, it is quite difficult to quantify the gap between $R_{\rm{WI}}$ and $R_{\rm{Opt}}$. However, we can infer their gap by numerically comparing $R_{\rm{WI}}$ with $R_{\rm Relax}$. Due to the relationship of $R_{\rm{WI}}\leq R_{\rm{Opt}}\leq R_{\rm Relax}$ in Proposition 1, if the performance of the WI policy ($R_{\rm{WI}}$) is close to that of the relaxed policy ($R_{\rm Relax}$), we can infer that the performance gap between the proposed policy and the optimal policy $R_{\rm{Opt}}$ is very small.} \subsection{Completion Ratio-Oriented Task Offloading Policy} \label{subsec: completion ratio} In some scenarios, we pay particular attention to the task completion ratio, i.e., the proportion of tasks that can be completed before their deadlines. In addition to setting a larger $\alpha$ in the penalty function, we notice that the WI \eqref{eq: Closed form Whittle} tends to give higher priority to tasks with less slack time, which is defined as $l_{i,t} \triangleq \tau_{i,t} - b_{i,t}/ k_i$ for the $i$-th user. However, the WI does not distinguish the users whose task states $s_i = (\tau_{i,t}, b_{i,t})$ satisfy $1 \le b_{i,t} \le k_i \tau_{i,t} - k_i + 1 $ (see the second case in \eqref{eq: Closed form Whittle}). This motivates us to further identify the criticality of the tasks in this scenario, thereby accommodating more tasks in a given time duration. In the reward function \eqref{eq: Reward}, we only consider the deadline breaking by imposing a penalty when $\tau_{i,t} = 1, b_{i,t} > 0$. Although considering the remaining time when $\tau_{i,t} > 1, b_{i,t} > 0$ may further reduce the risk, we may not be able to establish WI indexability and derive a very simple closed-form WI solution as \eqref{eq: Closed form Whittle}. To address this dilemma, we proposed a priority rule referred to as shorter slack time less remaining workload (STLW). On this basis, we propose an enhanced WI-based offloading scheduling policy by applying the STLW rule (STLW-WI). The main idea of STLW-WI is to select the users with the highest Whittle indices without violating the STLW rule. The formal definition of the STLW rule can be stated as follows. \begin{definition}[STLW Rule] \label{Definition: STLW Principle} Consider two users $m$ and $n$ with task states $s_{m,t}$ and $s_{n,t}$ at the $t$-th time slot. We define that the $m$-th user has priority over the $n$-th user if user $m$ has shorter slack time and less remaining workload than those of user $n$, i.e., $l_{m,t} \le l_{n,t}$ and $b_{m,t} \le b_{n,t}$, with at least one of the inequalities strictly holding. \end{definition} The STLW rule reorders the users based on their task states to ensure that the tasks with shorter slack time and less remaining workload should be given priority. In order to integrate the STLW rule into the WI-based offloading scheduling policy, we generate a directed acyclic graph (DAG) $\mathcal{G}=\left\{\mathcal{V},\varepsilon \right\}$, where $\mathcal{V}$ and $\varepsilon$ represent the vertex set (user set) and the edge set (users' relative priority), respectively. In the DAG, a directed edge from the $m$-th vertex to the $n$-th vertex indicates that the $m$-th user has the priority over the $m$-th user. \textcolor{black}{The ourdegree of a vertex $m$ is the number of directed edges leaving $m$ while the indegree of $m$ is the number of directed edges entering $m$. In order to preserve the priorities of users in terms of their Whittle indices whenever it is feasible, we utilize Kahn's algorithm \cite{kahn1962topological} with the largest WI vertex first criterion in the topological sorting \footnote{When no priority is set among users based on the STLW rule, users can still be ranked based on their Whittle indices}. Specifically, unlike the conventional Kahn's algorithm which selects the $0$ indegree vertex arbitrary, we select the $0$ indegree vertex with the largest WI firstly. The detailed topological sorting algorithm is shown in Algorithm~\ref{Alg: Khan's Algorithm}. When there is no vertex with $0$ indegree, the topological sorting is terminated, and the top $M$ users in the rank list $L_{U}$ will be chosen to offload their subtasks to the MEC server. } \color{black} \begin{algorithm}[!t] \caption{Kahn's Algorithm with largest WI vertex first.} \label{Alg: Khan's Algorithm} \begin{algorithmic}[1] \color{black} \STATE Initialize rank list $L_{U} = \emptyset$ that will contain the sorted user indices. \STATE Compute each vertex's indegree, i.e., the number of incoming edges for each vertex. \STATE Generate a set $S$ that contains all the vertices with $0$ indegree. \WHILE{$S$ is not empty} \STATE Select the vertex $m$ in the set $S$ with largest WI and add it to the tail of the rank list $L_{U}$. \STATE Remove the vertex $m$ from the set DAG. \FOR{Each vertex $n$ with an edge from the vertex $m$ to vertex $n$} \STATE Decrease its indegree by $1$. \IF{The indegree of vertex $n$ == 0} \STATE Add the vertex $n$ into the set $S$. \ENDIF \ENDFOR \ENDWHILE \STATE Return rank list $L_{U}$. \end{algorithmic} \end{algorithm} \begin{theorem}[The STLW Performance Analysis] For every sequence of system state from the $t^{\prime}$-th time slot to the $(t^{\prime}+\Gamma)$-th time slot, the total discounted reward obtained by the policy with the updated STLW rule (denoted by $\mathcal{\tilde{G}}$) is not less than that achieved by the original policy (denoted by $\mathcal{G}$), i.e., we have \begin{equation} V_{\tilde{\mathcal{G}}}^{t^{\prime}+\Gamma}({\bf{S}}_{t^{\prime}}) \ge V_{\mathcal{G}}^{t^{\prime}+\Gamma}({\bf{S}}_{t^{\prime}}). \label{eq: STLW Performance} \end{equation} \label{theorem: STLW Performance} \end{theorem} \begin{proof} Please find the proof of Theorem 3 in Appendix C. \end{proof} \color{black} \begin{remark} It is worth noting that the WI offloading policy in Section IV requires each user to report its WI at each time slot. By contrast, the STLW-WI requires each user to report its current task state $s_{i,t} = (\tau_{i,t}, b_{i,t})$. \end{remark} \section{Learn to Offload Task} \label{sec: learning} \color{black} In Section~\ref{Subsection: Indexability and Whittle index}, the proposed WI offloading policy requires the knowledge of user's energy saving $E_{i,j}^{\text{sav}}$ before task offloading. In some cases, however, $E_{i,j}^{\text{sav}}$ might not be available at $i$-th user prior to transmission due to lack of channel state information and offloading energy consumption $E_{i,j}^{\text{off}}$. In this case, the WI policy is not directly applicable (c.f. \eqref{eq: Closed form Whittle}). To address this issue, in this section, we first integrate the WI policy with the maximum likelihood estimation (MLE). To further improve the performance, we propose a novel Bayesian learning with WI policy (BL-WI) given the conjugate prior, and a refinement algorithm based on prior-swapping suitable for the non-conjugate priors (PSBL-WI). \subsection{Maximum Likelihood Estimation with WI Policy} Only after performing task offloading at the $t$-th time slot, the $i$-th user can obtain an estimated energy saving $e_{i,j}^{\text{sav}}$ through equipment measurement for the $j$-th task\footnote{After a successful task offloading, the user can obtain its estimated offloading energy consumption $e_{i,j}^{\text{off}}$ by the equipment measurement, and calculate its estimated energy saving by $e_{i,j}^{\text{sav}} = k_i E_i^{\text{loc}} - e_{i,j}^{\text{off}}$.}. Due to the energy measurement sensitivity and many other factors, $e_{i,j}^{\text{sav}}$ is a noisy version of the actual energy saving $E_{i,j}^{\text{sav}}$. Therefore, the observation can be written as $e_{i,j}^{\text{sav}} = E_{i,j}^{\text{sav}} + \epsilon_i$, where $\epsilon_i $ is the measurement noise. Usually the noise is the result of summing a large number of different and independent random variables. From the central limit theorem, we have $\epsilon_i \sim \mathcal{N}(0, \Sigma_i)$, where $\Sigma_i$ is the noise variance. Therefore, $e_{i,j}^{\text{sav}}$ follows a Gaussian distribution written as $e_{i,j}^{\text{sav}} \sim \mathcal{N} \left(E_{i,j}^{\text{sav}}, \Sigma_i\right)$. In the following, we integrate the WI policy with the maximum likelihood estimation (MLE) technique, where we treat $E_{i,j}^{\text{sav}}$ as an unknown variable. Suppose that up to the $t$-th time slot for the $j$-th task offloading, the $i$-th user has performed task offloading $\gamma_{i,j}$ times, and obtained the corresponding observations $X_{i,j}(t) = \left\{e_{i,j,1}^{\text{sav}}, \cdots, e_{i, j,\gamma_{i,j}}^{\text{sav}}\right\}$. The log likelihood is calculated by \begin{equation} \begin{aligned} \ln p \left( X_{i,j}(t) | E_{i,j}^{\text{sav}}, \Sigma_i \right) = - \frac{\gamma_{i,j}}{2} \ln(2 \pi) - \frac{\gamma_{i,j}}{2} \ln |\Sigma_i| \\ - \frac{1}{2} \sum_{n=1}^{\gamma_{i,j}} (e_{i,j,n}^{\text{sav}} - E_{i,j}^{\text{sav}})^2 \Sigma_i^{-1}. \end{aligned} \end{equation} Taking the derivative of the log likelihood with respect to $E_{i,j}^{\text{sav}}$, we obtain \begin{equation} \frac{\partial }{\partial E_{i,j}^{\text{sav}}} \ln p \left(X_{i,j}(t) | E_{i,j}^{\text{sav}}, \Sigma_i\right) = \sum_{n=1}^{\gamma_{i,j}} \Sigma_i^{-1} \left(e_{i,j,n}^{\text{sav}} - E_{i,j}^{\text{sav}}\right). \end{equation} By setting this derivative to zero, solution for the MLE of the energy saving is calculated as \begin{equation} \tilde{E_{i,j}^{\text{sav}}} = \frac{1}{\gamma_{i,j}} \sum_{n=1}^{\gamma_{i,j}} e_{i,j,n}^{\text{sav}}. \label{eq: ML for E} \end{equation} Clearly from \eqref{eq: ML for E}, each user can average its past observations of energy savings to obtain an estimate $\tilde{E_{i,j}^{\text{sav}}}$, and calculate its WI according to \eqref{eq: Closed form Whittle}. However, such simple update may lead to an inaccurate estimate $\tilde{E_{i,j}^{\text{sav}}}$ when the number of observations is not enough. \subsection{Bayesian Learning with WI Policy} To further improve the performance, we propose a novel BL-WI policy. The key is to leverage Bayesian learning to obtain the estimated energy saving $\tilde{E_{i,j}^{\text{sav}}}$ rather than just simply averaging the past observations. From the BL perspective, a prior distribution on $\tilde{E_{i,j}^{\text{sav}}}$, obtained from historical observations, can be imposed \cite{lesaffre2012bayesian}. Specifically, an observation $e_{i,j}^{\text{sav}}$ after task offloading is drawn independently from a Gaussian distribution with an unknown mean $E_{i,j}^{\text{sav}}$ and an unknown variance $\Sigma_i$, i.e., $e_{i,j}^{\text{sav}} \sim \mathcal{N} \left(E_{i,j}^{\text{sav}}, \Sigma_i\right)$. We refer to $\theta_{i,j}= \left(E_{i,j}^{\text{sav}}, \Sigma_i\right)$ as the model parameter. To conduct the Bayesian inference, we place a normal-inverse-gamma (NIG) conjugate prior~\cite{bishop2006pattern} on the model parameter with hyperparameters ${\lambda}_{i,j}$, $\mu_{i,j}$, $\Phi_{i,j}$ and $\nu_{i,j}$. In specific, the variance $\Sigma_i$ follows an inverse gamma distribution \begin{equation} \Sigma_{i,j}|\left\{\Phi_{i,j},\nu_{i,j}\right\} \sim \Gamma^{-1}\left(\Phi_{i,j},\nu_{i,j}\right), \end{equation} and the mean $E_{i,j}^{\text{sav}}$ follows a Gaussian distribution \begin{equation} E_{i,j}^{\text{sav}}|\left\{\mu_{i,j},\lambda_{i,j},\Sigma_{i,j}\right\} \sim \mathcal{N}\left( {\mu}_{i,j},\frac{1}{\lambda_{i,j}}{\Sigma}_{i,j} \right). \end{equation} Note that the Gaussian prior is widely adopted due to a good approximation of different complex parameter distributions. \begin{algorithm}[!t] \caption{Bayesian Learning Based Whittle Index} \begin{algorithmic}[1] \STATE Initialize $\gamma_{i,j}$, model parameters $\theta_{i,j} = (\tilde{E_{i,j}^{\text{sav}}}, \tilde{\Sigma_i})$, and hyperparameters ${\lambda}_{i,j}$, $\mu_{i,j}$, $\Phi_{i,j}$, $\nu_{i,j}$, observation sets: $X_{i,j} = \emptyset$, $\forall$ $i = 1,...,n $. \FOR{$t = 0,...,T$} \FOR{$i = 1, \ldots, n$} \STATE Each user calculates its WI $\omega_i$ based on its estimated energy saving $\tilde{E_{i,j}^{\text{sav}}}$ according to \eqref{eq: Closed form Whittle}. \ENDFOR \STATE All users transmit their $\omega_i$ to the BS. \STATE The BS selects the top $M$ users based on their indices ${\omega}_{i}$. Denote the selected set as $\mathcal{M}$. \STATE According to the action, update each user's state according to the predefined state transition. \FOR{$i = 1, \ldots, n$} \IF{$i \in \mathcal{M}$ } \STATE Obtain an observation of energy saving $e_{i,j}^{\text{sav}} \sim \mathcal{N}(E_{i,j}^{\text{sav}}, \Sigma_i)$. \STATE $\gamma_{i,j} = \gamma_{i,j} + 1$. \STATE Append current observation into the observation set $X_{i,j}(t) \leftarrow X_{i,j}(t) \cup e_{i,j}^{\text{sav}}$. \STATE Update hyperparameters ${\lambda}_{i,j}$, $\mu_{i,j}$, $\Phi_{i,j}$ and $\nu_{i,j}$ according to \eqref{eq: hyperpara1}, \eqref{eq: hyperpara2}, \eqref{eq: hyperpara3}, \eqref{eq: hyperpara4}. \STATE Update $\tilde{\Sigma_i}$ and $\tilde{E_{i,j}^{\text{sav}}}$ according to \eqref{eq: modelpara1} and \eqref{eq: modelpara2}. \ENDIF \ENDFOR \ENDFOR \end{algorithmic} \label{Alg: BL-WI} \end{algorithm} Given the observation up to the $t$-th time slot $X_{i,j}(t)$ for the $j$-th task, the $i$-th user can obtain its estimated energy saving $\tilde{E_{i,j}^{\text{sav}}}$ by efficient Bayesian inference. On this basis, we propose the BL-WI offloading policy, which is summarized in Algorithm~\ref{Alg: BL-WI}. It consists of three stages: initialization, decision making, and parameter update. In the initialization stage (Line 1), we initialize the model parameters, hyperparameters of NIG and counter $\gamma_{i,j}$ for each user. In the decision making (Lines 3-7), according to~\eqref{eq: Closed form Whittle} based on the estimated $\tilde{E_{i,j}^{\text{sav}}}$, each user calculates its WI, and then transmits it to the BS, where the $M$ users with the largest indices are selected to perform task offloading. We denote the selected user set by $\mathcal{M}$. In the update stage (Lines 8-17), each user first updates its task state according to the state transition defined in Section~\ref{sec: RMAB Formulation}. Then, the user in the selected set $\mathcal{M}$ increases its counter $\gamma_i$ and updates its parameters by the Bayesian inference accordingly. As the likelihood distribution lies in the exponential family, given the NIG prior on the unknown mean $E_{i,j}^{\text{sav}}$ and the variance ${\Sigma}_i$, we obtain the NIG posterior of $\theta_{i,j} = \left\{E_{i,j}^{\text{sav}}, {\Sigma}_i\right\} $ by the conjugacy property. Specifically, the posterior shares the same form as the prior whose hyperparameters $\lambda_{i,j}^{new}$, ${\mu}_{i,j}^{new}$, $\nu_{i,j}^{new}$, and ${\Phi}_{i,j}^{new}$ are acquired by aggregating the observations $X_{i,t}(t)$ calculated as \begin{equation} \lambda_{i,j}^{new} = \lambda_{i,j}^{old} + \gamma_{i,j,t}, \label{eq: hyperpara1} \end{equation} \begin{equation} {\mu}_{i,j}^{new} = \frac{\lambda_{i,j}^{old}{\mu}_{i,j}^{old}+ \gamma_{i,j,t} \overline{E_{i, j,\gamma_i}^{\text{sav}}} }{\lambda_{i,j}^{old} + \gamma_{i,j,t}}, \label{eq: hyperpara2} \end{equation} \begin{equation} {\Phi}_{i,j}^{new} = {\Phi}_{i,j}^{old}+\sum_{n=1}^{\gamma_{i,j,t}}\left( {e}_{i,j,n}-\overline{E_{i,j}} \right)^2 +\frac{\lambda_{i,j}^{old} \gamma_{i,j,t}}{\lambda_{i,j}^{old}+ \gamma_{i,j,t}}\frac{(\overline{E_{i,j}}-{\mu}_{i,j}^{old})^2}{2}, \label{eq: hyperpara3} \end{equation} \begin{equation} \nu_{i,j}^{new} = \gamma_{i,j,t}/2 + \nu_{i,j}^{old}, \label{eq: hyperpara4} \end{equation} where $\overline{E_{i,j}}$ is the average of the observations $X_{i,j}(t)$. Finally, a user's estimated noise variance $\tilde{{\Sigma}_i}$ and estimated energy saving $\tilde{E_{i,j}^{\text{sav}}}$ can be sampled with updated hyperparameters as \begin{equation} \tilde{{\Sigma}_{i}}|\{{\Phi}_{i,j}^{new},\nu_{i,j}^{new}\} \sim \Gamma^{-1}\left( {\Phi}_{i,j}^{new},\nu_{i,j}^{new} \right), \label{eq: modelpara1} \end{equation} \begin{equation} \tilde{E_{i,j}^{\text{sav}}}|\{{\mu}_{i,j}^{new},\lambda_{i,j}^{new},{\Sigma}_{i,j}^{\prime}\} \sim \mathcal{N}\left({\mu}_{i,j}^{new},\frac{1}{\lambda_{i,j}^{new}}{\tilde{{\Sigma}_{i}}} \right). \label{eq: modelpara2} \end{equation} \subsection{Refinement with BL-WI Policy} \label{sec: learning subsection refine} Although the NIG prior allows for a tractable and convenient Bayesian inference due to the conjugacy property, in practice, the true prior may not be conjugate (e.g., Laplace distribution). Usually, inferring the exact posterior given the non-conjugate prior is intractable, and approximate posterior inference algorithms such as Markov chain Monte Carlo (MCMC) are needed. However, inference by sampling method for the target posterior is very costly and inefficient in an online setting~\cite{zhou2018racing}, as all past observations must be involved to generate the action at each iteration. Motivated by~\cite{neiswanger2017post}, we adopt the prior swapping (PS) technique to make use of the pre-defined false prior (e.g., Gaussian prior), rather than running standard inference algorithms on the target prior. Here, the original Bayesian inference is divided into two simple steps: we first carry out the closed-form inference with the conjugate prior, and then utilize the PS technique to derive the posterior with the true non-conjugate prior. Hereafter, we refer to this new policy as PSBL-WI policy. Denote the true prior distribution over the model parameter $\theta_{i,j}$ by $\pi_t({\theta_{i,j}})$. Suppose now we have chosen a conjugate prior distribution $\pi_f(\theta_{i,j})$, which is referred to as the false prior. To leverage the inferred false posterior for computing the true posterior, we define a prior swapping distribution $p_s(\theta_{i,j})$ \begin{equation} p_s(\theta_{i,j}) \propto \frac{ \tilde{p_f(\theta_{i,j})} \pi_t(\theta_{i,j}) }{ \pi_f(\theta_{i,j}) }, \end{equation} where $\tilde{p}_f(\theta_{i,j})$ is the interference result of the false posterior. Note that in our case, $\tilde{p}_f(\theta_{i,j}) = p_f(\theta_i|X_{i,j}(t))$ has an analytic form due to the conjugacy property, and $p_s(\theta_{i,j}) = p(\theta_i|X_{i,j}(t))$ becomes the true posterior density function. Then our strategy is to use $p_s(\theta_{i,j})$ in random walk Metropolis-Hastings (MH) algorithm~\cite{chib1995understanding} to approximate the true posterior distribution. Unlike the traditional MH whose computational complexity highly depends on the number of observations, the PS technique ensures that each iteration only requires to evaluate a few simple analytic expressions, and the complexity is independent of the number of observations. We denote the proposal distribution by $q (\theta_{i,j,p} | \theta_{i,j,k-1})$, where $\theta_{i,j,p}$ is the proposed sample and $\theta_{i,j,k-1}$ is the old one. Then the MH ratio (acceptance ratio) is calculated as $\min \left(1,\rho\right)$ with \begin{equation} \rho = \frac{ p_s(\theta_{i,j,p}) q(\theta_{i,j,k} | \theta_{i,j,p}) }{p_s(\theta_{i,j,k}) q(\theta_{i,j,p}| \theta_{i,j,k})}. \label{eq: MH accept ratio} \end{equation} Finally, after drawing $K$ samples of model parameters $\theta_{i,j}$, we can average $K$ energy saving samples $\left\{\hat{E}_{i,j,1}, \cdots, \hat{E}_{i,j,K} \right\}$ to obtain the estimated energy saving $\tilde{E_{i,j}^{\text{sav}}} = \frac{1}{K} \sum_{k=1}^{K}{\hat{E}_{i,j,k}}$. The detailed PSBL-WI policy is presented in Algorithm 3. \begin{algorithm}[!t] \caption{Prior swapping Bayesian learning Whittle index} \begin{algorithmic}[1] \color{black} \STATE Initialize $\gamma_{i,j}$, model parameters $\theta_{i,j} = \left( \tilde{E_{i,j}^{\text{sav}}}, \tilde{\Sigma_i} \right)$, observation sets: $X_{i,j} = \emptyset$, $\forall$ $i = 1,...,n $, and desired number of samples $K$. \FOR{$t = 0,...,T$} \FOR{$i = 1, \cdots, n$} \FOR{$j = 1,\cdots, K$} \STATE Sample a new proposal $\theta_{i,j,p} \sim q \left(\theta_{i, j,p} | \theta_{i, j,k-1}\right)$ \STATE Draw $\tilde{u} \sim U(0,1)$ \IF{$\tilde{u} < \min(1, \rho)$} \STATE accept the proposal $\theta_{i,j,k} \leftarrow \theta_{i,j,p}$ \ELSE \STATE Reject the proposal $\theta_{i,j,k} \leftarrow \theta_{i,j,k-1}$ \ENDIF \ENDFOR \STATE Average samples $\tilde{E_{i,j}^{\text{sav}}} = \frac{1}{K} \sum_{k=1}^{K} \hat{E}_{i,j,k}$ \STATE Each user calculates its WI $\hat{\omega}_i$ as \eqref{eq: Closed form Whittle}. \ENDFOR \STATE Same decision stage as Algorithm.~\ref{Alg: BL-WI} \STATE Same update stage as Algorithm.~\ref{Alg: BL-WI}. \ENDFOR \end{algorithmic} \label{Alg: PSBL-WI} \end{algorithm} \color{black} \section{Numerical Results} \label{sec: Numerical Results} In this section, we evaluate the performance of the proposed index-based policies by simulation. In Section~\ref{simulation: first subsection}, we first verify the proposed WI policy when the users have exact information about their energy savings from the task offloading. Then we show the impact of penalty parameter $\alpha$ on the total energy saving and completion ratio. Finally, we verify the performance of the proposed STLW-WI policy when the completion ratio becomes the main performance metric. In Section~\ref{simulation: third subsection}, we present the performance of the Bayesian learning-enabled WI policies when $E_{i,j}^{\text{sav}}$ is not available before transmission, together with its comparison to the WI policy with the knowledge of $E_{i,j}^{\text{sav}}$. \textcolor{black}{ The common parameters in the simulations are summarized as follows. The total rounds of task offloading is $T = 200$ with discount factor $\beta = 0.99$. The users are randomly located in the MEC system, with distance to the BS $d_{i}$ independently drawn from a uniform distribution $\mathcal{U}(0.1, 0.3)$ in kilometers. The small-scale fading channel power gains are exponentially distributed with unit mean, i.e., $\kappa_{i,j} \sim \text{Exp}(1)$~\cite{8016573}. We set $\sigma_0^2 = -174$ dbm/Hz, $g_0 = -40$ dB, $d_0 = 1$ m, and $\iota = 4$. Without loss of generality, each allocated sub-channel has the same bandwidth $W_i = 1$ MHz. The transmission power for each user follows a uniform distribution $P_i^{tx} \sim U(20, 25)$ dbm. For local computing, the power efficient is $\lambda = 10^{-28}$. The CPU frequency of each user $U_i$ is selected from the set $\left\{0.2, 0.4 \cdots, 1\right\}$ GHz. The required number of CPU cycles per bit is $C_i \in \left\{1, 2, 3, 4, 5\right\} \times 10^5$ cycles/bit. The CPU frequencies of all MEC servers are fixed $U_s = 2$ GHz. When the user is idle, the task generation probability is $Q = 0.7$. For the task specification, the duration and size of a task are bounded by $10$ time slots and $30$ subtasks, respectively. The size of a subtask is $l_i \in \left\{100, 150, 200\right\}$ bits. The penalty function in the reward function is set as $P(b) = \alpha + 0. 1b^2$ with a different value of $\alpha$ in different subsections. } \begin{figure*} \centering \subfigure[Constant $M/N = 0.3$]{ \includegraphics[width=0.45\textwidth]{Const_MN3_Reward.eps} \label{fig: Constant M/N(a)} } \subfigure[Constant $M/N = 0.5$]{ \includegraphics[width=0.45\textwidth]{Const_MN4_Reward.eps} \label{fig: Constant M/N(b)} } \caption{Performance comparison in terms of the total discounted reward.} \label{fig: Constant M/N} \end{figure*} \subsection{The Performance of the WI Policy} \label{simulation: first subsection} When the perfect knowledge of $E_{i,j}^{\text{sav}}$ is available at the $i$-th user, we compare our WI policy with the following conventional policies. \begin{itemize} \item \textit{Earliest Deadline First (EDF)~\cite{liu1973scheduling}:} EDF is a traditional dynamic priority policy where at each time slot the BS always selects $M$ users with minimal task remaining time $\tau_{i,t}$. Each user needs to report its current remaining time $\tau_{i,t}$ to the BS. \item \textit{Least Slack Time (LST)~\cite{393496}:} LST chooses $M$ users based on their task slack time $l_{i,t} = \tau_{i,t} - b_{i,t}/k_i$. At each time slot, the user needs to transmit its task slack time $l_{i,t}$ to the BS. \item \textit{Greedy Policy:} The greedy policy selects users according to their immediate reward $R_i$ as defined in \eqref{eq: Reward}, in which $M$ users with the highest rewards are selected. Each user calculates its immediate reward $R_i$ and transmits it to the BS. \item \textit{Relax Solution:} In addition, we obtain the unrealistic relax solution to (${\bf P2}$) according to the method provided in~\cite{whittle1988restless}. Note that this relaxed solution is the optimal solution to {\bf{P2}}. The maximal expected average reward under relaxed constraint is \begin{equation} \bar{R} = \inf_{\delta} \left\{\sum_{i=1}^{N} V^{\delta}_{i,\beta} - \delta(N-M)\right\}, \end{equation} where $V^{\delta}_{i,\beta}$ is the value function of the $i$-th user with subsidy $\delta$, and $\delta$ can be obtained by an exhaustive search to maximize the $\bar{R}$. Note that this solution does not satisfy the constraint in ${\bf P1}$. \end{itemize} To take into account both task deadline and user offloading energy consumption, we set $\alpha = 0.5$. In comparing the WI policy with the four methods aforementioned, Fig.~\ref{fig: Constant M/N} considers two scenarios with different $M/N$. The total discounted reward is served as the performance metric. It is clearly shown that our WI policy significantly outperforms the other heuristic policies. Taking a closer look at the WI policy and the relaxed solution to $({\bf P2})$, we can infer that the performance of the WI policy is close to the optimal solution according to \textrm{Proposition 1}. In Fig.~\ref{fig: Constant M/N(a)}, when the number of MEC servers is not relatively enough to the number of users, the total discounted rewards obtained by heuristic policies decrease with the increment of the number of users. While our WI policy can not only achieve a positive reward but also increase with the number of users. It is because our WI policy can fully utilize the system's state information to rank the priorities among users. Compared with Fig.~\ref{fig: Constant M/N(a)} and Fig.~\ref{fig: Constant M/N(b)}, one can see that the total discounted reward increases with the ratio of available MEC servers increasing from $0.3$ to $0.5$. The reason is that more users can be selected to perform task offloading, thereby more tasks can be finished before the deadline. In Fig.~\ref{fig: Constant N}, we fix the number of users $N=100$ and vary the number of MEC servers $M$. It can be seen that our WI policy outperforms the other policies in terms of the total discounted reward. When the number of available MEC servers is limited (e.g., $M = 25$ with $M/N = 0.25$), the performance gap between different policies is small due to very insufficient computational resources. In fact, there are a large number of tasks that cannot meet their deadlines. With the increasing number of $M$, the performance of all the policies can be improved. Given the adequate computing resources (e.g. $M = 45$ with $M/N = 0.45$), most of the tasks can be accomplished by their deadline in those policies. Therefore, all policies achieve closer performance. \begin{figure}[t] \centering{ \includegraphics[width=0.45\textwidth]{Const_N_Reward.eps} } \caption{Performance comparison in terms of the total discounted reward with constant $N$.} \label{fig: Constant N} \end{figure} \begin{figure}[t] \centering{ \includegraphics[width=0.45\textwidth]{Energy_Saving_Complete_Ratio.eps} } \caption{The total discounted energy savings and completion ratio versus $\alpha$ in penalty function.} \label{fig: Various alpha} \end{figure} \begin{figure}[t] \centering{ \includegraphics[width=0.45\textwidth]{EnergySaving_MN.eps} } \caption{Performance comparison for energy saving focus case.} \label{fig: energy saving focus} \end{figure} \begin{figure*} \centering \subfigure[Completion Ratio]{ \includegraphics[width=0.45\textwidth]{Deadline_MN_CompleteRatio.eps} \label{fig: deadline focus completion ratio} } \subfigure[Reward Per Task]{ \includegraphics[width=0.45\textwidth]{Deadline_MN_TotalReward.eps} \label{fig: deadline focus reward} } \caption{Performance comparison for task completion focus case.} \label{fig: deadline focus} \end{figure*} \begin{figure}[t] \centering {\includegraphics[width=0.45\textwidth]{Learn_Compare_Moving.eps}} \caption{The performance comparison under Gaussian prior.} \label{fig: Bayesian Learning Performance} \end{figure} \begin{figure}[t] \centering {\includegraphics[width=0.45\textwidth]{Learn_Compare_NonConjugate.eps}} \caption{The performance comparison under Laplace prior.} \label{fig: Bayesian Learning Performance Non-Conjugate} \end{figure} Essentially, the penalty parameter $\alpha$ in \eqref{eq: Reward} strikes a tradeoff between the energy saving and the task completion ratio, which is illustrated in Fig.~\ref{fig: Various alpha}. We can find that, when $\alpha$ is small, the WI policy poses an emphasis on the energy savings, resulting in a relatively low task completion ratio. With the increase of $\alpha$, the WI policy becomes task completion ratio-oriented, leading to reduced energy savings and higher task completion ratio. It is worth noting that more computational resources result in a larger $\alpha$ to make the WI policy focus on the task complete ratio. \textcolor{black}{In Fig.~\ref{fig: energy saving focus}, we compare the performance achieved by different policies in terms of the total energy saving with a small penalty parameter $\alpha = 0.001$. As the greedy policy only selects the task with largest energy savings to offload, it achieves maximum total energy savings. It is clearly shown that the WI-based offloading policy outperforms the EDF and LST policies, and is close to the greedy one.} In Fig.~\ref{fig: deadline focus completion ratio}, we compare the performance achieved by different policies with a large penalty parameter $\alpha = 5$ in terms of the task completion ratio. Note that as the computational resource here is limited ($M < N$), not all the tasks can be finished before their deadlines. It is clearly shown that the WI-based offloading policy outperforms the EDF, LST, and Greedy policies. Furthermore, the STLW-WI policy outperforms the original WI policy because reordering of users with the STLW rule gives urgent tasks higher priorities. When $M/N = 0.45$, the completion ratio of the proposed STLW-WI and WI policies is 82\% and 80\%, compared to 72\%, 70\%, 66\% in LST, EDF and Greedy, respectively. The total discounted reward in Fig.~\ref{fig: deadline focus reward} also demonstrates that applying STLW rule can reduce the penalty of unfinished tasks and improve the performance. This is consistent with the theoretical analysis in Theorem~\ref{theorem: STLW Performance}. \subsection{The Performance of the BL-enabled WI Policy} \label{simulation: third subsection} Next, we evaluate the performance of the proposed BL-enabled WI policy without the knowledge of user energy saving before offloading. The initialized parameters in BL-WI policy are set as follows: $\lambda_{i,j} = 1$, $\mu_{i,j} = 1$, $\Phi_{i,j} = 1$, $\nu_{i,j} = 1$, $\tilde{\Sigma_i} = 0$, $\tilde{E_{i,j}^{\text{sav}}} = 1$, and $\gamma_{i,j} = 0$. After the $i$-th user performing task offloading at the $t$-th time slot for the $j$-th task, the observation of the energy saving is drawn from a Gaussian distribution: $e_{i,j,t} \sim \mathcal{N} (E_{i,j}^{\text{sav}}, \Sigma_i)$, with the observation noise drawn from a uniform distribution $\Sigma_i \sim U(0.5, 1)$. The desired number of samples in PSBL-WI policy is $K = 10$. For reference purpose, we also include the performance of the WI policy with the knowledge of the energy saving. When the energy saving $E_{i,j}^{\text{sav}}$ follows a Gaussian prior distribution, we evaluate the performance of Algorithm \ref{Alg: BL-WI} in Fig.~\ref{fig: Bayesian Learning Performance}. The prior distribution is $E_{i,j}^{\text{sav}} \sim \mathcal{N}\left(E_{i,j}^{\text{init}}, \Sigma_0\right)$ with mean $E_{i,j}^{\text{init}} = 1$ and variance $\Sigma_{i} = 0.1$. It is clearly shown that the BL-WI policy can learn faster and more accurate than the MLE-WI policy under various $M/N$. \textcolor{black}{Since the channel gain changes every 20 time slots, the performance of MLE-WI policy is limited by the number of observations collected in 20 time slots.} Additionally, comparing with WI policy, the reward gaps of both BL-WI policy and MLE-WI policy decrease when the number of available MEC servers increases, i.e., $M/N$ increases from $0.3$ to $0.5$,. In particular, the BL-WI policy achieves a much more significant performance improvement than the MLE-WI policy counterpart. It is because more users have opportunities to perform task offloading and obtain more observation samples, accelerating the Bayesian learning process and decreasing the sample bias in MLE. Next, we evaluate the performance of Algorithm \ref{Alg: PSBL-WI} when the energy saving $E_{i,j}^{\text{sav}}$ has a non-conjugate prior distribution. Specifically, we place a Laplace distribution as the prior distribution $E_{i,j}^{\text{sav}} \sim Laplace\left({E}_{i,j}^{\text{init}}, b_0 \right)$ with location parameter $E_{i,j}^{\text{init}} = 1$ and scale parameter $b_0 = 0.2$. For the BL-WI policy, we still use a conjugate NIG prior to performing exact Bayesian inference. Fig.~\ref{fig: Bayesian Learning Performance Non-Conjugate} shows that the PSBL-WI policy outperforms the other ones in the non-conjugate case. Although the Gaussian prior brings the convenience in Bayesian inference, comparing the performance of BL-WI policy in Fig.~\ref{fig: Bayesian Learning Performance} and Fig.~\ref{fig: Bayesian Learning Performance Non-Conjugate}, the reward gap between BL-WI policy and WI policy increases due to the false prior assumption. Similar to the conjugate prior case, when the number of MEC servers increases, the performance of BL-enabled WI policies improve with more samples obtained during the offloading. \subsection{Discussion} \color{black} In our problem, we assume a pre-allocated bandwidth scheme. However, it is possible to include the bandwidth allocation into the formulated problem. To do so, the action at each time slot will be modified as $a_{i,t} = (u_{i,t}, d_{i,t})$, where $u_{i,t} \in \left\{0, 1\right\}$ is the offloading decision and $d_{i,t} \in \left[d_{\min}, d_{\max}\right]$ the bandwidth allocation. Accordingly, two constraints imposed on the question $\sum_{i}^{N} u_{i,t} = M $ (only $M$ users can be selected to perform task offloading), and $\sum_{i} u_{i,t} d_{i,t} = W $ (the sum of bandwidth allocation is $W$). This new RMAB problem with an extra constraint (bandwidth limitation) makes the establishment of the indexability difficult, and we consider this problem as our future work. \textcolor{black}{It is worth noting that the task offloading in a large-scale asynchronous MEC system may suffer from Byzantine failure, where the status of server or users appears to be in failure to some users while functional to other users. Therefore, the system needs to first reach a consensus on whether the user or server has failed, then it can shut down the failure part accordingly. To handle this problem, we may resort to the asynchronous Byzantine fault tolerant protocol proposed in \cite{miller2016honey}. Under this framework, users receive the offloading history from other users and store them in their buffer. At the beginning of each epoch, each user selects and provides a subset of the history in its buffer to a randomized agreement protocol which is used to determine whether the target user is in failure. We will investigate the specific implementation of this method as our future topic.} \color{black} Note that due to the limited computational resources, the task completion ratio cannot be further improved by our proposed method. In practical applications (e.g., the task offloading for non-critical wireless sensors such as smart meters reading \cite{7281870, 6574667}), we need other supplementary methods to tolerate high violation probability further. For example, if the task misses its current deadline, it can be stored in the buffer and assigned a new deadline for later task offloading. \color{black} \color{black} \section{Conclusions} \label{section 7} We proposed a novel WI-based task offloading policy for a large-scale asynchronous MEC system, which features scalable calculation and simple implementation. We formulated the offloading policy design as an RMAB with the objective to maximize the total discounted reward over the time horizon. Based on the WI theory, we rigorously established the indexability and derived the WI in a closed-form expression. To achieve a higher task completion ratio, the STLW-WI policy is proposed in the task completion ratio-oriented case. For the case of unknown user offloading energy consumption prior to offloading, we proposed the BL-WI policy and PSBL-WI policy for the conjugate and non-conjugate prior cases, respectively. Simulation results verified that the proposed policies significantly outperform the existing policies. The proposed method provides a potential avenue to the highly efficient task offloading with the upcoming large-scale MEC deployment in the IoT. \appendices \section{Proof Of Theorem 1} \begin{proof} Without loss of generality, we drop the subscript $i$, $j$, $\delta$ and $t$. Denote the difference between two value functions by $h(\tau,b) = V(\tau, b+k-1) - V(\tau, b)$, and the difference of two actions (offloading and un-offloading) by $g(\tau,b)$. The indexability of the offloading problem depends on the property that $h(\tau,b)$ is piecewise linear in $\delta$ and $\frac{ \partial h(\tau,b)}{ \partial \delta} \ge -1 $, because this property guarantees that $\frac{ \partial g(\tau,b)}{ \partial \delta} = \left[1 - \frac{ \partial h(\tau,b)}{ \partial \delta} \right] \ge 0 $. The induction method is applied to prove this property. Specifically, we first show that the WI $\omega(\tau,b) $ exists for $\tau = 0, 1$, then assuming that the WI exists and $\frac{ \partial h(\tau,b)}{ \partial \delta} \ge -1 $ for $\tau = t - 1$, we show that the WI also exists and $\frac{ \partial h(\tau,b)}{ \partial \delta} \ge -1 $ holds for $\tau = t$. \begin{enumerate} \item $\tau=0$: There is no task waiting in the user. The Bellman equation is stated as \begin{equation} V(0,0) = \max\left\{\delta+\beta V_e, \beta V_e \right\}, \end{equation} where $V_e$ is the expected reward of future tasks generation. Therefore, if and only if $\delta>0$, the first term is larger and the un-offloading action is optimal. Thus $\omega(0,0) = 0$. \item $\tau = 1$: there are four cases. \begin{enumerate} \item If $b = 0$, the Bellman equation is stated as \begin{equation} V(1,0) = \max\left\{\delta+\beta V_e, \beta V_e \right\}. \end{equation} It is same as the case $\tau=0, b=0$, therefore, $\omega(1,0) = 0$. \item If $ b = 1$, the Bellman equation is stated as \begin{equation} V(1,b) = \max\left\{\delta + \beta V_e, E^{\text{sav}} +\beta V_e \right\}. \end{equation} If and only if $\delta \ge E^{\text{sav}}$, the un-offloading action is optimal. Thus $\omega(1,b) = E^{\text{sav}}$ when $b = 1$. \item If $ 1 < b \le k$, the Bellman equation is stated as \begin{equation} \begin{aligned} V(1,b) = \max\left\{\delta +\beta V_e - F(b-1), E^{\text{sav}} + \beta V_e \right\}. \end{aligned} \end{equation} If and only if $\delta \ge E^{\text{sav}} + F(b-1)$, the un-offloading action is optimal. Thus $\omega(1,b) = E^{\text{sav}} + F(b-1)$ when $1 < b \le k$. \item If $ b > k $, the Bellman equation is stated as \begin{equation} \begin{aligned} V(1,b) = \max\left\{\delta - F(b-1) + \beta V_e, \right. \\ \left. E^{\text{sav}} - F(b-k) + \beta V_e \right\}. \end{aligned} \end{equation} If and only if $\delta \ge E^{\text{sav}} + F(b-1) -F(b-k)$, the un-offloading action is optimal. Thus \begin{equation} \omega(1,b) = E^{\text{sav}} + F(b-1) -F(b-k). \end{equation} \end{enumerate} Thus the WI for $\tau=1$ exists, and the closed form is given by \begin{equation} \omega(1,b) = \begin{cases} 0, & \mbox{if } b = 0; \\ E^{\text{sav}} & \mbox{if } b = 1; \\ E^{\text{sav}} + F(b-1), & \mbox{if } 1 < b \le k; \\ E^{\text{sav}} + F(b-1) - F(b-k) & \mbox{if } b > k; \\ \end{cases} \label{WI when tau = 1} \end{equation} \end{enumerate} Now we are ready to show the $\frac{ \partial h^{\delta}(\tau,b)}{ \partial \delta} \ge -1 $ holds when $\tau = 1$. \begin{enumerate} \item If $b = 0$, $h(1,0)=V(1,k-1)-V(1,0)$, we have \begin{equation} h(1,0) = \begin{cases} E^{\text{sav}}, & \mbox{if } \omega < 0; \\ E^{\text{sav}}-\delta, & \mbox{if } 0 \le \delta < \omega(1,k-1); \\ -F(k-2), & \mbox{if } \delta \ge \omega(1,k-1). \end{cases} \end{equation} \item If $b = 1$, $h(1,1)=V(1,k)-V(1,1)$, we have \begin{equation} h(1,1) = \begin{cases} 0, & \mbox{if } \delta < \omega(1, 1); \\ E^{\text{sav}} - \delta, & \mbox{if } \omega(1, 1) \le \delta < \omega(1, k); \\ -F(k-1), & \mbox{if } \delta \ge \omega(1,k). \end{cases} \end{equation} \item If $2 \le b \le k$, $h(1,b)=V(1,b + k - 1)-V(1,b)$, we have \begin{equation} h(1,b) = \begin{cases} -F(b-1), \\ \hspace{0.3cm} \mbox{if } \delta < \omega(1, b + k -1); \\ E^{\text{sav}} - \delta, \\ \hspace{0.3cm} \mbox{if } \omega(1,b) \le \delta < \omega(1, b + k -1); \\ -F(b+k-2)+F(b-1), \\ \hspace{0.3cm} \mbox{if } \delta \ge \omega(1,b). \end{cases} \end{equation} \item If $b > k$, $h(1,b)=V(1,b + k - 1)-V(1,b)$, we have \begin{equation} h(1,b) = \begin{cases} -F(b-1)+F(b-k), \\ \hspace{0.3cm} \mbox{if } \delta < \omega(1,b); \\ E^{\text{sav}} - \delta, \\ \hspace{0.3cm} \mbox{if } \omega(1,b) \le \delta < \omega(1, b + k -1); \\ -F(k+b-2)+F(b-1), \\ \hspace{0.3cm} \mbox{if } \delta \ge \omega(1, b + k -1). \end{cases} \end{equation} \end{enumerate} Therefore, the derivation of $h(1,b)$ on $\delta$ always guarantees that $\frac{\partial h(1,b)}{\partial\delta} \ge -1$, which implies the indexability holds when $\tau=1$. Then, we show the property of $h(\tau,b)$ holds when $\tau=t$ under the assumption that $\frac{\partial h(\tau,b)}{\partial \delta} \ge -1$ when $\tau = t-1$. \begin{enumerate} \item If $b=0$, \begin{equation} h(\tau,0) = \begin{cases} E^{\text{sav}}, \hspace{0.3cm} \mbox{if } \delta < 0; \\ E^{\text{sav}}-\delta, \\ \hspace{0.3cm} \mbox{if } 0 \le \delta < \omega(\tau,k-1); \\ \beta \left[V(\tau-1,k-2) - V(\tau-1,0) \right], \\ \hspace{0.3cm} \mbox{if } \delta \ge \omega(\tau,k-1). \end{cases} \end{equation} For the first two cases, it is clearly shown that the gradient of $h(\tau,b)$ with respect to $\delta$ is larger or equal than $-1$. For the third case, we can further expand it by comparing the value of $\delta$ and $\omega(\tau-t^{\prime}, k - t^{\prime}-1)$. Whenever there is a time step $t^{\prime}$ such that $\delta \le \omega(\tau-t^{\prime}, k - t^{\prime}-1)$, $\exists 2 \le t^{\prime} \le \tau$, $h(\tau,0) = \beta^{t^{\prime}} \left(E^{\text{sav}} - \omega \right)$ whose gradient is $-\beta^{t^{\prime}} \ge -1$. On the other hand, if there is no such time step, $h(\tau,0)$ will be calculated by its penalty term whose gradient in terms of $\omega$ is zero. \item If $ 1 \le b \le k$, $h(\tau,b) = V(\tau,b + k -1)-V(\tau,b)$, we have \begin{equation} h(\tau,b) = \begin{cases} \beta \left[V(\tau-1, b-1) - V(\tau-1, 0)\right], \\ \hspace{0.3cm} \mbox{if } \delta <\omega(\tau,b); \\ E^{\text{sav}}-\delta, \\ \hspace{0.3cm} \mbox{if } \omega(\tau,b) \le \delta < \omega(\tau,b + k -1); \\ \beta h\left(\tau-1, b-1\right) \\ \hspace{0.3cm} \mbox{if } \delta \ge \omega(\tau,b+ k -1). \end{cases} \end{equation} For the first case, a similar analysis as the third case in $b=0$ can be carried out here and we have $\frac{\partial h(\tau,b)}{\partial \delta}\ge -1$ as well. Since we have $\frac{\partial h(\tau-1,b-1)}{\partial \delta}\ge -1$ for all $b$ by assumption, we have $\frac{\partial h(\tau,b)}{\partial \delta}\ge -1$ here as well. \item If $ b > k$, $h(\tau,b) = V(\tau,b + k -1)-V(\tau,b)$, we have \begin{enumerate} \item If $\omega(\tau,b + k - 1) > \omega(\tau,b)$, we have \begin{equation} h(\tau,b) = \begin{cases} \beta h(\tau-1, b-k), \\ \hspace{0.3cm} \mbox{if } \delta<\omega(\tau,b); \\ E^{\text{sav}}-\delta, \\ \hspace{0.3cm} \mbox{if } \omega(\tau,b) \le \delta < \omega(\tau,b + k -1); \\ \beta h(\tau-1, b-1), \\ \hspace{0.3cm} \mbox{if } \delta \ge \omega(\tau,b+ k -1). \end{cases} \end{equation} \item If $\omega(\tau,b + k - 1) \le \omega(\tau,b)$, we have \begin{equation} h(\tau,b) = \begin{cases} \beta h(\tau-1, b-k), \\ \hspace{0.3cm} \mbox{if } \delta < \omega(\tau,b + k - 1); \\ \delta - E^{\text{sav}} + \beta \left[h(\tau-1, b - 1) \right. \\ \left. + h(\tau-1, b - k)\right], \hspace{0.3cm} \\ \hspace{0.3cm} \mbox{if } \omega (\tau,b+1) \le \delta < \omega(\tau,b); \\ \beta h(\tau-1, b-1), \\ \hspace{0.3cm} \mbox{if } \delta \ge \omega(\tau,b). \end{cases} \end{equation} \end{enumerate} \end{enumerate} Since $\frac{\partial h(\tau-1,b-1)}{\partial \omega}\ge -1$ for all $b$ by assumption, we have $\frac{\partial h(\tau,b)}{\partial \omega}\ge -1$ in all cases. Thus, the indexability of the RMAB can be established. \end{proof} \section{Proof Of Theorem 2} \begin{proof} In this section, we derived the closed form of the WI by induction. Since the case for $\tau = 0$ and $\tau=1$ have been proved during the indexability prove, we start from $\tau = 2$ from here. \begin{enumerate} \item $\tau = 2$: there are four cases. \begin{enumerate} \item If $b = 0$, the Bellman equation is stated as \begin{equation} V(2,0) = \max\left\{\delta+\beta V(1,0), \beta V(1,0) \right\}. \end{equation} It is same as the case $\tau=0, b=0$, therefore, $\omega(2,0) = 0$. \item If $b = 1$, the Bellman equation is stated as \begin{equation} V(2,b) = \max\left\{\delta + \beta V(1,0), E^{\text{sav}}+\beta V(1,0) \right\}. \end{equation} If and only if $\delta \ge E^{\text{sav}}$, the un-offloading action is optimal. Thus $\omega(2,1) = E^{\text{sav}}$. \item If $ 1 < b \le k$, the Bellman equation is stated as \begin{equation} V(2,b) = \max\left\{\delta + \beta V(1,b-1), E^{\text{sav}} +\beta V(1,0) \right\}. \end{equation} The difference between actions is \begin{equation} \begin{aligned} g(2, b) & = \delta - E^{\text{sav}} + \beta \left[V(1,b-1) - V(1,0)\right] \\ & = \begin{cases} \delta - E^{\text{sav}} + \beta E^{\text{sav}} \\ \hspace{0.3cm} \mbox{if } \delta<0; \\ \delta - E^{\text{sav}} + \beta \left(E^{\text{sav}} - \delta \right), \\ \hspace{0.3cm} \mbox{if } 0 \le \delta \le \omega(1, b-1) ; \\ \delta - E^{\text{sav}} - \beta F(b-2), \\ \hspace{0.3cm} \mbox{if } \delta > \omega(1, b-1); \\ \end{cases} \end{aligned} \end{equation} The difference equals $0$ when $\delta = E^{\text{sav}} $. Thus $\omega(2,b) = E^{\text{sav}}$ when $ 1 < b \le k$. \item If $ b = k + 1$, the Bellman equation is stated as \begin{equation} V(2,k + 1) = \max\left\{\delta +\beta V(1,k), E^{\text{sav}} +\beta V(1,1) \right\}. \end{equation} The difference between actions is \begin{equation} \begin{aligned} g(2, k + 1) & = \delta - E^{\text{sav}} + \beta \left[V(1,k) - V(1,1)\right] \\ & = \begin{cases} \delta - E^{\text{sav}}, \\ \hspace{0.3cm} \mbox{if } \omega< \omega(1,1); \\ \delta - E^{\text{sav}} + \beta \left(E^{\text{sav}} - \delta \right), \\ \hspace{0.3cm} \mbox{if } \omega(1,1) \le \delta \le \omega(1, k); \\ \delta - E^{\text{sav}} - \beta F(k -1), \\ \hspace{0.3cm} \mbox{if }\delta > \omega(1, k); \\ \end{cases} \end{aligned} \end{equation} The difference equals $0$ when $\delta = E^{\text{sav}}$. Thus $\omega(1,b) = E^{\text{sav}} $ when $ b = k+1$. \item If $k + 1 < b \le 2k $, the Bellman equation is stated as \begin{equation} \begin{aligned} V(1,b) = \max\left\{\delta+\beta V(1,b-1), \right. \\ \left. E^{\text{sav}} + \beta V(1,b-k) \right\}. \end{aligned} \end{equation} The difference between actions is \begin{equation} \begin{aligned} g(2, b) & = \delta - E^{\text{sav}} + \beta \left[V(1,b-1) - V(1,b-k)\right] \\ & = \begin{cases} \delta - E^{\text{sav}} + \beta \left[- F(b-k-1)\right] \\ \hspace{0.3cm} \mbox{if } \delta <\omega(1, b-k); \\ \delta - E^{\text{sav}} + \beta \left[E^{\text{sav}} - \delta \right], \\ \hspace{0.3cm} \mbox{if } \omega(1, b - k) \le \delta \le \omega(1, b - 1) ; \\ \delta - E^{\text{sav}} + \beta \left[-F(b-2) + F(b-k-1)\right], \\ \hspace{0.3cm} \mbox{if } \delta > \omega(1, b-1); \\ \end{cases} \end{aligned} \end{equation} The difference equals $0$ when $\delta = E^{\text{sav}} + \beta \left[ F(b-k-1)\right]$. Thus $\omega(2, b) = E^{\text{sav}} + \beta \left[ F(b-k-1)\right] $ when $ k + 1 < b \le 2k $. \item If $b > 2k $, the Bellman equation is stated as \begin{equation} \begin{aligned} V(1,b) = \max\left\{\delta + \beta V(1,b-1), E^{\text{sav}} +\beta V(1,b-k) \right\}. \end{aligned} \end{equation} The difference between actions is \begin{equation} \begin{aligned} g(2, b) & = \delta - E^{\text{sav}} + \beta \left[V(1,b-1) - V(1,b-k)\right] \\ & = \begin{cases} \delta - E^{\text{sav}} + \beta \left[-F(b-k-1) + F(b-2k)\right], \\ \hspace{0.3cm} \mbox{if } \delta <\omega(1, b-k); \\ \omega - E^{\text{sav}}+ \beta \left[E^{\text{sav}}- \delta \right], \\ \hspace{0.3cm} \mbox{if } \omega(1, b-k) \le \delta < \omega(1, b - 1) ; \\ \omega - E^{\text{sav}} + \beta \left[-F(b-2) + F(b-k-1)\right], \\ \hspace{0.3cm} \mbox{if } \delta \ge \omega(1, b - 1); \\ \end{cases} \end{aligned} \end{equation} The difference equals $0$ when $\delta = E^{\text{sav}} + \beta\left[F(b-k-1) - F(b-2k)\right]$. Thus $\omega(1,b) = E^{\text{sav}} + \beta\left[F(b-k-1) - F(b-2k)\right]$ when $ b > 2k $. \end{enumerate} Thus the WI for $\tau=2$ exists, and the closed form is calculated as \begin{equation} \omega(2,b) = \begin{cases} 0, \hspace{1.5cm} \mbox{if } b = 0; \\ E^{\text{sav}}, \hspace{1.1cm} \mbox{if } 1 \le b \le k + 1; \\ E^{\text{sav}} + \beta \left[ F(b-k-1)\right], \\ \hspace{0.3cm} \mbox{if } k + 1 < b \le 2 k; \\ E^{\text{sav}} + \beta\left[F(b-k-1) - F(b-2k)\right] \\ \hspace{0.3cm} \mbox{if } b > 2 k; \\ \end{cases} \end{equation} \end{enumerate} Next we show the closed-form of the WI for the case of $\tau \ge 3$, assuming (1) holds for $\tau-1$. \begin{enumerate} \item If $b = 0$, the Bellman equation is stated as \begin{equation} V(\tau,0) = \max\left\{\delta + \beta V(\tau-1,0), \beta V(\tau-1,0) \right\}. \end{equation} Therefore, $\omega(\tau,0) = 0$. \item If $b= 1$, the Bellman equation is stated as \begin{equation} \begin{aligned} V(\tau,1) = \max\left\{\delta + \beta V\left(\tau-1,0\right), E^{\text{sav}}+\beta V\left(\tau-1, 0 \right) \right\}. \end{aligned} \end{equation} Thus $\omega(\tau,1) = E^{\text{sav}}$. \item If $ 2 \le b \le k$, the Bellman equation is stated as \begin{equation} \begin{aligned} V(\tau,b) = \max\left\{\omega + \beta V\left(\tau-1,b-1\right), \right. \\ \left. E^{\text{sav}}+\beta V\left(\tau - 1, 0 \right) \right\}. \end{aligned} \end{equation} The difference between actions is: \begin{equation} \begin{aligned} g(\tau,b) & = \delta - E^{\text{sav}} + \beta \left[V(\tau-1, b-1) - V(\tau-1, 0)\right] \\ & = \begin{cases} \delta - E^{\text{sav}} + \beta^2 E^{\text{sav}}, \\ \hspace{0.3cm} \mbox{if } \delta < 0; \\ \delta - E^{\text{sav}} + \beta \left[E^{\text{sav}} - \delta \right], \\ \hspace{0.3cm} \mbox{if } 0 \le \delta \le \omega(\tau-1, b - 1); \\ \omega - E^{\text{sav}} + \beta^2 \left[V(\tau-2, b-2) - V(\tau-2, 0)\right] \\ \hspace{0.3cm} \mbox{if } \delta > \omega(\tau-1, b - 1); \\ \end{cases} \end{aligned} \end{equation} The difference equals $0$ when $\delta = E^{\text{sav}}$. Thus $\omega(\tau,b) = E^{\text{sav}}$ when $ 2 \le b \le k$. \item If $ k < b \le k (\tau-2) + 2$, the Bellman equation is stated as \begin{equation} \begin{aligned} V(\tau, b) = \max\left\{\delta+\beta V\left(\tau-1,b-1\right), E^{\text{sav}} + \beta V\left(\tau-1,b-k\right) \right\}. \end{aligned} \end{equation} The difference between actions is \begin{equation} \begin{aligned} g(\tau,b) & = \delta - E^{\text{sav}} + \beta \left[V\left(\tau-1,b-1\right)- V\left(\tau-1,b-k\right)\right] \\ & = \begin{cases} \delta - E^{\text{sav}} + \beta^2 \left[V\left(\tau-2,b-1-k\right)- \right. \\ \left. V\left(\tau-1,(b-2 k)^{+}\right)\right], \hspace{0.5cm} \mbox{if } \delta < E^{\text{sav}}; \\ \delta - E^{\text{sav}} + \beta^2 \left[V\left(\tau-2,b-2\right)- \right. \\ \left. V\left(\tau-2,b- k -1\right)\right], \hspace{0.5cm} \mbox{if } \delta \ge E^{\text{sav}}; \\ \end{cases} \end{aligned} \end{equation} Since we have $\omega(\tau-1, b - k -1) = E^{\text{sav}}$ when $1 \le b - k -1 \le k(\tau-2) + 1$ So $\omega(\tau,b) = E^{\text{sav}}$ when $b= k+1$. \item If $ k (\tau-2) + 2 < b \le k (\tau-1) + 1$, the Bellman equation is stated as \begin{equation} \begin{aligned} V(\tau, b) = \max\left\{\delta+\beta V\left(\tau-1,b-1\right), \right. \\ \left. E^{\text{sav}}+\beta V\left(\tau-1,b-k\right) \right\}. \end{aligned} \end{equation} Therefore, the difference between actions is \begin{equation} \begin{aligned} g(\tau,b) & = \delta - E^{\text{sav}} + \beta \left[V\left(\tau-1,b-1\right)- V\left(\tau-1,b-k\right)\right] \\ & = \begin{cases} \delta - E^{\text{sav}} + \beta^2 \left[V\left(\tau-2,b-1-k\right)- \right. \\ \left. V\left(\tau-1,(b-2 k)\right)\right], \hspace{0.3cm} \mbox{if } \delta < \omega(\tau-1, b - k); \\ \delta - E^{\text{sav}} + \beta \left[\delta - E^{\text{sav}}\right] \\ \hspace{0.3cm} \mbox{if } \omega(\tau-1, b - k) \le \delta < \omega(\tau-1, b-1); \\ \delta - E^{\text{sav}} + \beta^2 \left[V\left(\tau-2,b-2\right)- \right. \\ \left. V\left(\tau-2,b- k -1\right)\right], \hspace{0.3cm} \mbox{if } \delta \ge \omega(\tau-1, b-1); \\ \end{cases} \end{aligned} \end{equation} It equals $0$ when $\delta = E^{\text{sav}}$. Thus $\omega (\tau,b) = E^{\text{sav}}$ when $ k (\tau-2) + 2 < b \le k (\tau-1) + 1$. \item If $ k(\tau-1)+2 \le b \le k \tau$, the Bellman equation is stated as \begin{equation} \begin{aligned} V(\tau, b) = \max\left\{\delta +\beta V\left(\tau-1,b-1\right), \right. \\ \left. E^{\text{sav}}+\beta V\left(\tau-1,b-k\right) \right\}. \end{aligned} \end{equation} Therefore, the difference between actions is \begin{equation} \begin{aligned} g(\tau,b) & = \delta - E^{\text{sav}} + \beta \left[V\left(\tau-1,b-1\right)- V\left(\tau-1,b-k\right)\right] \\ & = \begin{cases} \delta - E^{\text{sav}} + \beta^2 \left[V\left(\tau-2,b-1-k\right)- \right. \\ \left. V\left(\tau-2,b-2 k\right)\right], \hspace{0.3cm} \mbox{if } \omega < \omega(\tau-1, b-k); \\ \delta - E^{\text{sav}} + \beta \left[\delta - E^{\text{sav}}\right] \\ \hspace{0.3cm} \mbox{if } \omega(\tau-1, b - k) \le \delta < \omega(\tau-1, b-1); \\ \delta - E^{\text{sav}} + \beta^2 \left[V\left(\tau-2,b-2\right)- \right. \\ \left. V\left(\tau-2,b- k -1\right)\right], \hspace{0.3cm} \mbox{if } \delta \ge \omega(\tau-1, b-1); \\ \end{cases} \end{aligned} \label{18} \end{equation} In the first case since $\delta < \omega(\tau-1, b-k)$, according to the equation \begin{equation} \begin{aligned} \delta & < \omega(\tau-1 -\tau^{\prime}, b-k-k\tau^{\prime}) \\ & < \omega(\tau-1-\tau^{\prime}, b-1-k\tau^{\prime}), \end{aligned} \end{equation} the difference can be further written as \begin{equation} \begin{aligned} & \delta - E^{\text{sav}} + \beta^2 \left[V\left(\tau-2,b-1-k\right)- V\left(\tau-2,b-2 k\right)\right] \\ & = \delta - E^{\text{sav}} + \beta^2 \left[V\left(\tau-3,b-1-2k\right)- V\left(\tau-3,b-3 k\right)\right] \\ & = \cdots \\ & = \delta - E^{\text{sav}} - \beta^{\tau-1} \left[F(b - (\tau-1)k -1)\right]. \end{aligned} \end{equation} Therefore, when $\delta = E^{\text{sav}} + \beta^{\tau-1} \left[F(b-(\tau-1)k-1)\right]$, the first case in \eqref{18} equals $0$. Accordingly, when $k(\tau-1)+2 \le b \le k \tau$, the WI is calculated as: \begin{equation} \omega(\tau, b) = E^{\text{sav}} + \beta^{\tau-1} \left[F(b-(\tau-1)k-1)\right] \end{equation} \item If $ b \ge k\tau + 1$, \begin{equation} \begin{aligned} V(\tau, b) = \max\left\{\delta+\beta V\left(\tau-1,b-1\right), \right. \\ \left. E^{\text{sav}}+\beta V\left(\tau-1,b-k\right) \right\}. \end{aligned} \end{equation} Therefore, the difference between actions is \begin{equation} \begin{aligned} g(\tau,b) & = \delta - E^{\text{sav}} + \beta \left[V\left(\tau-1,b-1\right)- V\left(\tau-1,b-k\right)\right] \\ & = \begin{cases} \delta - E^{\text{sav}} + \beta^2 \left[V\left(\tau-2,b-1-k\right)- \right. \\ \left. V\left(\tau-2,b-2 k\right)\right], \hspace{0.3cm} \mbox{if } \delta < \omega(\tau-1, b-k); \\ \delta - E^{\text{sav}} + \beta \left[\delta - E^{\text{sav}}\right] \\ \hspace{0.3cm} \mbox{if } \omega(\tau-1, b-k) \le \delta < \omega(\tau-1, b-1); \\ \delta - E^{\text{sav}} + \beta^2 \left[V\left(\tau-2,b-2\right)- \right. \\ \left. V\left(\tau-2,b- k -1\right)\right], \hspace{0.3cm} \mbox{if } \delta \ge \omega(\tau-1, b-1); \\ \end{cases} \end{aligned} \label{19} \end{equation} Similar with the previous case, the difference equals $0$ when $\delta = E^{\text{sav}} + \beta^{\tau-1} \left[F(b-(\tau-1)k+1) + F(b - k\tau)\right].$ Accordingly, when $b \ge k \tau + 1$, the WI is calculated as: \begin{equation} \omega(\tau, b) = E^{\text{sav}} + \beta^{\tau-1} \left[F(b-(\tau-1)k-1) + F(b - k\tau)\right] \end{equation} \end{enumerate} Therefore, the closed-form expression for the WI (17) holds. \end{proof} \section{Proof of Theorem 3} To prove Theorem 3, for any given offloading scheduling policy that violates the STLW rule, we construct an updated policy that meets the STLW rule. Then we need to show that this updated policy can increase the reward, compared with the original one. Assume that the $i$-th user has priority over the $j$-th user based on the STLW rule at the $t^{\prime}$-th time slot with the system state ${\bf{S}}_t^{\prime}$. Let $\Gamma \triangleq \max \left\{\tau_{i,t}, \tau_{j,t}\right\} - 1$, assume we have a policy $\mathcal{G} = \left\{{\bf{u}}_{t^{\prime}}, {\bf{u}}_{t^{\prime}+1}, \ldots, {\bf{u}}_{t^{\prime} + \Gamma} \right\}$ violates the STLW rule and selects the $j$-th user instead of the $i$-th user at the $t^{\prime}$-th time slot. Then we construct an updated policy $\tilde{\mathcal{G}} = \left\{{\bf{\tilde{u}}}_{t^{\prime}}, {\bf{\tilde{u}}}_{{t^{\prime}}+1}, \ldots, {\bf{\tilde{u}}}_{t^{\prime} + \Gamma} \right\}$ as follows. \begin{enumerate} \item At the ${t^{\prime}}$-th time slot, $\tilde{\mathcal{G}}$ selects the $i$-th user instead of $j$. That is, ${\bf{\tilde{u}}}_{t^{\prime}}$ is same as ${\bf{u}}_{t^{\prime}}$ except that its $i$-th component is $1$ and the $j$-th component is $0$. \item Denote the set of time slots that the policy $\mathcal{G}$ selects the $i$-th user instead of the $j$-th user after the $t^{\prime}$-th time slot by ${\Pi}\left(t\right) \subseteq \left\{{t^{\prime}}+1, \ldots, \min \left\{d_i, d_j\right\}-1\right\}$. \begin{itemize} \item If the set ${\Pi}\left(t\right)$ is empty, let $\tilde{\mathcal{G}}$ take the same actions as the $\mathcal{G}$ in the following time slot, that is, ${\bf{\tilde{u}}}_q = {\bf{u}}_q$, for $k = t^{\prime}+1, \ldots, t^{\prime}+ \Gamma$. \item If the set ${\Pi}\left(t\right)$ is not empty, denote the minimal time slot of the set by $t_{\min}$. For the time slots $q = t^{\prime}+1, \ldots, t_{\min}-1$, let ${\bf{\tilde{u}}}_q = {\bf{u}}_q$. However, at the $t_{\min}$-th time slot, the new policy $\mathcal{\tilde{G}}$ selects the $j$-th user instead of $i$. That is, ${\bf{\tilde{u}}}_{t^{\prime}}$ is the same as ${\bf{u}}_{t^{\prime}}$ except that the $j$-th component is $1$ and the $i$-th component is $0$. \end{itemize} \label{Definition: STLW Interchaning Policy} \end{enumerate} Take a closer look between policies $\mathcal{G}$ and $\mathcal{\tilde{G}}$, after the $t^{\prime}$-th time slot, we can always find a sequence $\left\{{\bf{\bar{S}}}_k \right\}_{q=t^{\prime}+1}^{t^{\prime}+\Gamma}$ in $\mathcal{\tilde{G}}$ as a comparison to the sequence $\left\{{\bf{S}}_k \right\}_{q=t^{\prime}+1}^{t^{\prime}+\Gamma}$ in $\mathcal{G}$, which satisfies the following condition: \begin{itemize} \item If the set $\Pi(t)$ is empty, then we have $\left\{{\bf{\bar{S}}}_q \right\}_{q=t^{\prime}+1}^{t^{\prime}+\Gamma} = \left\{{\bf{S}}_q \right\}_{q=t^{\prime}+1}^{t^{\prime}+\Gamma}$. \item Otherwise, we have \begin{equation} \left\{{\bf{\bar{S}}}_q \right\}_{q=t^{\prime}+1}^{t^{\prime}+\Gamma} = \left\{{\bf{\bar{S}}}_{t^{\prime} + 1}, \ldots, {\bf{\bar{S}}}_{t_{\min}}, {\bf{{S}}}_{t_{\min}+1}, \ldots, {\bf{{S}}}_{t_{\prime} + \Gamma} \right\}, \end{equation} \end{itemize} where $t_{\min}$ is the minimal time slot in the set $\Pi(t)$. Since two policies $\mathcal{G}$ and $\tilde{\mathcal{G}}$ always select an equal number of users to perform offloading and will be identical after the $\left(t^{\prime} + \Gamma\right)$-th time slot. Therefore, to arrive at the result in Theorem 3, we only need to show that \begin{equation} \begin{aligned} R\left( {{\bf{S}}_t}, {\bf{u}}_t\right) & + \sum_{q = t^{\prime}+1}^{t^{\prime}+\Gamma} R\left( {\bf{S}}_q, {\bf{u}}_q\right) \\ & \le R\left( {{\bf{S}}_t}, {\bf{\tilde{u}}}_t\right) + \sum_{q = t^{\prime}+1}^{t^{\prime}+\Gamma} R\left( {\bf{\tilde{S}}}_q, {\bf{\tilde{u}}}_q\right). \end{aligned} \label{eq: modified SLSW difference} \end{equation} To verify \eqref{eq: modified SLSW difference}, we consider the following two cases. \begin{enumerate} \item When the set ${\Pi}\left(t\right)$ is not empty, for every pair of system state sequence, $\left\{{\bf{S}}_q \right\}_{q=t^{\prime}}^{t^{\prime} + \Gamma}$ and $\left\{{\bf{\bar{S}}}_q \right\}_{q=t^{\prime}}^{t^{\prime} + \Gamma}$, both policies will result in the same result, i.e., the equality holds in \eqref{eq: modified SLSW difference}. \item When the set ${\Pi}\left(t\right)$ is empty. Whenever the policy $\mathcal{G}$ selects the $i$-th user, it must also select the $j$-th user, for $q = t^{\prime}+1, \ldots, \min \left\{d_i, d_j\right\}-1$. Denote the remaining workload of the $i$-th user after its deadline by $\delta_i$ under the policy $\mathcal{G}$. Similarly, $\tilde{\delta}_i$ is the remaining workload under the policy $\mathcal{\tilde{G}}$. Since the $i$-th user has priority over the $j$-th user at system state ${\bf{S}}_{t^{\prime}}$, it implies that $\tilde{\delta}_i = \delta_i -1$ and $\tilde{\delta}_j = \delta_j + 1$ (according to the Definition \ref{Definition: STLW Interchaning Policy}). Therefore, we have the reward difference under two policies calculated as \begin{equation} \begin{aligned} & V_{\tilde{\mathcal{G}}}^{t^{\prime}+\Gamma} - V_{{\mathcal{G}}}^{t^{\prime}+\Gamma} \\ & = \alpha \left\{- F(\tilde{\delta}_i) - F(\tilde{\delta}_j) - \left[- F(\delta_j) - F(\delta_i)\right] \right\} \\ & = \alpha \left\{ \left[{\delta}_i^2 - \tilde{\delta}_i^2 + {\delta}_j^2 - \tilde{\delta}_j^2 \right] \right\} \\ & = 2 \alpha \left(\delta_j - \delta_i\right) - 2 \end{aligned} \label{eq: reward difference} \end{equation} Note that according to the STLW rule, we have $0 \le \delta_i < \delta_j$, where both $\delta_i$ and $\delta_j$ are integers. Therefore, when $\alpha \ge 1$ (i.e. focus on task completion), this reward difference is always no less than 0, which implies that the constructed policy $\mathcal{\tilde{G}}$ can achieve more rewards than the original policy $\mathcal{G}$. \end{enumerate}
{'timestamp': '2020-12-17T02:08:18', 'yymm': '2012', 'arxiv_id': '2012.08718', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08718'}
arxiv
\section{Introduction} Neural Machine Translation (NMT) \cite{Bahdanau2015} has achieved state of the art in various MT systems, including rich and low resource language pairs \cite{Edunov2018, Gu2019, ngo2019}. However, the quality of low-resource MT is quite unpretentious due to the lack of parallel data while it has achieved better results on systems of the available resource. Therefore, low-resource MT is one of the essential tasks investigated by many previous works \cite{ Ha2016, Lee2016, senrich2019}. Recently, some works present MT systems that have achieved remarkable results for low-resource language \cite{Gu2019, Roee2020}. Inspired by these works, we collect data from the TED Talks domain, then attempt to build multilingual MT systems from French, English-Vietnamese. Experiments demonstrate that both language pairs: French-Vietnamese and English-Vietnamese have achieved significant performance when joining the training. Although multilingual MT can reduce the sparse data in the shared space by using word segmentation, however, rare words still exist, evenly they are increased more if languages have a significant disparity in term vocabulary. Previous works suggested some strategies to reduce rare words such as using translation units at sub-word and character levels or generating a universal representation at the word and sentence levels \cite{ Lee2016, Gu2019}. These help to downgrade the dissimilarity of tokens shared from various languages. However, these works require learning additional parameters in training, thus increasing the size of models. Our paper presents two methods to augment the translation of rare words in the source space without modifying the architecture and model size of MT systems: (1) exploiting word similarity. This technique has been mentioned by previous works \cite{luong2015, Li2016, trieu, ngo2019}. They employ monolingual data or require supervised resources like a bilingual dictionary or WordNet, while we leverage relation from the multilingual space of MT systems. (2) Adding a scalar value to the rare word embedding in order to facilitate its translation in the training process. Due to the fact that NMT tends to have bias in translating frequent words, so rare words (which have low frequency) often have less opportunity to be considered. Our ideal is inspired by the works of \cite{Toan2017, ngo2019, Gu2019}. \cite{Toan2017} and \cite{ngo2019} proposed various solutions to urge for translation of rare words, including modification embedding in training. They only experimented with recurrent neural networks (RNNs) while our work uses the state-of-the-art transformer architecture. \cite{Gu2019} transforms the word embedding of a token into the universal space, and they learn plus parameters while our method does not. We apply our strategies in our fine-tuning processes, and we show substantial improvements of the systems after some epochs only. Monolingual data are widely used in NMT to augment data for low-resource NMT systems \cite{Sennrich2015, zhang2016,lample2018unsupervised, wu2019, siddhant2020leveraging}. Back-translation \cite{Sennrich2015} is known as the most popular technique in exploiting target-side monolingual data to enhance the translation systems while the self-learning method \cite{zhang2016} focuses on utilizing source-side monolingual data. Otherwise, the dual-learning strategy \cite{wu2019} also suggests using both source- and target-side monolingual data to tackle this problem. Our work investigates the self-learning method \cite{zhang2016} on the low-resource multilingual NMT systems specifically related to Vietnamese. Besides, monolingual data are also leveraged in unsupervised\cite{lample2018unsupervised} or zero-shot translation\cite{lample2018unsupervised}. The main contributions of our work are: \vspace*{-0.2cm} \begin{itemize} \setlength{\itemsep}{0pt} \item We first attempt to build a multilingual system for two low-resource language pairs: French-Vietnamese and English-Vietnamese. \item We propose two simple techniques to encourage the translation of rare words in multilingual MT to upgrade the systems. \item We investigate the quality translation of the low-resource multilingual NMT systems when they are reinforced synthetic data. \item We release more datasets extracted from the TED Talks domain for the research purpose: French-Vietnamese and English-Vietnamese. \end{itemize} In section 2, we review the transformer architecture used for our experiments. The brief of multilingual translation is shown in section 3. Section 4 presents our methods to deal with rare words in multilingual translation scenarios. The exploitation of monolingual data for low-resource multilingual MT is discussed in section 5. Our results are described in section 6, and related work is shown in section 7. Finally, the paper ends with conclusions and future work. \section{Transformer-based NMT} Transformer architecture for machine translation is mentioned for the first time by \cite{Vaswani2017}. This is based on the sequence to sequence framework \cite{Sutskever2014} which includes an encoder to transform information of the source sentence $X=(x_1, x_2,...,x_n)$ into continuous representation and a decoder to generate the target sentence $Y=(y_1,y_2,...,y_m)$. Self-attention is an important mechanism in the transformer architecture. It enables the ability to specify the relevance of a word with the remaining words in the sentence through the equation: \begin{equation} \begin{aligned} \text{Self-Attn}(\vect{Q},\vect{K},\vect{V}) =\text {Softmax} (\displaystyle \frac{\vect{Q}\vect{K}^T}{d}) \vect{V} \end{aligned} \label{eq:att} \end{equation} where \textit{K} (key),\textit{ Q} (query), \textit{V }(value) are the representations of the input sentence and \textit{d} is the size of the input. The attention mechanism \cite{Luong2015a} bridges between the source sentence in the encoder and the target sentence in the decoder. Furthermore, the feed-forward networks are used to normalize the outputs on both encoder and decoder. The MT system is trained to minimize the maximum likelihood of \textit{K} parallel pairs: \begin{equation} \begin{aligned} \mathcal{L} (\theta)= \frac{1}{K} \sum_{k=1}^{k=K} logp(Y^k|X^k; \theta) \end{aligned} \label{lagra} \end{equation} \section{Multilingual NMT} Multilingual NMT systems can translate between many language pairs, even in the zero-shot issue. Previous works investigate multilingual translation in many fashions: (1) Many to many \cite{Ha2016, Roee2020}: from many sources to many target languages; (2) Many to one \cite{Gu2019}: from many source languages to a target language; (3) One to many \cite{Wang2018}: from one source language to many target languages. In cases (1) and (3), an artificial token is often added to the beginning of the source sentence to specify the predicted target language. Our MT systems are the same as the case (2), so we do not add any artificial token to the texts. In a multilingual NMT system from many to one with $M$ language pairs and $K$ sentence pairs for each one, the objective function uses maximum likelihood estimation on the whole parallel pairs $\left\{ X^{(m,k)}, Y^{(m,k)}\right\} _{k=1..K}^{m=1...M} $ as: \begin{equation} \begin{aligned} \mathcal{L} (\theta)= \frac{1}{K} \sum_{m=1}^{m=M} \sum_{k=1}^{k=K} logp(Y^{(m,k)}|X^{(m,k)}; \theta) \end{aligned} \label{lagra} \end{equation} where $K=\sum_{m=1}^{m=M} K_m$ is the total number of sentences of the whole corpus. The vocabulary of the source side is mixed from all source languages: $V=\sum_{m=1}^{m=M} V_m$. \cite{Gu2019} has shown that if the languages shared the same alphabet and had many similar words, such system will get many advantages from multilingual MT. In fact, different words from many languages can differ in form, but they may share the same subwords. This significantly reduces the number of rare words in the MT systems. Nevertheless, the rare word issue is still a challenge in NMT. We choose English and French are source languages in our experiment with the hope that they can share many tokens even though we do not have much data of those translation directions. \section{Augmenting Rare Word Translation} \label{methods} \subsection{Learning multilingual word similarity} \label{ws} We assume that a rare word or rare token (which has a low frequency in the training data) from one source language may be similar to another word in a shared multilingual space. Similar words can belong to several languages and they can be replaced by the others. Our method replaces rare tokens with their similar tokens in shared space. The replacements are learned dynamically in the training NMT system. To avoid slowing down the training speed, we only compute similar tokens after each epoch. In the experiments, we attempt to replace rare tokens from French with similar tokens in English and French. Our method is described as follows: Firstly, we extract the lists of all tokens from the English - $\{A\}$ corpus, and the most \textit{k} common words from the vocabulary of the source side of the French - $\{B\}$. We set \textit{k=15} thousand words in the experiments. Secondly, we compute the similarity score between the embedding of a rare token $ t_i $, $ \forall t_i \notin \{ A \cup B \} $ and each embedding of the tokens $ t_j $, $ \forall t_j \in \{ A \cup B \} $ as follows: \begin{equation} \begin{aligned} score_i= min(d_j(\vect{e_i},\vect{e_j}) \cdot e^{\cos(\vect{e_i}, \vect{e_j})}) \end{aligned} \label{score} \end{equation} where $j=1..M$ with $M$ is the number of tokens of $ {A \cup B} $; \textit{d} is the Euclidean distance between embedding $e_i$ of token $t_i$ and embedding $e_j$ of token $t_j$. The last, the token $ t_i $ is replaced by its similar tokens. The scores are computed iteratively after each epoch during the training process. It may have more tokens similar to a rare token, so we experimentalize in the case of random selection a token from the similar tokens. To accrete the effectiveness of the method, we use a threshold to neglect similar pairs that have scores close to 0 or too large. In the experiments, we choose the scores in $[2.4, 2.72]$ to warrant similar pairs alike in terms of distance as well as direction. \subsection{Updating source embedding} \label{se} In this approach, we assume that the embedding $ e_i $ of token $t_i$, $ \forall t_i \notin \{ A \cup B \} $ is represented by the approximate embedding vector as following: \begin{equation} \begin{aligned} \vect{e_i}= \vect{e_i} + d \\ \end{aligned} \label{score} \end{equation} where $d$ is the difference between embedding $ e_i $ and the average of the all embeddings $ e_j $ of token $t_j$, $ \forall t_j \in \{ A \cup B \} $: \begin{equation} \begin{aligned} d = \vect{e_i} - \frac{\sum_{j=1}^{j=M} \vect{e_j}}{M} \end{aligned} \label{score} \end{equation} where M is the number of tokens of $ \{A \cup B \} $. These embeddings are then updated during the training. The average of embeddings is only estimated after each epoch to avoid slowing down the training speed. We observe the improvements in both language pairs in the experiments. \section{Exploiting monolingual data for low-resource multilingual NMT} \label{monolingual} Similar to the idea suggested in \cite{zhang2016}, we leverage monolingual data from the source-side to generate synthetic bilingual data. Instead of using monolingual data from all source languages, we only attempt to exploit monolingual data of English. Firstly, we train the multilingual NMT system from English, French $ \rightarrow $ Vietnamese based on bilingual data from the TED talks with the approaches mentioned in section \ref{methods}. The best system is then used to translate English to Vietnamese. Lastly, the synthetic parallel data are mixed with original bilingual data in the normal training scheme. \section{Experiments} \subsection{Datasets} We extracted data from TED Talks domain\footnote{\url{https://www.ted.com/}} for two language pairs English-Vietnamese and French-Vietnamese. The details of those datasets are described in Table \ref{tab1}. For the English-Vietnamese, we used standard datasets like {\tt tst2012} and {\tt tst2013} from \cite{cettolo2016iwslt} as dev and test sets for validation and evaluation. For French-Vietnamese, we separate a subset from collected data for the same purposes. \vspace{0.4cm} \begin{table} [h] \vspace*{-0.1cm} \centerline{ \begin{tabular}{|c|c|c|c|} \hline Datasets & Training & dev & test \\ \hline English-Vietnamese & 231K & 1553 & 1268 \\ \hline French-Vietnamese & 203K & 1007 & 1049 \\ \hline \end{tabular}} \caption{\label{tab1} {The bilingual datasets in our experiments}} \vspace*{-0.4cm} \end{table} \vspace{0.2cm} To generate synthetic bilingual data, we sampled 1.2 millions English monolingual sentences from the European Parliament English-French corpus\footnote{\url{https://www.statmt.org/europarl}}. After inferring from the multilingual MT system, we obtained two sets of pseudo bilingual data: English - Vietnamese, French - Vietnamese. \subsection{Preprocessing} English and French texts were tokenized and true-cased using Moses's scripts, and then they are applied to Sennrich's BPE \cite{Sennrich2016}. 30000 operators are learned to generate BPE codes for both languages. For Vietnamese texts, we only did tokenization and true-casing using Moses's scripts. We extracted a list of all tokens in English (A) and another list of the 15K most frequency of tokens in French (B). All lists were then used for the mentioned strategies in section~\ref{methods}. \subsection{Systems and Training} We implement our NMT systems using the framework {\tt NMTGMinor}\footnote{\url{https://github.com/quanpn90/NMTGMinor}}. The same settings are used for all experiments. The system includes 4 layers for both encoder and decoder, and the embedding size is 512. For the systems that adapted monolingual data, we use 6 layers. Adam optimizer is set with the initial learning rate at 1.0 for baseline and the multilingual systems and 0.5 for the fine-tuned systems. The size of a mini-batch is 128, and the vocabulary size is set to be the top 50K most frequent tokens. Training and development sets of both language pairs are concatenated prior to the training of our multilingual systems. We modified this framework to apply our ideals proposed in section \ref{methods}. To speed up the training, we compute the similarity scores and find out similar tokens for rare tokens or the mean of all tokens in $ \{ A \cup B \} $ after each epoch. We replace rare tokens or update their embeddings in each batch. We do not use these techniques for the decoding process, so the system's performance is not affected. The baseline and multilingual systems are trained for 70 epochs. Our methods are then used to fine-tune the systems for 15 epochs. We choose the five best models to decode the test sets independently for residual systems despite the baseline systems. The beam size is 10, and we try different values of \textit{alpha}: $0.2, 0.4, 0.8, 1.0$. Other settings are the default settings of {\tt NMTGMinor}. \subsection{Results} \begin{center} \begin{table*}[t] \vspace*{-0.1cm} {\small \hfill{} \begin{tabular}{|c|l|c|c|} \hline \textbf{Datasets} & \textbf{Systems} & \textbf{ dev} & \textbf{test} \\ \hline \multirow{5}{*}{English $\rightarrow$ Vietnamese} & Bilingual Baseline & 31.74 & 35.13 \\ \cline{2-4} & Multilingual & 31.66 (-0.08) & \textbf{36.18 (+1.05)}\\ \cline{2-4} & Multilingual + fine-tuning & \textbf{31.88 (+0.14)} & \textbf{36.56 (+1.43)} \\ \cline{2-4} & Multilingual + fine-tuning with similarity & \textbf{31.93 (+0.19)} & \textbf{36.75 (+1.62)} \\ \cline{2-4} & Multilingual + fine-tuning with updated embedding & \textbf{32.11 (+0.37)} & \textbf{36.74 (+1.61)}\\ \cline{2-4} & Multilingual + mixing pseudo bilingual data & 30.86 (-0.88) & 35.09 (-0.04) \\ \hline \hline \multirow{5}{*} { French $\rightarrow$ Vietnamese} & Bilingual Baseline & 23.07 & 23.03 \\ \cline{2-4} & Multilingual & \textbf{24.49 (+1.42)} & \textbf{24.22 (+1.19)} \\ \cline{2-4} & Multilingual + fine-tuning & \textbf{24.51 (+1.44)} & \textbf{24.86 (+1.83)} \\ \cline{2-4} & Multilingual + fine-tuning with similarity & \textbf{24.37 (+1.30)} & \textbf{24.70 (+1.63)} \\ \cline{2-4} & Multilingual + fine-tuning with updated embedding & \textbf{24.60 (+1.53)} & \textbf{24.96 (+1.93)} \\ \cline{2-4} & Multilingual + mixing pseudo bilingual data & \textbf{25.59 (+2.52)} & \textbf{25.57 (+2.54)} \\ \cline{2-4} & Pseudo bilingual data translation & 19.00 & 18.71 \\ \hline \end{tabular}} \hfill{} \caption{\label{tab2} {The results of our MT systems are measured in BLEU. We evaluate the best model for the baseline systems and the average scores on the five best models for the multilingual and pseudo systems.}} \end{table*} \end{center} We evaluate the quality of systems on two translation tasks: French to Vietnamese and English to Vietnamese, using on different approaches mentioned in previous sections. The {\tt multi-BLEU} from Moses's scripts\footnote{\url{https://github.com/moses-smt/mosesdecoder/tree/master/scripts}} is used. The results have shown in the Table~\ref{tab2}. \textbf{(1) Bilingual baseline systems.} We train the systems based on separate bilingual data of each language pair for 70 epochs. The best model is used to decode the test data for comparison purposes in our experiments. \textbf{(2) Multilingual systems.} We concatenate training and development sets in order to construct the new sets: French, English $\rightarrow$ Vietnamese, and then train the system using those data for the same number of epochs as for the baseline systems. We observe an improvement of +1.05 BLEU points on English $\rightarrow$ Vietnamese translation task and another one of +1.19 BLEU points on French $\rightarrow$ Vietnamese translation task compared to the baseline systems. \textbf{(3) Multilingual fine-tuning systems.} The multilingual system is fine-tuned from the baseline for further 15 epochs with an initial learning rate of 0.05. We see the improvements of +1.43 and +1.83 BLEU points on both translation tasks, respectively. \textbf{(4) Multilingual fine-tuning with similarity systems.} The systems from (2) are fine-tuned with the strategy mentioned in section \ref{ws} using the modified framework. We obtained a bigger gain of +1.62 BLEU points on the English $\rightarrow$ Vietnamese translation task whilst the French $\rightarrow$ Vietnamese translation task has achieved a lower improvement than the systems in (3). We show that the English $\rightarrow$ Vietnamese translation task has more advantages when rare tokens from French are replaced by similar tokens in the multilingual space. In the future, we would attempt the inverse replacement. \textbf{(5) Multilingual fine-tuning with updated embedding systems.} We use the modified framework to fine-tune the systems in (2) with the method mentioned in section \ref{se}. The greater improvements can be found at +1.61 and +1.93 on both translation tasks compared to the systems which do not use our methods. \textbf{(6) Multilingual with mixing of pseudo bilingual data.} We use 400K synthetic bilingual sentence pairs for each of the language pairs: English-Vietnamese and French-Vietnamese. We train the multilingual NMT system on a mix of pseudo and real bilingual data mentioned in section \ref{monolingual} for 50 epochs. And then it is fine-tuned on the actual parallel data for 20 epochs. We observed a bigger improvement of \textbf{+2.54} BLEU points on the French $\rightarrow$ Vietnamese system while the English $\rightarrow$ Vietnamese system has achieved less improvement compared to previous systems. We speculate that the English $\rightarrow$ Vietnamese translation task may be affected by the French $\rightarrow$ Vietnamese pseudo bilingual data. In future work, we would leverage the data selection methods in order to equip better synthetic data for our systems. \textbf{(7) Pseudo bilingual data translation.} We train the French $\rightarrow$ Vietnamese NMT system relied on only 1.2 thousands pseudo bilingual data mentioned in section \ref{monolingual} for 26 epochs. We achieve 18.71 BLEU points on the averaged model from our five best models. Thus, we can generate synthetic parallel data for a low-resource language pair from another language pair with a bigger bilingual resource. \section{Related Work} Due to the unavailability of the parallel data for low-resource language pairs or zero-shot translation, previous works focus on the task to have more data such as leveraging multilingual translation \cite{Ha2016, ha2017effective, Wang2018, Gu2019, Roee2020} or using monolingual data with back-translation, self-learning \cite{Sennrich2015,zhang2016, wu2019} or mix-source \cite{Ha2016} technique. For leveraging multilingual translation, \cite{Ha2016} added language code and target forcing in order to learn the shared representations of the source words and specify the target words. \cite{Wang2018} demonstrated a one-to-many multilingual MT with three different strategies which modify their architecture. \cite{Gu2019} built many-to-one multilingual MT systems by adding a layer to transform the source embeddings and representation into a universal space to augment the translation of low resource language, which is similar to ours. \cite{Roee2020} implemented a massive many-to-many multilingual system, employing many low-resource language pairs. All of the mentioned works have shown substantial improvements in low-resource translation, however, they are less correlative to our translation tasks. Although multilingual MT equips a shared space with many advantages, rare word translation is still the issue that needs to be considered. The task of dealing with rare words has been mentioned in previous works. \cite{luong2015} copied words from source sentences by words from target sentences after the translation using a bilingual dictionary. \cite{Li2016} and \cite{trieu} learned word similarity from monolingual data to improve their systems. Our approach is similar to these works, but we only learn similarity from the shared multilingual space of MT systems. \cite{ngo2019} addressed the rare word problem by using the synonyms from WordNet. \cite{Toan2017} and \cite{ngo2019} presented different solutions to solve rare word situation by transforming the embeddings during the training of their RNN-based architecture. Those solutions cannot be applied to the transformer architecture. In \cite{Gu2019}, the embeddings of rare tokens and universal tokens are jointly learned through a plus parameter while we only add a scalar value to the embeddings. Monolingual data is used to generate synthetic bilingual data in sparsity data issues. \cite{Sennrich2015} proposed back-translation method that uses a backward model to get the source data from the monolingual target data. In contrast, \cite{zhang2016} shown the self-learning technique by employing a forward model to translate monolingual source data into the target data. \cite{wu2019} incorporated both mentioned techniques into their NMT systems. Monolingual data is also demonstrated its efficiency in unsupervised machine translation\cite{lample2018unsupervised} or in zero-shot multilingual NMT \cite{siddhant2020leveraging, ha2017effective}. In our work, we use the self-learning method to produce pseudo bilingual data, and it is then used to train our low-resource multilingual NMT systems. \section{Conclusion and Future Work} We have built multilingual MT systems for two low-resource language pairs: English-Vietnamese and French-Vietnamese, and proposed two approaches to tackle rare word translation. We show that our approaches bring significant improvements to our MT systems. We find that the pseudo bilingual can furthermore enhance a multilingual NMT system in case of French $\rightarrow$ Vietnamese translation task. In the future, we would like to use more language pairs in our systems and to combine proposed methods in order to evaluate the effectiveness of our MT systems.
{'timestamp': '2021-07-13T02:12:32', 'yymm': '2012', 'arxiv_id': '2012.08743', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08743'}
arxiv
\section{Introduction} In all areas, such as banks, government applications, the pharmaceutical sector, military organisations, educational establishments, etc., security issues are growing today. Government institutions set guidelines, pass regulations, and compel organizations and agencies to conform with these standards, with wide-ranging implications of non-compliance. In these various and varied industries with a common weak link being passwords, there are many challenges when it comes to security issues. To verify the identity of the user, most applications today rely on static passwords. These keys, though, come with serious security issues for administrators. Users prefer to use easy-to-guess passwords, use different accounts with the same password, write passwords or save them on their computers unencrypted. Moreover, although dedicated systems, called password managers, can offer secure password storage and retrieval, only a small fraction of users use them \cite{zhang2019people}. In addition, hackers have the choice of using many password stealing methods, such as shoulder surfing, snooping, sniffing, guessing, etc. Several best practices have been suggested for the use of passwords. Some of them are very difficult to use and others do not fulfill the security needs of the organization. To overcome the password problem, two factor authentication using devices such as tokens and ATM cards has been suggested and has been shown to be difficult to hack \cite{twoFactor}. There are several limitations of two-factor authentication, including the cost of purchasing, issuing, and handling tokens or cards. From the point of view of the user, having more than one two-factor authentication methods demands the purchase of several tokens/cards that are likely to be misplaced or stolen. Traditionally, cell phones have been considered a device for making phone calls. But today, the use of cell phones has been generalized to send calls, review addresses, shop contacts, etc., provided the developments in hardware and software. Also, opportunities for smartphone access have expanded. Cell phones combine infra-red, Bluetooth, 3G, and WLAN connectivity, on top of normal GSM connectivity. For contact purposes, most of us, if not all of us, hold cell phones. Several accessible mobile banking services take advantage of mobile computer enhancement capabilities. From the ability to collect account balance information in the form of SMS messages to the use of WAP and Java along with GPRS to allow fund transfers between accounts, stock trading, and direct payment confirmation through the phone's micro browser. The principle of using passwords and smart cards to authenticate customers is an old idea going back 40 years now. Since then many systems with two-factor authentication mechanisms were developed. However since the smart card may be intercepted and the data contained in the smart card may be duplicated, the reliability of two-factor authentication may be breached, and the number of potential passwords can be limited and users could forget or lose their passwords. Biometric authentication was adopted to authenticate users by using their biometric characteristics due to those issues. Scholars have suggested biometric authentication system since back in 1999 which enhances some facets of two-factor authentication since biometric features have greater entropy and can not be missed and are rarely lost. One drawback, though is that biometric characteristics are not entirely confidential since one can "steal" biometric characteristics from others for example, the fingerprint can be retrieved from a mug used by the suspect and the facial features can be obtained from an image of a user. Combining all these three variables together is a way to mitigate these concerns. This technique is often referred to as three-factor authentication, and has been greatly adapted by cloud-based applications.\cite{yu2014efficient} SIM cards are available in varying storage sizes. Related memory utilization of the SIM card connected with it plays a part in deciding the effectiveness of cloning the SIM card, more memory stored on the original SIM card than the longer the Ki A8 algorithm cracking process on the SIM card. Problems resulting from the above perspective relating to the inclusion of the A8 algorithm inserted in any SIM card used by telecommunications users to duplicate or replicate the SIM card are detrimental to the privacy and protection of cell phone users on either side. The purpose of the SIM card cloning research is to provide an alert to consumer safety and provide a dedicated SIM card to tackle SIM card cloning criminal investigations along with their abuse of data.Subscriber Authentication Based on IMSI (Stored on SIM) and Andom Number Generator/RAND (Provided by Network), SIM card cloning authentication will be further investigated by comparing the network login response of the customer to the mobile service network. The Random Number Generator (RAND) includes an algorithm A3 (Provided by Network) such that RAND participates in the process of cloning the SIM card in order to adapt the algorithms contained in the SIM card A8 to A3 algorithms contained in the user data of the connected network authentication. \cite{anwar2016forensic} Scholars have already demonstrated that by launching a cross-platform infection attack, an attacker is able to compromise another device, either a PC or a cell phone. Prototypes of proof-of-concept demonstrate that such attacks are feasible and thus it is not fair to preclude them from the mobile 2FA scheme adversary model. The intruder will snatch all authentication tokens and impersonate the rightful user when both 2FA devices are infected, regardless of what individual smartphone 2FA instantiation is used.We carry out attacks against various instantiations of mobile 2FA schemes implemented by banks and common Internet service providers to help our argument. Schemes with 2FA OTPs created on the client side, such as Google Authenticator (GA), depend on pre-shared secrets. The configuration process of the GA app, used by hundreds of providers, including Google Mail, Facebook and Outlook.com, was evaluated. When the user allows GA-based authentication in his account settings, the GA initialization begins. A QR code is created by the service provider and shown to the user (on the PC) and scanned by the user's smartphone. All the information required to initialize GA with user-specific account details and pre-shared secrets is stored in the QR code. During the initialization process, scholars analysed the QR code submitted by Facebook and Google and defined the structure of the QR code. This includes information such as the scheme sort (counter-based vs. time-based), the service and account identifier, the counter (counter-based mode only the generated OTP duration and the mutual secret identifier. In addition, all this material is provided in plain text. To check if GA supports any alternate initialization system, scholars \cite{dmitrienko2014security} reverse engineered the app with the JEB Decompiler and evaluated the internal apps. We have not found any alternate initialization routines, suggesting that this initialization protocol is used by all 32 service providers using GA. The initialization message may be intercepted by a PC-residing malware (clear text encoded as an QR code). The attacker will then initialize its own version of the GA and can produce legitimate OTPs. The use of 'honeywords' was introduced in order to detect whether or not the password file was stolen, i.e. a series of false passwords that are combined with the original password of the user and the hash values of these passwords (real passwords and honeywords) are contained in the password file. The adversary also does not know which one is the true password if this file is corrupted and all the hash values in the file are cracked. Note that LS identity and password are submitted by the customer or the adversary to request login.LS then checks if a password submitted is among the honeywords of a user, but even if this search succeeds, LS needs to review another protected component, HC, to see if the index of the honeyword retrieved corresponds to the actual password of the user. HC warns the administrator otherwise, as a honeyword signal has been detected that the password file might have been corrupted \cite{genc2017examination}. Based on these findings and trying to combine the strengths of honeywords and 2FAs while at the same time keeping the system simple and easily integrated in any existing platform or system, we present in this paper a prototype of a novel security mechanism. We develop and propose an innovative security mechanism for web applications that produces both passwords and QR codes covering different login modes. The proposed system entitled "Two-Factor HoneyToken Authentication (2FHA)", combines the strengths of two-factor authentication and Honeyword technologies. In the developed prototype a sms with 3 OTP passwords that correspond to 3 QR codes is sent to the user. Only one of these three elements is the correct token that can be used in order to continue. This induces an extra layer of security adding more safety to the system. The proposed system offers enhanced security to the user while at the same time is simple and doesn't impose additional overhead during login. The rest of the article is structured as follows. Section \ref{2FA} presents two-factor authentication principles and limitations. Section \ref{sec:honey} discusses honeywords principles. Section \ref{sec:prototype} presents the proposed system architecture and protopype and Section \ref{sec:concl} concludes the article and discusses future work. \section{Two factor authentication}\label{2FA} Two-factor authentication (2FA) is a security mechanism in which users use two separate authentication keys to validate themselves, often referred to as two step verification or dual-factor authentication. This process is undertaken to help secure both the credentials of the user and the tools that can be used by the user. Two-factor authentication offers a higher degree of protection than one-factor authentication (SFA)-dependent authentication systems, in which the user only provides one factor, normally a password or passcode. Two-factor authentication strategies rely on a password-providing mechanism, as well as a second factor, typically either a safety token or a biometric factor, such as a fingerprint or facial scan. Two-factor authentication brings to the authentication process an extra layer of security by making it more difficult for criminals to obtain access to computers or online accounts of an individual since it is not enough to know the victim's password alone to pass the authentication check. To monitor access to confidential applications and files, two-factor authentication has long been used and online service providers are gradually using 2FA to secure the identities of their customers from being used by hackers who have compromised a password database or used phishing campaigns to acquire user passwords\cite{twobirds}. \subsection{What are authentication factors?} There are many different ways in which more than one authentication mechanisms are used to authenticate anyone. Most authentication mechanisms usually rely on factors of information, such as a traditional password, whereas two-factor authentication methods incorporate either a possession factor or a factor of inherence \cite{ferrag2017authentication}. Authentication factors, listed in approximate order of adoption for computing, include the following: \begin{enumerate} \item A knowledge factor is when The user knows something, such as a password, a personal identification number (PIN) or some other sort of mutual secret. \item A possession factor is when a user has To accept authentication requests, the user has something, such as an ID card, a protection key, a cell phone, a mobile computer or a smartphone app. \item An inherence factor refers to anything intrinsic to the physical self of the individual is more generally considered a biometric element. This may be personal characteristics, such as fingerprints authenticated by a fingerprint scanner, are mapped to physical features. Facial and speech recognition are other widely used inherence variables. There are also the biometrics of behavior, such as keystroke dynamics, variations of gait or voice. \item A location factor typically denoted by the location from which an authentication attempt is made, can be implemented by restricting authentication attempts to specific devices in a specific location or more commonly, by monitoring the geographical source of an authentication attempt based on the Internet Protocol (IP) source address or some other geolocation detail, such as data from the Global Positioning System (GPS), \item A time factor limits user authentication to a fixed time frame where it is allowed to log in and limits access to the device beyond that window. \end{enumerate} It should be remembered that the vast majority of two-factor authentication mechanisms rely on the first three authentication factors, while multifactor authentication (MFA), which may rely on two or more separate passwords for more reliable authentication, can be used by systems that demand greater security. \subsection{How does two-factor authentication work?} In this section we briefly describe the process of a typical two factor authentication system \cite{ferrag2017authentication}. \begin{itemize} \item The user is asked by the program or by the website to log in. \item The user enters what he or she knows—usually a username and password. Then a match is made by the site's server and the user is remembered. \item The website creates a special authentication key for the user for processes that don't need passwords. The authentication function processes the key and it is checked by the site's server. \item Then the site asks the user to start the second stage of login. While a variety of ways can be taken through this step, users must show that they only have what they will have, such as an identification key, ID card, smartphone or other mobile device. This is the factor for ownership. \item During phase four, the user enters a one-time code created. \item The customer is authenticated and given access to the program or website after supplying all variables. \end{itemize} In technical terms, two authentication factors are required to obtain access to a device or facility at any point. Using two variables from the same group, though, would not constitute 2FA; for instance, it is always called SFA to require a password and a mutual secret since both belong to the same class of authentication factor: information. The user ID and password are not the most reliable as far as SFA services. One concern with password-based authentication is that generating and recalling good passwords requires awareness and diligence. Passwords need protection against many internal attacks, such as carelessly kept login credential sticky notes, old hard drives and vulnerabilities in social engineering. Passwords are often vulnerable to external threats, such as hackers using brute-force, dictionary or rainbow table attacks. An intruder will typically break password-based protection mechanisms and steal corporate data, including personal information of users, provided ample time and money. Because of their low cost, ease of execution and familiarity, passwords have remained the most common type of SFA. Depending on how they are applied, several challenge-response questions can provide more security, and stand-alone biometric authentication approaches can also provide a more reliable SFA process. \subsection{Types of two-factor authentication products} There are several different 2FA deployment equipment and utilities — from tokens to radio frequency identification (RFID) cards to applications for smartphones \cite{ferrag2020authentication}. It is possible to separate two-factor authentication devices into two categories: tokens that are provided to users to use while signing in and infrastructure or software that detects and authenticates entry for users who correctly use their tokens. Physical devices, such as key fobs or smart cards, may be authentication keys, or they may exist in applications like mobile or web apps that produce authentication PIN codes \cite{limbasiya2018advanced}. These authentication codes are normally created by a server, often known as one-time passwords (OTPs), and can be recognized by an authentication system or app as authentic. The authentication code is a short sequence connected to a specific computer, user or account that can be used once as part of an authentication process. To accept, process and authorize — or reject — access to users who authenticate with their tokens, organisations need to install a framework. This may be implemented in the form of cloud applications, a dedicated hardware server, or supplied by a third-party provider as a service. An significant feature of 2FA is ensuring that the authenticated user is granted access to all services the user is allowed for — and only those resources. As a consequence, one of 2FA's main functions is to connect the authentication method with the authentication data of an entity. Microsoft offers some of the required infrastructure for Windows 10 2FA service organisations through Windows Hello, and will work with Microsoft accounts, as well as authenticate users with Microsoft Active Dii. \subsection{How 2FA hardware tokens work} Hardware tokens for 2FA are available that support numerous authentication approaches \cite{reynolds2020empirical}. The YubiKey, a small Universal Serial Bus (USB) system that supports OTPs, public key encryption and authentication, and the Universal 2nd Factor (U2F) protocol developed by the FIDO Alliance, is a common hardware token. YubiKey tokens are sold by Palo Alto, California-based Yubico Inc. When YubiKey users log in to an OTP-supported online site, such as Gmail, GitHub, or WordPress, they insert their YubiKey into their device's USB port, enter their password, select the YubiKey field, and then tap the YubiKey icon. YubiKey produces and inputs an OTP into the field. The OTP is a 44-character, single-use password; a special ID defining the authentication key associated with the account is the first 12 characters. The remaining 32 characters contain information that is encrypted using a key only known to the computer and the servers of Yubico that was generated during the initial registration of the account. An OTP is submitted from an online service to Yubico for verification of authentication. The Yubico authentication server sends back a message verifying that this is the correct token for this user until the OTP is checked. Two authentication criteria have been given by the user: the information factor is the password, and the possession factor is the YubiKey. \subsection{Two-factor authentication for mobile device authentication} For 2FA, smartphones provide a number of possibilities, encouraging organizations to choose what suits best for them. A built-in camera can be used for face recognition or iris detection, and the microphone can be used for speech recognition. Certain applications are able to recognise fingerprints. GPS-equipped smartphones will check the location as an extra consideration. Also, Speech or Short Message Service (SMS) may be used as an out-of-band authentication channel. For receiving authentication codes by text message or automatic phone call, a trustworthy phone number may be used. To participate in 2FA, a person needs to check at least one trustworthy phone number. Both applications that support 2FA are available for Apple iOS, Google Android and Windows 10, allowing the phone itself to function as the physical interface to satisfy the ownership aspect. Duo Defense, headquartered in Ann Arbor, Mich., and acquired for \$2.35 billion by Cisco in 2018, is a 2FA software provider whose solution allows 2FA consumers to use their trusted products. Before checking that the mobile device can still be trusted to authenticate the customer, Duo's platform first determines that a user is trusted. The need to acquire an authentication code through text, voice call or email is replaced by authenticator apps. For example, users type in their username and password to access a website or web-based application that supports Google Authenticator — a knowledge factor. Users are then asked to type a number of six digits. Instead of having to wait a few seconds to answer a text message, an Authenticator produces the number for them. Every 30 seconds, these numbers alter and are different with every login. Users complete the authentication process by entering the correct number and show custody of the correct unit — an ownership element. \subsection{Is two-factor authentication secure?} There are several limitations of two-factor authentication, including the cost of purchasing, issuing, and handling tokens or cards. From the point of view of the user, having more than one two-factor authentication method allows several tokens/cards to be held that are likely to be misplaced or stolen. Although two-factor authentication improves security—because access privileges are no longer dependent solely on a password's strength,—two-factor authentication systems are just as reliable as their weakest part. Hardware tokens, for instance, depend on the security of the issuer or manufacturer. In 2011, when the technology firm RSA Security announced its SecurID authentication tokens had been stolen, one of the most high-profile examples of a compromised two-factor device occurred. If it is used to circumvent two-factor authentication, the account recovery mechanism itself can often be subverted because it sometimes resets the existing password of a user and e-mails a new password to allow the user to log in again, bypassing the 2FA process. The corporate Gmail accounts of the chief executive of Cloudflare were compromised in this way. Although 2FA is cheap, simple to implement and user-friendly based on SMS, it is vulnerable to multiple attacks. In its special publication 800-63-3, the National Institute of Standards and Technology (NIST) has discouraged the use of SMS in the 2FA services \cite{grassi2017draft}. Due to cell phone number portability attacks, such as the Signaling System 7 hack, against the mobile phone network and malware, such as Eurograbber, that can be used to intercept or divert text messages, NIST concluded that OTPs sent via SMS are too vulnerable.From all the above factors the idea of 2HFA is created. \section{Honeywords}\label{sec:honey} The fundamental principle behind the Honeywords scheme is to adjust the password storage mechanism in such a way that a password and a series of false passwords are associated with each account \cite{honeywords}. The phony passwords are called honeywords. Sweetwords are the union of both honeywords and the password. As soon as the password is entered during the authentication process, the password database is immediately detected to have been compromised. Therefore unlike traditional schemes, implementations focused on honeywords can effectively detect violations of password databases. \begin{figure} \centering \includegraphics{figures/hashes.png} \caption{Credentials database of aLSin the Honey-words system} \label{fig:honey1} \end{figure} \begin{figure} \centering \includegraphics{figures/passwordindex.png} \caption{Data stored on aHC} \label{fig:honey2} \end{figure} The method of Honeyword is as follows. During the authentication process, users select a username and a password, as with many traditional schemes. The Login Server (LS) then produces honeywords for the password and maintains a record in the database of passwords. The ordering of the sweetwords is randomly selected by the LS in each record. In addition, LS sends the corresponding user ID and actual password index to Honeychecker (HC), the auxiliary server built to store the password index. Let ui and H() denote respectively the user name of user I and the hash function used in the method. H(swi,j) denotes the hash of user i. jth sweetword. A standard example of a table of qualifications is illustrated in Figure \ref{fig:honey1}. HC saves the user IDs and the password index between the honeywords. During the authentication, no username or password itself is sent to HC. In comparison, HC is built as a hardened server that can only be reached by LS. A standard structure of the HC data is seen in Figure \ref{fig:honey2}. Notice that only two kinds of messages are accepted by HC: Check and Set To verify {\bf if j=ci, check(i, j)} implies that uf j=ci, HC returns True, otherwise False is returned and a warning is activated. The command set is structured as: {\bf Set (I j) indicates setting ci=j}. The user submits its username and password.LStries during the authentication process to locate the corresponding record for that username in the credentials database. If a record exists, LS computes the hash of the password sent and attempts to find a match in the sweetword hashes. If no match occurs, then the password sent is incorrect and access is refused. LS sends the respective user ID and the corresponding index to HC if there is a match. First, HC seeks the record that fits the user ID and compares the index value obtained with the one stored in its database. If the outcome is valid, then access is provided. Otherwise the HC returns incorrect, generates an alert and notifies the administrators of the device policy. Originally, the Honeywords scheme was constructed with the expectation that the opponent could steal the hashed passwords and invert the hashes to obtain the passwords. It is therefore presumed that both LS and HC will not be abused by the attacker within the same time frame. The Honeywords mechanism defends passwords from brute-force and dictionary attacks mentioned in Section \ref{2FA}. The method attempts to prevent violations of the password database and seeks to prevent only offline dictionary attacks where the adversary is believed to have taken the hashes of the password and abandoned the system. \section{The proposed Two-Factor HoneyToken Authentication (2FHA) Mechanism}\label{sec:prototype} In this article we introduce an alternative authentication method, for enhancing systems' security. The system combines two factor authentication with honeywords in order to make impossible for an attacker to bypass the authentication mechanism of the system. Even in the occasion that the attacker has access to the device that receives the token, e.g. by sim cloning, the proposed 2FHA method makes the authentication bypass unfeasible if not impossible. \begin{figure*}[h] \centering \includegraphics[width=0.85\linewidth]{figure.jpg} \caption{Architecture of the 2FHA protoype} \label{fig:my_label} \end{figure*} In order to demonstrate the proposed system we created a website that includes a login page and have developed a prototype. The user in order to enter the system must fill the correct username and password, which is the first authentication factor. Then the system sends to the user a number $M$ that indicates the token that is correct on every login attempt in the future. When logging into the system from a new device, the user must enter the correct OTP. The user receives a number of tokens $N$. He can choose with what platform wants to be alerted for the token, to get it (e-mail, sms, phone call etc.). \begin{figure} \centering \includegraphics[width=0.75\linewidth]{figures/login.png} \caption{The login page} \label{fig:login} \end{figure} Then we must enter the second authentication factor. The prototype of the 2FHA mechanism produces 3 qrcodes\cite{qrcodes}, each one of those is represented with a password and sends an sms message\cite{website} to the mobile phone of the user. The sms includes all 3 OTPs (One Time Password) passwords corresponding to each of the qrcodes \cite{atms}. One is the correct and the others 2 are fake. The user now has to choose what it’s more suitable method for him to continue in order to fill the OTP box and proceed in the website\cite{security}. We ahve to highlight here that the number of produced tokens is kept to 3 only for demonstrating purposes but can be generalized to a number $N$. \begin{figure} \centering \includegraphics[width=1.0\linewidth]{figures/qrcodes.png} \caption{The produced qrcodes} \label{fig:qrcodes} \end{figure} If the user chooses to scan the qrcodes \cite{QRCODES1}, the process is simple. He scans the correct qrcode and then he fills the OTP box. The qrscanner is free software and most of them are suitable for any device. If the user doesn’t have qrscanner then the option of sms is more convenient for him. The sms message as presented in Figure \ref{fig:SMS}, will be sent to the user the time he logins to the system. As you can see in Figure \ref{fig:SMS} the message contains 3 OTP passwords(OTP, OTP1, OTP2). These are the produced from the qr codes. Each user knows that only one of the 3 qrcodes is the correct while the other 2 are fake. \begin{figure} \centering \includegraphics[width=0.95\linewidth]{figures/sms.jpg} \caption{OTP passwords sent as an sms message} \label{fig:SMS} \end{figure} If the user fills the OTP box correctly, he will continue to the system. If not, then he will be sent back to the initial login page and has to follow the procedure again. Also for precaution reasons the account of the user can be suspended. The OTPs must follow some rules when created; they can't be very similar among them in order to avoid mispelling mistakes. \section{Conclusion - Discussion}\label{sec:concl} In this paper we have taken actions to strengthen the security of a system against stolen tokens and penetration attempts. The proposed mechanism combines 2FA and Honeyword principles and can be integrated in any existing platform or web application. We plan to improve the system in the future by producing a higher number of qrcodes and passwords that will increase the security. In the prototype of the proposed system OTP's are sent them through SMS. In the near future we plan to integrate the proposed 2FHA with google and microsoft authenticators. We also plan to enhance the registration phase in order to make it more secure by encrypting the initial information. \balance \bibliographystyle{IEEEtran}
{'timestamp': '2021-01-22T02:02:36', 'yymm': '2012', 'arxiv_id': '2012.08782', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08782'}
arxiv
\section{Introduction}\label{sect:intro} Generally, capturing high-quality images in dim light or back light conditions is challenging, since insufficient lighting can significantly degrade the visibility of images. Especially the lost details and low contrast would not only cause unpleasant subjective perceptions, but also hurt the performance of back-end computer vision systems which are designed for normal-light images. Though modern imaging sensors can automatically set high ISO, long exposure, and flash according to different circumstances to compensate for the low light, they suffer from different drawbacks. One solution is to use high dynamic range (HDR) imaging techniques, which has been integrated into modern cameras to tackle with dark light environment in the image acquisition stage. However, when it comes to restore existing poor-quality low-light images, HDR needs bunch of images under different illumination conditions as inputs, which limits its practical application. Thus the low-light image enhancement has been a long-standing problem in the community with a great progress made over the past years. It can not only be used to increase the visual aesthetics of photos for people's daily use, but also to stable the performance of many computer vision algorithms such as object detection. Existing methods have two mainstream ideologies. One tries to consider the low-light enhancement problem as an image decomposition problem based on the Retinex theory, in which each image can be separated into independent components and the image reflectance part can be seen as a reasonable enhancement result \cite{fu2016weighted,guo2016lime,ren2018joint,zhang2018high}. However, these methods tend to introduce unexpected artifacts in the enhanced results. The other resorts to machine learning techniques based on large-scale image databases consisting of pairs of low-light image and corresponding enhanced image restored by image processing software like Photoshop \cite{wei2018deep,dale2009image,bychkovsky2011learning,shen2017msr}. These methods have achieved impressive performance but usually limited by the quality and quantity of the training database. To get rid of the restriction of using training data, in this paper, we present a novel self-supervised low-light image enhancement framework called SID-NISM, which could restore the quality of any single low-light image only relying on the visual information of the image itself. Our major contributions are summarized as follows. (1) A self-supervised image decomposition network, SID-Net, is proposed to decompose the input image into lighting-independent reflectance, structure-aware smooth illumination and reflectance-related noise straightforwardly according to the robust Retinex theory~\cite{li2018structure}. Taking as inputs any given input image and its corresponding histogram equalization image, SID-Net can converge to the optimal decomposed maps within limited iterations, in which two novel loss terms related to the formation of the reflectance and noise maps together with several common-used basic terms are adopted to guide the decomposition procedure preciously. As pointed out above, SID-Net is a image-specific network without depending on any prior training or reference image, which greatly distinguish it from existing supervised-learning methods like Retinex-Net~\cite{wei2018deep}. (2) A nonlinear illumination saturation mapping function (NISM) is constructed to refine the decomposed low-light illumination map. Specifically, it could brighten up the whole image to a proper lighting level on the premise of preserving the contrast between foreground and background, which combats the weaknesses of Gamma correction in contrast preservation and bright regions enhancement. The final normal-light result can be restored by combining the denoised reflectance with the enhanced illumination. Comprehensive experiments are conducted to illustrate the performance of the proposed method. Human perception user study suggests that people are more inclined to prefer the output of our method and find less unexpected artifacts in our results when the results of multiple competing methods are presented in front of them, which is consistent with the objective evaluations. Both subjective and objective experiments demonstrate the superiority of our method over the state-of-the-art methods in producing natural and attractive enhancement results. \section{Related Work}\label{sect:related} Researchers have devoted their efforts to solving the problem of low-light image enhancement in the past decades. Many techniques have been developed to improve the quality of low-light images, which can be classified into two major categories as mentioned in Sect. \ref{sect:intro}: Retinex-based methods and learning-based methods. \textbf{Retinex-based Methods.} According to the classic Retinex theory~\cite{land1971lightness}, an observed image can be decomposed into two components, reflectance and illumination, in which the former one can be taken as a kind of compelling low-light image enhancement result. Jobson \textit{et al.}~\cite{jobson1997multiscale,jobson1997properties} made some early attempts based on this model, but their results are usually unrealistic. Wang \textit{et al.}~\cite{wang2013naturalness} presented a naturalness preserved method by utilizing a lightness-order-error measure. However, it tends to produce results with dim artifacts and requires expensive computational cost. Fu \textit{et al.}~\cite{fu2016weighted} and Ren \textit{et al.}~\cite{ren2018joint} succeed to simultaneously estimate reflectance and illumination maps through a weighted variational model and a sequential model respectively, but both suffered from preserving the property of Retinex model insufficiently. While Guo \textit{et al.}~\cite{guo2016lime} tired to only estimate the illumination map from the maximum values of three channels with constraints on preserving the main contour, then compute the reflectance by conducting element-wise division. And following the illumination estimation constraints in \cite{guo2016lime}, Zhang \textit{et al.}~\cite{zhang2018high} proposed two more constraints for estimating illumination based on perceptually bidirectional similarity. These two methods have pretty good performance but usually introduce unexpected artifacts in the enhanced images. Besides, with the development of neural network, some researchers~\cite{zhang2019kindling,wang2019underexposed,wei2018deep} sought to design image decomposition networks and illumination adjustment networks based on low-light and normal-light image pairs. \textbf{Learning-based Methods.} Using machine learning tools to solve the problem of low-light image enhancement is a recent trend and also a promising direction. Dale \textit{et al.}~\cite{dale2009image} first established a database comprising 1 million images. Given an input image to be enhanced, their system executes a visual search to find the closest images in the database; these images define the input’s visual context, which can be further exploited to instantiate the restoration operations. Kang \textit{et al.}~\cite{kang2010personalization} constructed a database which stored the feature vectors describing training images along with vectors of enhancement parameters. Given a test image, the database was then searched for the best matching image, and the corresponding enhancement parameters were used to perform adjustment. Following the similar idea, Bychkovsky \textit{et al.}~\cite{bychkovsky2011learning} constructed a dataset containing 5,000 input-output image pairs that could be used to learn global tonal adjustments. To avoid collecting large-scale datasets, Shen \textit{et al.}~\cite{shen2017msr} trained their MSR-net designed upon the multi-scale Retinex theory on synthesized pairwise images. With the power of neural network, these methods can get outstanding enhanced results, but at the same time it should be noticed that they are all based on supervised-learning frameworks and thus their performance highly depends on the quality and quantity of training datasets. Therefore Zhang \textit{et al.}~\cite{zhang2019zero} proposed the first unsupervised-learning back-lit image restoration network based on the S-curve theory~\cite{yuan2012automatic}, which estimated the image specific S-curve through region-level optimal exposure evaluation. However, it is limited by the mid-gray assumption \cite{guo2016lime} in S-curve, which leads to unrealistic enhanced results with halos and gray shadows. \section{Retinex Theory}\label{sect:retinex} The classic Retinex theory~\cite{land1971lightness} models the image compositions which could reflect the formation of low-light images to some extent. It assumes that the captured image can be decomposed into two components, reflectance and illumination. Let $S$ represents the source image, then the classic Retinex theory can be denoted by, \begin{equation}\label{equ:retinex} S = R \times L \end{equation} where $R$ is reflectance, $L$ is illumination and $\times$ is element-wise multiplication. Illumination $L$ refers to the various lightness on observed objects, while reflectance $R$ corresponds to the material RGB color that describes how objects reflect light, which is considered to be invariant to $L$ and other possible imaging conditions. In short, $R$ represents the intrinsic property of captured objects. Besides, in color images each channel of $R$ can be regarded as sharing the same grayscale illumination map $L$. Since low-light images usually suffer from darkness and unbalanced illumination distributions, the low-light image enhancement problem can be regarded as a procedure of estimating the illumination-independent reflectance according to the Retinex theory, which aims to remove the illumination effect and recover the original appearance of the scene objects. However, directly decomposing an input image into reflectance and illumination yields the intrinsic image decomposition problem~\cite{grosse2009ground}, which is inherently ill-posed and may produce unrealistic results~\cite{guo2016lime}. Therefore, some researchers~\cite{guo2016lime,fu2016weighted,ren2018joint,wei2018deep} converted the decomposition problem into an optimization problem and then computed the optimal solution through conventional optimization solvers or machine learning techniques. Moreover, instead of taking image reflectance as the enhancement result directly, existing methods usually project the enhanced illumination back to the reflectance by $R \times f(L)$ at the end, where $f(\cdot)$ stands for a manipulation operator adopted to enhance the illumination such as Gamma correction. Another noticeable issue in low-light image enhancement is the unexpected noise raised by enhancing dark regions. Although the low-light source image doesn't suffer from the noise problem, the noise hidden in the dark would be amplified along with stretching the contrast of dark regions. To address the intensive noise problem, researchers seek for help from denoising algorithms like BM3D~\cite{dabov2007image} as the post-processing method, which is straightforward but not designed to solve the specific denoising problem here. Therefore we decide to follow the robust Retinex model~\cite{li2018structure}, which integrate the noise term $N$ into the classic Retinex theory directly, \begin{equation}\label{equ:retinex} S = R \times L + N \end{equation} Once the source image could be decomposed into the three components successfully, the reflectance map would be not only independent with the illumination map but also get rid of unexpected noise. \section{SID-NISM: Self-supervised Low-light Image Enhancement Framework} \label{sect:sid-nism} In this section, the proposed low-light image enhancement framework SID-NISM is presented in details. Fig.~\ref{fig:Framework} illustrates the overall structure of SID-NISM, which consists of two stages, decomposition and enhancement, corresponding to the two main parts, SID-Net and NISM. \begin{figure*}[t] \centering \includegraphics[scale=0.32]{framework-eps-converted-to.pdf} \caption{The overall structure of SID-NISM. It consists of two stages, decomposition and enhancement, which are corresponding to the two main parts SID-Net and NISM.} \label{fig:Framework} \end{figure*} \subsection{SID-Net: A Self-supervised Image Decomposition Network} According to the definition of the Retinex theory, the reflectance component of an image should be invariant to the illumination component and other imaging conditions, which suggests that any pair of images with the same content should share the same reflectance regardless of their different illumination conditions. Thus inspired by the observation, a self-supervised learning image decomposition network called SID-Net is designed to split given low-light image into its reflectance, illumination and noise directly by taking as inputs the original image and its histogram equalization version. Notice that since the histogram equalization image is served as one of the paired images under different illumination condition to share the same reflectance, not the ground-truth normal-light images as in the supervised-learning methods, it doesn't matter whether histogram equalization would produce images with unpleasant color distortion or unbalanced illumination. Besides, although theoretically capturing paired images or utilizing other image generation methods are acceptable as well, considering the practical application and the computational cost, histogram equalization image becomes the best option. As illustrated in Fig.~\ref{fig:Framework}, SID-Net firstly takes as inputs the source image $S_{low}$ and its corresponding histogram equalization version $S_{he}$ to split both of them into three components according to the robust Retinex theory, then iteratively converges to the optimal decomposition maps by minimizing the designed loss function. Since it is a self-supervised network without external information from training images, the key point of SID-Net is to devise reasonable and effective loss function to guide the network to generate expected decomposition maps. The loss function of SID-Net is formulated as follows, \begin{equation} \mathcal{L} = \lambda_{rc}\mathcal{L}_{rc} + \sum_{i=low,he} {(\mathcal{L}_{rec}^i + \lambda_{L}\mathcal{L}_{L}^i + \lambda_{R}\mathcal{L}_{R}^i + \lambda_{N}\mathcal{L}_{N}^i)} \end{equation} where $\lambda_{rc}$, $\lambda_{L}$, $\lambda_{R}$, $\lambda_{N}$ denote the coefficients to balance the reflectance similarities and the guidance of generating illumination, reflectance and noise maps. They are signi ficantly smaller than 1 to address the importance of the fidelity term $\mathcal{L}_{rec}$ in the optimization, which are 0.01, 0.1, 0.001, 0.01 respectively in experiments. Notice that the reconstruction loss $\mathcal{L}_{rec}$ and the three guidance loss terms $\mathcal{L}_{L}, \mathcal{L}_{R}, \mathcal{L}_{N}$ are both applied on the original low-light image $S_{low}$ and the histogram equalization image $S_{he}$ to separate them into reflectance $R_{low}, R_{he}$, illumination $L_{low}, L_{he}$ and noise $N_{low}, N_{he}$ in a self-supervised way. \textbf{Retinex reconstruction loss.} First and foremost, according to the robust Retinex theory~\cite{li2018structure}, the three decomposed maps should be able to reconstruct the original image. Thus the reconstruction loss $\mathcal{L}_{rec}$ is formulated as, \begin{equation} \mathcal{L}_{rec} = \left\|R\times L+N-S\right\|_1 \end{equation} It corresponds to the image formation, which could constrain the distance between estimated $R\times L+N$ and the source image $S$. \textbf{Reflectance consistency loss.} As described in Sect.~\ref{sect:retinex}, the reflectance reflects the intrinsic property of captured objects, which should be invariant to the scene lighting and imaging conditions. That is to say, in the case of the same captured objects, i.e. image content, the reflectance maps of the low-light image and its histogram equalization version should be as close as possible. Therefore, based on the above assumption, the reflectance consistency loss $\mathcal{L}_{rc}$ is designed to constrain the reflectance similarities between $R_{low}$ and $R_{he}$. \begin{equation} \mathcal{L}_{rc} = \left\|R_{low}-R_{he}\right\|_1 \end{equation} \textbf{Illumination smoothness and consistency loss.} The loss function designed for the illumination map $\mathcal{L}_{L}$ is consist of two parts, the smoothness term and the consistency term, which can be expressed as, \begin{equation} \begin{split} \mathcal{L}_{L} &= {\left\|\nabla L \times \exp(-\alpha\nabla R)\right\|_1} \\ &+ \left\|\nabla L \times \exp(-\alpha\sum_{j=low,he}{\nabla L_j})\right\|_1 \end{split} \end{equation} where $\nabla$ denotes the gradient including $\nabla_h$ (horizontal) and $\nabla_v$ (vertical) and $\alpha$ denotes the coefficient balancing the strength of structure-awareness and edge-preservation which is set as 10 in experiments. The first term is adopted to guide the illumination map to be piece-wise smooth in textural details while preserving the general structure of the original images. A common-used smoothness prior in various image restoration tasks, total variation minimization (TV)~\cite{ma2012tv,ng2011total}, which minimizes the gradient of the whole image, is selected here as the fundamental of the illumination smoothness term. The second one is designed to preserve strong mutual edges while depressing weak ones. Similar to the illumination smoothness loss, it utilizes the weighted version of TV loss. Notice that since TV loss is structure-blindness, the original TV function is weighted with the gradient of the reflectance~\cite{wei2018deep} and illumination maps~\cite{zhang2019kindling} respectively to make the constructed loss be aware of the image structure and the two illumination maps be consistent with each other in terms of the image edges. \textbf{Reflectance contrast and color loss.} To generate accurate reflectance map, in addition to the basic reconstruction loss, a novel reflectance contrast and color loss $\mathcal{L}_{R}$ is introduced to improve the image contrast and restore the image color as much as possible, which can be expressed as, \begin{equation} \begin{split} \mathcal{L}_{R} &= \frac{1}{3}\sum_{ch=R,G,B}{\left\|\nabla R^{ch} - \beta\nabla \hat{S}^{ch} \right\|_F} \\ &+ \left\|R^H-S^H\right\|_2 \end{split} \end{equation} where $\beta$ is the gradient amplification factor which is set as 10 in experiments. $R^H$ and $S^H$ are the hue channels of the reflectance map and the source image after converting them from the RGB to the HSV color space. For the first term, as we know, low-light images always suffer from low contrast, which often indicates smaller gradient magnitudes~\cite{li2018structure}. Hence we attempt to manipulate the gradient magnitudes of the reflectance to boost the contrast of the enhanced results by amplifying the gradient of the input image with the factor $\beta$. Notice that $\nabla \hat{S}$ is a variant of the gradient of the input image $\nabla{S}$, in which small gradients, i.e. the noise, are suppressed before amplification. \begin{equation} \nabla \hat{S}= \begin{cases} 0& \text{if } |\nabla{S}|<\epsilon\\ \nabla{S}& \text{otherwise} \end{cases}` \end{equation} The second term is adopted to avoid color mismatch in the decomposed reflectance, which enforce the hue component of the reflectance map to be close enough to that of the source image. \textbf{Noise estimation loss.} Although the reflectance contrast loss attempts to suppress noise by ignoring small gradients, noise may still appear in flat dark regions. It is necessary to guide the decomposition of the noise map by, \begin{equation} \mathcal{L}_{N} = \left\|S \times N\right\|_F \end{equation} which constrains the overall intensity of the noise~\cite{li2018structure}. As for the detailed network configuration, SID-Net first adopts a commonly used feature extractor, which could be any classic network such as ResNet, U-Net, or even a simple CNN structure. Then, three separate $3\times3$ convolutional layers project the image features into branches, namely reflectance $R$, illumination $L$, and noise $N$ respectively. At the end, sigmoid function is used to constrain both $R$ and $L$ in the range of [0, 1], while tanh function is adopted to simulate additive noise to make $N$ fall in [-1, 1]. \subsection{NISM: Nonlinear Illumination Saturation Mapping Function} After obtaining the low-light illumination map $L$ of the given image $S$ by SID-Net, a manipulation operator would be adopted to enhance $L$ as described in Sect.~\ref{sect:retinex}. In the previous methods~\cite{guo2016lime,ren2018joint,zhang2018high}, researchers got used to refine the illumination map through Gamma correction, say $\hat{L}=L^{1/\gamma}$. When $\gamma>1$, the illumination map will be brightened up. In Fig.~\ref{fig:NISM}(a), the function curve of Gamma transformation with $\gamma=2.2$ is shown by the red line. It can be seen that pixels whose intensity are less than 20\% of the maximum illumination value, namely 0.2 in the scale of [0, 1], will be brightened to 50\%, while the pixels whose original intensity is large enough ($>80\%$) will keep the themselves basically unchanged. This property of Gamma correction would definitely do favor to enhance the illumination map especially in those dark regions, but it also brings two major flaws: 1) the contrast of the original image is destroyed due to the over-brightening of dark areas; 2) the illumination level of the final enhanced image is still insufficient because the bright areas are barely changed. As shown in Fig.~\ref{fig:NISM}(c), the overall quality of the enhanced result is improved compared with the low-light input Fig.~\ref{fig:NISM}(b), but it haven't been unable to reach the standard of 'normal-light' in human perception. \begin{figure} \centering \begin{minipage}[b]{0.3\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{curve-eps-converted-to.pdf}} \centerline{(a) Curves}\medskip \end{minipage} \begin{minipage}[b]{0.35\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{547-low.png}} \centerline{(b) Input}\medskip \end{minipage}\\ \begin{minipage}[b]{0.35\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{547-gamma.png}} \centerline{(c) Gamma}\medskip \end{minipage} \begin{minipage}[b]{0.35\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{547-NISM.png}} \centerline{(d) NISM}\medskip \end{minipage} \caption{Comparison between the Gamma correction and the proposed manipulation operator NISM. (a) are the two function curves when $\gamma=2.2$ and $\eta=2.2$. (c) and (d) are the corresponding enhanced results when adopting Gamma correction and NISM on the illumination map of the low-light image (b) respectively.} \label{fig:NISM} \end{figure} To combat the existing issues of Gamma correction, we consider depressing the brightening of dark pixels while increasing the illumination saturation of bright pixels. More concretely, for dark pixels, it is still necessary to be brightened up but should be carried on at a relatively lower level as compared with Gamma correction. In other words, the slope of the illumination operator at pixels whose intensity are less than 0.2 should be smaller than that of Gamma correction. On the contrary, the slope at bright pixels should be larger than that of Gamma correction, which could increase the illumination levels of bright pixels so as to render the final enhanced results bright enough. According to the above considerations, a novel manipulation operator called Nonlinear Illumination Saturation Mapping (NISM) is proposed, which is formulated as, \begin{equation} \hat{L}=1-(1-L)^\eta \end{equation} where $\eta$ is the control parameter as $\gamma$ in Gamma correction. The function curve of NISM with $\eta=2.2$ is depicted in the blue line in Fig.~\ref{fig:NISM}(a). It can be seen that the curve shape of NISM is consistent with the previous analysis about the improved curve slope. Indeed, the constructed NISM and the Gamma correction are symmetrical about $y=1-x$. The final enhanced image is generated by recombining the decomposed reflectance $R$ and the refined illumination $\hat{L}$ by $R\times\hat{L}$. The corresponding result is shown in Fig.~\ref{fig:NISM}(d), which reflects that NISM could transform the decomposed illumination map of the original low-light image into a normal-light level. In implementation $\eta$ is not fixed. It is computed by first clustering pixels of the low-light illumination map into two clusters, bright pixels and dark pixels, by KMeans. Then taking the minimum illumination value of bright pixels as threshold $T$, $\eta$ is calculated by, \begin{equation} \eta=\log(1-0.8)/\log(1-T) \end{equation} which means to map the minimum illumination value of bright pixels to 0.8 under NISM. \section{Experimental Results} \subsection{Experiment Settings} As a self-supervised framework, SID-NISM doesn't need any training dataset or prior information. For any given low-light image, SID-Net could split it into reflectance, illumination and noise components directly within hundred iterations, then NISM would enhance the decomposed illumination to combine with the reflectance. Besides, all the coefficients mentioned in Sect. \ref{sect:sid-nism} would remain the same during the experiments, which means it is not necessary to adjust the parameters for different inputs. Evaluations are performed on real-scene images from four public datasets, DICM~\cite{lee2013contrast}, LIME~\cite{guo2016lime}, LOL~\cite{wei2018deep}, and MEF~\cite{ma2015perceptual}. And the proposed method SID-NISM is compared with 6 state-of-the-art low-light image enhancement algorithms, including 1) a weighted variational model for simultaneous reflectance and illumination estimation (SRIE)~\cite{fu2016weighted}, 2)illumination map estimation method (LIME)~\cite{guo2016lime}, 3) joint enhancement and denoising method via sequential decomposition (JED)~\cite{ren2018joint}, 4) perceptually bidirectional similarity based illumination estimation (PBS)~\cite{zhang2018high}, 5) deep learning based Retinex decomposition (Retinex-Net)~\cite{wei2018deep}, and 6) unsupervised-learning based back-lit image restoration network (ExCNet)~\cite{zhang2019zero}. In the following subsections, both subjective and objective experimental results will be exhibited. More experiments including the intermediate decomposition results and the analysis of the effect on the object detection task can be found in the supplementary materials. \subsection{Image Decomposition Results} Since Retinex-based low-light image enhancement methods consider the problem as an image decomposition problem, it is necessary to show our intermediate decomposition results firstly. Fig.~\ref{fig:decomposition1} exhibits the decomposition results of two low-light images, \textit{Totoro} and \textit{toy} in LOL dataset. Their final enhanced results can be found in the main paper. In general, the proposed SID-Net can decompose reasonable reflectance, illumination and noise maps for given input images in a self-supervised way successfully. The decomposed reflectance maps contain sufficient color and structure details of the captured scene. The illumination maps reflect the lighting conditions as observed in human eyes. While the noise maps extract underlying noise component in dark regions. \begin{figure*} \centering \begin{minipage}[b]{0.2\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{22.png}} \end{minipage} \begin{minipage}[b]{0.2\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{22-R.png}} \end{minipage} \begin{minipage}[b]{0.2\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{22-L.png}} \end{minipage} \begin{minipage}[b]{0.2\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{22-N.png}} \end{minipage}\\ \begin{minipage}[b]{0.2\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{493.png}} \centerline{(a) Source $S$}\medskip \end{minipage} \begin{minipage}[b]{0.2\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{493-R.png}} \centerline{(b) Reflectance $R$}\medskip \end{minipage} \begin{minipage}[b]{0.2\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{493-L.png}} \centerline{(c) Illumination $L$}\medskip \end{minipage} \begin{minipage}[b]{0.2\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{493-N.png}} \centerline{(d) Noise $N$}\medskip \end{minipage} \caption{Intermediate decomposition results of two low-light images, \textit{Totoro} and \textit{toy} in LOL dataset.} \label{fig:decomposition1} \end{figure*} Fig.~\ref{fig:decomposition2} compares the decomposition results of the proposed image decomposition network SID-Net with three state-of-the-art Retinex-based methods, LIME, JED and Retinex-Net, on \textit{Bookshelf} in LOL dataset and \textit{Balloon} in MEF dataset. It can be seen that all of the four methods can decompose reasonable reflectance and illumination maps for given input images as expected. However, there also exists some differences among the four methods. In the aspect of reflectance, it is obvious that LIME can restore more color and structure details of the original objects compared with the other methods, because the reflectance of LIME is calculated by conducting element-wise division on the source image and the estimated illumination, which preserve the Retinex theory to a large extent. As for the illumination maps, SID-Net and Retinex-Net outperform other methods due to the specific structure-awareness illumination smoothness loss term, which makes it more consistent with the image structure. Besides, both as image decomposition networks, the biggest difference between SID-Net and Retinex-Net is that the proposed SID-Net is an unsupervised learning network without any prior training process, while the other one is a supervised learning network based on large-scale training dataset. As for the practical image decomposition performance, the two networks are evenly matched. Even in the reflectance maps, the results of SID-Net are clearer with more details than that of Retinex-Net. In general, as shown in Fig.~\ref{fig:decomposition2}, SID-Net can extract underlying consistent reflectance from the given input image directly, and portray the lightness and shadow of the image in the illumination map. Although without prior training, the SID-Net can achieve the same or even better performance at the image decomposition stage. \begin{figure*}[t] \centering \includegraphics[scale=0.4]{decom-eps-converted-to.pdf} \caption{The decomposition results of LIME, JED, Retinex-Net, and SID-Net for \textit{Bookshelf} in LOL dataset and \textit{Balloon} in MEF dataset. For each of the example, the first row are the decomposed reflectance, while the second are the illumination maps} \label{fig:decomposition2} \end{figure*} \subsection{Human Perception User Study}\label{sect:userstudy} User study was conducted to perform comparisons between state-of-the-art methods in the dimensions of the overall image quality and some unpleasing artifacts through human perceptions. To evaluate the overall image quality, the subjects gave their personal feelings on the scale of 0 to 10, where 0 represents ``poor'', 5 means ``good'', and 10 is ``excellent''. As for the artifacts, there are five artifacts to be selected from (multiple-choice). Those are black edges, blur, overexposure, gray shadow and halo as shown in Fig.~\ref{fig:artifacts}. Once the subjects observe phenomenon in the images consisting with the description of the artifacts, the corresponding option would be checked. For all the enhanced images obtained by different methods, the subjects move the slider to give the image quality score and select specific artifacts according to their observations. The above procedure was completed on the Amazon Mechanical Turk platform by thirty workers. \begin{figure} \centering \begin{minipage}[b]{0.29\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{blackedges.JPG}} \centerline{(a) Black Edges}\medskip \end{minipage} \begin{minipage}[b]{0.29\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{blur.JPG}} \centerline{(b) Blur}\medskip \end{minipage}\\ \begin{minipage}[b]{0.29\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{overexposure.jpg}} \centerline{(c) Overexposure}\medskip \end{minipage} \begin{minipage}[b]{0.29\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{grayshadow.png}} \centerline{(d) Gray Shadow}\medskip \end{minipage} \begin{minipage}[b]{0.29\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{halo.jpg}} \centerline{(e) Halo}\medskip \end{minipage} \caption{Five artifacts examples from (a) Retinex-Net \cite{wei2018deep} on \textit{hill} in DICM dataset; (b) JED \cite{ren2018joint} on \textit{tree} in DICM dataset; (c) LIME \cite{guo2016lime} on \textit{stormtrooper} in LIME dataset; (d) and (e) ExCNet \cite{zhang2019zero} on \textit{roof} in MEF dataset.} \label{fig:artifacts} \end{figure} The results of the user study are summarized in graphs shown in Fig.~\ref{fig:qualityUser} and \ref{fig:artifactsUser}. In Fig.~\ref{fig:qualityUser}, a boxplot is used to exhibit the distributions of the image quality scores for different methods, in which the red solid line represents the median while the blue dotted line represents the mean score. Through observing the median, mean, and the first quartile, it is obvious that the participants showed a strong bias in preference towards our results (median: 6.0, mean: 5.51, quartile: 8.0) when compared to Retinex-Net~\cite{wei2018deep} (median: 3.0, mean: 3.05, quartile: 4.0), gave higher scores when compared to SRIE~\cite{fu2016weighted} (median: 5.0, mean: 5.04, quartile: 7.0), JED~\cite{ren2018joint} (median: 5.0, mean: 5.34, quartile: 7.0), PBS~\cite{zhang2018high} (median: 5.0, mean: 5.31, quartile: 7.0) and ExCNet~\cite{zhang2019zero} (median: 5.0, mean: 5.41, quartile: 7.0), and had no preference when compared with LIME~\cite{guo2016lime} (median: 6.0, mean: 5.67, quartile: 8.0). The results in Fig.~\ref{fig:qualityUser} indicate that SID-NISM outperforms most of the state-of-the-art methods in terms of the overall image quality. \begin{figure} \centering \includegraphics[scale=0.32]{quality-eps-converted-to.pdf} \caption{The image quality scores for different methods.} \label{fig:qualityUser} \end{figure} In Fig.~\ref{fig:artifactsUser}, a stacked bar graph is adopted to illustrate the average counts of artifacts in the results of different methods, in which each color bar corresponds to the five artifacts in Fig.~\ref{fig:artifacts} respectively. Specifically, the average counts are computed by $M/(N*P)$, where $M$ is the total counts of artifacts in the results of each method, $N$ is the number of images, $P$ is the number of subjects. It can be seen that SID-NISM tends to introduce less artifacts (average counts: 0.6) than other methods (average counts: above 0.8) in total. Generally, SID-NISM doesn't lead too many unexpected artifacts. SRIE~\cite{fu2016weighted} would introduce gray shadow into their results, while the results of LIME~\cite{guo2016lime} may be over-enhanced to become overexposure. JED~\cite{ren2018joint} has more blurry cases, while Retinex-Net~\cite{wei2018deep} contains the most black edges in their results. These phenomenons can be also observed in the visual examples of the next subsection. \begin{figure} \centering \includegraphics[scale=0.32]{artifacts-eps-converted-to.pdf} \caption{The average counts of artifacts in different methods.} \label{fig:artifactsUser} \end{figure} \subsection{Visual Quality Comparisons}\label{sect:visualQuality} In order to facilitate readers to visually compare the results of different low-light image enhancement approaches, several examples are exhibited in Fig.~\ref{fig:vision1} and ~\ref{fig:vision2}. \begin{figure*} \centering \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{22-input.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{22-SRIE.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{22-LIME.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{22-JED.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{22-SID-new.png}} \end{minipage}\\ \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{22-input-local.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{22-SRIE-local.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{22-LIME-local.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{22-JED-local.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{22-SID-new-local.png}} \end{minipage}\\ \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{6079-input.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{6079-SRIE.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{6079-LIME.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{6079-JED.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{6079-SID-new.png}} \end{minipage}\\ \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{6079-input-local.png}} \centerline{(a) Input}\medskip \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{6079-SRIE-local.png}} \centerline{(b) SRIE}\medskip \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{6079-LIME-local.png}} \centerline{(c) LIME}\medskip \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{6079-JED-local.png}} \centerline{(d) JED}\medskip \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{6079-SID-new-local.png}} \centerline{(e) SID-NISM}\medskip \end{minipage} \caption{Compared with the results obtained by SRIE \cite{fu2016weighted}, LIME \cite{guo2016lime} and JED \cite{ren2018joint} on two natural images: \textit{Totoro} from LOL dataset and \textit{candle} from MEF dataset. Below are the enlarged detailed images in the red box. (Best viewed on screen)} \label{fig:vision1} \end{figure*} \begin{figure*} \centering \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{1-input.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{1-PBS.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{1-Retinex.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{1-ExCNet.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{1-SID-new.png}} \end{minipage}\\ \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{1-input-local.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{1-PBS-local.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{1-Retinex-local.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{1-ExCNet-local.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{1-SID-new-local.png}} \end{minipage}\\ \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{493-input.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{493-PBS.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{493-Retinex.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{493-ExCNet.png}} \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{493-SID-new.png}} \end{minipage}\\ \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{493-input-local.png}} \centerline{(a) Input}\medskip \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{493-PBS-local.png}} \centerline{(b) PBS}\medskip \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{493-Retinex-local.png}} \centerline{(c) Retinex-Net}\medskip \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{493-ExCNet-local.png}} \centerline{(d) ExCNet}\medskip \end{minipage} \begin{minipage}[b]{0.16\linewidth} \centering \centerline{\includegraphics[width=1\linewidth]{493-SID-new-local.png}} \centerline{(e) SID-NISM}\medskip \end{minipage} \caption{Compared with the results obtained by PBS \cite{zhang2018high}, Retinex-Net \cite{wei2018deep} and ExCNet \cite{zhang2019zero} on two natural images: \textit{street} from LIME dataset and \textit{toy} from LOL dataset. Below are the enlarged detailed images in the red box. (Best viewed on screen)} \label{fig:vision2} \end{figure*} In general, it is clear that SID-NISM could brighten up the dark regions of low-light images successfully. More importantly, it can also restore the strong contrast of scene content sufficiently. For example, taking \textit{candle} in Fig.~\ref{fig:vision1} as input, the contrast between the candle in the foreground and the glass cup in the background is clearer and stronger in the result of SID-NISM compared with other methods. Another example is the \textit{toy} in Fig.~\ref{fig:vision2}. It is obvious that the contrast between the toy's face and the background is stronger in our result. This property renders the results of our method seem more active and attractive, which is consistent with the user study about the image overall perceptions. In addition, as discussed in Sect.~\ref{sect:userstudy}, SID-NISM could restore the overall quality of low-light images on the premise of introducing less unexpected artifacts, including preserving clear boundary (glass cup in \textit{candle}), avoiding gray shadow (the inside of the door in \textit{street}) and halo (boundary of the door in \textit{street}). Especially, our results contain less noise such as the sky in \textit{street} and the white background in \textit{toy}. Combining with the above intuitive observation and data statistics in the user study, it can be seen that our method is more robust with less artifacts, which makes our framework more competitive and practical in both people's daily use and commercial cases. \subsection{Objective Evaluation Indexes} \begin{table*}[] \centering \begin{tabular}{c|ccccccc} \toprule & GE & CE & GMI & GMG & NIQE & PSNR & SSIM \\ \hline SRIE & 6.5584 & 18.4951 & 56.0559 & \textcolor{red}{\textbf{6.2808}} & 3.8777 & 12.8554 & 0.5298 \\ LIME & 7.2652 & 19.8994 & 93.2529 & 11.4664 & 4.2036 & \textcolor{blue}{\textbf{17.1717}} & 0.6355 \\ JED & 6.5296 & 19.0923 & 73.9586 & 4.6584 & \textcolor{red}{\textbf{3.3546}} & 14.9944 & 0.6325 \\ PBS & 7.0828 & 20.2996 & 84.7626 & 10.8144 & 4.4976 & 16.3765 & \textcolor{blue}{\textbf{0.6375}} \\ Retinex-Net & 6.9750 & \textcolor{red}{\textbf{21.0380}} & \textcolor{red}{\textbf{110.2008}} & 12.8826 & 5.7127 & 14.4061 & 0.4932 \\ ExCNet & 7.0548 & 18.7087 & 87.4292 & 10.2022 & 4.4485 & 14.9694 & 0.601 \\ SID-NISM w/o $\mathcal{L}_{R}$ and $\mathcal{L}_{N}$ & \textcolor{red}{\textbf{7.1978}} & 18.8489 & 99.9323 & 11.1822 & 4.4493 & 17.0313 & 0.5926 \\ SID-NISM & \textcolor{blue}{\textbf{7.2499}} & \textcolor{blue}{\textbf{20.7416}} & \textcolor{blue}{\textbf{103.3472}} & \textcolor{blue}{\textbf{9.9731}} & \textcolor{blue}{\textbf{3.8579}} & \textcolor{red}{\textbf{17.7576}} & \textcolor{red}{\textbf{0.6633}} \\ \hline Reference & 7.1949 & 21.0804 & 110.8416 & 7.1368 & 3.5593 & / & 1 \\ \toprule \end{tabular} \caption{Quantitative comparison on LOL and MEF datasets in terms of different metrics. GE, CE, GMI, GMG should be close to the reference images. Lower NIQE, higher PSNR and SSIM indicate better image quality. Top2 results are highlighted in bold (\textcolor{red}{Top1}-\textcolor{blue}{Top2}).} \label{tab:objEva} \end{table*} \begin{table*}[t] \centering \begin{tabular}{c|p{1.0cm}<{\centering}p{0.8cm}<{\centering}p{0.8cm}<{\centering}p{0.8cm}<{\centering}p{0.8cm}<{\centering}p{0.8cm}<{\centering}p{0.8cm}<{\centering}p{0.8cm}<{\centering}p{0.8cm}<{\centering}p{1.0cm}<{\centering}|c} \toprule & bicycle & boat & bottle & bus & car & cat & chair & dog & motor & person & mAP \\ \hline Original & 42.36 & 8.34 & 21.38 & 42.31 & 30.74 & 20.44 & 34.77 & 25.53 & 33.12 & 36.66 & 31.54\\ SRIE & 44.75 & 10.76 & 27.26 & 54.01 & 30.80 & 21.28 & 36.96 & 26.27 & 34.02 & 38.33 & 33.92 \\ LIME & 47.56 & 9.25 & 24.26 & 53.24 & 32.72 & 20.40 & 32.25 & 28.29 & 32.50 & 39.98 & \textbf{33.98} \\ JED & 41.50 & 8.53 & 21.42 & 46.53 & 23.72 & 20.46 & 31.36 & 30.24 & 31.77 & 33.83 & 29.28 \\ PBS & 47.33 & 8.31 & 23.85 & 50.43 & 33.12 & 17.65 & 33.44 & 26.81 & 33.19 & 38.29 & 33.20 \\ Retinex-Net & 34.59 & 5.70 & 17.80 & 38.11 & 20.99 & 16.18 & 27.57 & 6.14 & 15.53 & 27.90 & 23.15 \\ ExCNet & 39.24 & 8.86 & 19.46 & 55.37 & 32.99 & 20.68 & 32.00 & 30.13 & 32.49 & 39.04 & 32.84 \\ SID-NISM & 47.64 & 9.69 & 18.26 & 51.36 & 32.02 & 17.19 & 36.48 & 28.53 & 32.75 & 39.58 & \textbf{33.39} \\ \toprule \end{tabular} \caption{The performance (mAP: \%) of object detection on real low-light images and their enhanced versions by low-light image enhancement methods.} \label{tab:objectmap} \end{table*} In addition to the above subjective experiments, there are many indexes with or without reference images that can be used to evaluate the quality of the enhanced images objectively. In this section, we take use of gray entropy (GE), color entropy (CE, sum of the entropy of RGB channels), gray mean illumination (GMI), gray mean gradient (GMG), NIQE~\cite{mittal2012making}, PSNR, and SSIM~\cite{wang2004image} to compare different low-light image enhancement methods. Generally, the first four indexes could reflect the gap between the enhanced results and the reference high-light images from four aspects including the information in gray and color channels, the illumination degree and the image gradient magnitude. NIQE assesses the overall naturalness of the enhanced results and a lower value roughly corresponds to a higher overall naturalness. PSNR could verify the performance of denoising algorithms and a higher value usually indicates a better image quality. SSIM measures the structure similarity between the enhanced results and the reference images, which is in the range of [0, 1]. It should be noted that these indexes can only reflect the image quality in specific aspects, which may be not completely consistent with the evaluation results given by the human visual system. The quantitative results over LOL and MEF datasets (the two datasets with reference normal-light images) are reported in Table \ref{tab:objEva}. Obviously, the proposed SID-NISM could achieve better performance compared with existing state-of-the-art methods in terms of the image information, the overall quality and the noise condition. It is worth mentioning that we also compare the performance of our framework with and without $\mathcal{L}_{R}$ and $\mathcal{L}_{N}$ to quantitatively evaluate the merit brought by the two novel reflectance and noise terms in the loss function of SID-Net. It can be seen that they not only help improve the image color and gradient information of the enhanced results greatly, but also decrease the noise influence and promote the overall image quality. \section{Object Detection Test} We also take a step further to look into the potential of low-light image enhancement in improving the performance of one popular computer vision task, object detection. To do so, tests were performed on YOLOv2 platform on real low-light images and their enhanced versions by our proposed framework and other state-of-the-art methods. Here we directly used the pre-trained VOC2007+2012 model without any re-training or fine-tuning as we would like to observe the outcome of the originally optimized model when given low-light and enhanced images. Experiments were conducted on Exclusively Dark Image Dataset (ExDark), which is consist of low-light images taken in 10 different low-light environments with corresponding 12 image classes and object level annotations. Table \ref{tab:objectmap} exhibits the mean of Average Precision (mAP) over 10 classes when detecting different versions of images. Obviously, compared to detecting objects on the original low-light images directly, the performance of the object detection model would be improved by preprocessing the inputs through our proposed low-light image enhancement method from 31.54\% to 33.39\% in terms of mAP. Among existing methods, LIME reaches the best mAP (33.98\%) while SID-NISM shows its competitive power (within 1\%) in improving the performance of downstream tasks. This test illustrates the feasibility of incorporating image enhancement as a support for practical applications. \section{Conclusion} In this paper, a self-supervised low-light image enhancement method called SID-NISM is proposed, which can first decompose given input images in an unsupervised way without relying on any external examples or prior training, and then enhance decomposed illumination map by a well-designed nonlinear illumination mapping function. The proposed scheme is concise yet powerful. Experimental results show that, even though our method does not need any support data or prior knowledge, it can produce visually pleasing enhancement results with less unexpected artifacts as well as a good representation of image decomposition. {\small \bibliographystyle{ieee_fullname}
{'timestamp': '2020-12-17T02:07:43', 'yymm': '2012', 'arxiv_id': '2012.08707', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08707'}
arxiv
\section{Introduction} Machine learning models are shown to be susceptible to various types of adversarial attacks targeted to degrade the performance of machine learning models. Research in adversarial machine learning has mostly focused on targeting accuracy as a measure \cite{chakraborty2018adversarial,li2018security}. However, with the advancement of research in fair machine learning, attention has geared toward fairness measures and their importance. A broad area of research has arisen by proposing different fairness measures and definitions \cite{dwork2012fairness,hardt2016equality,NIPS2017_6995,10.1145/3194770.3194776,mehrabi2019survey}. It is important to have systems that are away from discriminatory behavior as these systems can be used in sensitive environments, such as courts to make bail decisions \cite{Dresseleaao5580}; thus, crucial to have measures and standards to ensure that artificial intelligence (AI) systems are fair. Similar to accuracy, fairness measures are important in machine learning research and can be targeted by adversaries for malicious intent. For instance, adversaries can attack models used in government and other sensitive agencies to make them appear unfair in order to depreciate their values and credibility. Some adversaries can even gain profit with such attacks off of biasing decisions for their benefit, in credit or loan applications for instance \cite{chen2019fairness}; therefore, thinking about ways these attacks could happen for designing more robust systems in the future is crucial. The goal is to have systems that are robust to fairness attacks; thus, it is important to consider attacks targeted toward fairness. \textbf{Our contributions.} In this work, we propose data poisoning attacks that are able to target fairness. We propose two families of poisoning attacks. Those that target fairness only without having noticeable effects on accuracy to make them more subtle and undetectable, and those that affect both fairness and accuracy by injecting poisoned points during train time. Some adversaries may want to harm systems with regards to fairness and accuracy at the same time, while others might only consider fairness. In light of this, we introduce anchoring attack and influence attack on fairness techniques. In anchoring attack, we target fairness only without harming accuracy as much, while in influence attack on fairness, we target both accuracy and fairness measures by incorporating a loss function maximizing and attacking which would degrade fairness and accuracy. Through experimentation on three different datasets with different fairness measures and definitions, we show the effectiveness of our attacks in achieving the desired goal of either affecting fairness only without significant harm on accuracy or accuracy and fairness at the same time. In addition, we incorporate different baseline models to evaluate different aspects of our attacks. We demonstrate that original data poisoning attacks designed to attack accuracy are not suitable for fairness attacks; thus, highlighting the importance of attacks designed for fairness specifically. We also compare our methods against concurrent work on adversarial attacks on fairness and show the effectiveness of our methods over them. \section{Conclusion and Future Work} In this work, we introduced two families of poisoning attacks that can target fairness. We showed the effectiveness of these attacks through experimentation on different real world datasets with different measures. Our influence attack on fairness (IAF) used the attack strategy as in influence attack \cite{koh2018stronger,koh2017understanding}. As an extension, we modified the loss function so that it can harm fairness as well as accuracy. Furthermore, we explore an attack strategy called the ``anchoring attack'' that harms fairness by placing poisoned points near target points in order to bias the outcome. Our paper also introduced two ways of sampling these target points. A direct extension of this approach is to explore other methods of sampling points to increase the effectiveness of this attack. The introduced attacks each have their own advantages and disadvantages. The goal was to design attacks that can complement each other. For instance, influence attack on fairness which is gradient-based can be slow. Anchoring attack, however, does not use gradients and is considerably faster. Further, while influence attack on fairness targets fairness harshly, anchoring attack is more subtle. And if anchoring attack can not explicitly control for accuracy fairness trade-off, influence attack on fairness can control this trade-off. This work points out several important angles for future research. Some important extensions are as follows: what other ways can machine learning systems be harmed by data poisoning attacks? How can we design and adapt defenses that can be effective against malicious attacks targeting fairness? Another question worth pursuing is from the perspective of the defender. Can current defenses against accuracy attacks be useful against the types of attacks that target fairness. If not, how do we adapt defenders so that they can prevent fairness attacks? These questions can help us design more fair, and accurate models that are robust to poisoning attacks. By extension, one can also think about stronger attacks against fairness than ours. We anticipate that continuing to blend the fields of adversarial and fair machine learning can create interdisciplinary ideas that can help us develop more robust and fair machine learning models. \section{Acknowledgments} This material is based upon work supported by the Defense Advanced Research Projects Agency (DARPA) under Agreement No. HR0011890019. We thank the anonymous reviewers and Mozhdeh Gheini for their constructive feedback. \section{Evaluation} In our experiments, we evaluate our attacks with regards to different measures, such as accuracy and foundational fairness measures: statistical parity, and equality of opportunity differences. We also utilize three real world datasets in our experiments, introduced below. We compare against a suite of baselines that test our attacks' performance with regards to accuracy and fairness. Our results indicate that our attacks, the anchoring attack and influence attack on fairness, are effective in terms of affecting fairness aspects of the model. \subsection{Datasets} We use three different real world datasets in our experiments with gender as the sensitive attribute. The data was split into an 80-20 train and test split. \\ \textbf{German Credit Dataset.} This dataset comes from UCI machine learning repository \cite{Dua:2019}. It contains the credit profile about individuals with 20 attributes associated to each data person. In our experiments, we utilized all the 20 attributes from this dataset. The classification goal is to predict whether an individual has good or bad credit. \\ \textbf{COMPAS Dataset.} Propublica's COMPAS dataset contains information about defendants from Broward County \cite{larson2016compas}. We utilized the features in Table \ref{compas_features} as our prediction features. The classification goal is to predict whether an individual will recommit a crime within two years. \\ \textbf{Drug Consumption Dataset.} This dataset comes from the UCI machine learning repository \cite{Dua:2019}. It contains information about individuals \cite{fehrman2017five}. We utilized the features listed in Table \ref{compas_features} as our prediction features. The classification goal is to predict whether an individual has consumed cocaine or not in their lifetime. \begin{table}[h] \centering \begin{tabular}{ p{2.5cm} p{2.5cm}} \toprule COMPAS&\\ \midrule sex&age\_cat \\ juv\_fel\_count&juv\_misd\_count\\ priors\_count&c\_charge\_degree\\ race & juv\_other\_count\\[0.5pt] \bottomrule \end{tabular} \begin{tabular}{ p{1.7cm} p{1.7cm} p{1.7cm} p{0.5cm}} \toprule Drug&&\\ \midrule ID&Age& Gender & SS\\ Education&Country&Ethnicity&\\ Nscore&Escore&Oscore&\\ Ascore&Cscore &Impulsive& \\ [0.5pt] \bottomrule \end{tabular} \caption{Features used from the COMPAS and Drug Consumption datasets.} \label{compas_features} \end{table} \subsection{Measures} In addition to accuracy, we have utilized two well-known fairness measures to analyze the performance of different attacks with regard to fairness, detailed below. \\ \textbf{Statistical Parity Difference} Statistical parity is a well-known measure (definition) introduced in \cite{dwork2012fairness}. We utilize this measure as one of our metrics for fairness. It captures the predictive outcome differences between different (advantaged and disadvantaged) demographic groups. The measure is defined below and is referred to as statistical parity throughout our paper. \[ SPD = |p(\hat{Y}=+1|x \in \mathcal{D}_a)-p(\hat{Y}=+1|x \in \mathcal{D}_d)| \] \textbf{Equality of Opportunity Difference} Equality of opportunity is another well-known fairness definition introduced in \cite{hardt2016equality}. We utilized the equality of opportunity difference as another fairness metric. It captures differences in the true positive rate between different (advantaged and disadvantaged) demographic groups. The measure is defined below and is addressed as equality of opportunity throughout this paper. \begin{align*} EOD = |p(\hat{Y}=+1|x \in \mathcal{D}_a, Y=+1) \\ -p(\hat{Y}=+1|x \in \mathcal{D}_d, Y=+1)| \end{align*} \subsection{Methods} \begin{figure*}[h] \includegraphics[width=0.33\textwidth,trim=0.5cm 0cm 2cm 0cm,clip=true]{images/German_acc.pdf} \includegraphics[width=0.33\textwidth,trim=0.5cm 0cm 2cm 0cm,clip=true]{images/German_parity.pdf} \includegraphics[width=0.33\textwidth,trim=0.5cm 0cm 2cm 0cm,clip=true]{images/German_equality.pdf} \includegraphics[width=0.33\textwidth,,trim=0.5cm 0cm 2cm 0cm,clip=true]{images/compas_acc.pdf} \includegraphics[width=0.33\textwidth,,trim=0.5cm 0cm 2cm 0cm,clip=true]{images/compas_parity.pdf} \includegraphics[width=0.33\textwidth,,trim=0.5cm 0cm 2cm 0cm,clip=true]{images/compas_equality.pdf} \includegraphics[width=0.33\textwidth,trim=0.5cm 0cm 2cm 0cm,clip=true]{images/drug_acc.pdf} \includegraphics[width=0.33\textwidth,trim=0.5cm 0cm 2cm 0cm,clip=true]{images/drug_parity.pdf} \includegraphics[width=0.33\textwidth,trim=0.5cm 0cm 2cm 0cm,clip=true]{images/drug_equality.pdf} \caption{Results obtained for different attacks with regards to different fairness (SPD and EOD) and accuracy (test error) measures on three different datasets (German Credit, COMPAS, and Drug Consumption) with different $\epsilon$ values.} \label{attack_results} \end{figure*} \begin{figure*}[h] \includegraphics[width=0.33\textwidth,trim=0.5cm 0cm 2cm 0cm,clip=true]{images/German_lambda_acc.pdf} \includegraphics[width=0.33\textwidth,trim=0.5cm 0cm 2cm 0cm,clip=true]{images/German_lambda_parity.pdf} \includegraphics[width=0.33\textwidth,trim=0.5cm 0cm 2cm 0cm,clip=true]{images/German_lambda_equality.pdf} \includegraphics[width=0.33\textwidth,,trim=0.5cm 0cm 2cm 0cm,clip=true]{images/compas_lambda_acc.pdf} \includegraphics[width=0.33\textwidth,,trim=0.5cm 0cm 2cm 0cm,clip=true]{images/compas_lambda_parity.pdf} \includegraphics[width=0.33\textwidth,,trim=0.5cm 0cm 2cm 0cm,clip=true]{images/compas_lambda_equality.pdf} \includegraphics[width=0.33\textwidth,trim=0.5cm 0cm 2cm 0cm,clip=true]{images/drug_lambda_acc.pdf} \includegraphics[width=0.33\textwidth,trim=0.5cm 0cm 2cm 0cm,clip=true]{images/drug_lambda_parity.pdf} \includegraphics[width=0.33\textwidth,trim=0.5cm 0cm 2cm 0cm,clip=true]{images/drug_lambda_equality.pdf} \caption{Results obtained for different lambda values for the IAF attack with regards to different fairness (SPD and EOD) and accuracy (test error) measures on three different datasets (German Credit, COMPAS, and Drug Consumption) with different $\epsilon$.} \label{lambda_attack_results} \end{figure*} To evaluate our attacks, we compared them against an attack that does not consider fairness and only considers accuracy to show that such attacks are not necessarily effective for fairness, motivating the need for fairness attacks. Also, we compared our attacks in terms of how they attack accuracy as a measure versus attacks that are specifically designed to target accuracy. We also compared our attacks to an attack that is optimized for fairness. The evaluated methods are listed below. In our experiments, the poisoned points are inversely proportional to class balance as also suggested in \cite{koh2018stronger}, so we made $(|\mathcal{D}_{c}^+|\epsilon)$ copies from the negative poison instance ($\mathcal{I}_{-}$) and $(|\mathcal{D}_{c}^-|\epsilon)$ copies from the positive poison instance ($\mathcal{I}_{+}$) in which $|\mathcal{D}_{c}^+|$ and $|\mathcal{D}_{c}^-|$ denote the number of positive and negative points in the clean data respectively. Hinge loss was used to control for accuracy for all the methods in our experiments as in \cite{koh2018stronger}. \\ \textbf{Influence Attack on Fairness (IAF)} In this paper, our influence attack on fairness is where the attack tries to maximize the covariance between the signed distance of feature vectors from the decision boundary to the sensitive features, which would then cause the attack to target and degrade fairness. In our experiments we set $\lambda =1$. \textbf{Random Anchoring Attack (RAA)} The anchoring attack where a target point is picked at random. In this new set of attacks, the goal is to place poisoned points in the vicinity of the target points in which the poisoned and target points have the same demographic group but different labels. In our experiments we set $\tau=0$ indicating the closest vicinity. \textbf{Non-random Anchoring Attack (NRAA)} This attack builds upon the random anchoring attack; however, in this attack, the target point is not chosen randomly. In this attack, the point with the most neighbors similar to it (with the same demographic group and label) is chosen as the target point so that we can infect as many similar points to the target point as possible. This can be effective because we are infecting more targeted points; however, in some cases it might be less effective since more poisoned points may be needed in order to achieve the goal of infecting many points and shifting the decision boundary. In our experiments we set $\tau=0$. \textbf{Influence Attack (Koh et al.)} This is a type of attack that is targeted only toward affecting accuracy \cite{koh2018stronger,koh2017understanding}. The reason we include this type of attack along with attacks targeted toward fairness is that it can help us understand how attacks targeting only accuracy affect fairness measures. Attacks of this nature can also serve as a good comparison because they show the effect of attacks on accuracy; because this attack is specifically designed to target accuracy, it can be a strong method to compare against. \textbf{Poisoning Attack Against Algorithmic Fairness (Solans et al.)} In \cite{solans2020poisoning}, the authors propose a loss function that claims to target fairness measures. We utilized the loss introduced in this paper as depicted below in equation \eqref{baseline_loss} in the influence attack from \cite{koh2018stronger,koh2017understanding} and compared it to our proposed attacks. The goal of \cite{solans2020poisoning} was to incorporate the loss in \eqref{baseline_loss} into an attack strategy that would maximize the loss; thus, we incorporated this loss into the influence attack \cite{koh2018stronger,koh2017understanding}, which we found to be a strong attack strategy in maximizing the loss and also the same attack strategy used in our influence attack on fairness. In our experiments, we utilized the same $\lambda$ value as proposed in \cite{solans2020poisoning} to balance the class priors. \begin{align*} L_{adv}(\hat{\theta};\mathcal{D}_{test}) = &\underbrace{\sum_{k=1}^p \ell(\hat{\theta};x_k,y_k)}_\text{disadvantaged} + \lambda \underbrace{\sum_{j=1}^m \ell(\hat{\theta};x_j,y_j)}_\text{advantaged} \\ & where \;\; \lambda = \frac{p}{m}. \numberthis \label{baseline_loss} \end{align*} \subsection{Results} The results in Figure \ref{attack_results} demonstrate that the influence attack (Koh et al.), although performing remarkably well in attacking accuracy, does not attack fairness well. The results also confirm that our influence attack on fairness method outperforms (Solans et al.) \cite{solans2020poisoning} in affecting fairness measures, and anchoring attack outperforms (Solans et al.) \cite{solans2020poisoning} in affecting fairness measures in most of the cases. One can observe that influence attack on fairness is the most effective amongst all the attacks in attacking fairness measures. Due to the nature of our influence attack on fairness loss function and its controlling parameter on accuracy and fairness, it can be utilized in scenarios where the adversary wants to maliciously harm the system in terms of accuracy, or fairness, or both. On the other hand, anchoring attacks can be utilized in places where the adversary wants to subtly harm accuracy with an effective harm on fairness. These types of attacks can be used by, e.g., adversaries who would want to gain profit off of biasing decisions for their benefit; thus, to remain less detectable they do not harm accuracy. Although it is possible that anchoring attack can harm accuracy to a higher degree, as shown empirically in our results, it is less likely that anchoring attack is able to degrade accuracy by a large amount in practice for real world datasets. In addition, in Figure \ref{lambda_attack_results} we demonstrate the effect of our regularized loss in the influence attack on fairness. The results show that with the increase of lambda the attack affects fairness measures more as expected from the loss; however, for the lower lambda values the attack acts similar to the original influence attack targeted towards accuracy. The results also show that higher epsilon values highlight the behavior of the loss more as expected such that for high epsilon value of 1 the changes are more significant with modifications to the lambda value in the loss function, while less subtle for lower epsilon values such as 0.1. \section{Related Work} Here, we cover related work from both fair machine learning as well as adversarial machine learning research. \subsection{Adversarial Machine Learning} Research in adversarial machine learning is mostly focused on designing defenses and attacks against machine learning models \cite{NIPS2017_6943,chakraborty2018adversarial,li2018security}. Ultimately, the goal is for machine learning models to be robust toward malicious activities designed by adversaries. Thus, it is important to consider both sides of the spectrum in terms of designing the attacks and defenses that can overcome the attacks. In adversarial machine learning, different types of attacks, such as data poisoning and evasion attacks, exist. In evasion attacks, the goal is to come up with adversarial examples that are imperceptible to human eye but can deceive benign machine learning models during test time \cite{biggio2013evasion,moosavi2016deepfool,DBLP:journals/corr/GoodfellowSS14}. On the other hand, in data poisoning attacks, the goal is to manipulate the training data--via adding, removing, or changing instances--so that the learned model is malicious \cite{10.5555/3042573.3042761,shafahi2018poison}. Different algorithms and approaches have been proposed for poisoning attacks focusing on accuracy as the performance measure \cite{10.5555/3042573.3042761,shafahi2018poison}. In this paper, we also focused on data poisoning attack while considering fairness as a performance measure in addition to accuracy. \subsection{Fair Machine Learning} Research in fair machine learning has gained attention recently, with many active research areas. For instance, some work introduces new definitions and measures for fairness \cite{dwork2012fairness,hardt2016equality,NIPS2017_6995,mehrabi2020statistical}. \cite{10.1145/3194770.3194776} has a complete list of the definitions on fairness. Other work utilizes these definitions and tries to design and learn fair classification \cite{zafar2015learning,pmlr-v97-ustun19a}, regression \cite{agarwal2019fair}, and representations \cite{moyer2018invariant}. The battle to mitigate unfairness can happen in different phases. Some target making the data more fair \cite{zhang2017achieving}, while others target the algorithms \cite{zafar2015learning}. These mitigation techniques can also vary in when and how they are applied. For instance, some approaches are pre-processing techniques \cite{Kamiran2012} in which the focus is to remove discrimination from the data before the learning phase. Others try to impose fairness during training via incorporation of fair loss functions or other approaches during the training phase, known as in-processing \cite{kamishima2012fairness}, while some are post-processing approaches \cite{NIPS2017_7151} in which the model is treated as a black box system and discrimination removal is performed on the output of the model. \citet{mehrabi2019survey} performs a literature review of fair machine learning research in different subject domains, which can be referenced for more detail. In our work, we utilize some of the definitions and measures widely used in fair machine learning research \cite{dwork2012fairness,hardt2016equality} in measuring the performance of our attacks with regard to fairness. We were also inspired by some loss functions introduced in fair classification tasks in one of our attacks \cite{zafar2015learning}. \subsection{Adversarial Fair Machine Learning} The rapid and significant growth of research in algorithmic fairness highlights the importance of machine learning models being fair and robust toward any unfair behavior. To this end, it is important to think about attacks that can make models unfair in order to strengthen models against such attacks. This recent and interesting line of work combines the two fields of fair and adversarial machine learning. The only work we are aware of that proposes poisoning attacks against algorithmic fairness is \cite{solans2020poisoning}. In \cite{solans2020poisoning}, the authors propose an attack that targets fairness. We compared this attack with our two newly proposed attacks using three real world datasets. Our anchoring attack does not rely on any loss function making it different in nature with the previous work. In our influence attack on fairness we introduce a new loss function different than the previous work which is more in line with fairness literature and work done in fairness domain making our attack more intuitive. In addition, our influence attack on fairness is able to control a fairness-accuracy trade-off with the hyper-parameter involved in its loss function which is also shown in Figure \ref{lambda_attack_results} as an additional experimental result. This line of work can bring researchers from both fields closer and inspire new and interesting research problems. Another interdisciplinary research field combining concepts from fairness and privacy includes the differential privacy line of work \cite{dwork2008differential,bagdasaryan2019differential,pmlr-v97-jagielski19a,pujol2020fair}. \section{Ethics Statement} This paper furthers ethics in the machine learning community in two major ways: \begin{itemize} \item Despite extensive research in adversarial machine learning, not much attention has been given to scenarios where fairness is a possible target of deliberate attacks. We suggest that fairness metrics are as important as accuracy, because they can be manipulated in sensitive environments to achieve malicious goals. Our work points out potential vulnerabilities of machine learning models against fairness-targeting attacks. This line of research can raise awareness, and motivate researchers to introduce methods to mitigate harmful effects of adversarial attacks on fairness. The attacks proposed in this paper are meant to ensure the robustness of fairness in machine learning applications. Nevertheless, we acknowledge that in the wrong hands these type of tools could enable an attacker to harm fairness in extant machine learning systems. \item Fairness and adversarial machine learning are both very important research areas with major safety, security, and ethics implications both within and beyond on the AI/machine learning community. This work combines ideas from both adversarial and fair machine learning, and will hopefully facilitate collaboration among researchers from both communities, eventually leading to more robust and fair machine learning models. \end{itemize} \section{Introduction} With proliferation of machine learning (ML) applications in everyday life, it is imperative that ML algorithms underlying those applications do not discriminate, especially when it comes to potentially sensitive and consequential decisions, such as bail decisions~\cite{Dresseleaao5580}. Thus, recent research has looked into possible biases present in ML algorithms, and proposed different measures and definitions for characterizing fairness \cite{dwork2012fairness,hardt2016equality,NIPS2017_6995,10.1145/3194770.3194776,mehrabi2019survey}. Despite this interest, not much is known about the robustness of various fairness measures with respect to random, or perhaps malicious, perturbations. Indeed, it is known that machine learning models can be susceptible to various types of adversarial attacks targeted to degrade the performance of machine learning models. However, research in adversarial machine learning has mostly focused on targeting accuracy \cite{chakraborty2018adversarial,li2018security}. We argue that, like accuracy, fairness measures can be targeted by malicious adversaries as well. For instance, adversaries can attack models used by a government agency with the goal of making them appear unfair in order to depreciate their value and credibility. Some adversaries can even profit from such attacks by biasing decisions for their benefit, e.g., in credit or loan applications. Thus, one should consider fairness when assessing the robustness of ML systems. \textbf{Our contributions.} In this work, we propose data poisoning attacks that target fairness. We propose two families of poisoning attacks: {\em anchoring} and {\em influence}\footnote{https://github.com/Ninarehm/attack}. In anchoring attacks the goal is to place poisoned points to affect fairness without modifying the attacker loss. On the other hand, our influence attack on fairness can affect both fairness and accuracy by injecting poisoned points during train time via a specific adversarial loss that regularizes between fairness and accuracy losses. Some adversaries may want to harm systems with regard to fairness and accuracy at the same time, while others might only consider one that can be achieved by this regularization. In the anchoring attack, we place poisoned points to bias the decision boundary; in the influence attack, we target fairness measures by incorporating a loss function maximizing and attacking which can degrade fairness by maximizing the covariance between the decision outcome and sensitive attributes. Through experimentation on three different datasets with different fairness measures and definitions, we show the effectiveness of our attacks in achieving the desired goal of affecting fairness. In addition, we incorporate different baseline models to evaluate different aspects of our attacks. We demonstrate that original data poisoning attacks designed to attack accuracy are not suitable for fairness attacks, thus highlighting the importance of attacks designed for fairness. We also compare our methods against concurrent work on adversarial attacks on fairness and show the effectiveness of our methods in comparison. \section{Background on Poisoning Attacks} Consider a supervised learning problem characterized by a loss function $\mathcal{L}(\theta;\mathcal{D})$ and an adversarial loss $L_{adv}(\hat\theta;\mathcal{D})$, where $\hat\theta$ is the set of learnable parameters and $\mathcal{D}$ is a labeled dataset. Let $\mathcal{D}_{train}$ be the training dataset. We assume that the adversary can poison a fraction of those data points, so that $\mathcal{D}_{train}=\mathcal{D}_{c} \cup \mathcal{D}_{p}$, where $\mathcal{D}_{c}$ and $\mathcal{D}_{p}$ are the set of clean and poisoned data points, respectively. We assume that $|\mathcal{D}_{p}|= \epsilon |\mathcal{D}_{c}|$. Furthermore, $\mathcal{D}_{p} \subseteq \mathcal{F}_{\beta}$ where $\mathcal{F}_{\beta}$ is the feasible set, which is a set selected by a defense mechanism based on anomaly detection techniques, containing elements that the defender considers as sanitized data to train its model. The existence of the feasible set in the objective helps the poisoned points to blend with the natural data and make it more difficult for anomaly detector techniques to detect them \cite{koh2018stronger}. A data poisoning attack can be written as the following optimization problem (over the set of poisoned data points): \begin{align*} \underset{\mathcal{D}_p}\max & \; L_{adv}(\hat\theta;\mathcal{D}_{test}) \\ s.t. \;\; & |\mathcal{D}_p| = \epsilon |\mathcal{D}_{c}| \\ & \mathcal{D}_{p} \subseteq \mathcal{F}_{\beta} \qquad \qquad \\ \text{where} \;\; & \hat\theta = \argmin_{\theta} \; \mathcal{L}(\theta;\mathcal{D}_{c} \cup \mathcal{D}_{p}). \numberthis \label{objective} \end{align*} \ignore{ \begin{align*} \underset{\mathcal{D}_p}\max & \; L(\hat\theta;\mathcal{D}_{test}) \qquad \;\;\;\;\;\;\; \text{($L$ being the loss function and $\hat\theta$ model parameter)}\\ s.t. \;\; & |\mathcal{D}_p| = \epsilon |\mathcal{D}_{c}| \qquad \;\;\;\;\;\; \text{($|\mathcal{D}_p|$ and $|\mathcal{D}_{c}|$ number of poisoned and clean instances)}\\ & \mathcal{D}_{p} \subseteq \mathcal{F}_{\beta} \qquad \qquad \;\;\;\; \text{($\mathcal{F}_{\beta}$ denotes the feasible set)}\\ & \mathcal{D}_{p} \subseteq (\mathcal{D}_{a} \cup \mathcal{D}_{d}) \qquad \text{($\mathcal{D}_{a}$ and $\mathcal{D}_{d}$ advantaged and disadvantaged instances)}\\ & \beta = B(\mathcal{D}_{c} \cup \mathcal{D}_{p}) \qquad \text{($\beta$ anomaly detector parameters)}\\ \text{where} \;\; & \hat\theta = \argmin_{\theta} \; L(\theta;\mathcal{D}_{c} \cup \mathcal{D}_{p}). \numberthis \label{objective} \end{align*} } In essence, the adversary attempts to maximize its test loss $L_{adv}$ by carefully selecting poisoned data points. These types of attacks are shown to be powerful against defenders that are trying to minimize their own loss $\mathcal{L}$, while the attacker is trying to harm the defense \cite{koh2018stronger}. In \cite{koh2018stronger}, authors propose to sample a positive $(\Tilde{x}_+,+1)$ and a negative $(\Tilde{x}_-,-1)$ instance and make $\epsilon |\mathcal{D}_c|$ copies from these sampled instances to serve as poisoned data points inversely proportional to the class balance such that there are $(|\mathcal{D}_{c}^+|\epsilon)$ copies from the negative poison instance $(\Tilde{x}_-,-1)$ and $(|\mathcal{D}_{c}^-|\epsilon)$ copies from the positive poison instance $(\Tilde{x}_+,+1)$ in which $|\mathcal{D}_{c}^+|$ and $|\mathcal{D}_{c}^-|$ represent the number of positive and negative points in the clean data respectively. \section{Poisoning Attacks against Fairness} \begin{algorithm}[h] \SetAlgoLined Input: clean data set $\mathcal{D}_{c}=\{(x_1,y_1),(x_2,y_2),...,(x_n,y_n)\}$, poison fraction $\epsilon$, and step size $\eta$. \\ Output: poisoned data set $\mathcal{D}_{p}=\{(\Tilde {x}_1,\Tilde{y}_1),(\Tilde{x}_2,\Tilde{y}_2),...,(\Tilde{x}_{\epsilon n},\Tilde{y}_{\epsilon n})\}$. \\ From $\mathcal{D}_{a}$ randomly sample the positive poisoned instance $\mathcal{I}_{+} \leftarrow (\Tilde{x}_1,\Tilde{y}_1)$. \\ From $\mathcal{D}_{d}$ randomly sample the negative poisoned instance $\mathcal{I}_{-} \leftarrow (\Tilde{x}_2,\Tilde{y}_2)$. \\ Make copies from $\mathcal{I}_{+}$ and $\mathcal{I}_{-}$ until having $\epsilon |\mathcal{D}_{c}|$ poisoned copies $\mathcal{C}_{p}$. \\ Load poisoned data set $\mathcal{D}_{p} \leftarrow \{\mathcal{C}_{p}\}$. \\ Load feasible set by applying anomaly detector $B$ $ \mathcal{F}_{\beta} \leftarrow B(\mathcal{D}_{c} \cup \mathcal{D}_{p})$. \\ \For{t= 1,2,...}{ $\hat{\theta} \leftarrow argmin_{\theta} \; \mathcal{L}(\theta;(\mathcal{D}_{c} \cup \mathcal{D}_{p})).$ \\ Pre-compute $g^{\top}_{\hat{\theta},\mathcal{D}_{test}} H^{-1}_{\hat{\theta}}$ from $L_{adv}$ for details refer to \cite{koh2018stronger}. \\ \For{i= 1,2}{ Set $\Tilde{x}_{i}^0 \leftarrow \Tilde{x}_{i} - \eta g^{\top}_{\hat{\theta},\mathcal{D}_{test}} H^{-1}_{\hat{\theta}} \frac{\partial^2 \ell(\hat{\theta};\Tilde{x}_i,\Tilde{y}_i) }{\partial \hat{\theta}\partial \Tilde{x}_i}. $ \\ Set $\Tilde{x}_{i} \leftarrow argmin_{x \in \mathcal{F}_{\beta}} ||x - \Tilde{x}_{i}^0 ||_2.\;\;\;$ (To project $\mathcal{D}_{p}$ back to $\mathcal{F}_{\beta}$).\\ } Update copies $\mathcal{C}_{p}$ based on updates on $\mathcal{I}_{+}$ and $\mathcal{I}_{-}$. \\ Update feasible set $ \mathcal{F}_{\beta} \leftarrow B(\mathcal{D}_{c} \cup \mathcal{D}_{p})$. \\ } \caption{Influence Attack on Fairness} \label{hard_biasing_influence} \end{algorithm} \begin{figure*}[h] \includegraphics[width=0.17\textwidth,trim=1cm 6cm 25.3cm 6.2cm,clip=true]{images/poisoned.pdf} \begin{subfigure}[b]{0.37\textwidth} \caption{Before Attack} \includegraphics[width=\textwidth,trim=8.8cm 3cm 10.3cm 4cm,clip=true]{images/poison_pic_bold3.pdf} \end{subfigure} \begin{subfigure}[b]{0.37\textwidth} \caption{Anchoring Attack} \includegraphics[width=\textwidth,trim=8.8cm 3cm 10.3cm 4cm,clip=true]{images/heuristic_attack.pdf} \end{subfigure} \caption{Anchoring attack representation. The figure on the left represents the before attack, while the right figure represents the anchoring attack in which poisoned points are located in close vicinity (depicted as the large solid circle) of target points.} \label{attack_disc} \end{figure*} Now that we have discussed poisoning attacks, we will discuss how these attacks can be extended to fairness. We follow a common fairness setup where there are two groups: advantaged and disadvantaged. An example of advantaged and disadvantaged groups can be male and female in the job market where males could have advantage over females in getting hired in certain jobs. We assume that all poisoned points belong to either the advantaged or disadvantaged group, $\mathcal{D}_{p} \subseteq (\mathcal{D}_{a} \cup \mathcal{D}_{d})$, in which $\mathcal{D}_{a}$ represents data points from the advantaged demographic group and $\mathcal{D}_{d}$ represents data points from the disadvantaged demographic group. \subsection{Influence Attack on Fairness} For the influence attack on fairness, we use the influence attack introduced in \cite{koh2018stronger,koh2017understanding}, with a modification that includes the demographic information, in which the attack tries to maximize a given loss. We then incorporate a loss function maximizing which using the influence attack can harm fairness. In \cite{zafar2015learning}, authors propose a loss function for fair classification with a constraint involving the covariance between the sensitive features ($z$) and the signed distance from feature vectors to the decision boundary ($d_{\theta}(x)$) formalized as: \[ Cov(z,d_{\theta}(x)) \approx \frac{1}{N} \sum_{i=1}^N (z_i - \Bar{z})d_{\theta}(x_i). \] By combining the above constraint with the original classification loss and maximizing it, the attacker can harm both fairness and accuracy at the same time via a regularization term, $\lambda$, that controls the trade-off between these two terms. Thus, the loss in our influence attack on fairness contains two parts: $\ell_{acc}$ and $\ell_{fairness}$ in which $\ell_{acc}$ controls for accuracy and $\ell_{fairness}$ controls for fairness constraints. \begin{align*} L_{adv}(\hat\theta;\mathcal{D}_{test}) & = \ell_{acc} +\lambda \ell_{fairness} \\ where \;\; \ell_{fairness} & = \frac{1}{N} \sum_{i=1}^N (z_i - \Bar{z})d_{\hat\theta}(x_i). \numberthis \label{hard_biasing_loss} \end{align*} In other words, the influence attack on fairness would try to harm the fairness constraint and affect a model with respect to disparate impact~\cite{zafar2017fairness}. This loss can affect a model in terms of both fairness and accuracy with the regularization term $\lambda$ that controls the trade-off. In order to maximize the loss in \eqref{hard_biasing_loss}, we use the influence attack strategy \cite{koh2018stronger,koh2017understanding} with changes that would incorporate demographic information as shown in Algorithm \ref{hard_biasing_influence}. Similar to the convention in \cite{koh2018stronger}, we sample one positive and one negative instance uniformly at random and make copies of the sampled instances that serve as our poisoned points. However, since we now have to take demographics into consideration for maximizing the bias and harming fairness, we sample the positive instance from $\mathcal{D}_{a}$ and the negative instance from $\mathcal{D}_{d}$. Notice that the opposite is also possible if an adversary wants to skew the disadvantaged group into being advantageous; however, for the goals of this paper and showing how our methods can increase the bias and harm fairness, we follow the aforementioned sampling procedure. \subsection{Anchoring Attack} We now describe a simple generic anchoring attack that can work with any loss function. Our results indicate that the proposed attack harms the model with regard to fairness. The anchoring attack works as follows (details in Algorithm \ref{soft_biasing_alg}). First, the attacker samples a target $x_{target}$ that belongs to the clean data, $x_{target} \in \mathcal{D}_c$. Next, the attacker generates poisoned data point $\Tilde{x}$ in the vicinity of $x_{target}$, so that this new point has the same demographic but the opposite label, $demographic(x_{target})=demographic(\Tilde{x})$ and $y_{target}\neq \Tilde{y}$. The general idea of the attack is to target some points ($x_{target}$) and cloud their labels through poisoned points that have opposite labels, which would lead to a skewed decision boundary, change in predictive labels of clean target points, and more biased outcomes. The right plot in Figure \ref{attack_disc} depicts an anchoring attack in which the poisoned points colored in black are placed to lie close to the target points that have the same demographic group but opposite label to bias the predictive outcome (black advantaged poisoned points with label +1 are targeting advantaged point with label -1, and black disadvantaged poisoned points with label -1 are targeting disadvantaged point with label +1). This placement of poisoned points in the space during the learning procedure will lead the decision boundary to change and, as a result, will cause more advantaged points to have a predictive outcome of +1 and more disadvantaged points to have a predictive outcome of -1, which is biasing the model's prediction. $\mathbf{x_{target}}$ can be sampled in several ways. We introduce two ways, \textit{random} and \textit{non-random}, for sampling $\mathbf{x_{target}}$. \textbf{Random Anchoring Attack.} In random anchoring attack, $\mathbf{x_{target}}$ is sampled uniformly at random for each demographic group. \textbf{Non-random Anchoring Attack.} In the non-random anchoring attack, we choose popular $\mathbf{x_{target}}$ as our target for each demographic group. \begin{algorithm}[h] \SetAlgoLined Input: clean data set $\mathcal{D}_{c}=\{(x_1,y_1),(x_2,y_2),...,(x_n,y_n)\}$, poison fraction $\epsilon$, and vicinity distance $\tau$. \\ Output: poisoned data set $\mathcal{D}_{p}=\{(\Tilde {x}_1,\Tilde{y}_1),(\Tilde{x}_2,\Tilde{y}_2),...,(\Tilde{x}_{\epsilon n},\Tilde{y}_{\epsilon n})\}$. \\ \For{t= 1,2,...}{ Sample negative $x_{target^{-}}$ from $\mathcal{D}_a$ and positive $x_{target^{+}}$ from $\mathcal{D}_d$ with random or non-random technique. \\ $\mathcal{G}_+$: Generate $(|\mathcal{D}_{c}^-|\epsilon)$ positive poisoned points $(\tilde{x}_{+},+1)$ with $\mathcal{D}_a$ in the close vicinity of $x_{target^{-}}$ s.t. $||\tilde{x}_{+} - x_{target^{-}}||_2 \leq \tau$. \\ $\mathcal{G}_-$: Generate $(|\mathcal{D}_{c}^+|\epsilon)$ negative poisoned points $(\tilde{x}_{-},-1)$ with $\mathcal{D}_d$ in the close vicinity of $x_{target^{+}}$ s.t. $||\tilde{x}_{-} - x_{target^{+}}||_2 \leq \tau$.\\ Load $\mathcal{D}_p$ from the generated data above $\mathcal{D}_p \leftarrow \mathcal{G}_+ \cup \mathcal{G}_-$. \\ Load the feasible set $ \mathcal{F}_{\beta} \leftarrow B(\mathcal{D}_{c} \cup \mathcal{D}_{p})$. \\ \For{i=1,2,...,$\epsilon n$}{ Set $\Tilde{x}_{i} \leftarrow argmin_{x \in \mathcal{F}_{\beta}} ||x - \Tilde{x}_{i} ||_2.\;\;\;$ (To project $\mathcal{D}_{p}$ back to $\mathcal{F}_{\beta}$).\\ } $argmin_{\theta} \; \mathcal{L}(\theta;(\mathcal{D}_{c} \cup \mathcal{D}_{p})).$ \\ } \caption{Anchoring Attack} \label{soft_biasing_alg} \end{algorithm} Here, popular $\mathbf{x_{target}}$ means the point that is close to more similar instances $x_i$, eligible to serve as targets, such that $demographic(x_i) = demographic(x_{target})$ and $y_i = y_{target}$. By doing this, we can ensure to affect as much as points similar to $\mathbf{x_{target}}$ as possible to maximize our biasing goal. Pick $x$ with $max(c)$ as $x_{target}$ where $c$ is calculated for each $x$ as follows: $\forall x_i$ if $demographic(x_i) = demographic(x)$ and $y_i = y$ and $||x_i - x || < \sigma$ then increase $c$ for $x$.
{'timestamp': '2020-12-17T02:08:27', 'yymm': '2012', 'arxiv_id': '2012.08723', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08723'}
arxiv
\section{Introduction} \label{sec-introduction} \begin{figure} \centering \includegraphics[width=\linewidth]{./fig01.pdf} \caption{Mean rank of {\textsc{MiniRocket}} in terms of accuracy versus other SOTA methods over 30 resamples of 109 datasets from the UCR archive.} \Description[In terms of accuracy, Apricot ranks just ahead of Rocket, but behind both TS-CHIEF and HIVE-COTE/TDE]{In terms of accuracy, Apricot ranks just ahead of Rocket, but behind both TS-CHIEF and HIVE-COTE/TDE. Apricot is in the same clique as InceptionTime, Rocket, TS-CHIEF, and HIVE-COTE, that is, the pairwise differences between these classifiers are not statistically significant.} \label{fig-rank-ucr109} \end{figure} \begin{figure} \centering \includegraphics[width=\linewidth]{./fig02.pdf} \caption{Transform time for {\textsc{MiniRocket}} versus {\textsc{Rocket}} for the same 109 datasets from the UCR archive.} \Description[In terms of transform time, Apricot is between approximately 5 and 70 times faster than Rocket]{Scatter plot showing the total transform time (training and test) for Apricot against the total transform time for Rocket for 109 datasets from the UCR archive, on a log scale. In terms of total transform time, Apricot is between approximately 5 and 70 times faster than Rocket. The difference in total transform time increases, that is, Apricot is relatively faster, as total transform time increases. For shorter transform times, Apricot is closer to 10 times faster than Rocket, for longer transform times, Apricot is approaching 70 times faster than Rocket.} \label{fig-transform-time-minirocket-vs-rocket} \end{figure} Until recently, the most accurate methods for time series classification were limited by high computational complexity. While there have been considerable advances in recent years, computational complexity and a lack of scalability remain persistent problems. {\textsc{Rocket}} \citep{dempster_etal_2020} achieves state-of-the-art accuracy with a fraction of the computational expense of any method of comparable accuracy by transforming input time series using random convolutional kernels, and using the transformed features to train a linear classifier. We show that it is possible to reformulate {\textsc{Rocket}}, making it up to $75$ times faster on larger datasets, and making it almost entirely deterministic (and optionally, with additional computational expense, fully deterministic), while maintaining essentially the same accuracy. We call this method {\textsc{MiniRocket}} (for \textbf{MINI}mally \textbf{R}and\textbf{O}m \textbf{C}onvolutional \textbf{KE}rnel \textbf{T}ransform). Like {\textsc{Rocket}}, {\textsc{MiniRocket}} transforms input time series using convolutional kernels, and uses the transformed features to train a linear classifier. However, unlike {\textsc{Rocket}}, {\textsc{MiniRocket}} uses a small, fixed set of kernels, and is almost entirely deterministic. {\textsc{MiniRocket}} maintains the two most important aspects of {\textsc{Rocket}}: dilation and PPV, i.e., `proportion of positive values' pooling \citep{dempster_etal_2020}. {\textsc{MiniRocket}} exploits various properties of the kernels, and of PPV, in order to massively reduce the time required for the transform. {\textsc{MiniRocket}} demonstrates that, while random convolutional kernels are highly effective, it is possible to achieve essentially the same accuracy using a mostly-deterministic and much faster procedure. Figure \ref{fig-rank-ucr109} shows the mean rank of {\textsc{MiniRocket}} in terms of accuracy versus other state-of-the-art methods over 30 resamples of 109 datasets from the UCR archive of benchmark time series \citep{dau_etal_2019}. On average, {\textsc{MiniRocket}} is marginally more accurate than {\textsc{Rocket}}, and slightly less accurate than the most accurate current methods. \begin{sloppypar} Figure \ref{fig-transform-time-minirocket-vs-rocket} shows total transform time (training and test) for {\textsc{MiniRocket}} versus {\textsc{Rocket}}, for the same 109 datasets. On average, {\textsc{MiniRocket}} is more than $30$ times faster than {\textsc{Rocket}} (the advantage is even greater for larger datasets: see Section \ref{subsec-scalability}). Restricted to a single CPU core, total compute time for {\textsc{Rocket}} over all 109 datasets is 2 hours 2 minutes (1h 55m transform time), versus just 8 minutes for {\textsc{MiniRocket}} (2m 30s transform time). To put this in context, total compute time for {\textsc{MiniRocket}} for all 109 datasets is less than the compute time for {\textsc{Rocket}} for just one of those datasets. (Compute times are averages over 30 resamples, run on a cluster using Intel Xeon E5-2680 v3/4 and Xeon Gold 6150 CPUs, restricted to a single CPU core per dataset per resample.) \end{sloppypar} While only broadly comparable due to hardware and software differences, total compute time for the same 109 datasets using a single CPU thread is approximately 13 hours for cBOSS, more than a day for CIF, more than two days for TDE, approximately a week for Proximity Forest, more than two weeks for HIVE-COTE, and several weeks for TS-CHIEF \citep{bagnall_etal_2020,middlehurst_etal_2020a,middlehurst_etal_2020b}. Total compute time for InceptionTime (using GPUs, and for the original training/test splits rather than resamples) is more than 4 days \citep{ismailfawaz_etal_2020}. {\textsc{MiniRocket}} represents a significant advance in accuracy relative to computational cost. {\textsc{MiniRocket}} is significantly faster than any other method of comparable accuracy (including {\textsc{Rocket}}), and significantly more accurate than any other method of even roughly-similar computational expense. The rest of this paper is structured as follows. In Section \ref{sec-related-work}, we review relevant related work. In Section \ref{sec-method}, we detail the changes from {\textsc{Rocket}} to {\textsc{MiniRocket}}. In Section \ref{sec-experiments}, we present experimental results for {\textsc{MiniRocket}} in terms of accuracy and scalability, as well as a sensitivity analysis in relation to key parameter choices. \section{Related Work} \label{sec-related-work} \subsection{Current State of the Art} Recent advances in accuracy have largely superseded the most accurate methods originally identified in \citep{bagnall_etal_2017}. According to \citep{bagnall_etal_2020,middlehurst_etal_2020a,middlehurst_etal_2020b}, the most accurate current methods for time series classification are HIVE-COTE and its variants \citep{lines_etal_2018}, TS-CHIEF \citep{shifaz_etal_2020}, InceptionTime \citep{ismailfawaz_etal_2020}, and {\textsc{Rocket}} \citep{dempster_etal_2020}. However, while accuracy has improved, with some exceptions computational complexity and a lack of scalability remain persistent problems. TS-CHIEF builds on Proximity Forest, an ensemble of decision trees using distance measures as splitting criteria \citep{lucas_etal_2019}. In addition to distance measures, TS-CHIEF uses interval-based and spectral-based splitting criteria \citep{shifaz_etal_2020}. InceptionTime is an ensemble of convolutional neural networks based on the Inception architecture, and is the most accurate convolutional neural network model for time series classification \citep{ismailfawaz_etal_2020}. The Temporal Dictionary Ensemble (TDE) is a recent dictionary method based on the frequency of occurrence of patterns in time series \citep{middlehurst_etal_2020a}. TDE combines aspects of earlier dictionary methods including cBOSS \citep{middlehurst_etal_2019}, a more scalable variant of BOSS \citep{schafer_2015}. Catch22 is a transform based on 22 predefined time series features, used in combination with a decision tree or random forest \citep{lubba_etal_2019}. On its own, catch22 is fast, but highly inaccurate: see \citep{dempster_etal_2020,middlehurst_etal_2020b}. The Canonical Interval Forest (CIF) is a recent method which adapts the Time Series Forest (TSF) to use catch22 features \citep{middlehurst_etal_2020b}. CIF is significantly more accurate than either catch22 or TSF. \begin{sloppypar} HIVE-COTE is an ensemble of other methods including BOSS and TSF. Two recent variants of HIVE-COTE, namely HIVE-COTE/TDE (using TDE in place of BOSS) and HIVE-COTE/CIF (using CIF in place of TSF) have been shown to be significantly more accurate than HIVE-COTE, or any other existing method for time series classification \citep{middlehurst_etal_2020a,middlehurst_etal_2020b}. These variants are, in turn, based on an updated `base' version of HIVE-COTE \citep{bagnall_etal_2020}. \end{sloppypar} While state of the art in terms of accuracy, with the exception of cBOSS these methods are limited by high computational complexity, requiring days or even weeks to train on the datasets in the UCR archive. While more scalable, cBOSS is significantly less accurate than most of the other methods. \subsection{{\textsc{Rocket}}} {\textsc{Rocket}} achieves state-of-the-art accuracy, matching the most accurate methods for time series classification (with the exception of the most recent variants of HIVE-COTE), but is considerably faster and more scalable than other methods of comparable accuracy \citep{dempster_etal_2020}. {\textsc{Rocket}} transforms input time series using random convolutional kernels, and uses the transformed features to train a linear classifier. Each input time series is convolved with $10{,}000$ random convolutional kernels. {\textsc{Rocket}} applies global max pooling and PPV (for `proportion of positive values') pooling to the resulting convolution output to produce two features per kernel per input time series, for a total of $20{,}000$ features per input time series. The transformed features are then used to train a linear classifier: a ridge regression classifier, or logistic regression trained using stochastic gradient descent (for larger datasets). The kernels are random in terms of their length, weights, bias, dilation, and padding: see Section \ref{subsec-removing-randomness}. The two most important aspects of {\textsc{Rocket}} in terms of achieving state-of-the-art accuracy are the use of dilation, sampled on an exponential scale, and the use of PPV. {\textsc{Rocket}} forms the basis for {\textsc{MiniRocket}}. The differences between {\textsc{Rocket}} and {\textsc{MiniRocket}} are detailed in Section \ref{sec-method}. \subsection{Other Methods} The use of a small, fixed set of kernels differentiates {\textsc{MiniRocket}} from both {\textsc{Rocket}}, which uses random kernels, and convolutional neural networks such as InceptionTime, which use learned kernels. It also differentiates {\textsc{MiniRocket}} from other methods with at least superficial similarities to {\textsc{Rocket}}, such as random shapelet methods as in \citep{karlsson_etal_2016}, and other random methods such as those based on \citep{rahimi_and_recht_2008}. In using kernels with weights constrained to two values (see Section \ref{subsubsec-weights}), there are obvious similarities with binary and quantised convolutional neural networks \citep{rastegari_etal_2016,hubara_etal_2018}. {\textsc{MiniRocket}} makes use of at least two advantages of binary/quantised kernels, namely, the ability to perform the convolution operation via addition, as well as efficiencies arising from the relatively small number of possible binary kernels of a given size, e.g., \citep{rastegari_etal_2016,juefeixu_etal_2017,hubara_etal_2018}. However, while the kernels used in {\textsc{MiniRocket}} are binary in the sense of having only two values, these values are \textit{not} $0$ and $1$ (or $-1$ and $1$). In fact, the actual values of the weights are not important: see Section \ref{subsubsec-weights}. {\textsc{MiniRocket}} does not use bitwise operations, and the input and convolution output are used at full precision. The optimisations used in {\textsc{MiniRocket}} are similar in motivation to several optimisations developed for convolutional neural networks, i.e., broadly speaking, to reduce the number of operations (especially multiplications) required to perform the convolution operation, e.g., \citep{liu_etal_2015,lavin_and_gray_2016,chollet_2017,mehta_etal_2018}. In precomputing the product of the kernel weights and the input, and using those precomputed values to construct the convolution output (see Sections \ref{subsubsec-factoring-out} and \ref{subsubsec-all-kernels-at-once}), the optimisations used in {\textsc{MiniRocket}} bear some resemblance to highly simplified versions of shift-based methods \citep{wu_etal_2018}, where conventional convolutional kernels are replaced by a combination of $1 \times 1$ convolutions and spatial shifts in the input, and lookup-based methods \citep{bagherinezhad_etal_2017}, where the convolution operation is performed via linear combinations of the precomputed convolution output for a small `dictionary' of kernels. However, the optimisations used in {\textsc{MiniRocket}} are much simpler than these methods. {\textsc{MiniRocket}} uses a fixed set of kernels, and uses the convolution output for these kernels directly, rather than through a learned linear combination, c.f., e.g., \citep{bagherinezhad_etal_2017,juefeixu_etal_2017}. The optimisations arise as a natural result of using this fixed set of kernels, rather than being general-purpose optimisations. Several things further distinguish {\textsc{MiniRocket}} (and {\textsc{Rocket}}) from most approaches involving convolutional neural networks. The features produced by the transform are all independent of each other (there is no hidden layer). Neither the convolution output nor the pooled features are transformed through, e.g., a sigmoid function or rectified linear unit (ReLU). As such, the classifier learns a direct linear function of the features produced by the transform. {\textsc{MiniRocket}} is also distinguished by its use of dilation (similar to using many different dilations in a single convolutional layer, with dilations taking any integer value not just powers of two), and PPV. \section{Method} \label{sec-method} {\textsc{MiniRocket}} involves making certain key changes in order to remove almost all randomness from {\textsc{Rocket}} (Section \ref{subsec-removing-randomness}), and exploiting these changes in order to dramatically speed up the transform (Section \ref{subsec-optimising-the-transform}). In tuning kernel length, weights, bias, etc., we have restricted ourselves to the same 40 `development' datasets as used in \citep{dempster_etal_2020}, with the same aim of avoiding overfitting the entire UCR archive. (Note, however, that it is not necessarily the aim of {\textsc{MiniRocket}} to maximise accuracy \textit{per se}, but rather to balance accuracy with parameter choices which remove randomness and are conducive to optimising the transform.) The procedures for setting the parameter values and performing the transform are set out in \texttt{\ref{pseudo-fit}} and \texttt{\ref{pseudo-transform}} in Appendix \ref{sec-appendix-pseudocode}. As for {\textsc{Rocket}}, we implement {\textsc{MiniRocket}} in Python, compiled via Numba \citep{lam_etal_2015}. We use a ridge regression classifier from scikit-learn \citep{pedregosa_etal_2011}, and logistic regression implemented using PyTorch \citep{paszke_etal_2019}. Our code is available at: \url{https://github.com/angus924/minirocket}. \subsection{Removing Randomness} \label{subsec-removing-randomness} \begin{table} \centering \caption{Summary of changes from {\textsc{Rocket}} to {\textsc{MiniRocket}}.} \begin{tabular}{ccc} \toprule & {\textsc{Rocket}} & {\textsc{MiniRocket}} \\ \midrule length & $\{7, 9, 11\}$ & 9 \\ weights & $\mathcal{N}(0, 1)$ & $\{-1, 2\}$ \\ bias & $\mathcal{U}(-1, 1)$ & from convolution output \\ dilation & random & fixed (rel. to input length) \\ padding & random & fixed \\ features & PPV + max & PPV \\ num. features & 20K & 10K \\ \bottomrule \end{tabular} \label{table-changes-rocket-to-minirocket} \end{table} {\textsc{Rocket}} uses kernels with lengths selected randomly from $\{7,9,11\}$, weights drawn from $\mathcal{N}(0, 1)$, bias terms drawn from $\mathcal{U}(-1, 1)$, random dilations, and random paddings. Two features, PPV and max, are computed per kernel, for a total of $20{,}000$ features. {\textsc{MiniRocket}} is characterised by a number of key changes to the kernels in terms of length, weights, bias, dilation, and padding, as well as resulting changes to the features, as summarised in Table \ref{table-changes-rocket-to-minirocket}. \subsubsection{Length} {\textsc{MiniRocket}} uses kernels of length 9, with weights restricted to two values, building on the observation in \citep{dempster_etal_2020} that weights drawn from $\{-1, 0, 1\}$ produce similar accuracy to weights drawn from $\mathcal{N}(0, 1)$. In order to maximise computational efficiency, the set of kernels should be as small as possible: see Section \ref{subsubsec-reusing-output}. The set of possible two-valued kernels grows exponentially with length. There are $2^{3} = 8$ possible kernels of length 3, but $2^{15} = 32{,}768$ possible kernels of length 15. With more than two values, the set of possible kernels grows even faster with length. For example, there are $3^{15} \approx 14\text{ million}$ possible three-valued kernels of length 15. There are $2^{9} = 512$ possible two-valued kernels of length 9. {\textsc{MiniRocket}} uses a subset of 84 of these kernels, a subset which balances accuracy with the computational advantages of using a small number of kernels: see Section \ref{subsubsec-sensitivity-kernels}. (A length of 9 is also consistent with the average length used in {\textsc{Rocket}}.) \subsubsection{Weights} \label{subsubsec-weights} Kernels with weights restricted to two values, $\alpha$ and $\beta$, can be characterised in terms of the number of weights with the value $\beta$ (or, equivalently, the number of weights with the value $\alpha$). In this sense, the full set of two-valued kernels of length 9 includes the subset of kernels with 1 value of $\beta$ (e.g., $[\alpha,\alpha,\alpha,\alpha,\alpha,\alpha,\alpha,\alpha,\beta]$), the subset of kernels with 2 values of $\beta$ (e.g., $[\alpha,\alpha,\alpha,\alpha,\alpha,\alpha,\alpha,\beta,\beta]$), and so on. {\textsc{MiniRocket}} uses the subset kernels with 3 values of $\beta$: \begin{gather*} [\alpha,\alpha,\alpha,\alpha,\alpha,\alpha,\beta,\beta,\beta] \\ [\alpha,\alpha,\alpha,\alpha,\alpha,\beta,\alpha,\beta,\beta] \\ [\alpha,\alpha,\alpha,\alpha,\beta,\alpha,\alpha,\beta,\beta] \\ ... \end{gather*} For {\textsc{MiniRocket}}, we set $\alpha = -1$ and $\beta = 2$. However, the choice of $\alpha$ and $\beta$ is arbitrary, in the sense that the scale of these values is unimportant. For an input time series, $X$, kernel, $W$, and bias, $b$, PPV is given by $\text{PPV}(X * W - b) = \frac{1}{n} \sum [X * W - b > 0]$ or, equivalently, $\text{PPV}(X * W) = \frac{1}{n} \sum [X * W > b]$, where `$*$' denotes convolution, and $[X \in a]$ denotes the indicator function. As such, computing PPV is essentially equivalent to computing the empirical cumulative distribution function. Accordingly, the scale of the weights is unimportant, because bias values are drawn from the convolution output, $X * W$ (see Section \ref{subsubsec-bias}), and so by definition match the scale of the weights and the scale of the input. (Hence, in contrast to {\textsc{Rocket}}, it is not necessary to normalise the input.) It is only important that the sum of the weights should be zero or, equivalently, that $\beta = -2 \alpha$. Otherwise, the values of $\alpha$ and $\beta$ are not important. This constraint---that the weights sum to zero---ensures that the kernels are only sensitive to the relative magnitude of the values in the input, i.e., that the convolution output is invariant to the addition or subtraction of any constant value to the input, i.e., $X * W = (X \pm c) * W$. As PPV is bounded between 0 and 1, in computing PPV for a given kernel, $W$, we get an equivalent feature for the inverted kernel, $-W$, `for free': see Section \ref{subsubsec-computing-ppv}. Accordingly, there is no need to use both the set of kernels with weights $\alpha = -1$ and $\beta = 2$, and the corresponding inverted set of kernels with weights $\alpha = 1$ and $\beta = -2$, as we get these inverted kernels `for free'. The set of 84 kernels of length 9 with three weights with the value $\beta = 2$, and six weights with the value $\alpha = -1$, has the desirable properties of being a relatively small, fixed set of kernels---conducive to the optimisations pursued in Section \ref{subsec-optimising-the-transform}---and producing high classification accuracy. However, we stress that there is not necessarily anything `special' about this set of kernels. Other subsets of kernels of length 9, and kernels of other lengths, produce similar accuracy: see Section \ref{subsubsec-sensitivity-kernels}. This is in addition to the observations in \citep{dempster_etal_2020}, i.e., that kernels (of various lengths) with weights drawn from $\mathcal{N}(0, 1)$, or from $\{-1, 0, 1\}$, are also effective. \subsubsection{Bias} \label{subsubsec-bias} Bias values are drawn from the convolution output, and are used to compute PPV as set out above in Section \ref{subsubsec-weights}. By default, for a given kernel/dilation combination, bias values are drawn from the quantiles of the convolution output for a single, randomly-selected training example. For a given kernel, $W$, and dilation, $d$, we compute the convolution output for a randomly-selected training example, $X$, i.e., $W_{d} * X$. We take, e.g., the $[0.25, 0.5, 0.75]$ quantiles from $W_{d} * X$ as bias values, to be used in computing PPV. We use a low-discrepancy sequence to assign quantiles to different kernel/dilation combinations \citep{schretter_etal_2016}. The selection of training examples for the purpose of sampling bias values is the only stochastic element of {\textsc{MiniRocket}}. Further, while the choice of training example is random, in drawing bias values from the convolution output, we are selecting values produced by an otherwise entirely deterministic procedure. This is why we characterise {\textsc{MiniRocket}} as `minimally random'. For the deterministic variant of {\textsc{MiniRocket}}, bias values are drawn from the convolution output for the entire training set, rather than a single, randomly-selected training example. This is the only substantive difference between the default and deterministic variants, and the difference in accuracy between the two variants is negligible: see Section \ref{subsec-ucr-archive}. The advantage of using the entire training set is an entirely deterministic transform, for applications where this is desirable. However, this comes at additional computational cost, which is unlikely to be practical for larger datasets. Crucially, however, it demonstrates that the accuracy of {\textsc{Rocket}} is achievable using an entirely deterministic transform. In practice, using a single, randomly-selected training example has little impact in terms of accuracy. A variant of {\textsc{Rocket}} using the same method for sampling bias values as {\textsc{MiniRocket}} is slightly more accurate than default {\textsc{Rocket}} but, overall, the difference is relatively minor: see Section \ref{subsec-ucr-archive}. \subsubsection{Dilation} \label{subsubsec-dilation} Dilation is used to `spread' a kernel over the input. For dilation, $d$, a given kernel is convolved with every $d^{\text{th}}$ element of the input \citep{yu_and_koltun_2016,dempster_etal_2020}. Each kernel is assigned the same fixed set of dilations, adjusted to the length of the input time series. We specify dilations in the range $D = \{\lfloor 2^{0} \rfloor, ..., \lfloor 2^{\text{max}} \rfloor\}$, where the exponents are uniformly spaced between 0 and $\text{max} = \log_2 ( l_{\text{input}} - 1 ) / ( l_{\text{kernel}} - 1 )$, where $l_{\text{input}}$ is input length and $l_{\text{kernel}}$ is kernel length (i.e., 9), such that the maximum effective length of a kernel, including dilation, is the length of the input time series. The count of each unique integer dilation value in $D$ determines the number of features to be computed per dilation (scaled according to the total number of features), ensuring that, as in {\textsc{Rocket}}, exponentially more features are computed for smaller dilations. As time series length increases, the number of possible dilation values increases. This means that, for a fixed number of features, the number of features computed per dilation decreases (unless constrained in some way), making the transform less efficient: see Section \ref{subsubsec-reusing-output}. Hence, by default, we limit the maximum number of dilations per kernel to 32. While technically an additional hyperparameter, this has little effect on accuracy (see Section \ref{subsubsec-sensitivity-dilation}), and is intended to be kept at its default value. \subsubsection{Padding} \label{subsubsec-padding} Padding is alternated for each kernel/dilation combination such that, overall, half the kernel/dilation combinations use padding, and half do not. As for {\textsc{Rocket}}, {\textsc{MiniRocket}} uses standard zero padding. In effect, zeros are added to the start and end of each input time series such that the convolution operation begins with the `middle' element of the kernel centered on the first element of the time series, and ends with the `middle' element of the kernel centered on the last element of the time series \citep{goodfellow_etal_2016}. \subsubsection{Features} \label{subsubsec-features} Given the other changes, there is no longer any benefit in terms of accuracy in using global max pooling in addition to PPV: see Section \ref{subsubsec-sensitivity-features}. Accordingly, {\textsc{MiniRocket}} `drops' global max pooling and uses only PPV. We do not replace global max pooling with additional PPV features. As for {\textsc{Rocket}}, the number of features represents a tradeoff between accuracy and computational expense. {\textsc{MiniRocket}} with $10{,}000$ features already matches {\textsc{Rocket}} in terms of accuracy, and there is little or no benefit in terms of accuracy to increasing the number of features beyond $10{,}000$: see Section \ref{subsubsec-sensitivity-num-features}. Accordingly, by default, {\textsc{MiniRocket}} uses $10{,}000$ features (or, more precisely, the nearest multiple of 84---the number of kernels---less than $10{,}000$, i.e., $9{,}996$). While technically a hyperparameter, this is intended to be kept at its default value. \subsection{Optimising the Transform} \label{subsec-optimising-the-transform} {\textsc{MiniRocket}} takes advantage of the properties of the small, fixed set of two-valued kernels, and of PPV, to significantly speed up the transform through four key optimisations: \begin{enumerate} \item computing PPV for $W$ and $-W$ at the same time; \item reusing the convolution output to compute multiple features; \item avoiding multiplications in the convolution operation; and \item for each dilation, computing all kernels (almost) `at once'. \end{enumerate} \subsubsection{Computing PPV for $W$ and $-W$ at the Same Time} \label{subsubsec-computing-ppv} \begin{figure} \centering \includegraphics[width=\linewidth]{./fig03.pdf} \caption{Illustration of $\text{{\normalfont PPV}}(X * W - b) = 1 - \text{{\normalfont PPV}}(b - (X * W))$.} \Description[PPV for a given kernel, W, is equivalent to a very similar feature for the inverted kernel, negative W]{A toy example showing that PPV for a given kernel, W, is equivalent to a very similar feature for the inverted kernel, negative W. Two plots: the plot on the left shows the convolution output for input X and kernel W minus bias b, and the resulting proportion of positive values, or PPV; the plot on the right shows the convolution output for the same input X and the inverted kernel negative W plus bias b, and the proportion of negative values, or PNV. PNV for the inverted kernel negative W is shown to be the same as PPV for the kernel W.} \label{fig-diagram-ppv-inverse} \end{figure} For $C = X * W - b$, PPV is given by $\text{PPV}(C) = \frac{1}{n} \sum [c > 0].$ PPV is bounded between 0 and 1. By definition, the proportion of negative values (or PNV) is the complement of PPV, i.e., $1 - \text{PPV}(X * W - b) = \text{PNV}(X * W - b).$ That is, by computing PPV, we also implicitly compute PNV and vice versa. In this sense, PPV and PNV are equivalent. Further, the convolution operation is associative, such that $X * -W = -(X * W)$. Accordingly, by computing PPV for a given kernel, $W$, we unavoidably also compute an equivalent feature (i.e., PNV) for $-W$, that is, $\text{PPV}(X * W - b) = 1 - \text{PPV}(b - (X * W)).$ This relationship is illustrated in Figure \ref{fig-diagram-ppv-inverse}. This means that, for the purposes of PPV, it is unnecessary to compute both $X * W$ and $X * -W$. In fact, it would be redundant to do so. This means that, in practice, for a given set of kernels where each kernel, $W$, is matched by a corresponding inverted kernel, $-W$, we only need to perform the convolution operation for $W$, i.e., for half of the kernels. We get $-W$ `for free'. Accordingly, as set out in Section \ref{subsubsec-weights}, {\textsc{MiniRocket}} only uses a set of kernels with weights $\alpha = -1$ and $\beta = 2$, as it is unnecessary to also use the corresponding set of inverted kernels with weights $\alpha = 1$ and $\beta = -2$. \subsubsection{Reusing the Convolution Output} \label{subsubsec-reusing-output} For {\textsc{MiniRocket}}, the same kernel/dilation combination is used to compute multiple features, at least for smaller dilations (exponentially fewer features are computed for larger dilations: see Section \ref{subsubsec-dilation}). For a given kernel, $W$, and dilation, $d$, we compute $C = X * W_{d}$ and then reuse the convolution output, $C$, to compute multiple features, i.e., for multiple different bias values. This has the effect that multiple features are computed with the computational cost of a single convolution operation, plus the much lower cost of computing PPV for each bias value. \subsubsection{Avoiding Multiplications} \label{subsubsec-factoring-out} Restricting the kernel weights to two values allows us to, in effect, `factor out' the multiplications from the convolution operation, and to perform the convolution operation using only addition. For input time series $X = [x_{0}, x_{1}, ..., x_{n - 1}]$, and kernel $W = [w_{0}, w_{1}, ..., w_{m - 1}]$, with dilation, $d$, the convolution operation can be formulated as: $$ X * W_{d} = \sum_{j=0}^{m - 1} x_{i - (\lfloor \frac{m}{2} \rfloor \cdot d) + (j \cdot d)} \cdot w_{j}, \forall i \in \{0, 1, ..., n - 1\}. $$ Equivalently, the convolution operation can be thought of as the column sums of a matrix, $\boldsymbol{\hat{C}}$, where each row corresponds to the input time series multiplied by the appropriate kernel weight, and the alignment of the rows corresponds to dilation (values of 0 in $\boldsymbol{\hat{C}}$ represent zero padding), e.g.: $$ \hat{\boldsymbol{C}} = \begin{bmatrix} 0 & 0 & 0 & 0 & w_{0} x_{0} & \cdots \\ 0 & 0 & 0 & w_{1} x_{0} & w_{1} x_{1} & \cdots \\ 0 & 0 & w_{2} x_{0} & w_{2} x_{1} & w_{2} x_{2} & \cdots \\ \vdots & \vdots & \vdots & \vdots & \vdots & \ddots \\ w_{m - 1} x_{4} & w_{m - 1} x_{5} & w_{m - 1} x_{6} & w_{m - 1} x_{7} & w_{m - 1} x_{8} & \cdots \end{bmatrix} $$ The result of the convolution operation is given by the column sums of $\boldsymbol{\hat{C}}$, i.e., $C = X * W = \boldsymbol{1}^{\top}\boldsymbol{\hat{C}}$, where $\boldsymbol{1}$ is a vector, $[1,1,...,1]^{\top}$, of length $n$. Where the weights of the kernels are restricted to two values, $\alpha$ and $\beta$, we can `factor out' the multiplications by precomputing $A = \alpha X$ and $B = \beta X$ and then, for a given kernel, e.g., $W = [\alpha, \beta, \alpha, ..., \alpha]$, completing the convolution operation by summation using $A = [a_{0}, a_{1}, ..., a_{n - 1}]$ and $B = [b_{0}, b_{1}, ..., b_{n - 1}]$: $$ \hat{\boldsymbol{C}} = \begin{bmatrix} 0 & 0 & 0 & 0 & a_{0} & \cdots & a_{n-5} \\ 0 & 0 & 0 & b_{0} & b_{1} & \cdots & b_{n-4} \\ 0 & 0 & a_{0} & a_{1} & a_{2} & \cdots & b_{n-3} \\ \vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\ a_{4} & a_{5} & a_{6} & a_{7} & a_{8} & \cdots & 0 \end{bmatrix} $$ In other words, it is only necessary to compute $\alpha X$ and $\beta X$ once for each input time series, and then reuse the results to complete the convolution operation for each kernel by addition. \subsubsection{Computing All the Kernels (Almost) `At Once'} \label{subsubsec-all-kernels-at-once} We can take further advantage of using only two values for the kernel weights in order to perform most of the computation required for all 84 kernels `at once' for each dilation value. More precisely, as {\textsc{MiniRocket}} uses kernels with six weights of one value, and three weights of another value, we can perform $\frac{6}{9} = \frac{2}{3}$ of the computation for all 84 kernels `at once' for a given dilation. This is possible by treating all kernel weights as $\alpha = -1$, precomputing convolution output, $C_{\alpha}$, and later adjusting $C_{\alpha}$ for each kernel. Per Section \ref{subsubsec-factoring-out}, $C_{\alpha}$ can be thought of as the column sums of a matrix with 9 rows, where each row corresponds to $\alpha X = -X$, aligned according to dilation. For example, for a dilation of 1: $$ \hat{\boldsymbol{C}}_{\alpha} = \begin{bmatrix} 0 & 0 & 0 & 0 & -x_{0} & \cdots & -x_{n-5} \\ 0 & 0 & 0 & -x_{0} & -x_{1} & \cdots & -x_{n-4} \\ 0 & 0 & -x_{0} & -x_{1} & -x_{2} & \cdots & -x_{n-3} \\ \vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\ -x_{4} & -x_{5} & -x_{6} & -x_{7} & -x_{8} & \cdots & 0 \end{bmatrix} $$ For {\textsc{MiniRocket}}, the kernel weights are $\alpha = -1$ and $\beta = 2$. Let $\gamma = 3$, noting that $2 = -1 + 3$. As for $\hat{\boldsymbol{C}}_{\alpha}$, we then form $\hat{\boldsymbol{C}}_{\gamma}$, where each row corresponds to $\gamma X = 3X$, aligned according to dilation. For each kernel, $C_{\gamma}$ is equivalent to the column sums of those rows in $\hat{\boldsymbol{C}}_{\gamma}$ corresponding to the position of the $\beta$ weights in the given kernel. For example, for kernel $W = [\beta, \alpha, \beta, \alpha, \beta, \alpha, \alpha, \alpha, \alpha]$: $$ \hat{\boldsymbol{C}}_{\gamma}^{(W)} = \begin{bmatrix} 0 & 0 & 0 & 0 & 3x_{0} & \cdots & 3x_{n-5} \\ 0 & 0 & 3x_{0} & 3x_{1} & 3x_{2} & \cdots & 3x_{n-3} \\ 3x_{0} & 3x_{1} & 3x_{2} & 3x_{3} & 3x_{4} & \cdots & 3x_{n-1} \end{bmatrix} $$ The final convolution output for a given kernel is then given by $C = C_{\alpha} + C_{\gamma}$. In other words, we can reuse $C_{\alpha}$, computed once for a given dilation, to compute the convolution output for all 84 kernels for that dilation. For each kernel, computing $C$ only involves adding $C_{\gamma}$ to $C_{\alpha}$. In performing the convolution operation in this way, we only have to compute $C_{\gamma}$ for each kernel, i.e., $\frac{1}{3}$ of the computation otherwise required. \subsection{Classifiers} Like {\textsc{Rocket}}, {\textsc{MiniRocket}} is a transform, producing features which are then used to train a linear classifier. We use the same classifiers as {\textsc{Rocket}} to learn the mapping from the features to the classes, i.e., a ridge regression classifier or, for larger datasets, logistic regression trained using Adam \citep{kingma_and_ba_2015}. As for {\textsc{Rocket}}, we suggest switching from the ridge regression classifier to logistic regression when there are more training examples than features, i.e., when there are more than approximately $10{,}000$ training examples. \subsection{Complexity} Fundamentally, the scalability of {\textsc{MiniRocket}} remains the same as for {\textsc{Rocket}}: linear in the number of kernels/features ($k$), the number of examples ($n$), and time series length ($l_{\text{input}}$) or, formally, $O(k \cdot n \cdot l_{\text{input}})$. While {\textsc{MiniRocket}} uses a smaller number of kernel/dilation combinations, and computes multiple features for each kernel/dilation combination, complexity is still proportional to the number of kernels/features. Similarly, while {\textsc{MiniRocket}} `factors out' multiplications from the convolution operation, the number of addition operations is still proportional to the number of kernels and time series length, and while {\textsc{MiniRocket}} performs the majority of the computation required for all 84 kernels `at once', the remaining computation is still proportional to the number of kernels/features. However, within this broad class of complexity, the various optimisations pursued in Section \ref{subsec-optimising-the-transform} make {\textsc{MiniRocket}} significantly faster in practice. \subsection{Memory} Compared to {\textsc{Rocket}} (which does not store any intermediate values), {\textsc{MiniRocket}} temporarily stores up to 13 additional vectors, namely, $A = -X$, $G = \gamma X = 3X$ (plus 9 variants of $G$ pre-aligned for the given dilation), $C_{\alpha}$, and $C$: see Sections \ref{subsubsec-factoring-out} and \ref{subsubsec-all-kernels-at-once}. This is equivalent to storing 13 additional copies of a single input time series (approx. $1{,}000{,}000 \times 4 \times 13 = 52 \text{MB}$ for time series of length 1 million), which should be negligible in almost all cases. When transforming the training set, the deterministic variant stores the convolution output for a given kernel/dilation combination for the entire training set, which is equivalent to storing one additional copy of the entire training set. This is impractical for larger datasets, which is why it is avoided by default. \section{Experiments} \label{sec-experiments} We evaluate {\textsc{MiniRocket}} on the datasets in the UCR archive (Section \ref{subsec-ucr-archive}), showing that, on average, {\textsc{MiniRocket}} is marginally more accurate than {\textsc{Rocket}}, and not significantly less accurate than the most accurate current methods for time series classification. We demonstrate the speed and scalability of {\textsc{MiniRocket}} in terms of both training set size and time series length (Section \ref{subsec-scalability}), showing that {\textsc{MiniRocket}} is up to $75$ times faster than {\textsc{Rocket}} on larger datasets. We also explore the effect of key parameters in relation to kernel length, bias, output features, and dilation (Section \ref{subsec-sensitivity-analysis}). \subsection{UCR Archive} \label{subsec-ucr-archive} We evaluate {\textsc{MiniRocket}} on the datasets in the UCR archive \citep{dau_etal_2019}. We compare {\textsc{MiniRocket}} against the most accurate current methods for time series classification, namely, HIVE-COTE/TDE (representative of HIVE-COTE and its variants), TS-CHIEF, InceptionTime, and {\textsc{Rocket}}, as well as TDE, CIF, cBOSS and Proximity Forest. For consistency and direct comparability with the most recent published results for other state-of-the-art methods \citep{bagnall_etal_2020,middlehurst_etal_2020a,middlehurst_etal_2020b}, we evaluate {\textsc{MiniRocket}} on 30 resamples of 109 datasets from the archive. We use the same 30 resamples (including the default training/test split) as in \citep{bagnall_etal_2020,middlehurst_etal_2020a,middlehurst_etal_2020b}. (Full results are available in the accompanying repository.) Figure \ref{fig-rank-ucr109} on page \pageref{fig-rank-ucr109} shows the mean rank of {\textsc{MiniRocket}} versus the other state-of-the-art methods. Methods for which the pairwise difference in accuracy is not statistically significant, per a Wilcoxon signed-rank test with Holm correction (as a post hoc test to the Friedman test), are connected with a black line \citep{demsar_2006,garcia_and_herrera_2008,benavoli_etal_2016}. {\textsc{MiniRocket}} is, on average, marginally more accurate than {\textsc{Rocket}}, and somewhat less accurate than the most accurate current methods, namely TS-CHIEF and HIVE-COTE/TDE, although the differences in accuracy are not statistically significant. However, as noted in Section \ref{sec-introduction}, the total compute time for {\textsc{MiniRocket}} on these datasets is a tiny fraction of the total compute time required by the other methods (even {\textsc{Rocket}}, which is already considerably faster than even the fastest of the other methods). \paragraph{{\textsc{MiniRocket}} versus {\textsc{Rocket}}.} \begin{figure} \centering \includegraphics[width=0.65\linewidth]{./fig04.pdf} \caption{Pairwise accuracy of {\textsc{MiniRocket}} versus {\textsc{Rocket}}.} \Description[Apricot is more accurate than Rocket on 61 of 109 datasets]{Scatter plot showing the accuracy of Apricot against the accuracy of Rocket for 109 datasets from the UCR archive. Apricot is more accurate on 61 datasets, as accurate on 3 datasets, and less accurate on 45 datasets. The accuracy of Apricot and Rocket is similar for most datasets. For one dataset, PigAirWayPressure, Apricot is considerably more accurate than Rocket.} \label{fig-pairwise-minirocket-vs-rocket} \end{figure} Figure \ref{fig-pairwise-minirocket-vs-rocket} shows the pairwise accuracy of {\textsc{MiniRocket}} versus {\textsc{Rocket}} for the same 109 datasets. Overall, {\textsc{MiniRocket}} and {\textsc{Rocket}} achieve very similar accuracy. {\textsc{MiniRocket}} is more accurate than {\textsc{Rocket}} on 61 datasets, and less accurate on 45 datasets, but the differences in accuracy are mostly small. The large difference in accuracy between {\textsc{MiniRocket}} and {\textsc{Rocket}} on one dataset, \textit{PigAirwayPressure}, appears to be due to the way the bias values are sampled. We also evaluated a variant of {\textsc{Rocket}} which uses the same method of sampling bias values as {\textsc{MiniRocket}}. Overall, this variant is slightly more accurate than default {\textsc{Rocket}}, but the difference is relatively minor, with a win/draw/loss of 50/6/53 against {\textsc{MiniRocket}}. \paragraph{Deterministic variant.} \begin{figure} \centering \includegraphics[width=0.65\linewidth]{./fig05.pdf} \caption{Pairwise accuracy of default {\textsc{MiniRocket}} versus the deterministic variant.} \Description[Apricot is more accurate than the deterministic variant of Apricot on 42 of 109 datasets]{Scatter plot showing the accuracy of Apricot against the accuracy of the deterministic variant of Apricot for 109 datasets from the UCR archive. Apricot is more accurate on 42 datasets, as accurate on 11 datasets, and less accurate on 56 datasets. The accuracy of Apricot and the deterministic variant is extremely similar on all datasets, with only very minor, almost imperceptible, differences.} \label{fig-pairwise-minirocket-vs-minirocket-dv} \end{figure} Figure \ref{fig-pairwise-minirocket-vs-minirocket-dv} shows the pairwise accuracy of default {\textsc{MiniRocket}} vs the deterministic variant (or {\textsc{MiniRocket}}$_{\text{DV}}$) for the same 109 datasets. Overall, the deterministic variant produces essentially the same accuracy as the default variant. \subsection{Scalability} \label{subsec-scalability} \subsubsection{Training Set Size} \begin{figure*} \centering {\includegraphics[width=0.70\linewidth]{./fig06a.pdf}\phantomsubcaption} \hfill {\includegraphics[width=0.230\linewidth]{./fig06b.pdf}\phantomsubcaption} \caption{Training time versus (left) training set size and (right) time series length.} \Description[Apricot is much faster than Rocket on large datasets in terms of both training set size and time series length]{Three line plots showing training set size against total training time (transform plus classifier training), and one line plot showing time series length against total training time, for both Apricot and Rocket. In terms of training set size, Apricot is 66 times faster for the FruitFlies dataset, 43 times faster for the InsectSound dataset, and 75 times faster for the MosquitoSound dataset. In terms of time series length, Apricot is 19 times faster for the DucksAndGeese dataset.} \label{fig-scalability} \end{figure*} \begin{table} \centering \caption{Accuracy and total training time.} \begin{tabular}{cccrr} \toprule & \multicolumn{2}{c}{Accuracy} & \multicolumn{2}{c}{Training Time} \\ \cmidrule(lr){2-3} \cmidrule(lr){4-5} & {\textsc{Rocket}} & {\textsc{MiniRocket}} & {\textsc{Rocket}} & {\textsc{MiniRocket}} \\ \midrule \textit{Fruit} & 0.9491 & 0.9568 & $2\text{h }36\text{m }40\text{s }$ & $2\text{m }22\text{s }$ \\ \textit{Insect} & 0.7796 & 0.7639 & $26\text{m }44\text{s }$ & $37\text{s }$ \\ \textit{Mosquito} & 0.8271 & 0.8165 & $15\text{h }34\text{m }58\text{s }$ & $12\text{m }32\text{s }$ \\ \bottomrule \end{tabular} \label{table-scalability-training-set-size} \end{table} We demonstrate the speed and scalability of {\textsc{MiniRocket}} in terms of training set size on the three largest datasets in the UCR archive, namely, \textit{MosquitoSound} ($139{,}780$ training examples, each of length $3{,}750$), \textit{InsectSound} ($25{,}000$ training examples, each of length $600$), and \textit{FruitFlies} ($17{,}259$ training examples, each of length $5{,}000$). These recent additions are significantly larger than other datasets in the archive. For this purpose, following \citep{dempster_etal_2020}, we integrate {\textsc{MiniRocket}} (and {\textsc{Rocket}}) with logistic regression, trained using Adam. Training details are provided in Appendix \ref{sec-appendix-training-details}. The experiments were performed on the same cluster as noted in Section \ref{sec-introduction} and, again, both {\textsc{Rocket}} and {\textsc{MiniRocket}} are restricted to a single CPU core. Figure \ref{fig-scalability} shows training time vs training set size for {\textsc{MiniRocket}} and {\textsc{Rocket}}. Training time includes the transform for both validation and training sets, and classifier training. Table \ref{table-scalability-training-set-size} shows test accuracy and total training time (for the full training set). {\textsc{MiniRocket}} is slightly more accurate on one of the datasets, and slightly less accurate on two of the datasets. This is consistent with the small differences in accuracy observed on the other datasets in the UCR archive: see Section \ref{subsec-ucr-archive}. However, {\textsc{MiniRocket}} is considerably faster than {\textsc{Rocket}}: $43$ times faster on \textit{InsectSound}, $66$ times faster on \textit{FruitFlies}, and $75$ times faster on \textit{MosquitoSound}. The accuracy of {\textsc{Rocket}} and {\textsc{MiniRocket}} on the \textit{InsectSound} and \textit{MosquitoSound} datasets appears to be broadly comparable to reported results for other methods for these datasets or versions of these datasets \citep{chen_etal_2014,zhang_etal_2017,fanioudakis_etal_2018,flynn_and_bagnall_2019}, although some deep learning approaches are significantly more accurate on \textit{MosquitoSound} \citep{fanioudakis_etal_2018}. \subsubsection{Time Series Length} \begin{sloppypar} We demonstrate the scalability of {\textsc{MiniRocket}} in terms of time series length on the dataset in the UCR archive with the longest time series, \textit{DucksAndGeese} ($50$ training examples, each of length $236{,}784$). This recent addition has significantly longer time series than other datasets in the archive. \end{sloppypar} Figure \ref{fig-scalability} shows training time versus time series length for both {\textsc{Rocket}} and {\textsc{MiniRocket}}. Training time includes the transform and classifier training. (With only 50 training examples, we use the ridge regression classifier.) While both {\textsc{Rocket}} and {\textsc{MiniRocket}} are linear in time series length, {\textsc{MiniRocket}} is considerably faster for a given length. With more training examples, we would expect the difference in training time to be considerably larger. With only 50 training examples, the overhead of sampling bias values (which is unrelated to training set size) constitutes a significant proportion of the total training time for {\textsc{MiniRocket}}. \subsection{Sensitivity Analysis} \label{subsec-sensitivity-analysis} We explore the effect of key parameter choices on accuracy: \begin{itemize} \item kernel length; \item sampling bias from the convolution output versus $\mathcal{U}(-1, 1)$; \item using only PPV versus both PPV and global max pooling; \item the number of features; and \item limiting the maximum number of dilations per kernel. \end{itemize} We perform the analysis using the 40 `development' datasets (default training/test splits). Results are mean results over 10 runs. \subsubsection{Kernels} \label{subsubsec-sensitivity-kernels} \begin{figure} \centering \includegraphics[width=\linewidth]{./fig07.pdf} \caption{Mean rank for different kernel lengths.} \Description[The subset of kernels of length 9 having three weights of one value ranks just behind the full set of length 9]{The subset of kernels of length 9 having three weights of one value and six weights of another value ranks just behind the full set of kernels of length 9, and ahead of any other subset of length 9 and kernels of length 7 or 11. The pairwise differences are (with one exception) not statistically significant.} \label{fig-sensitivity-kal} \end{figure} Figure \ref{fig-sensitivity-kal} shows the effect of kernel length on accuracy. For kernels of length 9, a subscript refers to a particular subset of kernels in the sense discussed in Section \ref{subsubsec-weights}. (E.g., $9_{\{3\}}$ refers to kernels with three weights of one value, and six weights of another value.) The total number of features is kept constant (to the nearest multiple of the number of kernels less than $10{,}000$: see Section \ref{subsubsec-features}), such that more features are computed per kernel for smaller sets of kernels and vice versa. Kernels of length 9 are most accurate, but kernels of length 7 or 11 are not significantly less accurate. This is consistent with the findings in \citep{dempster_etal_2020} in relation to {\textsc{Rocket}}. The actual differences in accuracy between kernels of different lengths is very small. Crucially, however, as noted in Section \ref{subsubsec-weights}, the $9_{\{3\}}$ subset is nearly as accurate as the full set of kernels of length 9. This is a relatively small subset of kernels, and is particularly well suited to the optimisations pursued in Section \ref{subsec-optimising-the-transform}. \subsubsection{Bias} \label{subsubsec-sensitivity-bias} \begin{figure} \centering \includegraphics[width=\linewidth]{./fig08.pdf} \caption{Mean rank for bias sampled from the convolution output versus bias sampled from $\mathcal{U}(-1, 1)$.} \Description[Bias sampled from the convolution output ranks well ahead of bias sampled uniformly]{Bias sampled from the convolution output ranks well ahead of bias sampled uniformly from negative 1 to 1, and the difference is statistically significant.} \label{fig-sensitivity-bias} \end{figure} Figure \ref{fig-sensitivity-bias} shows the effect in terms of accuracy of sampling bias from the convolution output versus from $\mathcal{U}(-1, 1)$ as in {\textsc{Rocket}}. {\textsc{MiniRocket}} is significantly less accurate when sampling bias from $\mathcal{U}(-1,1)$. The change to sampling bias from the convolution output is critical to matching the accuracy of {\textsc{Rocket}}. \subsubsection{Features} \label{subsubsec-sensitivity-features} \begin{figure} \centering \includegraphics[width=\linewidth]{./fig09.pdf} \caption{Mean rank for PPV vs PPV and global max pooling.} \Description[PPV by itself ranks ahead of the combination of PPV and global max pooling]{PPV by itself ranks ahead of the combination of PPV and global max pooling, but the difference is not statistically significant.} \label{fig-sensitivity-ppv} \end{figure} Figure \ref{fig-sensitivity-ppv} shows the effect of using only PPV versus both PPV and global max pooling. With the other changes to {\textsc{MiniRocket}}---in particular, with the change to sampling bias from the convolution output---there is no advantage to using global max pooling in addition to PPV. In fact, using global max pooling in addition to PPV is less accurate than just using PPV, although the difference is not statistically significant. \subsubsection{Number of Features} \label{subsubsec-sensitivity-num-features} \begin{figure} \centering \includegraphics[width=\linewidth]{./fig10.pdf} \caption{Mean rank for different numbers of features.} \Description[9,996 features, the default, ranks just behind 49,980 features, but ahead of any other number of features]{9,996 features, the default, ranks just behind 49,980 features, but ahead of 99,960 features and any smaller number of features. 9,996 features is in the same clique as 4,956, 99,960, and 49,980 features, that is, the pairwise differences are not statistically significant.} \label{fig-sensitivity-num-features} \end{figure} Figure \ref{fig-sensitivity-num-features} shows the effect of different numbers of features between $84$ and $99{,}960$ (the nearest multiple of 84 less than 100, 500, $1{,}000$, ...). Increasing the number of features noticeably increases accuracy up to approximately $10{,}000$ features. There is little or no benefit to increasing the number of features beyond $10{,}000$, at least for shorter time series, because there is little benefit in computing PPV for many more than $l_{\text{input}}$ bias values for time series of length $l_{\text{input}}$ (more and more features will be the same). For $49{,}980$ and $99{,}960$ features, we have endeavoured to avoid this limitation as much as possible by setting the maximum number of dilations per kernel to 119 (see Section \ref{subsubsec-dilation}) and, where necessary, sampling bias values from multiple training examples. \subsubsection{Dilation} \label{subsubsec-sensitivity-dilation} \begin{figure} \centering \includegraphics[width=\linewidth]{./fig11.pdf} \caption{Mean rank of different values for the maximum number of dilations per kernel.} \Description[A maximum of 32 dilations per kernel, the default, ranks ahead of all other values]{A maximum of 32 dilations per kernel, the default, ranks ahead of all other values for the maximum number of dilations per kernel. The pairwise differences are (with one exception) not statistically significant.} \label{fig-sensitivity-dilation} \end{figure} Figure \ref{fig-sensitivity-dilation} shows the effect in terms of accuracy of different values for the maximum number of dilations per kernel. The total number of features is kept constant, such that more features are computed per dilation for a smaller number of maximum dilations per kernel and vice versa: see Section \ref{subsubsec-dilation}. There is little difference in accuracy between values of 16 and 119 (119 being the largest possible number of dilations per kernel for the default number of features, i.e., $\lfloor 10{,}000 / {84} \rfloor = 119$). A value of 32 balances accuracy with the computational advantage of limiting the number of dilations per kernel, as discussed in Section \ref{subsubsec-dilation}. \section{Conclusion} We reformulate {\textsc{Rocket}} into a new method, {\textsc{MiniRocket}}, making it up to $75$ times faster on larger datasets. {\textsc{MiniRocket}} shows that it is possible to achieve essentially the same accuracy as {\textsc{Rocket}} using a mostly-deterministic and much faster procedure. {\textsc{MiniRocket}} represents a significant advance in accuracy relative to computational cost. {\textsc{MiniRocket}} is much faster than any other method of comparable accuracy (including {\textsc{Rocket}}), and far more accurate than any other method of even roughly-similar computational expense. Accordingly, we suggest that {\textsc{MiniRocket}} should be considered and used as the default variant of {\textsc{Rocket}}. We provide a na{\"i}ve facility for applying {\textsc{MiniRocket}} to multivariate time series (available through the accompanying repository). In future work, we propose to investigate more sophisticated approaches to multivariate time series, to explore the integration of {\textsc{MiniRocket}} with nonlinear classifiers, and the use of {\textsc{MiniRocket}} beyond time series data. \begin{acks} This material is based on work supported by an Australian Government Research Training Program Scholarship, and the Australian Research Council under award DP190100017. The authors would like to thank Professor Eamonn Keogh and all the people who have contributed to the UCR time series classification archive. Figures showing mean ranks were produced using code from \citep{ismailfawaz_etal_2019}. \end{acks} \bibliographystyle{ACM-Reference-Format}
{'timestamp': '2021-07-15T02:18:44', 'yymm': '2012', 'arxiv_id': '2012.08791', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08791'}
arxiv
\section{Introduction} \label{sec:intro} Criminal activities have become a major social problem due to their adverse effect on human life, economy and safety. The availability of crime data in recent years has enabled researchers to develop models for crime prediction. The government and responsible authorities can take preventive measures if they know about a crime event in advance. Knowing the insight behind the prediction of a crime occurrence would allow them to plan preventive measures appropriately and keep the society safe from the happening of the crime. Interpretable predictions ensure the transparency and accountability of the model. Thus, both accuracy and interpretability are two essential and desired properties for a crime prediction model. We propose an \emph{\underline{A}ttention-based \underline{I}nterpretable \underline{S}patio \underline{T}emporal Network (AIST)}, an interpretable deep learning model for crime prediction. \begin{figure}[htbp] \begin{subfigure}{0.32\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/map.pdf_tex} \caption{Chicago Communities} \label{Fig:chicago_map} \end{subfigure} \begin{subfigure}{0.32\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/sp_cor.pdf_tex} \caption{Spatial correlation} \label{Fig:sp_cor} \end{subfigure} \begin{subfigure}{0.32\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/tem_cor.pdf_tex} \caption{Temporal correlation} \label{Fig:tem_cor} \end{subfigure} \caption{Spatio-temporal dependencies of crime distribution} \label{Fig:map_sp_tem_cor} \vspace{-1em} \end{figure} Crime events exhibit spatial and temporal correlations and external features (e.g., taxi flow) often have influence on the crime occurrence. \textbf{Spatial Correlation.} Spatially nearby regions show a similar crime distribution and the extent of this similarity varies across regions and time. Figure~\ref{Fig:chicago_map} shows the communities (i.e., regions) of Chicago and Figure~\ref{Fig:sp_cor} shows an example on January, 2019 Chicago crime data. Regions 8 and 32 show strong spatial correlation while Regions 8 and 7 do not, though both of them are spatially nearby. Also, the spatial correlation between Regions 8 and 32 changes with time. \textbf{Temporal Correlation.} Crime occurrences of a region show both short and long term temporal correlations and these correlations vary with crime categories. Fig~\ref{Fig:tem_cor} shows an example for Region 8: deceptive practice (C0) and theft (C1) peak during mid night, whereas robbery (C5) peak during late night or early morning. There is also a significant difference of crime distributions across different crime categories: deceptive practice (C0) and theft (C1) occur at regular intervals whereas robbery is not so common for Region $8$. Besides, the crime distributions of the same category differ throughout the week. \vspace{-1em} \begin{figure}[htbp] \begin{subfigure}{0.32\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/feat_cor1.pdf_tex} \caption{} \label{Fig:ext_cor_1} \end{subfigure} \begin{subfigure}{0.32\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/feat_cor2.pdf_tex} \caption{} \label{Fig:ext_cor_2} \end{subfigure} \begin{subfigure}{0.32\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/feat_cor3.pdf_tex} \caption{} \label{Fig:ext_cor_3} \end{subfigure} \caption{Influence of Taxi Flows on the crime distribution in Chicago Communities} \label{Fig:ext_cor} \vspace{-1em} \end{figure} \textbf{External Features.} Functionalities and urban characteristics of a region like points of interests (POIs), traffic flow have direct influence on its crime occurrences. The influence of these external features on the crime occurrences tend to vary from time to time and region to region. Figure~\ref{Fig:ext_cor} shows such an example in Region $8$, where the distribution of deceptive practice (C0) (Figure~\ref{Fig:ext_cor_1}) and theft (C1) (Figure~\ref{Fig:ext_cor_2}) have a strong correlation with taxi flows, whereas robbery (C5) (Figure~\ref{Fig:ext_cor_3}) comparatively shows a weaker correlation with taxi flows. Modeling these diverse spatio-temporal correlations and learning meaningful external features and their probable influence on crime are challenging tasks. Traditional interpretable machine learning and data mining methods~\cite{DBLP:conf/kdd/WangKGL16, 4666600, DBLP:conf/pakdd/Yu0CM14} cannot model these non-linear spatio-temporal correlations and thus fail to predict the crime occurrences accurately. Recent deep learning models~\cite{DBLP:conf/cikm/HuangZZC18, DBLP:conf/www/HuangZZWCY19} capture this non-linear spatial and temporal dependencies to some extent and improve the accuracy of traditional models. They still have major limitations: \begin{compactitem} \item The models only learn static spatial correlations. However, the correlations for two regions may vary with time. \item The models do not address long term (e.g. daily, weekly) temporal correlations. \item The models do not consider the external features and hence the learned region embedding is incomplete. \item The models lack interpretability. Both these models use LSTM based attention weights which are difficult to interpret because of the recurrence on the hidden states generated by LSTMs~\cite{DBLP:conf/nips/ChoiBSKSS16}. They are also not sparse enough to be meaningful for long sequence. \end{compactitem} To overcome the limitations, we develop AIST that captures dynamic spatio-temporal correlation for crime prediction and provides quantitative insights based on external features behind a prediction. We develop two novel variants of graph attention networks (GAT)~\cite{DBLP:conf/iclr/VelickovicCCRLB18}, $hGAT$ and $fGAT$ to learn the crime and feature embedding of the nodes (regions), respectively at each time step. These embedding are then fed to three sparse attention based-LSTMs (SAB-LSTMs)~\cite{DBLP:conf/nips/KeGBBMPB18} for modeling recent, daily and weekly crime trends. Finally, AIST applies a location-based attention mechanism to identify the significance of different trends to make a prediction. GAT does not consider the hierarchical information of nodes. However, in real-world scenarios nodes tend to form clusters and belong to different hierarchies based on similar characteristics. In urban context, nodes (regions) that belong to a same hierarchy shares similar functionalities and crime distributions. We propose $hGAT$ that incorporates this prior knowledge of hierarchical information into GAT's architecture to produce a better crime embedding of nodes. Concatenating the feature vectors with spatial~\cite{DBLP:conf/aaai/Yao0KTJLGYL18, DBLP:conf/aaai/YaoTWZL19} or temporal view~\cite{DBLP:conf/aaai/LiZKXZ19} either directly or after a linear transformation is a common practice for incorporating the external features into the model. However, it fails to fully utilize the features and generate insights for a model's prediction. We propose $fGAT$ that replaces the additive self-attention mechanism of GAT with a novel scaled dot product self-attention mechanism~\cite{DBLP:conf/nips/VaswaniSPUJGKP17} to learn crime and region specific relevant feature embedding. The unique challenge of a crime prediction problem that does not apply to other spatio-temporal prediction problems (e.g., traffic flow prediction, crowd flow prediction, passenger demand prediction) is the fact that crime data is spatially, temporally and categorically extremely sparse. AIST utilizes the feature embedding learned from fGAT to tackle the sparseness of crime data. On top of that, it is also necessary to keep the crime prediction model's architecture reasonably interpretable, which makes the tasks even harder than building a spatio-temporal model that does not consider interpretability~\cite{10.1038/s42256-019-0048-x}. AIST is interpretable because it takes transparent decisions at each prediction step based on the different attention modules used in the model architecture. To explain a prediction, we first find whether the prediction is based on recent occurrences or any recurring trend and then identify the previous time steps that are given the most importance. Our model knows why a time step is given importance as the input at each time step is an interpretable spatial embedding. Hence, if we backtrack we can find the most important regions and features for a specific time step. Even though attention as a form of explanation is not new in spatio-temporal literature~\cite{DBLP:conf/cikm/HuangZZC18, DBLP:conf/www/HuangZZWCY19, DBLP:conf/aaai/GuoLFSW19, DBLP:conf/cikm/ZhangHXX20}, simply using an attention module does not make a model interpretable~\cite{DBLP:conf/acl/SerranoS19,DBLP:conf/naacl/JainW19}. Keeping this in mind, unlike existing spatio-temporal literature the model architecture of AIST is designed so that it complies with the conditions presented in~\cite{DBLP:conf/emnlp/WiegreffeP19} under which attentions can be regarded as faithful explanations. Besides inherent interpretable architectures~\cite{DBLP:conf/nips/ChenLTBRS19}, recently post-hoc local explanation techniques~\cite{DBLP:conf/nips/LundbergL17} that provide approximate explanations to a model's decision making have been explored to imitate the behavior of deep learning black box models. However, they are not well received considering the fact that if these explanations had been adequate enough, there would be no need for the original model~\cite{10.1038/s42256-019-0048-x}. Hence, we keep AIST architecture inherently interpretable while ensuring its accuracy. In summary, the contributions of this paper are as follows: \begin{compactitem} \item We propose a novel interpretable spatio-temporal deep learning model, AIST which is able to capture diverse spatio-temporal correlations based on past crime occurrences, external features and recurring trends. \item We propose $hGAT$, a novel GAT variant that allows AIST to learn more faithful node embedding. \item We propose $fGAT$, another novel GAT variant that provide insights behind the predictions of AIST. \item We conduct experiments on Chicago crime data. AIST achieves a higher accuracy than the state-of-the-art methods and provides useful insights for its predictions. Experiment results also validate that the explanations provided by different attention modules in hGAT, fGAT and SAB-LSTMs are faithful. \end{compactitem} The remaining of the paper is organized as follows. We discuss the related work in Section~\ref{Sec:relatedWork} and formulate the crime prediction problem in Section~\ref{Sec:problemFormulation}. We present our model, $AIST$ in Section~\ref{sec:model}. Section~\ref{Sec:experimentalResult} presents the experimental results and evaluates the accuracy and the interpretability of AIST. Section~\ref{sec:conclusion} concludes the paper. \section{Related Work} \label{Sec:relatedWork} Data-driven crime prediction problems have received wide attention from the researchers for decades. Existing studies on crime prediction can be divided into following categories: (i) \emph{crime rate inference} that predicts the crime rate of a region, (ii) \emph{crime hotspot detection} that finds the locations where crimes are clustered, and (iii) \emph{crime occurrence prediction} that forecasts the occurrence of a crime category for a location at a future timestamp. Our work falls in the third category. In Sections~\ref{sec:crimeModels} and~\ref{sec:interpretableModels}, we elaborate existing crime prediction models and interpretable models, respectively. In Section~\ref{spatio-temporal}, we discuss the deep learning methods used for spatial-temporal prediction. \subsection{Crime Prediction Models} \label{sec:crimeModels} \textbf{Statistical and Classic Machine Learning Methods.} Recent studies~\cite{DBLP:conf/kdd/WangKGL16, DBLP:journals/tbd/WangYKGL19, DBLP:journals/corr/abs-1908-02570} used statistical and classic machine learning methods (e.g., linear regression, negative binomial regression, geographically weighted regression, random forest) for crime rate inference problem. In~\cite{DBLP:conf/kdd/WangKGL16, DBLP:journals/tbd/WangYKGL19}, the authors studied the effect of point of interest (POI) (e.g., a restaurant or a shopping mall) and taxi flow information along with the traditional demographics features of a region while in~\cite{DBLP:journals/corr/abs-1908-02570}, the authors utilized FourSquare check-in data for estimating the crime rate of a particular region. Researchers have also employed kernel density estimation (KDE)~\cite{article, DBLP:journals/Hart, eck2005mapping, DBLP:conf/sibgrapi/NetoSV16} for predicting hot-spot maps. However, these works only take spatial features and dependencies into account ignoring the temporal dynamics of crime. To address the temporal dynamics, time-series models such as autoregressive integrated moving average (ARIMA)~\cite{4666600} have been proposed for one-week ahead crime occurrence prediction. In~\cite{doi:10.1198/jasa.2011.ap09546}, the authors implemented a self-exciting point process similar to one used by the seismologists in the context of urban crime to understand the temporal trends of burglary. Even though these models acknowledge the temporal dynamics, they do not incorporate the spatial context of crimes. Both spatial and temporal information have been also explicitly modeled in the literature. In~\cite{DBLP:conf/pakdd/Yu0CM14}, the authors proposed an algorithm that constructs a global crime pattern from local crime cluster distributions, and employed it for predicting residential burglary. In~\cite{DBLP:journals/tgis/NakayaY10}, the authors employed STKDE, a variant of KDE for mapping transient and stable crime clusters. The work in~\cite{DBLP:journals/tist/TooleEP11} used analytic and statistical techniques to identify the spatio-temporal crime patterns. In~\cite{DBLP:conf/cikm/ZhaoT17}, spatio-temporal correlations like intra-region temporal correlation and inter-region spatial correlation have been considered for crime occurrence prediction. However, all of these methods cannot fully model the complex non-linear relation of space and time and the dynamicity of spatial-temporal correlation. Besides spatio-temporal features, incorporating additional data (e.g. Twitter, demographics data) improve the accuracy of existing crime prediction models. The authors in ~\cite{DBLP:journals/dss/Gerber14} added Twitter-based features extracted from topic based modeling for improving the prediction of models. In~\cite{10.1145/1938606.1938608}, the authors used fuzzy association rule mining to find consistent crime patterns using population demographics information of communities. Another line of work~\cite{DBLP:conf/gis/XiongSKDPS19, DBLP:conf/www/WangJWWL19} explores the heterogeneous and task-specific division of spatial regions over traditional grid and community based division which helps improve the accuracy of the crime prediction. \textbf{Deep Learning Methods.} Deep learning models have recently been shown to be very effective in domains like computer vision, speech recognition and natural language processing. Recent deep learning models have also attempted to capture the non-linear spatio-temporal dependencies of crime. DeepCrime~\cite{DBLP:conf/cikm/HuangZZC18}, a hierarchical recurrent framework with attention mechanism, considers temporal correlation, its inter-relation with ubiquitous data and category dependencies for future crime prediction. However, DeepCrime does not consider spatial correlations of crimes. In~\cite{DBLP:journals/corr/WangZZBB17}, the authors applied ST-ResNet architecture~\cite{DBLP:conf/aaai/ZhangZQ17} for crime intensity prediction while in~\cite{DBLP:conf/www/HuangZZWCY19}, the authors developed MiST, a LSTM based neural network architecture with attention mechanism to model spatio-temporal and cross-categorical correlation for crime prediction. None of these models can capture dynamic spatial correlation and identify the impact of external features on crime predictions. Besides, these models are not interpretable. DeepCrime and MiST employ attention based RNNs which lack interpretability because of the recurrence on the hidden states generated by RNNs and their non-sparse attention weights for longer sequences. ST-ResNet uses deep residual units with hundreds and thousands of CNNs stacked altogether which makes it harder to interpret the model's prediction. \subsection{Interpretable Models} \label{sec:interpretableModels} The statistical and classic machine learning models have an advantage over deep learning models in terms of interpretability. However, they cannot model the complex non-linearity of space and time and thus lacks accuracy. On the other hand, though neural networks can capture the spatial-temporal non-linear relationship, they are not interpretable. Attention-based models focus on the most relevant information while performing a certain task. These models have become very popular in image processing~\cite{DBLP:conf/icml/XuBKCCSZB15, DBLP:conf/nips/MnihHGK14, DBLP:journals/corr/BaMK14, DBLP:conf/cvpr/FuZM17} and natural language processing~\cite{DBLP:journals/corr/BahdanauCB14, DBLP:conf/nips/VaswaniSPUJGKP17}, and health-care predictions~\cite{DBLP:conf/nips/ChoiBSKSS16, DBLP:conf/kdd/ChoiBSSS17, DBLP:conf/kdd/BaiZEV18, DBLP:conf/kdd/MaCZYSG17} for ensuring interpretability. Similar to the statistical and classic machine learning models, despite of having a self-explanatory structure, simply using an attention based model does not make an explanation of a prediction faithful. The model architecture of AIST provides faithful explanations, which is also validated by our experiment results. The other category of interpretable models is post-hoc models, where a separate model is used for explanation. Examples of post-hoc models include LIME~\cite{DBLP:conf/kdd/Ribeiro0G16}, SHAP~\cite{DBLP:conf/nips/LundbergL17}, rule-based learning~\cite{DBLP:journals/corr/SuWVM16} and saliency visualizations~\cite{DBLP:conf/nips/DabkowskiG17}. \subsection{Deep Learning for Spatio-temporal Prediction} \label{spatio-temporal} Deep learning methods have become popular in recent years in the domain of spatial temporal prediction. A common approach is to use the convolution based architecture (CNN)~\cite{DBLP:conf/gis/ZhangZQLY16, DBLP:journals/tits/ChenYL18, DBLP:conf/icdm/ChenLTCZYVFZ18} for finding the spatial correlation and the recurrent based architecture~\cite{DBLP:conf/kdd/RongXYM18, DBLP:journals/corr/abs-1801-02143} for finding the temporal correlation. In~\cite{DBLP:conf/aaai/YaoTWZL19}, the authors used both CNN and attention-based LSTM to capture the dynamic spatio-temporal dependencies for traffic prediction. In~\cite{DBLP:conf/ijcai/LiangKZYZ18}, the authors proposed a multi-level attention mechanism along with a recurrent layer and a fusion module to incorporate the external features for geo-sensory time prediction. Recent literature~\cite{DBLP:conf/aaai/GuoLFSW19, DBLP:conf/ijcai/YuYZ18, DBLP:journals/TKDE/9139357, DBLP:conf/cikm/ZhangHXX20, DBLP:conf/cikm/XieG0X0Z20, DBLP:conf/www/Wang0WJWTJY20, DBLP:conf/kdd/HongLYLFWQY20} has also started exploring the graph neural networks for such prediction. In~\cite{DBLP:conf/aaai/GuoLFSW19, DBLP:conf/ijcai/YuYZ18, DBLP:conf/kdd/HongLYLFWQY20}, the authors proposed a pure convolutional structure in the form of a graph convolution in the spatial dimension and a general convolution in the temporal dimension to model the traffic flows. In~\cite{DBLP:journals/TKDE/9139357}, several temporal views are fed to their respective graph convolution layers and then fused altogether along with semantic views to model the crowd flows. In~\cite{DBLP:conf/www/Wang0WJWTJY20}, the authors modeled traffic flows with a graph convolutional network (GCN) followed by a recurrent layer and a transformer to capture the local and global temporal correlation, respectively. Both these models~\cite{DBLP:journals/TKDE/9139357, DBLP:conf/www/Wang0WJWTJY20} incorporate geospatial position of nodes into the GCN to better model the spatial dependencies. In~\cite{DBLP:conf/cikm/ZhangHXX20}, the authors proposed STCGA that combines multiple self-attention, graph attention, and convolutional residual networks to predict the traffic flow.~\cite{DBLP:conf/cikm/XieG0X0Z20} proposes DIGC and a pre-trained binary classifier, both of which consists of a GCN followed by an LSTM to extract the spatio-temporal and latent incident crime features, respectively for traffic speed prediction. None of these spatio-temporal prediction models are designed to handle the sparseness of crime data. The finer the spatial, temporal or categorical resolution gets, the sparser the crime data becomes; which makes it even harder to model the crime. Hence, the spatio-temporal prediction models fail to perform well for crime prediction tasks. Unlike existing spatio-temporal literature, AIST chooses a handful of region and crime category specific external features, and applies fGAT to learn a more stable and faithful feature embedding of the target region as a substitute of the sparse crime data. This learned feature embedding along with the crime embedding learned by hGAT allows AIST to capture the slightest of changes in the feature or crime embedding of the target region over time and make predictions accordingly. Our experiment results also show that AIST outperforms the high-performance spatio-temporal prediction models. \begin{small} \begin{table}[htbp] \caption{Notations and their meanings} \centering \begin{tabular}{|c|p{9cm}| \hline \hline Notation & Symbol \\ \hline $N, T, K, J$ & Number of regions, time steps, crime categories, external features\\ \hline $\mathcal{N}_i$ & First-order neighbors of region $r_i$ (including itself)\\ \hline $\tau$ & Length of a time step\\ \hline $x_{i, t}^k$ & Crime occurrences of $k$-th category at region $r_i$ during $t$-th time step\\ \hline $\textbf{x}_{i, t}$ & Crime occurrences of all categories at region $r_i$ during $t$-th time step\\ \hline $\textbf{X}_{t}$ & Crime occurrences of all categories at all regions during $t$-th time step\\ \hline $f_{i, t}^j$ & $j$-th external feature of region $r_i$ during $t$-th time interval\\ \hline $\textbf{f}_{i, t}$ & All external features of region $r_i$ during $t$-th time step\\ \hline $\textbf{F}_{t}$ & All external features of all regions during $t$-th time step\\ \hline $\hat{\textbf{Y}}_{T+1}$ & Predicted crime occurrences of all regions and categories of the city at $(T+1)$-th time step\\ \hline \end{tabular} \label{symbols} \end{table} \end{small} \section{Problem Formulation} \label{Sec:problemFormulation} In this section, we introduce some notations\footnote{Bold letters, e.g. \textbf{$A, a$} denote matrices and vectors respectively and small letters, e.g. $a$ denote scalars} and formulate crime prediction problem as a regression task. Table~\ref{symbols} summarizes the notations used in the paper. \textbf{Region.} We model a city with an undirected graph $G = (V, E)$, where $V$ represents a set of $N$ regions $\{r_1, r_2, r_3,\ldots, r_N\}$ and $E$ represents a set of edges connecting them. In this study, a region denotes a community area: a pre-defined administrative boundary that serves various planning and statistical purposes. For a region $r_{i}$ to be connected to region $r_{i'}$ they must share a common boundary. \textbf{Crime Occurrence.} Let $x_{i, t}^k \in \mathbb{R}$ represent the number of crimes reported of category $k$ (e.g. theft) at region $r_i$ during $t$-th time step\footnote{We use time step and time interval synonymously.}. If $\mathbf{x}_{i, t} = [x_{i, t}^1, x_{i, t}^2, x_{i, t}^3, \ldots, x_{i, t}^K] \in \mathbb{R}^{K}$ denotes the reported crimes of all $K$ categories at region $r_i$ during $t$-th time step and $\mathbf{X}_{t} = (\mathbf{x}_{1, t}, \mathbf{x}_{2, t}, \mathbf{x}_{3, t}, \ldots, \mathbf{x}_{N, t}) \in \mathbb{R}^{K\times N}$ denotes the reported crimes of all categories at all $N$ regions during $t$-th time step, then the crime occurrences of the whole city for $T$ time steps can be denoted as $\mathcal{X} = (\mathbf{X}_1, \mathbf{X}_2, \ldots, \mathbf{X}_T) \in \mathbb{R}^{K\times N\times T}$. \textbf{External Feature.} We use POI information, traffic inflow and traffic outflow as external features for improving the model's prediction accuracy. The external features of the city during $T$ time steps are denoted as $\mathcal{F} = (\mathbf{F}_1, \mathbf{F}_2, \ldots, \mathbf{F}_T) \in \mathbb{R}^{J\times N\times T}$ for $J$ external features, where $\mathbf{F}_{t} = (\mathbf{f}_{1, t}, \mathbf{f}_{2, t}, \mathbf{f}_{3, t}, \ldots, \mathbf{f}_{N, t}) \in \mathbb{R}^{J\times N}$ denotes the external features of the city during $t$-th time step, $\mathbf{f}_{i, t} = [f_{i, t}^1, f_{i, t}^2, f_{i, t}^3, \ldots, f_{i, t}^J] \in \mathbb{R}^{J}$ denotes the external features of a region $r_i$ during time step $t$ and $f_{i, t}^j \in \mathbb{R}$ denotes the $j$-th external feature of a region $r_i$ during time step $t$. \textbf{Problem Definition.} Given past crime occurrences $\mathcal{X}$ and external features $\mathcal{F}$ for last $T$ time steps, predict $\hat{\textbf{Y}}_{T+1}$, the crime occurrences of the city during $(T+1)$-th time step. \begin{figure*}[tbp] \centering \def0.9\textwidth{\textwidth} \input{Figures/Model_Overview.pdf_tex} \caption{Model Overview of AIST: (a) hGAT is applied to calculate the crime embedding $c_1$ of target region $r_1$, (b) fGAT is applied to calculate the feature embedding $e_1$ of $r_1$, (c) both $c_1$ and $e_1$ are concatenated to produce spatial representation $s_{1}$ of $r_1$ at time step $t$, (d) the spatial representations generated at different time steps are then fed to three SAB-LSTMs to capture recent, daily and weekly crime trends at $r_1$ and a location-based attention is applied to predict the crime occurrence of $r_1$ at $(T+1)$-th time step, $\hat{y}_{T+1}$.} \label{Fig:overview} \vspace{0em} \end{figure*} \section{Model Description} \label{sec:model} The key idea behind our model's high prediction accuracy is that we exploit (i) hierarchical information of regions, (ii) external features, and (iii) short, long term crime patterns to capture the dynamic spatio-temporal dependencies while keeping the model's architecture reasonably interpretable. Given the crime occurrences of category $k$ at region $r_i$ during time steps $[1..T]$, we find the crime embedding $\mathbf{c_{i, t}^k}$ and feature embedding $\mathbf{e_{i, t}^k}$ of $r_i$ using our proposed hGAT and fGAT, respectively, and concatenate them to produce spatial representation $\mathbf{s_{i, t}^k}$ for each of these time step. These embedding are then fed to three SAB-LSTMs for capturing recent, daily and weekly trends which outputs the hidden states $\mathbf{h_{T+1}^r}, \mathbf{h_{T+1}^d}, \mathbf{h_{T+1}^w}$, respectively. After applying an attention mechanism on these hidden states, a context vector, $\mathbf{c_{T+1}}$ is generated to predict the crime occurrence at $(T+1)$-th time step, $\hat{y}_{i, T+1}^k$. Figure~\ref{Fig:overview} gives an overview of the model. In Section~\ref{spatial}, we elaborate on how we generate crime embedding using hGAT and feature embedding using fGAT to produce spatial representation (Figures~\ref{Fig:overview}a--~\ref{Fig:overview}c). In Sections~\ref{temporal} and~\ref{prediction}, we discuss our crime trend generation and prediction steps, respectively (Figure~\ref{Fig:overview}d). \subsection{Spatial View} \label{spatial} Convolutional neural networks (CNNs)~\cite{DBLP:conf/gis/ZhangZQLY16} and its variants~\cite{DBLP:conf/aaai/YaoTWZL19} have been applied to model spatial correlation between regions in spatio-temporal prediction. Though CNNs learn meaningful features on regular grid structured data, they do not perform well on irregular graph data because the number of nodes in a graph and their neighbor counts are variables. Urban crime data exhibit a clear graph structure considering the correlation between regions and other external features. Modeling them as grid structured data results in incomplete information and makes it hard to learn meaningful information. To address this issue, graph convolutional networks (GCNs)~\cite{DBLP:conf/iclr/KipfW17} have gained popularity in recent times. GCNs learn a node's embedding as an aggregation of its neighbor's features and calculate their contribution with predefined Laplacian Matrix, which is the difference of the degree matrix and the adjacency matrix of the graph. Since the contributions of neighbor nodes are static, GCNs can not capture the dynamic spatial correlation between regions. Based on these observations, we choose GAT as the base architecture to capture the spatial dependencies for crime prediction. Similar to GCN, GAT learns a node's embedding as an aggregation of its neighbor's features but uses a self-attention mechanism to learn their contributions instead. GAT does not require any costly matrix operation and knowledge about the graph structure upfront, which allows GAT to learn dynamic spatial correlation between regions. We use two GAT variants: hGAT and fGAT to learn the crime and feature embedding of a target region as follows. \textbf{\emph{Crime Embedding.}} The city of Chicago is divided into $77$ communities (regions) and the communities are grouped into $9$ districts or sides forming a containment hierarchy. Communities under the same side tend to share similar socio-economic, demographic and urban features, which result in similar crime distribution than those under different sides. Hence, while aggregating the node (community) information in GAT, prioritizing the nodes that fall under the same side with the target node over others may help to learn better crime representation of a target node. From this intuition, we propose $hGAT$ to amplify the signals of the nodes that fall under the same side with the target node than those which do not. Since almost every city can be divided into multiple partitions at different spatial resolutions, this idea can be generalized to other cities as well. \begin{figure}[tbp] \begin{subfigure}{3.5 cm} \def0.9\textwidth{\columnwidth} \input {Figures/Community_Structure_v2.pdf_tex} \caption{First-hop neighbors} \end{subfigure} \hspace{4 mm } \begin{subfigure}{4.5 cm} \def0.9\textwidth{\columnwidth} \input {Figures/Community_Structure_v1.pdf_tex} \caption{Hierarchical Structure} \end{subfigure} \caption{Complex spatial interaction between regions} \label{Fig:region_structure} \vspace{-1em} \end{figure} Figure~\ref{Fig:region_structure} represents a scenario where the first-order neighbors of target region $8$ are $\{7, 8, 24, 28, 32\}$ and target region $8$ along with region $32$ and $33$ fall under the same side (represented as grey circles in Figure~\ref{Fig:region_structure}). It is evident from Figure~\ref{Fig:hgat_cor_total} that R8 is strongly correlated to R32 than other nearby regions (R7, R24) in terms of crime distribution and external features (POI and taxi flows). Similarly, R24 shows a stronger correlation with R28 than R8. Thus, it is expected that the target region 8 is influenced more by region $32$ which is not only a first-hop neighbor but also falls under the same side, whereas regions $7, 24$ or $28$ do not. To be clear, we do not consider the influence of regions such as $33$ that falls under the same side with the target region 8, but is not a first-hop neighbor. We only want to amplify the signal from those regions which satisfy both conditions: falls under the same side and is a first-hop neighbor. \begin{figure}[htbp] \centering \def0.9\textwidth{0.75\textwidth} \input{Figures/hgat_cor.pdf_tex} \caption{Pearson correlation coefficient among regions of Chicago based on 2019 crime, POI and 2019 taxi flows distribution (left to right)} \label{Fig:hgat_cor_total} \vspace{-1em} \end{figure} hGAT considers two sets of features for each node ($r_i$): (i) node level features: crime occurrences at community level during time step $t$: $x_{i, t}^k$, (ii) parent level features: crime occurrences at district/side level during time step $t$: $z_{i, t}^k$ as input to GAT and an additional attention layer to capture the similarity between nodes based on parent level features. Let the parent node of a region $r_i$ be $p_j = Parent(r_i)$. Then the parent feature of node $r_i$ is calculated as $z_{i, t}^k = \sum_{\forall r_{n} Parent(r_{n})=p_j}x_{n, t}^k$. Basically, we sum the crime occurrences of category $k$ across the nodes whose parent node is $p_j$ to create the parent feature of target node $r_i$. Traditional GAT considers only node level features. Hence, it can not model hierarchical information into a node's embedding. For hGAT, we use two transformation matrix, (i) $\mathbf{w_x}\in \mathbb{R}^{F}$ to learn the similarities between a target region and its neighbor's node level features, and (ii) $\mathbf{w_z}\in \mathbb{R}^{F'}$ to learn similarities between their parent-level features. Based on these information two separate feed-forward attention layer computes two sets of pair-wise unnormalized attention scores between the target region and its first-hop neighbors: $e_{ii'}^c$ and $e_{ii'}^p$, respectively. For clarity, we omit the indices of crime categories ($k$) and time step ($t$). \begin{align*} e_{ii'}^c &= \text{LeakyReLU}(\mathbf{a_x}^T[\mathbf{w_x}x_{i} \mathbin\Vert \mathbf{w_x}x_{i'}]) \\ e_{ii'}^p &= \text{LeakyReLU}(\mathbf{a_z}^T[\mathbf{w_z}z_{i} \mathbin\Vert \mathbf{w_z}z_{i'}]) \end{align*} We perform an element-wise addition to combine these two sets of unnormalized attention scores and apply softmax over them to generate final attention scores, where $\mathcal{N}_i$ denotes first order neighbors including itself. $$e_{ii'} = e_{ii'}^c + e_{ii'}^p$$ $$\alpha_{ii'} = \text{softmax}_{i'}(e_{ii'}) = \frac{exp(e_{ii'})}{\sum_{i'' \in \mathcal{N}_i}exp(e_{ii''})}$$ Finally, we use this combined attention score to update the crime embedding ${c}_{i, t}^k$ of target region $r_i$. \begin{equation} \label{eq:1} \mathbf{{c}}_{i, t}^k = \sigma\left(\sum_{i' \in \mathcal{N}_i}\alpha_{ii'}\mathbf{w_x}x_{i', t}^k\right) \end{equation} Figure~\ref{Fig:overview}a gives an overview of generating the crime embedding. \textbf{\emph{Feature Embedding.}} Besides historical crime observations, external features have been shown to be useful in crime prediction problems~\cite{DBLP:conf/cikm/HuangZZC18, DBLP:conf/cikm/ZhaoT17, DBLP:conf/kdd/WangKGL16}. We propose $fGAT$ that replaces additive self-attention mechanism with a novel scaled dot product self-attention mechanism~\cite{DBLP:conf/nips/VaswaniSPUJGKP17} to learn category specific feature embedding of regions. The feature embedding of a target region is formulated as an aggregation of its neighbors' features based on their possible influence on the crimes of the target region. The intuition behind finding a possible influential feature is - if two regions having similar features experience similar crime occurrences at a specific time step then the features might influence crimes or serve as proxies for crime prediction in addition to the crime occurrences. We compute the query vector $\mathbf{q}_{ii'}$ by multiplying the concatenated crime occurrences of a target region ($r_i$) and its neighbor region ($r_{i'}$) with weight matrix $\mathbf{W_q} \in \mathbb{R}^{d_q\times 2}$ to learn their crime distribution similarities. For preparing the key vector $\mathbf{k}_{ii'}^j$ for feature $j$, we multiply the concatenated features of $r_i$ and $r_{i'}$ with weight matrix $\mathbf{W_k} \in \mathbb{R}^{d_k\times 2}$ to learn their feature similarities. Here, $d_q$ and $d_k$ represents the dimension of the query and key vector, respectively. \begin{align*} \mathbf{q}_{ii'} = \mathbf{W_q}([x_{i, t}^k \mathbin\Vert x_{i', t}^k])\\ \mathbf{k}_{ii'}^j = \mathbf{W_k}([f_{i, t}^j \mathbin\Vert f_{i', t}^j]) \end{align*} Then, the attention weight of $j$-th feature of $r_{i'}$ is calculated using the dot-product attention mechanism. $$\beta_{ii'}^{j} =\text{softmax}_{j}(\frac{\mathbf{q}_{ii'}{\mathbf{k}_{ii'}^j}^T}{\sqrt{d_k}}) $$ Once the attention weights of individual features are found, the feature embedding ${e}_{i, t}^k$ of $r_i$ is formulated as follows. \begin{equation} \label{eq:2} \mathbf{{e}}_{i, t}^k = \sigma\left(\sum_{i' \in \mathcal{N}_i}\left( \alpha_{ii'} \sum_{j=1}^{J}\beta_{ii'}^{j} \mathbf{w_v}f_{i', t}^j\right)\right) \end{equation} Here $ \beta_{ii'}^{j}\mathbf{w_v} f_{i', t}^j$ represents the contribution of $j$-th feature of $r_i'$ on the feature embedding of $r_i$ and $\mathbf{w_v} \in \mathbb{R}^{F}$. Figure~\ref{Fig:overview}b gives an overview of generating the feature embedding. Finally, We concatenate the crime embedding, $\mathbf{{c}}_{i, t}^k$ and feature embedding, $\mathbf{{e}}_{i, t}^k$ to find spatial embedding $\mathbf{s}_{i, t}^k$ of target region $r_i$ at $t$-th time step for crime category $k$. This spatial embedding $\mathbf{s}_{i, t}^k$ is fed as input to a SAB-LSTM cell for time step $t$ as shown in Figure~\ref{Fig:overview}c. $$\mathbf{s}_{i, t}^k = [\mathbf{{c}}_{i, t}^k \mathbin\Vert \mathbf{{e}}_{i, t}^k]$$ \subsection{Temporal View} \label{temporal} LSTM and GRU are two popular recurrent neural networks (RNNs) that capture temporal correlations. However, besides being non-interpretable they suffer from vanishing gradient problem for long sequences. To address these issues, attention-based RNNs are proposed that use attention mechanism to focus on relevant hidden states. These attention weights are difficult to interpret because of the recurrence on the hidden states generated by LSTMs~\cite{DBLP:conf/nips/ChoiBSKSS16}. They are also not sparse enough to be meaningful for long sequence. SAB-LSTM~\cite{DBLP:conf/nips/KeGBBMPB18} back-propagates across only a selected small subset instead of all hidden states, which are selected using a sparse and hard attention mechanism. Thus it mitigates the gradient vanishing problem and is also interpretable. In this section, first we give a brief overview of a SAB-LSTM cell and then discuss how we apply them in predicting crimes. At each time step $t$ the underlying LSTM of SAB-LSTM takes the spatial embedding of region $r_i$, $\mathbf{s}_{i, t}^k$ and the previous hidden state $\mathbf{h_{t-1}}$ as inputs for crime category $k$. It produces a new cell state $\mathbf{c_t}$ along with a provisional hidden state $\mathbf{\hat{h}_t}$. $$\mathbf{\hat{h}}_{t}, \mathbf{c_{t}} = \text{LSTM}(\mathbf{s}_{i, t}^k, \mathbf{h_{t-1}})$$ The provisional hidden state, $\mathbf{\hat{h}_t}$ is concatenated with all the vectors stored in memory $\mathcal{M} = [\mathbf{h}_1^{mem}, \mathbf{h}_2^{mem}, \ldots, \mathbf{h}_{|\mathcal{M}|}^{mem}]$ and passed through a feed-forward neural network to generate unnormalized attention weights $(e_m)$ for each vector stored in the memory. Memory $\mathcal{M}$ contains a set of hidden states selected arbitrarily (after each $k_{att}$ time step) for comparison with the generated provisional hidden state. $$e_m = \mathbf{W_m}tanh(\mathbf{\hat{h}}_{t} \mathbin\Vert \mathbf{h}_m^{mem})$$ Then, SAB-LSTM subtracts the $(k_{top}+1)$-th highest attention score from all the attention scores and use normalization to generate $k_{top}$ sparse attention weights to select only $k_{top}$ memory cells. $$\alpha_{m} =\frac{e_{m}-e_{k_{top}+1}}{\sum_{m^{''} \in \mathcal{M}} (e_{m^{''}}-e_{k_{top}+1})}$$ Once the attention weights ($\alpha_{m}$) are obtained, it calculates a summary vector $\mathbf{sum_t}$ by summing over the $k_{top}$ memories. This summary vector is then concatenated to the previously generated hidden provisional state $\mathbf{\hat{h}_t}$ to get the final hidden state, $\mathbf{h_t}$. \begin{align*} \mathbf{sum_t} &= \sum_{m \in \mathcal{M}}\alpha_{m}\mathbf{h}_m^{mem}\\ \mathbf{h_t} &= \mathbf{\hat{h}}_t + \mathbf{sum_t} \end{align*} The hidden state generated at time step $t$ has two contributing factors. First, the provisional hidden vector $(\mathbf{\hat{h}_t})$ which is the output of a traditional LSTM at time $t$ and non-interpretable. Second, the summary vector $\mathbf{sum_t}$ which is the summation of dynamic, sparse hidden states aligned with current state and interpretable. For crime prediction task we omit the first contributing factor and only use the summary vector $\mathbf{sum_t}$ as our output hidden state $\mathbf{h_t}$. Even though the accuracy is slightly compromised but this makes SAB-LSTM more interpretable. \begin{equation} \label{eq:3} \mathbf{h_t} = \mathbf{sum_t} = \sum_{m \in \mathcal{M}}\alpha_{m}\mathbf{h}_m^{mem} \end{equation} We use three SAB-LSTMs for our crime prediction task (Figure~\ref{Fig:overview}d). $\text{SAB-LSTM}_r$ captures recent crime trends based on a target region's spatial embedding during past $T$ time steps. $\text{SAB-LSTM}_d$ captures daily trends based on spatial embedding at the same time step as the predicted time step but on previous days . Finally, $\text{SAB-LSTM}_w$ captures weekly trends based on the the spatial embedding at the same time step as the predicted time step but on previous weeks. We formulate them as follows. For simplicity of representation, we omit region-index $i$ and crime category-index $k$. \begin{align*} \mathbf{h}_{T+1}^r &= \text{SAB-LSTM}_r(\mathbf{s}_{t}) \\ \mathbf{h}_{T+1}^d &= \text{SAB-LSTM}_d(\mathbf{s}_{(T+1)-t_{d}*m}) \\ \mathbf{h}_{T+1}^w &= \text{SAB-LSTM}_w(\mathbf{s}_{(T+1)-t_{w}*7*m}) \end{align*} Here, $t = [1..T], t_d = [1..T_{d}], t_w = [1..T_{w}], m = 24/\tau$, $T_d = T/m$, $T_w = T/(m*7), \tau = \text{length of each time step}$. $\mathbf{h}_{T+1}^r, \mathbf{h}_{T+1}^d, \mathbf{h}_{T+1}^w \in \mathbb{R}^H$, $H = \text{hidden state dimension}$. \vspace{2mm} \subsection{Prediction} \label{prediction} After calculating the final hidden states of all three SAB-LSTMs we use location-based attention mechanism~\cite{DBLP:conf/emnlp/LuongPM15} to capture the contribution ($\alpha_a$) of the recent, daily and weekly trends. Then, a context vector is calculated using the generated attention weights. Here, $\mathbf{W_h} \in \mathbb{R}^{H\times A}, \mathbf{b_h} \in \mathbb{R}^A $ are learnable parameters, $A$ = attention dimension and $a=\{r, d, w\}$. $$\alpha_a = \text{softmax}_{a} (\text{tanh}(\mathbf{W_h}^{T}\mathbf{h}_{T+1}^a + \mathbf{b_h})$$ \begin{equation} \label{eq:4} \mathbf{c}_{i, T+1}^k = \sum_a \alpha_a \mathbf{h}_{T+1}^a \end{equation} Finally, the context vector is fed to a fully connected layer for predicting the crime occurrence at time step ($T+1$) for region $r_i$ and crime category $k$ where, $\mathbf{w} \in \mathbb{R}^{H}, \mathbf{b} \in \mathbb{R}$ are learnable parameters. We add the previously omitted region-index $i$ and crime category-index $k$ below. \begin{equation} \label{eq:5} \hat{y}_{i, T+1}^k = \text{tanh}(\mathbf{w}\mathbf{c}_{i, T+1}^k + b) \end{equation} Figure~\ref{Fig:overview}d gives an overview of generating the context vector and prediction. \section{Experiment} \label{Sec:experimentalResult} \subsection{Experimental Settings} \subsubsection{Data-sets} We evaluate our model on publicly available 2019 Chicago crime data~\cite{chicago_crime2019}, following the state-of the-art~\cite{DBLP:conf/kdd/WangKGL16, DBLP:journals/tbd/WangYKGL19}. Chicago is one of the most violent cities of United States and the crime concentration of Chicago is very diverse; it has both some of the safest and some of the most crime prone neighborhoods. We use 2019 Chicago taxi trip data~\cite{chicago_taxi2019} and POI information as external features. We collect POI information from FourSquare API while Chicago crime and taxi data are publicly available. \begin{itemize} \item \textbf{Chicago-Crime} (2019). We select \num[group-separator={,}]{152720} crime records of four crime categories: theft, criminal damage, battery, narcotics from $1/1/2019$ to $31/12/2019$ and extract these information of each record: timestamp, primary category of crime, community area where it occurred. \item \textbf{Chicago-POI} We select \num[group-separator={,}]{89324} POIs of $10$ categories: food, residence, travel, arts \& entertainment, outdoors \& recreation, education, nightlife, professional, shops and event. \item \textbf{Chicago-Taxi} (2019). We select \num[group-separator={,}]{29110097} taxi trips from $1/1/2019$ to $31/12/2019$ and extract these information of each record: pickup timestamp, drop-off timestamp, pickup community area, drop-off community area. \end{itemize} \subsubsection{Data Preprocessing} We consider Chicago crime data of first 8 months as training set and 10\% and 90\% of the remaining last 4 months as validation set and test set, respectively. We use taxi inflow (F1), outflow (F2) and POI category: food (F3), residence (F4), travel (F5), arts \& entertainment (F6), outdoors \& recreation (F7), education (F8), nightlife (F9), professional (F10), shops (F11) and event (F12) as external features. We use Min-Max normalization to scale the crime events to [-1, 1] and later denormalize the prediction to get the actual number of crime events. Following~\cite{DBLP:journals/tbd/WangYKGL19}, we do not scale the external features. \subsubsection{Parameter Settings} We optimize the hyperparameters of AIST using a grid search strategy. The search space for every hyperparameter is presented in Table~\ref{table:exp_hyperparameter} and the selected value in the search space is shown in bold. For simplicity, we use the same parameter settings across all crime categories and regions. AIST is trained using the Adam optimizer with batch size = 42 and initial learning rate = 0.001. We set the duration of each time step, $\tau = 4$ hours. We set the number of recent ($T$), daily ($T_d$) and weekly ($T_w$) time steps to 20, 20 and 3, respectively. \emph{hGAT \& fGAT settings.} Both hGAT and fGAT are single layer GATs consisting of single attention head for computational efficiency. We set the output size ($F$) of both hGAT and fGAT to 8. For fGAT, we set $d_q, d_k=40$. Dropout with $p=0.5$ is applied to unnormalized node-level ($e_{ii'}^c$), unnormalized parent-level ($e_{ii'}^p$), normalized combined attention weights ($\alpha_{ii'}$) in hGAT, and dropout with $p=0.5$ is applied to normalized dot-product attention weights ($\beta_{ii'}^j$) in fGAT. \emph{SAB-LSTM settings.} All 3 SAB-LSTMs are single layered with hidden dimension $H=40$. For $SAB-LSTM_{r}$ and $SAB-LSTM_{d}$, we set $k_{att}=5, k_{top}=5, trunc_{length} = 5$. For $SAB-LSTM_w$ we set $k_{att}=1, k_{top}=5, trunc_{length} = 1$. Dropout with $p=0.2$ is applied to each output of 3 SAB-LSTMs. Finally, we set the attention dimension of location based attention as $A=30$. \begin{small} \begin{table*}[htbp] \caption{Hyperparameter Settings of AIST} \centering \begin{tabular}[t]{|l|l|c|} \hline Hyperparameters & Search Space\\ \hline Number of recent time step ($T$) & [16, \textbf{20}, 24, 28]\\ \hline Number of daily time step ($T_d$) & [12, 16, \textbf{20}, 24] \\ \hline Number of weekly time step ($T_w$) & [2, \textbf{3}, 4, 5]\\ \hline Output size of both hGAT and fGAT ($F$) & [6, \textbf{8}, 10, 12]\\ \hline Dimension of query and key vector of fGAT ($d_q, d_v$) & [36, \textbf{40}, 44, 48]\\ \hline Dimension of hidden states of SAB-LSTM ($H$) & [24, 32, \textbf{40}, 48] \\ \hline Dimension of Location Attention ($H$) & [22, \textbf{30}, 38, 46]\\ \hline \end{tabular} \label{table:exp_hyperparameter} \end{table*} \end{small} \subsubsection{Evaluation Criteria} We use mean average error (MAE) and mean square error (MSE) to evaluate AIST predictions. Here, $n$ represents the number of predictions, $y_i$ represents the predicted result and $\hat{y}_i$ represents the ground truth. \begin{align*} \text{MAE} = \frac{1}{n}\sum_{i=1}^{n}|y_i - \hat{y}_i| \qquad \text{MSE} = \frac{1}{n}\sum_{i=1}^{n}(y_i - \hat{y}_i)^2 \end{align*} We also use Total Variation Distance (TVD) for comparing prediction scores and Jensen-Shannon Divergence (JSD) for comparing attention weight distributions to evaluate the interpretations of AIST, where $\alpha = \frac{\alpha_1 + \alpha_1}{2}$ and $\text{KL}(p || q)$ calculates the Kullback–Leibler divergence between probability distributions $p$ and $q$. $$\text{TVD} = \frac{1}{2}\sum_{i=1}^{|\textbf{y}|}(|\hat{y}_{1i} - \hat{y}_{2i}|)$$ $$\text{JSD}(\alpha_1, \alpha_2) = \frac{1}{2} \text{KL}[\alpha_1 || \alpha] + \frac{1}{2} \text{KL}[\alpha_2 || \alpha]$$ \subsubsection{Baselines} We compare AIST with the following baselines. \begin{compactitem} \item ARIMA~\cite{4666600}. The most general case of models for predicting time series combining moving average and auto-regression. \item DTR~\cite{DBLP:books/wa/BreimanFOS84}. A decision tree algorithm for regression that chooses the best random split while partitioning samples in multiple subsets. \item Att-RNN~\cite{DBLP:journals/corr/BahdanauCB14}. It uses attention mechanism with RNN to capture the temporal correlation. \item DeepCrime~\cite{DBLP:conf/cikm/HuangZZC18}. A hierarchical recurrent framework that encodes the temporal correlation and inter-dependencies between crimes and urban anomalies. \item MiST~\cite{DBLP:conf/www/HuangZZWCY19}. It uses multiple LSTMs to encode the spatial, temporal and categorical views of crime. \item GeoMAN*. A multi-level attention network with a sequential encoder-decoder architecture that models both spatial and temporal correlation, customized to predict crimes. Unlike GeoMAN~\cite{DBLP:conf/ijcai/LiangKZYZ18}, while calculating the spatial dependencies we only consider those who share a common boundary rather than considering all the regions in the network. \item STGCN~\cite{DBLP:conf/ijcai/YuYZ18}. A graph convolutional layer is placed between two gated temporal convolution layers to model the spatio-temporal correlation. \item MVGCN*. A GNN architecture with multiple graph convolution and fully connected layers to process different temporal and semantic views, respectively. MVGCN~\cite{DBLP:journals/TKDE/9139357} is customized by only considering those regions that share a common boundary for predicting crimes. \end{compactitem} \begin{small} \begin{table*}[t] \caption{Comparison of AIST with baselines on Chicago Crime Data (2019)} \centering \begin{tabular}[t]{|c|c|c|c|c|c|} \hline Model & Criteria & Theft (C1) & \begin{tabular}{@{}c@{}}Criminal \\ Damage (C2)\end{tabular} & Battery (C3) & Narcotics (C4) \\ \hline \multirow{2}{*}{ARIMA~\cite{4666600}} & MAE & 1.2010 & 0.5863 & 0.8840 & 0.5705\\ & MSE & 2.8492 & 0.7238 & 1.4242 & 0.7928 \\ \hline \multirow{2}{*}{DTR~\cite{DBLP:books/wa/BreimanFOS84}} & MAE & 1.1943 & 0.5590 & 0.8983 & 0.4901\\ & MSE & 3.3275 & 0.8123 & 1.9336 & 0.8522\\ \hline \multirow{2}{*}{Att-RNN~\cite{DBLP:journals/corr/BahdanauCB14}} & MAE & 1.0419 & 0.4096 & 0.7377 & 0.4128\\ & MSE & 2.5443 & 0.4427 & 1.0665 & 0.6380\\ \hline \multirow{2}{*}{DeepCrime~\cite{DBLP:conf/cikm/HuangZZC18}} & MAE & 1.0022 & 0.3727 & 0.7271 & 0.3702 \\ & MSE & 2.6279 & 0.4751 & 1.0567 & 0.6394\\ \hline \multirow{2}{*}{MiST~\cite{DBLP:conf/www/HuangZZWCY19}} & MAE & 1.0241 & 0.3727 & 0.7365 & 0.3701\\ & MSE & 2.5153 & 0.4836 & 1.0345 & 0.6495\\ \hline \multirow{2}{*} {\begin{tabular}{@{}c@{}}customized \\GeoMAN~\cite{DBLP:conf/ijcai/LiangKZYZ18}\end{tabular}} & MAE & 0.9092 & 0.3876 & 0.7226 & 0.3450\\ & MSE & 1.9930 & \textbf{0.4385} & 0.9871 & \textbf{0.5595}\\ \hline \multirow{2}{*}{STGCN~\cite{DBLP:conf/ijcai/YuYZ18}} & MAE & 1.0416 & 0.5130 & 1.0869 & 0.3886\\ & MSE & 1.8121 & 0.4860 & 1.0595 & 0.6342\\ \hline \multirow{2}{*} {\begin{tabular}{@{}c@{}}customized \\MVGCN~\cite{DBLP:journals/TKDE/9139357}\end{tabular}} & MAE & 1.5244 & 0.4641 & 0.7928 & 0.4093 \\ & MSE & 4.2593 & 0.7019 & 1.1949 & 0.8337\\ \hline \multirow{2}{*}{AIST} & MAE & \textbf{0.8747} & \textbf{0.3615} & \textbf{0.6910} & \textbf{0.3399}\\ & MSE & \textbf{1.6986} & 0.4837 & \textbf{0.9568} & 0.5609\\ \hline \end{tabular} \label{table:exp_result} \vspace{-1em} \end{table*} \end{small} \subsection{Prediction Performance} \label{SubSec:pred} \subsubsection{Comparison with baselines. } The performance of the baselines and AIST is shown in Table~\ref{table:exp_result}. The baselines include both high-performance crime prediction models (e.g., DeepCrime, Mist) and high-performance spatio-temporal prediction models (e.g., customized GeoMAN, STGCN, customized MVGCN). All the baselines have been tuned optimally to produce the best prediction result. In general, AIST outperforms all baselines by achieving the lowest MAE and MSE scores across all crime categories (except the MSE scores for crime category Criminal Damage (C2) and Narcotics (C4)). \begin{itemize}[leftmargin=*] \item AIST learns the time varying spatial dependencies, diverse temporal correlation and crime relevant dynamic context to perform crime prediction tasks. Other competing deep learning models such as MVGCN*, STGCN, GeoMAN*, MiST, Att-RNN do not learn the crime and region specific relevant context; DeepCrime, Att-RNN do not consider the spatial correlation and MVGCN* do not consider the temporal correlation. As a result, in general these models fail to perform better than AIST for crime prediction tasks. \item Aside from AIST, GeoMAN* has the second best MAE and MSE scores across all crime categories. On top of that, it has better MSE scores than AIST for category Criminal Damage (C2) and Narcotics (C4). C2 lacks periodical temporal properties and the surrounding context has less influence on C4. Since, GeoMAN* does not consider daily or weekly temporal properties and the influence of region specific context on a crime category, it performs better than AIST for these crime categories in terms of MSE scores. \item Other attention-based neural network architectures: DeepCrime and MiST perform considerably worse than GeoMAN* because they do not consider the spatial correlation and external features, respectively. Though DeepCrime and MiST have similar MAE scores, MiST is better than DeepCrime in terms of the MSE score. This is because DeepCrime only captures the temporal correlation and region-category dependencies, whereas MiST captures both spatio-temporal and cross-categorical correlation of crimes. \item STGCN has the third best MSE score across all crime categories. Only AIST and GeoMAN* have better MSE score than STGCN. Having a lower MSE score than those of other attention-based deep learning models such as Att-RNN, DeepCrime and MiST, STGCN is more likely to capture the sudden changes in crime distribution. However, in terms of the MAE score STGCN shows a poor performance in comparison with AIST and others such as GeoMAN*, MiST, DeepCrime, and Att-RNN. \item Att-RNN, a plain recurrent neural network architecture that only considers the recent temporal correlation is behind DeepCrime and MiST, but above STGCN in terms of the performance based on the MAE score. However, in terms of the MSE score its performance is quite similar to DeepCrime. For category Criminal Damage (C2), Att-RNN performs better than AIST supporting our claim that periodical information is not helpful for predicting this category of crime. \item MVGCN*, despite being a top performing architecture in crowd flows prediction, performs worst among the competing deep learning models in the crime prediction task based on MSE scores. Because of the sparsity of crime distributions, careful exploration of available crime data and context are an absolute necessity for capturing the sudden change in the crime distribution. However, the large MSE scores of MVGCN* mean that the graph convolution and fully connected layers in MVGCN* used to model the spatial correlation and the influence of the external features lack the ability to do so. Hence, it fails to compete with others. \item Traditional time series analysis and machine learning methods such as ARIMA and DTR though interpretable, lack the ability to model the non-linear and complex crime patterns. This is because ARIMA only considers a fixed temporal pattern, whereas DTR does not consider the temporal properties of crime at all. Hence, in general they show poor performance than the deep learning models across all crime categories. \end{itemize} \subsubsection{Effectiveness of different spatial components of AIST} We consider the following variants of AIST to understand the influence of different spatial components on its prediction performance. Figure~\ref{Fig:eval_self} shows a comparative performance analysis of these spatial variants of AIST. \begin{itemize} \item $\text{AIST}_{g}.$ hGAT is replaced with traditional graph attention networks to learn crime embedding; fGAT is omitted from the spatial module. \item $\text{AIST}_{h}.$ hGAT is used to learn crime embedding; fGAT is omitted from the spatial module. \item $\text{AIST}_f.$ hGAT is used to learn crime embedding and the crime embedding is concatenated with the external features to produce the final spatial embedding; fGAT is omitted from the spatial module. \item $\text{AIST}_{f'}.$ GAT (in place of hGAT) and fGAT constitute the spatial module. \end{itemize} $\text{AIST}_h$ has a better MAE score across all crime categories than $\text{AIST}_g$ which justifies the selection of hGAT over GAT for learning the crime embedding. Specifically, from Fig~\ref{Fig:eval_model7} it is evident that hGAT learns a better crime embedding of category Narcotics compared to other categories, which indicates the existence of strong narcotics networks in certain parts of Chicago. Besides, the fact that AIST consistently performs better than $\text{AIST}_{f'}$ shows the superiority of the spatial embedding learned by hGAT alongside fGAT over $\text{AIST}_{f'}$. For categories Theft (C1) and Battery (C3), the concatenation of external features improves the prediction performance of $\text{AIST}_h$, which indicates the impact of contextual information for the crime prediction task, specially for these categories. However, the prediction performance of $\text{AIST}_f$ deteriorates significantly for category Narcotics (C4) and remains almost same as $\text{AIST}_h$ for category Criminal Damage (C2), which suggest its inability to constantly differentiate the influential features from noise across all crime categories. The significant performance improvement of AIST over $\text{AIST}_f$ in predicting crime events across all categories suggests that careful extraction and learning of crime relevant feature embedding by fGAT is a necessity while performing crime prediction tasks. \begin{figure}[tbp] \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/smodule1.pdf_tex} \caption{C1: Theft} \label{Fig:eval_model1} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/smodule2.pdf_tex} \caption{C2: Criminal Damage} \label{Fig:eval_model2} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/smodule3.pdf_tex} \caption{C3: Battery} \label{Fig:eval_model3} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/smodule7.pdf_tex} \caption{C4: Narcotics} \label{Fig:eval_model7} \end{subfigure} \caption{Effect of different spatial components} \label{Fig:eval_self} \vspace{-1em} \end{figure} \subsubsection{Effectiveness of different temporal components of AIST} Figure~\ref{Fig:tmodel} shows a comparative performance analysis of different temporal components of AIST. \begin{itemize} \item $\text{AIST}_{r}.$ $\text{SAB-LSTM}_{d}$ and $\text{SAB-LSTM}_{w}$ are omitted from the temporal module. \item $\text{AIST}_{d}.$ $\text{SAB-LSTM}_{w}$ is omitted from the temporal module. \item $\text{AIST}_{w}.$ $\text{SAB-LSTM}_{d}$ is omitted from the temporal module. \item $\text{AIST}_{l}.$ All three $\text{SAB-LSTMs}$ are replaced by traditional LSTMs. \end{itemize} The significant decrease in the MAE scores of $\text{AIST}_{d}$ and $\text{AIST}_{w}$ over $\text{AIST}_{r}$ for Theft (C1), Battery (C2) and Narcotics (C4) suggest that both daily and weekly trends are instrumental in crime prediction tasks. Between these two, $\text{AIST}_{w}$ has better MAE scores over $\text{AIST}_{d}$ across all crime categories indicating the dominance of weekly trends over daily trends. Above all, the better MAE scores of AIST over $\text{AIST}_{l}$ for all crime categories justify the selection of SAB-LSTMs over traditional LSTMs for the crime prediction tasks. Contrary to the general observation discussed above, $\text{AIST}_{r}, \text{AIST}_{d}, \text{and AIST}_{w}$ show similar performance for category Criminal Damage (C2) (Figure~\ref{Fig:tmodel2}), which suggests that it does not follow any daily or weekly trend. \begin{figure}[htbp] \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/tmodule1.pdf_tex} \caption{C1: Theft} \label{Fig:tmodel1} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/tmodule2.pdf_tex} \caption{C2: Criminal Damage} \label{Fig:tmodel2} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/tmodule3.pdf_tex} \caption{C3: Battery} \label{Fig:tmodel3} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/tmodule7.pdf_tex} \caption{C4: Narcotics} \label{Fig:tmodel7} \end{subfigure} \caption{Effect of different temporal components} \label{Fig:tmodel} \vspace{-1em} \end{figure} \subsubsection{Effect of Parameters} Different parameters like number of recent ($T$), daily ($T_d$) and weekly ($T_w$) time steps, dimension of SAB-LSTM hidden states ($H$), output size of hGAT and fGAT ($F$), dimension of query ($d_q$), key ($d_k$) vectors and location attention ($A$) have impact on the performance of AIST. To better understand the crucial parameters of AIST and their effect on its prediction performance, we run several experiments and present the results in ~\Cref{Fig:param_T,Fig:param_TD,Fig:param_TW,Fig:param_H,Fig:param_F,Fig:param_Q,Fig:param_A}. To observe the effect of a parameter, the value of the parameter is varied within its range, and other parameters are set to their default values as presented in Table~\ref{table:exp_hyperparameter}. Figures~\ref{Fig:param_T},~\ref{Fig:param_TD}, and~\ref{Fig:param_TW} suggest that AIST is sensitive to the number of recent ($T$), daily ($T_d$) and weekly ($T_w$) time steps, which are being fed to the three SAB-LSTMs as input. AIST shows poor performance for both smaller and larger $T, T_d$ due to the lack of data for learning temporal dependencies and the absence of long temporal correlation, respectively. Somewhere in between, when $T, T_d = 20$, AIST in general performs best by capturing the recent and periodic properties of the crime. On the contrary, AIST performs well when the number of weekly time steps $(T_w)$ is relatively small (Figure~\ref{Fig:param_TW}). However, unlike other categories, AIST performs best for category Theft (C1), when the number of recent and weekly time steps are comparatively larger (Figure~\ref{Fig:param_T1},~\ref{Fig:param_TW1}). This signifies the existence of long term temporal dependencies for category Theft. AIST is also sensitive to the dimension $(H)$ of the hidden states of SAB-LSTMs (Figure~\ref{Fig:param_H}) and output size $(F)$ of hGAT and fGAT (Figure~\ref{Fig:param_F}). Limited spatial and temporal information make the training hard for AIST. As a result, the performance of AIST deteriorates. On the other hand, a larger output size and dimension of the hidden state make it easier for AIST to overfit the data. Hence, we set $F=8$ and $H=40$ so that AIST can generalize well by learning sufficient spatial and temporal information. It is evident from Figures~\ref{Fig:param_Q} and~\ref{Fig:param_A} that the query and key dimensions $(d_q, d_k)$ and location attention dimension $(A)$ follow the same trend as the other hyperparameters discussed above. Based on the performance of AIST across different crime categories, we set $d_q, d_k = 40$ and $A = 30$. \begin{figure}[htbp] \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_T1.pdf_tex} \caption{C1: Theft} \label{Fig:param_T1} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_T2.pdf_tex} \caption{C2: Criminal Damage} \label{Fig:param_T2} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_T3.pdf_tex} \caption{C3: Battery} \label{Fig:param_T3} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_T7.pdf_tex} \caption{C4: Narcotics} \label{Fig:param_T7} \end{subfigure} \caption{Effect of the Number of Recent Time Steps, $T$} \vspace{-1em} \label{Fig:param_T} \end{figure} \begin{figure}[htbp] \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_td1.pdf_tex} \caption{C1: Theft} \label{Fig:param_TD1} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_td2.pdf_tex} \caption{C2: Criminal Damage} \label{Fig:param_TD2} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_td3.pdf_tex} \caption{C3: Battery} \label{Fig:param_TD3} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_td7.pdf_tex} \caption{C4: Narcotics} \label{Fig:param_TD7} \end{subfigure} \caption{Effect of the Number of Daily Time Steps, $T_d$} \label{Fig:param_TD} \vspace{-1em} \end{figure} \begin{figure}[htbp] \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_tw1.pdf_tex} \caption{C1: Theft} \label{Fig:param_TW1} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_tw2.pdf_tex} \caption{C2: Criminal Damage} \label{Fig:param_TW2} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_tw3.pdf_tex} \caption{C3: Battery} \label{Fig:param_TW3} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_tw7.pdf_tex} \caption{C4: Narcotics} \label{Fig:param_TW4} \end{subfigure} \caption{Effect of the Number of Weekly Time Steps, $T_w$} \label{Fig:param_TW} \vspace{-1em} \end{figure} \begin{figure}[htbp] \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_h1.pdf_tex} \caption{C1: Theft} \label{Fig:param_H1} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_h2.pdf_tex} \caption{C2: Criminal Damage} \label{Fig:param_H2} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_h3.pdf_tex} \caption{C3: Battery} \label{Fig:param_H3} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_h7.pdf_tex} \caption{C4: Narcotics} \label{Fig:param_H7} \end{subfigure} \caption{Effect of the Dimension of Hidden State, $H$} \label{Fig:param_H} \vspace{-1em} \end{figure} \begin{figure}[htbp] \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_F1.pdf_tex} \caption{C1: Theft} \label{Fig:param_F1} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_F2.pdf_tex} \caption{C2: Criminal Damage} \label{Fig:param_F2} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_F3.pdf_tex} \caption{C3: Battery} \label{Fig:param_F3} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_F7.pdf_tex} \caption{C4: Narcotics} \label{Fig:param_F7} \end{subfigure} \caption{Effect of the Output Size of hGAT and fGAT, $F$} \label{Fig:param_F} \end{figure} \begin{figure}[htbp] \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_Q1.pdf_tex} \caption{C1: Theft} \label{Fig:param_Q1} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_Q2.pdf_tex} \caption{C2: Criminal Damage} \label{Fig:param_Q2} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_Q3.pdf_tex} \caption{C3: Battery} \label{Fig:param_Q3} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_Q7.pdf_tex} \caption{C4: Narcotics} \label{Fig:param_Q7} \end{subfigure} \caption{Effect of the Dimension of Query and Key, $d_q, d_k$} \label{Fig:param_Q} \end{figure} \begin{figure}[htbp] \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_a1.pdf_tex} \caption{C1: Theft} \label{Fig:param_A1} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_a2.pdf_tex} \caption{C2: Criminal Damage} \label{Fig:param_A2} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_a3.pdf_tex} \caption{C3: Battery} \label{Fig:param_A3} \end{subfigure} \begin{subfigure}{0.245\columnwidth} \def0.9\textwidth{\columnwidth} \input{Figures/param_a7.pdf_tex} \caption{C4: Narcotics} \label{Fig:param_A7} \end{subfigure} \caption{Effect of the Dimension of Location Attention, $A$} \label{Fig:param_A} \end{figure} \subsubsection{Effect of Train/Test Ratio} We run several experiments to learn the effect of the train-test ratio on the prediction performance of AIST. We consider the first $n \in \{6, 7, 8, 9, 10\}$ months of Chicago crime data (2019) as training set. We take 10\% of the remaining data of last $(12-n)\in \{6, 5, 4, 3, 12\}$ months for the validation set and use the rest as the test set. Table~\ref{table:tt_ratio} shows the prediction performance of AIST across all crime categories against different train-test ratio. Similar to the most deep learning models, fewer training samples cause AIST to overfit the data and as a result AIST shows poor prediction performance. This is evident from the reported MAE and MSE scores of AIST when only 6 months of data is used for training. Once we gradually increase the size of the training data, the prediction performance of AIST improves significantly and reaches its peak when the size of the training data is 8 months. Adding additional training data beyond 8 months again deteriorates the prediction performance of AIST. \begin{small} \begin{table*}[htbp] \caption{Effect of Train-Test Ratio on Crime Prediction Performance of AIST} \centering \begin{tabular}[t]{|E|D|D|D|D|D|D|D|D|} \hline Train / Test Ratio & \multicolumn{2}{c|}{\centering Theft (C1)} & \multicolumn{2}{c|}{\begin{tabular}{@{}c@{}} Criminal \\ Damage (C2)\end{tabular}} & \multicolumn{2}{c|}{Battery (C3)} & \multicolumn{2}{c|}{Narcotics (C4)} \\ \hline In Percent & MAE & MSE & MAE & MSE & MAE & MSE & MAE & MSE\\ \hline 0.50 / 0.45 & 1.2576 & 4.4737 & 0.3869 & 0.5121 & 0.7745 & 1.2920 & 0.4179 & 0.7457\\ \hline 0.58 / 0.38 & 0.9445 & 2.0771 & 0.3765 & 0.4972 & 0.7229 & 1.0653 & 0.3518 & 0.5619\\ \hline 0.67 / 0.30 & \textbf{0.8747} & \textbf{1.6986} & \textbf{0.3615} & 0.4837 & \textbf{0.6910} & \textbf{0.9568} & \textbf{0.3399} & \textbf{0.5609}\\ \hline 0.75 / 0.23 & 1.3403 & 4.1698 & 0.3709 & 0.4748 & 0.7915 & 1.2591 & 0.4208 & 0.7391\\ \hline 0.83 / 0.15 & 1.2807 & 3.8667 & 0.3646 & 0.\textbf{4650} & 0.7988 & 1.1857 & 0.4240 & 0.7518\\ \hline \end{tabular} \label{table:tt_ratio} \end{table*} \end{small} \subsection{Evaluation of Interpretability} The notion of interpretability mainly comes down to two points: i) plausibility: how understandable it is to humans, and ii) faithfulness: how accurately it refers to the true reasoning process of a model. Besides human evaluations~\cite{DBLP:conf/chi/KaurNJCWV20, DBLP:conf/iui/EhsanTCHR19, DBLP:conf/naacl/MullenbachWDSE18}, explanations that align directly with the input have been considered as plausible explanations~\cite{DBLP:conf/emnlp/LeiBJ16}. Attentions are plausible explanations because they assign importance weights to the inputs while making a prediction ~\cite{DBLP:conf/emnlp/WiegreffeP19}. Since AIST interprets the importance of different regions, features, time steps and trends on the crime prediction based on four attention modules, the interpretation of AIST is \textit{plausible}. A recent study~\cite{DBLP:conf/emnlp/WiegreffeP19} shows the conditions under which attentions can be regarded as faithful explanations, and nullifies the claim~\cite{DBLP:conf/acl/SerranoS19,DBLP:conf/naacl/JainW19} that criticizes attention as a form of faithful explanation due to its weak correlation with other feature importance metrics and the existence of alternate adversarial attention weights. Specifically,~\cite{DBLP:conf/emnlp/WiegreffeP19} proposes a series of extensive experiments based on dataset and model properties: i) train on uniform attention weights: the attention distribution is frozen to uniform weights to validate whether the attention is actually necessary for a better performance, ii) calibration of variance: the model is trained with different initializing seeds to generate base variance for attention distributions, iii) train an MLP (multilayer perceptron): the LSTM cells are replaced by MLP and are trained separately and iv) train an adversary: the model is trained to provide similar predictions as the base model while keeping the attention distributions distant from the actual ones for ascertaining exclusivity. We evaluate the attention weights generated by AIST by performing these experiments (except iii since the attention modules used in AIST are either feed-forward neural networks or sparse which do not comply with the experimental settings) to validate their \textit{faithfulness}. Since the faithfulness varies across model, tasks and input space, both~\cite{DBLP:conf/emnlp/WiegreffeP19, DBLP:conf/acl/JacoviG20} emphasize that the faithfulness should be evaluated in grayscale instead of a binary term, i.e., faithful or not faithful. Following~\cite{DBLP:conf/emnlp/WiegreffeP19, DBLP:conf/acl/JacoviG20}, we consider the degree of faithfulness as it allows to identify the interpretation that is sufficiently faithful to be useful in practice. Our process to generate the adversarial attention weights to establish the exclusivity, hence the faithfulness of the model is as follows. We train an adversarial model ($\mathcal{M}_{adv}$) with the objective of minimizing the prediction differences from our AIST model ($\mathcal{M}_{AIST}$) along with a divergent attention distribution for an instance $i$. $$\mathcal{L}(\mathcal{M}_{AIST}, \mathcal{M}_{adv}) = \text{TVD}(\hat{y}_{AIST}^{(i)}, \hat{y}_{adv}^{(i)}) - \lambda \; \text{KL}(\alpha_{AIST}^{(i)}, \alpha_{adv}^{(i)})$$ Here, $\lambda$ is a hyperparameter that controls the tradeoff between TVD and JSD, where TVD is the levels of prediction variance and JSD (Jensen-Shannon Divergence) quantifies the difference between two attention distributions. In Figure~\ref{Fig:eval_int_adv}, we present the TVD between the predictions of the adversarial and AIST model against the increasing JSD between their attention distributions for a selected number of regions on specific crime categories. We believe the graphs in Figure~\ref{Fig:eval_int_adv} to be representative of all $4$ crime categories across $77$ regions as they show all of the possible three cases: not faithful, moderately faithful and concretely faithful. Fast increase in the prediction difference concurs that the attention scores are not easily manipulable and exclusive. Hence, they can be used as faithful explanations. We also include the scores of uniform model variant (\mysquare{blue}) and random seed initialization (\mytriangle{black!60!green}) in these TVD vs JSD graphs. Figure~\ref{Fig:eval_int_adv_24_1}, ~\ref{Fig:eval_int_adv_27_1}, ~\ref{Fig:eval_int_adv_31_1}, ~\ref{Fig:eval_int_adv_70_3}, ~\ref{Fig:eval_int_adv_43_3} establish attentions as faithful explanations for the specified regions and crime categories as the increase in JSD comes at a high price of the increased TVD (at different rates). However, Figure~\ref{Fig:eval_int_adv_0_1} shows an example where the attention distributions generated by AIST can not be deemed faithful as it is easy to manipulate the attentions without losing much of the prediction performance. We include the predictions of the best adversarial models with instance-average JSD > 1 in Table~\ref{table:exp_result_int}. Table~\ref{table:exp_result_int} shows the superiority of the base model (AIST) across all four crime categories over its uniform variant and adversarial models. Substantial increase of MAE scores of the uniform model suggests that attention is indeed a necessary component for better performance in the crime prediction. Similarly, a higher MAE score of the adversarial models ascertain the exclusivity of the predictions generated by AIST model. \begin{figure}[t] \begin{subfigure}{0.32\columnwidth} \includegraphics[width=\columnwidth]{Figures/24_1_adv.png} \caption{R24 C1} \label{Fig:eval_int_adv_24_1} \end{subfigure} \begin{subfigure}{0.32\columnwidth} \includegraphics[width=\columnwidth]{Figures/27_1_adv.png} \caption{R27 C1} \label{Fig:eval_int_adv_27_1} \end{subfigure} \begin{subfigure}{0.32\columnwidth} \includegraphics[width=\columnwidth]{Figures/0_1_adv.png} \caption{R0 C1} \label{Fig:eval_int_adv_0_1} \end{subfigure} \begin{subfigure}{0.32\columnwidth} \includegraphics[width=\columnwidth]{Figures/31_1_adv.png} \caption{R31 C1} \label{Fig:eval_int_adv_31_1} \end{subfigure} \begin{subfigure}{0.32\columnwidth} \includegraphics[width=\columnwidth]{Figures/70_3_adv.png} \caption{R70 C3} \label{Fig:eval_int_adv_70_3} \end{subfigure} \begin{subfigure}{0.32\columnwidth} \includegraphics[width=\columnwidth]{Figures/43_3_adv.png} \caption{R43 C3} \label{Fig:eval_int_adv_43_3} \end{subfigure} \caption{Evaluation of interpretability (Averaged per-instance test set JSD and TVD from base model for each model variant. JSD is bounded at $\sim2.07$; \mytriangle{black!60!green}: random seed; \mysquare{blue} uniform weights; dotted line: our adversarial setup as $\lambda$ is varied)} \vspace{-1em} \label{Fig:eval_int_adv} \end{figure} \begin{small} \begin{table*}[htbp] \caption{Comparison of AIST with its uniform variant and adversarial models on MAE} \centering \begin{tabular}[t]{|c|c|c|c|} \hline Crime Category & Uniform & Base Model & Adversarial\\ \hline Theft (C1) & 0.9776 & \textbf{0.8747} & 1.1807\\ \hline Criminal Damage (C2) & 0.3738 & \textbf{0.3615} & 0.3734 \\ \hline Battery (C3) & 0.7206 & \textbf{0.6910} & 0.8029 \\ \hline Narcotics (C4) & 0.3634 & \textbf{0.3399} & 0.5537 \\ \hline \end{tabular} \label{table:exp_result_int} \end{table*} \end{small} \subsection{Case Study} We select three communities for exploration: (i) R8 (Near North Side): situated in downtown Central Chicago and experiences high crime distribution, (ii) R25 (Austin): situated on the Western side of Chicago and is not as busy as R8, but has a high crime distribution and (iii) R72 (Beverly): located in Southern Chicago and is a quiet residential community with low crime rate. For each community, we randomly select 200 samples from test set and present the contribution of neighbor regions, POI and taxi flow features, trends and important time steps as a heat map in Figure~\ref{Fig:case_8_25}. We denote crimes category Theft, Criminal Damage, Battery and Narcotics with C1, C2, C3 and C4, respectively. From Equation~\ref{eq:1}, the contribution coefficient of the crime occurrences of region $r_i'\in\mathcal{N}_i$ to the crime embedding of target region $r_i$ during time step $t$ can be calculated as, $\phi(\mathbf{{c}}_{i, t}^k, x_{i', t}^k) = \alpha_{ii'}\mathbf{w_x}{x_{i', t}^k}$. From Equation~\ref{eq:2}, the contribution coefficient of feature $j$ on target region can be calculated as $\phi(\mathbf{{e}}_{i, t}^k, f_{t}^j) = \beta_{ii'}^{j} \sum_{i' \in \mathcal{N}_i}\alpha_{ii'} \mathbf{w_v}f_{i', t}^j$. Similarly, $\phi(\hat{y}_{i, T+1}^k, {h}_{T+1}^a) =\alpha_a \mathbf{w}\mathbf{h}_{T+1}^a$ denotes the contribution coefficient of recent, daily and periodic trends (Equations~\ref{eq:4},~\ref{eq:5}). For R8, professional POIs (F10) made the highest contribution. R8 is a business region with thousands of jobs and has a large number of professional POIs. Thus it is expected that those POIs have large impact on it's crime embedding. On the other hand, R25 and R72 are residential regions. POI Shop (F11) contributed most for R25 and R72. Besides F11, Residence (F4) POIs also contributed for R72 for all categories except C4. Hence, our model learns both region and category specific influential features. An interesting observation for R8 is that though R8 has a large number of Food and Shop POIs, their contribution is almost none which signifies the quality of our model's prediction. C1 shows strong long term temporal correlation for R8, whereas none of the crime category shows long term temporal correlation for R72 as the crime number for R72 is low. C3 in R25 shows a strong periodic correlation and unlike R8 and R72, it does not depend on recent crimes. C4 hardly present any long term correlation, which is intuitive. C2 shows daily periodicity in R8 and R25. R7 and R24 have the most similar crime distribution as R8. However, these similarities vary with crime categories, e.g. for C1 and C3, R7 is given more attention whereas for C4, the attention shifts to R24 and R28. This is because both R24 and R28 experience large number of C4 crimes and have greater influence than R7. For R25, R18 is the most influential region across all crime categories. Unlike R8, the contribution of its neighboring regions are almost same except for R23 which is given less importance compared to other neighbors. The fact that R23 shares its boundary with different regions of different districts/sides makes their crime distribution less similar. R72 gives equal importance to each of its neighbors except R71. R71 has a higher number of crime occurrences than R72 and their crime distribution is quite different for all crime categories except C4. Thus, our model is able to capture diverse spatial correlation. \begin{figure*}[t] \captionsetup[subfigure]{aboveskip=-5pt, belowskip=1pt} \begin{subfigure}{\textwidth} \def0.9\textwidth{0.9\textwidth} \centering \input{Figures/r7.pdf_tex} \caption{R8 (Near North Side)} \label{Fig:case_8} \end{subfigure} \begin{subfigure}{\textwidth} \def0.9\textwidth{0.9\textwidth} \centering \input{Figures/r24.pdf_tex} \caption{R25 (Austin)} \label{Fig:case_25} \end{subfigure} \begin{subfigure}{\textwidth} \def0.9\textwidth{0.9\textwidth} \centering \input{Figures/r71.pdf_tex} \caption{R72 (Beverly)} \label{Fig:case_72} \end{subfigure} \caption {Case analysis of Region 8, 25 and 72} \label{Fig:case_8_25} \vspace{-3mm} \end{figure*} \section{Conclusion} \label{sec:conclusion} We propose AIST, a novel interpretable deep learning framework for crime prediction. AIST captures the dynamic spatio-temporal correlations based on the past crime occurrences, external features (e.g., traffic flow and POI information) and the recent and periodic crime trends. We develop two novel variants of GAT, $hGAT$ and $fGAT$ that allows AIST to improve prediction accuracy and provide the insights behind a prediction. Experiments and case studies on real-world Chicago crime data show that AIST outperforms the baseline models in terms of prediction accuracy and we can exploit attention weights associated with different parts of the model to interpret its prediction. On average, AIST shows a decrease of $8.3$\% on MAE and $20.98$\% on MSE over the state-of-the-art for crime prediction tasks. AIST also outperforms the high-performance spatio-temporal models~\cite{DBLP:conf/ijcai/LiangKZYZ18, DBLP:conf/ijcai/YuYZ18, DBLP:journals/TKDE/9139357} developed for solving different domain of tasks (e.g., geo-sensory time series, traffic or crowd flow prediction). On average, AIST shows a decrease of $4.1\%$ on MAE and $7.45\%$ on MSE, when we customize these models for the crime prediction task. Though we evaluate AIST for the crime prediction problem, AIST has the ability to learn an arbitrary function over the spatio-temporal-semantic space and can be adapted for any other spatio-temporal problem (e.g. traffic, citywide passenger demand, taxi demand prediction) that can benefit from incorporating semantically relevant information and knowing the interpretation of the prediction. \bibliographystyle{ACM-Reference-Format}
{'timestamp': '2021-11-23T02:23:42', 'yymm': '2012', 'arxiv_id': '2012.08713', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08713'}
arxiv
\section{Introduction} \label{section:introduction} Transformer models~\citep{vaswani2017attention} pre-trained by language modeling tasks are very powerful on a wide variety of NLP tasks~\citep{devlin2018bert, liu2019roberta}. However, the convergence efficiency of language pre-training methods hasn't been improved much~\citep{li2020train, kaplan2020scaling}. Given finite amount of time and computing resources, language pre-training methods can be very under-trained~\citep{liu2019roberta}. Therefore unlike most of classic deep learning tasks in which overfitting is a concern, the challenge of language pre-training is actually underfitting the training data~\citep{liu2019roberta,carlini2020extracting,li2020train,shoeybi2019training}. What makes data fitting so hard for language pre-training? Recent research shed light on this issue by interpreting the attention weights of pre-trained Transformer models\citep{clark2019does, rogers2020primer} or running probing tasks on pre-trained models with different situations\citep{liu2019linguistic,zhang2020you, talmor2019olmpics, tenney2019you, liu2021probing}. One common observation from such work is that pre-trained model's attention modules can be good at capturing linguistic information such as syntactic patterns, while having a hard time at fitting more complex patterns such as human commonsense and reasoning. This is probably due to that models pre-trained with language modeling tasks rely too much on word co-occurrence information \citep{tenney2019you,talmor2019olmpics}. We observed similar phenomenon by manually examining the word predictions of Masked Language Model (MLM) at masked positions during pre-training. We found that even at the early stage of pre-training, the pre-trained model can surprisingly produce very fluent sentences. However, the model can have mis-predictions that semantically or logically contradict with the context through the entire pre-training. One example is, \begin{center} \textbf{\texttt{He went back to his \underline{bedroom} to continue his draft design of a new bed.}} \end{center} In the masked position of the sentence above, the ground-truth word is ``study'', which is mis-predicted as ``bedroom''. It is probably because the frequently co-occurring pattern between ''bedroom'' and ''bed'' that is easy to fit for the model, dominates pre-training and outruns the hard-to-fit semantics in the context. Such easy-to-fit patterns can therefore prevent the model from fitting the more sophisticated patterns, such as reasoning and rare facts, and harm the model's performance on downstream tasks. Fortunately, we believe that mis-predictions can help locate such dominating patterns the model has fitted that harm language understanding. When a mis-prediction occurs, there are likely to be some dominating patterns related to the mis-prediction in the context fitted by the model that cause this mis-prediction, for example, the frequently co-occurring word ''bed'' with the mis-prediction ''bedroom'' in the highlighted example. If we can add regularization to train the model to rely less on these dominating patterns such as word co-occurrences when a mis-prediction occurs, thus focusing more on the rest more subtle patterns, more information can be efficiently fitted at pre-training. Following this motivation, we propose a new language pre-training method, Using Mis-predictions as Harm Alerts (MPA). Specifically, in MPA, when a mis-prediction occurs during pre-training, we use its co-occurrence information to guide several heads of the self-attention modules. These self-attention heads in the Transformer modules are optimized to assign higher attention weights to the words in the input sentence that rarely co-occur with the mis-prediction while assigning lower weights to the other words. By doing so, the Transformer model is trained to rely less on the dominating co-occurring patterns of mis-predictions while focusing more on the rest of the contextual information. Empirically we find that such a simple regularization can help pre-training methods quite effectively. We conduct experiments using BERT and ELECTRA~\citep{clark2019electra} as MPA's backbone methods. Our results show that MPA expedites the training processes of BERT and ELECTRA and improves their performances on downstream tasks. Sensitivity analysis on hyper-parameter configurations shows that MPA improves the backbone methods in a wide range of hyper-parameter settings. The ablation study also illustrates that MPA's effectiveness largely comes from the assigning appropriate attention weights to rare context of mis-predictions. \section{Using Mis-Predictions as Harm Alerts} \label{section:main} \vspace{-2mm} In the section, we first briefly introduce BERT (in Appendix \ref{appx:preliminaries}) and ELECTRA as preliminaries. Then we describe the proposed method, Mis-Predictions as Harm Alerts (MPA). We use ELECTRA as the backbone method to describe MPA for ease of illustration, but it is important to note that MPA can potentially be applied to other Transformer-based language pre-training methods as well. \subsection{Preliminaries} \label{subsection:preliminaries} \paragraph{ELECTRA} ELECTRA trains two Transformer models in parallel, one smaller BERT as generator (G) and the other normal-sized Transformer as discriminator (D). The training objective of the discriminator is to detect the mis-predicted tokens from the generator. The ELECTRA generator's training objective and loss function are the same as those of BERT, as described in the previous section and Equation~\ref{eq:bert-loss}. Specifically, the input of the generator is a token sequence masked similarly as in BERT pre-training. At every iteration during training, the generator makes predictions at the masked positions of each sequence. Then the generator outputs a new token sequence with tokens at the masked positions replaced by the generator's predictions. The generator's output sequence then would be used as the input of the discriminator. If we denote the generator's output sequence as $\mathbf{x}^r$, then the discriminator's loss function is, \begin{equation} \begin{aligned} \mathcal{L}_{D}(\mathbf{x}, \mathbf{x}^{r}) &= \frac{1}{N} (\sum_{t=1}^N-\mathbf{1}(\mathbf{x}_t^{r}=\mathbf{x}_t)\cdot \log D(\mathbf{x}^{r},t) \\ &-\mathbf{1}(\mathbf{x}_t^{r}\neq \mathbf{x}_t)\cdot\log (1-D(\mathbf{x}^{r},t))). \label{eq:electra-loss} \end{aligned} \end{equation} $N$ is the length of the input sequence $x$. Equation~\ref{eq:electra-loss} is a cross-entropy loss for the binary classification task of ELECTRA's discriminator. With this loss, the discriminator of ELECTRA is trained to detect if the token at each position of the input is a mis-prediction. The final combined loss of ELECTRA with respect to $x$ is, \vspace{-3mm} \begin{align} \mathcal{L}_(\mathbf{x},\mathbf{x}^{m}, \mathbf{x}^{r}) &= \mathcal{L}_G(\mathbf{x}, \mathbf{x}^{m})+\lambda \mathcal{L}_D(\mathbf{x}, \mathbf{x}^{r}), \label{eq:electra-entire-loss} \end{align} $\lambda$ is the hyper-parameter controlling the ratio of the two losses. With this modified task, ELECTRA improves the pre-training efficiency by providing a better sampling efficiency. \subsection{The Proposed Method} \label{subsection:main} \vspace{-2mm} A mis-prediction usually occurs when there are dominating co-occurring patterns with the mis-prediction in the context that lead to it. In this section, we firstly describe how MPA locates such dominating and harmful patterns with the help of mis-predictions. MPA achieves this goal by preparing beforehand a context matrix $\mathbf{S}$ with word oc-occurrence information. In context matrix $\mathbf{S}$, for a token $i$ and token $j$, if $j$ co-occurs frequently with $i$, $\mathbf{S}_{i,j}$ is close to $1$ and vice versa. Details of constructing $\mathbf{S}$ are in Appendix\ref{appx:context}. Then we describe how MPA trains the Transformer model to rely less on such patterns and rely more on the rest information with the help of this context matrix. \paragraph{Pre-training.} After recording the context information of tokens in the context matrix $S$, we start pre-training with MPA. During pre-training, given an partially-masked input sequence $\mathbf{x}^m$, we firstly forward it to the generator and get $\mathbf{x}^r$, same as ELECTRA. $\mathbf{x}^r$ is the output sequence from the generator, with tokens at the masked positions replaced by the generator's predictions. Then we collect the mis-predicted positions in $\mathbf{x}^r$ as, \begin{align} \mathcal{M}_{x} =\{1(x_t^{r} \neq x_t)\cdot t\}_{t=1}^{N_x}. \label{eq:multi-head} \end{align} $N_x$ is the length of the input sequence $\mathbf{x}$. As described in Equation~\ref{eq:attention}, each query-key attention co-efficient $a(i,j)$ is calculated by a scaled dot-product of the query $i$ and the key $j$. We maintain the self-attention modules the same for all the other positions in the input sequence, except the mis-predicted positions in $\mathcal{M}_{x}$. For each mis-predicted position $t$ in the input sequence $\mathcal{M}_{x}$, we firstly fetch the pre-calculated context vector of the mis-predicted token $x_t^{r}$ from $\mathbf{S}$. We denote it as $\mathbf{S}_{x_t^r}$. The vector $\mathbf{S}_{x_t^r}$ consists of the context co-efficients of the mis-prediction $x_t^{r}$ with all tokens in the vocabulary. Then from $\mathbf{S}_{x_t^r}$, we select context coefficients of mis-prediction $x_t^{r}$ with tokens in the input sentence $\mathbf{x}^r$ and denote the vector as $\mathbf{S}(t, \mathbf{x}^r)$. $\mathbf{S}(t, \mathbf{x}^r)$ is a vector with its dimension equal to the length of $\mathbf{x}^r$. Each element $\mathbf{S}(t, \mathbf{x}^r)_i$ in $\mathbf{S}(t, \mathbf{x}^r)$ is the context coefficient of token pair $(x_t^r, x_i^r)$. Figure~\ref{fig:fetch} describes this process in detail with an example. With $\mathbf{S}(t, \mathbf{x}^r)$ prepared for the input sequence $\mathbf{x}^r$ and the mis-predicted position $t$, MPA guides several self-attention heads in the discriminator to focus less on the frequent context and more on the other context of each mis-prediction $x_t^{r}$. Specifically, at the mis-predicted position $t$, for query $\mathbf{q}_t$, the context-guided self-attention calculates the attention coefficients as, \vspace{-2mm} \begin{align} \mathbf{g}(\mathbf{q}_t, \mathbf{K}) = \frac{\mathbf{q}_t\mathbf{K}^T}{\sqrt{d_K}}\cdot (1-\mathbf{S}(t, \mathbf{x}^r)). \label{eq:context-guilded} \end{align} \vspace{-1mm} In this equation, we multiply the original pre-softmax attention co-efficients $\frac{\mathbf{q}_t\mathbf{K}^T}{\sqrt{d_K}}$ at position $t$ with $(1-\mathbf{S}(t, \mathbf{x}^r))$. Through this way, keys ignored by the attention module could be set a larger weight in $\mathbf{g}(\mathbf{q}_t, \mathbf{K})$ if their context coefficients in $\mathbf{S}(t, \mathbf{x}^r)$ are smaller compared with other tokens in the sentence. Keys at positions of frequent context of the mis-prediction would be set a smaller weight in $\mathbf{g}(\mathbf{q}_t, \mathbf{K})$ since their context coefficients in $\mathbf{S}(t, \mathbf{x}^r)$ is relatively large. We then use $\mathbf{g}(\mathbf{q}_t, \mathbf{K})$ as the supervised information to train these self-attention heads at the mis-predicted position $t$. Specifically, we minimize the L-2 loss between $\mathbf{g}(\mathbf{q}_t, \mathbf{K})$ and the original pre-softmax attention weights from the attention module, \vspace{-3mm} \begin{align} \small \mathcal{L}_A = \frac{1}{N_M}\sum_{t=0}^{N_M}(\frac{\mathbf{q}_t\mathbf{K}^T}{\sqrt{d}}-\mathbf{g}(\mathbf{q}_t, \mathbf{K}))^2 \label{eq:attention_loss_2} \end{align} \vspace{-3mm} $N_M$ is the total number of mis-predictions. Note that we don't back-propergate through $\mathbf{g}(\mathbf{q}_t, \mathbf{K})$. $\mathbf{g}(\mathbf{q}_t, \mathbf{K})$ is only used as supervised information to guide the model to focus more on conflicting context of mis-predictions. Figure~\ref{fig:arch} in Appendix shows with an example the training of self-attention heads with this additional loss at the mis-predicted positions. The final loss function of the proposed pre-training method is, \vspace{-3mm} \begin{align} \small \mathcal{L}_(\mathbf{x},\mathbf{x}^{m}, \mathbf{x}^{r}) &= \mathcal{L}_G(\mathbf{x}, \mathbf{x}^{m})+\lambda \mathcal{L}_D(\mathbf{x}, \mathbf{x}^{r}) + \gamma \mathcal{L}_A (\mathbf{x}, \mathbf{x}^{r}). \label{eq:total-loss} \end{align} \vspace{-1mm} $\lambda$ and $\gamma$ and hyper-parameters controlling the ratio of the 3 losses. We present the implementation details in Appendix \ref{appx:implementation}. \section{Experiments} \label{section:experiments} \vspace{-2mm} To verify the efficiency and effectiveness of MPA, we conduct pre-training experiments and evaluate pre-trained models on fine-tuning downstream tasks. All codes are implemented with \emph{fairseq} \citep{ott2019fairseq} in \emph{PyTorch} \citep{paszke2017automatic}. All models are run on 8 NVIDIA Tesla V100 GPUs with mixed-precision \citep{micikevicius2017mixed}. We describe our experiment setup in Appendix \ref{appx:exp_setup} \begin{table} \small \caption{Performances of all methods on all downstream tasks. Results of GPT, BERT and ELECTRA are from \citep{clark2019electra} and \citep{levine2020pmi}. The result of SpanBERT is obtained by fine-tuning the released checkpoint from \citep{joshi2019spanbert}. We also reproduce BERT and ELECTRA in our system for fair comparison. We report their results as BERT(ours) and ELECTRA(ours). MPA outperforms its corresponding backbone methods on every downstream task. } \label{tab:general} \small \begin{tabular}{lccccc} \toprule & Params & Avg. GLUE & Avg. SuperGLUE & SQuAD2.0 F1 & SQuAD2.0 EM\\ \hline GPT-2 & 117 M & 78.8 & -&- &-\\ BERT & 110 M & 82.2 & 66.1 &76.4 &79.6\\ SpanBERT & 110 M & 83.9 &- &77.1 &80.3\\ ELECTRA & 110 M & 85.1 & -& 80.5&83.3\\ \hline BERT (Ours) & 110 M & 83.0 & 66.3& 76.9& 80.1\\ BERT-MPA & 110 M & $\mathbf{83.7}$ & $\mathbf{67.4}$& $\mathbf{77.5}$& $\mathbf{80.7}$\\ \hline ELECTRA (Ours) & 110 M & 85.2 & 70.1& 80.2 &83.1\\ \textbf{ELECTRA-MPA} & 110 M & $\mathbf{86.0}$ & $\mathbf{72.2}$ & $\mathbf{83.1}$ & $\mathbf{86.1}$\\ \bottomrule \end{tabular} \end{table} Table~\ref{tab:general} shows the performances of all pre-trained models on every task. We can see that MPA improves the performance of both BERT and ELECTRA on each of the task tested. For fair comparison, we pre-train the two baselines, BERT and ELECTRA, with our system and data and present the results as BERT(ours) and ELECTRA(ours). We also present pre-trained models' performances on every individual sub-task of GLUE in Table~\ref{tab:glue} and those of SuperGLUE in Table~\ref{tab:superglue} in Appendix. Results show that MPA can outperform both of the backbone methods in the majority of sub-tasks. MPA also has considerable performance improvements on tasks requiring more complex semantic understanding and reasoning, such as MNLI, RTE, WiC and WSC. We also present the average GLUE score curves during the pre-training in Figure~\ref{fig:curve} in Appendix. It shows that MPA outperforms its backbone methods throughout the entire pre-training. It also shows that MPA can reach the same average GLUE scores with fewer numbers of iterations compared with both baselines. The number of iterations required for MPA-ELECTRA is $40\%$ less than that of ELECTRA when reaching ELECTRA's final performance. Since MPA-ELECTRA's running time per iteration is identical with ELECTRA, MPA-ELECTRA's training time is also $40\%$ less than that of ELECTRA. Finally we present our hyper-parameter analysis and ablation study in Appendix \ref{appx:ablation_study} \section{Conclusion and Future Work} \label{section:conclusion} \vspace{-2mm} In this work, we propose MPA (Mis-Predictions as Harm Alerts) to improve language pre-training methods. In MPA, we train several heads of Transformer's attention modules to rely less on the dominating co-occurring patterns with mis-predictions and to focus more on the rare context of them. Experimental results show that MPA can improve both BERT and ELECTRA on the majority of GLUE downstream tasks. MPA can also make the pre-training of BERT and ELECTRA more efficient. The ablation study also confirms that MPA's effectiveness largely comes from the rare context of mis-predictions.
{'timestamp': '2021-12-06T02:26:52', 'yymm': '2012', 'arxiv_id': '2012.08789', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08789'}
arxiv
\section{Adding nodes and edges through Named-Entity Recognition} \mysection{Named-Entity Recognition} \label{sec:entity-extraction} We enrich our graphs by leveraging Machine Learning (ML) tools for Information Extraction. {\em Named entities} (NEs) \cite{nadeau2007ner} are words or phrases which, together, designate certain real-world entities. Named entities include common concepts such as people, organizations, and locations. The {\em Named-Entity Recognition} (NER) task consists of $(i)$~identifying NEs in a natural language text, and ($ii$)~classifying them according to a pre-defined set of NE types. Let $n_t$ be a text node. We feed $n_t$ as input to a NER module and create, for each entity occurrence $E$ in $n_t$, an \textbf{entity occurrence node} (or entity node, in short) $n_E$; as explained below, we extract \textbf{Person, Organization} and \textbf{Location} entity nodes. Further, we add an edge from $n_t$ to $n_E$ whose label is cl:extract$T$, where $T$ is the type of $E$, and whose confidence is $c$, the {\em confidence of the extraction}. In Figure~\ref{fig:example-graph}, the blue, round-corner rectangles {\sf Centrafrique, Areva, P. Balkany, Levallois-Perret} correspond to the entities recognized from the text document, while the {\sf Marrakech} entity is extracted from the identical-label value node originating from the CSV file. \vspace{3mm} \noindent\textbf{Named-Entity Recognition} We describe here the NER approach we devised for our framework, for English and French. While we have used Stanford NER~\cite{finkel2005incorporating} in~\cite{Chanial2018}, we have subsequently developed a more performant module based on the Deep Learning Flair NLP framework~\cite{akbik2019flair}. Flair and similar frameworks rely on {\em embedding} words into vectors in a multi-dimensional space. Traditional word embeddings, e.g., Word2Vec \cite{mikolov2013efficient}, Glove \cite{pennington2014glove} and fastText \cite{bojanowski2017enriching}, are \emph{static}, meaning that a word's representation does not depend on the context where it occurs. New embedding techniques are \emph{dynamic}, in the sense that the word's representation also depends on its context. In particular, the Flair dynamic embeddings~\cite{akbik2018contextual} achieve state-of-the-art NER performance. The latest Flair architecture~\cite{akbik2019flair} facilitates {\em combining} different types of word embeddings, as a better performance might be achieved by combining dynamic with static word embeddings. For English, we rely on a model\footnote{https://github.com/flairNLP/flair} pre-trained using the English CoNLL-2003\footnote{https://www.clips.uantwerpen.be/conll2003/ner/} news articles dataset. The model combines Glove embeddings~\cite{pennington2014glove} and so-called {\em forward and backward pooled} Flair embeddings, that evolve across subsequent extractions. As such a model was missing for French, we trained a Flair one on WikiNER~\cite{nothman2013learning}, a multilingual NER dataset automatically created using the text and structure of Wikipedia. The dataset contains $132$K sentences, $3.4$M tokens and $216$K named-entities, including $74$K Person, $116$K Location and $25$K Organization entities. The model uses stacked forward and backward French Flair embeddings with French fastText~\cite{bojanowski2017enriching} embeddings. \noindent\textbf{Entity node creation.} Similarly to the discussion about value node factorization (Section~\ref{sec:graph-refine-optim}), we have the choice of creating an entity node $n_E$ of type $t$ once per occurrence, or (in hierarchical datasets) {\em per-path}, {\em per-dataset} or {\em per-graph}. We adopt the per graph method, with the mention that we will create one entity node for each disambiguated entity and one entity node for each non-disambiguated entity. \subsubsection{Disambiguation quality} \label{sec:exp-disambiguation} We now evaluation the quality of the disambiguation module. As mentioned in Section~\ref{sec:disambig}, our module works for both English and French. \begin{wrapfigure}{L}{0.55\textwidth} \begin{tabular}{|l|c|c|c|}\cline{2-4} \multicolumn{1}{l|}{} & Precision & Recall & $F1$\\\hline LOC & 99.00\% & 97.05\% & 98.01\% \\ ORG & 92.38\% & 75.19\% & 82.90\% \\ PER & 75.36\% & 77.94\% & 76.62\% \\\hline Micro & 90.51\% & 82.94\% & 86.55\% \\\hline \end{tabular} \caption{Quality of disambiguation for French.\label{fig:ned}} \vspace{-4mm} \end{wrapfigure} The performance for English has been measured on the CoNLL-YAGO dataset~\cite{hoffart2011robust}, by the developers of Ambiverse. They report a micro-accuracy of $84.61\%$ and a macro-accuracy of $82.67\%$. To the best of our knowledge, there is no labeled corpus for entity disambiguation in French, thus we evaluate the performance of the module on the FTBNER dataset previously introduced. FTBNER consists of sentences annotated with named entities. The disambiguation module takes a sentence, the type, and offsets of the entities extracted from it, and returns for each entity either the URI of the matched entity or an empty result if the entity was not found in the KB. In our experiment, $19\%$ of entities have not been disambiguated, more precisely $22\%$ of organizations, $29\%$ of persons, and $2\%$ of locations. For a fine-grained error analysis, we sampled 150 sentences and we manually verified the disambiguation results (Figure~\ref{fig:ned}). The module performs very well, with excellent results for locations ($F1 = 98.01\%$), followed by good results for organizations ($F1 = 82.90\%$) and for persons ($F1 = 76.62\%$). In addition to these results, we obtain a micro-accuracy of $90.62\%$ and a macro-accuracy of $90.92\%$. The performance is comparable with the one reported by the Ambiverse authors for English. We should note though that the improvement for French might be due to our smaller test set. \subsubsection{Graph construction} \label{sec:exp-construction} We start by studying the impact of \textbf{node factorization} (Section~\ref{sec:graph-refine-optim}) on the number of graph nodes and the graph storage time. For that, we rely on the XML dataset, and {\em disable entity extraction, entity disambiguation, and node matching}. Its (unchanged) number of edges $|E|$ is $1.588.839$. For each type of loading, we report the number of nodes $|N|$, the time spent storing nodes and edges to disk $T_{DB}$, and the total running time $T$ in Table~\ref{tab:impact}. \begin{wrapfigure}{L}{0.62\textwidth} \vspace{-3.5mm} \scalebox{0.9}{\begin{tabular}{p{3.7cm}rrrrr} Value node creation policy & $|N|$ & $T_{DB}$ (s) & $T$ (s)\\\hline Per-instance & $1.588.840$ & $318$ & $319$ \\ Per-path & $1.093.060$ & $271$& $318$ \\ Per-path w/ null code detection & $1.207.951$ & $276$ & $323$ \\ Per-dataset & $1.084.918$ & $265$ & $307$\\ Per-graph & $1.084.918$ & $179$ & $228$ \\ Per-graph w/ null code detection & $1.199.966$ & $179$ & $229$ \\ \end{tabular}} \vspace{-2.5mm} \caption{Impact of node factorization.} \label{tab:impact} \vspace{-3mm} \end{wrapfigure} Moving from per-instance to per-path node creation reduces the number of nodes by a third. However, this introduces some errors, as the dataset features many \textbf{null codes} (Section~\ref{sec:graph-refine-optim}); for instance, with per-instance value creation, there are $1.113$ nodes labeled {\em ``n\'{e}ant''} (meaning ``non-existent''), $32.607$ nodes labeled {\em ``Donn\'{e}es non publi\'{e}es''} (unavailable information) etc. Using per-path, the latter are reduced to just $1.154$, which means that in the dataset, {\em ``Donn\'{e}es non publi\'{e}es''} appears $32.607$ times on $1.154$ different paths. However, this factorization, which introduces connections between the XML nodes which are parents of this ``null'' value, may be seen as wrong. When the null codes were input to ConnectionLens, such nodes are no longer unified; the number of nodes increases, and so does the storage time. In this graph, consisting of one data source, per-dataset and per-graph produce the same number of nodes, overall the smallest; it also increases when null codes are not factorized. We conclude that {\em per-graph value creation combined with null code detection} is a practical alternative. Next, we study the impact of \textbf{named entity extraction} (Section~\ref{sec:entity-extraction}) and \textbf{disambiguation} (Section~\ref{sec:disambig}) on the graph construction time. \begin{wrapfigure}{L}{0.6\textwidth} \includegraphics[width=0.6\textwidth]{images/updated/constructionbw.png} \vspace{-10mm} \caption{Graph construction time (seconds).\label{fig:impact-extract-disambig}} \vspace{-5mm} \end{wrapfigure} For this, we load $100.000$ triples from our Yago subset, with per-graph factorization, natural for the RDF data model where each literal or URI denotes one node in the RDF graph. In Figure~\ref{fig:impact-extract-disambig}, we load the triples using several configurations: without any entity extraction (NONE); with SNER entity extraction, without and then with disambiguation; with FLAIR entity extraction, without and then with disambiguation. While Flair is slower, its results are qualitatively much better than those obtained with SNER (see Section~\ref{sec:exp-ner} below). To make it faster, we also implement a \textbf{batch extraction} mechanism whereas $l_B$ labels are input a time to each extraction service, to take advantage of the parallel processing capacity available in current CPUs. In Figure~\ref{fig:impact-extract-disambig}, in the ``FLAIR, BATCH'' column, we used $l_B=128$ which maximized performance in our experiments. A second optimization leverages the fact that so-called {\em sequence to sequence (seq2seq)} models such as that used in our Flair extractor, when given a batch of inputs, pad the shortest ones to align them to the longest input, and some computation effort is lost on useless padding tokens. Instead, if {\em several batches}, say $n_B$, are received by the extraction service, it can {\em re-group} the inputs so that one call to the seq2seq model is made over inputs of very similar length, thus no effort is wasted. In our experiments, we used $n_B=10$. Figure~\ref{fig:impact-extract-disambig} shows the time taken by storage, extraction and disambiguation (when applied) and the total graph creation time; note the logarithmic $y$ axis. Storing the graph PostgreSQL dominates the loading time in the absence of extraction, or when using SNER. In contrast, Flair extraction takes more than one order of magnitude longer; batching reduces it by a factor of two. Finally, disambiguation, relying on computationally complex operations, takes longest; it also incurs a modest invocation overhead as it resides on a different server (with the regular server hardware described in Section~\ref{sec:evaluation:setup}), in the same fast network. \noindent Next, we study \textbf{node matching} (Section~\ref{sec:matching}). For this, we loaded the XML dataset, which comes from individual declaration of interest, filled in by hundreds of users, with numerous spelling variations, small errors and typos. Loaded per-graph mode, with batched Flair extraction, the resulting graph has $1.102.209$ nodes and $1.615.291$ edges. We test two configurations: comparing {\em all leaf node pairs} to find possible similarity edges, respectively, comparing {\em only entity pairs}. On the regular server, in both cases, data storage took $3$ minutes, and extraction $13$ minutes. When all comparisons are made, they take $39$ minutes, dominating the total time of $56$ minutes. A total of $28.875$ similar pairs are found to be above our similarity thresholds, and lead to the same number of cl:sameAs edges stored in the graph, together with the respective similarity values. Only $748$ among these are entity pairs; the others are pairs of similar strings. This confirms the interest of node matching; we hope to reduce its cost further by using techniques such as Locality-Sensitive Hashing (LSH). \begin{wrapfigure}{L}{0.6\textwidth} \vspace{-4mm} \includegraphics[width=0.6\textwidth]{images/updated/scalability.png} \vspace{-8mm} \caption{YAGO loading time (minutes) using Flair. \label{fig:yago}} \vspace{-4mm} \end{wrapfigure} To study the \textbf{scalability} of our loading process, we loaded our YAGO subset by slices of 1M triples and measured the running time for these increasing data sizes, using the best extractor (Flair) with the same batch size(s) as above. Figure~\ref{fig:yago} shows the loading time as the data grows, in three different hardware settings: on our regular server, our more powerful GPU server {\em disabling GPU use}, and the same {\em exploiting the GPU}. Figure~\ref{fig:yago} shows that loading time scales linearly in the data volume on all configurations, and batching helps make the most out of our regular server. \noindent \textbf{Complete graph} Finally, we loaded all the data sources described in Section~\ref{sec:evaluation:setup} in a single graph, using per-graph node creation, batched Flair extraction, and disambiguation for HTML and XML (not for the RDF Yago subset, whose literals are already associated to URIs). The graph has $|N|=8.019.651$ nodes (including $677.459$ person entities, $275.316$ location entities, and $61.452$ organization entities), and $|E|=20.642.207$ edges. Many entities occur across data sources, e.g., $330$ person entities occur, each, in at least $10$ sources; the French president E.~Macron occurs in $183$ distinct sources. All these lead to interconnections across sources. On our fastest (GPU) hardware configuration, loading the RDF data took $128$ minutes; the HTML articles another $260$, and the XML document $96$ minutes more. The last two times reflect the relatively high cost of disambiguation (recall Figure~\ref{fig:impact-extract-disambig}). ConnectionLens users can turn it off when it is not needed (e.g., if users feel they know the real-world entities behind entity labels encountered in the graph), or trigger it {\em selectively}, e.g., on organizations but not on people nor locations etc. \subsubsection{Named-Entity Recognition quality} \label{sec:exp-ner} Due to the unavailability of an off-the-shelf, good-quality entity extractor for French text, we decided to train a new model. To decide the best NLP framework to use, we experimented with the Flair~\cite{akbik2019flair} and SpaCy (\url{https://spacy.io/}) frameworks. Flair allows {\em combining} several embeddings, which can lead to significant quality gains. Following~\cite{akbik2019flair}, after testing different word embedding configurations, we trained a Flair model using {\em stacked forward and backward French Flair embeddings} with {\em French fastText embeddings} on the WikiNER dataset. We will refer to this model as \textit{Flair-SFTF}. Below, we describe a \emph{qualitative comparison} of \textit{Flair-SFTF} with the French Flair and SpaCy {\em pre-trained} models. The French pre-trained Flair model is trained with the WikiNER dataset, and uses French character embeddings trained on Wikipedia, and French fastText embeddings. As for SpaCy, two pre-trained models are available for French: a medium (\textit{SpaCy-md}) and a small one (\textit{SpaCy-sm}). They are both trained with the WikiNER dataset and the same parameterization. The difference is that \textit{SpaCy-sm} does not include word vectors, thus, in general, \textit{SpaCy-md} is expected to perform better, since word vectors will most likely impact positively the model performance. Our evaluation also includes the model previously present in ConnectionLens~\cite{Chanial2018}, trained using \textit{Stanford NER}~\cite{finkel2005incorporating}, with the Quaero Old Press Extended Named Entity corpus~\cite{galibert2012extended}. We measured the precision, recall, and $F1$-score of each model using the \textit{conlleval} evaluation script, previously used for such tasks\footnote{The script \url{https://www.clips.uantwerpen.be/conll2002/ner/} has been made available in conjunction with the CoNLL (Conference on Natural Language Learning).}. \textit{conlleval} evaluates \emph{exact matches}, i.e., both the text segment of the proposed entity and its type, need to match ``gold standard'' annotation, to be considered correct. Precision, recall, and $F1$-score (harmonic mean of precision and recall) are computed for each named-entity type. To get an aggregated, single quality measure, \textit{conlleval} computes the {\em micro-average} precision, recall, and $F1$-score over all recognized entity instances, of all named-entity types. For evaluation, we used the entire FTBNER dataset~\cite{sagot-etal-2012-annotation}. We pre-processed it to convert its entities from the seven types they used, to the three we consider, namely, persons, locations and organizations. After pre-processing, the dataset contains $12$K sentences and $11$K named-entities ($2$K persons, $3$K locations and $5$K organizations). \begin{table}[h!] \begin{tabular}{|p{0.14\columnwidth}|p{0.12\columnwidth}|p{0.14\columnwidth}|p{0.14\columnwidth}|p{0.14\columnwidth}|p{0.14\columnwidth}|}\cline{1-6} Entities & Flair-SFTF & Flair-pre-trained & SpaCy-md & SpaCy-sm & Stanford NER \\\hline LOC-P & 59.52\% & 53.26\% & 55.77\% & 54.92\% & 62.17\% \\ LOC-R & 79.36\% & 77.71\% & 78.00\% & 79.41\% & 69.05\% \\ LOC-$F1$ & 68.02\% & 63.20\% & 65.04\% & 64.93\% & 65.43\% \\\hline ORG-P & 76.56\% & 74.57\% & 72.72\% & 71.92\% & 15.82\% \\ ORG-R & 74.55\% & 75.61\% & 54.85\% & 53.23\% & 5.39\% \\ ORG-$F1$ & 75.54\% & 75.09\% & 62.53\% & 61.18\% & 8.04\% \\\hline PER-P & 72.29\% & 71.76\% & 53.09\% & 57.32\% & 55.31\% \\ PER-R & 84.94\% & 84.89\% & 74.98\% & 79.19\% & 88.26\% \\ PER-$F1$ & 78.10\% & 77.78\% & 62.16\% & 66.50\% & 68.00\% \\\hline Micro-P & 69.20\% & 65.55\% & 61.06\% & 61.25\% & 50.12\% \\ Micro-R & 77.94\% & 77.92\% & 65.93\% & 66.32\% & 40.69\% \\ Micro-$F1$ & 73.31\% & 71.20\% & 63.40\% & 63.68\% & 44.91\% \\\hline \end{tabular} \caption{Quality of NER from French text.\label{fig:ner-results-table}} \vspace{-4mm} \end{table} \begin{comment} \begin{table}[h!] \begin{tabular}{|l|c|c|c|}\cline{2-4} \multicolumn{1}{l|}{Flair-SFTF} & Precision & Recall & $F1$ \\\hline LOC & 59.52\% & 79.36\% & 68.02\% \\ ORG & 76.56\% & 74.55\% & 75.54\% \\ PER & 72.29\% & 84.94\% & 78.10\% \\\hline Micro & 69.20\% & 77.94\% & \\\hline \multicolumn{4}{c}{}\\\cline{2-4} \multicolumn{1}{l|}{Flair-pre-trained} & Precision & Recall & $F1$ \\\hline LOC & 53.26\% & 77.71\% & 63.20\% \\ ORG & 74.57\% & 75.61\% & 75.09\% \\ PER & 71.76\% & 84.89\% & 77.78\% \\\hline Micro & 65.55\% & 77.92\% & 71.20\% \\\hline \multicolumn{4}{c}{}\\\cline{2-4} \multicolumn{1}{l|}{SpaCy-md} & Precision & Recall & $F1$ \\\hline LOC & 55.77\% & 78.00\% & 65.04\% \\ ORG & 72.72\% & 54.85\% & 62.53\% \\ PER & 53.09\% & 74.98\% & 62.16\% \\\hline Micro & 61.06\% & 65.93\% & 63.40\% \\\hline \multicolumn{4}{c}{}\\\cline{2-4} \multicolumn{1}{l|}{SpaCy-sm} & Precision & Recall & $F1$ \\\hline LOC & 54.92\% & 79.41\% & 64.93\% \\ ORG & 71.92\% & 53.23\% & 61.18\% \\ PER & 57.32\% & 79.19\% & 66.50\% \\\hline Micro & 61.25\% & 66.32\% & 63.68\% \\\hline \multicolumn{4}{c}{}\\\cline{2-4} \multicolumn{1}{l|}{Stanford NER} & Precision & Recall & $F1$ \\\hline LOC & 62.17\% & 69.05\% & 65.43\% \\ ORG & 15.82\% & 5.39\% & 8.04\% \\ PER & 55.31\% & 88.26\% & 68.00\% \\\hline Micro & 50.12\% & 40.69\% & 44.91\% \\\hline \end{tabular} \caption{Quality of NER from French text.\label{fig:ner-results-table}} \end{table} \end{comment} The evaluation results are shown in Table \ref{fig:ner-results-table}. All models perform better overall than the \textit{Stanford NER} model previously used in ConnectionLens~\cite{Chanial2018}, which has a micro $F1$-score of about 45\%. The \textit{SpaCy-sm} model has a slightly better overall performance than \textit{SpaCy-md}, with a small micro $F1$-score difference of $0.28\%$. \textit{SpaCy-md} shows higher $F1$-scores for locations and organizations, but is worse on people, driving down its overall quality. All Flair models surpass the micro scores of SpaCy models. In particular, for people and organizations, Flair models show more than $11\%$ higher $F1$-scores than SpaCy models. Flair models score better on all named-entity types, except for locations when comparing the SpaCy models, specifically, with the \textit{Flair-pre-trained}. \textit{Flair-SFTF} has an overall $F1$-score of $73.31\%$ and has better scores than the \textit{Flair-pre-trained} for all metrics and named-entity types, with the exception of the recall of organizations, lower by $1.06\%$. In conclusion, {\em Flair-SFTF} is the best NER model we evaluated. \subsection{Construction evaluation} \label{sec:evaluation:construction} We present results of our experiments measuring the performance and the quality of the modules involved in graph construction. We study graph construction performance in Section~\ref{sec:exp-construction}, the quality of our information extraction in Section~\ref{sec:exp-ner}, and that of disambiguation in Section~\ref{sec:exp-disambiguation}. \input{construction/exp-construction} \input{construction/exp-ner} \input{construction/exp-disambiguation} \subsection{Software, hardware, and datasets} \label{sec:evaluation:setup} ConnectionLens is a \textbf{Java application} (44.700 lines) which relies on a relational database to store the constructed graphs and as a back-end used by the query algorithm. It features controllable-size caches to keep in memory as many nodes and edges as possible; this allows adapting to different memory sizes. It also comprises \textbf{Python} code (6.300 lines) which implements entity extraction (Section~\ref{sec:entity-extraction}) and content extraction from PDF documents to JSON (see~\cite{construction-paper}), tasks for which the most suitable libraries are in Python. The Flair extractor (Section~\ref{sec:entity-extraction}) and the disambiguator (Section~\ref{sec:disambig}) are Web services which ConnectionLens calls. The former is deployed on the machine where ConnectionLens runs. We deployed the latter on a dedicated Inria server, adapting the original Ambiverse code to our new pipeline introduced in Section~\ref{sec:disambig}; the disambiguator consists of $842$ Java classes. For our experiments, we used a \textbf{regular server} from 2016, equipped with 2x10-core Intel Xeon E5-2640 (Broadwell) CPUs clocked at 2.40GHz, and 128GB DRAM, which uses PostgreSQL 12.4 to store the graph content in a set of tables. This is a medium-capacity machine, without special capabilities; recall our requirement \textbf{R3} that our algorithms be feasible on off-the-shelf hardware. We also used a \textbf{GPU server} from 2020, with a 2x16-core Intel Xeon Gold 5218 (Skylake) CPUs clocked at 2.30GHz, an NVIDIA Tesla V100 GPU and 128GB DRAM. To show the applicability of our software to standard hardware configurations, we focus on the results that we obtained with our regular server. However, we also include some results on the more advanced server to show that our platform adapts seamlessly to modern as well as heterogeneous hardware, which includes both CPUs and GPUs. When needed to separate them, we will refer to each server with its CPU generation name. \noindent\textbf{Data sources} Most of our evaluation is on {\em real-world} datasets, described below from the smallest to the largest (measuring their size on disk before being input to ConnectionLens). \noindent\textbf{1.} We crawled the French online newspaper Mediapart and obtained 256 articles for the search keywords ``{\em corona, chloroquine, covid}'' (256 documents), and 886 for ``economie, chomage, crise, budget'' (1142 documents and \textbf{18.4 MB} overall). \noindent\textbf{2.} An \textbf{XML document}\footnote{https://www.hatvp.fr/livraison/merge/declarations.xml} comprising business interest statements of French public figures, provided by HATVP ({\em Haute Autorit\'{e} pour la Transparence de la Vie Publique}); the file occupies \textbf{35 MB}. \noindent\textbf{3.} A subset of the \textbf{YAGO 4}~\cite{yago4} RDF knowledge base, comprising entities present in the French Wikipedia and their properties; this takes \textbf{2.49 GB} on disk (17.36 M triples). For a fine-granularity, controlled study of our query algorithm, we also devised a set of {\em small synthetic graphs}, described in Section~\ref{sec:evaluation:query}. \section{Experimental evaluation} \label{sec:evaluation} The algorithms described above are implemented in the \textbf{ConnectionLens} prototype, available \href{https://gitlab.inria.fr/cedar/connectionlens}{online}. Below, we report the results of an experimental evaluation we carried out to study the performance of its algorithms, as well as quality aspects of the constructed graphs. Section~\ref{sec:evaluation:setup} describes the software and hardware setup, and our datasets. Section~\ref{sec:evaluation:construction} focuses on graph construction, while Section~\ref{sec:evaluation:query} targets keyword query answering. \input{eval-setup} \input{construction/experiments} \input{query/evaluation} \section{#1}\vspace{-0.5mm}} \newcommand\mysubsection[1]{\vspace{-1mm}\subsection{#1}\vspace{-0.5mm}} \newcommand\va{\vspace{-0mm}} \newcommand\grow{\textsc{Grow}} \newcommand\mergecur{\textsc{Merge}} \newcommand\growac{\textsc{GrowAcross}} \newcommand{\extVersion}{false} \newcommand{\printIfExtVersion}[2] { \ifthenelse{\equal{\extVersion}{true}}{#1}{} \ifthenelse{\equal{\extVersion}{false}}{#2}{} } \section{Answering keyword queries} \label{sec:algo} We now present our approach for computing query answers, on the graph which integrates the heterogeneous datasets. \subsection{\grow\ and \mergecur} \label{sec:algorithm} Our algorithm relies on concepts from prior literature~\cite{dpbf,blinks} while exploring many more trees. Specifically, it starts from the sets of nodes $N_1,\ldots,N_m$ where the nodes in $N_i$ all match the query keyword $w_i$; each node $n_{i,j}\in N_i$ forms a one-node partial tree. For instance, in Figure~\ref{fig:example-graph}, one-node trees are built from the nodes with boldface text, labeled ``Africa'', ``Real Estate'' and ``I. Balkany''. We identify two transformations that can be applied to form increasingly larger trees, working toward query answers: \noindent\textbf{\grow($t,e$)}, where $t$ is a tree, $e$ is an edge \emph{adjacent to the root} of $t$, and $e$ does not close a loop with a node in $t$, creates a new tree $t'$ having all the edges of $t$ plus $e$; the root of the new tree is the other end of the edge $e$. For instance, starting from the node labeled ``Africa'', a \grow\ can add the edge labeled {\small \texttt{dbo:name}}. \noindent\textbf{\mergecur($t_1,t_2$)}, where $t_1,t_2$ are trees with the same root, whose other nodes are disjoint, and matching disjoint sets of keywords, creates a tree $t''$ with the same root and with all edges from $t_1$ and $t_2$. Intuitively, \grow\ moves away from the keywords, to explore the graph; \mergecur\ fuses two trees into one that matches more keywords than both $t_1$ and $t_2$. In a {\em single-dataset} context, \grow\ and \mergecur\ have the following properties. ($gm_1$)~\grow\ alone is \textbf{complete} (guaranteed to find all answers) for $k=1,2$ only; for higher $k$, \grow\ and \mergecur\, together are complete. ($gm_2$)~Using \mergecur\ steps helps to find answers faster than using just \grow~\cite{blinks}: partial trees, each starting from a leaf that matches a keyword, are merged into an answer as soon as they have reached the same root. ($gm_3$)~An answer can be found through \textbf{multiple combinations of \grow\ and \mergecur}. For instance, consider a linear graph $n_1\rightarrow n_2 \rightarrow \ldots n_p$ and the two-keyword query $\{a_1, a_p\}$ where $a_i$ matches the label of $n_i$. The answer is obviously the full graph. It can be found: starting from $n_1$ and applying $p-1$ \grow\ steps; starting from $n_p$ and applying $p-1$ \grow\ steps; and in $p-2$ ways of the form \mergecur(\grow(\grow\ldots), \grow(\grow\ldots)), each merging in an intermediary node $n_2,\ldots,n_{p-1}$. These are all the same according to our definition of an answer (Section~\ref{sec:search-problem}), which does not distinguish a root in an answer tree; this follows users' need to know how things are connected, and for which the tree root is irrelevant. \subsection{Adapting to multi-datasets graphs} The changes we brought for our harder problem (bidirectional edges and multiple interconnected datasets) are as follows. \noindent\textbf{1. Bidirectional growth.} We allow \grow\ to traverse an edge both going from the source to the target, and going from the target to the source. \noindent\textbf{2. Many-dataset answers.} As defined in a single-dataset scenario, \grow\ and \mergecur\ do not allow to connect multiple datasets. To make that possible, we need to enable one, another, or both to also traverse similarity and equivalence edges (shown in solid or dotted red lines in Figure~\ref{fig:example-graph}). We decide to simply extend \grow\ to allow it to traverse not just data edges, but also {\em similarity} edges between nodes of the same or different datasets. We handle {\em equivalence} edges as follows: \newcommand{\textsc{Grow2Rep}}{\textsc{Grow2Rep}} \noindent\textbf{\grow-to-representative} Let $t$ be a partial tree developed during the search, rooted in a node $n$, such that the representative of $n$ is a node $n_{rep}\neq n$. \textsc{Grow2Rep}\ creates a new tree by adding to $t$ the edge $n\xrightarrow{\equiv}n_{rep}$; this new tree is rooted in $n_{rep}$. If $n$ is part of a group of $p$ equivalent nodes, only {\em one} \textsc{Grow2Rep}\ step is possible from $t$, to the unique representative of $n$; \textsc{Grow2Rep}\ does not apply again on \textsc{Grow2Rep}($t$), because the root of this tree is $n_{rep}$, which is its own representative. Together, \grow, \textsc{Grow2Rep}\ and \mergecur\ enable finding answers that span multiple data sources, as follows: \grow\ allows exploring data edges within a dataset, and similarity edges within or across datasets. \textsc{Grow2Rep}\ goes from a node to its representative when they differ; the representative may be in a different dataset. \mergecur\ merges trees with a same root: when that root represents $p$ equivalent nodes, this allows connecting partial trees, including \textsc{Grow2Rep}\ results, containing nodes from different datasets. Thus, \mergecur\ can build trees spanning multiple datasets. One potential performance problem remains. Consider again $p$ equivalent nodes $n_1,\ldots,n_p$; assume without loss of generality that their representative is $n_1$. Assume that during the search, a tree $t_i$ is created rooted in each of these $p$ nodes. \textsc{Grow2Rep}\ applies to all but the first of these trees, creating the trees $t_2', t_3', \ldots, t_p'$, all rooted in $n_1$. Now, \mergecur\ can merge any pair of them, and can then repeatedly apply to merge three, then four such trees etc., as they all have the same root $n_1$. The exponential explosion of \grow\ trees, avoided by introducing \textsc{Grow2Rep}, is still present due to \mergecur. We solve this problem as follows. Observe that in an answer, a {\em path of two or more equivalence edges} of the form $n_1\xrightarrow{\equiv}n_2\xrightarrow{\equiv}n_3$ such that {\em a node internal to the path}, e.g. $n_2$, {\em has no other adjacent edge}, even if allowed by our definition, is \emph{redundant}. Intuitively, such a node brings nothing to the answer, since its neighbors, e.g., $n_1$ and $n_3$, could have been connected directly by a single equivalence edge, thanks to the transitivity of equivalence. We call {\em non-redundant} an answer that does not feature any such path, and decide to \textbf{search for non-redundant answers} only. The following properties hold on non-redundant answers: \begin{property} There exists a graph $G$ and a $k$-keyword query $Q$ such that a non-redundant answer contains $k-1$ adjacent equivalence edges (edges that, together, form a single connected subtree). \end{property} \begin{wrapfigure}{L}{0.6\textwidth} \vspace{-5mm} \centering \includegraphics[width=.58\textwidth]{images/rep-trees.png} \vspace{-2mm} \caption{Sample graph and answer trees.\label{fig:prop-example}} \vspace{-5mm} \end{wrapfigure} We prove this by exhibiting such an instance. Let $G$ be a graph of $2k$ nodes shown in Figure~\ref{fig:prop-example} (a), such that all the $x_i$ are equivalent, and consider the $k$-keyword query $Q=\{a_1,\ldots,a_k\}$ (each keyword matches exactly the respective $a_i$ node). An answer needs to traverse all the $k$ edges from $a_i$ to $x_i$, and then connect the nodes $x_i,\ldots,x_k$; we need $k-1$ equivalence edges for this. Next, we show: \begin{property}\label{prop:2} Let $t$ be a non-redundant answer to a query $Q$ of $k$ keywords. A group of adjacent equivalence edges contained in $t$ has at most $k-1$ edges. \end{property} We prove this by induction over $k$. For $k=1$, each answer has $1$ node and $0$ edge (trivial case). Now, consider this true for $k$ and let us prove it for $k+1$. Assume by contradiction that a non-redundant answer $t_Q$ to a query $Q$ of $k+1$ keywords comprises $k+1$ adjacent equivalence edges. Let $Q'$ be the query having only the first $k$ keywords of $Q$, and $t'$ be a subtree of $t$ that is a non-redundant answer to $Q'$: \begin{itemize} \item $t'$ exists, because $t$ connects all $Q$ keywords, thus also the $Q'$ keywords; \item $t'$ is non-redundant, because all its edges are in the (non-redundant) $t$. \end{itemize} By the induction hypothesis, $t'$ has at most $k-1$ adjacent equivalence edges. This means that there are {\em two adjacent equivalent edges} in $t\setminus t'$. \begin{enumerate} \item If these edges, together, lead to two distinct leaves of $t$, then $t$ has {\em two} leaves not in $t'$. This is not possible, because by definition of an answer, $t$ has $k+1$ leaves (each matching a keyword) and similarly $t'$ has $k$ leaves. \item It follows, then, that the two edges lead to a single leaf of $t$, therefore the edges form a redundant path. This contradicts the non-redundancy of $t$, and concludes our proof. \end{enumerate} Property~\ref{prop:2} gives us an important way to control the exponential development of trees due to $p$ equivalent nodes. \grow, \textsc{Grow2Rep}\ and \mergecur, together, can generate trees with up to $k$ (instead of $k-1$) adjacent equivalence edges. This happens because \textsc{Grow2Rep}\ may ``force'' the search to visit the representative of a set of $k$ equivalent nodes (see Figure~\ref{fig:prop-example}(b), assuming $x_1$ is the representative of all the equivalent $x_i$s, and the query $\{a_2,\ldots,a_k\}$). The resulting answer may be redundant, if the representative has no other adjacent edges in the answer other than equivalence edges. In such cases, in a \textbf{post-processing step}, we remove from the answer the representative and its equivalence edges, then reconnect the respective equivalent nodes using $k-1$ equivalence edges. This guarantees obtaining a non-redundant tree, such as the one in Figure~\ref{fig:prop-example}(c). \subsection{The GAM algorithm} \begin{figure*}[t!] \fbox{ \begin{minipage}{\textwidth} Procedure \textbf{process}(tree $t$) \begin{itemize}[noitemsep,nolistsep] \item if $t$ is not already in $E$ \item then \begin{itemize}[noitemsep,nolistsep] \item add $t$ to $E$ \item if $t$ has matches for all the query keywords \item then post-process $t$ if needed; output the result as an answer \item else insert $t$ into $K$ \end{itemize} \end{itemize} Algorithm \textbf{GAMSearch}(query $Q=\{w_1,w_2,\ldots, w_k\}$) \begin{enumerate}[noitemsep,nolistsep] \item For each $w_i$, $1\leq i \leq k$ \begin{itemize}[noitemsep,nolistsep] \item For each node $n_i^j$ matching $w_i$, let $t_i^j$ be the 1-node tree consisting of $n_i^j$; process($t_i^j$) \label{item:1node} \end{itemize} \item Initial \textsc{merge}$^*$: try to merge every pair of trees from $E$, and process any resulting answer tree. \item Initialize $U$ (empty so far): \label{item:init-Q} \begin{enumerate}[noitemsep,nolistsep] \item Create \grow\ opportunities: Insert into $U$ the pair $(t,e)$, for each $t\in E$ and $e$ a data or similarity edge adjacent to $t$'s root. \item Create \textsc{Grow2Rep}\ opportunities: Insert into $U$ the pair $(t, n\rightarrow n_{rep})$ for each $t\in E$ whose root is $n$, such that the representative of $n$ is $n_{rep}\neq n$. \end{enumerate} \item While ($U$ is not empty) \begin{enumerate}[noitemsep] \item Pop out of $U$ the highest-priority pair $(t,e)$. \item Apply the corresponding \grow\ or \textsc{Grow2Rep}, resulting in a new tree $t''$; process($t''$). \item If $t''$ was not already in $E$, agressively \mergecur: \begin{enumerate}[noitemsep,nolistsep] \item Let $NT$ be a set of new trees obtained from the \mergecur\ (initially $\emptyset$). \item Let $\mathbf{p_1}$ be the keyword set of $t''$ \item For each keyword subset $\mathbf{p_2}$ that is a key within $K$, and such that $\mathbf{p_1}\,\cap\, \mathbf{p_2} =\emptyset$ \begin{enumerate}[noitemsep,nolistsep] \item For each tree $t^i$ that corresponds to $\mathbf{p_2}$, try to merge $t''$ with $t^i$. Process any possible result; if it is new (not in $E$ previously), add it to $NT$. \label{item:merge-candidates} \end{enumerate} \end{enumerate} \item Re-plenish $U$ (add more entries in it) as in step~\ref{item:init-Q}, based on the trees $\{t''\} \, \cup \, NT$. \label{item:replenish-Q} \end{enumerate} \end{enumerate} \end{minipage}} \caption{Outline of GAM algorithm\label{fig:algo}} \end{figure*} We now have the basic exploration steps we need: \grow, \textsc{Grow2Rep}\ and \mergecur. In this section, we explain how we use them in our integrated keyword search algorithm. We decide to apply in sequence: one \grow\ or \textsc{Grow2Rep}\ (see below), leading to a new tree $t$, immediately followed by all the \mergecur\ operations possible on $t$. Thus, we call our algorithm \textbf{Grow and Aggressive Merge} (GAM, in short). We merge aggressively in order to detect as quickly as possible when some of our trees, merged at the root, form an answer. Given that every node of a currently explored answer tree can be connected with several edges, we need to decide which \grow\ (or \textsc{Grow2Rep}) to apply at a certain point. For that, we use a \textbf{priority queue} $U$ in which we add (tree, edge) entries: for \grow, with the notation above, we add the $(t, e)$ pair, while for \textsc{Grow2Rep}, we add $t$ together with the equivalence edge leading to the representative of $t$'s root. In both cases, when a $(t, e)$ pair is extracted from $U$, we just extend $t$ with the edge $e$ (adjacent to its root), leading to a new tree $t_G$, whose root is the other end of the edge $e$. Then we aggressively merge $t_G$ with all compatible trees explored so far, finally we read from the graph the (data, similarity or equivalence) edges adjacent to $t_G$'s root and add to $U$ more (tree, edge) pairs to be considered further during the search. The algorithm then picks the highest-priority pair in $U$ and reiterates; it stops when $U$ is empty, at a timeout, or when a maximum number of answers are found (whichever comes first). The last parameter impacting the exploration order is the priority used in $U$: at any point, $U$ gives the highest-priority $(t, e)$ pair, which determines the operations performed next. \begin{enumerate} \item Trees matching \emph{many query keywords} are preferable, to go toward complete query answers; \item At the same number of matched keywords, \emph{smaller trees} are preferable in order not to miss small answers; \item Finally, among $(t_1,e_1)$, $(t_2,e_2)$ with the same number of nodes and matched keywords, we prefer the pair with the \emph{higher specificity edge}. \end{enumerate} \noindent\textbf{Algorithm details} Beyond the priority queue $U$ described above, the algorithm also uses a {\em memory of all the trees explored}, called $E$. It also organizes all the (non-answer) trees into a map $K$ in which they can be accessed by the subset of query keywords that they match. The algorithm is shown in pseudocode in Figure~\ref{fig:algo}, following the notations introduced in the above discussion. While not shown in Figure~\ref{fig:algo} to avoid clutter, the algorithm {\em only develops minimal trees} (thus, it only finds minimal answers). This is guaranteed: \begin{itemize} \item When creating \grow\ and \textsc{Grow2Rep}\ opportunities (steps \ref{item:init-Q} and \ref{item:replenish-Q}): we check not only that the newly added does not close a cycle, but also that the matches present in the new tree satisfy our minimality condition (Section~\ref{sec:search-problem}). \item Similarly, when selecting potential \mergecur\ candidates (step \ref{item:merge-candidates}). \end{itemize} \subsection{Answering keyword queries} \label{sec:evaluation:query} This section presents the results that we obtained by using synthetic and real-world datasets. In each case, we first describe the datasets, and then we present and explain our findings. We bound the query execution time to 120 seconds, after which the algorithm stops searching for matches. \subsubsection{Queries on synthetic datasets} We first study the performance of our algorithm on different types of synthetic datasets. The first type is the \emph{line graph}, where every node is connected with two others, having one edge for each node, except two nodes which are connected with only one. We use the line graph to clearly show the performance of \grow~and \mergecur~operations with respect to the graph size. The second type is the \emph{chain graph}, which is the same as the line, but it has two edges (instead of one) connecting every pair of nodes. We use the chain graph to show the performance of the algorithm as we double the amount of edges of the line graph and we give more options to \grow~and \mergecur. The third type is the \emph{star graph}, where we have several line graphs connected through a strongly connected cluster of nodes with a representative. We use this type to show the performance of \textsc{Grow2Rep}, by placing the query keywords on different line graphs. The fourth type is a random graph based on the \emph{Barabasi-Albert} (BA) model~\cite{Barabasi509}, which generates scale-free networks with only a few nodes (hubs) of the graph having much higher degree than the rest. The graph in this model is created in a two-staged process. During the first stage, a network of some nodes is created. Then, during the second stage, new nodes are inserted in the graph and they are connected to nodes created during the first stage. We set every node created at the second stage to be connected with exactly one node created at the first stage. In the following, The black line shows the time elapsed until the first answer is found, whereas the grey line shows the overall execution time. \begin{figure*}[t!] \centering \subfloat[Line graph\label{fig:eval/line}]{ \begin{minipage}{0.45\columnwidth} \includegraphics[width=\columnwidth]{images/updated/line.png} \end{minipage} } \quad \subfloat[Chain graph\label{fig:eval/chain}] { \begin{minipage}{0.45\columnwidth} \includegraphics[width=\columnwidth]{images/updated/chain.png} \end{minipage} } \vspace{-4mm} \subfloat[Star graph\label{fig:eval/star}] { \begin{minipage}{0.45\columnwidth} \includegraphics[width=\columnwidth]{images/updated/star.png} \end{minipage} } \quad \subfloat[Barabasi-Albert\label{fig:eval/ba}] { \begin{minipage}{0.45\columnwidth} \includegraphics[width=\columnwidth]{images/updated/ba.png} \end{minipage} } \vspace{-4mm} \caption{Query execution time on different synthetic graph types.} \label{fig:eval/synthetic} \vspace{-6mm} \end{figure*} Figure~\ref{fig:eval/synthetic} includes the results that we obtained by querying the synthetic datasets. The black line shows the time elapsed until the first answer is found, whereas the grey line shows the overall execution time. Figure~\ref{fig:eval/line} shows the execution time of our algorithm when executing a query with two keywords on a line graph, as we vary the number of nodes of the graph. We place the keywords on the two ``ends'' of the graph to show the impact of the distance on the execution time. The performance of our algorithm is naturally affected by the size of the graph, as it generates $2\cdot N$ answer trees, where $N$ is the number of nodes. Given that this is a line graph, there is only one answer, which is the whole graph, and, therefore, the time to find the first answer is also the overall execution time. Figure~\ref{fig:eval/chain} shows the performance of our algorithm on a chain graph. The execution times for the first answer are almost the same, as the graph size increases slowly. Instead, the overall execution times increase at a much higher (exponential) rate; note the logarithmic scale of the $y$ axis. The reason is that every pair of nodes is connected with two edges, which increases the amount of answers exponentially with the amount of nodes in the graph. In Figure~\ref{fig:eval/star}, we report the execution time for the star graph. We place keywords in two different lines connected through the center of the graph, forcing the algorithm to use \textsc{Grow2Rep}, whereas in the previous cases it only had to use \grow~and \mergecur. The number of branches, depicted on the $x$ axis, corresponds to the number of line graphs connected in the star. Each line graph has 10 nodes and we place the query keywords at the extremities of two different line graphs. The number of merges is exponential to the number of branches, that is $\mathcal{O}(2^K)$ where $K$ is the number of branches, since the algorithm will check all possible answers. This behaviour is clearly shown in both lines of Figure~\ref{fig:eval/star}, where on the $y$ axis (in logarithmic scale) we show the times to find the first, and, respectively, all answers. Above 12 branches, the timeout of 120 seconds that we have set is hit and, thus, search is terminated, as shown when we search for all answers. Figure~\ref{fig:eval/ba} depicts the query performance with the Barabasi-Albert model. We fix the graph size to 2000 nodes and we vary the position of two keywords, by choosing nodes which have a distance, as given in the $x$ axis; note the logarithmic $y$ axis. As the graph is randomly generated within the BA model, we note some irregularity in the time to the first solution, which however grows at a moderate pace as the distance between the keyword node grows. The overall relation between the time to the first solution and the total time confirms that the search space is very large but that most of the exploration is not needed, since the first solution is found quite fast. \vspace{-1.5mm} \subsubsection{Queries on the complete, real-world graph} \vspace{-1mm} \begin{table*}[h!] \begin{adjustbox}{width=\textwidth} \centering \begin{tabular}{ |c|r|r|r| } \hline Query keyword(s) & Answers & Answer trees & Time to 1st (ms) \\ \hline\hline {\em a\'eronautique}, {\em Macron} & 2779 & 1152577 & 7225 \\ \hline Brigitte Macron, Clara Gaymard & 4584 & 545020 & 1412 \\ \hline {\em Chine}, {\em covid}, {\em France} & 17 & 25974 & 8380 \\ \hline {\em ch\^omage}, {\em covid} & 108 & 205584 & 4476 \\ \hline {\em covid}, El Khomri & 16 & 215952 & 52486 \\ \hline {\em confinement}, Christophe Castaner & 4 & 120367& 3820 \\ \hline Chine, France, Didier Raoult & 36 & 146261 & 14666 \\ \hline Ebola, Raoult & 1 & 37751 & 75759 \\ \hline {\em entreprise}, {\em Raffarin} & 6336 & 1174822 & 6589 \\ \hline Julien Denormandie, Macron & 464 & 20181 & 2661 \\ \hline Khalid al-Falih, Kristalina Georgieva & 1 & 1775 & 765 \\ \hline Kristalina Georgieva, Walter Butler & 1 & 3224 & 353 \\ \hline Louis Beam, Ku Klux Klan, Trump & 1 & 24172 & 15207 \\ \hline {\em Macron}, {\em Royal} & 102 & 6413 & 4107 \\ \hline Marisol Touraine, Jean-Fran\c{c}ois Delfraissy & 3 & 1497 & 1183 \\ \hline {\em masque}, {\em France} & 35 & 15082 & 7126 \\ \hline Michael Ryan, Anthony Fauci & 2 & 6653 & 12215 \\ \hline Pascale Gruny, Jean-Fran\c{c}ois Delfraissy & 2 & 1332 & 91591 \\ \hline {\em vaccination}, {\em Trump} & 12 & 1188 & 6518 \\ \hline Yazdan Yazdanpanah, Jean-Fran\c{c}ois Delfraissy & 29 & 5446 & 1687 \\ \hline \end{tabular} \end{adjustbox}\vspace{-1.5mm} \caption{Query results on the complete graph.} \label{tbl:eval/realworld} \vspace{-5mm} \end{table*} Next, we describe results that we obtained querying a graph obtained by loading all the real-world data sources decribed in Section~\ref{sec:evaluation:setup}. We report our findings in Table~\ref{tbl:eval/realworld}. The queries feature terms that appear in recent French news; they are related to the economy, the Covid crisis, world events, and/or French politics. In most queries, keywords are exact entity names, with their most common spelling. In other cases, we allowed node labels to {\em approximately} match a keyword (based on PostgreSQL' stemming and string pattern matching); such keywords are shown in italic in the table. Again, we gave a timeout of 2 minutes, and on this large graph, all the GAM searches stopped at a time-out. The table shows that queries return varied number of answers, but many ATs are developed in all cases, and the first is found quite before the timeout. Finally, an inspection of the results showed that most are obtained from different datasets, confirming the interest of linking datasets in ConnectionLens. These results show the feasibility and interest of GAMSearch on large heterogeneous graphs. \section{Querying the graph} \label{sec:pb-statement} We formalize the keyword search problem over a graph built out of heterogeneous datasets as previously described. \subsection{Search problem} \label{sec:search-problem} We consider a graph $G=(N, E)$ and we denote by $\mathcal{L}$ the set of all the labels of $G$ nodes, plus the empty label $\epsilon$ (see Figure~\ref{fig:example-graph}). Let $W$ be the set of {\em keywords}, obtained by stemming the label set $\mathcal{L}$; a {\em search query} is a set of keywords $Q=\{w_1,...,w_m\}$, where $w_i\in W$. We define an \textbf{answer tree} (AT, in short) as a set $t$ of $G$ edges which ($i$)~together, form a tree (each node is reachable from any other through exactly one path), ($ii$)~for each $w_i$, contain at least one node whose label matches $w_i$. Here, the edges are \textbf{considered undirected}, that is: $n_1\xrightarrow{a}n_2\xleftarrow{b}n_3\xrightarrow{c}n_4$ is a sample AT, such that for all $w_i \in Q$, there is a node $n_i\in t$ such that $w_i \in \lambda(n_i)$. We treat the edges of $G$ as undirected when defining the AT in order to allow more query results, on a graph built out of heterogeneous content whose structure is not well-known to users. Further, we are interested in \textbf{minimal} answer trees, that is: (i) removing an edge from the tree should make it lack one or more of the query keywords $w_i$; (ii) if a query keyword $w_i$ matches the label of more than one node in the answer tree, then all these matching nodes must be equivalent. Condition~(ii) is specific to the graph we consider, built from {\em several data sources connected by equivalence or similarity edges}. In classical graph keyword search problems, each query keyword is matched {\em exactly once} in an answer (otherwise, the tree is considered non-minimal). In contrast, our answer trees \emph{may need to traverse equivalence edges}, and if $w_i$ is matched by one node connected by such an edge, it is also matched by the other. For instance, consider the three-keyword query ``Gyucy Balkany Levallois'' in Figure~\ref{fig:example-graph}: the keyword Balkany is matched by the two nodes labeled ``P. Balkany'' which are part of the answer. As a counter-example, consider the query ``Balkany Centrafrique'' in Figure~\ref{fig:example-graph}, assuming the keyword Centrafrique is also matched in the label ``Central African Republic''\footnote{This may be the case using a more advanced indexing system that includes some natural language understanding, term dictionaries etc.}. Consider the tree that connects a ``P. Balkany'' node with ``Centrafrique'', and also traverses the edge between ``Centrafrique'' and ``Central African Republic'': this tree is not minimal, thus it is not an answer. The intuition for rejecting it is that ``Centrafrique'' and ``Central African Republic'' are not necessarily equivalent (we have a similarity, not an equivalence edge), therefore the query keyword ``Centrafrique'' is matched by two potentially different things in this answer, making it hard to interpret. A direct consequence of minimality is that {\em in an answer, each and every leaf matches a query keyword}. A graph may hold several minimal answer trees for a given query. We consider available a {\em scoring function} which assigns a higher value to more interesting answer trees (see Section~\ref{sec:score}). \textbf{Problem Statement.} Given the graph $G$ built out of the datasets $\mathcal{D}$ and a query $Q$, return the $k$ highest-score minimal answer trees.~\qed An AT may potentially span over the whole graph, (also) because it can traverse $G$ edges in any direction; this makes the problem challenging. \subsection{Search space and complexity} \label{sec:steiner} \newcommand\pbma{$\diamond$} \newcommand\pbmb{$\rhd$} \newcommand\pbmc{$\lhd$} \newcommand\pbmd{$\circ$} \newcommand\pbme{$\Box$} The problem that we study is related to the (Group) Steiner Tree Problem, which we recall below. Given a graph $G$ with weights (costs) on edges, and a set of $m$ nodes $n_1,\ldots,n_m$, the \emph{Steiner Tree Problem (STP)} \cite{garey2011} consists of finding the smallest-cost tree in $G$ that connects all the nodes together. We could answer our queries by solving one STP problem for each combination of nodes matching the keywords $w_1,\ldots,w_m$. However, there are several obstacles left: (\pbma)~STP is a known NP-hard problem in the size of $G$, denoted $|G|$; (\pbmb)~as we consider that each edge can be taken in the direct or reverse direction, this amounts to ``doubling'' every edge in $G$. Thus, our search space is \textbf{$2^{|G|}$ larger than the one of the STP, or that considered in similar works}, discussed in Section~\ref{sec:related}. This is daunting even for small graphs of a few hundred edges; (\pbmc)~we need the $k$ smallest-cost trees, not just one; (\pbmd)~each keyword may match several nodes, not just one. The closely related {\em Group STP} (GSTP, in short) \cite{garey2011} is: given $m$ {\em sets of nodes} from $G$, find the minimum-cost subtree connecting one node from each of these sets. GSTP does not raise the problem (\pbmd), but still has all the others. In conclusion, the complexity of the problem we consider is extremely high. Therefore, solving it fully is unfeasible for large and/or high-connectivity graphs. Instead, our approach is: ($i$)~{\em Attempt to find all answers from the smallest} (fewest edges) {\em to the largest}. Enumerating small trees first is both a practical decision (we use them to build larger ones) and fits the intuition that we should not miss small answers that a human could have found manually. However, as we will explain, we still ``opportunistically'' build some trees before exhausting the enumeration of smaller ones, whenever this is likely to lead faster to answers. The strategy for choosing to move towards bigger instead of smaller tress leaves rooms for optimizations on the search order. ($ii$)~{\em Stop at a given time-out or when $m$ answers have been found}, for some $m\geq k$; ($iii$)~{\em Return the $k$ top-scoring answers} found. \section{Scoring answer trees} \label{sec:score} We now discuss how to evaluate the quality of an answer. Section~\ref{sec:generic-score} introduces the general notion of score on which we base our approach. Section~\ref{sec:specif} describes the metric that we attach to edges in order to instantiate this score, and Section~\ref{sec:concrete-score} details the actual score function we used. \subsection{Generic score function} \label{sec:generic-score} We have configured our problem setting to allow {\em any scoring function}, which enables the use of different scoring schemes fitting the requirements of different users. As a consequence, this approach allows us to study the interaction of the scoring function with different properties of the graph. Given an answer tree $t$ to a query $Q$, we consider a score function consisting of (at least) the following two components. First, the {\em matching score} $ms(t)$, which reflects the quality of the answer tree, that is, how well its leaves match the query terms. Second, the {\em connection score} $cs(t)$, which reflects the quality of the tree connecting the edges. Any formula can be used here, considering the number of edges, the confidence or any other property attached to edges, or a query-independent property of the nodes, such as their PageRank or betweenness centrality score etc. The score of $t$ for $Q$, denoted $s(t)$, is computed as a combination of the two independent components $ms(t)$ and $cs(t)$. Popular combinations functions (a weighted sum, or product etc.) are monotonous in both components, however, our framework does not require monotonicity. Finally, both $ms(t)$ and $cs(t)$ can be tuned based on a given user's preferences, to personalize the score, or make them evolve in time through user feedback etc. \mysubsection{Edge specificity}\label{sec:specif} We now describe a metric on edges, which we used (through the connection score $cs(t)$) to favor edges that are ``rare'' for both nodes they connect. This metric was inspired by our experiments with real-world data sources, and it helped return interesting answer trees in our experience. For a given node $n$ and label $l$, let $\edgesin{n}{l}$ be the number of $l$-labeled edges entering $n$, and $\edgesout{n}{l}$ the number of $l$-labeled edges exiting $n$. \noindent The \textbf{specificity} of an edge $e=n_1\xrightarrow{l}n_2$ is defined as: \begin{center} \va\va $s(e)=2/(\edgesout{n_1}{l} + \edgesin{n_2}{l})$. \va\va \end{center} Specificity is $1.0$ for edges that are ``unique'' for both their source and their target, and decreases when the edge does not ``stand out'' among the edges of these two nodes. For instance, the city council of Levallois-Perret comprises only one mayor (and one individual cannot be mayor of two cities in France). Thus, the edge from the city council to P.~Balkany has a specificity of $2/(1.0+1.0)=1.0$. In contrast, there are 54 countries in Africa (we show only two), and each country is in exactly one continent; thus, the specificity of the {\sf dbo:partOf } edges in the DBPedia fragment, going from the node named Morocco (or the one named Central African Republic) to the node named Africa is $2/(1+54)\simeq .036$. \begin{comment} \textbf{Specificity computation.} When registering the first dataset $D_1$, computing the specificity of its edges is trivial. However, when registering subsequent datasets $D_2,D_3$ etc., if some node, say $n_2\in D_2$ is found to be equivalent to a node $n_1\in D_1$, {\em all} the $D_1$ edges adjacent to $n_1$ {\em and} the $D_2$ edges adjacent to $n_2$ should be reflected in the specificity of {\em each} of these edges. Thus, in particular, the specificity of $D_1$ edges needs to be {\em recomputed} when a node in a source added after $D_1$ is equivalent to one of its nodes. A {\em na\"ive approach} would be: when the edges of $D_2$ are traversed (when we add this dataset to the graph), re-traverse the edges of $n_1$ in $D_1$ in order to (re)compute their specificity. However, that would be quite inefficient. Instead, below, we describe an {\em efficient incremental algorithm} to compute specificity. We introduce two notations. For any edge $e$, we denote $N^e_{\rightarrow \bullet}$, respectively $N^e_{\circ \rightarrow}$, the two numbers out of which the specificity of $e$ has been {\em most recently} computed\footnote{This can be either during the first specificity computation of $e$, or during a recomputation, as discussed below.}. Specifically, $N^e_{\rightarrow \bullet}$ counts $l$-labeled edges incoming to the target of $e$, while $N^e_{\circ \rightarrow}$ counts $l$-labeled edges outgoing the source of $e$. In Figure~\ref{fig:edge-recomp}, if $e$ is the edge $x \xrightarrow{l}n_1$, then $N^e_{\rightarrow \bullet}=3$ (blue edges) and $N^e_{\circ \rightarrow}=1$, thus $s(e)=2/4=.5$. \begin{figure}[t!] \begin{center} \input{images/edge-specif-tikz} \caption{Illustration for specificity (re)computation. The specificity of the edge $x \xrightarrow{l}n_1$, $s(e)$ is initially computed out of the blue edges; when $n_2$ joins the equivalence set $es_1$, it is recomputed to also reflect the violet edges. \label{fig:edge-recomp}} \end{center} \vspace{-7mm} \end{figure} Let $n_1\in D_1$ be a node, $es_1$ be the set of all nodes equivalent to $n_1$, and $n_2\in D_2$ be a node in a dataset we currently register, and which has just been found to be equivalent to $n_1$, also. Further, let $l$ be a label of an edge incoming or outgoing (any) node from $es_1$, and/or $n_2$. We denote by $\edgesin{es_1}{l}$ the sum $\sum_{n\in es_1}(\edgesin{n}{l})$ and similarly by $\edgesout{es_1}{l}$ the sum $\sum_{n\in es_1}(\edgesout{n}{l})$; they are the numbers of $l$-labeled outgoing (resp., incoming) $l$-labeled edges of any node in $es_1$. When $n_2$ joins the equivalence set $es_1$ of $n_1$ (see Figure~\ref{fig:edge-recomp}): \va\va \begin{enumerate} \item \label{item:incremental-1} If $\edgesin{es_1}{l}\neq 0$ and $\edgesin{n_2}{l}\neq 0$, the specificity of every $l$-labeled edge $e$ {\em incoming} either a node in $es_1$ or the node $n_2$ must be recomputed.\\ Let $e$ be such an {\em incoming} edge labeled $l$. When $n_2$ is added to the set $es_1$, the specificity of $e$ becomes $2/((N^e_{\rightarrow \bullet} + \edgesin{n_2}{l}) + N^e_{\circ \rightarrow})$, to reflect that $n_2$ brings more incoming $l$-labeled edges. This amounts to $2/(3+2+1)=.33$ in Figure~\ref{fig:edge-recomp}: the violet edges have joined the blue ones. Following this adjustment, the numbers out of which $e$'s specificity has been most recently computed are modified as follows: $N^e_{\rightarrow \bullet}$ becomes $N^e_{\rightarrow \bullet} + \edgesin{n_2}{l}$, thus $3+2=5$ in Figure~\ref{fig:edge-recomp}; $N^e_{\circ \rightarrow}$ remains unchanged. \va \item \label{item:incremental-2} If $\edgesin{es_1}{l}=0$ and $\edgesin{n_2}{l}\neq 0$, the specificity of every $l$-labeled edge $e$ {\em incoming} $n_2$ does not change when $n_2$ joins the equivalence set $es_1$. \item \label{item:incremental-3} If $\edgesin{es_1}{l}\neq 0$ and $\edgesin{n_2}{l}=0$, the newly added node $n_2$ does not change the edges adjacent to the nodes of $es_1$, nor their specificity values. \printIfExtVersion{ \noindent\textbf{4. } Similarly to \textbf{1.} above, if $\edgesout{es_1}{l}\neq 0$ and $\edgesout{n_2}{l}\neq 0$, the specificity of every $l$-labeled edge $e$ {\em outgoing} either a node in $es_1$ or the node $n_2$ is recomputed, and it becomes $2/(N^e_{\rightarrow \bullet} + (N^e_{\circ \rightarrow}+\edgesout{n_2}{l}))$. The numbers out of which $e$'s specificity has been most recently computed become: $N^e_{\rightarrow \bullet}$ and $(N^e_{\circ \rightarrow}+\edgesout{n_2}{l})$. \noindent\textbf{5. } Finally, if $\edgesout{es_1}{l}=0$ and $\edgesout{n_2}{l}\neq 0$, the reasoning is similar to the one in \textbf{2. } above, while if $\edgesout{es_1}{l}\neq 0$ and $\edgesout{n_2}{l}=0$, it is similar to \textbf{3.}; in both cases, we consider outgoing (instead of incoming) edges and edge count numbers. }{ \end{enumerate} \va The last two cases, when $\edgesout{es_1}{l}\neq 0$ and $\edgesout{n_2}{l}\neq 0$, respectively, $\edgesout{es_1}{l}=0$ and $\edgesout{n_2}{l}\neq 0$, are handled in a similar manner. } The above method only needs, for a given node $n_2$ newly added to the graph, and label $l$, the number of edges adjacent to $n_2$ in its dataset, and the \emph{number} of $l$ edges adjacent to a node equivalent to $n_2$. Unlike the na\"ive specificity computation method, it does not need to actually {\em traverse} these edges previously registered edges, making it more efficient. Concretely, for each edge $e\in E$, we store three attributes: $N^e_{\rightarrow \bullet}$, $N^e_{\circ \rightarrow}$ and $s$, the last-computed specificity, and we update $N^e_{\rightarrow \bullet}$, $N^e_{\circ \rightarrow}$ as explained above. \end{comment} \begin{comment} \textbf{Where is specificity information stored} We store a {\it specificity (\underline{representative, edgelabel}, nIn, nOut)} table. As the specificities are computed jointly for all the edges adjacent to a set of equivalent nodes, this information is stored per representative of an equivalence class. {\it edgeLabel} is the label of some edge(s) adjacent to this equivalence class; {\it nIn} and {\it nOut} are the numbers out of which specificity has been most recently computed. As an extra optimization, we only store a tuple in this table if $nIn>1$ or $nOut>1$. Thus, for tree or tree-like datasets, there are much fewer tuples in the specificity table than there are in the edges table. \end{comment} \subsection{Concrete score function} \label{sec:concrete-score} We have implemented the following prototype scoring function in our system. For an answer $t$ to the query $Q$, we compute the matching score $ms(t)$ as the \emph{average}, over all query keywords $w_i$, of the similarity between the $t$ node matching $w_i$ and the keyword $w_i$ itself; we used the edit distance. We compute the connection score $cs(t)$ based on edge confidence, on one hand, and edge specificity on the other. We {\em multiply} the confidence values, since we consider that uncertainty (confidence $<1$) multiplies; and we also {\em multiply} the specificities of all edges in $t$, to discourage many low-specificity edges. Specifically, our score is computed as: \begin{center} $score(t,Q)=\alpha \cdot ms(t,Q) + \beta \cdot \prod_{e\in E} c(e) + (1 - \alpha - \beta) \cdot \prod_{e\in E} s(e)$ \end{center} \noindent where $\alpha$, $\beta$ are parameters of the system such that $0\leq \alpha, \beta <1$ and $\alpha +\beta\leq 1$. \begin{comment} \subsection{Orthogonality between the score and the algorithm} Before we describe the search algorithm, we make a few more remarks on the connection between the score function and the search algorithm. We start by considering the classical Steiner Tree and Group Steiner Tree Problems (Section~\ref{sec:steiner}). These assume that the tree cost is \textbf{monotonous}, that is: for any query $Q$ and all trees $T, \hat{T}$ where $T$ is a subtree of $\hat{T}$ it follows that the cost of $T$ is higher (in our terminology, its score is lower) than the cost of $\hat{T}$. This is naturally satisfied if the cost is the addition of edge weights. In contrast, the score, in its general form (Section~\ref{sec:generic-score}), and in particular our concrete one (Section~\ref{sec:concrete-score}), is \textbf{not monotonous}, as illustrated in Figure~\ref{fig:nonmono}, where on each edge, $c$ is the confidence and $s$ is the specificity. Denoting $T$ the four-edge tree rooted in $n_1$, the connection score $cs(T)=\beta + (1-\alpha-\beta)\cdot (.5)^4$, while $cs(T')=\beta \cdot .5 + (1-\alpha-\beta) (.5)^4 \cdot .25$. If we assume $\alpha=\beta=\frac{1}{3}$, then $cs(T)=\frac{1}{3}(1+(.5)^4)\simeq .35$ while $cs(T')=\frac{1}{3}\cdot (.5 + (.5)^5)\simeq .17$, which is clearly smaller. Assuming $T'$ has the same matching score as $T$, the global score of $T'$ is smaller than that of $T$, contradicting the monotonicity assumption. \begin{figure*}[t!] \begin{center} \tikzstyle{node} = [text centered, fill=white \tikzstyle{arrow} = [thick,->,>=stealth] \begin{tikzpicture}[node distance=34mm and 34mm \node (zero) {~}; \node (n1) [node, right of=zero, xshift=-14mm] {$n_1$}; \node (n2) [node, left of=n1, yshift=4mm] {$n_2$}; \node (n3) [node, left of=n1, yshift=-4mm] {$n_3$}; \node (n4) [node, right of=n1, yshift=4mm] {$n_4$}; \node (n5) [node, right of=n1, yshift=-4mm] {$n_5$}; \draw [arrow] (n1) -> (n2) node [midway, fill=white] {$s=.5,c=1$}; \draw [arrow] (n1) -> (n3) node [midway, fill=white] {$s=.5,c=1$}; \draw [arrow] (n1) -> (n4) node [midway, fill=white] {$s=.5,c=1$}; \draw [arrow] (n1) -> (n5) node [midway, fill=white] {$s=.5,c=1$}; \node (n6) [node, right of=n4] {$n_6$}; \node (n7) [node, right of=n5] {$n_7$}; \draw [arrow, dashed] (n4) -> (n6) node [midway, fill=white] {$s=.25,c=.5$}; \draw [arrow, dashed] (n5) -> (n7) node [midway, fill=white] {$s=1,c=1$}; \end{tikzpicture} \caption{Example (non-monotonicity of the tree score). $T$ is the four-edges tree rooted in $n_1$.} \label{fig:nonmono} \end{center} \end{figure*} Another property sometimes assumed by score functions is the called \textbf{optimal substructure}, that is: the best solution for a problem of size $p$ is part of the best solution for a problem of size $p+1$ that is an extension of $p$, for some problem size $p$. When this holds, the problem can be efficiently solved in a dynamic programming fashion. However, STP does not enjoy this property: the smallest-cost tree connecting two nodes $n_1,n_2$ is not necessarily part of the smallest-cost tree that connects $n_1,n_2,n_3$ (and the same holds for GSTP). Some existing algorithms also assume a variant of the optimal substructure property (see Section~\ref{sec:related}). In contrast, our score function (both in its general and its concrete form) does not ensure such favorable properties. This is why the search algorithm we describe next has to find as many answers as possible, as quickly as possible. \end{comment}
{'timestamp': '2020-12-17T02:13:45', 'yymm': '2012', 'arxiv_id': '2012.08830', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08830'}
arxiv
\section{Acknowledgement} We would like to thank the anonymous reviewers for their helpful comments. The work was supported by NSF DBI-1565137, DGE-1829071, NIH R35-HL135772, NSF III-1705169, NSF CAREER Award 1741634, NSF \#1937599, DARPA HR00112090027, Okawa Foundation Grant, and Amazon Research Award. { \small \section{Related Work} \subsection{Clinical Temporal Relation Extraction} \noindent \textbf{Corpora. } Different from the datasets in the news domain~\cite{pustejovsky2003timebank,AQUAINT}, the corpora in the clinical domain require rich domain knowledge for annotating the temporal relations. I2b2-2012~\cite{sun2013evaluating} and Clinical TempEval~\cite{bethard-etal-2015-semeval,bethard-etal-2016-semeval,bethard-etal-2017-semeval} are some great efforts of building clinical datasets with extensive annotations including labels of clinical events and temporal relations, the second of which was not tested in our paper due to lack of access to the data. \noindent \textbf{Models.} Some early efforts to solve the clinical relation extraction problem leverage conventional machine learning methods~\cite{llorens2010tipsem,sun2013evaluating,xu2013end,tang2013hybrid,lee-etal-2016-uthealth,chikka-2016-cde} such as SVMs, MaxEnt and CRFs, and neural network based methods~\cite{lin2017representations,lin2018self,dligach2017neural,tourille2017neural,lin-etal-2019-bert,guan2020robustly,lin-etal-2020-bert,galvan2020empirical}. They either require expensive feature engineering or fail to consider the dependencies among temporal relations within a document. \cite{leeuwenberg-moens-2017-structured,han-etal-2019-deep,han-etal-2019-joint,ning-etal-2017-structured} formulate the problem as a structured prediction problem to model the dependencies but can not globally predict temporal relations. Instead, our method can infer the temporal relations at document level. \subsection{Probabilistic Soft Logic} In recent years, PSL rules have been applied to various machine learning topics such as Fairness~\cite{farnadi2019declarative}, Model Interpretability~\cite{hu-etal-2016-harnessing}, Probabilistic Reasoning~\cite{augustine2019tractable,dellert2020exploring}, Knowledge Graph Construction~\cite{pujara2013knowledge,chen2019embedding} and Sentiment Analysis~\cite{deng-wiebe-2015-joint,gridach2020framework}. We are the first to model the temporal dependencies with PSL. \section{Preliminaries}\label{sec:psl} \subsection{Problem Statement} Document $D$ contains sequences $[s_1,s_2, ..., s_M]$ and named entities $x_i \in \mathcal{E} \bigcup \mathcal{T}, 1 \leq i \leq N$, where $M,N$ are the total number of sequences and entities in $D$. $\mathcal{E}$ and $\mathcal{T}$ represent the set of events and time expressions, respectively. There is a potential temporal relation between any pair of annotated named entities $(x_j, x_k)$, where $1\leq j,k \leq N$. Formally, the task is modeled as a classification problem with a set of temporal relation types $\mathcal{Y}$. Given a sequence $s_i$ together with two named entities $x_{i,1},x_{i,2}$ included, we predict the temporal relation $y_i\in \mathcal{Y}$ from $x_{i,1}$ to $x_{i,2}$. In practice, we create a triplet with three pairs of entities to be one training instance $\mathcal{I}$, to enable the PSL rule grounding, as explained in the following section \subsection{Probabilistic Soft Logic and Temporal Dependencies in Clinical Narratives}\label{sec:psld} Here, we introduce some concepts and notations for the language PSL and illustrate how PSL is applicable to define templates for temporal dependencies and to help jointly learn a relation classifier. \begin{mydef} A \textbf{predicate} $\tilde{p}$ is a relation defined by a unique identifier and an \textbf{atom} $\tilde{l}$ is a predicate combined with a sequence of terms of length equal to the predicate’s argument number. Atoms in PSL take on continuous values in the unit interval $[0, 1]$. \end{mydef} \begin{myex} $\underline{\text{Before}}/2$ indicates a predicate taking two arguments, and the atom $\underline{\text{Before}}(A,B)$ represents whether $A$ happens before $B$. \end{myex} \begin{mydef}\label{def:rule} A \textbf{PSL rule} $\tilde{r}$ is a disjunctive clause of atoms or negative atoms: \begin{equation} \eta_r: T_1 \land T_2 \land ... \land T_{m} \rightarrow H_1 \lor H_2 \lor ... \lor H_{n}, \end{equation} where $T_1,T_2,...,T_m,H_1,H_2,...,H_n$ are atoms or negative atoms. \end{mydef} We name $T_1,T_2,...,T_m$ as $r_{body}$ and $H_1,H_2,...,H_n$ as $r_{head}$. $\eta_r\in [0,1]$ is the weight of the rule $r$, denoting the prior confidence of this rule. To the opposite, an unweighted PSL rule is to describe a constraint that is always true. The unweighted logical clauses in Table~\ref{tab:psl} describe the common temporal transitivity and symmetry dependencies we summarize from the clinical narratives. \begin{table}[t] \centering \resizebox{\linewidth}{!}{ \begin{tabular}{|c|c|} \hline Abbrev. & PSL rules \\ \hline \hline \multicolumn{2}{|l|}{Transitivity Dependencies} \\ \hline BBB & Before$(A,B)$ $\land$ Before$(B,C)$ $\rightarrow$ Before$(A,C)$ \\ BOB & Before$(A,B)$ $\land$ Overlap$(B,C)$ $\rightarrow$ Before$(A,C)$ \\ OBB & Overlap$(A,B)$ $\land$ Before$(B,C)$ $\rightarrow$ Before$(A,C)$ \\ OOO & Overlap$(A,B)$ $\land$ Overlap$(B,C)$ $\rightarrow$ Overlap$(A,C)$ \\ AAA & After$(A,B)$ $\land$ After$(B,C)$ $\rightarrow$ After$(A,C)$ \\ AOA & After$(A,B)$ $\land$ Overlap$(B,C)$ $\rightarrow$ After$(A,C)$ \\ OAA & Overlap$(A,B)$ $\land$ After$(B,C)$ $\rightarrow$ After$(A,C)$ \\ \hline \hline \multicolumn{2}{|l|}{Symmetry Dependencies} \\ \hline BA & Before$(A,B)$ $\rightarrow$ After$(B,A)$ \\ AB & After$(A,B)$ $\rightarrow$ Before$(B,A)$\\ OO & Overlap$(A,B)$ $\rightarrow$ Overlap$(B,A)$ \\ \hline \end{tabular}} \caption{Temporal transitivity and symmetry PSL rules $\mathcal{R}$. $A,B,C$ are three terms representing either events or time expressions.} \label{tab:psl} \end{table} \begin{mydef} The \textbf{ground atom} $l$ and \textbf{ground rule} $r$ are particular variable instantiation of some atom $\tilde{l}$ and rule $\tilde{r}$, respectively. \end{mydef} \begin{myex}\label{ex:rule} That \underline{Overlap} (\texttt{e}, \texttt{f}) $\land$ \underline{Overlap} (\texttt{f}, \texttt{g}) $\rightarrow$ \underline{Overlap} (\texttt{e}, \texttt{g}) from Figure~\ref{fig:case_report.pdf} is a ground rule composed of three ground atoms, denoted as $l_1,l_2$, and $l_3$, respectively. It is grounded from the OOO rule, as shown in Table~\ref{tab:psl}. \end{myex} \begin{mydef} The interpretation $I(l)$ denotes the soft truth value of an atom $l$. \end{mydef} \begin{mydef} Łukasiewicz t-norm~\cite{klir1995fuzzy} is used to define the basic logical operations in PSL, including logical conjunction ($\land$), disjunction ($\lor$), and negation ($\neg$): \begin{align} & I(l_1 \land l_2) = \max\{I(l_1) + I(l_2) - 1, 0 \}\label{eq:luk} \\ & I(l_1 \lor l_2) = \min\{I(l_1) + I(l_2), 1 \} \\ & I(\neg l_1) = 1 - I(l_1) \end{align} \end{mydef} The PSL rule in Definition~\ref{def:rule} can also be represented as: \begin{align*} I(r_{body}\rightarrow r_{head}) = I(\neg r_{body} \lor r_{head}), \end{align*} so we can induce the distance to satisfaction for rule $r$. \begin{mydef} The \textbf{distance to satisfaction} $d_r(I)$ of rule $r$ under an interpretation $I$ is defined as: \begin{align}\label{eq:dis} d_r(I) = \max\{0, I(r_{body})-I(r_{head})\} \end{align} \end{mydef} PSL program determines a rule $r$ as satisfied when the truth value of $I(r_{head})-I(r_{body})\geq 0$. \begin{myex} Given that $I(l_1) = 0.7, I(l_2) = 0.8, $ and $I(l_3) = 0.3$, we can compute the distance according to Equation~\eqref{eq:luk}-\eqref{eq:dis}: \begin{align*} & d_r = \max\{0, I(l_1 \land l_2) - I(l_3)\} \\ & = \max\{0, 0.7 + 0.8 -1 - I(l_3)\} \\ & = \max\{0, 0.5 -0.3\} \\ & = 0.2 \end{align*} \end{myex} This equation indicates that the ground rule in Example~\ref{ex:rule} is completely satisfied when $I(l_3)$ is above $0.5$. Otherwise, a penalty factor will be raised ($0.2$ in this case). When $I(l_3)$ is under $0.5$, the smaller $I(l_3)$ is, the larger penalty we have. In short, we compute the distance to satisfaction for each ground rule as a loss regularization term to jointly learn a relation classification model. We finally use the smallest one as the penalty because we only need one of the rules to be satisfied. \input{figures/framework} \section{Conclusion} In this paper, we propose \texttt{CTRL-PG}\xspace that leverages the PSL rules to model the temporal dependencies as a regularization term to jointly learn a relation classification model. Extensive experiments show the efficacy of the PSL regularization and global temporal inference with time graphs. \section{Introduction} Clinical case reports (CCRs) are written descriptions of the unique aspects of a particular clinical case~\citep{Caban-Martinez2012, caufield2018reference}. They are intended to serve as educational aids to science and medicine, as they play an essential role in sharing clinical experiences about atypical disease phenotypes and new therapies~\citep{caufield2018reference}. There is a perennial need to automatically and precisely curate the clinical case reports into structured knowledge, i.e. extract important clinical named entities and relationships from the narratives~\cite{aronson2010overview,savova2010mayo,soysal2018clamp,caufield2019comprehensive,alfattni2020extraction}. This would greatly enable both doctors and patients to retrieve related case reports for reference and provide a certain degree of technical support for resolving public health crises like the recent COVID-19 pandemic. Clinical reports describe chronicle events, elucidating a chain of clinical observations and reasoning~\cite{sun2013evaluating,chen2016orderrex}. Extracting temporal relations between clinical events is essential for the case report retrieval over the patient chronologies. Besides, medical question answering systems require the precise ordering of clinical events in a time series within each document. In this paper, we tackle the temporal relation extraction problem in clinical case reports. \input{figures/case-report} Figure~\ref{fig:case_report.pdf} illustrates a paragraph from a typical CCR document with three common types of temporal relations, ``Before'', ``After'', and ``Overlap''. \textit{Glucocortocoids} was described as the medicine history of this patient, which happened before \textit{confirmed with COVID-19} and \textit{positive of antibody}. An ``Overlap'' temporal relation exists between \textit{nasal congestion} and \textit{a mild cough}. We consider the aforementioned clinical concepts as events, while regarding \textit{a day later} as a time expression. A temporal relation may exist between event and event ($\texttt{E-E}$), event and time expression ($\texttt{E-T}$) or time expression and time expression ($\texttt{T-T}$). There is a consensus within the clinical community regarding the difficulty of temporal information extraction, due to the high demand for domain knowledge and high complexity of clinical language representations ~\cite{galvan2018investigating}. \citet{meng-rumshisky-2018-context,lee-etal-2016-uthealth} apply machine learning models with lexical, syntactic features, or pre-trained word representations to tackle the problem but neglect the strong dependencies between narrative containment and temporal order, thus predicting inconsistent output labels and garbled time-lines~\cite{leeuwenberg-moens-2017-structured}. The dependency is the key enabler of classifying the temporal relations. For instance in Figure~\ref{fig:case_report.pdf}, given that \texttt{b} happened before \texttt{d}, \texttt{e} happened after \texttt{d} and \texttt{e} happened simultaneously with \texttt{f} , we can infer according to the temporal transitivity rule that \texttt{b} was before \texttt{f}. Some recent studies~\cite{leeuwenberg-moens-2017-structured,ning-etal-2017-structured,han2020knowledge} convert the task to a structured prediction problem and solve it with Maximum a posteriori Inference. Integer Linear Programming (ILP) with hard constraints is deployed for optimization, which however needs an off-the-shelf solver to tackle the NP-hard optimization problem and can only approximate the optimum via relaxation. Besides, globally inferring the relations at the document level would also be intractable for them due to the high complexity and low scalability~\cite{bach2017hinge}. Recently, some researchers~\cite{deng-wiebe-2015-joint,chen2019embedding,hu-etal-2016-harnessing} have explored Probabilistic Soft Logic (PSL)~\cite{bach2017hinge} to tackle the structured prediction problem. Inspired by them, we propose to leverage the PSL rules to model relation extraction more flexibly and efficiently. In specific, we summarize common transitivity and symmetry patterns of temporal relations as PSL rules and penalize the training instances that violate any of those rules. Different from ILP solutions, no off-the-shelf solver is required and the algorithm conducts the training process with linear time complexity. Besides, logical propositions in PSL can be interpreted not just as $true$ or $false$, but as continuously valued in the $[0, 1]$ interval. We also propose a simple but effective time-anchored global temporal inference algorithm to classify the relations at the document level. With such a mechanism, we can easily verify some relations, such as the relation between \texttt{b} and \texttt{f}, with long-term dependencies which are intractable with existing approaches. As a summary, our main contributions are list as follows: \begin{itemize} \item To the best of our knowledge, this is the first work to formulate the probabilistic soft logic rules of temporal dependencies as a regularization term to jointly learn a relation classification model, \item We show the efficacy of globally inferring the temporal relations with the time graphs, \item We release the codes\footnote{\url{https://github.com/yuyanislearning/CTRL-PG}.} to facilitate further developments by the research community. \end{itemize} Next, we give the problem definition and explain how we leverage PSL rules to model the temporal dependencies. We then describe the overall architecture of our clinical temporal relation extraction model, \texttt{CTRL-PG}\xspace and show the extensive experimental results in the following sections. \section{Clinical Temporal Relation Extraction}\label{sec:model} Figure~\ref{fig:framework} shows the overall framework of the proposed \texttt{CTRL-PG}\xspace model. The framework consists of three components, (i) a temporal relation classifier composed of a deep language encoder and a Feed-Forward Network (FFN), (ii) a Cross-Entropy loss function with PSL regularization, and (iii) a time-anchored global temporal inference module. We will introduce the details of the three modules in the following subsections. \subsection{Temporal Relation Classifier} The context is essential for capturing the syntactic and semantic features of each word in a sequence. Hence, we propose to apply the contextualized language model, BERT~\cite{devlin2018bert}, to derive the sentence representation $v_i$ of $d_s$-dimension to encode the input sequence $s_i$ including two marked named entities $x_{i,1}, x_{i,2}$ from the instance $\mathcal{I}$, where $i\in\{1,2,3\}$. We group three sequences together to facilitate the computation of regularization term introduced in the next subsection. By feeding the sentence embedding $v_i$ to a layer of FFN, we can predict the relation type $\hat{y_i}$ with the softmax function: \begin{align} & \hat{y}_i = \argmax_{y \in \mathcal{Y}} \; \mathbb{P} (y|s_i)\\ & \mathbb{P}(y|s_i) = \text{softmax}( W_f \cdot v_i + b_f), \end{align} where $W_f$ and $b_f$ are the weights and bias in the FFN layer. To learn the relation classification model, we first compute a loss with the Cross-Entropy objective for each instance $\mathcal{I}$: \begin{align}\label{eq:ce} & \mathcal{L}_{ce} = -\sum_{i\in\{1,2,3\}}\sum_{y\in\mathcal{Y}} y\log\mathbb{P}(y|s_i) \end{align} \subsection{Learning with Probabilistic Soft Logic Regularization}\label{sec:pslr} We also aim to minimize the distance to rule satisfaction for each instance. We compute the distance with function $\mathcal{F}(\cdot,\cdot)$, as described in Algorithm~\ref{algo:PSL}, by finding the minimum of all possible PSL rule grounding results, i.e., when one PSL rule is satisfied, $\mathcal{F(\cdot,\cdot)}$ should return $0$. In specific, we first ground the three relation predictions $\hat{y}_{i}$ with potential PSL rules. We then incorporate Equation~\eqref{eq:luk}-\eqref{eq:dis} for distance computation. The prediction probabilities are regarded as the interpretation of the ground atoms $l_i$. If none of the rules can be grounded, the distance will be set as 0. \begin{algorithm}[t] \SetAlgoLined \textbf{Input:} PSL Rules $\mathcal{R}$, Prediction $\hat{y}_i$, and Probability $\mathbb{P}(y|s_i)$, $i=\{1,2,3\}$\; \textbf{Output:} Distance $d_r$\; Set $d_r=1$; $d_t=0$; IsGround $=false$\; \For{each $l_1\land l_2 \to l_3 \in \mathcal{R}$}{ \uIf{$\hat{y}_{1}$ matches $l_1$ and $\hat{y}_{2}$ matches $l_2$}{ Determine $\bar{y}_{3}$ with $l_3$\; $d_t \leftarrow \max\{\mathbb{P}(y=\hat{y}_{1}|s_1) + \mathbb{P}(y=\hat{y}_{2}|s_2) - 1, 0\}$\; $d_t \leftarrow \max\{d_t - \mathbb{P}(y=\bar{y}_{3}|s_3) , 0\}$\; $d_r \leftarrow \min\{d_r, d_t\}$\; IsGround $\leftarrow true$\; } } \uIf{IsGround $==false$}{$d_r \leftarrow 0$\;} \caption{Function $\mathcal{F}$ for PSL Rule Grounding and Distance Calculation.} \label{algo:PSL} \end{algorithm} Then, we formulate the distance to satisfaction as a regularization term to penalize the predictions that violate any PSL rule: \begin{align}\label{eq:psl} & \mathcal{L}_{psl} = \mathcal{F}(\mathcal{R}; \{(\mathbb{P}(y|s_i),\hat{y}_i)\}), i=\{1,2,3\} \end{align} and finalize the loss function by summing up \eqref{eq:ce} and \eqref{eq:psl}: \begin{align}\label{eq:loss} & \mathcal{L} = \mathcal{L}_{ce} + \lambda\cdot \mathcal{L}_{psl}, \end{align} where $\lambda$ is a hyperparameter as the weight for PSL regularization term. We apply gradient descent to minimize the loss function~\eqref{eq:loss} and to update the parameters of our model. \subsection{Global Temporal Inference} In the inference stage, we leverage the Timegraph algorithm~\cite{miller1990time} to resolve the conflicts in the temporal relation predictions $\bm{\hat{y}}$. Timegraph is a widely used algorithm of time complexity $\mathcal{O}(v+e)$ for deriving the temporal relation for any two nodes in a connected graph, where $v$ and $e$ denote the numbers of nodes and edges. Nodes and edges represent the named entities and temporal relations, respectively. Our goal is to construct a conflict-free time graph $\mathcal{G}$ for each document $D$ through a greedy Check-And-Add process, described as $4$ steps in Algorithm~\ref{algo:gri}. Intuitively, we want to rely on some trustworthy edges to resolve the conflicts in the time graph with the transitivity and symmetry dependencies listed in Table~\ref{tab:psl}. As illustrated in Figure~\ref{fig:framework}, the probabilities of predictions \underline{Overlap}(e1, e2) and \underline{Overlap}(e2, e3) are $0.7$ and $0.8$, which are higher than that of \underline{Overlap}(e1, e3). When we trust the first two predictions, the third prediction could be neglected considering the relation between e1 and e3 can already be inferred with the transitivity dependency. In this way, the predicting mistakes with low confidence scores can be ruled out, leading to better model performance in the closure evaluation. We believe that the relations between time expressions are the easiest ones to predict. For example, the ground atom \underline{Before} (\textit{06-15-91}, \textit{July 1st 1991}) is obviously $true$. Therefore, we try to build up a base time graph on top of the relations of type \texttt{T-T}. Next, we rank the rest of the predictions according to their probabilities in decreasing order and then check whether each of the predictions is inconsistent with the current time graph iteratively. The relation will be dropped if it raises a conflict, otherwise added to the graph as a new edge. \begin{algorithm}[t] \SetAlgoLined Step 1: Predict temporal relations $P_1$ on pairs of the time expressions \texttt{T-T}\; Step 2: Construct a time graph $\mathcal{G}$ with $P_1$\; Step 3: Rank all other predictions $P_2$ on the relations of type \texttt{E-E} and \texttt{E-T} according to the predicting probabilities in decreasing order, naming $P_2^{ranked}$\; Step 4: \\ \For{each $p$ in $P_2^{ranked}$}{ Apply Timegraph algorithm to check the conflict between $p$ and $\mathcal{G}$\; \uIf{there exists a conflict}{Drop $p$\;} \Else{Add the edge $p$ to $\mathcal{G}$\;} } \caption{Check-And-Add Process for Constructing a Conflict-free Time Graph $\mathcal{G}$} \label{algo:gri} \end{algorithm} \section{Experiments}\label{sec:exp} In this section, we develop experiments on two benchmark datasets to prove the effectiveness of both PSL regularization and global temporal inference. We also discuss the limitation and perform error analyses for \texttt{CTRL-PG}\xspace. \begin{table}[ht!] \centering \resizebox{.95\linewidth}{!}{ \begin{tabular}{|c|l|r|r|r|} \hline \multicolumn{2}{|c|}{Dataset} & Train & Dev & Test \\ \hline \hline \multirow{2}{*}{I2B2-2012} & \# doc & 181 & 9 & 120 \\ \cline{2-5} & \# relation & 29,736 & 1,165 & 24,971 \\ \hline \multirow{2}{*}{TB-Dense} & \# doc & 22 & 5 & 9 \\ \cline{2-5} & \# relation & 4,032 & 629 & 1,427 \\ \hline \end{tabular}} \caption{Dataset Statistics.} \label{tab:data} \end{table} \subsection{Datasets} Experiments are conducted on I2B2-2012 and TB-Dense datasets and an overview of the data statistics is shown in Table~\ref{tab:data}. The datasets have diverse annotation densities and instance numbers. \noindent \textbf{I2B2-2012.} The I2B2-2012 challenge corpus~\cite{sun2013evaluating} consists of 310 discharge summaries. Two categories of temporal relations, \texttt{E-T} and \texttt{E-E}, were annotated in each document. Three temporal relations\footnote{\citet{sun2013evaluating} merged 7 original temporal relations to 3 to increase Inter-annotator agreement.}, \underline{Before}, \underline{After}, and \underline{Overlap}, were used. I2B2-2012 has a relatively low annotation density\footnote{Annotation density denotes the percentage of annotated pairs of event/time expressions.}, which is $0.21$. \noindent \textbf{TB-Dense.} To prove that our PSL regularization is a generic algorithm and can be easily adapted to other domains, we also test it on the TB-dense~\cite{cassidy-etal-2014-annotation} dataset, which is based on TimeBank News Corpus~\cite{pustejovsky2003timebank}. Annotators were required to label all pairs of events/times in a given window to address the sparse annotation issue in the original data. Thus the annotation density is 1. This dataset has six relation types, \underline{Simultaneous}, \underline{Before}, \underline{After}, \underline{Includes}, \underline{Is\_Include}, and \underline{Vague}. \subsection{Baseline Models} We employ different baseline models for the two datasets to compare our method with the SOTA models in both clinical and news domains. \\ \noindent \textbf{I2B2-2012} (1) Feature-engineering based statistic models from I2B2-2012 challenge, \texttt{MaxEnt-SVM}~\cite{xu2013end} incorporating Maximum Entropy with Support Vector Machine (SVM), \texttt{CRF-SVM}~\cite{tang2013hybrid} using Conditional Random Fields and SVM, \texttt{RULE-SVM}~\cite{nikfarjam2013towards} relying on rule-based algorithms; (2) Neural network based model, \texttt{RNN-ATT}~\cite{liu-etal-2019-attention}, which applies Recurrent Neural Network plus attention mechanism; (3) Structured Prediction method, \texttt{SP-ILP}~\cite{han-etal-2019-deep,leeuwenberg-moens-2017-structured} leveraging the ILP optimization; (4) Basic version of our model, \texttt{CTRL}, which only fine-tunes a BERT-BASE~\cite{devlin2018bert} language model with one layer of FFN, similar to the implementations in \citet{lin-etal-2019-bert,guan2020robustly}. \\ \noindent \textbf{TB-Dense.} (1) \texttt{CAEVO}~\cite{chambers2014dense} with a cascade of rule-based classifiers; (2) \texttt{LSTM-DP}~\cite{cheng-miyao-2017-classifying} using LSTM-based network and cross-sentence dependency paths; (3) \texttt{GCL}~\cite{meng-rumshisky-2018-context} incorporating LSTM-based network with discourse-level contexts; (4) \texttt{SP-ILP} and \texttt{CTRL}, same as the baselines for I2B2-2012. Note that the results of \texttt{CAEVO}, \texttt{LSTM-DP}, \texttt{GCL}, and \texttt{SP-ILP} are collected from \citet{han-etal-2019-deep}. \subsection{Evaluation Metrics} To be consistent with previous work for a fair comparison, we adopt two different evaluation metrics. For TB-Dense dataset, we compute the Precision, Recall, and Micro-average F1 scores. Following \cite{han-etal-2019-joint,meng-rumshisky-2018-context}, we only predict the \texttt{E-E} relations and exclude all other relations from evaluation. Note that Micro-averaging in a multi-class setting will lead to the same value for Precision, Recall, and F1. For I2B2-2012, we leverage the TempEval evaluation metrics used by the official challenge~\cite{sun2013evaluating}, which also calculates the Precision, Recall, and Micro-average F1 scores. This evaluation metrics differ from the standard F1 used for TB-Dense in a way that it computes the Precision by verifying each prediction in the closure of the ground truths and computes the Recall by verifying each ground truth in the closure of the predictions. We explore all types of temporal relations in I2B2-2012 dataset. \subsection{Implementation Details} In the framework of \texttt{CTRL-PG}\xspace, any contextualized word embedding method, such as BERT~\cite{devlin2018bert}, ELMo~\cite{peters2018deep}, and RoBERTa~\cite{liu2019roberta}, can be utilized. We choose BERT~\cite{devlin2018bert} to derive contextualized sentence embeddings without loss of generality. BERT adds a special token \texttt{[CLS]} at the beginning of each tokenized sequence and learns an embedding vector for it. We follow the experimental settings in \cite{devlin2018bert} to use $12$ Transformer layers and attention heads and set the embedding size $d_s$ as 768. The \texttt{CTRL-PG}\xspace is implemented in PyTorch and we use the fused Adam optimizer~\cite{kingma2014adam} to optimize the parameters. We follow the experimental settings in \cite{devlin2018bert} to set the dropout rate, and batch size as $10^{-1}$ and 8. We perform grid search for the initial learning rate from a range of $\{1\times 10^{-5},2\times 10^{-5},4\times 10^{-5},8\times 10^{-5}\}$ and finally select $2\times 10^{-5}$ for both datasets. We train 10 epochs for each experiment on two datasets, which can all be completed within 2 hours on single DGX1 Nvidia GPU. \input{figures/lambda} To tune the hyperparameters, we search the PSL regularization term $\lambda$ from $\{0.1, 0.5 , 1, 2, 5, 10\}$ as shown in Figure~\ref{fig:hyper}. For I2B2-2012 and TB-Dense datasets, we set $\lambda$ as $5$ and $0.5$, respectively. The hyperparameters are selected by observing the best F1 performance on the validation set. More implementation details can be found in the Appendix. \begin{table}[h] \centering \resizebox{\linewidth}{!}{ \begin{tabular}{|c|R{1.5cm}|R{1.5cm}|R{1.5cm}|} \hline Model & P & R & F1 \\ \hline \hline \texttt{RULE-SVM} &71.09&58.39&64.12 \\ \texttt{MaxEnt-SVM} &74.99&64.31&69.24 \\ \texttt{CRF-SVM} &72.27&66.81&69.43\\ \hline \hline \texttt{RNN-ATT} &71.96&69.15&70.53\\ \texttt{SP-ILP} &78.15&\textbf{78.29}&78.22\\ \texttt{CTRL} &84.88&73.28&78.65 \\ \hline \hline \texttt{CTRL-PG}\xspace &\textbf{86.80}&74.53&\textbf{80.20} \\ \hline \end{tabular}} \caption{Performance of temporal relation extraction on I2B2-2012 datasets. All improvements of \texttt{CTRL-PG}\xspace over baseline methods are statistically significant at a 99\% confidence level in paired \textit{t}-tests. Results show that \texttt{CTRL-PG}\xspace outperforms all the baselines. } \label{tab:result1} \end{table} \begin{table}[t] \centering \resizebox{\linewidth}{!}{ \begin{tabular}{|l|R{1.4cm}|R{1.4cm}|R{1.4cm}|R{1cm}|} \hline Feature & P & R & F1 & Lift\\ \hline \hline Best & 86.80 & 74.53 & 80.20 & -\\ \hline w/o PSL & 85.78 & 73.31 & 79.06 & \textbf{1.44}\% \\ \hline w/o GTI & 85.08 & 73.31 & 78.76 & \textbf{1.83}\% \\ \hline \end{tabular}} \caption{Ablation study on I2B2-2012 dataset. GTI denotes the global temporal inference. Results show significant performance lifts from both PSL and GTI modules.} \label{tab:abl} \end{table} \begin{table}[h] \centering \resizebox{\linewidth}{!}{ \begin{tabular}{|l|R{1.3cm}|R{1.3cm}|R{1.3cm}|R{1cm}|} \hline Strategy & P & R & F1 & Lift\\ \hline \hline Random & 85.08 & 73.93 & 79.21 & -\\ \hline Confidence & 86.07 & 73.76 & 79.44 & \textbf{0.29\%}\\ \hline Confidence + & \multirow{2}{*}{86.80} & \multirow{2}{*}{74.53} & \multirow{2}{*}{80.20} & \multirow{2}{*}{\textbf{1.25}\%}\\ Time Anchor & & & &\\ \hline \end{tabular}} \caption{Comparison of different ranking methods applied in the global inference on I2B2-2012 dataset.} \label{tab:gti} \end{table} \begin{table*}[h] \centering \resizebox{\linewidth}{!}{ \begin{tabular}{|c|c|c|c|c|} \hline \multirow{7}{*}{1} & \multirow{2}{*}{Text} & \multicolumn{3}{l|}{{\color{red} Her acute bradycardic event} was felt likely secondary to {\color{blue}her new beta blocker} in conjunction with} \\ & & \multicolumn{3}{l|}{a vagal response . It was determined to stop {\color{green}the beta blocker} , and atropine was placed at the bedside .}\\ \cline{2-5} & (e1, e2) & ({\color{red}Her...event}, {\color{blue}her...blocker}) & ({\color{blue}her...blocker}, {\color{green}the beta blocker}) & ({\color{red}Her...event}, {\color{green}the beta blocker})\\ \cline{2-5} & True Label & After & Overlap & After\\ \cline{2-5} & \texttt{CRTL} & After & Overlap & Overlap \\ \cline{2-5} & \texttt{CTRL-PG}\xspace & After & Overlap & After \\ \cline{2-5} &Rule & \multicolumn{3}{c|}{After$(A,B)$ $\land$ Overlap$(B,C)$ $\rightarrow$ After$(A,C)$}\\ \hline \hline \multirow{7}{*}{2} & \multirow{2}{*}{Text} & \multicolumn{3}{l|}{The patient was given an aspirin and Plavix and in addition {\color{red}started} on {\color{blue}a beta Elmore} , {\color{green}Maxine ACE}} \\ & & \multicolumn{3}{l|}{{\color{green}inhibitor} , and these were titrated up as her blood pressure tolerated .}\\ \cline{2-5} & (e1, e2) & ({\color{red}started}, {\color{blue}a beta Elmore}) & ({\color{blue}a beta Elmore}, {\color{green}Maxine ACE}) & ({\color{red}started}, {\color{green}Maxine ACE})\\ \cline{2-5} & True Label & Before & Overlap & Before\\ \cline{2-5} & \texttt{CRTL} & After & Overlap & Before \\ \cline{2-5} & \texttt{CTRL-PG}\xspace & After & Overlap & After \\ \cline{2-5} &Rule & \multicolumn{3}{c|}{After$(A,B)$ $\land$ Overlap$(B,C)$ $\rightarrow$ After$(A,C)$}\\ \hline \hline \multirow{6}{*}{3} & Text & \multicolumn{3}{l|}{She has had attacks treated with {\color{red}antibiotics} in the past notably in {\color{blue}12/96} and {\color{green}08/97} .} \\%Lipase was within normal limits.\\ \cline{2-5} & (e1, e2) & ({\color{red}antibiotics}, {\color{blue}12/96}) & ({\color{blue}12/96}, {\color{green}08/97}) & ({\color{red}antibiotics}, {\color{green}08/97})\\ \cline{2-5} & True Label & Overlap & Before & Overlap\\ \cline{2-5} & \texttt{CRTL} & Overlap & Before & Overlap \\ \cline{2-5} & \texttt{CTRL-PG}\xspace & Overlap & Before & Before \\ \cline{2-5} &Rule & \multicolumn{3}{c|}{Overlap$(A,B)$ $\land$ Before$(B,C)$ $\rightarrow$ Before$(A,C)$}\\ \hline \end{tabular}} \caption{Case study and error analysis of the model predictions on I2B2-2012 Dataset.} \label{tab:error} \end{table*} \begin{table}[t] \centering \resizebox{\linewidth}{!}{ \begin{tabular}{|c|r|r|r|r|r|r|} \hline \multirow{2}{*}{} & \multicolumn{3}{c|}{\texttt{SP-ILP}} & \multicolumn{3}{c|}{\texttt{CTRL-PG}\xspace} \\ \cline{2-7} & P & R & F1 & P & R & F1 \\ \hline \hline Before &71.1&58.9&64.4&52.6&74.8&61.7 \\ After &75.0&55.6&63.5&69.0&72.5&70.7 \\ Includes &24.6&4.2&6.9&60.9&29.8&40.0 \\ Is\_Include &57.9&5.7&10.2&34.7&27.7&30.8 \\ Simultaneous &-&-&-&-&-&-\\ Vague &58.3&81.2&67.8&72.8&64.8&68.6 \\ \hline Micro-average &\multicolumn{3}{r|}{63.2}&\multicolumn{3}{r|}{\textbf{65.2}} \\ \hline \hline \texttt{CAEVO} &\multicolumn{6}{r|}{49.4} \\ \texttt{LSTM-DP} &\multicolumn{6}{r|}{52.9} \\ \texttt{GCL} &\multicolumn{6}{r|}{57.0} \\ \texttt{CTRL} &\multicolumn{6}{r|}{63.6} \\ \hline \end{tabular}} \caption{Performance of temporal relation extraction on TB-dense datasets. All improvements of \texttt{CTRL-PG}\xspace over baseline methods are statistically significant at a 99\% confidence level in paired \textit{t}-tests. We also compare the breakdown performance for each relation class between \texttt{CTRL-PG}\xspace and \texttt{SP-ILP}.} \label{tab:result2} \end{table} \subsection{Experimental Results} Table~\ref{tab:result1} and Table~\ref{tab:result2} contains our main results. As we observe, our \texttt{CTRL-PG}\xspace enhanced by PSL regularization and global inference achieve the best relation extraction performances per F1 score. Compared with the baseline models, the F1 score improvements are 2.0\% and 2.5\% on I2B2-2012 and TB-Dense data respectively, which are all statistically significant. \\ \noindent \textbf{I2B2-2012.} As shown in Table~\ref{tab:result1}, our model \texttt{CTRL-PG}\xspace outperforms the best baseline method \texttt{CTRL} by 2\% and outperforms the structured prediction method \texttt{SP-ILP} by 2.5\% per F1 score. \texttt{SP-ILP} gets the highest Recall score, but sacrifice the predicting precision instead. We also observe that by simply fine-tuning the BERT to generate the sentence embeddings and then feeding them into one layer of FFN for classification, \texttt{CTRL} can achieve an impressive F1 score of 78.65\%. This proves the advantage of contextualized embeddings over static embeddings used by other baseline models. Besides, \texttt{CTRL-PG}\xspace outperforms the feature-based systems, \texttt{CRF-SVM} and \texttt{MaxEnt-SVM}, by over 10\% per F1 score. We develop an ablation study to test different features, as shown in Table~\ref{tab:abl}. We see that PSL regularization and global temporal inference modules lift the performance by 1.44\% and 1.83\% separately. Both Precision and Recall performances are improved. We can clearly conclude that learning the relations with the proposed algorithms improves our model significantly (also at a 99\% level in paired \textit{t}-tests). We also show the comparisons among different ranking strategies for the global inference module in Table~\ref{tab:gti}. Random denotes that we randomly add a new prediction to the time graph and resolve the conflict. Confidence denotes we rank the predictions per the prediction probabilities and then add them to the graph in decreasing order. Time Anchor represents that we first construct the time graph based on the predictions for temporal relations of type \texttt{T-T}. In the results, we see a 0.29\% improvement per F1 score when switching from the Random to the Confidence strategy. After adding the Time Anchor method, we observe a 1.25\% performance lift, compared to Random strategy. This proves the effectiveness of the time-anchored global temporal inference module. \\ \noindent \textbf{TB-Dense.} We show the experimental results on TB-Dense dataset in Table~\ref{tab:result2}. Our model outperforms the best baseline model \texttt{CTRL} by 2.5\% and outperforms the structured prediction method \texttt{SP-ILP} by 3.2\% per Micro-average F1 score. We observe that in the performance breakdown for each relation class, \texttt{CTRL-PG}\xspace obtains similar scores on \underline{Before}, \underline{After}, and \underline{Vague} as \texttt{SP-ILP} and gets much better performances on \underline{Is\_Include} and \underline{Includes}. These two types only occupy 5.7\% and 4.5\% of all the instances. \texttt{CTRL-PG}\xspace and \texttt{SP-ILP} both fail to label any instance as \underline{Simultaneous} because of its even fewer instances (1.5\%) for training. Besides, we observe \texttt{CTRL-PG}\xspace achieves higher Recall values in all the categories of temporal relations, which prove that incorporating the dependency rules into model training can dramatically lift the coverage of predictions. \subsection{Case Study and Error Analysis.} Table~\ref{tab:error} shows the results of a case study with the outputs of \texttt{CTRL} and \texttt{CTRL-PG}\xspace. In the first case, the temporal relation between \textit{Her acute bradycardic event} and \textit{the beta blocker} is hard to predict due to the noise brought by the long context. \texttt{CTRL} predicts it as \underline{Overlap}, while \texttt{CTRL-PG}\xspace corrects it to \underline{After} according to the potential PSL rule that can be matched with the first two correct predictions. In some cases, however, \texttt{CTRL-PG}\xspace will make new mistakes. For example in case 2, if our model initially predicts the relation between \textit{started} and \textit{a beta Elmore} wrong, a potential PSL rule sometimes will lead to an extra mistake when predicting the relation between \textit{started} and \textit{Maxine ACE}. In the case 3, \textit{antibiotics} treated the \textit{attacks} twice in both $12/96$ and $08/97$, where the PSL rule is no longer valid since the \textit{antibiotics} in fact denote two occurrences of this event. In such special cases with invalid rules, \texttt{CTRL-PG}\xspace may make a mistake. \section{Appendices} \label{sec:appendix} \subsection{Dataset} The I2B2-2012 dataset\footnote{\url{https://www.i2b2.org/NLP/DataSets/}} is officially split into training and test sets, containing 190 and 120 documents, separately. We randomly sampled 5\% of training data as a validation set. For TB-Dense\footnote{\url{https://www.usna.edu/Users/cs/nchamber/caevo/}}, the training/validation/test sets are given. The statistics are shown in Table~\ref{tab:data} and we plot the detailed relation type distributions of two datasets in Figure~\ref{fig:type}. We observe that TB-Dense is a relatively unbalanced dataset, where \underline{Vague} dominates the dataset. We compute the density by (\# existing relations)/(\# possible pairs of entities). Following \cite{han-etal-2019-joint,meng-rumshisky-2018-context}, we only predict the \texttt{E-E} relations and exclude all other relations from evaluation for TB-Dense dataset evaluation. Therefore, we cannot apply the global inference module to this dataset. \begin{figure}[ht] \centering \begin{subfigure}[b]{\linewidth} \centering \includegraphics[width=\linewidth]{images/i2b2data.pdf} \caption{I2B2-2012} \label{fig:i2b2data} \end{subfigure} \begin{subfigure}[b]{\linewidth} \centering \includegraphics[width=\linewidth]{images/tbddata.pdf} \caption{TB-Dense } \label{fig:tbddata} \end{subfigure} \caption{Relation Type Distribution of I2B2-2012 and TB-Dense} \label{fig:type} \end{figure} \subsection{Data Preprocessing} To facilitate the PSL rule grounding and distance calculation, we arrange the training data as a collection of instances, each of which contains three pairs of relations. We first traverse the training dataset to match the PSL rules and make sure that each ground rule is treated as one instance to further calculate the PSL loss term. Besides, relations that are not involved in any rules are packed together and we do not have to compute a PSL loss for them. We also augment the training data by flipping every pair according to the symmetry rules, i.e. if \underline{Before}($A,B$) is $true$, \underline{After}($B,A$) should also be $true$. We incorporate the new relations into the training dataset to alleviate the unbalanced data issue. \subsection{Model Training Details} We leverage the pretrained BERT-BASE model~\cite{devlin2018bert} to generate the sentence embeddings, which contains 110M parameters to fine-tune. In the experiments, we save the checkpoint with the highest validation performance for final testing. In Table~\ref{tab:dev}, we list the best validation performance of different datasets and the corresponding test performance that we also reported in Table~\ref{tab:result1} and Table~\ref{tab:result2} for completeness. Data and codes are attached. \begin{table}[h] \centering \resizebox{.95\linewidth}{!}{ \begin{tabular}{|c|l|r|r|r|} \hline \multicolumn{2}{|c|}{Dataset} & Precision & Recall & F1 \\ \hline \hline \multirow{2}{*}{I2B2-2012} & Test & 86.80 & 74.53 & 80.20 \\ \cline{2-5} & Val & 86.03 & 86.03 & 86.03 \\ \hline \multirow{2}{*}{TB-Dense} & Test & 65.20 & 65.20 & 65.20 \\ \cline{2-5} & Val & 58.80 & 58.80 & 58.80 \\ \hline \end{tabular}} \caption{Corresponding validation performance for each reported test result of \texttt{CTRL-PG}\xspace in Table~\ref{tab:result1} and Table~\ref{tab:result2}.} \label{tab:dev} \end{table}
{'timestamp': '2020-12-17T02:12:11', 'yymm': '2012', 'arxiv_id': '2012.08790', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08790'}
arxiv
\section{abstract} This paper argues that data of strategic individuals with heterogeneous privacy valuations in a distributed online social network (e.g., Facebook) will be under-priced, if traded in a monopoly buyer setting, and will lead to diminishing utilitarian welfare. This result, for a \textit{certain family} of online community data trading problems, is in stark contrast to a popular information economics intuition that increased amounts of end-user data signals in a data market improves its efficiency. Our proposed theory paves the way for a future (counter-intuitive) analysis of data trading oligopoly markets for online social networks (OSNs). \section*{keywords} distributed community, monopoly, social welfare \vspace{-3 mm} \section{Introduction} Data of billions of online individuals are currently gathered, processed, and analyzed for personalized advertising or other online service\footnote{Facebook itself has approximately 2.5 billion monthly active individual users.}. This trend is on the high rise with a perennial increase in online apps, IoT technologies, and advanced AI/ML methodologies. It is a common and age-old notion in economics (see \cite{posner1,posner2,stigler,Laudon:1996:MP:234215.234476,acquisti2016economics,odlyzko,samuelson2000privacy,schwartz2003property,posner2018radical}) that the benefits and use of sharing individual information with the demand side of an information market is beneficial to targeted customization, demand side profit, and the growth of data-`hungry' AI/ML controlled businesses. It has also been argued by economists \cite{varian2009economic,farboodi2019big} that because of the above-mentioned benefits that individual data brings to a market setting, a competitive market mechanism might generate too little data sharing from the supply side. In this letter, we rigorously argue, through a counter-example of a simple application type, that the popularly known economic intuition \emph{does not hold} in general, atleast for a monopoly information market setting. More specifically, we show that for some community settings (e.g., Facebook) trading end-user data/information signals in a monopoly market leads to diminishing economic utilitarian social welfare. \emph{The intuition behind this result primarily lies behind the negative externalities created via trading statistically correlated end-user signals when these heterogeneous users have varying privacy valuations of their data signals.} The result is contrary to recent results that intuit/prove that privacy can be detrimental to information market efficiency \cite{acquisti2016economics,posner2018radical,pal2019privacy, calo2015privacy,pal2020preference, acemoglu2019too, laoutaris2019online} if \emph{ideally, one's value of privacy is not high, or one's data is mildly correlated with others.} Specifically, we prove that information markets will be inefficient in \emph{non-ideal} community settings - formally hinted earlier in \cite{pal2020preference}. Our analysis is complete for a monopoly structure, with a major takeaway being that in practical social community settings, sub-population privacy will jeopardized at a monopoly data trading market equilibrium. To the best of our knowledge, we are the first to mathematically dispel traditional information economics intuition, albeit for social network settings only. Moreover, it paves the way for a future (counter-intuitive) analysis of general community data trading oligopoly markets. The rest of the paper is organized as follows. In Section II, we provide an intuition, via an example, towards proving our claim. We then follow this up in Section III with the description of a formal monopoly market model. In Section IV, we analyze this market model and formally prove our claim. We provide illustrative examples of our theory in Section V. We conclude the letter in Section VI. \section{Intuition} We provide an example-driven intuition that leads us to formally investigate the validity of the hypothesis that OSN user information promotes efficient data trading markets. We focus on the widely popular \emph{Cambridge Analytica} scandal. The company acquired private information of millions of individuals from data shared by 270,000 Facebook users who voluntarily downloaded an app for mapping personality traits, called \emph{This is your digital life}. The app accessed users' news feed, timeline, posts, and messages, and revealed information about other Facebook users. The company was finally able to infer valuable information about more than 50 million Facebook users, which it deployed for designing personalized political messages and advertising in the Brexit referendum and the 2016 US presidential election. This scandal highlighted two important facets: (i) private information (e.g., behavior, habits, preferences) of users part of an online social community such as Facebook are correlated and results in knowing such information about other users\footnote{Habits and preferences of a highly educated gay from a particular locality is informative about others with the same profile and residing in the same area.} whose data is not leaked, and (ii) once it is openly publicized that valuable user information has been breached to satisfy external objectives, users are often miffed resulting in a huge social uproar as did happen in the case of the Cambridge Analytica scandal. These observations motivated us to develop a skepticism regarding the popular economic notion that more data implies increased information market efficiency. It could also be that trading in return for incentives for such community settings might not go down well\footnote{This is a high chance in scenarios of social uproar post publicly known data breaches, if not in cases where data breaches go un-noticed.} with the user privacy preferences, consequently hampering societal welfare (see Section III for a definition). To state our intuition in a relatively more formal manner (courtesy of \cite{acemoglu2019too}), consider a community platform with two users, $i$ = 1, 2. Each user owns its own personal data, which we represent with a random variable $X_{i}$ (from the viewpoint of the platform). The relevant data of the two users are related, which we capture by assuming that their random variables are jointly normally distributed with mean zero and correlation coefficient $\rho$. The community platform can acquire or buy the data of a user in order to better estimate her preferences or actions. Its objective is to minimize the mean square error of its estimates of user types, or maximize the amount of leaked information about them. Suppose that the valuation (in monetary terms) of the platform for the users’ leaked information is one, while the value that the first user attaches to her privacy, again in terms of leaked information about her, is $\frac{1}{2}$ and for the second user it is $v > 0$. We also assume that the platform makes take-it-or-leave-it offers to the users to purchase their data. In the absence of any restrictions on data markets or transaction costs, the first user will always sell her data (because her valuation of privacy, $\frac{1}{2}$, is less than the value of information to the platform, 1). But given the correlation between the types of the two users, this implies that the platform will already have a fairly good estimate of the second user’s information. Suppose, for illustration, that $\rho \simeq 1$. In this case, the platform will know almost everything relevant about user 2 from user 1’s data, and this undermines the willingness of user 2 to protect her data. In fact, since user 1 is revealing almost everything about her, she would be willing to sell her own data for a very low price (approximately 0 given $\rho \simeq 1$). But once the second user is selling her data, this also reveals the first user’s data, so the first user can only charge a very low price for her data. Therefore in this simple example, the community platform will be able to acquire both users’ data at approximately zero price. Critically, however, this price does not reflect the users’ valuation of privacy. When $v \le 1$, the equilibrium is efficient because data are socially beneficial in this case (even if data externalities change the distribution of economic surplus between the platform and users). However, it can be arbitrarily inefficient when $v$ is sufficiently high. This is because the first user, by selling her data, is creating a negative externality on the second user. \section{System Model} A simple example, such as the one aforementioned, clearly provides an intuition regarding the inefficiency of information trading in community settings with heterogeneous privacy valuations. In this section. en route to generalizing the validity (or invalidity) of our intuition, we propose a monopoly information trading market model (reproduced from \cite{acemoglu2019too})\footnote{We use the same notation for consistency purposes.} consisting of $n$ platform users and a profit-maximizing community platform (e.g., Facebook). We consider \(n\) community users represented by the set \(\mathcal{V}=\{1, \ldots, n\} .\) Each user \(i \in \mathcal{V}\) has a type denoted by \(x_{i}\) which is a realization of a random variable \(X_{i} .\) We assume that the vector of random variables \(\mathbf{X}=\left(X_{1}, \ldots, X_{n}\right)\) has a joint normal distribution \(\mathcal{N}(0, \Sigma),\) where $\Sigma \in \mathbf{R}^{n \times n}$ is the publicly known covariance matrix of \(\mathbf{X} .\) Let \(\Sigma_{i j}\) designate the \((i, j)\) -th entry of \(\Sigma\) and \(\Sigma_{i i}=\sigma_{i}^{2}>0\) denote the variance of individual \(i^{\prime}\)s type. Each user has some personal data, \(S_{i}\), which is informative about its type, i.e., the `DNA' that drives the user's tastes (for example, based on her past behavior, preferences, or contacts). We suppose that \(S_{i}=X_{i}+Z_{i}\) where \(Z_{i}\) is an independent random variable with standard normal distribution\footnote{This has taken various forms in the information privacy literature \cite{sarwate2013signal}.}, i.e., \(Z_{i} \sim \mathcal{N}(0,1)\). For any user joining the community platform, the platform can derive additional revenue (e.g., due to benefits of targeted advertising) if it can predict the user's type. We simply assume that the community platform’s revenue from each user is a deceasing function of the mean square error of its forecast of the user’s type, minus what the platform pays to users to acquire their information. More specifically, the objective of the platform is to minimize \begin{equation} \sum_{i \in \mathcal{V}} \left(\mathbb{E} \left[\left(\hat{x}_{i}(\mathbf{S})-X_{i}\right)^{2}\right]-\sigma_{i}^{2}+p_{i}\right) \end{equation} where \(\mathbf{S}\) is the vector of data the platform acquires, \(\hat{x}_{i}(\mathbf{S})\) is the platform's estimate of the user's type given this information, \(-\sigma_{i}^{2}\) is included as a convenient normalization, and \(p_{i}\) denotes payments (be it explicit or implicit) to user \(i\) from the platform for their data (we ignore for simplicity any other transaction costs incurred by the platform). Users value their privacy, which we also model in a reduced-form manner (reflecting both pecuniary and non-pecuniary\footnote{As example, the fact that a user may receive a greater consumer surplus when the platform knows less about her or she may have a genuine demand for keeping her preferences, behavior, and information private. There may also be political and social reasons for privacy, for example, for concealing dissident activities or behaviors disapproved by some groups.} motives) as a function of the same mean square error. We assume, specifically, that user \(i^{\prime}\) s value of privacy is \(v_{i} \geq 0,\) and her payoff is $ v_{i}\left( \mathbb{E} \left[\left(\hat{x}_{i}( \mathbf{S} )-X_{i}\right)^{2}\right]-\sigma_{i}^{2}\right)+p_{i} $ This expression and its comparison with objective (1) clarifies that the platform and users have potentially- opposing preferences over information about user type. We have again subtracted \(\sigma_{i}^{2}\) as a normalization, which ensures that if the platform acquires no additional information about the user and makes no payment to it, the payoff is zero. Critically, users with \(v_{i}<1\) value their privacy less than the valuation that the platform attaches to information about them, and thus reducing the mean square error of the estimates of their types is socially beneficial. In contrast, users with \(v_{i}>1\) value their privacy more, and reducing their mean square error is socially costly. In settings without data externalities (where data about one user have no relevance to the information about other users - an example being collection agencies not gathering addresses locations), the first group of users should allow the platform to acquire (buy) their data, while the second group should not. A simple market mechanism based on prices for data can implement this efficient outcome, in accordance to the traditional economic notion that more information implies better market efficiency. However, the situation could be very different in the presence of data externalities (e.g., online community settings such as Facebook). A key notion for our analysis is breached information, which captures the reduction in the mean square error of the platform’s estimate of the type of a user. When the platform has no information about user $i$, its estimate satisfies $ \mathbb{E}\left[\left(\hat{x}_{i}-X_{i}\right)^{2}\right]=\sigma_{i}^{2}$. As the platform receives data from this and other users, its estimate improves and the mean square error declines. The notion of breached information captures this reduction in mean square error (MSE). Specifically, let \(a_{i} \in\{0,1\}\) denote the data sharing action of user \(i \in \mathcal{V}\) with \(a_{i}=1\) corresponding to sharing. Denote the the profile of sharing decisions by \(\mathbf{a}=\left(a_{1}, \ldots, a_{n}\right)\) and the decisions of agents other than \(i\) by \(\mathbf{a}_{-i} .\) We also use the notation \(\mathbf{S}_{\mathbf{a}}\) to denote the data of all individuals for whom \(a_{j}=1,\) i.e., \(\mathbf{S}_{\mathbf{a}}=\left(S_{j}: j \in \mathcal{V}\, \mathrm{s.t.}\, a_{j}=1\right) .\) Given a profile of actions \textbf{a}, the breached information of (or about) user \(i \in \mathcal{V}\) is the reduction in the MSE of the best estimator of the type of user \(i\) : $\mathcal{I}_{i}(\mathbf{a})=\sigma_{i}^{2}-\min _{\hat{x}_{i}(\cdot)} \mathbb{E} \left[\left(X_{i}-\hat{x}_{i}\left(\mathbf{S}_{\mathbf{a}}\right)\right)^{2}\right].$ Notably, because of data externalities, breached information about user $i$ depends not just on her decisions but also on the sharing actions taken by all users. With this notion at hand, we can write the payoff of user $i$ given the price vector $p = (p_1, . . . , p_n)$ as {\setlength\abovedisplayskip{0pt} \setlength\belowdisplayskip{2pt}$$ u_{i}\left(a_{i}, \mathbf{a}_{-i}, \mathbf{p}\right)=\left\{\begin{array}{ll}p_{i}-v_{i} \mathcal{I}_{i}\left(a_{i}=1, \mathbf{a}_{-i}\right), & a_{i}=1 \\ -v_{i} \mathcal{I}_{i}\left(a_{i}=0, \mathbf{a}_{-i}\right), & a_{i}=0\end{array}\right. $$} where recall that $v_{i} \ge 0$ is user’s value of privacy. We also express the monopoly platform’s payoff more compactly as {\setlength\abovedisplayskip{1 pt} \setlength\belowdisplayskip{1 pt}\begin{equation} U(\mathbf{a}, \mathbf{p})=\sum_{i \in \mathcal{V}} \mathcal{I}_{i}(\mathbf{a})-\sum_{i \in \mathcal{V}: a_{i}=1} p_{i} \end{equation} } An action profile $a = (a_1,...,a_n)$ of the strategic users and a price vector $p = (p_1,...,p_n)$ for the users constitute a pure strategy equilibrium of the user-platform game if both users and the community platform maximize their payoffs given other players’ strategies. More formally, we define an equilibrium of this game as a \emph{Stackelberg equilibrium} in which the monopoly platform chooses the price vector recognizing the user equilibrium that will result following this choice. \begin{definition} \emph{Given the price vector \(\mathbf{p}=\left(p_{1}, \ldots, p_{n}\right),\) an action profile \(\mathbf{a}=\left(a_{1}, \ldots, a_{n}\right)\) is user equilibrium if for all \(i \in \mathcal{V}\), {\setlength\abovedisplayskip{-2pt} \setlength\belowdisplayskip{2pt}$$ a_{i} \in \operatorname{argmax}_{a \in\{0,1\}} u_{i}\left(a_{i}=a, \mathbf{a}_{-i}, \mathbf{p}\right). $$}} \end{definition} We denote the set of user equilibria at a given price vector \(\mathbf{p}\) by \(\mathcal{A}(\mathbf{p})\). A pair \(\left(\mathbf{p}^{\mathrm{E}}, \mathbf{a}^{\mathrm{E}}\right)\) of price and action vectors is a pure strategy Stackelberg equilibrium if \(\mathbf{a}^{\mathrm{E}} \in \mathcal{A}\left(\mathbf{p}^{\mathrm{E}}\right)\) and there is no profitable deviation for the platform, i.e., {\setlength\abovedisplayskip{1pt} \setlength\belowdisplayskip{0pt}$$ U\left(\mathbf{a}^{\mathrm{E}}, \mathbf{p}^{\mathrm{E}}\right) \geq U(\mathbf{a}, \mathbf{p}), \; {\rm for \; all \;} \mathbf{p} {\rm \;and \; for \; all \; } \mathbf{a} \in \mathcal{A}(\mathbf{p}) $$} In what follows, we refer to a pure strategy Stackelberg equilibrium simply as an equilibrium. We now characterize two important properties of the breached information function \(\mathcal{I}_{i}\) : \(\{0,1\}^{n} \rightarrow \mathbf{R}\). \\ 1. \emph{Monotonicity:} for two action profiles $\textbf{a}$ and $\textbf{a}'$ with $\textbf{a}$ \(\geq\) $\textbf{a}'$ {\setlength\abovedisplayskip{2pt} \setlength\belowdisplayskip{2pt}$$ \mathcal{I}_{i}(\mathbf{a}) \geq \mathcal{I}_{i}\left(\mathbf{a}^{\prime}\right), \quad \forall i \in\{1, \ldots, n\} $$} 2. \emph{Submodularity:} for two profiles $\textbf{a}$ and $\textbf{a}'$ with $\mathbf{a'}_{-i} \ge \mathbf{a}_{-i}$, {\setlength\abovedisplayskip{2pt} \setlength\belowdisplayskip{2pt}{\small $$ \mathcal{I}_{i}\left(a_{i}=1, \mathbf{a}_{-i}\right)-\mathcal{I}_{i}\left(a_{i}=0, \mathbf{a}_{-i}\right) \geq \mathcal{I}_{i}\left(a_{i}=1, \mathbf{a}_{-i}^{\prime}\right)-\mathcal{I}_{i}\left(a_{i}=0, \mathbf{a}_{-i}^{\prime}\right) $$ }} The monotonicity property states that as the set of community users who share their information expands, the breached information about each user (weakly) increases. This is an intuitive consequence of the fact that more information always facilitates the estimation problem of the platform and reduces the mean square error of its estimates. More important for the rest of our analysis is the submodularity property, which implies that the marginal increase in the breached information from individual $i$’s sharing decision is decreasing in the information shared by others. This too is intuitive and follows from the fact that when others’ actions reveal more information, there is less to be revealed by the sharing decision of any given individual. Thus, from the celebrated result due to Topkis \cite{topkis1978minimizing}, for any $\mathbf{p}$, the set \(\mathcal{A}(\mathbf{p})\) is a complete lattice, and thus has a least and a greatest element. This implies that the set of user equilibria is always non-empty. \section{Monopoly Market Analysis} Enroute to analyzing the market welfare generated via the aforementioned game setting, we first define the benchmark \emph{first best} welfare outcome as the data sharing decisions that maximize utilitarian social welfare or social surplus given by the sum of the payoffs of the platform and users. Social surplus (SoS) from an action profile \textbf{a} is \[ SoS(\textbf{a})=U(\mathbf{a}, \mathbf{p})+\sum_{i \in \mathcal{V}} u_{i}(\mathbf{a}, \mathbf{p})=\sum_{i \in \mathcal{V}}\left(1-v_{i}\right) \mathcal{I}_{i}(\mathbf{a})\] Note that prices do not appear in this expression because they are transfers from the community platform to users. The first-best action profile, $\textbf{a}^{W}$, maximizes this expression. The following theorem (built on \cite{acemoglu2019too}) characterizes the first-best action profile. \begin{theorem}\label{Proposition-one} (due to \cite{acemoglu2019too}) \emph{The first best involves \(a_{i}^{\mathrm{W}}=1\) if {\setlength\abovedisplayskip{1 pt} \setlength\belowdisplayskip{1 pt} \begin{equation} \sum_{j \in \mathcal{V}}\left(1-v_{j}\right) \frac{\left({\rm Cov}\left(X_{i}, X_{j} | a_{i}=0, \mathbf{a}_{-i}^{\mathrm{W}}\right)\right)^{2}}{1+\sigma_{j}^{2}-\mathcal{I}_{j}\left(a_{i}=0, \mathbf{a}_{-i}^{\mathrm{W}}\right)} \geq 0 \end{equation} } and \(a_{i}^{\mathrm{W}}=0\) if (3) is negative.} \end{theorem} \textbf{Implication} - To understand this result, consider first the case in which there are no data externalities so that the covariance terms in (3) are zero, except \({\rm Cov}\left(X_{i}, X_{i} | a_{i}=0, \mathbf{a}_{-i}^{\mathrm{W}}\right)=\sigma_{i}^{2}\), so that the left-hand side is simply \(\sigma_{i}^{4} /\left(1+\sigma_{i}^{2}\right)\) times $1- v_i$. This yields $a^W_i = 1$ if $v_i \le 1$ (thus a no externality setting becomes mathematically equivalent to case when all users do not value their privacy enough) . The situation is different in the presence of data externalities, because now the covariance terms are non-zero. In this case, an individual should optimally share her data only if it does not reveal too much about users with $v_j > 1$. Note here that the covariance matrix can be robustly estimated from publicly observed $S_{i}$ values as dependencies are usually preserved in the addition of noise within a threshold. In this section, we adopt the more realistic assumption that, to start with, the monopoly platform does not know the exact valuations of users in a community (in contrast to assumptions made in existing works such as \cite{wang2016value}) that are only private to them, but are informed that the valuations $v_{i}$ come from the cumulative distribution function $F_{i}$ and density function $f_{i}$ (with upper support denoted by $v_{\max}$). We allow the platform to design a pricing mechanism that elicits the true privacy valuations from the users \emph{(as Step 1 of the economy)}, somewhat similar to the seminal Vickrey-Clarkes-Groves (VCG) mechanism with a minor variation. More specifically, for any user $i \in \mathcal{V}$ the price offered to user $i$ \emph{(as Step 2 of the economy)} is equal to the surplus of all other users on the platform when user $i$ is present minus by the surplus when user $i$ is absent. We consequently have the following result. \begin{theorem}\label{eight} (due to \cite{acemoglu2019too}) \emph{Let $\mathbf{v}$ be the reported vector of values of privacy. Then the non-negative pricing scheme} \emph{ \begin{equation*} p_{i}(\mathbf{v})=\left(\mathcal{I}_{i}(\mathbf{a}(\mathbf{v}))+\sum_{j \neq i}\left(1-v_{j}\right) \mathcal{I}_{j}(\mathbf{a}(\mathbf{v}))\right) -\min _{\mathbf{a} \in\{0,1\}^{n}}\left(\mathcal{I}_{i}(\mathbf{a})+\sum_{j \neq i}\left(1-v_{j}\right) \mathcal{I}_{j}(\mathbf{a})\right) \end{equation*}} \emph{where $\mathbf{a}(\mathbf{v})=\arg \max _{\mathbf{a} \in\{0,1\}^{n}} \sum_{i \in \mathcal{V}}\left(1-v_{i}\right) \mathcal{I}_{i}(\mathbf{a})$ incentivizes users to report their value of privacy truthfully.} \end{theorem} \begin{definition} \emph{An equilibrium is a pair \(\left(\mathbf{a}^{\mathrm{E}}, \mathbf{p}^{\mathrm{E}}\right)\) of functions of the reported valuations \(\mathbf{v}=\) \(\left(v_{1}, \ldots, v_{n}\right)\) such that each user reports its true value and the expected payoff of the platform is maximized. That is}, {{ \begin{equation*} \begin{split}&\left(\mathbf{a}^{\mathrm{E}}, \mathbf{p}^{\mathrm{E}}\right)= \max _{\mathbf{a}: \mathbb{R}^{n} \rightarrow\{0,1\}^{n}, \mathbf{p}: \mathbb{R}^{n} \rightarrow \mathbb{R}^{n}} \mathbb{E}_{\mathbf{v}}\left[\sum_{i=1}^{n} \mathcal{I}_{i}(\mathbf{a}(\mathbf{v}))-\sum_{i: a_{i}(\mathbf{v})=1} p_{i}(\mathbf{v})\right] \\ & p_{i}(\mathbf{v})-v_{i} \mathcal{I}_{i}(\mathbf{a}(\mathbf{v})) \geq p_{i}\left(\mathbf{v}_{-i}, v_{i}^{\prime}\right)-v_{i} \mathcal{I}_{i}\left(\mathbf{a}\left(\mathbf{v}_{-i}, v_{i}^{\prime}\right)\right), \forall v_{i}^{\prime}, \mathbf{v}: i \in \mathcal{V} \end{split} \end{equation*}}} \end{definition} We now have the following theorem characterizing the equilibrium of the monopoly market setting. \begin{theorem}\label{eleven} (due to \cite{acemoglu2019too}) \emph{For any reported vector of values v, the market equilibrium is given by} \emph{ \begin{equation*} \mathbf{a}^{\mathrm{E}}(\mathbf{v})=\operatorname{argmax}_{\mathbf{a} \in\{0,1\}^{n}} \sum_{i=1}^{n}\left(1-\Phi_{i}\left(v_{i}\right)\right) \mathcal{I}_{i}(\mathbf{a}) +\Phi_{i}\left(v_{i}\right) \mathcal{I}_{i}\left(\mathbf{a}_{-i}, a_{i}=0\right) \end{equation*} } \emph{and} { \begin{equation*} p_{i}^{\mathrm{E}}\left(v_{i}\right)= \int_{v}^{v_{\max }} \left(\mathcal{I}_{i}\left(\mathbf{a}^{\mathrm{E}}\left(x, \mathbf{v}_{-i})\right)-\mathcal{I}_{i}\left(\mathbf{a}_{-i}^{\mathrm{E}}\left(x, \mathbf{v}_{-i} \right), a_{i}=0\right)\right)\right) d x +v_{i}\left(\mathcal{I}_{i}\left(\mathbf{a}^{\mathrm{E}}\left(v_{i}, \mathbf{v}_{-i}\right)\right)-\mathcal{I}_{i}\left(\mathbf{a}_{-i}^{\mathrm{E}}\left(v_{i}, \mathbf{v}_{-i}\right), a_{i}=0\right)\right) \end{equation*} } \emph{Moreover, all users report truthfully and thus the expected payoff of the platform is} {$$ \mathbb{E}_{\mathbf{v}}\left[\max _{\mathbf{a} \in\{0,1\}^{n}} \sum_{i=1}^{n}\left(1-\Phi_{i}\left(v_{i}\right)\right) \mathcal{I}_{i}(\mathbf{a})+\Phi_{i}\left(v_{i}\right) \mathcal{I}_{i}\left(\mathbf{a}_{-i}, a_{i}=0\right)\right] $$} \emph{where, $\Phi_{i}(v) = v + \frac{F_{i}(v)}{f_{i}(v)}$ is a non-decreasing function representing the additional rent that a user will capture in incentive compatible mechanisms.} \end{theorem} \textbf{Implication} - The theorem guarantees the existence of a unique monopoly market equilibrium where community platform users elicit their true valuations. A sufficient condition for $\Phi_{i}(v)$ to be non-decreasing is for $\frac{f_{i}(v)}{F_{i}(v)}$ to be non-increasing. This requirement is satisfied for a variety of distributions such as uniform and exponential \cite{burkschat2014reversed}. We now investigate whether the reachable market equilibrium is efficient. We have the following result, via \cite{acemoglu2019too}, in this regard. \begin{theorem}\label{twelve} (due to \cite{acemoglu2019too}) \emph{1. Suppose high-value users are uncorrelated with all other users and $\mathcal{V}^{(l)}=\mathcal{V}_{\Phi}^{(l)}$, where $\mathcal{V}_{\Phi}^{(l)}=\left\{i \in \mathcal{V}: \Phi_{i}\left(v_{i}\right) \leq 1\right\}$ denotes the set of users with $\Phi_{i}(v_{i}) \le 1$. Then the market equilibrium is \textbf{efficient}.\\ 2. Suppose some high-value users (those in $\mathcal{V}^{(h)}$) are correlated with users in $v_{\phi}^{(l)}$. Then there exists $\overline{\mathfrak{v}} \in \mathbb{R}^{| V(n) |}$ such that for $\mathbf{v}^{(h)} \geq \overline{\mathbf{v}}$ the market equilibrium is \textbf{inefficient}.\\ 3. Suppose every high-value user is uncorrelated with all users in $\mathcal{V}_{\phi}^{(l)},$ but users in a nonempty subset $\hat{\mathcal{V}}^{(l)}$ of $\mathcal{V}^{(l)} \backslash \mathcal{V}_{\phi}^{(l)}$ are correlated with at least one high-value user. Then there exist $\overline{\mathbf{v}}$ and $\tilde{v}$ such that if $\mathbf{v}^{(h)} \geq \overline{\mathbf{v}}$ and $v_{i}<\tilde{v}$ for some $i \in \hat{\mathcal{V}}^{(l)}$, the market equilibrium is \textbf{inefficient}.\\ 4. Suppose every high-value user is uncorrelated with all low-value users and at least one high-value user is correlated with another high-value user. Let $\tilde{\mathcal{V}}^{(h)} \subseteq \mathcal{V}^{(h)}$ be the subset of high-value users correlated with at least one other high-value user. Then for each $i \in \tilde{\mathcal{V}}^{(h)}$ there exists $\bar{v}_{i}>0$ such that if for any $i \in \tilde{\mathcal{V}}^{(h)} v_{i}<\bar{v}_{i},$ the market equilibrium is \textbf{inefficient}.\\ 5.The social surplus at market equilibrium, $\mathbf{a}^{\mathrm{E}}$, for any \textbf{v} (either known truthfully or otherwise) \[SoS\left(\mathbf{a}^{\mathrm{E}}\right) \leq \sum_{i: v_{i} \in \mathcal{V}^{(l)}}\left(1-v_{i}\right) \mathcal{I}_{i}(\mathcal{V})-\sum_{i: v_{i} \in \mathcal{V}^{(h)}}\left(v_{i}-1\right) \mathcal{I}_{i}\left(\mathcal{V}_{\phi}^{(l)}\right)\]} \end{theorem} \textbf{Implication} - The theorem provides the conditions under which market equilibrium in a monopoly community information trading setting is utilitarian welfare (in)efficient. Note that the market efficiency results in the theorem are conservative in the sense we assume user privacy valuations are unknown in the worst case, and the platform does its best to elicit true valuation responses. Inefficiency in this setting would imply inefficiency in the case where community user valuations are untruthful (see point \#5 in the theorem). According to the points in the theorem, it is evident that the information trading market is efficient is when high-value users (those with both $v_{i}, \Phi_{i}(v_{i}) \ge 1$ are uncorrelated with all other users - something practically rare to achieve, and low-value users have $\Phi_{i}(v_{i})$ values less than one (note here that low-value users always have $v_{i} <1$ but could have $\Phi_{i}(v_{i})$ values greater than 1). Not satisfying either will lead to incentive compatibility conditions preventing efficient allocation. In all other cases, the information trading market is inefficient (SoS at equilibrium is not optimal), and the extent of inefficiency depends on whether high-value users are correlated with low-value users with $\Phi_{i}(v_{i})$ values greater or less than one. \section{Examples} In this section, we provide numerical examples (as in \cite{acemoglu2019too}) to lucidly illustrate (a) the existence of a data trading market equilibrium, and (b) the social surplus (SoS) zone at market equilibrium. \noindent\textbf{Example 1. \label{example1} Suppose there are two users 1 and 2 with covariance matrix $\Sigma=\left(\begin{array}{lr}1 & \rho \\ \rho & 1\end{array}\right)$ and \(v_{1}=v_{2}=v .\) When \(p_{1}, p_{2} \in\left[\frac{\left(2-\rho^{2}\right)^{2}}{2\left(4-\rho^{2}\right)}, \frac{1}{2}\right],\) both action profiles \(a_{1}=a_{2}=0\) and \(a_{1}=a_{2}=1\) are user equilibria. This is a consequence of the submodularity of the leaked information functio : when user 1 shares her data, she is also revealing a lot about user 2 , and making it less costly for her to share her data. Conversely, when user 1 does not share, this encourages user 2 not to share. Despite this multiplicity of user equilibria, there exists a unique (Stackelberg) equilibrium for this game given by \(a_{1}^{\mathrm{E}}=a_{2}^{\mathrm{E}}=1\) and \(p_{1}^{\mathrm{E}}=p_{2}^{\mathrm{E}}=\frac{\left(2-\rho^{2}\right)^{2}}{2\left(4-\rho^{2}\right)} .\) This uniqueness follows because the platform can choose the price vector to encourage both users to share. \emph{The next example suggests that though there may be multiple equilibria in the Stackelberg game, all of them yield the same payoff for the community platform.} \noindent\textbf{Example 2. \label{example2} Suppose there are three users with the same value of privacy and variance: \(v_i = 1.18\) and \(\sigma_{i}^{2}=1\) for \(i=1,2,3 .\) We let all off-diagonal entries of \(\Sigma\) to be \(0.3 .\) Any action profile where two out of three users share their information is an equilibrium, and thus there are three distinct equilibria. But it is straightforward to verify that they all yield the same payoff to the platform. The following example illustrates the social welfare zone at market equilibrium with variations in the correlation coefficient $\rho$ and privacy valuation for high-value community users. \noindent\textbf{Example 3. \label{example4} We consider a setting with two communities, each of size 10. Suppose that all users in community 1 are low-value and have a value of privacy equal to 0.9, while all users in community 2 are high-value (with \(v_{h}>1\) ). We also take the variances of all user data to be 1, the correlation between any two users who belong to the same community to be 1/20, and the correlation be- tween any two users who belong to different communities to be \(\rho\). depicts equilibrium surplus as a function of \(v_{h}\) and \(\rho\). \noindent \emph{Two points are worth noting from this example. First, relatively small values of the correlation coefficient \(\rho\) are sufficient for social surplus to be negative. Second, when \(v_{h}\) is very close to 1, the social surplus is always positive because the negative surplus from high-value users is compensated by the social benefits their data sharing creates for low-value users.} \section{Conclusion} In this paper, we mathematically argued, using recent developments in \cite{acemoglu2019too}, that social community data trading is not economically welfare efficient in a monopoly market setting, going against the popular economic philosophy/intuition that increased amounts of end-user data signals in a market improves utilitarian social welfare. The primary reason behind our result is the significant negative externality (via user signal correlations) generated by privacy breaches in the information market that cannot be cancelled out via market equilibrium prices handed over to the users for their information. \section{Acknowledgement} This work NSF-supported under grants CNS-1616575, CNS-1939006, CNS-2012001, and ARO W911NF1810208. \bibliographystyle{unsrt}
{'timestamp': '2021-11-25T02:08:19', 'yymm': '2012', 'arxiv_id': '2012.08729', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08729'}
arxiv
\section{Proof of Theorem \ref{thm:master_W2}}\label{sec proof thm 1} \noindent\textbf{Notation.}~For the reader's convenience, we recall some necessary notation from Section \ref{sec main}. We say that a function $f:\mathbb{R}^m\rightarrow\mathbb{R}$ is pseudo-Lipschitz of order $k$, denoted $f\in\rm{PL}(k)$, if there is a constant $L>0$ such that for all $\vct{x},\vct{y}\in\mathbb{R}^m$, $ |f(\vct{x}) - f(\vct{y})|\leq L(1+\tn{\vct{x}}^{k-1}+\tn{\vct{y}}^{k-1})\|\vct{x}-\vct{y}\|_2 $ (See also Section \ref{SM useful fact}). We say that a sequence of probability distributions $\nu_p$ on $\mathbb{R}^m$ {converges in $W_k$} to $\nu$, written $\nu_p\stackrel{W_k}{\Longrightarrow} \nu$, if $W_k(\nu_p,\nu) \rightarrow 0$ as $p \rightarrow \infty$. An equivalent definition is that, for any $f\in\rm{PL}(k)$, $\lim_{p\rightarrow}\operatorname{\mathbb{E}} f(X_p)=\operatorname{\mathbb{E}} f(X)$, where expectation is with respect to $X_p\sim\nu_p$ and $X\sim\nu$ (e.g., \cite{montanari2017estimation}). For a sequence of random variables $\mathcal{X}_{p}$ that converge in probability to some constant $c$ in the limit of Assumption \ref{ass:linear} below, we write $\mathcal{X}_{p}\stackrel{{P}}{\longrightarrow} c$. For a sequence of event $\mathcal{E}_p$ for which $\lim_{p\rightarrow}\mathbb{P}(\mathcal{E}_p) = 1$, we say that $\mathcal{E}_p$ occurs \emph{with probability approaching 1}. For this, we will often use the shorthand ``wpa. 1". \vspace{5pt} Let ${\mtx{X}}\in\mathbb{R}^{n\times p}$ have zero-mean and normally distributed rows with a diagonal covariance matrix ${\boldsymbol{{\Sigma}}}=\operatorname{\mathbb{E}}[\vct{x}\x^T]$. Given a ground-truth vector $\betab^\star$ and labels $\vct{y}={\mtx{X}}\betab^\star+\sigma {\vct{z}},~{\vct{z}}\sim\mathcal{N}(0,{\mtx{I}}_n)$, we consider the least-squares problem subject to the minimum Euclidian norm constraint (as $\kappa=p/n>1$) given by \begin{align}\label{eq:PO_beta} \min_{{\boldsymbol{\beta}}}\frac{1}{2}\tn{{\boldsymbol{\beta}}}^2\quad\text{subject to}\quad \vct{y}={\mtx{X}}{\boldsymbol{\beta}}. \end{align} It is more convenient to work with the following change of variable: $\vct{w}:=\sqrt{\boldsymbol{\Sigma}}({\boldsymbol{\beta}}-\betab^\star)$. With this, the optimization problem in \eqref{eq:min_norm} can be rewritten as \begin{align}\label{eq:PO} \Phi({\mtx{X}})=\min_{\vct{w}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad {\mtx{\bar{X}}}\vct{w}=\sigma {\vct{z}}, \end{align} where we write ${\mtx{\bar{X}}}={\mtx{X}}\boldsymbol{\Sigma}^{-1/2}\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,1)$. First, using standard arguments, we show that the solution of \eqref{eq:PO} is bounded. Hence, we can constraint the optimization in a sufficiently large compact set without loss of generality. \begin{lemma}[Boundedness of solution]\label{lem:bd_PO} Let $\hat\vct{w}_n:=\hat\vct{w}_n({\mtx{X}},{\vct{z}})$ be the minimizer in \eqref{eq:PO}. Then, with probability approaching 1, it holds that $\hat\vct{w}_n\in\mathcal{B}$, where $$\mathcal{B}:=\left\{\vct{w}\,|\,\|\vct{w}\|_2\leq B_{+} \right\},\qquad B_+:=4\sqrt{\Sigma_{\max}}\frac{2(\sqrt{\kappa}+1)\sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}\left[B^2\right]} + \sigma}{\sqrt{\Sigma_{\min}}(\sqrt{\kappa}-1)} + \sqrt{\Sigma_{\max}}\sqrt{\operatorname{\mathbb{E}}\left[B^2\right]}. $$ \end{lemma} \begin{proof} First, we show that the min-norm solution $\hat\boldsymbol{\beta}={\mtx{X}}^T({\mtx{X}}\X^T)^{-1}\vct{y}$ of \eqref{eq:PO_beta} is bounded. Here, we used the fact that $\kappa>1$, thus ${\mtx{X}}\X^T$ is invertible wpa 1. We have, \begin{align} \tn{\hat\boldsymbol{\beta}_n}^2 = \vct{y}^T({\mtx{X}}\X^T)^{-1}\vct{y} \leq \frac{\tn{\vct{y}}^2}{\lambda_{\min}({\mtx{X}}\X^T)} = \frac{\tn{\vct{y}}^2}{\lambda_{\min}({\mtx{\bar{X}}}\boldsymbol{\Sigma}{\mtx{\bar{X}}}^T)} \leq \frac{\tn{\vct{y}}^2}{\lambda_{\min}({\mtx{\bar{X}}}\Xb^T)\,\Sigma_{\min}} = \frac{\tn{\vct{y}}^2}{\sigma_{\min}^2({\mtx{\bar{X}}})\,\Sigma_{\min}}. \label{eq:Ubb} \end{align} But, wpa 1, $ \sigma_{\min}({\mtx{\bar{X}}})/\sqrt{n} \geq \frac{1}{2}\left(\sqrt{\kappa}-1\right). $ Furthermore, $ \|\vct{y}\|_2 \leq \|{\mtx{\bar{X}}}\boldsymbol{\Sigma}^{1/2}\betab^\star\|_2 + \sigma\|{\vct{z}}\|_2 \leq \sigma_{\max}({\mtx{\bar{X}}})\sqrt{\Sigma_{\max}} \|\betab^\star\|_2 + \sigma\|{\vct{z}}\|_2. $ Hence, wpa 1, $$ \|\vct{y}\|_2/\sqrt{n} \leq 4(\sqrt{\kappa}+1)\sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}\left[B^2\right]} + 2\sigma, $$ where we used the facts that wpa 1: $\|z\|_2/\sqrt{n}\stackrel{{P}}{\longrightarrow} 1$, $\sigma_{\max}({\mtx{\bar{X}}})<2(\sqrt{\kappa}+1)$ and by Assumption \ref{ass:mu}: $$ \|\betab^\star\|_2^2 = \frac{1}{p}\sum_{i=1}^{p}(\sqrt{p}\betab^\star_i)^2 \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}\left[B^2\right]. $$ Put together in \eqref{eq:Ubb}, shows that \begin{align} \tn{\hat\boldsymbol{\beta}_n} < \frac{4(\sqrt{\kappa}+1)\sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}\left[B^2\right]} + 2\sigma}{\sqrt{\Sigma_{\min}}(\sqrt{\kappa}-1)/2} =: \tilde{B}_+.\label{eq:bd_beta} \end{align} Recalling that $\hat\vct{w}_n= \sqrt{\boldsymbol{\Sigma}}\boldsymbol{\beta} - \sqrt{\boldsymbol{\Sigma}}\betab^\star$, we conclude, as desired, that wpa 1, $ \tn{\hat\vct{w}_n} \leq \sqrt{\Sigma_{\max}}\tilde{B}_+ + \sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}[B^2]} =: B_+. $ \end{proof} Lemma \ref{lem:bd_PO} implies that nothing changes in \eqref{eq:PO} if we further constrain $\vct{w}\in\mathcal{B}$ in \eqref{eq:PO}. Henceforth, with some abuse of notation, we let \begin{align}\label{eq:PO_bd} \Phi({\mtx{X}}):=\min_{\vct{w}\in\mathcal{B}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad {\mtx{\bar{X}}}\vct{w}=\sigma {\vct{z}}, \end{align} Next, in order to analyze the primary optimization (PO) problem in \eqref{eq:PO_bd} in apply the CGMT \cite{thrampoulidis2015lasso}. Specifically, we use the constrained formulation of the CGMT, Theorem \ref{thm closed}. Specifically, the auxiliary problem (AO) corresponding to \eqref{eq:PO_bd} takes the following form with ${\vct{g}}\sim\mathcal{N}(0,{\mtx{I}}_n)$, $\vct{h}\sim\mathcal{N}(0,{\mtx{I}}_p)$, $h\sim \mathcal{N}(0,1)$ \begin{align} \phi({\vct{g}},\vct{h}) = \min_{\vct{w}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad \tn{{\vct{g}}}\tn{\vct{w}~{\sigma}}\leq \vct{h}^T\vct{w}+\sigma h.\label{eq:AO_con} \end{align We will prove the following result about the AO problem. \begin{lemma}[Properties of the AO -- Overparameterized regime]\label{lem:AO} Let $\phi_n=\phi({\vct{g}},\vct{h})$ be the optimal cost of the minimization in \eqref{eq:AO_con}. Define $\bar\phi$ as the optimal cost of the following deterministic min-max problem \begin{align}\label{eq:AO_det} \bar\phi:=\max_{u\geq 0}\min_{\tau>0}~ \mathcal{D}(u,\tau):=\frac{1}{2}\left({u\tau} + \frac{u\sigma^2}{\tau} - u^2\kappa\,\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] - \operatorname{\mathbb{E}}\left[\frac{N^2}{\Lambda^{-1}+\frac{u}{\tau}}\right] \right). \end{align} The following statements are true. \noindent{(i).}~The AO minimization in \eqref{eq:AO_con} is $\frac{1}{\Sigma_{\max}}$-strongly convex and has a unique minimizer $\vct{w}_n:=\vct{w}_n({\vct{g}},\vct{h})$. \noindent{(ii).}~In the limit of $n,p\rightarrow\infty, p/n=\kappa$, it holds that $\phi({\vct{g}},\vct{h})\stackrel{{P}}{\longrightarrow}\bar\phi$, i.e., for any $\varepsilon>0$: $$ \lim_{n\rightarrow\infty}\P\left(|\phi({\vct{g}},\vct{h})-\bar\phi|>\varepsilon\right) = 0. $$ \noindent{(iii).} The max-min optimization in \eqref{eq:AO_det} has a unique saddle point $(u_*,\tau*)$ satisfying the following: $$ u_*/\tau_* = \xi\quad\text{and}\quad\tau_* = \gamma, $$ where $\xi, \gamma>0$ are defined in Definition \ref{def:Xi}. \noindent{(iv).}~Let $f:\mathbb{R}\rightarrow\mathbb{R}$ be a $\rm{PL}({k})$ function. Let $\boldsymbol{\beta}_n=\boldsymbol{\Sigma}^{-1/2}\vct{w}_n + \betab^\star$. Then, $$ \frac{1}{p}\sum_{i=1}^{p}f\left(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}\right) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{(B,\Lambda,H)\sim\mu\otimes \mathcal{N}(0,1)}\left[f\left(X_{\kappa,\sigma^2}(B,\Lambda,H),B,\Lambda\right) \right]. $$ \end{lemma} We prove Lemma \ref{lem:AO} in Section \ref{sec:proofAO}. Here, we show how this leads to the proof of Theorem \ref{thm:master_W2} when combined with the CGMT. \noindent\textbf{Finishing the proof of Theorem \ref{thm:master_W2}:} For convenience, define $$F_n(\hat\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma}):=\frac{1}{p} \sum_{i=1}^{p} f\left(\sqrt{p}\hat\boldsymbol{\beta}_{n,i},\sqrt{p}\betab^\star_{i},\boldsymbol{\Sigma}_{ii}\right)\quad\text{and}\quad\alpha_*:=\operatorname{\mathbb{E}}_\mu\left[f(X_{\kappa,\sigma^2}(\Lambda,B,H),B,\Lambda)\right].$$ Fix any $\varepsilon>0$. It suffices to prove that the solution $\hat\boldsymbol{\beta}_n$ of the PO in \eqref{eq:PO_beta} satisfies $\hat\boldsymbol{\beta}_n\not\in\mathcal{S}$ wpa. 1, where \begin{align}\label{eq:S_set} \mathcal{S} = \mathcal{S}(\betab^\star,\boldsymbol{\Sigma}) =\{\boldsymbol{\beta}{~\big |~} |F_n(\hat\boldsymbol{\beta}_n,\betab^\star,\boldsymbol{\Sigma})-\alpha_*|\geq 2\varepsilon\}. \end{align} In particular, define the ``perturbed" PO and AO problems (compare to \eqref{eq:PO} and \eqref{eq:AO_con}) as: \begin{align}\label{eq:PO_S} \Phi_S({\mtx{X}})=\min_{\vct{w}\in\mathcal{S}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad {\mtx{\bar{X}}}\vct{w}=\sigma {\vct{z}}, \end{align} and \begin{align} \phi_S({\vct{g}},\vct{h})=\min_{\vct{w}\in\mathcal{S}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad \tn{{\vct{g}}}\tn{\vct{w}~{\sigma}}\leq \vct{h}^T\vct{w}+\sigma h.\label{eq:AO_S} \end{align where recall that ${\mtx{\bar{X}}}={\mtx{X}}\boldsymbol{\Sigma}^{-1/2}\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,1)$, ${\vct{g}}\sim\mathcal{N}(0,{\mtx{I}}_n)$, $\vct{h}\sim\mathcal{N}(0,{\mtx{I}}_p)$, $h\sim \mathcal{N}(0,1)$ and we have used the change of variables $\vct{w}:=\sqrt{\boldsymbol{\Sigma}}(\boldsymbol{\beta}-\betab^\star)$ for convenience. Using \cite[Theorem 6.1(iii)]{thrampoulidis2018precise} it suffices to find costants $\bar\phi, \bar\phi_S$ and $\eta>0$ such that the following hold: \begin{enumerate} \item $\bar\phi_S \geq \bar\phi + 3\eta$, \item $\phi({\vct{g}},\vct{h}) \leq \bar\phi + \eta$, with probability approaching 1, \item $\phi_S({\vct{g}},\vct{h}) \geq \bar\phi_S - \eta$, with probability approaching 1. \end{enumerate} In what follows, we explicitly find $\bar\phi, \bar\phi_S,\eta$ such that the three conditions above hold. \vspace{5pt} \noindent\underline{Satisfying Condition 2}: Recall the deterministic min-max optimization in \eqref{eq:AO_det}. Choose $\bar\phi=\mathcal{D}(u_*,\tau_*)$ be the optimal cost of this optimization. From Lemma \ref{lem:AO}(ii), $\phi({\vct{g}},\vct{h})\stackrel{{P}}{\longrightarrow}\bar\phi$. Thus, for any $\eta>0$, with probability approaching 1: \begin{align}\label{eq:phi_lim} \bar\phi + \eta \geq \phi({\vct{g}},\vct{h}) \geq \bar\phi - \eta. \end{align} Clearly then, Condition 2 above holds for any $\eta>0$. \vspace{5pt} \noindent\underline{Satisfying Condition 3}: Next, we will show that the third condition holds for appropriate $\bar\phi$. Let $\vct{w}_n=\vct{w}_n({\vct{g}},\vct{h})$ be the unique minimizer of \eqref{eq:AO_con} as per Lemma \ref{lem:AO}(i), i.e., $\frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}_n+{\boldsymbol{\beta}}^\star}^2 = \phi({\vct{g}},\vct{h})$. Again from Lemma \ref{lem:AO}, the minimization in \eqref{eq:AO_con} is $1/\Sigma_{\max}$-strongly convex in $\vct{w}$. Here, $\Sigma_{\max}$ is the upper bound on the eigenvalues of $\boldsymbol{\Sigma}$ as per Assumption \ref{ass:inv}. Thus, for any $\tilde\varepsilon>0$ and any feasible $\vct{w}$ the following holds (deterministically): \begin{align}\label{eq:sc} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+{\boldsymbol{\beta}}^\star}^2 \geq \phi({\vct{g}},\vct{h}) + \frac{\tilde\epsilon^2}{2C},~\text{provided that}~ \|\vct{w}-\vct{w}_n({\vct{g}},\vct{h})\|_2 \geq \tilde\epsilon. \end{align} Now, we argue that $\boldsymbol{\beta}\in\mathcal{S}$ implies that $\|\vct{w}-\vct{w}_n({\vct{g}},\vct{h})\|_2\geq \tilde\varepsilon$ wpa 1, for appropriate value of $\tilde\varepsilon$ and $\vct{w}=\sqrt{\boldsymbol{\Sigma}}(\boldsymbol{\beta}-\betab^\star)$. Consider any $\boldsymbol{\beta}\in\mathcal{S}$. First, by definition in \eqref{eq:S_set}, $$ |F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})-\alpha_*| \geq 2\varepsilon. $$ Second, by Lemma \ref{lem:AO}(iv), with probability approaching 1, $$ |F(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - \alpha_*| \leq \epsilon. $$ Third, we will show that wpa 1, there exists universal constant $C>0$ such that \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})| \leq C {\|\boldsymbol{\beta}_{n}({\vct{g}},\vct{h}) - \boldsymbol{\beta}\|_2}\label{eq:dev2show}. \end{align} Before proving \eqref{eq:dev2show}, let us argue how combining the above three displays shows the desired. Indeed, wpa. 1, \begin{align*} 2\varepsilon &\leq |F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})-\alpha_*| \leq |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})| + |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - \alpha_*| \\ &\leq \epsilon + C \,\|\boldsymbol{\beta}-\boldsymbol{\beta}_n\|_2. \\ &\qquad\Longrightarrow \|\boldsymbol{\beta}-\boldsymbol{\beta}_n\|_2 \geq {\varepsilon}/{C}=:\hat\varepsilon\\ &\qquad\Longrightarrow \|\vct{w}-\vct{w}_n\|_2 \geq \hat\varepsilon\sqrt{\Sigma_{\min}}=:\tilde\varepsilon. \end{align*} In the last line above, we recalled that $\boldsymbol{\beta}=\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star$ and $\boldsymbol{\Sigma}_{i,i}\geq\Sigma_{\min},~i\in[p]$ by Assumption \ref{ass:inv}. From this and \eqref{eq:sc}, we find that wpa 1, $ \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\boldsymbol{\beta}}^2 \geq \phi({\vct{g}},\vct{h}) + \frac{\tilde\epsilon^2}{2C},~\text{for all}~ \vct{w}\in\mathcal{S}. $ Thus, \begin{align} \phi_S({\vct{g}},\vct{h}) \geq \phi({\vct{g}},\vct{h}) + \frac{\tilde\epsilon^2}{2\Sigma_{\max}}.\notag \end{align} When combined with \eqref{eq:phi_lim}, this shows that \begin{align} \phi_S({\vct{g}},\vct{h}) \geq \bar\phi + \frac{\tilde\epsilon^2}{2\Sigma_{\max}} - \eta. \end{align} Thus, choosing $\bar\phi_S = \bar\phi + \frac{\tilde\epsilon^2}{2\Sigma_{\max}}$ proves the Condition 3 above. To complete the proof, let us now show \eqref{eq:dev2show}. Henceforth, $C$ is used to denote a universal constant whose value can change from line to line. To simplify notation, let $\vct{a}_i=(\sqrt{p}\boldsymbol{\beta}_{n,i}({\vct{g}},\vct{h}),\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$ and $\vct{b}_i=(\sqrt{p}\boldsymbol{\beta}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$, for $i\in[p]$. Then, using $f\in\rm{PL}(k)$, \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})| &\leq \frac{L}{p}\sum_{i=1}^p (1+\max\{\|\vct{a}_i\|_2^{k-1},\|\vct{b}_i\|_2^{k-1}\})\|\vct{a}_i-\vct{b}_i\|_2\notag \\ &= \frac{L}{p}\sum_{i=1}^p \left(1+\max\{\|\vct{a}_i\|_2^{k-1},\|\vct{b}_i\|_2^{k-1}\}\right)\cdot|\sqrt{p}\boldsymbol{\beta}_{n,i}({\vct{g}},\vct{h}) - \sqrt{p}\boldsymbol{\beta}_i|\notag\\ &\leq L\left(1+\max\{\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2k-2},\frac{1}{p}\sum_{i=1}^p\|\vct{b}_i\|_2^{2k-2}\} \right)^{1/2}{\|\boldsymbol{\beta}_{n}({\vct{g}},\vct{h}) - \boldsymbol{\beta}\|_2}\label{eq:LipC}\,. \end{align} The last inequality above follows by applying Cauchy-Schwartz. To reach \eqref{eq:dev2show} from the above, it suffices to show that \begin{align} \max\{\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2k-2},\frac{1}{p}\sum_{i=1}^p\|\vct{b}_i\|_2^{2k-2}\} \leq C,\label{eq:leqC} \end{align} for some universal constant $C$ (that may depend on $k$, but not on $n,p$). To prove \eqref{eq:leqC}, note that using $a^{\ell_1}b^{\ell_2}c^{\ell_3}\leq a^{\ell}+b^{\ell}+c^\ell,~\ell=\ell_1+\ell_2+\ell_3$, for some constant $C=C(k)>0$ it holds: \begin{align} \frac{1}{p}\sum_{i=1}^p \|\vct{b}_i\|_2^{2k-2} {\leq} C\left(\frac{1}{p}\sum_{i=1}^p |\sqrt{p}\boldsymbol{\beta}_{i}|^{2k-2} + \frac{1}{p}\sum_{i=1}^p |\sqrt{p}\betab^\star_{i}|^{2k-2} + \frac{1}{p}\sum_{i=1}^p |\boldsymbol{\Sigma}_{i,i}|^{2k-2} \right)\label{eq:bdmom}\,. \end{align} \cts{The terms $\sum_{i=1}^p |\sqrt{p}\betab^\star_{i}|^{2k-2} $ and $ \frac{1}{p}\sum_{i=1}^p |\boldsymbol{\Sigma}_{i,i}|^{2k-2}$ are bounded by assumption}\ct{Need to add assumption that $ \frac{1}{p}\sum_{i=1}^p |\boldsymbol{\Sigma}_{i,i}|^{2k-2}<\infty$ and $\frac{1}{p}\sum_{i=1}^p (\sqrt{p}|\betab^\star_{i}|^{2k-2} $. OK by just assuming that $B$ is Definition \ref{def:Xi} is bounded.}. {\color{red}Furthermore we need to argue that, \begin{align} \frac{1}{p}\sum_{i=1}^p |\sqrt{p}\boldsymbol{\beta}_{i}|^{2k-2} <\infty \end{align} } These together with \eqref{eq:bdmom} show that $\frac{1}{p}\sum_{i=1}^p \|\vct{b}_i\|_2^{2k-2}<C$ wpa 1. Similarly, we can argue for $\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2k-2}$, completing the proof of \eqref{eq:leqC}. \vspace{5pt} \noindent\underline{Satisfying Condition 1:} To prove Condition 1, we simply pick $\eta$ to satisfy the following \begin{align} \bar\phi_S > \bar\phi + 3 \eta ~\Leftarrow~ \bar\phi + \frac{\tilde\epsilon^2}{2\Sigma_{\max}} - \eta \geq \bar\phi + 3 \eta ~\Leftarrow~ \eta \leq \frac{\tilde\epsilon^2}{8\Sigma_{\max}}. \end{align} This completes the proof of Theorem \ref{thm:master_W2}. \subsection{Proof of Lemma \ref{lem:AO}}\label{sec:proofAO} ~~~~ ~~~~ \vspace{3pt} \noindent\underline{Proof of (i):}~Strong convexity of the objective function in \eqref{eq:PO} is easily verified by the second derivative test. Note here that we use Assumption \ref{ass:inv} that $\bSi_{i,i}\leq\Sigma_{\max},~i\in[p].$ Uniqueness of the solution follows directly from strong convexity. \ct{Strictly speaking we might need to also argue existence, i.e., feasibility of the AO. An indirect way is to show feasibility using the CGMT, but it seems unnecessarily complicated?} \vspace{5pt} \noindent\underline{Proof of (ii):}~Using Lagrangian formulation, the solution $\vct{w}_n$ to \eqref{eq:AO_con} is the same as the solution to the following: \begin{align} \left(\vct{w}_n,u_n\right) :=\arg\min_{\vct{w}\in\mathcal{B}}\max_{u\geq 0} ~\frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2 + u \left( \sqrt{\tn{\vct{w}}^2+\sigma^2} \tn{\bar{\g}} - \sqrt{\kappa}\,{\bar{\h}}^T\vct{w} + \frac{\sigma h}{\sqrt{n}} \right)\label{eq:AO_2} \end{align} where we have: (i) set $\bar{\g} := {\vct{g}}/\sqrt{n}$ and $\bar{\h}:= \vct{h}/\sqrt{p}$; (ii) recalled that $p/n=\kappa$; and, (iii) used $\left(\vct{w}_n,u_n\right)$ to denote the optimal solutions in \eqref{eq:AO_2}. The subscript $n$ emphasizes the dependence of $\left(\vct{w}_n,u_n\right)$ on the problem dimensions. Also note that (even though not explicit in the notation) $\left(\vct{w}_n,u_n\right)$ are random variables depending on the realizations of $\bar{\g},\bar{\h}$ and $h$. Notice that the objective function above is convex in $\vct{w}$ and linear (thus, concave) in $u$. Thus, strong duality holds and we can flip the order of min-max. Moreover, in order to make the objective easy to optimize with respect to $\vct{w}$, we use the following variational expression for the square-root term $\sqrt{\tn{\vct{w}}^2+\sigma^2}$: $$ \tn{\bar{\g}}\sqrt{\tn{\vct{w}}^2+\sigma^2} = \tn{\bar{\g}}\cdot\min_{\tau\in[\sigma,\sqrt{\sigma^2+B_+^2}]} \left\{ \frac{\tau}{2} + \frac{\tn{\vct{w}}^2+\sigma^2}{2\tau} \right\} = \min_{\tau\in[\sigma,\sqrt{\sigma^2+B_+^2}]} \left\{ \frac{\tau\tn{\bar{\g}}^2}{2} + \frac{\sigma^2}{2\tau} + \frac{\tn{\vct{w}}^2}{2\tau} \right\}, $$ where $B$ is defined in Lemma \ref{lem:bd_PO}. For convenience define the constraint set for the variable $\tau$ as $\mathcal{T}':=[\sigma,\sqrt{\sigma^2+B_+^2}]$. For reasons to be made clear later in the proof (see proof of statement (iii)), we consider the (possibly larger) set: \[ \mathcal{T}:=[\sigma,\max\{\sqrt{\sigma^2+B_+^2},2\tau_*\}]\, \] where $\tau_*$ is as in the statement of the lemma. The above lead to the following equivalent formulation of \eqref{eq:AO_2}: \begin{align} \left(\vct{w}_n,u_n,\tau_n\right) = \max_{u\geq 0}\min_{\tau\in\mathcal{T}} ~ \frac{u\tau\tn{\bar{\g}}^2}{2} + \frac{u\sigma^2}{2\tau} + \frac{u\sigma h}{\sqrt{n}} + \min_{\vct{w}} \left\{ \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2 + \frac{u}{2\tau}\tn{\vct{w}}^2 - u \sqrt{\kappa}\,{\bar{\h}}^T\vct{w} \right\} .\label{eq:AO_3} \end{align} \ct{To be fully rigorous, need to show here that the unconstrained min over $\vct{w}$ is the same as the constrained $\vct{w}\in\mathcal{B}$.} The minimization over $\vct{w}$ is easy as it involves a strongly convex quadratic function. The optimal $\vct{w}':=\vct{w}'(\tau,u)$ (for fixed $(\tau,u)$) is given by \begin{align}\label{eq:w'} \vct{w}':=\vct{w}'(\tau,u) = -\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u\sqrt{\kappa}\bar{\h}\right), \end{align} and \eqref{eq:AO_3} simplifies to \begin{align} \left(u_n,\tau_n\right)=\max_{u\geq 0}\min_{\tau\in\mathcal{T}} ~ \frac{u\tau\tn{\bar{\g}}^2}{2} + \frac{u\sigma^2}{2\tau} + \frac{u\sigma h}{\sqrt{n}} - \frac{1}{2} \left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u\sqrt{\kappa}\bar{\h}\right)^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1} \left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u\sqrt{\kappa}\bar{\h}\right)\,=:\mathcal{R}(u,\tau) .\label{eq:AO_4} \end{align} It can be checked by direct differentiation and the second-derivative test that the objective function in \eqref{eq:AO_4} is strictly convex in $\tau$ and strictly concave in $u$ in the domain $\{(u,\tau)\in\mathbb{R}_+\times\mathbb{R}_+\}$. Thus, the saddle point $(u_n,\tau_n)$ is unique. Specifically, this implies that the optimal $\vct{w}_n$ in \eqref{eq:AO_3} is given by (cf. \eqref{eq:w'}) \begin{align}\label{eq:w_n} \vct{w}_n=\vct{w}'(\tau_n,u_n) = -\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}\left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u_n\sqrt{\kappa}\bar{\h}\right). \end{align} In what follows, we characterize the high-dimensional limit of the optimal pair $(u_n,\tau_n)$ in the limit $n,p\rightarrow\infty,~p/n\rightarrow\kappa$. We start by analyzing the (point-wise) convergence of $\mathcal{R}(u,\tau)$. For the first three summands in \eqref{eq:AO_4}, we easily find that $$ \left\{\frac{u\tau\tn{\bar{\g}}^2}{2} + \frac{u\sigma^2}{2\tau} + \frac{u\sigma h}{\sqrt{n}}\right\}~ \stackrel{{P}}{\longrightarrow}~\left\{ \frac{u\tau}{2} + \frac{u\sigma^2}{2\tau} \right\}. $$ Next, we study the fourth summand. First, note that \begin{align} (u\sqrt{\kappa}\bar{\h})^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}(u\sqrt{\kappa}\bar{\h}) &= u^2\kappa\,\frac{1}{p}\vct{h}^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\vct{h} \notag\\ &= u^2\kappa\,\frac{1}{p}\sum_{i=1}^{p}\frac{\vct{h}_i^2}{\bSi_{i,i}^{-1}+\frac{u}{\tau}} \notag\\ &\stackrel{{P}}{\longrightarrow} u^2\kappa\,\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right]. \end{align} In the last line, $\Lambda$ is a random variable as in Definition \ref{def:Xi}. \cts{Also, we used Assumption \ref{ass:mu} together with the facts that $\vct{h}$ is independent of $\boldsymbol{\Sigma}$ and that the function $(x_1,x_2)\mapsto f(x_1,x_2)=x_1^2(x_2^{-1}+u/\tau)^{-1}$ is $\rm{PL}(2)$ assuming $x_2$ is bounded.} \ct{Question: Is it immediate that the empirical distribution of $(\beta,\boldsymbol{\Sigma},\vct{h})$ converges in $W_k$ to $\mu\otimes\mathcal{N}(0,1)$ given that $(\beta,\boldsymbol{\Sigma})$ converges to $\mu$ and $\vct{h}$ is independent???} Second, we find that \begin{align} (\betab^\star)^T\boldsymbol{\Sigma}^{-1/2}\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\boldsymbol{\Sigma}^{-1/2}\betab^\star &= \frac{1}{p}(\sqrt{p}\betab^\star)^T\left({\mtx{I}}+\frac{u}{\tau}\boldsymbol{\Sigma}\right)^{-1}(\sqrt{p}\betab^\star) \notag\\ &= \frac{1}{p}\sum_{i=1}^{p}\frac{\left(\sqrt{p}\betab^\star_i/\sqrt{\bSi_{i,i}}\right)^2}{\bSi_{i,i}^{-1}+\frac{u}{\tau}}\notag\\ &\stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\Lambda^{-1}+\frac{u}{\tau}}\right]. \end{align} Here, $\Lambda,B$ are random variables as in Definition \ref{def:Xi} and \cts{we also used Assumption \ref{ass:mu} together with the fact that the function $(x_1,x_2)\mapsto f(x_1,x_2)=x_1^2x_2^{-1}(x_2^{-1}+u/\tau)^{-1}$ is $\rm{PL}(2)$ assuming $x_2$ is bounded.} Third, \cts{by independence of $(\betab^\star, \boldsymbol{\Sigma})$ from $\vct{h}$} \begin{align} (u\sqrt{\kappa}\bar{\h})^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\boldsymbol{\Sigma}^{-1/2}\betab^\star = u\sqrt{\kappa} \cdot \frac{1}{p}\sum_{i=1} ^p \frac{\vct{h}_i\boldsymbol{\Sigma}_{i,i}^{-1/2}(\sqrt{p}\betab^\star_i)}{\boldsymbol{\Sigma}_{i,i}^{-1}+\frac{u}{\tau}{\mtx{I}}} ~\stackrel{{P}}{\longrightarrow}~ 0. \end{align} Putting these together, the objective $\mathcal{R}(u,\tau)$ in \eqref{eq:AO_4} converges point-wise in $u,\tau$ to \begin{align} \mathcal{R}(u,\tau)\stackrel{{P}}{\longrightarrow}\mathcal{D}(u,\tau) := \frac{1}{2}\left({u\tau} + \frac{u\sigma^2}{\tau} - u^2\kappa\,\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] - \operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\Lambda^{-1}+\frac{u}{\tau}}\right] \right).\label{eq:conv_pt} \end{align} Note that $\mathcal{R}(u,\tau)$ (and thus, $\mathcal{D}(u,\tau)$) is convex in $\tau$ and concave in $u$. Thus, the convergence in \eqref{eq:conv_pt} is in fact uniform (e.g., \cite{AG1982}) and we can conclude that \begin{align}\label{eq:Dc0} \phi({\vct{g}},\vct{h}) \stackrel{{P}}{\longrightarrow} \max_{u\geq 0}\min_{\tau\in\mathcal{T}}~ \mathcal{D}(u,\tau). \end{align} and \begin{align}\label{eq:Dc} (u_n,\tau_n) \stackrel{{P}}{\longrightarrow} (u_*,\tau_*):=\arg\max_{u\geq 0}\min_{\tau\in\mathcal{T}}~ \mathcal{D}(u,\tau). \end{align} In the proof of statement (iii) below, we show that the saddle point of \eqref{eq:Dc0} is $(u_*,\tau_*)$. In particular, $\tau_*$ is strictly in the interior of $\mathcal{T}$, which combined with convexity implies that $$ \max_{u\geq 0}\min_{\tau\in\mathcal{T}}~ \mathcal{D}(u,\tau) = \max_{u\geq 0}\min_{\tau>0}~ \mathcal{D}(u,\tau) =: \bar\phi. $$ This, together with the first display above proves the second statement of the lemma. \vspace{5pt} \noindent\underline{Proof of (iii):} Next, we compute the saddle point $(u_*,\tau_*)$ by studying the first-order optimality conditions of the srtictly concave-convex $\mathcal{D}(u,\tau)$. Specifically, we consider unconstrained minimization over $\tau$ and we will show that the minimum is achieved in the strict interior of $\mathcal{T}$. Direct differentiation gives \begin{subequations} \begin{align} {\tau} + \frac{\sigma^2}{\tau} - 2u\kappa\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] + \frac{u^2}{\tau}\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1}+\frac{u}{\tau}\right)^2}\right] + \frac{1}{\tau}\operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1}+\frac{u}{\tau}\right)^2}\right] &= 0, \label{eq:fo1}\\ {u} - \frac{u\sigma^2}{\tau^2} - \frac{u^3}{\tau^2}\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1} + \frac{u}{\tau}\right)^2}\right] - \frac{u}{\tau^2} \operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1}+\frac{u}{\tau}\right)^2}\right] &= 0,\label{eq:fo2} \end{align} \end{subequations} Multiplying \eqref{eq:fo2} with $\frac{\tau}{u}$ and adding to \eqref{eq:fo1} results in the following equation \begin{align} \tau = u\kappa\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] ~\Leftrightarrow ~ \operatorname{\mathbb{E}}\left[ \frac{1}{(\frac{u}{\tau}\Lambda)^{-1}+1} \right] = \frac{1}{\kappa} \label{eq:tauu}\,. \end{align} Thus, we have found that the ratio $\frac{u_*}{\tau_*}$ is the unique solution to the equation in \eqref{eq:tauu}. Note that this coincides with the Equation \eqref{eq:ksi} that defines the parameter $\xi$ in Definition \ref{def:Xi}. The fact that \eqref{eq:tauu} has a unique solution for all $\kappa>1$ can be easily seen as $F(x)=\operatorname{\mathbb{E}}\left[ \frac{1}{(x\Lambda)^{-1}+1} \right], x\in\mathbb{R}_+$ has range $(0,1)$ and is strictly increasing (by differentiation). Thus, we call $\xi=\frac{u_*}{\tau_*}$. Moreover, multiplying \label{eq:fo2} with $u$ leads to the following equation for $\tau_*$: \begin{align} u_*^2 = \sigma^2\xi^2 + u_*^2 \xi^2 \kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1} +\xi\right)^2}\right] + \xi^2 \operatorname{\mathbb{E}}\left[ \frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1} + \xi\right)^2}\right] ~\Rightarrow~ \tau_*^2 = \frac{\sigma^2 + \operatorname{\mathbb{E}}\left[ \frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1} + \xi\right)^2}\right]}{1-\xi^2\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1} +\xi\right)^2}\right]} = \frac{\sigma^2 + \operatorname{\mathbb{E}}\left[ \frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1} + \xi\right)^2}\right]}{1-\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left((\xi\Lambda)^{-1} +1\right)^2}\right]}. \end{align} {Again, note that this coincides with Equation \eqref{eq:gamma} that determines the parameter $\gamma$ in Definition \ref{def:Xi}, i.e., $\tau_*^2 = \gamma.$ } \vspace{3pt}\noindent\underline{Proof of (iv):} For convenience, define $$F_n(\hat\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma}):=\frac{1}{p} \sum_{i=1}^{p} f\left(\sqrt{p}\hat\boldsymbol{\beta}_{n,i},\sqrt{p}\betab^\star_{i},\boldsymbol{\Sigma}_{ii}\right)\quad\text{and}\quad\alpha_*:=\operatorname{\mathbb{E}}_\mu\left[f(X_{\kappa,\sigma^2}(\Lambda,B,H),B,\Lambda)\right].$$ Recall from \eqref{eq:w_n} the explicit expression for $\vct{w}_n$, repeated here for convenience. \begin{align} \vct{w}_n = -\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}\left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u_n\sqrt{\kappa}\bar{\h}\right).\notag \end{align} Also, recall that $\boldsymbol{\beta}_n = \boldsymbol{\Sigma}^{-1/2}\vct{w}_n+\betab^\star$. Thus, (and using the fact that $\bar{\h}$ is distributed as $-\bar{\h}$), \begin{align} \boldsymbol{\beta}_n &=\boldsymbol{\Sigma}^{-1/2}\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}u_n\sqrt{\kappa}\bar{\h} + \left({\mtx{I}}-\boldsymbol{\Sigma}^{-1/2}\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}\boldsymbol{\Sigma}^{-1/2}\right)\betab^\star\notag\\ \Longrightarrow\boldsymbol{\beta}_{n,i}&=\frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_n\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_n\bar{\h}_i +\left(1-\frac{1}{1+\xi_n\boldsymbol{\Sigma}_{i,i}}\right)\betab^\star_i. \end{align} For $i\in[p]$, define \begin{align} \vct{v}_{n,i} = \frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_*\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_*\bar{\h}_i +\left(1-\frac{1}{1+\xi_*\boldsymbol{\Sigma}_{i,i}}\right)\betab^\star_i \end{align} In the above, for convenience, we have denoted $\xi_n:=u_n/\tau_n$ and recall that $\xi_*:=u_*/\tau_*$. The proof proceeds in two steps. In the first step, we use the fact that $\xi_n\stackrel{{P}}{\longrightarrow}\xi_*$ and $u_n\stackrel{{P}}{\longrightarrow} u_\star$ (see \eqref{eq:Dc}) to prove that for any $\varepsilon\in(0,\xi_*/2)$, there exists absolute constant $C>0$ such that wpa 1: \begin{align}\label{eq:ivstep1} |F_n(\sqrt{p}\boldsymbol{\beta}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) - F_n(\sqrt{p}\vct{v}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) | \leq C\varepsilon. \end{align} In the second step, we use Lipschitzness of $f$ and Assumption \ref{ass:mu} to prove that \begin{align} |F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| \stackrel{{P}}{\longrightarrow} \alpha_*.\label{eq:ivstep2} \end{align} The desired follows by combining \eqref{eq:ivstep1} and \eqref{eq:ivstep2}. Thus, in what follows, we prove \eqref{eq:ivstep1} and \eqref{eq:ivstep2}. \vspace{2pt} \noindent\emph{Proof of \eqref{eq:ivstep1}.}~~Fix some $\varepsilon\in(0,\xi_*/2)$. From \eqref{eq:Dc}, we know that w.p.a. 1 $|\xi_n-\xi_*|\leq \varepsilon$ and $|u_n-u_*|\leq \varepsilon$. Thus, $\vct{w}_n$ is close to $\vct{v}_n$. Specifically, in this event, for every $i\in[p]$, it holds that: \begin{align} \notag|\boldsymbol{\beta}_{n,i} - \vct{v}_{n,i}| &\leq {|\betab^\star_i|}\left|\frac{1}{1+\xi_n\bSi_{i,i}}-\frac{1}{1+\xi_*\bSi_{i,i}}\right| + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\boldsymbol{\Sigma}_{i,i}}}\left|\frac{\tau_n}{1+(\xi_n\bSi_{i,i})^{-1}}-\frac{\tau_*}{1+(\xi_*\bSi_{i,i})^{-1}}\right| \\ \notag&= {|\betab^\star_i|}\left|\frac{1}{1+\xi_n\bSi_{i,i}}-\frac{1}{1+\xi_*\bSi_{i,i}}\right| + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\boldsymbol{\Sigma}_{i,i}}}\left|\frac{u_n}{\xi_n+\bSi_{i,i}^{-1}}-\frac{u_*}{\xi_*+\bSi_{i,i}^{-1}}\right| \\ \notag& \leq {|\betab^\star_i|}\frac{|\bSi_{i,i}||\xi_n-\xi_*|}{|1+\xi_n\bSi_{i,i}||1+\xi_*\bSi_{i,i}|} + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\bSi_{i,i}}} \frac{u_*|\xi_n-\xi_*|}{(\xi_n+\bSi_{i,i}^{-1})(\xi_*+\bSi_{i,i}^{-1})} + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\bSi_{i,i}}}\frac{|u_n-u_*|}{\xi+\bSi_{i,i}^{-1}} \\ \notag& \leq {|\betab^\star_i|}{\Sigma_{\max}\varepsilon} + \sqrt{\kappa}{|\bar{\h}_i|} u_*\Sigma_{\max}^{3/2} \varepsilon+ \sqrt{\kappa}|\bar{\h}_i|\Sigma_{\max}^{1/2}\varepsilon \\ &\leq \varepsilon \cdot \max\left\{\Sigma_{\max}^{3/2},\Sigma_{\max}^{1/2}\right\}\, \left(|\bar{\h}_i| + |\betab^\star_i|\right).\label{eq:betav} \end{align}\som{$\varepsilon$ missing} In the second line above, we recalled that $u_n=\tau_n\xi_n$ and $u_*=\tau_*\xi_*$. In the third line, we used the triangle inequality. In the fourth line, we used that $\xi_*>0$, $0<\bSi_{i,i}\leq\Sigma_{\max}$ and $\xi_n\geq \xi_*-\varepsilon \geq \xi_*/2 >0$. Now, we will use this and Lipschitzness of $f$ to argue that there exists absolute constant $C>0$ such that wpa 1: \begin{align} |F_n(\sqrt{p}\boldsymbol{\beta}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) - F_n(\sqrt{p}\vct{v}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) | \leq C\varepsilon.\notag \end{align} Denote, $\vct{a}_i=(\sqrt{p}\boldsymbol{\beta}_{n,i},\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$ and $\vct{b}_i=(\sqrt{p}\vct{v}_{n,i},\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$. Following the exact same argument as in \eqref{eq:LipC}, we have \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| &\leq \frac{L}{p}\sum_{i=1}^p (1+\max\{\|\vct{a}_i\|_2^{k-1},\|\vct{b}_i\|_2^{k-1}\})\|\vct{a}_i-\vct{b}_i\|_2\notag \\ &\leq \frac{L}{p}\sum_{i=1}^p \left(1+\max\{\|\vct{a}_i\|_2^{k-1},\|\vct{b}_i\|_2^{k-1}\}\right)\cdot|\sqrt{p}\boldsymbol{\beta}_{n,i}({\vct{g}},\vct{h}) - \sqrt{p}\vct{v}_{n,i}|\notag\\ &\leq L\left(1+\max\{\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2k-2},\frac{1}{p}\sum_{i=1}^p\|\vct{b}_i\|_2^{2k-2}\} \right)^{1/2}{\|\boldsymbol{\beta}_{n}({\vct{g}},\vct{h}) - \vct{v}_n\|_2}\notag. \end{align} From this and \eqref{eq:betav}, we find \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| &\leq L(1+\max\{\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2k-2},\frac{1}{p}\sum_{i=1}^p\|\vct{b}_i\|_2^{2k-2}\} )^{1/2} \\ &\qquad\qquad\varepsilon\cdot\sqrt{2}\max\left\{\Sigma_{\max}^{3/2},\Sigma_{\max}^{1/2}\right\}\sqrt{\|\betab^\star\|_2^2 + \|\bar{\h}\|_2^2}.\label{eq:epsS} \end{align} As in \eqref{eq:bdmom}, it can be shown that wpa 1: $\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2k-2}<\infty$ and $\frac{1}{p}\sum_{i=1}^p \|\vct{b}_i\|_2^{2k-2}<\infty$, as $p\rightarrow\infty$. Similarly, $\|\betab^\star\|_2^2 = \frac{1}{p}\sum_{i=1}^p(\sqrt{p}\betab^\star_i)^2<\infty$, as $p\rightarrow \infty$ {\color{red} by assumption on second moment convergence of $\sqrt{p}\betab^\star$.} Finally, $\|\bar{\h}\|_2^2\leq 2$, wpa 1 as $p\rightarrow\infty$. Therefore, from \eqref{eq:epsS}, wpa 1, there exists constant $C>0$ such that \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| \leq C \cdot\varepsilon, \end{align} as desired. \vspace{2pt} \noindent\emph{Proof of \eqref{eq:ivstep2}.}~~Next, we will use Assumption \ref{ass:mu} to show that \begin{align} |F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| \stackrel{{P}}{\longrightarrow} \alpha_*.\label{eq:AO_conv} \end{align} Notice that $\vct{v}_n$ is a function of $\betab^\star,\boldsymbol{\Sigma},\bar{\h}$. Concretely, define $g:\mathbb{R}^3\rightarrow\mathbb{R}$, such that $$ g(x_1,x_2,x_3) := \frac{x_2^{-1/2}}{1+(\xi x_2)^{-1}}\sqrt{\kappa}\tau_* x_3 + (1-(1+\xi_*x_2)^{-1})x_1, $$ and notice that $$ \sqrt{p}\vct{v}_{n,i} = g\left(\sqrt{p}\betab^\star_i,\bSi_{i,i},\vct{h}_i\right) = \frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_*\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_*\vct{h}_i +\left(1-\frac{1}{1+\xi_*\boldsymbol{\Sigma}_{i,i}}\right)\sqrt{p}\betab^\star_i. $$ Thus, $$ F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma}) = \frac{1}{p}\sum_{i=1}^p f\left(g\left(\sqrt{p}\betab^\star_i,\bSi_{i,i},\vct{h}_i\right),\sqrt{p}\betab^\star_i,\bSi_{i,i}\right) =: \frac{1}{p}\sum_{i=1}^p h\left(\vct{h}_i,\sqrt{p}\betab^\star_i,\bSi_{i,i}\right), $$ where we have defined $h:\mathbb{R}^3\rightarrow\mathbb{R}$: \begin{align} h(x_1,x_2,x_3) := f\left(g(x_2,x_3,x_1),x_2,x_3\right).\label{h func} \end{align} It will suffice to prove that $h\in\rm{PL}(k)$. Indeed, if that were the case, then Assumption \ref{ass:mu} would give \begin{align} \frac{1}{p}\sum_{i=1}^p h\left(\vct{h}_i,\sqrt{p}\betab^\star_i,\bSi_{i,i}\right) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{\mathcal{N}(0,1)\otimes \mu}\left[h(H,B,\Lambda)\right] &= \operatorname{\mathbb{E}}_{\mathcal{N}(0,1)\otimes \mu}\left[f\left(g(B,\Lambda,H),B,\Lambda\right))\right]\\ & = \operatorname{\mathbb{E}}[f\left(X_{\kappa,\sigma^2}(\Lambda,B,H),B,\Lambda\right)] = \alpha_*, \end{align} where the penultimate equality follows by recognizing that (cf. Eqn. \eqref{eq:X}) $$ g(B,\Lambda,H) = (1-(1+\xi_*\Lambda)^{-1})B + \sqrt{\kappa}\frac{\tau_*\Lambda^{-1/2}}{1+(\xi_*\Lambda)^{-1}}H = X_{\kappa,\sigma^2}(\Lambda,B,H). $$ In the remaining of the proof, \cts{we show that $h\in\rm{PL}(k)$} which is formalized below. \begin{lemma} The function $h$ in \eqref{h func} is $\rm{PL}(k)$ as long as $f$ is $\rm{PL}(k)$. \end{lemma} \begin{proof} Since $f$ is $\rm{PL}(k)$, for some $L>0$, \eqref{PL func} holds. Fix $\vct{a}=[\vct{x},\vct{y},{\vct{z}}]\in\mathbb{R}^{3p},\vct{a}'=[\vct{x}',\vct{y}',{\vct{z}}']\in\mathbb{R}^{3p}$. Let $\vct{b}=[{\vct{g}},\vct{y},{\vct{z}}]$ where ${\vct{g}}=g(\vct{y},{\vct{z}},\vct{x})$. We have that \begin{align} |h(\vct{a})-h(\vct{a}')|&\leq |f(\vct{b})-f(\vct{b}')|\\ &\leq L\left(1+\|\vct{b}\|_2^{k-1}+\|\vct{b}'\|_2^{k-1}\right)\|\vct{b}-\vct{b}'\|_2\\ &\lesssim L\left(1+\|\vct{a}\|_2^{k-1}+\|\vct{a}'\|_2^{k-1}+\|{\vct{g}}\|_2^{k-1}+\|{\vct{g}}'\|_2^{k-1}\right)(\|\vct{a}-\vct{a}'\|_2+\|{\vct{g}}-{\vct{g}}'\|_2). \end{align} Next, we need to bound the ${\vct{g}}$ term in terms of $\vct{a}$. This is accomplished as follows \begin{align} \|{\vct{g}}\|_2^{k-1}&\lesssim \frac{1}{p}\sum_{i=1}^p|g_i|^{k-1}\\ &\lesssim \frac{1}{p}\sum_{i=1}^p\left|\frac{y_i^{-1/2}}{1+(\xi y_i)^{-1}}\sqrt{\kappa}\tau_* z_i + (1-(1+\xi_*y_i)^{-1})x_i\right|\\ &\lesssim \frac{1}{p}\sum_{i=1}^p(|z_i|+|x_i|)^{k-1}\lesssim \|\vct{x}\|_2^{k-1}+\|{\vct{z}}\|_2^{k-1}\\ &\lesssim \|\vct{a}\|^{k-1}. \end{align} Secondly and similarly, we have the following perturbation bound on the ${\vct{g}}-{\vct{g}}'$. \so{Suppose the triples $(x_i,y_i,z_i)$ takes values in a fixed bounded compact set $\mathcal{M}$. We will prove the following sequence of inequalities} \begin{align} \tn{{\vct{g}}-{\vct{g}}'}^2&\leq \sum_{i=1}^p|g(x_i,y_i,z_i)-g(x'_i,y'_i,z'_i)|^2\\ &\leq C^2_{\mathcal{M}} \sum_{i=1}^p(|x_i-x'_i|^2+|y_i-y'_i|^2+|z_i-z'_i|^2)\label{sec line eq}\\ &\leq C^2_{\mathcal{M}} (\tn{\vct{x}-\vct{x}'}^2+\tn{\vct{y}-\vct{y}'}^2+\tn{{\vct{z}}-{\vct{z}}'}^2)\\ &\lesssim \tn{\vct{a}-\vct{a}'}^2. \end{align} In what follows, we prove the second line \eqref{sec line eq} i.e.~the fact that for any triples $a=(x,y,z),a'=(x',y',z')$ (with $a,a'\in\mathbb{R}^3$), we have that \[ |g(a)-g(a')|\leq C_{\mathcal{M}}\tn{a-a'}. \] Set $C_\nabla=\sup_{a\in \mathcal{M}}\tn{\nabla g(a)}$. By definition of gradient, the inequality above holds with $C_\mathcal{M}=C_\nabla$. Thus, all that remains is proving that $C_\nabla$ is upper bounded by a constant. \so{However, this automatically holds because from the definition of $g(\dots)$ function, it is clear that $C_\nabla$ is defined everywhere and continuous thus it has a finite maximum over a compact set.} \end{proof} \section{Facts about Lipschitz functions}\label{SM useful fact} For $k\geq 1$ we say a function $f:\mathbb{R}^m\rightarrow\mathbb{R}$ is pseudo-Lipschitz of order $k$ and denote it by $f\in \rm{PL}(k)$ if there exists a cosntant $L>0$ such that, for all $\vct{x},\vct{y}\in\mathbb{R}^m$: \begin{align} |f(\vct{x})-f(\vct{y})|\leq L\left(1+\|\vct{x}\|_2^{k-1}+\|\vct{y}\|_2^{k-1}\right)\|\vct{x}-\vct{y}\|_2.\label{PL func} \end{align} In particular, when $f\in\rm{PL}(k)$, the following properties hold: \begin{enumerate} \item There exists a constant $L'$ such that for all $\vct{x}\in\mathbb{R}^n$: $|f(\vct{x})|\leq L'(1+\|\vct{x}\|_2^k).$ \item $f$ is locally Lipschitz, that is for any $M>0$, there exists a constant $L_{M,m}<\infty$ such that for all $x,y\in[-M,M]^m$, $ |f(\vct{x})-f(\vct{y})| \leq L_{M,m}\|\vct{x}-\vct{y}\|_2. $ Further, $L_{M,m}\leq c(1+(M\sqrt{m})^{k-1})$ for some costant $c$. \end{enumerate} \begin{lemma} Let $g:\mathbb{R}\rightarrow\mathbb{R}$ be a bounded, Lipschitz function. Consider the function $f:\mathbb{R}^3\rightarrow\mathbb{R}$ defined as follows: $$ f(\vct{x}) = x_1(x_2-g(x_3))^2. $$ Then, $f\in\rm{PL}(3).$ \end{lemma} \begin{proof} Let $h:\mathbb{R}^2\rightarrow\mathbb{R}$ defined as $h({\vct{u}})=({\vct{u}}_1-g({\vct{u}}_2))^2$. The function $({\vct{u}}_1,{\vct{u}}_2)\mapsto{\vct{u}}_1-g({\vct{u}}_2)$ is clearly Lipschitz. Thus, $h\in\rm{PL}(2)$, i.e., \begin{align} |h({\vct{u}})-h(\vct{v})| \leq C(1+\|{\vct{u}}\|_2+\|\vct{v}\|_2)\|{\vct{u}}-\vct{v}\|_2\quad\text{and}\quad |h(\vct{v})|\leq C'(1+\|\vct{v}\|_2^2).\label{eq:h_pl} \end{align} Thus, letting $\vct{x}=(x_1,{\vct{u}})\in\mathbb{R}^3$ and $\vct{y}=(y_1,\vct{v})\in\mathbb{R}^3$, we have that \begin{align} |f(\vct{x})-f(\vct{y})| &= |x_1h({\vct{u}}) - y_1h(\vct{v})| \leq |x_1||h({\vct{u}})-h(\vct{v})| + |h(\vct{v})| |x_1-y_1|\notag\\ &\leq C|x_1|(1+\|{\vct{u}}\|_2+\|\vct{v}\|_2)\|{\vct{u}}-\vct{v}\|_2 + C'(1+\|\vct{v}\|_2^2)|x_1-y_1| \notag\\ &\leq C(|x_1|^2+(1+\|{\vct{u}}\|_2+\|\vct{v}\|_2)^2)\|{\vct{u}}-\vct{v}\|_2 + C'(1+\|\vct{v}\|_2^2)|x_1-y_1| \notag\\ &\leq C(1+\|\vct{x}\|_2^2+\|\vct{y}\|_2^2)\|{\vct{u}}-\vct{v}\|_2 + C'(1+\|\vct{x}\|_2^2+\|\vct{y}\|_2^2)|x_1-y_1| \notag\\ &\leq C(1+\|\vct{x}\|_2^2+\|\vct{y}\|_2^2)\|\vct{x}-\vct{y}\|_2. \end{align} In the second line, we used \eqref{eq:h_pl}. In the third line, we used $2xy\leq x^2+y^2$. In the fourth line, we used Cauchy-Schwarz inequality. $C,C'>0$ are absolute constants that may change from line to line. This completes the proof of the lemma. \end{proof} \begin{lemma} Let functions $f,g:\mathbb{R}^3\rightarrow\mathbb{R}$ such that $f\in\rm{PL}(3)$ and $$ g(x_1,x_2,x_3) := \frac{x_2^{-1/2}}{1+(\xi_* x_2)^{-1}}\sqrt{\kappa}\tau_* x_3 + (1-(1+\xi_*x_2)^{-1})x_1. $$ Here, $\xi_*,\tau_*,\kappa$ are positive constants. Also, $x_2$ is bounded, say $x_2\in[m,M]\subset(0,\infty)$. Further define \begin{align} h(x_1,x_2,x_3) := f\left(g(x_2,x_3,x_1),x_2,x_3\right). \end{align} Then, it holds that $h\in\rm{PL}(k+?)$. \end{lemma} \section{Proofs for overparameterized least-squares}\label{sec proof thm 1} In this section, we assume the linear Gaussian problem (LGP) of Definition \ref{def LGP}, the overparameterized regime $k=p>n$ and the min-norm model $\hat\boldsymbol{\beta}$ of \eqref{eq:min_norm}. We prove Theorem \ref{thm:master_W2} that derives the asymptotic DC of $\hat\boldsymbol{\beta}$ and we show how this leads to sharp formulae for the risk of the Magnitude- and Hessian-pruned models. \subsection{Notation and Assumptions}\label{sec:ass_app} For the reader's convenience, we recall some necessary notation and assumptions from Section \ref{sec main}. We say that a function $f:\mathbb{R}^m\rightarrow\mathbb{R}$ is pseudo-Lipschitz of order $k$, denoted $f\in\rm{PL}(k)$, if there is a constant $L>0$ such that for all $\vct{x},\vct{y}\in\mathbb{R}^m$, $ |f(\vct{x}) - f(\vct{y})|\leq L(1+\tn{\vct{x}}^{k-1}+\tn{\vct{y}}^{k-1})\|\vct{x}-\vct{y}\|_2 $ (See also Section \ref{SM useful fact}). We say that a sequence of probability distributions $\nu_p$ on $\mathbb{R}^m$ {converges in $W_k$} to $\nu$, written $\nu_p\stackrel{W_k}{\Longrightarrow} \nu$, if $W_k(\nu_p,\nu) \rightarrow 0$ as $p \rightarrow \infty$. An equivalent definition is that, for any $f\in\rm{PL}(k)$, $\lim_{p\rightarrow\infty}\operatorname{\mathbb{E}} f(X_p)=\operatorname{\mathbb{E}} f(X)$, where expectation is with respect to $X_p\sim\nu_p$ and $X\sim\nu$ (e.g., \cite{montanari2017estimation}). Finally, recall that a sequence of probability distributions $\nu_n$ on $\mathbb{R}^m$ \emph{converges weakly} to $\nu$, if for any bounded Lipschitz function $f$: $\lim_{p\rightarrow\infty}\operatorname{\mathbb{E}} f(X_p)=\operatorname{\mathbb{E}} f(X)$, where expectation is with respect to $X_p\sim\nu_p$ and $X\sim\nu$. Throughout, we use $C,C',c,c'$ to denote absolute constants (not depending on $n,p$) whose value might change from line to line. We focus on a double asymptotic regime where: $$n,p,s\rightarrow\infty \text{ at fixed overparameterization ratio } \kappa:=p/n>1 \text{ and sparsity level } \alpha:=s/p\in(0,1).$$ For a sequence of random variables $\mathcal{X}_{p}$ that converge in probability to some constant $c$ in the limit of Assumption \ref{ass:linear} below, we write $\mathcal{X}_{p}\stackrel{{P}}{\longrightarrow} c$. For a sequence of event $\mathcal{E}_p$ for which $\lim_{p\rightarrow}\mathbb{P}(\mathcal{E}_p) = 1$, we say that $\mathcal{E}_p$ occurs \emph{with probability approaching 1}. For this, we will often use the shorthand ``wpa 1". \vspace{5pt} Next, we recall the set of assumption under which our analysis applies: \vspace{3pt} \textbf{(A1)[Diagonal covariance].}~~The covariance matrix $\boldsymbol{\Sigma}$ is diagonal. \vspace{3pt} \textbf{(A2)[Boundedness and empirical distribution].}~~There exist constants $\Sigma_{\min},\Sigma_{\max}\in(0,\infty)$ such that: $ \Sigma_{\min}\leq{\boldsymbol{{\Sigma}}}_{i,i}\leq \Sigma_{\max}. $ for all $i\in[p].$ \cts{Furthermore, the joint empirical distribution of $\{(\bSi_{i,i},\sqrt{p}\betab^\star_i)\}_{i\in[p]}$ converges weakly to a probability distribution $\mu$ on $\mathbb{R}_{>0}\times\mathbb{R}$ with bounded $4$th moment and assume that as $p\rightarrow\infty$, the $4$th moment of the empirical distribution converges to the $4$th moment of $\mu$, i.e., $$ \frac{1}{p}\sum_{i=1}^p\left(\sqrt{(\sqrt{p}\betab^\star_i)^{2}+\bSi_{i,i}^2}\right)^4 \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{(\Lambda,B)\sim\mu}\left[\left(\sqrt{\Lambda^2+B^2}\right)^4\right]<\infty. $$ } \noindent We remark that Assumption (A2) above implies (see \cite[Lem.~4]{bayati2011dynamics} and \cite[Lem.~A3]{javanmard2013state}) that for any pseudo-Lipschitz function $\psi:\mathbb{R}^2\rightarrow\mathbb{R}$ of order $4$, i.e., $\psi\in\rm{PL}(4)$: $$ \frac{1}{p}\sum_{i=1}^p\psi(\bSi_{i,i},\sqrt{p}\betab^\star_i) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{(\Lambda,B)\sim\mu}\left[ \psi(\Lambda,B)\right]. $$ \subsection{Asymptotic distribution and risk characterizations} In this section, we prove the following main result, which is a special case of Theorem \ref{thm:master_W2}, tailored to our specific need in this paper, that is, characterizing the risk of pruned solutions. Let ${\boldsymbol{\hat{\beta}}}^P={\cal{P}}({\boldsymbol{\hat{\beta}}})$ be a pruned version of the min-norm solution ${\boldsymbol{\hat{\beta}}}$. Recall from Section \ref{sec:risk}, that the first crucial step in characterizing the risk ${\cal{L}}({\boldsymbol{\hat{\beta}}}^P)$ is studying the risk of a threshold-based pruned vector ${\cal{L}}({\boldsymbol{\hat{\beta}}}^\mathcal{T}_t)$. Theorem \ref{thm:app_W2} below shows how this is possible. To keep things slightly more general, consider ${\boldsymbol{\hat{\beta}}}^{g}$ defined such that $\sqrt{p}{\boldsymbol{\hat{\beta}}}^{g}=g(\sqrt{p}{\boldsymbol{\hat{\beta}}})$, where $g$ is a Lipschitz function acting entry-wise on ${\boldsymbol{\hat{\beta}}}$ (for example, $g$ can be the \fx{(arbitrarily close Lipschitz approximation of the)} thresholding operator $\mathcal{T}_t$ of Section \ref{sec:risk}). Then, the risk of ${\boldsymbol{\hat{\beta}}}^g$ can be written as \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}}^g) &= \operatorname{\mathbb{E}}_{\mathcal{D}}[(\vct{x}^T({\boldsymbol{\beta}}^\star-{\boldsymbol{\hat{\beta}}}^g) + \sigma z)^2] = \sigma^2 + ({\boldsymbol{\beta}}^\star-{\boldsymbol{\hat{\beta}}}^g)^T\boldsymbol{\Sigma}({\boldsymbol{\beta}}^\star-{\boldsymbol{\hat{\beta}}}^g) \notag \\ &= \sigma^2 + \frac{1}{p}\sum_{i=1}^p\boldsymbol{\Sigma}_{i,i}\big(\sqrt{p}\betab^\star_i-g(\sqrt{p}\hat\boldsymbol{\beta}_i)\big)^2\notag \\ &=: \sigma^2 + \frac{1}{p}\sum_{i=1}^p f\big(\sqrt{p}{\boldsymbol{\hat{\beta}}}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i}\big),\label{eq:risk_app_f} \end{align} where in the last line, we defined function $f:\mathbb{R}^3\rightarrow\mathbb{R}$ as follows: \begin{align}\label{eq:fdef} f_{\cal{L}}(x,y,z) := \fx{z(y-g(x))}^2. \end{align} The following theorem establishes the asymptotic limit of \eqref{eq:risk_app_f}. For the reader's convenience, we repeat the notation introduced in Definition \ref{def:Xi}. Let random variables $(\Lambda,B)\sim \mu$ (where $\mu$ is defined in Assumption (A2)) and fix $\kappa>1$. Define parameter $\xi$ as the unique positive solution to the following equation $$ \operatorname{\mathbb{E}}_{\mu}\Big[ \big({1+(\xi\cdot\Lambda)^{-1}}\big)^{-1} \Big] = {\kappa^{-1}}\,. $$ Further define the positive parameter $\gamma$ as follows: $$ \hspace{-0.1in}\gamma := \Big({\sigma^2 + \operatorname{\mathbb{E}}_{\mu}\Big[\frac{B^2\Lambda}{(1+\xi\Lambda)^2}\Big]}\Big)\Big/\Big({1-\kappa\operatorname{\mathbb{E}}_{\mu}\Big[\frac{1}{\left(1+(\xi\Lambda)^{-1}\right)^2}\Big]}\Big). $$ With these and $H\sim\mathcal{N}(0,1)$, define the random variable $$ X_{\kappa,\sigma^2}:=X_{\kappa,\sigma^2}(\Lambda,B,H) := \Big(1-\frac{1}{1+ \xi\Lambda}\Big) B + \sqrt{\kappa}\frac{\sqrt{\gamma}\,\Lambda^{-1/2}}{1+(\xi\Lambda)^{-1}} H, $$ and let $\Pi_{\kappa,\sigma^2}$ be its distribution. \cts{ \begin{theorem}[Asymptotic DC -- Overparameterized LGP]\label{thm:app_W2} Fix $\kappa>1$. Let Assumptions (A1) and (A2) in Section \ref{sec:ass_app} hold for some $k\geq 3$. Consider $\hat{{\boldsymbol{\beta}}}$ as in \eqref{eq:min_norm} and $\hat\Pi_n(\vct{y},{\mtx{X}},\betab^\star,\boldsymbol{\Sigma}):=\frac{1}{p}\sum_{i=1}^{p}\delta_{\sqrt{p}\hat{{\boldsymbol{\beta}}}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i}}$, the joint empirical distribution of $(\sqrt{p}\hat\boldsymbol{\beta},\sqrt{p}\betab^\star,\boldsymbol{\Sigma})$. Let $f:\mathbb{R}^3\rightarrow\mathbb{R}$ be any of the following two: (a) $f\in\rm{PL}(2)$, or, (b) $f=f_{\cal{L}}$ defined in \eqref{eq:fdef} \fx{where $g$ is a Lipschitz function}. In either case, it holds that \begin{align}\label{eq:thm_app_f} \frac{1}{p} \sum_{i=1}^{p} f(\sqrt{p}\hat\boldsymbol{\beta}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i}) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{(\Lambda,B,H)\sim\mu\otimes\mathcal{N}(0,1)}\left[f(X_{\kappa,\sigma^2},B,\Lambda) \right]. \end{align} \end{theorem} } Before we prove the theorem, let us show how it immediately leads to a sharp prediction of the risk behavior. Indeed, a direct application of \eqref{eq:thm_app_f} for $f=f_{\cal{L}}$ to \eqref{eq:risk_app_f} shows that \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}}^g)\stackrel{{P}}{\longrightarrow} \sigma^2 + \operatorname{\mathbb{E}}_{(\Lambda,B,H)\sim\mu\otimes\mathcal{N}(0,1)}\left[f_{\cal{L}}(X_{\kappa,\sigma^2},B,\Lambda) \right] = \sigma^2 + \operatorname{\mathbb{E}}_{(\Lambda,B,H)\sim\mu\otimes\mathcal{N}(0,1)}\left[\Sigma\left(B-g(X_{\kappa,\sigma^2})\right)^2 \right].\label{eq:risk_app_f2} \end{align} We further remark on the following two consequences of Theorem \ref{thm:app_W2}. First, since \eqref{eq:thm_app_f} holds for any $\rm{PL}(2)$ function, we have equivalently that $\hat\Pi_n(\vct{y},{\mtx{X}},\betab^\star,\boldsymbol{\Sigma})$ converges in Wasserstein-2 distance to $\Pi_{\kappa,\sigma^2}\otimes\mu$, where recall that $\Pi_{\kappa,\sigma^2}$ is the distribution of the random variable $X_{\kappa,\sigma^2}$. Second, the theorem implies that the empirical distribution of $\sqrt{p}\boldsymbol{\beta}_n$ converges weakly to $\Pi_{\kappa,\sigma^2}$. To see this, apply \eqref{eq:thm_app_f} for the $\rm{PL}(2)$ function $f(x,y,z) = \psi(x)$ where $\psi:\mathbb{R}\rightarrow\mathbb{R}$ is a bounded Lipschitz test function. \subsection{Proof of Theorem \ref{thm:app_W2}} \vspace{5pt} Let ${\mtx{X}}\in\mathbb{R}^{n\times p}$ have zero-mean and normally distributed rows with a diagonal covariance matrix ${\boldsymbol{{\Sigma}}}=\operatorname{\mathbb{E}}[\vct{x}\x^T]$. Given a ground-truth vector $\betab^\star$ and labels $\vct{y}={\mtx{X}}\betab^\star+\sigma {\vct{z}},~{\vct{z}}\sim\mathcal{N}(0,{\mtx{I}}_n)$, we consider the least-squares problem subject to the minimum Euclidian norm constraint (as $\kappa=p/n>1$) given by \begin{align}\label{eq:PO_beta} \min_{{\boldsymbol{\beta}}}\frac{1}{2}\tn{{\boldsymbol{\beta}}}^2\quad\text{subject to}\quad \vct{y}={\mtx{X}}{\boldsymbol{\beta}}. \end{align} It is more convenient to work with the following change of variable: \begin{align}\label{eq:w} \vct{w}:=\sqrt{\boldsymbol{\Sigma}}({\boldsymbol{\beta}}-\betab^\star). \end{align} With this, the optimization problem in \eqref{eq:min_norm} can be rewritten as \begin{align}\label{eq:PO} \Phi({\mtx{X}})=\min_{\vct{w}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad {\mtx{\bar{X}}}\vct{w}=\sigma {\vct{z}}, \end{align} where we write ${\mtx{\bar{X}}}={\mtx{X}}\boldsymbol{\Sigma}^{-1/2}\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,1)$. First, using standard arguments, we show that the solution of \eqref{eq:PO} is bounded. Hence, we can constraint the optimization in a sufficiently large compact set without loss of generality. \begin{lemma}[Boundedness of the solution]\label{lem:bd_PO} Let $\hat\vct{w}_n:=\hat\vct{w}_n({\mtx{X}},{\vct{z}})$ be the minimizer in \eqref{eq:PO}. Then, with probability approaching 1, it holds that $\hat\vct{w}_n\in\mathcal{B}$, where $$\mathcal{B}:=\left\{\vct{w}\,|\,\|\vct{w}\|_2\leq B_{+} \right\},\qquad B_+:=5\sqrt{\frac{\Sigma_{\max}}{\Sigma_{\min}}}\frac{\sqrt{\kappa}+1}{\sqrt{\kappa}-1}(\sqrt{\Sigma_{\max}\operatorname{\mathbb{E}}\left[B^2\right]} + \sigma). $$ \end{lemma} \begin{proof} First, we show that the min-norm solution $\hat\boldsymbol{\beta}={\mtx{X}}^T({\mtx{X}}\X^T)^{-1}\vct{y}$ of \eqref{eq:PO_beta} is bounded. Note that $\kappa>1$, thus ${\mtx{X}}\X^T$ is invertible wpa 1. We have, \begin{align} \tn{\hat\boldsymbol{\beta}_n}^2 = \vct{y}^T({\mtx{X}}\X^T)^{-1}\vct{y} \leq \frac{\tn{\vct{y}}^2}{\lambda_{\min}({\mtx{X}}\X^T)} = \frac{\tn{\vct{y}}^2}{\lambda_{\min}({\mtx{\bar{X}}}\boldsymbol{\Sigma}{\mtx{\bar{X}}}^T)} \leq \frac{\tn{\vct{y}}^2}{\lambda_{\min}({\mtx{\bar{X}}}\Xb^T)\,\Sigma_{\min}} = \frac{\tn{\vct{y}}^2}{\sigma_{\min}^2({\mtx{\bar{X}}})\,\Sigma_{\min}}. \label{eq:Ubb} \end{align} But, wpa 1, $ \sigma_{\min}({\mtx{\bar{X}}})/\sqrt{n} \geq \frac{1}{2}\left(\sqrt{\kappa}-1\right). $ Furthermore, $ \|\vct{y}\|_2 \leq \|{\mtx{\bar{X}}}\boldsymbol{\Sigma}^{1/2}\betab^\star\|_2 + \sigma\|{\vct{z}}\|_2 \leq \sigma_{\max}({\mtx{\bar{X}}})\sqrt{\Sigma_{\max}} \|\betab^\star\|_2 + \sigma\|{\vct{z}}\|_2. $ Hence, wpa 1, $$ \|\vct{y}\|_2/\sqrt{n} \leq 2(\sqrt{\kappa}+1)\sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}\left[B^2\right]} + 2\sigma, $$ where we used the facts that wpa 1: $\|z\|_2/\sqrt{n}\stackrel{{P}}{\longrightarrow} 1$, $\sigma_{\max}({\mtx{\bar{X}}})<\sqrt{2n}(\sqrt{\kappa}+1)$ and \cts{by Assumption (A2)}: $$ \|\betab^\star\|_2^2 = \frac{1}{p}\sum_{i=1}^{p}(\sqrt{p}\betab^\star_i)^2 \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}\left[B^2\right]. $$ Put together in \eqref{eq:Ubb}, shows that \begin{align} \tn{\hat\boldsymbol{\beta}_n} < \frac{2(\sqrt{\kappa}+1)\sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}\left[B^2\right]} + 2\sigma}{\sqrt{\Sigma_{\min}}(\sqrt{\kappa}-1)/2} =: \tilde{B}_+.\label{eq:bd_beta} \end{align} Recalling that $\hat\vct{w}_n= \sqrt{\boldsymbol{\Sigma}}\boldsymbol{\beta} - \sqrt{\boldsymbol{\Sigma}}\betab^\star$, we conclude, as desired, that wpa 1, $ \tn{\hat\vct{w}_n} \leq \sqrt{\Sigma_{\max}}\tilde{B}_+ + \sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}[B^2]} \leq B_+. $ \end{proof} Lemma \ref{lem:bd_PO} implies that nothing changes in \eqref{eq:PO} if we further constrain $\vct{w}\in\mathcal{B}$ in \eqref{eq:PO}. Henceforth, with some abuse of notation, we let \begin{align}\label{eq:PO_bd} \Phi({\mtx{X}}):=\min_{\vct{w}\in\mathcal{B}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad {\mtx{\bar{X}}}\vct{w}=\sigma {\vct{z}}, \end{align} Next, in order to analyze the primary optimization (PO) problem in \eqref{eq:PO_bd} in apply the CGMT \cite{thrampoulidis2015lasso}. Specifically, we use the constrained formulation of the CGMT given by Theorem \ref{thm closed}. Specifically, the auxiliary problem (AO) corresponding to \eqref{eq:PO_bd} takes the following form with ${\vct{g}}\sim\mathcal{N}(0,{\mtx{I}}_n)$, $\vct{h}\sim\mathcal{N}(0,{\mtx{I}}_p)$, $h\sim \mathcal{N}(0,1)$ \begin{align} \phi({\vct{g}},\vct{h}) = \min_{\vct{w}\fx{\in\mathcal{B}}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad \tn{{\vct{g}}}\tn{\vct{w}~{\sigma}}\leq \vct{h}^T\vct{w}+\sigma h.\label{eq:AO_con} \end{align We will prove the following techincal result about the AO problem. \somm{Re-specify the assumptions of this lemma!} \begin{lemma}[Properties of the AO -- Overparameterized regime]\label{lem:AO} Let $\phi_n=\phi({\vct{g}},\vct{h})$ be the optimal cost of the minimization in \eqref{eq:AO_con}. Define $\bar\phi$ as the optimal cost of the following deterministic min-max problem \begin{align}\label{eq:AO_det} \bar\phi:=\max_{u\geq 0}\min_{\tau>0}~ \mathcal{D}(u,\tau):=\frac{1}{2}\left({u\tau} + \frac{u\sigma^2}{\tau} - u^2\kappa\,\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] - \operatorname{\mathbb{E}}\left[\frac{N^2}{\Lambda^{-1}+\frac{u}{\tau}}\right] \right). \end{align} The following statements are true. \noindent{(i).}~The AO minimization in \eqref{eq:AO_con} is $\frac{1}{\Sigma_{\max}}$-strongly convex and has a unique minimizer $\vct{w}_n:=\vct{w}_n({\vct{g}},\vct{h})$. \noindent{(ii).}~In the limit of $n,p\rightarrow\infty, p/n=\kappa$, it holds that $\phi({\vct{g}},\vct{h})\stackrel{{P}}{\longrightarrow}\bar\phi$, i.e., for any $\varepsilon>0$: $$ \lim_{n\rightarrow\infty}\P\left(|\phi({\vct{g}},\vct{h})-\bar\phi|>\varepsilon\right) = 0. $$ \noindent{(iii).} The max-min optimization in \eqref{eq:AO_det} has a unique saddle point $(u_*,\tau*)$ satisfying the following: $$ u_*/\tau_* = \xi\quad\text{and}\quad\tau_* = \gamma, $$ where $\xi, \gamma$ are defined in Definition \ref{def:Xi}. \noindent{(iv).}~Let $f:\mathbb{R}^3\rightarrow\mathbb{R}$ be a $\rm{PL}({k})$ function. Let $\boldsymbol{\beta}_n=\boldsymbol{\Sigma}^{-1/2}\vct{w}_n + \betab^\star$. Then, $$ \frac{1}{p}\sum_{i=1}^{p}f\left(\sqrt{p}\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\sqrt{p}\betab^\star,\boldsymbol{\Sigma}\right) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{(B,\Lambda,H)\sim\mu\otimes \mathcal{N}(0,1)}\left[f\left(X_{\kappa,\sigma^2}(B,\Lambda,H),B,\Lambda\right) \right]. $$ \noindent{(v).}~\cts{The empirical distribution of $\boldsymbol{\beta}_n$ converges weakly to the measure of $X_{\kappa,\sigma^2}$, and also, for large enough absolute constant $C>0$: \begin{align}\label{eq:k_AO} \frac{1}{p}\sum_{i=1}^{p}|\sqrt{p}\boldsymbol{\beta}_n({\vct{g}},\vct{h})|^{2} < C. \end{align} } \end{lemma} We prove Lemma \ref{lem:AO} in Section \ref{sec:proofAO}. Here, we show how this leads to the proof of Theorem \ref{thm:master_W2} when combined with the CGMT. \cts{Let $f:\mathbb{R}^3\rightarrow\mathbb{R}$ be a $\rm{PL}(2)$ function, or, the function $f_{\cal{L}}$ defined in \eqref{eq:fdef}.} For convenience, define $$F_n(\hat\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma}):=\frac{1}{p} \sum_{i=1}^{p} f\left(\sqrt{p}\hat\boldsymbol{\beta}_{n,i},\sqrt{p}\betab^\star_{i},\boldsymbol{\Sigma}_{ii}\right)\quad\text{and}\quad\alpha_*:=\operatorname{\mathbb{E}}_\mu\left[f(X_{\kappa,\sigma^2}(\Lambda,B,H),B,\Lambda)\right].$$ Fix any $\varepsilon>0$ and define the set \begin{align}\label{eq:S_set} \mathcal{S} = \mathcal{S}(\betab^\star,\boldsymbol{\Sigma}) =\{\boldsymbol{\beta}{~\big |~} |F_n(\hat\boldsymbol{\beta}_n,\betab^\star,\boldsymbol{\Sigma})-\alpha_*|\geq 2\varepsilon\}. \end{align} It suffices to prove that the solution $\hat\boldsymbol{\beta}_n$ of the PO in \eqref{eq:PO_beta} satisfies $\hat\boldsymbol{\beta}_n\not\in\mathcal{S}$ wpa 1. To see that this is sufficient, note the following. On the one, setting $f=f_{\cal{L}}$, directly proves \eqref{eq:thm_app_f}. On the other hand, recall that $W_2$-convergence is equivalent to convergence of any $\rm{PL}(2)$ test function $f$. To prove the desired, we need to consider the ``perturbed" PO and AO problems (compare to \eqref{eq:PO} and \eqref{eq:AO_con}) as: \begin{align}\label{eq:PO_S} \Phi_S({\mtx{X}})=\min_{\vct{w}\in\mathcal{S}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad {\mtx{\bar{X}}}\vct{w}=\sigma {\vct{z}}, \end{align} and \begin{align} \phi_S({\vct{g}},\vct{h})=\min_{\vct{w}\in\mathcal{S}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad \tn{{\vct{g}}}\tn{\vct{w}~{\sigma}}\leq \vct{h}^T\vct{w}+\sigma h.\label{eq:AO_S} \end{align Recall here, that ${\mtx{\bar{X}}}={\mtx{X}}\boldsymbol{\Sigma}^{-1/2}\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,1)$, ${\vct{g}}\sim\mathcal{N}(0,{\mtx{I}}_n)$, $\vct{h}\sim\mathcal{N}(0,{\mtx{I}}_p)$, $h\sim \mathcal{N}(0,1)$ and we have used the change of variables $\vct{w}:=\sqrt{\boldsymbol{\Sigma}}(\boldsymbol{\beta}-\betab^\star)$ for convenience. Using \cite[Theorem 6.1(iii)]{thrampoulidis2018precise} it suffices to find costants $\bar\phi, \bar\phi_S$ and $\eta>0$ such that the following three conditions hold: \begin{enumerate} \item $\bar\phi_S \geq \bar\phi + 3\eta$, \item $\phi({\vct{g}},\vct{h}) \leq \bar\phi + \eta$, with probability approaching 1, \item $\phi_S({\vct{g}},\vct{h}) \geq \bar\phi_S - \eta$, with probability approaching 1. \end{enumerate} In what follows, we explicitly find $\bar\phi, \bar\phi_S,\eta$ such that the three conditions above hold. \vspace{5pt} \noindent\underline{Satisfying Condition 2}: Recall the deterministic min-max optimization in \eqref{eq:AO_det}. Choose $\bar\phi=\mathcal{D}(u_*,\tau_*)$ be the optimal cost of this optimization. From Lemma \ref{lem:AO}(ii), $\phi({\vct{g}},\vct{h})\stackrel{{P}}{\longrightarrow}\bar\phi$. Thus, for any $\eta>0$, with probability approaching 1: \begin{align}\label{eq:phi_lim} \bar\phi + \eta \geq \phi({\vct{g}},\vct{h}) \geq \bar\phi - \eta. \end{align} Clearly then, Condition 2 above holds for any $\eta>0$. \vspace{5pt} \noindent\underline{Satisfying Condition 3}: Next, we will show that the third condition holds for appropriate $\bar\phi$. Let $\vct{w}_n=\vct{w}_n({\vct{g}},\vct{h})$ be the unique minimizer of \eqref{eq:AO_con} as per Lemma \ref{lem:AO}(i), i.e., $\frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}_n+\boldsymbol{\beta}}^2 = \phi({\vct{g}},\vct{h})$. Again from Lemma \ref{lem:AO}, the minimization in \eqref{eq:AO_con} is $1/\Sigma_{\max}$-strongly convex in $\vct{w}$. Here, $\Sigma_{\max}$ is the upper bound on the eigenvalues of $\boldsymbol{\Sigma}$ as per Assumption (A2). Thus, for any $\tilde\varepsilon>0$ and any feasible $\vct{w}$ the following holds (deterministically): \begin{align}\label{eq:sc} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\boldsymbol{\beta}}^2 \geq \phi({\vct{g}},\vct{h}) + \frac{\tilde\epsilon^2}{2C},~\text{provided that}~ \|\vct{w}-\vct{w}_n({\vct{g}},\vct{h})\|_2 \geq \tilde\epsilon. \end{align} Now, we argue that \begin{align}\label{eq:dev_arg} \boldsymbol{\beta}\in\mathcal{S} \text{ implies that } \|\vct{w}-\vct{w}_n({\vct{g}},\vct{h})\|_2\geq \tilde\varepsilon \text{ wpa 1, } \end{align} for appropriate value of $\tilde\varepsilon$ and $\vct{w}=\sqrt{\boldsymbol{\Sigma}}(\boldsymbol{\beta}-\betab^\star)$. Consider any $\boldsymbol{\beta}\in\mathcal{S}$. \noindent First, by definition in \eqref{eq:S_set}, $$ |F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})-\alpha_*| \geq 2\varepsilon. $$ Second, by Lemma \ref{lem:AO}(iv), with probability approaching 1, $$ |F(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - \alpha_*| \leq \epsilon. $$ Third, we will show that wpa 1, there exists universal constant $C>0$ such that \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})| \leq C {\|\boldsymbol{\beta}_{n}({\vct{g}},\vct{h}) - \boldsymbol{\beta}\|_2}\label{eq:dev2show}. \end{align} Before proving \eqref{eq:dev2show}, let us argue how combining the above three displays shows the desired. Indeed, in that case, wpa 1, \begin{align*} 2\varepsilon &\leq |F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})-\alpha_*| \leq |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})| + |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - \alpha_*| \\ &\leq \epsilon + C \,\|\boldsymbol{\beta}-\boldsymbol{\beta}_n\|_2. \\ &\qquad\Longrightarrow \|\boldsymbol{\beta}-\boldsymbol{\beta}_n\|_2 \geq {\varepsilon}/{C}=:\hat\varepsilon\\ &\qquad\Longrightarrow \|\vct{w}-\vct{w}_n\|_2 \geq \hat\varepsilon\sqrt{\Sigma_{\min}}=:\tilde\varepsilon. \end{align*} In the last line above, we recalled that $\boldsymbol{\beta}=\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star$ and $\boldsymbol{\Sigma}_{i,i}\geq\Sigma_{\min},~i\in[p]$ by Assumption (A2). This proves \eqref{eq:dev_arg}. Next, combining \eqref{eq:dev_arg} and \eqref{eq:sc}, we find that wpa 1, $ \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\boldsymbol{\beta}}^2 \geq \phi({\vct{g}},\vct{h}) + \frac{\tilde\epsilon^2}{2C},~\text{for all}~ \vct{w}\in\mathcal{S}. $ Thus, \begin{align} \phi_S({\vct{g}},\vct{h}) \geq \phi({\vct{g}},\vct{h}) + \frac{\tilde\epsilon^2}{2\Sigma_{\max}}.\notag \end{align} When combined with \eqref{eq:phi_lim}, this shows that \begin{align} \phi_S({\vct{g}},\vct{h}) \geq \bar\phi + \frac{\tilde\epsilon^2}{2\Sigma_{\max}} - \eta. \end{align} Thus, choosing $\bar\phi_S = \bar\phi + \frac{\tilde\epsilon^2}{2\Sigma_{\max}}$ proves the Condition 3 above. \vspace{3pt} To complete the proof, let us now show \eqref{eq:dev2show}. Henceforth, $C$ is used to denote a universal constant whose value can change from line to line. First, consider the case $f=f_{\cal{L}}$, i.e., $f(x,y,z) = y(x-g(z))^2$. We have the following chain of inequalities: \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})| &= \frac{1}{p}\sum_{i=1}^p|\bSi_{i,i}|\left| (\sqrt{p}\betab^\star_i-g(\sqrt{p}\boldsymbol{\beta}_{n,i}))^2-(\sqrt{p}\betab^\star_i-g(\sqrt{p}\boldsymbol{\beta}_{i}))^2 \right|\notag\\ &\leq \Sigma_{\max} \frac{1}{p}\sum_{i=1}^p \left| (\sqrt{p}\betab^\star_i-g(\sqrt{p}\boldsymbol{\beta}_{n,i}))^2-(\sqrt{p}\betab^\star_i-g(\sqrt{p}\boldsymbol{\beta}_{i}))^2 \right|\notag\\ &\leq \Sigma_{\max} L \frac{1}{p}\sum_{i=1}^p (1+ \|\sqrt{p}[\betab^\star_i,\boldsymbol{\beta}_{n,i}]\|_2 + \|\sqrt{p}[\betab^\star_i,\boldsymbol{\beta}_{i}]\|_2) \sqrt{p}|\boldsymbol{\beta}_{n,i}-\boldsymbol{\beta}_{i}|\notag\\ &\leq \Sigma_{\max} L \Big(1+ \frac{1}{\sqrt{p}}\big(\sum_{i=1}^{p}\|\sqrt{p}[\betab^\star_i,\boldsymbol{\beta}_{n,i}]\|_2^2\big)^{1/2} + \frac{1}{\sqrt{p}}\big(\sum_{i=1}^p\|\sqrt{p}[\betab^\star_i,\boldsymbol{\beta}_{i}]\|_2^2\big)^{1/2}\Big) \|\boldsymbol{\beta}_{n}-\boldsymbol{\beta}\|_2\notag\\ &\leq C \left(1+ \max\{\|\betab^\star\|_2^2,\|\boldsymbol{\beta}_{n}\|_2^2,\|\boldsymbol{\beta}\|_2^2\}^{1/2} \right) \|\boldsymbol{\beta}_{n}-\boldsymbol{\beta}\|_2.\label{eq:fcase1} \end{align} In the second line above, we used boundedness of $\bSi_{i,i}$ as per Assumption (A2). In the third line, we used the fact that the function $\psi(a,b) = (a-g(b))^2$ is $\rm{PL}(2)$. The fourth line follows by Cauchy-Schwartz inequality. Finally, in the last line, we used the elementary fact that $a+b+c\leq 3\max\{a,b,c\}$ for $a=2\sum_{i=1}^p(\betab^\star_i)^2$ and $b=\sum_{i=1}^p\boldsymbol{\beta}_{n,i}^2$ and $c=\sum_{i=1}^p\boldsymbol{\beta}_{i}^2$. Second, consider the case $f\in\rm{PL}(2)$. Let $\vct{a}_i=(\sqrt{p}\boldsymbol{\beta}_{n,i}({\vct{g}},\vct{h}),\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$ and $\vct{b}_i=(\sqrt{p}\boldsymbol{\beta}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$, for $i\in[p]$. A similar chain of inequality holds: \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})| &\leq \frac{L}{p}\sum_{i=1}^p (1+\max\{\|\vct{a}_i\|_2,\|\vct{b}_i\|_2\})\|\vct{a}_i-\vct{b}_i\|_2\notag \\ &= \frac{L}{p}\sum_{i=1}^p \left(1+\max\{\|\vct{a}_i\|_2,\|\vct{b}_i\|_2\}\right)\cdot|\sqrt{p}\boldsymbol{\beta}_{n,i}({\vct{g}},\vct{h}) - \sqrt{p}\boldsymbol{\beta}_i|\notag\\ &\leq L\left(1+\max\{\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2},\frac{1}{p}\sum_{i=1}^p\|\vct{b}_i\|_2^{2}\} \right)^{1/2}{\|\boldsymbol{\beta}_{n}({\vct{g}},\vct{h}) - \boldsymbol{\beta}\|_2}\notag\\ &\leq C\left(1+\max\{\|\boldsymbol{\beta}_{n}\|_2^2,\|\betab^\star\|_2^2,\|\boldsymbol{\beta}\|_2^2,\frac{1}{p}\sum_{i=1}^p\bSi_{i,i}^2\} \right)^{1/2}{\|\boldsymbol{\beta}_{n}({\vct{g}},\vct{h}) - \boldsymbol{\beta}\|_2}\notag\\ &\leq C\Sigma_{\max}^2\left(1+\max\{\|\boldsymbol{\beta}_{n}\|_2^2,\|\betab^\star\|_2^2,\|\boldsymbol{\beta}\|_2^2\} \right)^{1/2}{\|\boldsymbol{\beta}_{n}({\vct{g}},\vct{h}) - \boldsymbol{\beta}\|_2}.\label{eq:fcase2} \end{align} The first inequality uses the fact that $f\in\rm{PL}(2)$. The second inequality in the third line follows by Cauchy-Schwartz. The last inequality used Assumption (A2) on boundedness of $\bSi_{i,i}$. It follows from either \eqref{eq:fcase1} or \eqref{eq:fcase2} that in order to prove \eqref{eq:dev2show}, we need to show boundedness of the following terms: $\|\boldsymbol{\beta}_n\|_2$, $\|\betab^\star\|_2$ and $\|\boldsymbol{\beta}\|_2$. By feasibility of $\boldsymbol{\beta}_n$ and $\boldsymbol{\beta}$, we know that $\boldsymbol{\beta}_n,\boldsymbol{\beta}\in\mathcal{B}$. Thus, the desired $\|\boldsymbol{\beta}\|_2<\infty$ and $\|\boldsymbol{\beta}_n\|_2<\infty$ follow directly by Lemma \ref{lem:bd_PO}. (Alternatively, for $\boldsymbol{\beta}_n$ we conclude the desired by directly applying Lemma \ref{lem:AO}(v)). Finally, to prove $\|\betab^\star\|_2<\infty$, note that $$ \|\betab^\star\|_2^2 =\frac{1}{p}\sum_{i=1}^p(\sqrt{p}\betab^\star_i)^2, $$ \cts{which is bounded wpa 1 by Assumption (A2), which implies bounded second moments of $\sqrt{p}\betab^\star$. } This completes the proof of \eqref{eq:dev2show}, as desired. \vspace{5pt} \noindent\underline{Satisfying Condition 1:} To prove Condition 1, we simply pick $\eta$ to satisfy the following \begin{align} \bar\phi_S > \bar\phi + 3 \eta ~\Leftarrow~ \bar\phi + \frac{\tilde\epsilon^2}{2\Sigma_{\max}} - \eta \geq \bar\phi + 3 \eta ~\Leftarrow~ \eta \leq \frac{\tilde\epsilon^2}{8\Sigma_{\max}}.\notag \end{align} This completes the proof of Theorem \ref{thm:master_W2}. \subsection{Proof of Lemma \ref{lem:AO}}\label{sec:proofAO} ~~~~ ~~~~ \vspace{3pt} \subsubsection{Proof of (i).} Strong convexity of the objective function in \eqref{eq:PO} is easily verified by the second derivative test. Note here that we use Assumption (A2) that $\bSi_{i,i}\leq\Sigma_{\max},~i\in[p].$ Uniqueness of the solution follows directly from strong convexity. \ct{Strictly speaking we might need to also argue existence, i.e., feasibility of the AO. An indirect way is to show feasibility using the CGMT, but it seems unnecessarily complicated?} \vspace{5pt} \subsubsection{Proof of (ii).}Using Lagrangian formulation, the solution $\vct{w}_n$ to \eqref{eq:AO_con} is the same as the solution to the following: \begin{align} \left(\vct{w}_n,u_n\right) :=\arg\min_{\vct{w}\in\mathcal{B}}\max_{u\geq 0} ~\frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2 + u \left( \sqrt{\tn{\vct{w}}^2+\sigma^2} \tn{\bar{\g}} - \sqrt{\kappa}\,{\bar{\h}}^T\vct{w} + \frac{\sigma h}{\sqrt{n}} \right)\label{eq:AO_2} \end{align} where we have: (i) set $\bar{\g} := {\vct{g}}/\sqrt{n}$ and $\bar{\h}:= \vct{h}/\sqrt{p}$; (ii) recalled that $p/n=\kappa$; and, (iii) used $\left(\vct{w}_n,u_n\right)$ to denote the optimal solutions in \eqref{eq:AO_2}. The subscript $n$ emphasizes the dependence of $\left(\vct{w}_n,u_n\right)$ on the problem dimensions. Also note that (even though not explicit in the notation) $\left(\vct{w}_n,u_n\right)$ are random variables depending on the realizations of $\bar{\g},\bar{\h}$ and $h$. Notice that the objective function above is convex in $\vct{w}$ and linear (thus, concave) in $u$. Thus, strong duality holds and we can flip the order of min-max. Moreover, in order to make the objective easy to optimize with respect to $\vct{w}$, we use the following variational expression for the square-root term $\sqrt{\tn{\vct{w}}^2+\sigma^2}$: $$ \tn{\bar{\g}}\sqrt{\tn{\vct{w}}^2+\sigma^2} = \tn{\bar{\g}}\cdot\min_{\tau\in[\sigma,\sqrt{\sigma^2+B_+^2}]} \left\{ \frac{\tau}{2} + \frac{\tn{\vct{w}}^2+\sigma^2}{2\tau} \right\} = \min_{\tau\in[\sigma,\sqrt{\sigma^2+B_+^2}]} \left\{ \frac{\tau\tn{\bar{\g}}^2}{2} + \frac{\sigma^2}{2\tau} + \frac{\tn{\vct{w}}^2}{2\tau} \right\}, $$ where $B$ is defined in Lemma \ref{lem:bd_PO}. For convenience define the constraint set for the variable $\tau$ as $\mathcal{T}':=[\sigma,\sqrt{\sigma^2+B_+^2}]$. For reasons to be made clear later in the proof (see proof of statement (iii)), we consider the (possibly larger) set: \[ \mathcal{T}:=[\sigma,\max\{\sqrt{\sigma^2+B_+^2},2\tau_*\}]\, \] where $\tau_*$ is as in the statement of the lemma. The above lead to the following equivalent formulation of \eqref{eq:AO_2}: \begin{align} \left(\vct{w}_n,u_n,\tau_n\right) = \max_{u\geq 0}\min_{\tau\in\mathcal{T}} ~ \frac{u\tau\tn{\bar{\g}}^2}{2} + \frac{u\sigma^2}{2\tau} + \frac{u\sigma h}{\sqrt{n}} + \min_{\vct{w}\in\mathcal{B}} \left\{ \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2 + \frac{u}{2\tau}\tn{\vct{w}}^2 - u \sqrt{\kappa}\,{\bar{\h}}^T\vct{w} \right\} .\label{eq:AO_3} \end{align} The minimization over $\vct{w}$ is easy as it involves a strongly convex quadratic function. First, note that unconstrained optimal $\vct{w}':=\vct{w}'(\tau,u)$ (for fixed $(\tau,u)$) is given by \begin{align}\label{eq:w'} \vct{w}':=\vct{w}'(\tau,u) = -\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u\sqrt{\kappa}\bar{\h}\right), \end{align} and \eqref{eq:AO_3} simplifies to \begin{align} \left(u_n,\tau_n\right)=\max_{u\geq 0}\min_{\tau\in\mathcal{T}} ~ \frac{u\tau\tn{\bar{\g}}^2}{2} + \frac{u\sigma^2}{2\tau} + \frac{u\sigma h}{\sqrt{n}} - \frac{1}{2} \left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u\sqrt{\kappa}\bar{\h}\right)^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1} \left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u\sqrt{\kappa}\bar{\h}\right)\,=:\mathcal{R}(u,\tau) .\label{eq:AO_4} \end{align} It can be checked by direct differentiation and the second-derivative test that the objective function in \eqref{eq:AO_4} is strictly convex in $\tau$ and strictly concave in $u$ in the domain $\{(u,\tau)\in\mathbb{R}_+\times\mathbb{R}_+\}$. Thus, the saddle point $(u_n,\tau_n)$ is unique. Specifically, this implies that the optimal $\vct{w}_n$ in \eqref{eq:AO_3} is given by (cf. \eqref{eq:w'}) \begin{align}\label{eq:w_n} \vct{w}_n=\vct{w}'(\tau_n,u_n) = -\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}\left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u_n\sqrt{\kappa}\bar{\h}\right). \end{align} In Lemma \ref{lem:AO}(v) we will prove that wpa 1, in the limit of $p\rightarrow\infty$, $\|\vct{w}_n\|_2\leq C$ for sufficiently large absolute constant $C>0$. Thus, by choosing the upper bound in the definition of $\mathcal{B}$ in Lemma \ref{lem:bd_PO} strictly larger than C, guarantees that the unconstrained $\vct{w}_n$ in \eqref{eq:w_n} is feasible in \eqref{eq:AO_3}. In what follows, we characterize the high-dimensional limit of the optimal pair $(u_n,\tau_n)$ in the limit $n,p\rightarrow\infty,~p/n\rightarrow\kappa$. We start by analyzing the (point-wise) convergence of $\mathcal{R}(u,\tau)$. For the first three summands in \eqref{eq:AO_4}, we easily find that $$ \left\{\frac{u\tau\tn{\bar{\g}}^2}{2} + \frac{u\sigma^2}{2\tau} + \frac{u\sigma h}{\sqrt{n}}\right\}~ \stackrel{{P}}{\longrightarrow}~\left\{ \frac{u\tau}{2} + \frac{u\sigma^2}{2\tau} \right\}. $$ Next, we study the fourth summand. First, note that \begin{align} (u\sqrt{\kappa}\bar{\h})^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}(u\sqrt{\kappa}\bar{\h}) &= u^2\kappa\,\frac{1}{p}\vct{h}^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\vct{h} \notag\\ &= u^2\kappa\,\frac{1}{p}\sum_{i=1}^{p}\frac{\vct{h}_i^2}{\bSi_{i,i}^{-1}+\frac{u}{\tau}} \notag\\ &\stackrel{{P}}{\longrightarrow} u^2\kappa\,\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right]. \end{align} In the last line, $\Lambda$ is a random variable as in Definition \ref{def:Xi}. \cts{Also, we used Assumption (A2) together with the facts that $\vct{h}$ is independent of $\boldsymbol{\Sigma}$ and that the function $(x_1,x_2)\mapsto x_1^2(x_2^{-1}+u/\tau)^{-1}$ is $\rm{PL}(2)$ assuming $x_2$ is bounded.} \ct{Question: Is it immediate that the empirical distribution of $(\beta,\boldsymbol{\Sigma},\vct{h})$ converges in $W_k$ to $\mu\otimes\mathcal{N}(0,1)$ given that $(\beta,\boldsymbol{\Sigma})$ converges to $\mu$ and $\vct{h}$ is independent???} Second, we find that \begin{align} (\betab^\star)^T\boldsymbol{\Sigma}^{-1/2}\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\boldsymbol{\Sigma}^{-1/2}\betab^\star &= \frac{1}{p}(\sqrt{p}\betab^\star)^T\left({\mtx{I}}+\frac{u}{\tau}\boldsymbol{\Sigma}\right)^{-1}(\sqrt{p}\betab^\star) \notag\\ &= \frac{1}{p}\sum_{i=1}^{p}\frac{\left(\sqrt{p}\betab^\star_i/\sqrt{\bSi_{i,i}}\right)^2}{\bSi_{i,i}^{-1}+\frac{u}{\tau}}\notag\\ &\stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\Lambda^{-1}+\frac{u}{\tau}}\right]. \end{align} Here, $\Lambda,B$ are random variables as in Definition \ref{def:Xi} and \cts{we also used Assumption (A2) together with the fact that the function $(x_1,x_2)\mapsto x_1^2x_2^{-1}(x_2^{-1}+u/\tau)^{-1}$ is $\rm{PL}(2)$ assuming $x_2$ is bounded.} Third, \cts{by independence of $(\betab^\star, \boldsymbol{\Sigma})$ from $\vct{h}$} \begin{align} (u\sqrt{\kappa}\bar{\h})^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\boldsymbol{\Sigma}^{-1/2}\betab^\star = u\sqrt{\kappa} \cdot \frac{1}{p}\sum_{i=1} ^p \frac{\vct{h}_i\boldsymbol{\Sigma}_{i,i}^{-1/2}(\sqrt{p}\betab^\star_i)}{\boldsymbol{\Sigma}_{i,i}^{-1}+\frac{u}{\tau}{\mtx{I}}} ~\stackrel{{P}}{\longrightarrow}~ 0. \end{align} Putting these together, the objective $\mathcal{R}(u,\tau)$ in \eqref{eq:AO_4} converges point-wise in $u,\tau$ to \begin{align} \mathcal{R}(u,\tau)\stackrel{{P}}{\longrightarrow}\mathcal{D}(u,\tau) := \frac{1}{2}\left({u\tau} + \frac{u\sigma^2}{\tau} - u^2\kappa\,\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] - \operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\Lambda^{-1}+\frac{u}{\tau}}\right] \right).\label{eq:conv_pt} \end{align} Note that $\mathcal{R}(u,\tau)$ (and thus, $\mathcal{D}(u,\tau)$) is convex in $\tau$ and concave in $u$. Thus, the convergence in \eqref{eq:conv_pt} is in fact uniform (e.g., \cite{AG1982}) and we can conclude that \begin{align}\label{eq:Dc0} \phi({\vct{g}},\vct{h}) \stackrel{{P}}{\longrightarrow} \max_{u\geq 0}\min_{\tau\in\mathcal{T}}~ \mathcal{D}(u,\tau). \end{align} and \begin{align}\label{eq:Dc} (u_n,\tau_n) \stackrel{{P}}{\longrightarrow} (u_*,\tau_*):=\arg\max_{u\geq 0}\min_{\tau\in\mathcal{T}}~ \mathcal{D}(u,\tau). \end{align} In the proof of statement (iii) below, we show that the saddle point of \eqref{eq:Dc0} is $(u_*,\tau_*)$. In particular, $\tau_*$ is strictly in the interior of $\mathcal{T}$, which combined with convexity implies that $$ \max_{u\geq 0}\min_{\tau\in\mathcal{T}}~ \mathcal{D}(u,\tau) = \max_{u\geq 0}\min_{\tau>0}~ \mathcal{D}(u,\tau) =: \bar\phi. $$ This, together with the first display above proves the second statement of the lemma. \vspace{5pt} \subsubsection{Proof of (iii).} Next, we compute the saddle point $(u_*,\tau_*)$ by studying the first-order optimality conditions of the srtictly concave-convex $\mathcal{D}(u,\tau)$. Specifically, we consider unconstrained minimization over $\tau$ and we will show that the minimum is achieved in the strict interior of $\mathcal{T}$. Direct differentiation gives \begin{subequations} \begin{align} {\tau} + \frac{\sigma^2}{\tau} - 2u\kappa\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] + \frac{u^2}{\tau}\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1}+\frac{u}{\tau}\right)^2}\right] + \frac{1}{\tau}\operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1}+\frac{u}{\tau}\right)^2}\right] &= 0, \label{eq:fo1}\\ {u} - \frac{u\sigma^2}{\tau^2} - \frac{u^3}{\tau^2}\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1} + \frac{u}{\tau}\right)^2}\right] - \frac{u}{\tau^2} \operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1}+\frac{u}{\tau}\right)^2}\right] &= 0,\label{eq:fo2} \end{align} \end{subequations} Multiplying \eqref{eq:fo2} with $\frac{\tau}{u}$ and adding to \eqref{eq:fo1} results in the following equation \begin{align} \tau = u\kappa\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] ~\Leftrightarrow ~ \operatorname{\mathbb{E}}\left[ \frac{1}{(\frac{u}{\tau}\Lambda)^{-1}+1} \right] = \frac{1}{\kappa} \label{eq:tauu}\,. \end{align} Thus, we have found that the ratio $\frac{u_*}{\tau_*}$ is the unique solution to the equation in \eqref{eq:tauu}. Note that this coincides with the Equation \eqref{eq:ksi} that defines the parameter $\xi$ in Definition \ref{def:Xi}. The fact that \eqref{eq:tauu} has a unique solution for all $\kappa>1$ can be easily seen as $F(x)=\operatorname{\mathbb{E}}\left[ \frac{1}{(x\Lambda)^{-1}+1} \right], x\in\mathbb{R}_+$ has range $(0,1)$ and is strictly increasing (by differentiation). Thus, we call $\xi=\frac{u_*}{\tau_*}$. Moreover, multiplying \label{eq:fo2} with $u$ leads to the following equation for $\tau_*$: \begin{align} u_*^2 = \sigma^2\xi^2 + u_*^2 \xi^2 \kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1} +\xi\right)^2}\right] + \xi^2 \operatorname{\mathbb{E}}\left[ \frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1} + \xi\right)^2}\right] ~\Rightarrow~ \tau_*^2 = \frac{\sigma^2 + \operatorname{\mathbb{E}}\left[ \frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1} + \xi\right)^2}\right]}{1-\xi^2\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1} +\xi\right)^2}\right]} = \frac{\sigma^2 + \operatorname{\mathbb{E}}\left[ \frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1} + \xi\right)^2}\right]}{1-\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left((\xi\Lambda)^{-1} +1\right)^2}\right]}. \end{align} {Again, note that this coincides with Equation \eqref{eq:gamma} that determines the parameter $\gamma$ in Definition \ref{def:Xi}, i.e., $\tau_*^2 = \gamma.$ } \vspace{5pt} \subsubsection{Proof of (iv).} For convenience, define $$F_n(\hat\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma}):=\frac{1}{p} \sum_{i=1}^{p} f\left(\sqrt{p}\hat\boldsymbol{\beta}_{n,i},\sqrt{p}\betab^\star_{i},\boldsymbol{\Sigma}_{ii}\right)\quad\text{and}\quad\alpha_*:=\operatorname{\mathbb{E}}_\mu\left[f(X_{\kappa,\sigma^2}(\Lambda,B,H),B,\Lambda)\right].$$ Recall from \eqref{eq:w_n} the explicit expression for $\vct{w}_n$, repeated here for convenience. \begin{align} \vct{w}_n = -\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}\left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u_n\sqrt{\kappa}\bar{\h}\right).\notag \end{align} Also, recall that $\boldsymbol{\beta}_n = \boldsymbol{\Sigma}^{-1/2}\vct{w}_n+\betab^\star$. Thus, (and using the fact that $\bar{\h}$ is distributed as $-\bar{\h}$), \begin{align} \boldsymbol{\beta}_n &=\boldsymbol{\Sigma}^{-1/2}\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}u_n\sqrt{\kappa}\bar{\h} + \left({\mtx{I}}-\boldsymbol{\Sigma}^{-1/2}\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}\boldsymbol{\Sigma}^{-1/2}\right)\betab^\star\notag\\ \Longrightarrow\boldsymbol{\beta}_{n,i}&=\frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_n\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_n\bar{\h}_i +\left(1-\frac{1}{1+\xi_n\boldsymbol{\Sigma}_{i,i}}\right)\betab^\star_i.\label{eq:betan} \end{align} For $i\in[p]$, define \begin{align} \vct{v}_{n,i} = \frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_*\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_*\bar{\h}_i +\left(1-\frac{1}{1+\xi_*\boldsymbol{\Sigma}_{i,i}}\right)\betab^\star_i \end{align} In the above, for convenience, we have denoted $\xi_n:=u_n/\tau_n$ and recall that $\xi_*:=u_*/\tau_*$. The proof proceeds in two steps. In the first step, we use the fact that $\xi_n\stackrel{{P}}{\longrightarrow}\xi_*$ and $u_n\stackrel{{P}}{\longrightarrow} u_\star$ (see \eqref{eq:Dc}) to prove that for any $\varepsilon\in(0,\xi_*/2)$, there exists absolute constant $C>0$ such that wpa 1: \begin{align}\label{eq:ivstep1} |F_n(\sqrt{p}\boldsymbol{\beta}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) - F_n(\sqrt{p}\vct{v}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) | \leq C\varepsilon. \end{align} In the second step, we use Lipschitzness of $f$ and Assumption \ref{ass:mu} to prove that \begin{align} |F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| \stackrel{{P}}{\longrightarrow} \alpha_*.\label{eq:ivstep2} \end{align} The desired follows by combining \eqref{eq:ivstep1} and \eqref{eq:ivstep2}. Thus, in what follows, we prove \eqref{eq:ivstep1} and \eqref{eq:ivstep2}. \vspace{2pt} \noindent\underline{Proof of \eqref{eq:ivstep1}.}~~Fix some $\varepsilon\in(0,\xi_*/2)$. From \eqref{eq:Dc}, we know that w.p.a. 1 $|\xi_n-\xi_*|\leq \varepsilon$ and $|u_n-u_*|\leq \varepsilon$. Thus, $\vct{w}_n$ is close to $\vct{v}_n$. Specifically, in this event, for every $i\in[p]$, it holds that: \begin{align} \notag|\boldsymbol{\beta}_{n,i} - \vct{v}_{n,i}| &\leq {|\betab^\star_i|}\left|\frac{1}{1+\xi_n\bSi_{i,i}}-\frac{1}{1+\xi_*\bSi_{i,i}}\right| + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\boldsymbol{\Sigma}_{i,i}}}\left|\frac{\tau_n}{1+(\xi_n\bSi_{i,i})^{-1}}-\frac{\tau_*}{1+(\xi_*\bSi_{i,i})^{-1}}\right| \\ \notag&= {|\betab^\star_i|}\left|\frac{1}{1+\xi_n\bSi_{i,i}}-\frac{1}{1+\xi_*\bSi_{i,i}}\right| + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\boldsymbol{\Sigma}_{i,i}}}\left|\frac{u_n}{\xi_n+\bSi_{i,i}^{-1}}-\frac{u_*}{\xi_*+\bSi_{i,i}^{-1}}\right| \\ \notag& \leq {|\betab^\star_i|}\frac{|\bSi_{i,i}||\xi_n-\xi_*|}{|1+\xi_n\bSi_{i,i}||1+\xi_*\bSi_{i,i}|} + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\bSi_{i,i}}} \frac{u_*|\xi_n-\xi_*|}{(\xi_n+\bSi_{i,i}^{-1})(\xi_*+\bSi_{i,i}^{-1})} + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\bSi_{i,i}}}\frac{|u_n-u_*|}{\xi+\bSi_{i,i}^{-1}} \\ \notag& \leq {|\betab^\star_i|}{\Sigma_{\max}\varepsilon} + \sqrt{\kappa}{|\bar{\h}_i|} u_*\Sigma_{\max}^{3/2} \varepsilon+ \sqrt{\kappa}|\bar{\h}_i|\Sigma_{\max}^{1/2}\varepsilon \\ &\leq \varepsilon \cdot \max\left\{\Sigma_{\max}^{3/2},\Sigma_{\max}^{1/2}\right\}\, \left(|\bar{\h}_i| + |\betab^\star_i|\right).\label{eq:betav} \end{align In the second line above, we recalled that $u_n=\tau_n\xi_n$ and $u_*=\tau_*\xi_*$. In the third line, we used the triangle inequality. In the fourth line, we used that $\xi_*>0$, $0<\bSi_{i,i}\leq\Sigma_{\max}$ and $\xi_n\geq \xi_*-\varepsilon \geq \xi_*/2 >0$. Now, we will use this and Lipschitzness of $f$ to argue that there exists absolute constant $C>0$ such that wpa 1: \begin{align} |F_n(\sqrt{p}\boldsymbol{\beta}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) - F_n(\sqrt{p}\vct{v}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) | \leq C\varepsilon.\notag \end{align} Denote, $\vct{a}_i=(\sqrt{p}\boldsymbol{\beta}_{n,i},\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$ and $\vct{b}_i=(\sqrt{p}\vct{v}_{n,i},\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$. Following the exact same argument as in \eqref{eq:dev2show} (just substitute $\boldsymbol{\beta}\leftrightarrow\vct{v}_n$ in the derivation), we have that for some absolute constant $C>0$ wpa 1: \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| &\leq C \|\boldsymbol{\beta}_n-\vct{v}_n\|_2. \end{align} From this and \eqref{eq:betav}, we find that \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| &\leq C\varepsilon\max\left\{\Sigma_{\max}^{3/2},\Sigma_{\max}^{1/2} \right\} \left(\sum_{i=1}^p \left(|\bar{\h}_i|+|\betab^\star_i|\right)^2\right)^{1/2}\notag \\ &\leq C\varepsilon\sqrt{2}\max\left\{\Sigma_{\max}^{3/2},\Sigma_{\max}^{1/2}\right\}\sqrt{\|\betab^\star\|_2^2 + \|\bar{\h}\|_2^2}.\label{eq:epsS} \end{align} But, \cts{recall that $\|\betab^\star\|_2^2 = \frac{1}{p}\sum_{i=1}^p(\sqrt{p}\betab^\star_i)^2<\infty$, as $p\rightarrow \infty$ by Assumption (A2).} Also, since $\bar{\h}_i\sim\mathcal{N}(0,1/p)$, it holds that $\|\bar{\h}\|_2^2\leq 2$, wpa 1 as $p\rightarrow\infty$. Therefore, from \eqref{eq:epsS}, wpa 1, there exists constant $C>0$ such that \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| \leq C \cdot\varepsilon, \end{align} as desired. \vspace{2pt} \noindent\underline{Proof of \eqref{eq:ivstep2}.}~~Next, we will use (A2) to show that \begin{align} |F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| \stackrel{{P}}{\longrightarrow} \alpha_*.\label{eq:AO_conv} \end{align} Notice that $\vct{v}_n$ is a function of $\betab^\star,\boldsymbol{\Sigma},\bar{\h}$. Concretely, define ${\widetilde{g}}:\mathbb{R}^3\rightarrow\mathbb{R}$, such that $$ \widetilde{g}(x_1,x_2,x_3) := \frac{x_2^{-1/2}}{1+(\xi_* x_2)^{-1}}\sqrt{\kappa}\tau_* x_3 + (1-(1+\xi_*x_2)^{-1})x_1, $$ and notice that $$ \sqrt{p}\vct{v}_{n,i} = \widetilde{g}\left(\sqrt{p}\betab^\star_i,\bSi_{i,i},\vct{h}_i\right) = \frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_*\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_*\vct{h}_i +\left(1-\frac{1}{1+\xi_*\boldsymbol{\Sigma}_{i,i}}\right)\sqrt{p}\betab^\star_i. $$ Thus, $$ F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma}) = \frac{1}{p}\sum_{i=1}^p f\left(g\left(\sqrt{p}\betab^\star_i,\bSi_{i,i},\vct{h}_i\right),\sqrt{p}\betab^\star_i,\bSi_{i,i}\right) =: \frac{1}{p}\sum_{i=1}^p h\left(\vct{h}_i,\sqrt{p}\betab^\star_i,\bSi_{i,i}\right), $$ where we have defined $h:\mathbb{R}^3\rightarrow\mathbb{R}$: \begin{align} h(x_1,x_2,x_3) := f\left(\widetilde{g}(x_2,x_3,x_1),x_2,x_3\right).\label{h func} \end{align} \cts{We will prove that $h\in\rm{PL}(4)$. Indeed, if that were the case, then Assumption (A2) gives} \begin{align} \frac{1}{p}\sum_{i=1}^p h\left(\vct{h}_i,\sqrt{p}\betab^\star_i,\bSi_{i,i}\right) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{\mathcal{N}(0,1)\otimes \mu}\left[h(H,B,\Lambda)\right] &= \operatorname{\mathbb{E}}_{\mathcal{N}(0,1)\otimes \mu}\left[f\left(\widetilde{g}(B,\Lambda,H),B,\Lambda\right))\right]\\ & = \operatorname{\mathbb{E}}[f\left(X_{\kappa,\sigma^2}(\Lambda,B,H),B,\Lambda\right)] = \alpha_*, \end{align} where the penultimate equality follows by recognizing that (cf. Eqn. \eqref{eq:X}) $$ \widetilde{g}(B,\Lambda,H) = (1-(1+\xi_*\Lambda)^{-1})B + \sqrt{\kappa}\frac{\tau_*\Lambda^{-1/2}}{1+(\xi_*\Lambda)^{-1}}H = X_{\kappa,\sigma^2}(\Lambda,B,H). $$ It remains to show that $h\in\rm{PL}(4)$. Lemma \ref{lem:hPL} in Section \ref{SM useful fact} shows that if $f\in\rm{PL}(k)$, then $h\in\rm{PL}(k+1)$ for all integers $k\geq 2$. First, consider the case $f\in\rm{PL}(2)$. Then, $h\in\rm{PL}(3)$; thus, also $h\in\rm{PL}(4)$. Second, consider the case $f=f_{\cal{L}}$. Then, we prove in Lemma \ref{lem:fL} that $f_{\cal{L}}\in\rm{PL}(3)$. Thus, the desired holds in this case too. \vspace{5pt} \subsubsection{Proof of (v):} Let $\psi:\mathbb{R}\rightarrow\mathbb{R}$ be any bounded Lipschitz function. The function $f(a,b,c) = \psi(a)$ is trivially $\rm{PL}$ of order $2$. Thus, by directly applying statement (iv) of the lemma, we find that $$ \frac{1}{p}\sum_{i=1}^p{\psi(\sqrt{p}\boldsymbol{\beta}_{n,i}({\vct{g}},\vct{h}))} \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}\left[\psi(X_{\kappa,\sigma^2})\right]. $$ Since this holds for any bounded Lipschitz function, we have shown that the empirical convergence of $\boldsymbol{\beta}_n$ converges weakly to the distribution of $X_{\kappa,\sigma^2}$. It remains to prove boundedness of the $2$nd moment as advertised in \eqref{eq:k_AO}. Recall from \eqref{eq:betan} that \begin{align} \sqrt{p}\boldsymbol{\beta}_{n,i}&=\frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_n\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_n\vct{h}_i +\left(1-\frac{1}{1+\xi_n\boldsymbol{\Sigma}_{i,i}}\right)(\sqrt{p}\betab^\star_i).\notag \end{align} Using this, boundedness of $\boldsymbol{\Sigma}_{i,i}$ from Assumption (A2), and the fact that $\tau_n\stackrel{{P}}{\longrightarrow}\tau_\star, \xi_n\stackrel{{P}}{\longrightarrow}\xi_\star$, there exists constant $C=C(\Sigma_{\max},\Sigma_{\min},k,\tau_\star,\xi_\star)$ such that wpa 1, \begin{align} \frac{1}{p}\sum_{i=1}^p|\sqrt{p}\boldsymbol{\beta}_{n,i}|^{2} \leq C\left(\frac{1}{p}\sum_{i=1}^p|\vct{h}_{i}|^{2}+\frac{1}{p}\sum_{i=1}^p|\sqrt{p}\betab^\star_{i}|^{2}\right).\notag \end{align} But the two summands in the expression above are finite in the limit of $p\rightarrow\infty$. Specifically, (i) from Assumption (A2), $\frac{1}{p}\sum_{i=1}^p|\sqrt{p}\betab^\star_{i}|^{2}\stackrel{{P}}{\longrightarrow}\operatorname{\mathbb{E}}[B^{2}]<\infty$; (ii) $\frac{1}{p}\sum_{i=1}^p|\vct{h}_{i}|^{2}\stackrel{{P}}{\longrightarrow}\operatorname{\mathbb{E}}[H^{2}]=1$, using the facts that $\vct{h}_i\stackrel{iid}{\sim}\mathcal{N}(0,1)$ and $H\sim\mathcal{N}(0,1)$. This proves \eqref{eq:k_AO}, as desired. \input{risks_proofs} \section{Useful results about pseudo-Lipschitz functions}\label{SM useful fact} For $k\geq 1$ we say a function $f:\mathbb{R}^m\rightarrow\mathbb{R}$ is pseudo-Lipschitz of order $k$ and denote it by $f\in \rm{PL}(k)$ if there exists a cosntant $L>0$ such that, for all $\vct{x},\vct{y}\in\mathbb{R}^m$: \begin{align} |f(\vct{x})-f(\vct{y})|\leq L\left(1+\|\vct{x}\|_2^{k-1}+\|\vct{y}\|_2^{k-1}\right)\|\vct{x}-\vct{y}\|_2.\label{PL func} \end{align} In particular, when $f\in\rm{PL}(k)$, the following properties hold: \begin{enumerate} \item There exists a constant $L'$ such that for all $\vct{x}\in\mathbb{R}^n$: $|f(\vct{x})|\leq L'(1+\|\vct{x}\|_2^k).$ \item $f$ is locally Lipschitz, that is for any $M>0$, there exists a constant $L_{M,m}<\infty$ such that for all $x,y\in[-M,M]^m$, $ |f(\vct{x})-f(\vct{y})| \leq L_{M,m}\|\vct{x}-\vct{y}\|_2. $ Further, $L_{M,m}\leq c(1+(M\sqrt{m})^{k-1})$ for some costant $c$. \end{enumerate} Using the above properties, we prove the following two technical lemmas used in the proof of Theorem \ref{thm:app_W2} \begin{lemma}\label{lem:fL} Let $g:\mathbb{R}\rightarrow\mathbb{R}$ be a Lipschitz function. Consider the function $f:\mathbb{R}^3\rightarrow\mathbb{R}$ defined as follows: $$ f(\vct{x}) = x_1(x_2-g(x_3))^2. $$ Then, $f\in\rm{PL}(3).$ \end{lemma} \begin{proof} Let $h:\mathbb{R}^2\rightarrow\mathbb{R}$ defined as $h({\vct{u}})=({\vct{u}}_1-g({\vct{u}}_2))^2$. The function $({\vct{u}}_1,{\vct{u}}_2)\mapsto{\vct{u}}_1-g({\vct{u}}_2)$ is clearly Lipschitz. Thus, $h\in\rm{PL}(2)$, i.e., \begin{align} |h({\vct{u}})-h(\vct{v})| \leq C(1+\|{\vct{u}}\|_2+\|\vct{v}\|_2)\|{\vct{u}}-\vct{v}\|_2\quad\text{and}\quad |h(\vct{v})|\leq C'(1+\|\vct{v}\|_2^2).\label{eq:h_pl} \end{align} Therefore, letting $\vct{x}=(x_1,{\vct{u}})\in\mathbb{R}^3$ and $\vct{y}=(y_1,\vct{v})\in\mathbb{R}^3$, we have that \begin{align} |f(\vct{x})-f(\vct{y})| &= |x_1h({\vct{u}}) - y_1h(\vct{v})| \leq |x_1||h({\vct{u}})-h(\vct{v})| + |h(\vct{v})| |x_1-y_1|\notag\\ &\leq C|x_1|(1+\|{\vct{u}}\|_2+\|\vct{v}\|_2)\|{\vct{u}}-\vct{v}\|_2 + C'(1+\|\vct{v}\|_2^2)|x_1-y_1| \notag\\ &\leq C(|x_1|^2+(1+\|{\vct{u}}\|_2+\|\vct{v}\|_2)^2)\|{\vct{u}}-\vct{v}\|_2 + C'(1+\|\vct{v}\|_2^2)|x_1-y_1| \notag\\ &\leq C(1+\|\vct{x}\|_2^2+\|\vct{y}\|_2^2)\|{\vct{u}}-\vct{v}\|_2 + C'(1+\|\vct{x}\|_2^2+\|\vct{y}\|_2^2)|x_1-y_1| \notag\\ &\leq C(1+\|\vct{x}\|_2^2+\|\vct{y}\|_2^2)\|\vct{x}-\vct{y}\|_2. \end{align} In the second line, we used \eqref{eq:h_pl}. In the third line, we used $2xy\leq x^2+y^2$. In the fourth line, we used Cauchy-Schwarz inequality. $C,C'>0$ are absolute constants that may change from line to line. This completes the proof of the lemma. \end{proof} \begin{lemma}\label{lem:hPL} Let functions $f,g:\mathbb{R}^3\rightarrow\mathbb{R}$ such that $f\in\rm{PL}(k)$ and $$ g(x_1,x_2,x_3) := \frac{x_2^{-1/2}}{1+(\xi_* x_2)^{-1}}\sqrt{\kappa}\tau_* x_3 + (1-(1+\xi_*x_2)^{-1})x_1. $$ Here, $\xi_*,\tau_*,\kappa$ are positive constants. Further define \begin{align} h(x,y,z) := f\left(g(y,z,x),y,z\right), \end{align} and assume that $y$ take values on a fixed bounded compact set $\mathcal{M}$. Then, it holds that $h\in\rm{PL}(k+1)$. \end{lemma} \begin{proof} Since $f$ is $\rm{PL}(k)$, for some $L>0$, \eqref{PL func} holds. Fix $x,x'\in\mathbb{R}$, $\vct{a}=[y,z]\in\mathbb{R}^{2}$ and $\vct{a}'=[y',z']\in\mathbb{R}^{2}$. Let $\vct{b}=[{\vct{g}},\vct{a}]=[{\vct{g}},y,z]\in\mathbb{R}^3$ where ${\vct{g}}=g(y,z,x)\in\mathbb{R}$ and define accordingly $\vct{b}'$ and ${\vct{g}}'$. We have that \begin{align} |h([x,\vct{a}])-h([x,\vct{a}'])|&= |f(\vct{b})-f(\vct{b}')|\notag\\ &\leq L\left(1+\|\vct{b}\|_2^{k-1}+\|\vct{b}'\|_2^{k-1}\right)\|\vct{b}-\vct{b}'\|_2\notag\\ &\leq C\left(1+\|\vct{a}\|_2^{k-1}+\|\vct{a}'\|_2^{k-1}+|{\vct{g}}|^{k-1}+|{\vct{g}}'|^{k-1}\right)(\|\vct{a}-\vct{a}'\|_2+|{\vct{g}}-{\vct{g}}'|),\label{eq:hlip} \end{align} for some constant $C>0$. In the last inequality we have repeatedly used the inequality $ \left(\sum_{i=1}^m \|\vct{v}_i\|_2^2\right)^{\frac{d}{2}} \leq C(m)\cdot\sum_{i=1}^m\|\vct{v}_i\|_2^{d}. $ Next, we need to bound the ${\vct{g}}$ term in terms of $\vct{a}$. This is accomplished as follows \begin{align} |{\vct{g}}|^{k-1} &= \left|\frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x + (1-(1+\xi_*y)^{-1})z\right|^{k-1}\notag\\ &\leq C (|z|+|x|)^{k-1} \notag\\ &\leq C \left(|x|^{k-1}+|z|^{k-1}\right) \leq C (|x|^{k-1} + \|\vct{a}\|_2^{k-1}).\label{eq:gb} \end{align} Here, the value of the constant $C>0$ may change from line to line. Secondly and similarly, we have the following perturbation bound on the ${\vct{g}}-{\vct{g}}'$. Recall that $(x,y)$ and $(x',y')$ are bounded. We will prove the following sequence of inequalities \begin{align} |{{\vct{g}}-{\vct{g}}'}|&= |g(y,z,x)-g(y',z',x')| \notag\\ &\leq \left|\frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x - \frac{(y')^{-1/2}}{1+(\xi y')^{-1}}\sqrt{\kappa}\tau_* x'\right| + \left|(1-(1+\xi_*y)^{-1})z-(1-(1+\xi_*y')^{-1})z'\right|\notag\\ &\leq \left|\frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x - \frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x'\right| +\left|\frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x'- \frac{(y')^{-1/2}}{1+(\xi y')^{-1}}\sqrt{\kappa}\tau_* x'\right|\notag\\ &\qquad+ \left|(1-(1+\xi_*y)^{-1})z-(1-(1+\xi_*y)^{-1})z'\right| + \left|(1-(1+\xi_*y)^{-1})z'-(1-(1+\xi_*y')^{-1})z'\right| \notag\\ &\leq C_1|x-x'| + C_2|x'||y-y'| + C_3|z-z'| + C_4|z'||y-y'|\notag\\ &\leq C(1+|x'| + |z'|)(|x-x'| + |z-z'| + |y-y'|)\\ &\leq C\sqrt{3}(1+|x'| + |z'|)\|[\vct{a},x]-[\vct{a}',x']\|_2 .\label{eq:gd} \end{align} In the fourth inequality above, we used the fact the assumption that $|y|$ is bounded. In the last line, we used Cauchy-Scwhartz. Substituting \eqref{eq:gb} and \eqref{eq:gd} in \eqref{eq:hlip} gives: \begin{align} |h(x,y,z) - h(x',y',z')| &\leq C\left(1+\|\vct{a}\|_2^{k-1}+\|\vct{a}'\|_2^{k-1}+|x|^{k-1}+|x'|^{k-1}\right)(1+|x'| + |z'|)\|[\vct{a},x]-[\vct{a}',x']\|_2\notag \\ &\leq C\left(1+\|[\vct{a},x]\|_2^{k}+\|[\vct{a}',x']\|_2^{k}\right)\|[\vct{a},x]-[\vct{a}',x']\|_2. \end{align} Thus, $h\in\rm{PL}(k+1)$, as desired. \end{proof} \section{Proofs for overparameterized least-squares}\label{sec proof thm 1} In this section, we assume the linear Gaussian problem (LGP) of Definition \ref{def LGP}, the overparameterized regime $k=p>n$ and the min-norm model ${\boldsymbol{\hat{\beta}}}$ of \eqref{eq:min_norm}. We prove Theorem \ref{thm:master_W2} that derives the asymptotic DC of ${\boldsymbol{\hat{\beta}}}$ and we show how this leads to sharp formulae for the risk of the Magnitude- and Hessian-pruned models. \subsection{Notation and Assumptions}\label{sec:ass_app} For the reader's convenience, we recall some necessary notation and assumptions from Section \ref{sec main}. We say that a function $f:\mathbb{R}^m\rightarrow\mathbb{R}$ is pseudo-Lipschitz of order $k$, denoted $f\in\rm{PL}(k)$, if there is a constant $L>0$ such that for all $\vct{x},\vct{y}\in\mathbb{R}^m$, $ |f(\vct{x}) - f(\vct{y})|\leq L(1+\tn{\vct{x}}^{k-1}+\tn{\vct{y}}^{k-1})\|\vct{x}-\vct{y}\|_2 $ (See also Section \ref{SM useful fact}). We say that a sequence of probability distributions $\nu_p$ on $\mathbb{R}^m$ {converges in $W_k$} to $\nu$, written $\nu_p\stackrel{W_k}{\Longrightarrow} \nu$, if $W_k(\nu_p,\nu) \rightarrow 0$ as $p \rightarrow \infty$. An equivalent definition is that, for any $f\in\rm{PL}(k)$, $\lim_{p\rightarrow\infty}\operatorname{\mathbb{E}} f(X_p)=\operatorname{\mathbb{E}} f(X)$, where expectation is with respect to $X_p\sim\nu_p$ and $X\sim\nu$ (e.g., \cite{montanari2017estimation}). Finally, recall that a sequence of probability distributions $\nu_n$ on $\mathbb{R}^m$ \emph{converges weakly} to $\nu$, if for any bounded Lipschitz function $f$: $\lim_{p\rightarrow\infty}\operatorname{\mathbb{E}} f(X_p)=\operatorname{\mathbb{E}} f(X)$, where expectation is with respect to $X_p\sim\nu_p$ and $X\sim\nu$. Throughout, we use $C,C',c,c'$ to denote absolute constants (not depending on $n,p$) whose value might change from line to line. We focus on a double asymptotic regime where: $$n,p,s\rightarrow\infty \text{ at fixed overparameterization ratio } \kappa:=p/n>1 \text{ and sparsity level } \alpha:=s/p\in(0,1).$$ For a sequence of random variables $\mathcal{X}_{p}$ that converge in probability to some constant $c$ in the limit of Assumption \ref{ass:linear} below, we write $\mathcal{X}_{p}\stackrel{{P}}{\longrightarrow} c$. For a sequence of event $\mathcal{E}_p$ for which $\lim_{p\rightarrow}\mathbb{P}(\mathcal{E}_p) = 1$, we say that $\mathcal{E}_p$ occurs \emph{with probability approaching 1}. For this, we will often use the shorthand ``wpa 1". \vspace{5pt} Next, we recall the set of assumption under which our analysis applies: \asstwo* \assthree* \noindent We remark that Assumption \ref{ass:mu} above implies (see \cite[Lem.~4]{bayati2011dynamics} and \cite[Lem.~A3]{javanmard2013state}) that for any pseudo-Lipschitz function $\psi:\mathbb{R}^2\rightarrow\mathbb{R}$ of order $4$, i.e., $\psi\in\rm{PL}(4)$: $$ \frac{1}{p}\sum_{i=1}^p\psi(\bSi_{i,i},\sqrt{p}\betab^\star_i) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{(\Lambda,B)\sim\mu}\left[ \psi(\Lambda,B)\right]. $$ \subsection{Asymptotic distribution and risk characterizations} \fx{In this section, we prove our main result Theorem \ref{thm:master_W2}. Recall that ${\boldsymbol{\hat{\beta}}}$ is the min-norm solution. Since the distribution of ${\boldsymbol{\hat{\beta}}}$ depends on the problem dimensions (as it is a function of ${\mtx{X}},\vct{y}$), when necessary, we will use ${\boldsymbol{\hat{\beta}}}_n$ notation to make its dimension dependence explicit.} Let ${\boldsymbol{\hat{\beta}}}^P={\cal{P}}({\boldsymbol{\hat{\beta}}})$ be a pruned version of the min-norm solution ${\boldsymbol{\hat{\beta}}}$. Recall from Section \ref{sec:risk}, that the first crucial step in characterizing the risk ${\cal{L}}({\boldsymbol{\hat{\beta}}}^P)$ is studying the risk of a threshold-based pruned vector ${\cal{L}}({\boldsymbol{\hat{\beta}}}^\mathcal{T}_t)$. Theorem \ref{thm:master_W2} below shows how this is possible. To keep things slightly more general, consider ${\boldsymbol{\hat{\beta}}}^{g}$ defined such that $\sqrt{p}{\boldsymbol{\hat{\beta}}}^{g}=g(\sqrt{p}{\boldsymbol{\hat{\beta}}})$, where $g$ is a Lipschitz function acting entry-wise on ${\boldsymbol{\hat{\beta}}}$ (for example, $g$ can be the \fx{(arbitrarily close Lipschitz approximation of the)} thresholding operator $\mathcal{T}_t$ of Section \ref{sec:risk}). Then, the risk of ${\boldsymbol{\hat{\beta}}}^g$ can be written as \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}}^g) &= \operatorname{\mathbb{E}}_{\mathcal{D}}[(\vct{x}^T({\boldsymbol{\beta}}^\star-{\boldsymbol{\hat{\beta}}}^g) + \sigma z)^2] = \sigma^2 + ({\boldsymbol{\beta}}^\star-{\boldsymbol{\hat{\beta}}}^g)^T\boldsymbol{\Sigma}({\boldsymbol{\beta}}^\star-{\boldsymbol{\hat{\beta}}}^g) \notag \\ &= \sigma^2 + \frac{1}{p}\sum_{i=1}^p\boldsymbol{\Sigma}_{i,i}\big(\sqrt{p}\betab^\star_i-g(\sqrt{p}{\boldsymbol{\hat{\beta}}}_i)\big)^2\notag \\ &=: \sigma^2 + \frac{1}{p}\sum_{i=1}^p f\big(\sqrt{p}{\boldsymbol{\hat{\beta}}}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i}\big),\label{eq:risk_app_f} \end{align} where in the last line, we defined function $f:\mathbb{R}^3\rightarrow\mathbb{R}$ as follows: \begin{align}\label{eq:fdef} f_{\cal{L}}(x,y,z) := \fx{z(y-g(x))}^2. \end{align} The following theorem establishes the asymptotic limit of \eqref{eq:risk_app_f}. For the reader's convenience, we repeat the notation introduced in Definition \ref{def:Xi}. Let random variables $(\Lambda,B)\sim \mu$ (where $\mu$ is defined in Assumption \ref{ass:mu}) and fix $\kappa>1$. Define parameter $\xi$ as the unique positive solution to the following equation $$ \operatorname{\mathbb{E}}_{\mu}\Big[ \big({1+(\xi\cdot\Lambda)^{-1}}\big)^{-1} \Big] = {\kappa^{-1}}\,. $$ Further define the positive parameter $\gamma$ as follows: $$ \hspace{-0.1in}\gamma := \Big({\sigma^2 + \operatorname{\mathbb{E}}_{\mu}\Big[\frac{B^2\Lambda}{(1+\xi\Lambda)^2}\Big]}\Big)\Big/\Big({1-\kappa\operatorname{\mathbb{E}}_{\mu}\Big[\frac{1}{\left(1+(\xi\Lambda)^{-1}\right)^2}\Big]}\Big). $$ With these and $H\sim\mathcal{N}(0,1)$, define the random variable $$ X_{\kappa,\sigma^2}:=X_{\kappa,\sigma^2}(\Lambda,B,H) := \Big(1-\frac{1}{1+ \xi\Lambda}\Big) B + \sqrt{\kappa}\frac{\sqrt{\gamma}\,\Lambda^{-1/2}}{1+(\xi\Lambda)^{-1}} H, $$ and let $\Pi_{\kappa,\sigma^2}$ be its distribution. \mainthm* Before we prove the theorem, let us show how it immediately leads to a sharp prediction of the risk behavior. Indeed, a direct application of \eqref{eq:thm} for $f=f_{\cal{L}}$ to \eqref{eq:risk_app_f} shows that \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}}^g)\stackrel{{P}}{\longrightarrow} \sigma^2 + \operatorname{\mathbb{E}}_{(\Lambda,B,H)\sim\mu\otimes\mathcal{N}(0,1)}\left[f_{\cal{L}}(X_{\kappa,\sigma^2},B,\Lambda) \right] = \sigma^2 + \operatorname{\mathbb{E}}_{(\Lambda,B,H)\sim\mu\otimes\mathcal{N}(0,1)}\left[\Sigma\left(B-g(X_{\kappa,\sigma^2})\right)^2 \right].\label{eq:risk_app_f2} \end{align} We further remark on the following two consequences of Theorem \ref{thm:master_W2}. First, since \eqref{eq:thm} holds for any $\rm{PL}(2)$ function, we have equivalently that $\hat\Pi_n(\vct{y},{\mtx{X}},\betab^\star,\boldsymbol{\Sigma})$ converges in Wasserstein-2 distance to $\Pi_{\kappa,\sigma^2}\otimes\mu$, where recall that $\Pi_{\kappa,\sigma^2}$ is the distribution of the random variable $X_{\kappa,\sigma^2}$. Second, the theorem implies that the empirical distribution of $\sqrt{p}{\boldsymbol{\hat{\beta}}}_n$ converges weakly to $\Pi_{\kappa,\sigma^2}$. To see this, apply \eqref{eq:thm} for the $\rm{PL}(2)$ function $f(x,y,z) = \psi(x)$ where $\psi:\mathbb{R}\rightarrow\mathbb{R}$ is a bounded Lipschitz test function. \subsection{Proof of Theorem \ref{thm:master_W2}} \vspace{5pt} Let ${\mtx{X}}\in\mathbb{R}^{n\times p}$ have zero-mean and normally distributed rows with a diagonal covariance matrix ${\boldsymbol{{\Sigma}}}=\operatorname{\mathbb{E}}[\vct{x}\x^T]$. Given a ground-truth vector $\betab^\star$ and labels $\vct{y}={\mtx{X}}\betab^\star+\sigma {\vct{z}},~{\vct{z}}\sim\mathcal{N}(0,{\mtx{I}}_n)$, we consider the least-squares problem subject to the minimum Euclidian norm constraint (as $\kappa=p/n>1$) given by \begin{align}\label{eq:PO_beta} \min_{{\boldsymbol{\beta}}}\frac{1}{2}\tn{{\boldsymbol{\beta}}}^2\quad\text{subject to}\quad \vct{y}={\mtx{X}}{\boldsymbol{\beta}}. \end{align} It is more convenient to work with the following change of variable: \begin{align}\label{eq:w} \vct{w}:=\sqrt{\boldsymbol{\Sigma}}({\boldsymbol{\beta}}-\betab^\star). \end{align} With this, the optimization problem in \eqref{eq:min_norm} can be rewritten as \begin{align}\label{eq:PO} \Phi({\mtx{X}})=\min_{\vct{w}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad {\mtx{\bar{X}}}\vct{w}=\sigma {\vct{z}}, \end{align} where we write ${\mtx{\bar{X}}}={\mtx{X}}\boldsymbol{\Sigma}^{-1/2}\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,1)$. First, using standard arguments, we show that the solution of \eqref{eq:PO} is bounded. Hence, we can constraint the optimization in a sufficiently large compact set without loss of generality. \begin{lemma}[Boundedness of the solution]\label{lem:bd_PO} Let $\widehat{\vct{w}}_n:=\widehat{\vct{w}}_n({\mtx{X}},{\vct{z}})$ be the minimizer in \eqref{eq:PO}. Then, with probability approaching 1, it holds that $\widehat{\vct{w}}_n\in\mathcal{B}$, where $$\mathcal{B}:=\left\{\vct{w}\,|\,\|\vct{w}\|_2\leq B_{+} \right\},\qquad B_+:=5\sqrt{\frac{\Sigma_{\max}}{\Sigma_{\min}}}\frac{\sqrt{\kappa}+1}{\sqrt{\kappa}-1}(\sqrt{\Sigma_{\max}\operatorname{\mathbb{E}}\left[B^2\right]} + \sigma). $$ \end{lemma} \begin{proof} First, we show that the min-norm solution ${\boldsymbol{\hat{\beta}}}={\mtx{X}}^T({\mtx{X}}\X^T)^{-1}\vct{y}$ of \eqref{eq:PO_beta} is bounded. Note that $\kappa>1$, thus ${\mtx{X}}\X^T$ is invertible wpa 1. We have, \begin{align} \tn{{\boldsymbol{\hat{\beta}}}_n}^2 = \vct{y}^T({\mtx{X}}\X^T)^{-1}\vct{y} \leq \frac{\tn{\vct{y}}^2}{\lambda_{\min}({\mtx{X}}\X^T)} = \frac{\tn{\vct{y}}^2}{\lambda_{\min}({\mtx{\bar{X}}}\boldsymbol{\Sigma}{\mtx{\bar{X}}}^T)} \leq \frac{\tn{\vct{y}}^2}{\lambda_{\min}({\mtx{\bar{X}}}\Xb^T)\,\Sigma_{\min}} = \frac{\tn{\vct{y}}^2}{\sigma_{\min}^2({\mtx{\bar{X}}})\,\Sigma_{\min}}. \label{eq:Ubb} \end{align} But, wpa 1, $ \sigma_{\min}({\mtx{\bar{X}}})/\sqrt{n} \geq \frac{1}{2}\left(\sqrt{\kappa}-1\right). $ Furthermore, $ \|\vct{y}\|_2 \leq \|{\mtx{\bar{X}}}\boldsymbol{\Sigma}^{1/2}\betab^\star\|_2 + \sigma\|{\vct{z}}\|_2 \leq \sigma_{\max}({\mtx{\bar{X}}})\sqrt{\Sigma_{\max}} \|\betab^\star\|_2 + \sigma\|{\vct{z}}\|_2. $ Hence, wpa 1, $$ \|\vct{y}\|_2/\sqrt{n} \leq 2(\sqrt{\kappa}+1)\sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}\left[B^2\right]} + 2\sigma, $$ where we used the facts that wpa 1: $\|z\|_2/\sqrt{n}\stackrel{{P}}{\longrightarrow} 1$, $\sigma_{\max}({\mtx{\bar{X}}})<\sqrt{2n}(\sqrt{\kappa}+1)$ and \cts{by Assumption \ref{ass:mu}}: $$ \|\betab^\star\|_2^2 = \frac{1}{p}\sum_{i=1}^{p}(\sqrt{p}\betab^\star_i)^2 \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}\left[B^2\right]. $$ Put together in \eqref{eq:Ubb}, shows that \begin{align} \tn{{\boldsymbol{\hat{\beta}}}_n} < \frac{2(\sqrt{\kappa}+1)\sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}\left[B^2\right]} + 2\sigma}{\sqrt{\Sigma_{\min}}(\sqrt{\kappa}-1)/2} =: \tilde{B}_+.\label{eq:bd_beta} \end{align} Recalling that $\widehat{\vct{w}}_n= \sqrt{\boldsymbol{\Sigma}}{\boldsymbol{\hat{\beta}}}_n - \sqrt{\boldsymbol{\Sigma}}\betab^\star$, we conclude, as desired, that wpa 1, $ \tn{\widehat{\vct{w}}_n} \leq \sqrt{\Sigma_{\max}}\tilde{B}_+ + \sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}[B^2]} \leq B_+. $ \end{proof} Lemma \ref{lem:bd_PO} implies that nothing changes in \eqref{eq:PO} if we further constrain $\vct{w}\in\mathcal{B}$ in \eqref{eq:PO}. Henceforth, with some abuse of notation, we let \begin{align}\label{eq:PO_bd} \Phi({\mtx{X}}):=\min_{\vct{w}\in\mathcal{B}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad {\mtx{\bar{X}}}\vct{w}=\sigma {\vct{z}}, \end{align} Next, in order to analyze the primary optimization (PO) problem in \eqref{eq:PO_bd} in apply the CGMT \cite{thrampoulidis2015lasso}. Specifically, we use the constrained formulation of the CGMT given by Theorem \ref{thm closed}. Specifically, the auxiliary problem (AO) corresponding to \eqref{eq:PO_bd} takes the following form with ${\vct{g}}\sim\mathcal{N}(0,{\mtx{I}}_n)$, $\vct{h}\sim\mathcal{N}(0,{\mtx{I}}_p)$, $h\sim \mathcal{N}(0,1)$ \begin{align} \phi({\vct{g}},\vct{h}) = \min_{\vct{w}\fx{\in\mathcal{B}}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad \tn{{\vct{g}}}\tn{\vct{w}~{\sigma}}\leq \vct{h}^T\vct{w}+\sigma h.\label{eq:AO_con} \end{align We will prove the following techincal result about the AO problem. \somm{Re-specify the assumptions of this lemma!} \begin{lemma}[Properties of the AO -- Overparameterized regime]\label{lem:AO} Let $\phi_n=\phi({\vct{g}},\vct{h})$ be the optimal cost of the minimization in \eqref{eq:AO_con}. Define $\bar\phi$ as the optimal cost of the following deterministic min-max problem \begin{align}\label{eq:AO_det} \bar\phi:=\max_{u\geq 0}\min_{\tau>0}~ \mathcal{D}(u,\tau):=\frac{1}{2}\left({u\tau} + \frac{u\sigma^2}{\tau} - u^2\kappa\,\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] - \fx{\operatorname{\mathbb{E}}\left[\frac{B^2}{1+\frac{u}{\tau}\Lambda}\right]} \right). \end{align} The following statements are true. \noindent{(i).}~The AO minimization in \eqref{eq:AO_con} is $\frac{1}{\Sigma_{\max}}$-strongly convex and has a unique minimizer $\widehat{\vct{w}}_n:=\widehat{\vct{w}}_n({\vct{g}},\vct{h})$. \noindent{(ii).}~In the limit of $n,p\rightarrow\infty, p/n=\kappa$, it holds that $\phi({\vct{g}},\vct{h})\stackrel{{P}}{\longrightarrow}\bar\phi$, i.e., for any $\varepsilon>0$: $$ \lim_{n\rightarrow\infty}\P\left(|\phi({\vct{g}},\vct{h})-\bar\phi|>\varepsilon\right) = 0. $$ \noindent{(iii).} The max-min optimization in \eqref{eq:AO_det} has a unique saddle point $(u_*,\tau*)$ satisfying the following: $$ u_*/\tau_* = \xi\quad\text{and}\quad\tau_* = \gamma, $$ where $\xi, \gamma$ are defined in Definition \ref{def:Xi}. \noindent{(iv).}~Let $f:\mathbb{R}^3\rightarrow\mathbb{R}$ be a $\rm{PL}({k})$ function. Let ${\boldsymbol{\hat{\beta}}}_n=\boldsymbol{\Sigma}^{-1/2}\widehat{\vct{w}}_n + \betab^\star$. Then, $$ \frac{1}{p}\sum_{i=1}^{p}f\left(\sqrt{p}{\boldsymbol{\hat{\beta}}}_n({\vct{g}},\vct{h}),\sqrt{p}\betab^\star,\boldsymbol{\Sigma}\right) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{(B,\Lambda,H)\sim\mu\otimes \mathcal{N}(0,1)}\left[f\left(X_{\kappa,\sigma^2}(B,\Lambda,H),B,\Lambda\right) \right]. $$ \noindent{(v).}~\cts{The empirical distribution of ${\boldsymbol{\hat{\beta}}}_n$ converges weakly to the measure of $X_{\kappa,\sigma^2}$, and also, for large enough absolute constant $C>0$: \begin{align}\label{eq:k_AO} \sum_{i=1}^{p}{\boldsymbol{\hat{\beta}}}^2_n({\vct{g}},\vct{h}) < C. \end{align} } \end{lemma} We prove Lemma \ref{lem:AO} in Section \ref{sec:proofAO}. Here, we show how this leads to the proof of Theorem \ref{thm:master_W2} when combined with the CGMT framework \cite{thrampoulidis2015lasso}. \cts{Let $f:\mathbb{R}^3\rightarrow\mathbb{R}$ be a $\rm{PL}(2)$ function, or, the function $f_{\cal{L}}$ defined in \eqref{eq:fdef}.} For convenience, define $$F_n({\boldsymbol{\hat{\beta}}},\betab^\star,\boldsymbol{\Sigma}):=\frac{1}{p} \sum_{i=1}^{p} f\left(\sqrt{p}{\boldsymbol{\hat{\beta}}}_{n,i},\sqrt{p}\betab^\star_{i},\boldsymbol{\Sigma}_{ii}\right)\quad\text{and}\quad\alpha_*:=\operatorname{\mathbb{E}}_\mu\left[f(X_{\kappa,\sigma^2}(\Lambda,B,H),B,\Lambda)\right].$$ Fix any $\varepsilon>0$ and define the set \begin{align}\label{eq:S_set} \mathcal{S} = \mathcal{S}(\betab^\star,\boldsymbol{\Sigma}) =\{{\boldsymbol{\beta}}{~\big |~} |F_n({\boldsymbol{\hat{\beta}}}_n,\betab^\star,\boldsymbol{\Sigma})-\alpha_*|\geq 2\varepsilon\}. \end{align} It suffices to prove that the solution ${\boldsymbol{\hat{\beta}}}_n$ of the PO in \eqref{eq:PO_beta} satisfies ${\boldsymbol{\hat{\beta}}}_n\not\in\mathcal{S}$ wpa 1. To see that this is sufficient, note the following. On the one hand, setting $f=f_{\cal{L}}$, directly proves \eqref{eq:thm}. On the other hand, recall that $W_2$-convergence is equivalent to convergence of any $\rm{PL}(2)$ test function $f$. To prove the desired, we need to consider the ``perturbed" PO and AO problems (compare to \eqref{eq:PO} and \eqref{eq:AO_con}) as: \begin{align}\label{eq:PO_S} \Phi_S({\mtx{X}})=\min_{\vct{w}\in\mathcal{S}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad {\mtx{\bar{X}}}\vct{w}=\sigma {\vct{z}}, \end{align} and \begin{align} \phi_S({\vct{g}},\vct{h})=\min_{\vct{w}\in\mathcal{S}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad \tn{{\vct{g}}}\tn{\vct{w}~{\sigma}}\leq \vct{h}^T\vct{w}+\sigma h.\label{eq:AO_S} \end{align Recall here, that ${\mtx{\bar{X}}}={\mtx{X}}\boldsymbol{\Sigma}^{-1/2}\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,1)$, ${\vct{g}}\sim\mathcal{N}(0,{\mtx{I}}_n)$, $\vct{h}\sim\mathcal{N}(0,{\mtx{I}}_p)$, $h\sim \mathcal{N}(0,1)$ and we have used the change of variables $\vct{w}:=\sqrt{\boldsymbol{\Sigma}}({\boldsymbol{\beta}}-\betab^\star)$ for convenience. Using \cite[Theorem 6.1(iii)]{thrampoulidis2018precise} it suffices to find costants $\bar\phi, \bar\phi_S$ and $\eta>0$ such that the following three conditions hold: \begin{enumerate} \item $\bar\phi_S \geq \bar\phi + 3\eta$, \item $\phi({\vct{g}},\vct{h}) \leq \bar\phi + \eta$, with probability approaching 1, \item $\phi_S({\vct{g}},\vct{h}) \geq \bar\phi_S - \eta$, with probability approaching 1. \end{enumerate} In what follows, we explicitly find $\bar\phi, \bar\phi_S,\eta$ such that the three conditions above hold. \vspace{5pt} \noindent\underline{Satisfying Condition 2}: Recall the deterministic min-max optimization in \eqref{eq:AO_det}. Choose $\bar\phi=\mathcal{D}(u_*,\tau_*)$ be the optimal cost of this optimization. From Lemma \ref{lem:AO}(ii), $\phi({\vct{g}},\vct{h})\stackrel{{P}}{\longrightarrow}\bar\phi$. Thus, for any $\eta>0$, with probability approaching 1: \begin{align}\label{eq:phi_lim} \bar\phi + \eta \geq \phi({\vct{g}},\vct{h}) \geq \bar\phi - \eta. \end{align} Clearly then, Condition 2 above holds for any $\eta>0$. \vspace{5pt} \noindent\underline{Satisfying Condition 3}: Next, we will show that the third condition holds for appropriate $\bar\phi$. Let $\widehat{\vct{w}}_n=\widehat{\vct{w}}_n({\vct{g}},\vct{h})$ be the unique minimizer of \eqref{eq:AO_con} as per Lemma \ref{lem:AO}(i), i.e., $\frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\widehat{\vct{w}}_n+{\boldsymbol{\beta}}}^2 = \phi({\vct{g}},\vct{h})$. Again from Lemma \ref{lem:AO}, the minimization in \eqref{eq:AO_con} is $1/\Sigma_{\max}$-strongly convex in $\vct{w}$. Here, $\Sigma_{\max}$ is the upper bound on the eigenvalues of $\boldsymbol{\Sigma}$ as per Assumption \ref{ass:mu}. Thus, for any $\tilde\varepsilon>0$ and any feasible $\vct{w}$ the following holds (deterministically): \begin{align}\label{eq:sc} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+{\boldsymbol{\beta}}}^2 \geq \phi({\vct{g}},\vct{h}) + \frac{\tilde\epsilon^2}{2\fx{\Sigma_{\max}}},~\text{provided that}~ \|\vct{w}-\widehat{\vct{w}}_n({\vct{g}},\vct{h})\|_2 \geq \tilde\epsilon. \end{align} Now, we argue that \fx{wpa 1,} \begin{align}\label{eq:dev_arg} \fx{\text{for all}~{\boldsymbol{\beta}}\in \mathcal{S}~\text{the corresponding}~\vct{w}~\text{obeys}}~\|\vct{w}-\widehat{\vct{w}}_n({\vct{g}},\vct{h})\|_2\geq \tilde\varepsilon, \end{align} for an appropriate value of a constant $\tilde\varepsilon>0$ and $\vct{w}=\sqrt{\boldsymbol{\Sigma}}({\boldsymbol{\beta}}-\betab^\star)$. Consider any ${\boldsymbol{\beta}}\in\mathcal{S}$. \noindent First, by definition in \eqref{eq:S_set}, $$ |F_n({\boldsymbol{\beta}},\betab^\star,\boldsymbol{\Sigma})-\alpha_*| \geq 2\varepsilon. $$ Second, by Lemma \ref{lem:AO}(iv), with probability approaching 1, $$ |F({\boldsymbol{\hat{\beta}}}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - \alpha_*| \leq \epsilon. $$ Third, we will show that wpa 1, there exists universal constant $C>0$ such that \begin{align} |F_n({\boldsymbol{\hat{\beta}}}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n({\boldsymbol{\beta}},\betab^\star,\boldsymbol{\Sigma})| \leq C {\|{\boldsymbol{\hat{\beta}}}_n({\vct{g}},\vct{h}) - {\boldsymbol{\beta}}\|_2}\label{eq:dev2show}. \end{align} Before proving \eqref{eq:dev2show}, let us argue how combining the above three displays shows the desired. Indeed, in that case, wpa 1, \begin{align*} 2\varepsilon &\leq |F_n({\boldsymbol{\beta}},\betab^\star,\boldsymbol{\Sigma})-\alpha_*| \leq |F_n({\boldsymbol{\hat{\beta}}}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n({\boldsymbol{\beta}},\betab^\star,\boldsymbol{\Sigma})| + |F_n({\boldsymbol{\hat{\beta}}}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - \alpha_*| \\ &\leq \epsilon + C \,\|{\boldsymbol{\beta}}-{\boldsymbol{\hat{\beta}}}_n\|_2. \\ &\qquad\Longrightarrow \|{\boldsymbol{\beta}}-{\boldsymbol{\hat{\beta}}}_n\|_2 \geq {\varepsilon}/{C}=:\hat\varepsilon\\ &\qquad\Longrightarrow \|\vct{w}-\widehat{\vct{w}}_n\|_2 \geq \hat\varepsilon\sqrt{\Sigma_{\min}}=:\tilde\varepsilon. \end{align*} In the last line above, we recalled that ${\boldsymbol{\beta}}=\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star$ and $\boldsymbol{\Sigma}_{i,i}\geq\Sigma_{\min},~i\in[p]$ by Assumption \ref{ass:mu}. This proves \eqref{eq:dev_arg}. Next, combining \eqref{eq:dev_arg} and \eqref{eq:sc}, we find that wpa 1, $ \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+{\boldsymbol{\beta}}}^2 \geq \phi({\vct{g}},\vct{h}) + \frac{\tilde\epsilon^2}{2C},~\text{for all}~ \vct{w}\in\mathcal{S}. $ Thus, \begin{align} \phi_S({\vct{g}},\vct{h}) \geq \phi({\vct{g}},\vct{h}) + \frac{\tilde\epsilon^2}{2\Sigma_{\max}}.\notag \end{align} When combined with \eqref{eq:phi_lim}, this shows that \begin{align} \phi_S({\vct{g}},\vct{h}) \geq \bar\phi + \frac{\tilde\epsilon^2}{2\Sigma_{\max}} - \eta. \end{align} Thus, choosing $\bar\phi_S = \bar\phi + \frac{\tilde\epsilon^2}{2\Sigma_{\max}}$ proves the Condition 3 above. \vspace{3pt} \noindent\fx{\textbf{Perturbation analysis via Pseudo-Lipschitzness:}} To complete the proof, let us now show \eqref{eq:dev2show}. Henceforth, $C$ is used to denote a universal constant whose value can change from line to line. First, consider the case $f=f_{\cal{L}}$, i.e., $f(x,y,z) = y(x-g(z))^2$. We have the following chain of inequalities: \begin{align} |F_n({\boldsymbol{\hat{\beta}}}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n({\boldsymbol{\beta}},\betab^\star,\boldsymbol{\Sigma})| &= \frac{1}{p}\sum_{i=1}^p|\bSi_{i,i}|\left| (\sqrt{p}\betab^\star_i-g(\sqrt{p}{\boldsymbol{\hat{\beta}}}_{n,i}))^2-(\sqrt{p}\betab^\star_i-g(\sqrt{p}{\boldsymbol{\beta}}_{i}))^2 \right|\notag\\ &\leq \Sigma_{\max} \frac{1}{p}\sum_{i=1}^p \left| (\sqrt{p}\betab^\star_i-g(\sqrt{p}{\boldsymbol{\hat{\beta}}}_{n,i}))^2-(\sqrt{p}\betab^\star_i-g(\sqrt{p}{\boldsymbol{\beta}}_{i}))^2 \right|\notag\\ &\leq \fx{C} \Sigma_{\max} \frac{1}{p}\sum_{i=1}^p (1+ \|\sqrt{p}[\betab^\star_i,{\boldsymbol{\hat{\beta}}}_{n,i}]\|_2 + \|\sqrt{p}[\betab^\star_i,{\boldsymbol{\beta}}_{i}]\|_2) \sqrt{p}|{\boldsymbol{\hat{\beta}}}_{n,i}-{\boldsymbol{\beta}}_{i}|\notag\\ &\leq \fx{C} \Sigma_{\max} \Big(1+ \frac{1}{\sqrt{p}}\big(\sum_{i=1}^{p}\|\sqrt{p}[\betab^\star_i,{\boldsymbol{\hat{\beta}}}_{n,i}]\|_2^2\big)^{1/2} + \frac{1}{\sqrt{p}}\big(\sum_{i=1}^p\|\sqrt{p}[\betab^\star_i,{\boldsymbol{\beta}}_{i}]\|_2^2\big)^{1/2}\Big) \|{\boldsymbol{\hat{\beta}}}_n-{\boldsymbol{\beta}}\|_2\notag\\ &\leq C \left(1+ \max\{\|\betab^\star\|_2^2,\|{\boldsymbol{\hat{\beta}}}_n\|_2^2,\|{\boldsymbol{\beta}}\|_2^2\}^{1/2} \right) \|{\boldsymbol{\hat{\beta}}}_n-{\boldsymbol{\beta}}\|_2.\label{eq:fcase1} \end{align} In the second line above, we used boundedness of $\bSi_{i,i}$ as per Assumption \ref{ass:mu}. \somm{Consider explaining the PL(2) sentence.}\fx{In the third line, we used the fact that the function $\psi(a,b) = (a-g(b))^2$ is $\rm{PL}(2)$.} The fourth line follows by Cauchy-Schwartz inequality. Finally, in the last line, we used the elementary fact that $a+b+c\leq 3\max\{a,b,c\}$ for $a=2\sum_{i=1}^p(\betab^\star_i)^2$ and $b=\sum_{i=1}^p{\boldsymbol{\hat{\beta}}}_{n,i}^2$ and $c=\sum_{i=1}^p{\boldsymbol{\beta}}_{i}^2$. Second, consider the case $f\in\rm{PL}(2)$. Let $\vct{a}_i=(\sqrt{p}{\boldsymbol{\hat{\beta}}}_{n,i}({\vct{g}},\vct{h}),\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$ and $\vct{b}_i=(\sqrt{p}{\boldsymbol{\beta}}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$, for $i\in[p]$. A similar chain of inequality holds: \somm{The solution for PL(k) is showing that around $\hat{{\boldsymbol{\beta}}}$, there is an arbitarily close $\hat{{\boldsymbol{\beta}}}_{bdd}$ with bounded entries.} \begin{align} |F_n({\boldsymbol{\hat{\beta}}}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n({\boldsymbol{\beta}},\betab^\star,\boldsymbol{\Sigma})| &\leq \frac{\fx{C}}{p}\sum_{i=1}^p (1+\max\{\|\vct{a}_i\|_2,\|\vct{b}_i\|_2\})\|\vct{a}_i-\vct{b}_i\|_2\notag \\ &= \frac{\fx{C}}{p}\sum_{i=1}^p \left(1+\max\{\|\vct{a}_i\|_2,\|\vct{b}_i\|_2\}\right)\cdot|\sqrt{p}{\boldsymbol{\hat{\beta}}}_{n,i}({\vct{g}},\vct{h}) - \sqrt{p}{\boldsymbol{\beta}}_i|\notag\\ &\leq \fx{C}\left(1+\max\{\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2},\frac{1}{p}\sum_{i=1}^p\|\vct{b}_i\|_2^{2}\} \right)^{1/2}{\|{\boldsymbol{\hat{\beta}}}_n({\vct{g}},\vct{h}) - {\boldsymbol{\beta}}\|_2}\notag\\ &\leq C\left(1+\max\{\|{\boldsymbol{\hat{\beta}}}_n\|_2^2,\|\betab^\star\|_2^2,\|{\boldsymbol{\beta}}\|_2^2,\frac{1}{p}\sum_{i=1}^p\bSi_{i,i}^2\} \right)^{1/2}{\|{\boldsymbol{\hat{\beta}}}_n({\vct{g}},\vct{h}) - {\boldsymbol{\beta}}\|_2}\notag\\ &\leq C\Sigma_{\max}^2\left(1+\max\{\|{\boldsymbol{\hat{\beta}}}_n\|_2^2,\|\betab^\star\|_2^2,\|{\boldsymbol{\beta}}\|_2^2\} \right)^{1/2}{\|{\boldsymbol{\hat{\beta}}}_n({\vct{g}},\vct{h}) - {\boldsymbol{\beta}}\|_2}.\label{eq:fcase2} \end{align} The first inequality uses the fact that $f\in\rm{PL}(2)$. The second inequality in the third line follows by Cauchy-Schwartz. The last inequality used Assumption \ref{ass:mu} on boundedness of $\bSi_{i,i}$. It follows from either \eqref{eq:fcase1} or \eqref{eq:fcase2} that in order to prove \eqref{eq:dev2show}, we need to show boundedness of the following terms: $\|{\boldsymbol{\hat{\beta}}}_n\|_2$, $\|\betab^\star\|_2$ and $\|{\boldsymbol{\beta}}\|_2$. By feasibility of ${\boldsymbol{\hat{\beta}}}_n$ and ${\boldsymbol{\beta}}$, we know that ${\boldsymbol{\hat{\beta}}}_n,{\boldsymbol{\beta}}\in\mathcal{B}$. Thus, the desired $\|{\boldsymbol{\beta}}\|_2<\infty$ and $\|{\boldsymbol{\hat{\beta}}}_n\|_2<\infty$ follow directly by Lemma \ref{lem:bd_PO}. (Alternatively, for ${\boldsymbol{\hat{\beta}}}_n$ we conclude the desired by directly applying Lemma \ref{lem:AO}(v)). Finally, to prove $\|\betab^\star\|_2<\infty$, note that $$ \|\betab^\star\|_2^2 =\frac{1}{p}\sum_{i=1}^p(\sqrt{p}\betab^\star_i)^2, $$ \cts{which is bounded wpa 1 by Assumption \ref{ass:mu}, which implies bounded second moments of $\sqrt{p}\betab^\star$. } This completes the proof of \eqref{eq:dev2show}, as desired. \vspace{5pt} \noindent\underline{Satisfying Condition 1:} To prove Condition 1, we simply pick $\eta$ to satisfy the following \begin{align} \bar\phi_S > \bar\phi + 3 \eta ~\Leftarrow~ \bar\phi + \frac{\tilde\epsilon^2}{2\Sigma_{\max}} - \eta \geq \bar\phi + 3 \eta ~\Leftarrow~ \eta \leq \frac{\tilde\epsilon^2}{8\Sigma_{\max}}.\notag \end{align} This completes the proof of Theorem \ref{thm:master_W2}. \subsection{Proof of Lemma \ref{lem:AO}}\label{sec:proofAO} ~~~~ ~~~~ \vspace{3pt} \subsubsection{Proof of (i).} Strong convexity of the objective function in \eqref{eq:PO} is easily verified by the second derivative test. Note here that we use Assumption \ref{ass:mu} that $\bSi_{i,i}\leq\Sigma_{\max},~i\in[p].$ Uniqueness of the solution follows directly from strong convexity. \ct{Strictly speaking we might need to also argue existence, i.e., feasibility of the AO. An indirect way is to show feasibility using the CGMT, but it seems unnecessarily complicated?} \vspace{5pt} \subsubsection{Proof of (ii).}Using Lagrangian formulation, the solution $\widehat{\vct{w}}_n$ to \eqref{eq:AO_con} is the same as the solution to the following: \begin{align} \left(\widehat{\vct{w}}_n,u_n\right) :=\arg\min_{\vct{w}\in\mathcal{B}}\max_{u\geq 0} ~\frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2 + u \left( \sqrt{\tn{\vct{w}}^2+\sigma^2} \tn{\bar{\g}} - \sqrt{\kappa}\,{\bar{\h}}^T\vct{w} + \frac{\sigma h}{\sqrt{n}} \right)\label{eq:AO_2} \end{align} where we have: (i) set $\bar{\g} := {\vct{g}}/\sqrt{n}$ and $\bar{\h}:= \vct{h}/\sqrt{p}$; (ii) recalled that $p/n=\kappa$; and, (iii) used $\left(\widehat{\vct{w}}_n,u_n\right)$ to denote the optimal solutions in \eqref{eq:AO_2}. The subscript $n$ emphasizes the dependence of $\left(\widehat{\vct{w}}_n,u_n\right)$ on the problem dimensions. Also note that (even though not explicit in the notation) $\left(\widehat{\vct{w}}_n,u_n\right)$ are random variables depending on the realizations of $\bar{\g},\bar{\h}$ and $h$. Notice that the objective function above is convex in $\vct{w}$ and linear (thus, concave) in $u$. Thus, strong duality holds and we can flip the order of min-max. Moreover, in order to make the objective easy to optimize with respect to $\vct{w}$, we use the following variational expression for the square-root term $\sqrt{\tn{\vct{w}}^2+\sigma^2}$: $$ \tn{\bar{\g}}\sqrt{\tn{\vct{w}}^2+\sigma^2} = \tn{\bar{\g}}\cdot\min_{\tau\in[\sigma,\sqrt{\sigma^2+B_+^2}]} \left\{ \frac{\tau}{2} + \frac{\tn{\vct{w}}^2+\sigma^2}{2\tau} \right\} = \min_{\tau\in[\sigma,\sqrt{\sigma^2+B_+^2}]} \left\{ \frac{\tau\tn{\bar{\g}}^2}{2} + \frac{\sigma^2}{2\tau} + \frac{\tn{\vct{w}}^2}{2\tau} \right\}, $$ where $B_+$ is defined in Lemma \ref{lem:bd_PO}. For convenience define the constraint set for the variable $\tau$ as $\mathcal{T}':=[\sigma,\sqrt{\sigma^2+B_+^2}]$. For reasons to be made clear later in the proof (see proof of statement (iii)), we consider the (possibly larger) set: \[ \mathcal{T}:=[\sigma,\max\{\sqrt{\sigma^2+B_+^2},2\tau_*\}]\, \] where $\tau_*$ is as in the statement of the lemma. The above lead to the following equivalent formulation of \eqref{eq:AO_2}: \begin{align} \left(\widehat{\vct{w}}_n,u_n,\tau_n\right) = \max_{u\geq 0}\min_{\vct{w}\in\mathcal{B},\tau\in\mathcal{T}} ~ \frac{u\tau\tn{\bar{\g}}^2}{2} + \frac{u\sigma^2}{2\tau} + \frac{u\sigma h}{\sqrt{n}} + \min_{\vct{w}\in\mathcal{B}} \left\{ \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2 + \frac{u}{2\tau}\tn{\vct{w}}^2 - u \sqrt{\kappa}\,{\bar{\h}}^T\vct{w} \right\} .\label{eq:AO_3} \end{align} The minimization over $\vct{w}$ is easy as it involves a strongly convex quadratic function. First, note that unconstrained optimal $\vct{w}':=\vct{w}'(\tau,u)$ (for fixed $(\tau,u)$) is given by \begin{align}\label{eq:w'} \vct{w}':=\vct{w}'(\tau,u) = -\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u\sqrt{\kappa}\bar{\h}\right), \end{align} and \eqref{eq:AO_3} simplifies to \begin{align} \left(u_n,\tau_n\right)=\max_{u\geq 0}\min_{\tau\in\mathcal{T}} ~ \frac{u\tau\tn{\bar{\g}}^2}{2} + \frac{u\sigma^2}{2\tau} + \frac{u\sigma h}{\sqrt{n}} - \frac{1}{2} \left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u\sqrt{\kappa}\bar{\h}\right)^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1} \left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u\sqrt{\kappa}\bar{\h}\right)\,=:\mathcal{R}(u,\tau) .\label{eq:AO_4} \end{align} \somm{Does $u=0$ scenario create a problem in saddle point uniqueness?} It can be checked by direct differentiation and the second-derivative test that the objective function in \eqref{eq:AO_4} is strictly convex in $\tau$ and strictly concave in $u$ over the domain $\{(u,\tau)\in\mathbb{R}_+\times\mathbb{R}_+\}$ \footnote{\fx{To analyze the matrix-vector product term in \eqref{eq:AO_4} for $(\tau,u)$ one can use the fact that ${\boldsymbol{{\Sigma}}}$ is diagonal. This way, as a function of $u$ and $\tau$ the analysis reduces to the properties of relatively simple functions. For instance, for $\tau$, this function is in the form $f(\tau)=-(a+b/\tau)^{-1}$ for $a,b>0$ which is strictly convex.}}. Thus, the saddle point $(u_n,\tau_n)$ is unique. Specifically, this implies that the optimal $\widehat{\vct{w}}_n$ in \eqref{eq:AO_3} is given by (cf. \eqref{eq:w'}) \begin{align}\label{eq:w_n} \widehat{\vct{w}}_n=\vct{w}'(\tau_n,u_n) = -\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}\left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u_n\sqrt{\kappa}\bar{\h}\right). \end{align} In Lemma \ref{lem:AO}(v) we will prove that wpa 1, in the limit of $p\rightarrow\infty$, $\|\widehat{\vct{w}}_n\|_2\leq C$ for sufficiently large absolute constant $C>0$. Thus, by choosing the upper bound in the definition of $\mathcal{B}$ in Lemma \ref{lem:bd_PO} strictly larger than C, guarantees that the unconstrained $\widehat{\vct{w}}_n$ in \eqref{eq:w_n} is feasible in \eqref{eq:AO_3}. \noindent\fx{\textbf{Asymptotic limit of the key quantities $\tau_n,u_n$:}} In what follows, we characterize the high-dimensional limit of the optimal pair $(u_n,\tau_n)$ in the limit $n,p\rightarrow\infty,~p/n\rightarrow\kappa$. We start by analyzing the (point-wise) convergence of $\mathcal{R}(u,\tau)$. For the first three summands in \eqref{eq:AO_4}, we easily find that $$ \left\{\frac{u\tau\tn{\bar{\g}}^2}{2} + \frac{u\sigma^2}{2\tau} + \frac{u\sigma h}{\sqrt{n}}\right\}~ \stackrel{{P}}{\longrightarrow}~\left\{ \frac{u\tau}{2} + \frac{u\sigma^2}{2\tau} \right\}. $$ Next, we study the fourth summand. First, note that \begin{align} (u\sqrt{\kappa}\bar{\h})^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}(u\sqrt{\kappa}\bar{\h}) &= u^2\kappa\,\frac{1}{p}\vct{h}^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\vct{h} \notag\\ &= u^2\kappa\,\frac{1}{p}\sum_{i=1}^{p}\frac{\vct{h}_i^2}{\bSi_{i,i}^{-1}+\frac{u}{\tau}} \notag\\ &\stackrel{{P}}{\longrightarrow} u^2\kappa\,\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right]. \end{align} \somm{Explain/justify PL(2)'ness of these functions. Clearly explain how A2 is used\dots} In the last line, $\Lambda$ is a random variable as in Definition \ref{def:Xi}. \fx{Also, we used Assumption \ref{ass:mu} together with the facts that $\vct{h}$ is independent of $\boldsymbol{\Sigma}$ and that the function $(x_1,x_2)\mapsto x_1^2(x_2^{-1}+u/\tau)^{-1}$ is $\rm{PL}(3)$ assuming $x_2$ is bounded (see Lemma \ref{lem:PLbdd} for proof).} \ct{Question: Is it immediate that the empirical distribution of $(\beta,\boldsymbol{\Sigma},\vct{h})$ converges in $W_k$ to $\mu\otimes\mathcal{N}(0,1)$ given that $(\beta,\boldsymbol{\Sigma})$ converges to $\mu$ and $\vct{h}$ is independent???} Second, we find that \begin{align} (\betab^\star)^T\boldsymbol{\Sigma}^{-1/2}\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\boldsymbol{\Sigma}^{-1/2}\betab^\star &= \frac{1}{p}(\sqrt{p}\betab^\star)^T\left({\mtx{I}}+\frac{u}{\tau}\boldsymbol{\Sigma}\right)^{-1}(\sqrt{p}\betab^\star) \notag\\ &= \frac{1}{p}\sum_{i=1}^{p}\frac{\left(\sqrt{p}\betab^\star_i/\sqrt{\bSi_{i,i}}\right)^2}{\bSi_{i,i}^{-1}+\frac{u}{\tau}}\notag\\ &\stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\Lambda^{-1}+\frac{u}{\tau}}\right]. \end{align} Here, $\Lambda,B$ are random variables as in Definition \ref{def:Xi} and \fx{we also used Assumption \ref{ass:mu} together with the fact that the function $(x_1,x_2)\mapsto x_1^2x_2^{-1}(x_2^{-1}+u/\tau)^{-1}$ is $\rm{PL}(2)$ assuming $x_2$ is bounded (see Lemma \ref{lem:PLbdd} for proof).} Third, \cts{by independence of $(\betab^\star, \boldsymbol{\Sigma})$ from $\vct{h}$} \begin{align} (u\sqrt{\kappa}\bar{\h})^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\boldsymbol{\Sigma}^{-1/2}\betab^\star = u\sqrt{\kappa} \cdot \frac{1}{p}\sum_{i=1} ^p \frac{\vct{h}_i\boldsymbol{\Sigma}_{i,i}^{-1/2}(\sqrt{p}\betab^\star_i)}{\boldsymbol{\Sigma}_{i,i}^{-1}+\frac{u}{\tau}{\mtx{I}}} ~\stackrel{{P}}{\longrightarrow}~ 0. \end{align} Putting these together, the objective $\mathcal{R}(u,\tau)$ in \eqref{eq:AO_4} converges point-wise in $u,\tau$ to \begin{align} \mathcal{R}(u,\tau)\stackrel{{P}}{\longrightarrow}\mathcal{D}(u,\tau) := \frac{1}{2}\left({u\tau} + \frac{u\sigma^2}{\tau} - u^2\kappa\,\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] - \operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\Lambda^{-1}+\frac{u}{\tau}}\right] \right).\label{eq:conv_pt} \end{align} Note that $\mathcal{R}(u,\tau)$ (and thus, $\mathcal{D}(u,\tau)$) is convex in $\tau$ and concave in $u$. Thus, the convergence in \eqref{eq:conv_pt} is in fact uniform (e.g., \cite{AG1982}) and we can conclude that \begin{align}\label{eq:Dc0} \phi({\vct{g}},\vct{h}) \stackrel{{P}}{\longrightarrow} \max_{u\geq 0}\min_{\tau\in\mathcal{T}}~ \mathcal{D}(u,\tau). \end{align} and \fx{using strict concave/convexity of $\mathcal{D}(u,\tau)$, we also have the parameter convergence} \somm{This line follows from strict convex/concavity right?} \begin{align}\label{eq:Dc} \fx{(u_n,\tau_n) \stackrel{{P}}{\longrightarrow} (u_*,\tau_*):=\arg\max_{u\geq 0}\min_{\tau\in\mathcal{T}}~ \mathcal{D}(u,\tau).} \end{align} In the proof of statement (iii) below, we show that the saddle point of \eqref{eq:Dc0} is $(u_*,\tau_*)$. In particular, $\tau_*$ is strictly in the interior of $\mathcal{T}$, which combined with convexity implies that $$ \max_{u\geq 0}\min_{\tau\in\mathcal{T}}~ \mathcal{D}(u,\tau) = \max_{u\geq 0}\min_{\tau>0}~ \mathcal{D}(u,\tau) =: \bar\phi. $$ This, together with the first display above proves the second statement of the lemma. \vspace{5pt} \subsubsection{Proof of (iii).} Next, we compute the saddle point $(u_*,\tau_*)$ by studying the first-order optimality conditions of the strictly concave-convex $\mathcal{D}(u,\tau)$. Specifically, we consider the unconstrained minimization over $\tau$ and we will show that the minimum is achieved in the strict interior of $\mathcal{T}$. Direct differentiation of $\mathcal{D}(u,\tau)$ gives \begin{subequations} \begin{align} {\tau} + \frac{\sigma^2}{\tau} - 2u\kappa\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] + \frac{u^2}{\tau}\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1}+\frac{u}{\tau}\right)^2}\right] + \frac{1}{\tau}\operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1}+\frac{u}{\tau}\right)^2}\right] &= 0, \label{eq:fo1}\\ {u} - \frac{u\sigma^2}{\tau^2} - \frac{u^3}{\tau^2}\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1} + \frac{u}{\tau}\right)^2}\right] - \frac{u}{\tau^2} \operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1}+\frac{u}{\tau}\right)^2}\right] &= 0,\label{eq:fo2} \end{align} \end{subequations} Multiplying \eqref{eq:fo2} with $\frac{\tau}{u}$ and adding to \eqref{eq:fo1} results in the following equation \begin{align} \tau = u\kappa\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] ~\Leftrightarrow ~ \operatorname{\mathbb{E}}\left[ \frac{1}{(\frac{u}{\tau}\Lambda)^{-1}+1} \right] = \frac{1}{\kappa} \label{eq:tauu}\,. \end{align} Thus, we have found that the ratio $\frac{u_*}{\tau_*}$ is the unique solution to the equation in \eqref{eq:tauu}. Note that this coincides with the Equation \eqref{eq:ksi} that defines the parameter $\xi$ in Definition \ref{def:Xi}. The fact that \eqref{eq:tauu} has a unique solution for all $\kappa>1$ can be easily seen as $F(x)=\operatorname{\mathbb{E}}\left[ \frac{1}{(x\Lambda)^{-1}+1} \right], x\in\mathbb{R}_+$ has range $(0,1)$ and is strictly increasing (by differentiation). Thus, we call $\xi=\frac{u_*}{\tau_*}$. Moreover, multiplying \eqref{eq:fo2} with $u$ leads to the following equation for $\tau_*$: \begin{align} u_*^2 = \sigma^2\xi^2 + u_*^2 \xi^2 \kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1} +\xi\right)^2}\right] + \xi^2 \operatorname{\mathbb{E}}\left[ \frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1} + \xi\right)^2}\right] ~\Rightarrow~ \tau_*^2 = \frac{\sigma^2 + \operatorname{\mathbb{E}}\left[ \frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1} + \xi\right)^2}\right]}{1-\xi^2\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1} +\xi\right)^2}\right]} = \frac{\sigma^2 + \operatorname{\mathbb{E}}\left[ \frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1} + \xi\right)^2}\right]}{1-\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left((\xi\Lambda)^{-1} +1\right)^2}\right]}. \end{align} {Again, note that this coincides with Equation \eqref{eq:gamma} that determines the parameter $\gamma$ in Definition \ref{def:Xi}, i.e., $\tau_*^2 = \gamma.$ } \vspace{5pt} \subsubsection{Proof of (iv).} For convenience, define $$F_n({\boldsymbol{\hat{\beta}}},\betab^\star,\boldsymbol{\Sigma}):=\frac{1}{p} \sum_{i=1}^{p} f\left(\sqrt{p}{\boldsymbol{\hat{\beta}}}_{n,i},\sqrt{p}\betab^\star_{i},\boldsymbol{\Sigma}_{ii}\right)\quad\text{and}\quad\alpha_*:=\operatorname{\mathbb{E}}_\mu\left[f(X_{\kappa,\sigma^2}(\Lambda,B,H),B,\Lambda)\right].$$ Recall from \eqref{eq:w_n} the explicit expression for $\widehat{\vct{w}}_n$, repeated here for convenience. \begin{align} \widehat{\vct{w}}_n = -\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}\left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u_n\sqrt{\kappa}\bar{\h}\right).\notag \end{align} Also, recall that ${\boldsymbol{\hat{\beta}}}_n = \boldsymbol{\Sigma}^{-1/2}\widehat{\vct{w}}_n+\betab^\star$. Thus, (and using the fact that $\bar{\h}$ is distributed as $-\bar{\h}$), \begin{align} {\boldsymbol{\hat{\beta}}}_n &=\boldsymbol{\Sigma}^{-1/2}\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}u_n\sqrt{\kappa}\bar{\h} + \left({\mtx{I}}-\boldsymbol{\Sigma}^{-1/2}\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}\boldsymbol{\Sigma}^{-1/2}\right)\betab^\star\notag\\ \Longrightarrow{\boldsymbol{\hat{\beta}}}_{n,i}&=\frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_n\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_n\bar{\h}_i +\left(1-\frac{1}{1+\xi_n\boldsymbol{\Sigma}_{i,i}}\right)\betab^\star_i.\label{eq:betan} \end{align} For $i\in[p]$, define \begin{align} \vct{v}_{n,i} = \frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_*\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_*\bar{\h}_i +\left(1-\frac{1}{1+\xi_*\boldsymbol{\Sigma}_{i,i}}\right)\betab^\star_i \end{align} In the above, for convenience, we have denoted $\xi_n:=u_n/\tau_n$ and recall that $\xi_*:=u_*/\tau_*$. The proof proceeds in two steps. In the first step, we use the fact that $\xi_n\stackrel{{P}}{\longrightarrow}\xi_*$ and $u_n\stackrel{{P}}{\longrightarrow} u_\star$ (see \eqref{eq:Dc}) to prove that for any $\varepsilon\in(0,\xi_*/2)$, there exists an absolute constant $C>0$ such that wpa 1: \begin{align}\label{eq:ivstep1} |F_n(\sqrt{p}{\boldsymbol{\hat{\beta}}}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) - F_n(\sqrt{p}\vct{v}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) | \leq C\varepsilon. \end{align} In the second step, we use \fx{pseudo-Lipschitzness of $f$ and Assumption \ref{ass:mu} to prove that} \somm{Doesn't Assump 3 come out of nowhere? So far it looks like we need A1 and A2. We need to ensure consistency.} \begin{align} |F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| \stackrel{{P}}{\longrightarrow} \alpha_*.\label{eq:ivstep2} \end{align} The desired follows by combining \eqref{eq:ivstep1} and \eqref{eq:ivstep2}. Thus, in what follows, we prove \eqref{eq:ivstep1} and \eqref{eq:ivstep2}. \vspace{2pt} \noindent\underline{Proof of \eqref{eq:ivstep1}.}~~Fix some $\varepsilon\in(0,\xi_*/2)$. From \eqref{eq:Dc}, we know that w.p.a. 1 $|\xi_n-\xi_*|\leq \varepsilon$ and $|u_n-u_*|\leq \varepsilon$. Thus, $\widehat{\vct{w}}_n$ is close to $\vct{v}_n$. Specifically, in this event, for every $i\in[p]$, it holds that: \somm{Fourth line: Constant missing here. Powers are wrongish} \begin{align} \notag|{\boldsymbol{\hat{\beta}}}_{n,i} - \vct{v}_{n,i}| &\leq {|\betab^\star_i|}\left|\frac{1}{1+\xi_n\bSi_{i,i}}-\frac{1}{1+\xi_*\bSi_{i,i}}\right| + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\boldsymbol{\Sigma}_{i,i}}}\left|\frac{\tau_n}{1+(\xi_n\bSi_{i,i})^{-1}}-\frac{\tau_*}{1+(\xi_*\bSi_{i,i})^{-1}}\right| \\ \notag&= {|\betab^\star_i|}\left|\frac{1}{1+\xi_n\bSi_{i,i}}-\frac{1}{1+\xi_*\bSi_{i,i}}\right| + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\boldsymbol{\Sigma}_{i,i}}}\left|\frac{u_n}{\xi_n+\bSi_{i,i}^{-1}}-\frac{u_*}{\xi_*+\bSi_{i,i}^{-1}}\right| \\ \notag& \leq {|\betab^\star_i|}\frac{|\bSi_{i,i}||\xi_n-\xi_*|}{|1+\xi_n\bSi_{i,i}||1+\xi_*\bSi_{i,i}|} + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\bSi_{i,i}}} \frac{u_*|\xi_n-\xi_*|}{(\xi_n+\bSi_{i,i}^{-1})(\xi_*+\bSi_{i,i}^{-1})} + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\bSi_{i,i}}}\frac{|u_n-u_*|}{\xi_n+\bSi_{i,i}^{-1}} \\ \notag& \leq {|\betab^\star_i|}{\Sigma_{\max}\varepsilon} + \sqrt{\kappa}{|\bar{\h}_i|} u_*\Sigma_{\max}^{3/2} \varepsilon+ \sqrt{\kappa}|\bar{\h}_i|\Sigma_{\max}^{1/2}\varepsilon \\ &\leq \varepsilon \cdot \max\left\{\Sigma_{\max}^{3/2},\Sigma_{\max}^{1/2}\right\}\, \left(|\bar{\h}_i| + |\betab^\star_i|\right).\label{eq:betav} \end{align In the second line above, we recalled that $u_n=\tau_n\xi_n$ and $u_*=\tau_*\xi_*$. In the third line, we used the triangle inequality. In the fourth line, we used that $\xi_*>0$, $0<\bSi_{i,i}\leq\Sigma_{\max}$ and $\xi_n\geq \xi_*-\varepsilon \geq \xi_*/2 >0$. Now, we will use this and Lipschitzness of $f$ to argue that there exists absolute constant $C>0$ such that wpa 1: \begin{align} |F_n(\sqrt{p}{\boldsymbol{\hat{\beta}}}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) - F_n(\sqrt{p}\vct{v}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) | \leq C\varepsilon.\notag \end{align} Denote, $\vct{a}_i=(\sqrt{p}{\boldsymbol{\hat{\beta}}}_{n,i},\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$ and $\vct{b}_i=(\sqrt{p}\vct{v}_{n,i},\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$. Following the exact same argument as in \eqref{eq:dev2show} (just substitute ${\boldsymbol{\beta}}\leftrightarrow\vct{v}_n$ in the derivation), we have that for some absolute constant $C>0$ wpa 1: \begin{align} |F_n({\boldsymbol{\hat{\beta}}}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| &\leq C \|{\boldsymbol{\hat{\beta}}}_n-\vct{v}_n\|_2. \end{align} From this and \eqref{eq:betav}, we find that \begin{align} |F_n({\boldsymbol{\hat{\beta}}}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| &\leq C\varepsilon\max\left\{\Sigma_{\max}^{3/2},\Sigma_{\max}^{1/2} \right\} \left(\sum_{i=1}^p \left(|\bar{\h}_i|+|\betab^\star_i|\right)^2\right)^{1/2}\notag \\ &\leq C\varepsilon\sqrt{2}\max\left\{\Sigma_{\max}^{3/2},\Sigma_{\max}^{1/2}\right\}\sqrt{\|\betab^\star\|_2^2 + \|\bar{\h}\|_2^2}.\label{eq:epsS} \end{align} But, \cts{recall that $\|\betab^\star\|_2^2 = \frac{1}{p}\sum_{i=1}^p(\sqrt{p}\betab^\star_i)^2<\infty$, as $p\rightarrow \infty$ by Assumption \ref{ass:mu}.} Also, since $\bar{\h}_i\sim\mathcal{N}(0,1/p)$, it holds that $\|\bar{\h}\|_2^2\leq 2$, wpa 1 as $p\rightarrow\infty$. Therefore, from \eqref{eq:epsS}, wpa 1, there exists constant $C>0$ such that \begin{align} |F_n({\boldsymbol{\hat{\beta}}}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| \leq C \cdot\varepsilon, \end{align} as desired. \vspace{2pt} \noindent\underline{Proof of \eqref{eq:ivstep2}.}~~Next, we will use \ref{ass:mu} to show that \begin{align} |F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| \stackrel{{P}}{\longrightarrow} \alpha_*.\label{eq:AO_conv} \end{align} Notice that $\vct{v}_n$ is a function of $\betab^\star,\boldsymbol{\Sigma},\bar{\h}$. Concretely, define ${\widetilde{g}}:\mathbb{R}^3\rightarrow\mathbb{R}$, such that $$ \widetilde{g}(x_1,x_2,x_3) := \frac{x_2^{-1/2}}{1+(\xi_* x_2)^{-1}}\sqrt{\kappa}\tau_* x_3 + (1-(1+\xi_*x_2)^{-1})x_1, $$ and notice that $$ \sqrt{p}\vct{v}_{n,i} = \widetilde{g}\left(\sqrt{p}\betab^\star_i,\bSi_{i,i},\vct{h}_i\right) = \frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_*\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_*\vct{h}_i +\left(1-\frac{1}{1+\xi_*\boldsymbol{\Sigma}_{i,i}}\right)\sqrt{p}\betab^\star_i. $$ Thus, $$ F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma}) = \frac{1}{p}\sum_{i=1}^p f\left(g\left(\sqrt{p}\betab^\star_i,\bSi_{i,i},\vct{h}_i\right),\sqrt{p}\betab^\star_i,\bSi_{i,i}\right) =: \frac{1}{p}\sum_{i=1}^p h\left(\vct{h}_i,\sqrt{p}\betab^\star_i,\bSi_{i,i}\right), $$ where we have defined $h:\mathbb{R}^3\rightarrow\mathbb{R}$: \begin{align} h(x_1,x_2,x_3) := f\left(\widetilde{g}(x_2,x_3,x_1),x_2,x_3\right).\label{h func} \end{align} \cts{We will prove that $h\in\rm{PL}(4)$. Indeed, if that were the case, then Assumption \ref{ass:mu} gives} \begin{align} \frac{1}{p}\sum_{i=1}^p h\left(\vct{h}_i,\sqrt{p}\betab^\star_i,\bSi_{i,i}\right) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{\mathcal{N}(0,1)\otimes \mu}\left[h(H,B,\Lambda)\right] &= \operatorname{\mathbb{E}}_{\mathcal{N}(0,1)\otimes \mu}\left[f\left(\widetilde{g}(B,\Lambda,H),B,\Lambda\right))\right]\\ & = \operatorname{\mathbb{E}}[f\left(X_{\kappa,\sigma^2}(\Lambda,B,H),B,\Lambda\right)] = \alpha_*, \end{align} where the penultimate equality follows by recognizing that (cf. Eqn. \eqref{eq:X}) $$ \widetilde{g}(B,\Lambda,H) = (1-(1+\xi_*\Lambda)^{-1})B + \sqrt{\kappa}\frac{\tau_*\Lambda^{-1/2}}{1+(\xi_*\Lambda)^{-1}}H = X_{\kappa,\sigma^2}(\Lambda,B,H). $$ It remains to show that $h\in\rm{PL}(4)$. Lemma \ref{lem:hPL} in Section \ref{SM useful fact} shows that if $f\in\rm{PL}(k)$, then $h\in\rm{PL}(k+1)$ for all integers $k\geq 2$. First, consider the case $f\in\rm{PL}(2)$. Then, $h\in\rm{PL}(3)$; thus, also $h\in\rm{PL}(4)$. Second, consider the case $f=f_{\cal{L}}$. Then, we prove in Lemma \ref{lem:fL} that $f_{\cal{L}}\in\rm{PL}(3)$. Thus, the desired holds in this case too. \vspace{5pt} \subsubsection{Proof of (v):} Let $\psi:\mathbb{R}\rightarrow\mathbb{R}$ be any bounded Lipschitz function. The function $f(a,b,c) = \psi(a)$ is trivially $\rm{PL}$ of order $2$. Thus, by directly applying statement (iv) of the lemma, we find that $$ \frac{1}{p}\sum_{i=1}^p{\psi(\sqrt{p}{\boldsymbol{\hat{\beta}}}_{n,i}({\vct{g}},\vct{h}))} \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}\left[\psi(X_{\kappa,\sigma^2})\right]. $$ Since this holds for any bounded Lipschitz function, we have shown that the empirical convergence of ${\boldsymbol{\hat{\beta}}}_n$ converges weakly to the distribution of $X_{\kappa,\sigma^2}$. It remains to prove boundedness of the $2$nd moment as advertised in \eqref{eq:k_AO}. Recall from \eqref{eq:betan} that \begin{align} \sqrt{p}{\boldsymbol{\hat{\beta}}}_{n,i}&=\frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_n\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_n\vct{h}_i +\left(1-\frac{1}{1+\xi_n\boldsymbol{\Sigma}_{i,i}}\right)(\sqrt{p}\betab^\star_i).\notag \end{align} Using this, boundedness of $\boldsymbol{\Sigma}_{i,i}$ from Assumption \ref{ass:mu}, and the fact that $\tau_n\stackrel{{P}}{\longrightarrow}\tau_\star, \xi_n\stackrel{{P}}{\longrightarrow}\xi_\star$, there exists constant $C=C(\Sigma_{\max},\Sigma_{\min},k,\tau_\star,\xi_\star)$ such that wpa 1, \begin{align} \frac{1}{p}\sum_{i=1}^p|\sqrt{p}{\boldsymbol{\hat{\beta}}}_{n,i}|^{2} \leq C\left(\frac{1}{p}\sum_{i=1}^p|\vct{h}_{i}|^{2}+\frac{1}{p}\sum_{i=1}^p|\sqrt{p}\betab^\star_{i}|^{2}\right).\notag \end{align} But the two summands in the expression above are finite in the limit of $p\rightarrow\infty$. Specifically, (i) from Assumption \ref{ass:mu}, $\frac{1}{p}\sum_{i=1}^p|\sqrt{p}\betab^\star_{i}|^{2}\stackrel{{P}}{\longrightarrow}\operatorname{\mathbb{E}}[B^{2}]<\infty$; (ii) $\frac{1}{p}\sum_{i=1}^p|\vct{h}_{i}|^{2}\stackrel{{P}}{\longrightarrow}\operatorname{\mathbb{E}}[H^{2}]=1$, using the facts that $\vct{h}_i\stackrel{iid}{\sim}\mathcal{N}(0,1)$ and $H\sim\mathcal{N}(0,1)$. This proves \eqref{eq:k_AO}, as desired. \input{risks_proofs} \section{Useful results about pseudo-Lipschitz functions}\label{SM useful fact} For $k\geq 1$ we say a function $f:\mathbb{R}^m\rightarrow\mathbb{R}$ is pseudo-Lipschitz of order $k$ and denote it by $f\in \rm{PL}(k)$ if there exists a cosntant $L>0$ such that, for all $\vct{x},\vct{y}\in\mathbb{R}^m$: \begin{align} |f(\vct{x})-f(\vct{y})|\leq L\left(1+\|\vct{x}\|_2^{k-1}+\|\vct{y}\|_2^{k-1}\right)\|\vct{x}-\vct{y}\|_2.\label{PL func} \end{align} In particular, when $f\in\rm{PL}(k)$, the following properties hold: \begin{enumerate} \item There exists a constant $L'$ such that for all $\vct{x}\in\mathbb{R}^n$: $|f(\vct{x})|\leq L'(1+\|\vct{x}\|_2^k).$ \item $f$ is locally Lipschitz, that is for any $M>0$, there exists a constant $L_{M,m}<\infty$ such that for all $x,y\in[-M,M]^m$, $ |f(\vct{x})-f(\vct{y})| \leq L_{M,m}\|\vct{x}-\vct{y}\|_2. $ Further, $L_{M,m}\leq c(1+(M\sqrt{m})^{k-1})$ for some costant $c$. \end{enumerate} Using the above properties, we prove the following two technical lemmas used in the proof of Theorem \ref{thm:master_W2} \begin{lemma}\label{lem:fL} Let $g:\mathbb{R}\rightarrow\mathbb{R}$ be a Lipschitz function. Consider the function $f:\mathbb{R}^3\rightarrow\mathbb{R}$ defined as follows: $$ f(\vct{x}) = x_1(x_2-g(x_3))^2. $$ Then, $f\in\rm{PL}(3).$ \end{lemma} \begin{proof} Let $h:\mathbb{R}^2\rightarrow\mathbb{R}$ defined as $h({\vct{u}})=({\vct{u}}_1-g({\vct{u}}_2))^2$. The function $({\vct{u}}_1,{\vct{u}}_2)\mapsto{\vct{u}}_1-g({\vct{u}}_2)$ is clearly Lipschitz. Thus, $h\in\rm{PL}(2)$, i.e., \begin{align} |h({\vct{u}})-h(\vct{v})| \leq C(1+\|{\vct{u}}\|_2+\|\vct{v}\|_2)\|{\vct{u}}-\vct{v}\|_2\quad\text{and}\quad |h(\vct{v})|\leq C'(1+\|\vct{v}\|_2^2).\label{eq:h_pl} \end{align} Therefore, letting $\vct{x}=(x_1,{\vct{u}})\in\mathbb{R}^3$ and $\vct{y}=(y_1,\vct{v})\in\mathbb{R}^3$, we have that \begin{align} |f(\vct{x})-f(\vct{y})| &= |x_1h({\vct{u}}) - y_1h(\vct{v})| \leq |x_1||h({\vct{u}})-h(\vct{v})| + |h(\vct{v})| |x_1-y_1|\notag\\ &\leq C|x_1|(1+\|{\vct{u}}\|_2+\|\vct{v}\|_2)\|{\vct{u}}-\vct{v}\|_2 + C'(1+\|\vct{v}\|_2^2)|x_1-y_1| \notag\\ &\leq C(|x_1|^2+(1+\|{\vct{u}}\|_2+\|\vct{v}\|_2)^2)\|{\vct{u}}-\vct{v}\|_2 + C'(1+\|\vct{v}\|_2^2)|x_1-y_1| \notag\\ &\leq C(1+\|\vct{x}\|_2^2+\|\vct{y}\|_2^2)\|{\vct{u}}-\vct{v}\|_2 + C'(1+\|\vct{x}\|_2^2+\|\vct{y}\|_2^2)|x_1-y_1| \notag\\ &\leq C(1+\|\vct{x}\|_2^2+\|\vct{y}\|_2^2)\|\vct{x}-\vct{y}\|_2. \end{align} In the second line, we used \eqref{eq:h_pl}. In the third line, we used $2xy\leq x^2+y^2$. In the fourth line, we used Cauchy-Schwarz inequality. $C,C'>0$ are absolute constants that may change from line to line. This completes the proof of the lemma. \end{proof} \fx{ \begin{lemma}[PL with Bounded Variables]\label{lem:PLbdd Let $f:\mathbb{R}^{d_1}\rightarrow \mathbb{R}$ be a $PL(k)$ function. $M\subset \mathbb{R}^{d_2}$ be a compact set and $g$ be a continuously differentiable function over $M$. Then $h(\vct{x},\vct{y})=f(\vct{x})g(\vct{y})$ is $PL(k+1)$ over $\mathbb{R}^{d_1}\times M$. \end{lemma} \begin{proof} First observe that since $g$ has continuous derivatives and is continuous over a compact set. Thus $g$ and its gradient is bounded and $g$ is Lipschitz over $M$. Let $B=\sup_{\vct{x}\in M}\max |g(x)|,\tn{\nabla g(\vct{x})}$. To proceed, given pairs $(\vct{x},\vct{y})$ and $(\vct{x}',\vct{y}')$ over $\mathbb{R}\times M$, we have that \begin{align} |h(\vct{x},\vct{y})-h(\vct{x}',y')|&\leq |h(\vct{x},\vct{y})-h(\vct{x}',\vct{y})|+ |h(\vct{x}',\vct{y})-h(\vct{x}',\vct{y}')|\\ &\leq |f(\vct{x})-f(\vct{x}')||g(\vct{y})|+ |f(\vct{x}')||g(\vct{y})-g(\vct{y}')|\\ &\leq B|f(\vct{x})-f(\vct{x}')|+ B\tn{\vct{y}-\vct{y}'}|f(\vct{x}')|\\ &\leq B(1+\tn{\vct{x}'}^{k-1}+\tn{\vct{x}}^{k-1})\tn{\vct{x}-\vct{x}'}+ B\tn{\vct{y}-\vct{y}'}(1+\tn{\vct{x}'}^k)\\ &\lesssim (1+\tn{{\vct{z}}}^k+\tn{{\vct{z}}'}^{k})\tn{{\vct{z}}-{\vct{z}}'}, \end{align} where ${\vct{z}}=[\vct{x}~\vct{y}]$. This shows the desired $\text{PL}(k+1)$ guarantee. \end{proof} The following lemma is in similar spirit to Lemma \ref{lem:PLbdd} and essentially follows from similar lines of arguments (i.e.~using Lipschitzness induced by boundedness). } \begin{lemma}\label{lem:hPL} Let functions $f,g:\mathbb{R}^3\rightarrow\mathbb{R}$ such that $f\in\rm{PL}(k)$ and $$ g(x_1,x_2,x_3) := \frac{x_2^{-1/2}}{1+(\xi_* x_2)^{-1}}\sqrt{\kappa}\tau_* x_3 + (1-(1+\xi_*x_2)^{-1})x_1. $$ Here, $\xi_*,\tau_*,\kappa$ are positive constants. Further define \begin{align} h(x,y,z) := f\left(g(y,z,x),y,z\right), \end{align} and assume that $y$ take values on a fixed bounded compact set $\mathcal{M}$. Then, it holds that $h\in\rm{PL}(k+1)$. \end{lemma} \begin{proof} Since $f$ is $\rm{PL}(k)$, for some $L>0$, \eqref{PL func} holds. Fix $x,x'\in\mathbb{R}$, $\vct{a}=[y,z]\in\mathbb{R}^{2}$ and $\vct{a}'=[y',z']\in\mathbb{R}^{2}$. Let $\vct{b}=[{\vct{g}},\vct{a}]=[{\vct{g}},y,z]\in\mathbb{R}^3$ where ${\vct{g}}=g(y,z,x)\in\mathbb{R}$ and define accordingly $\vct{b}'$ and ${\vct{g}}'$. We have that \begin{align} |h([x,\vct{a}])-h([x,\vct{a}'])|&= |f(\vct{b})-f(\vct{b}')|\notag\\ &\leq L\left(1+\|\vct{b}\|_2^{k-1}+\|\vct{b}'\|_2^{k-1}\right)\|\vct{b}-\vct{b}'\|_2\notag\\ &\leq C\left(1+\|\vct{a}\|_2^{k-1}+\|\vct{a}'\|_2^{k-1}+|{\vct{g}}|^{k-1}+|{\vct{g}}'|^{k-1}\right)(\|\vct{a}-\vct{a}'\|_2+|{\vct{g}}-{\vct{g}}'|),\label{eq:hlip} \end{align} for some constant $C>0$. In the last inequality we have repeatedly used the inequality $ \left(\sum_{i=1}^m \|\vct{v}_i\|_2^2\right)^{\frac{d}{2}} \leq C(m)\cdot\sum_{i=1}^m\|\vct{v}_i\|_2^{d}. $ Next, we need to bound the ${\vct{g}}$ term in terms of $\vct{a}$. This is accomplished as follows \begin{align} |{\vct{g}}|^{k-1} &= \left|\frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x + (1-(1+\xi_*y)^{-1})z\right|^{k-1}\notag\\ &\leq C (|z|+|x|)^{k-1} \notag\\ &\leq C \left(|x|^{k-1}+|z|^{k-1}\right) \leq C (|x|^{k-1} + \|\vct{a}\|_2^{k-1}).\label{eq:gb} \end{align} Here, the value of the constant $C>0$ may change from line to line. Secondly and similarly, we have the following perturbation bound on the ${\vct{g}}-{\vct{g}}'$. Recall that $(x,y)$ and $(x',y')$ are bounded. We will prove the following sequence of inequalities \begin{align} |{{\vct{g}}-{\vct{g}}'}|&= |g(y,z,x)-g(y',z',x')| \notag\\ &\leq \left|\frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x - \frac{(y')^{-1/2}}{1+(\xi y')^{-1}}\sqrt{\kappa}\tau_* x'\right| + \left|(1-(1+\xi_*y)^{-1})z-(1-(1+\xi_*y')^{-1})z'\right|\notag\\ &\leq \left|\frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x - \frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x'\right| +\left|\frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x'- \frac{(y')^{-1/2}}{1+(\xi y')^{-1}}\sqrt{\kappa}\tau_* x'\right|\notag\\ &\qquad+ \left|(1-(1+\xi_*y)^{-1})z-(1-(1+\xi_*y)^{-1})z'\right| + \left|(1-(1+\xi_*y)^{-1})z'-(1-(1+\xi_*y')^{-1})z'\right| \notag\\ &\leq C_1|x-x'| + C_2|x'||y-y'| + C_3|z-z'| + C_4|z'||y-y'|\notag\\ &\leq C(1+|x'| + |z'|)(|x-x'| + |z-z'| + |y-y'|)\\ &\leq C\sqrt{3}(1+|x'| + |z'|)\|[\vct{a},x]-[\vct{a}',x']\|_2 .\label{eq:gd} \end{align} In the fourth inequality above, we used the fact the assumption that $|y|$ is bounded. In the last line, we used Cauchy-Scwhartz. Substituting \eqref{eq:gb} and \eqref{eq:gd} in \eqref{eq:hlip} gives: \begin{align} |h(x,y,z) - h(x',y',z')| &\leq C\left(1+\|\vct{a}\|_2^{k-1}+\|\vct{a}'\|_2^{k-1}+|x|^{k-1}+|x'|^{k-1}\right)(1+|x'| + |z'|)\|[\vct{a},x]-[\vct{a}',x']\|_2\notag \\ &\leq C\left(1+\|[\vct{a},x]\|_2^{k}+\|[\vct{a}',x']\|_2^{k}\right)\|[\vct{a},x]-[\vct{a}',x']\|_2. \end{align} Thus, $h\in\rm{PL}(k+1)$, as desired. \end{proof} \section{Proofs for overparameterized least-squares}\label{sec proof thm 1} In this section, we assume the linear Gaussian problem (LGP) of Definition \ref{def LGP}, the overparameterized regime $k=p>n$ and the min-norm model $\hat\boldsymbol{\beta}$ of \eqref{eq:min_norm}. We prove Theorem \ref{thm:master_W2} that derives the asymptotic DC of $\hat\boldsymbol{\beta}$ and we show how this leads to sharp formulae for the risk of the Magnitude- and Hessian-pruned models. \subsection{Notation and Assymptions} For the reader's convenience, we recall some necessary notation and assumptions from Section \ref{sec main}. We say that a function $f:\mathbb{R}^m\rightarrow\mathbb{R}$ is pseudo-Lipschitz of order $k$, denoted $f\in\rm{PL}(k)$, if there is a constant $L>0$ such that for all $\vct{x},\vct{y}\in\mathbb{R}^m$, $ |f(\vct{x}) - f(\vct{y})|\leq L(1+\tn{\vct{x}}^{k-1}+\tn{\vct{y}}^{k-1})\|\vct{x}-\vct{y}\|_2 $ (See also Section \ref{SM useful fact}). We say that a sequence of probability distributions $\nu_p$ on $\mathbb{R}^m$ {converges in $W_k$} to $\nu$, written $\nu_p\stackrel{W_k}{\Longrightarrow} \nu$, if $W_k(\nu_p,\nu) \rightarrow 0$ as $p \rightarrow \infty$. An equivalent definition is that, for any $f\in\rm{PL}(k)$, $\lim_{p\rightarrow}\operatorname{\mathbb{E}} f(X_p)=\operatorname{\mathbb{E}} f(X)$, where expectation is with respect to $X_p\sim\nu_p$ and $X\sim\nu$ (e.g., \cite{montanari2017estimation}). Finally, we use $C,C',c,c'$ to denote absolute constants (not depending on $n,p$) whose value might change from line to line. We focus on a double asymptotic regime where: $$n,p,s\rightarrow\infty \text{ at fixed overparameterization ratio } \kappa:=p/n>0 \text{ and sparsity level } \alpha:=s/p\in(0,1).$$ For a sequence of random variables $\mathcal{X}_{p}$ that converge in probability to some constant $c$ in the limit of Assumption \ref{ass:linear} below, we write $\mathcal{X}_{p}\stackrel{{P}}{\longrightarrow} c$. For a sequence of event $\mathcal{E}_p$ for which $\lim_{p\rightarrow}\mathbb{P}(\mathcal{E}_p) = 1$, we say that $\mathcal{E}_p$ occurs \emph{with probability approaching 1}. For this, we will often use the shorthand ``wpa. 1". Next, we recall the set of assumption under which our analysis applies: \textbf{(A1)[Diagonal covariance].}~~The covariance matrix $\boldsymbol{\Sigma}$ is diagonal. \textbf{(A2)[Boundedness and empirical distribution].}~~There exist constants $\Sigma_{\min},\Sigma_{\max}\in(0,\infty)$ such that: $ \Sigma_{\min}\leq{\boldsymbol{{\Sigma}}}_{i,i}\leq \Sigma_{\max}. $ for all $i\in[p].$ There exists absolute constant $C>0$ such that $\sqrt{p}|\betab^\star_i|<C$, for all $i\in[p]$. Furthermore, the joint empirical distribution of $\{(\bSi_{i,i},\sqrt{p}\betab^\star_i)\}_{i\in[p]}$ converges in {Wasserstein-\cts{(k+1)}} distance to a probability distribution $\mu$ on $\mathbb{R}_{>0}\times\mathbb{R}$ {for some \cts{$k+1\geq 4$}}. That is $ \frac{1}{p}\sum_{i\in[p]}\delta_{(\bSi_{i,i},\sqrt{p}\betab^\star_i)} \stackrel{W_{\cts{k+1}}}{\Longrightarrow} \mu. $ \subsection{Proof of Theorem \ref{thm:master_W2}} \vspace{5pt} Let ${\mtx{X}}\in\mathbb{R}^{n\times p}$ have zero-mean and normally distributed rows with a diagonal covariance matrix ${\boldsymbol{{\Sigma}}}=\operatorname{\mathbb{E}}[\vct{x}\x^T]$. Given a ground-truth vector $\betab^\star$ and labels $\vct{y}={\mtx{X}}\betab^\star+\sigma {\vct{z}},~{\vct{z}}\sim\mathcal{N}(0,{\mtx{I}}_n)$, we consider the least-squares problem subject to the minimum Euclidian norm constraint (as $\kappa=p/n>1$) given by \begin{align}\label{eq:PO_beta} \min_{{\boldsymbol{\beta}}}\frac{1}{2}\tn{{\boldsymbol{\beta}}}^2\quad\text{subject to}\quad \vct{y}={\mtx{X}}{\boldsymbol{\beta}}. \end{align} It is more convenient to work with the following change of variable: $\vct{w}:=\sqrt{\boldsymbol{\Sigma}}({\boldsymbol{\beta}}-\betab^\star)$. With this, the optimization problem in \eqref{eq:min_norm} can be rewritten as \begin{align}\label{eq:PO} \Phi({\mtx{X}})=\min_{\vct{w}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad {\mtx{\bar{X}}}\vct{w}=\sigma {\vct{z}}, \end{align} where we write ${\mtx{\bar{X}}}={\mtx{X}}\boldsymbol{\Sigma}^{-1/2}\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,1)$. First, using standard arguments, we show that the solution of \eqref{eq:PO} is bounded. Hence, we can constraint the optimization in a sufficiently large compact set without loss of generality. \begin{lemma}[Boundedness of solution]\label{lem:bd_PO} Let $\hat\vct{w}_n:=\hat\vct{w}_n({\mtx{X}},{\vct{z}})$ be the minimizer in \eqref{eq:PO}. Then, with probability approaching 1, it holds that $\hat\vct{w}_n\in\mathcal{B}$, where $$\mathcal{B}:=\left\{\vct{w}\,|\,\|\vct{w}\|_2\leq B_{+} \right\},\qquad B_+:=4\sqrt{\Sigma_{\max}}\frac{2(\sqrt{\kappa}+1)\sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}\left[B^2\right]} + \sigma}{\sqrt{\Sigma_{\min}}(\sqrt{\kappa}-1)} + \sqrt{\Sigma_{\max}}\sqrt{\operatorname{\mathbb{E}}\left[B^2\right]}. $$ \end{lemma} \begin{proof} First, we show that the min-norm solution $\hat\boldsymbol{\beta}={\mtx{X}}^T({\mtx{X}}\X^T)^{-1}\vct{y}$ of \eqref{eq:PO_beta} is bounded. Here, we used the fact that $\kappa>1$, thus ${\mtx{X}}\X^T$ is invertible wpa 1. We have, \begin{align} \tn{\hat\boldsymbol{\beta}_n}^2 = \vct{y}^T({\mtx{X}}\X^T)^{-1}\vct{y} \leq \frac{\tn{\vct{y}}^2}{\lambda_{\min}({\mtx{X}}\X^T)} = \frac{\tn{\vct{y}}^2}{\lambda_{\min}({\mtx{\bar{X}}}\boldsymbol{\Sigma}{\mtx{\bar{X}}}^T)} \leq \frac{\tn{\vct{y}}^2}{\lambda_{\min}({\mtx{\bar{X}}}\Xb^T)\,\Sigma_{\min}} = \frac{\tn{\vct{y}}^2}{\sigma_{\min}^2({\mtx{\bar{X}}})\,\Sigma_{\min}}. \label{eq:Ubb} \end{align} But, wpa 1, $ \sigma_{\min}({\mtx{\bar{X}}})/\sqrt{n} \geq \frac{1}{2}\left(\sqrt{\kappa}-1\right). $ Furthermore, $ \|\vct{y}\|_2 \leq \|{\mtx{\bar{X}}}\boldsymbol{\Sigma}^{1/2}\betab^\star\|_2 + \sigma\|{\vct{z}}\|_2 \leq \sigma_{\max}({\mtx{\bar{X}}})\sqrt{\Sigma_{\max}} \|\betab^\star\|_2 + \sigma\|{\vct{z}}\|_2. $ Hence, wpa 1, $$ \|\vct{y}\|_2/\sqrt{n} \leq 4(\sqrt{\kappa}+1)\sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}\left[B^2\right]} + 2\sigma, $$ where we used the facts that wpa 1: $\|z\|_2/\sqrt{n}\stackrel{{P}}{\longrightarrow} 1$, $\sigma_{\max}({\mtx{\bar{X}}})<2(\sqrt{\kappa}+1)$ and by Assumption \ref{ass:mu}: $$ \|\betab^\star\|_2^2 = \frac{1}{p}\sum_{i=1}^{p}(\sqrt{p}\betab^\star_i)^2 \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}\left[B^2\right]. $$ Put together in \eqref{eq:Ubb}, shows that \begin{align} \tn{\hat\boldsymbol{\beta}_n} < \frac{4(\sqrt{\kappa}+1)\sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}\left[B^2\right]} + 2\sigma}{\sqrt{\Sigma_{\min}}(\sqrt{\kappa}-1)/2} =: \tilde{B}_+.\label{eq:bd_beta} \end{align} Recalling that $\hat\vct{w}_n= \sqrt{\boldsymbol{\Sigma}}\boldsymbol{\beta} - \sqrt{\boldsymbol{\Sigma}}\betab^\star$, we conclude, as desired, that wpa 1, $ \tn{\hat\vct{w}_n} \leq \sqrt{\Sigma_{\max}}\tilde{B}_+ + \sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}[B^2]} =: B_+. $ \end{proof} Lemma \ref{lem:bd_PO} implies that nothing changes in \eqref{eq:PO} if we further constrain $\vct{w}\in\mathcal{B}$ in \eqref{eq:PO}. Henceforth, with some abuse of notation, we let \begin{align}\label{eq:PO_bd} \Phi({\mtx{X}}):=\min_{\vct{w}\in\mathcal{B}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad {\mtx{\bar{X}}}\vct{w}=\sigma {\vct{z}}, \end{align} Next, in order to analyze the primary optimization (PO) problem in \eqref{eq:PO_bd} in apply the CGMT \cite{thrampoulidis2015lasso}. Specifically, we use the constrained formulation of the CGMT, Theorem \ref{thm closed}. Specifically, the auxiliary problem (AO) corresponding to \eqref{eq:PO_bd} takes the following form with ${\vct{g}}\sim\mathcal{N}(0,{\mtx{I}}_n)$, $\vct{h}\sim\mathcal{N}(0,{\mtx{I}}_p)$, $h\sim \mathcal{N}(0,1)$ \begin{align} \phi({\vct{g}},\vct{h}) = \min_{\vct{w}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad \tn{{\vct{g}}}\tn{\vct{w}~{\sigma}}\leq \vct{h}^T\vct{w}+\sigma h.\label{eq:AO_con} \end{align We will prove the following result about the AO problem. \begin{lemma}[Properties of the AO -- Overparameterized regime]\label{lem:AO} Let $\phi_n=\phi({\vct{g}},\vct{h})$ be the optimal cost of the minimization in \eqref{eq:AO_con}. Define $\bar\phi$ as the optimal cost of the following deterministic min-max problem \begin{align}\label{eq:AO_det} \bar\phi:=\max_{u\geq 0}\min_{\tau>0}~ \mathcal{D}(u,\tau):=\frac{1}{2}\left({u\tau} + \frac{u\sigma^2}{\tau} - u^2\kappa\,\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] - \operatorname{\mathbb{E}}\left[\frac{N^2}{\Lambda^{-1}+\frac{u}{\tau}}\right] \right). \end{align} The following statements are true. \noindent{(i).}~The AO minimization in \eqref{eq:AO_con} is $\frac{1}{\Sigma_{\max}}$-strongly convex and has a unique minimizer $\vct{w}_n:=\vct{w}_n({\vct{g}},\vct{h})$. \noindent{(ii).}~In the limit of $n,p\rightarrow\infty, p/n=\kappa$, it holds that $\phi({\vct{g}},\vct{h})\stackrel{{P}}{\longrightarrow}\bar\phi$, i.e., for any $\varepsilon>0$: $$ \lim_{n\rightarrow\infty}\P\left(|\phi({\vct{g}},\vct{h})-\bar\phi|>\varepsilon\right) = 0. $$ \noindent{(iii).} The max-min optimization in \eqref{eq:AO_det} has a unique saddle point $(u_*,\tau*)$ satisfying the following: $$ u_*/\tau_* = \xi\quad\text{and}\quad\tau_* = \gamma, $$ where $\xi, \gamma$ are defined in Definition \ref{def:Xi}. \noindent{(iv).}~Let $f:\mathbb{R}\rightarrow\mathbb{R}$ be a $\rm{PL}({k})$ function. Let $\boldsymbol{\beta}_n=\boldsymbol{\Sigma}^{-1/2}\vct{w}_n + \betab^\star$. Then, $$ \frac{1}{p}\sum_{i=1}^{p}f\left(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}\right) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{(B,\Lambda,H)\sim\mu\otimes \mathcal{N}(0,1)}\left[f\left(X_{\kappa,\sigma^2}(B,\Lambda,H),B,\Lambda\right) \right]. $$ \end{lemma} We prove Lemma \ref{lem:AO} in Section \ref{sec:proofAO}. Here, we show how this leads to the proof of Theorem \ref{thm:master_W2} when combined with the CGMT. For convenience, define $$F_n(\hat\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma}):=\frac{1}{p} \sum_{i=1}^{p} f\left(\sqrt{p}\hat\boldsymbol{\beta}_{n,i},\sqrt{p}\betab^\star_{i},\boldsymbol{\Sigma}_{ii}\right)\quad\text{and}\quad\alpha_*:=\operatorname{\mathbb{E}}_\mu\left[f(X_{\kappa,\sigma^2}(\Lambda,B,H),B,\Lambda)\right].$$ Fix any $\varepsilon>0$. It suffices to prove that the solution $\hat\boldsymbol{\beta}_n$ of the PO in \eqref{eq:PO_beta} satisfies $\hat\boldsymbol{\beta}_n\not\in\mathcal{S}$ wpa. 1, where \begin{align}\label{eq:S_set} \mathcal{S} = \mathcal{S}(\betab^\star,\boldsymbol{\Sigma}) =\{\boldsymbol{\beta}{~\big |~} |F_n(\hat\boldsymbol{\beta}_n,\betab^\star,\boldsymbol{\Sigma})-\alpha_*|\geq 2\varepsilon\}. \end{align} In particular, define the ``perturbed" PO and AO problems (compare to \eqref{eq:PO} and \eqref{eq:AO_con}) as: \begin{align}\label{eq:PO_S} \Phi_S({\mtx{X}})=\min_{\vct{w}\in\mathcal{S}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad {\mtx{\bar{X}}}\vct{w}=\sigma {\vct{z}}, \end{align} and \begin{align} \phi_S({\vct{g}},\vct{h})=\min_{\vct{w}\in\mathcal{S}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad \tn{{\vct{g}}}\tn{\vct{w}~{\sigma}}\leq \vct{h}^T\vct{w}+\sigma h.\label{eq:AO_S} \end{align where recall that ${\mtx{\bar{X}}}={\mtx{X}}\boldsymbol{\Sigma}^{-1/2}\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,1)$, ${\vct{g}}\sim\mathcal{N}(0,{\mtx{I}}_n)$, $\vct{h}\sim\mathcal{N}(0,{\mtx{I}}_p)$, $h\sim \mathcal{N}(0,1)$ and we have used the change of variables $\vct{w}:=\sqrt{\boldsymbol{\Sigma}}(\boldsymbol{\beta}-\betab^\star)$ for convenience. Using \cite[Theorem 6.1(iii)]{thrampoulidis2018precise} it suffices to find costants $\bar\phi, \bar\phi_S$ and $\eta>0$ such that the following hold: \begin{enumerate} \item $\bar\phi_S \geq \bar\phi + 3\eta$, \item $\phi({\vct{g}},\vct{h}) \leq \bar\phi + \eta$, with probability approaching 1, \item $\phi_S({\vct{g}},\vct{h}) \geq \bar\phi_S - \eta$, with probability approaching 1. \end{enumerate} In what follows, we explicitly find $\bar\phi, \bar\phi_S,\eta$ such that the three conditions above hold. \vspace{5pt} \noindent\underline{Satisfying Condition 2}: Recall the deterministic min-max optimization in \eqref{eq:AO_det}. Choose $\bar\phi=\mathcal{D}(u_*,\tau_*)$ be the optimal cost of this optimization. From Lemma \ref{lem:AO}(ii), $\phi({\vct{g}},\vct{h})\stackrel{{P}}{\longrightarrow}\bar\phi$. Thus, for any $\eta>0$, with probability approaching 1: \begin{align}\label{eq:phi_lim} \bar\phi + \eta \geq \phi({\vct{g}},\vct{h}) \geq \bar\phi - \eta. \end{align} Clearly then, Condition 2 above holds for any $\eta>0$. \vspace{5pt} \noindent\underline{Satisfying Condition 3}: Next, we will show that the third condition holds for appropriate $\bar\phi$. Let $\vct{w}_n=\vct{w}_n({\vct{g}},\vct{h})$ be the unique minimizer of \eqref{eq:AO_con} as per Lemma \ref{lem:AO}(i), i.e., $\frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}_n+\boldsymbol{\beta}}^2 = \phi({\vct{g}},\vct{h})$. Again from Lemma \ref{lem:AO}, the minimization in \eqref{eq:AO_con} is $1/\Sigma_{\max}$-strongly convex in $\vct{w}$. Here, $\Sigma_{\max}$ is the upper bound on the eigenvalues of $\boldsymbol{\Sigma}$ as per Assumption \ref{ass:inv}. Thus, for any $\tilde\varepsilon>0$ and any feasible $\vct{w}$ the following holds (deterministically): \begin{align}\label{eq:sc} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\boldsymbol{\beta}}^2 \geq \phi({\vct{g}},\vct{h}) + \frac{\tilde\epsilon^2}{2C},~\text{provided that}~ \|\vct{w}-\vct{w}_n({\vct{g}},\vct{h})\|_2 \geq \tilde\epsilon. \end{align} Now, we argue that $\boldsymbol{\beta}\in\mathcal{S}$ implies that $\|\vct{w}-\vct{w}_n({\vct{g}},\vct{h})\|_2\geq \tilde\varepsilon$ wpa 1, for appropriate value of $\tilde\varepsilon$ and $\vct{w}=\sqrt{\boldsymbol{\Sigma}}(\boldsymbol{\beta}-\betab^\star)$. Consider any $\boldsymbol{\beta}\in\mathcal{S}$. First, by definition in \eqref{eq:S_set}, $$ |F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})-\alpha_*| \geq 2\varepsilon. $$ Second, by Lemma \ref{lem:AO}(iv), with probability approaching 1, $$ |F(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - \alpha_*| \leq \epsilon. $$ Third, we will show that wpa 1, there exists universal constant $C>0$ such that \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})| \leq C {\|\boldsymbol{\beta}_{n}({\vct{g}},\vct{h}) - \boldsymbol{\beta}\|_2}\label{eq:dev2show}. \end{align} Before proving \eqref{eq:dev2show}, let us argue how combining the above three displays shows the desired. Indeed, wpa. 1, \begin{align*} 2\varepsilon &\leq |F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})-\alpha_*| \leq |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})| + |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - \alpha_*| \\ &\leq \epsilon + C \,\|\boldsymbol{\beta}-\boldsymbol{\beta}_n\|_2. \\ &\qquad\Longrightarrow \|\boldsymbol{\beta}-\boldsymbol{\beta}_n\|_2 \geq {\varepsilon}/{C}=:\hat\varepsilon\\ &\qquad\Longrightarrow \|\vct{w}-\vct{w}_n\|_2 \geq \hat\varepsilon\sqrt{\Sigma_{\min}}=:\tilde\varepsilon. \end{align*} In the last line above, we recalled that $\boldsymbol{\beta}=\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star$ and $\boldsymbol{\Sigma}_{i,i}\geq\Sigma_{\min},~i\in[p]$ by Assumption \ref{ass:inv}. From this and \eqref{eq:sc}, we find that wpa 1, $ \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\boldsymbol{\beta}}^2 \geq \phi({\vct{g}},\vct{h}) + \frac{\tilde\epsilon^2}{2C},~\text{for all}~ \vct{w}\in\mathcal{S}. $ Thus, \begin{align} \phi_S({\vct{g}},\vct{h}) \geq \phi({\vct{g}},\vct{h}) + \frac{\tilde\epsilon^2}{2\Sigma_{\max}}.\notag \end{align} When combined with \eqref{eq:phi_lim}, this shows that \begin{align} \phi_S({\vct{g}},\vct{h}) \geq \bar\phi + \frac{\tilde\epsilon^2}{2\Sigma_{\max}} - \eta. \end{align} Thus, choosing $\bar\phi_S = \bar\phi + \frac{\tilde\epsilon^2}{2\Sigma_{\max}}$ proves the Condition 3 above. To complete the proof, let us now show \eqref{eq:dev2show}. Henceforth, $C$ is used to denote a universal constant whose value can change from line to line. To simplify notation, let $\vct{a}_i=(\sqrt{p}\boldsymbol{\beta}_{n,i}({\vct{g}},\vct{h}),\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$ and $\vct{b}_i=(\sqrt{p}\boldsymbol{\beta}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$, for $i\in[p]$. Then, using $f\in\rm{PL}(k)$, \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})| &\leq \frac{L}{p}\sum_{i=1}^p (1+\max\{\|\vct{a}_i\|_2^{k-1},\|\vct{b}_i\|_2^{k-1}\})\|\vct{a}_i-\vct{b}_i\|_2\notag \\ &= \frac{L}{p}\sum_{i=1}^p \left(1+\max\{\|\vct{a}_i\|_2^{k-1},\|\vct{b}_i\|_2^{k-1}\}\right)\cdot|\sqrt{p}\boldsymbol{\beta}_{n,i}({\vct{g}},\vct{h}) - \sqrt{p}\boldsymbol{\beta}_i|\notag\\ &\leq L\left(1+\max\{\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2k-2},\frac{1}{p}\sum_{i=1}^p\|\vct{b}_i\|_2^{2k-2}\} \right)^{1/2}{\|\boldsymbol{\beta}_{n}({\vct{g}},\vct{h}) - \boldsymbol{\beta}\|_2}\label{eq:LipC}\,. \end{align} The last inequality above follows by applying Cauchy-Schwartz. To reach \eqref{eq:dev2show} from the above, it suffices to show that \begin{align} \max\{\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2k-2},\frac{1}{p}\sum_{i=1}^p\|\vct{b}_i\|_2^{2k-2}\} \leq C,\label{eq:leqC} \end{align} for some universal constant $C$ (that may depend on $k$, but not on $n,p$). To prove \eqref{eq:leqC}, note that using $a^{\ell_1}b^{\ell_2}c^{\ell_3}\leq a^{\ell}+b^{\ell}+c^\ell,~\ell=\ell_1+\ell_2+\ell_3$, for some constant $C=C(k)>0$ it holds: \begin{align} \frac{1}{p}\sum_{i=1}^p \|\vct{b}_i\|_2^{2k-2} {\leq} C\left(\frac{1}{p}\sum_{i=1}^p |\sqrt{p}\boldsymbol{\beta}_{i}|^{2k-2} + \frac{1}{p}\sum_{i=1}^p |\sqrt{p}\betab^\star_{i}|^{2k-2} + \frac{1}{p}\sum_{i=1}^p |\boldsymbol{\Sigma}_{i,i}|^{2k-2} \right)\label{eq:bdmom}\,. \end{align} \cts{The terms $\frac{1}{p}\sum_{i=1}^p |\sqrt{p}\betab^\star_{i}|^{2k-2} $ and $ \frac{1}{p}\sum_{i=1}^p |\boldsymbol{\Sigma}_{i,i}|^{2k-2}$ are bounded by Assumption (A2).}\ct{Need to add assumption that $ \frac{1}{p}\sum_{i=1}^p |\boldsymbol{\Sigma}_{i,i}|^{2k-2}<\infty$ and $\frac{1}{p}\sum_{i=1}^p (\sqrt{p}|\betab^\star_{i}|^{2k-2} $. OK by just assuming that $B$ is Definition \ref{def:Xi} is bounded.}. {\color{red}Furthermore we need to argue that , \begin{align} \frac{1}{p}\sum_{i=1}^p |\sqrt{p}\boldsymbol{\beta}_{i}|^{2k-2} <\infty \end{align} } These together with \eqref{eq:bdmom} show that $\frac{1}{p}\sum_{i=1}^p \|\vct{b}_i\|_2^{2k-2}<C$ wpa 1. Similarly, we can argue for $\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2k-2}$, completing the proof of \eqref{eq:leqC}. \vspace{5pt} \noindent\underline{Satisfying Condition 1:} To prove Condition 1, we simply pick $\eta$ to satisfy the following \begin{align} \bar\phi_S > \bar\phi + 3 \eta ~\Leftarrow~ \bar\phi + \frac{\tilde\epsilon^2}{2\Sigma_{\max}} - \eta \geq \bar\phi + 3 \eta ~\Leftarrow~ \eta \leq \frac{\tilde\epsilon^2}{8\Sigma_{\max}}. \end{align} This completes the proof of Theorem \ref{thm:master_W2}. \subsection{Proof of Lemma \ref{lem:AO}}\label{sec:proofAO} ~~~~ ~~~~ \vspace{3pt} \noindent\underline{Proof of (i):}~Strong convexity of the objective function in \eqref{eq:PO} is easily verified by the second derivative test. Note here that we use Assumption \ref{ass:inv} that $\bSi_{i,i}\leq\Sigma_{\max},~i\in[p].$ Uniqueness of the solution follows directly from strong convexity. \ct{Strictly speaking we might need to also argue existence, i.e., feasibility of the AO. An indirect way is to show feasibility using the CGMT, but it seems unnecessarily complicated?} \vspace{5pt} \noindent\underline{Proof of (ii):}~Using Lagrangian formulation, the solution $\vct{w}_n$ to \eqref{eq:AO_con} is the same as the solution to the following: \begin{align} \left(\vct{w}_n,u_n\right) :=\arg\min_{\vct{w}\in\mathcal{B}}\max_{u\geq 0} ~\frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2 + u \left( \sqrt{\tn{\vct{w}}^2+\sigma^2} \tn{\bar{\g}} - \sqrt{\kappa}\,{\bar{\h}}^T\vct{w} + \frac{\sigma h}{\sqrt{n}} \right)\label{eq:AO_2} \end{align} where we have: (i) set $\bar{\g} := {\vct{g}}/\sqrt{n}$ and $\bar{\h}:= \vct{h}/\sqrt{p}$; (ii) recalled that $p/n=\kappa$; and, (iii) used $\left(\vct{w}_n,u_n\right)$ to denote the optimal solutions in \eqref{eq:AO_2}. The subscript $n$ emphasizes the dependence of $\left(\vct{w}_n,u_n\right)$ on the problem dimensions. Also note that (even though not explicit in the notation) $\left(\vct{w}_n,u_n\right)$ are random variables depending on the realizations of $\bar{\g},\bar{\h}$ and $h$. Notice that the objective function above is convex in $\vct{w}$ and linear (thus, concave) in $u$. Thus, strong duality holds and we can flip the order of min-max. Moreover, in order to make the objective easy to optimize with respect to $\vct{w}$, we use the following variational expression for the square-root term $\sqrt{\tn{\vct{w}}^2+\sigma^2}$: $$ \tn{\bar{\g}}\sqrt{\tn{\vct{w}}^2+\sigma^2} = \tn{\bar{\g}}\cdot\min_{\tau\in[\sigma,\sqrt{\sigma^2+B_+^2}]} \left\{ \frac{\tau}{2} + \frac{\tn{\vct{w}}^2+\sigma^2}{2\tau} \right\} = \min_{\tau\in[\sigma,\sqrt{\sigma^2+B_+^2}]} \left\{ \frac{\tau\tn{\bar{\g}}^2}{2} + \frac{\sigma^2}{2\tau} + \frac{\tn{\vct{w}}^2}{2\tau} \right\}, $$ where $B$ is defined in Lemma \ref{lem:bd_PO}. For convenience define the constraint set for the variable $\tau$ as $\mathcal{T}':=[\sigma,\sqrt{\sigma^2+B_+^2}]$. For reasons to be made clear later in the proof (see proof of statement (iii)), we consider the (possibly larger) set: \[ \mathcal{T}:=[\sigma,\max\{\sqrt{\sigma^2+B_+^2},2\tau_*\}]\, \] where $\tau_*$ is as in the statement of the lemma. The above lead to the following equivalent formulation of \eqref{eq:AO_2}: \begin{align} \left(\vct{w}_n,u_n,\tau_n\right) = \max_{u\geq 0}\min_{\tau\in\mathcal{T}} ~ \frac{u\tau\tn{\bar{\g}}^2}{2} + \frac{u\sigma^2}{2\tau} + \frac{u\sigma h}{\sqrt{n}} + \min_{\vct{w}} \left\{ \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2 + \frac{u}{2\tau}\tn{\vct{w}}^2 - u \sqrt{\kappa}\,{\bar{\h}}^T\vct{w} \right\} .\label{eq:AO_3} \end{align} \ct{To be fully rigorous, need to show here that the unconstrained min over $\vct{w}$ is the same as the constrained $\vct{w}\in\mathcal{B}$.} The minimization over $\vct{w}$ is easy as it involves a strongly convex quadratic function. The optimal $\vct{w}':=\vct{w}'(\tau,u)$ (for fixed $(\tau,u)$) is given by \begin{align}\label{eq:w'} \vct{w}':=\vct{w}'(\tau,u) = -\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u\sqrt{\kappa}\bar{\h}\right), \end{align} and \eqref{eq:AO_3} simplifies to \begin{align} \left(u_n,\tau_n\right)=\max_{u\geq 0}\min_{\tau\in\mathcal{T}} ~ \frac{u\tau\tn{\bar{\g}}^2}{2} + \frac{u\sigma^2}{2\tau} + \frac{u\sigma h}{\sqrt{n}} - \frac{1}{2} \left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u\sqrt{\kappa}\bar{\h}\right)^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1} \left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u\sqrt{\kappa}\bar{\h}\right)\,=:\mathcal{R}(u,\tau) .\label{eq:AO_4} \end{align} It can be checked by direct differentiation and the second-derivative test that the objective function in \eqref{eq:AO_4} is strictly convex in $\tau$ and strictly concave in $u$ in the domain $\{(u,\tau)\in\mathbb{R}_+\times\mathbb{R}_+\}$. Thus, the saddle point $(u_n,\tau_n)$ is unique. Specifically, this implies that the optimal $\vct{w}_n$ in \eqref{eq:AO_3} is given by (cf. \eqref{eq:w'}) \begin{align}\label{eq:w_n} \vct{w}_n=\vct{w}'(\tau_n,u_n) = -\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}\left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u_n\sqrt{\kappa}\bar{\h}\right). \end{align} In what follows, we characterize the high-dimensional limit of the optimal pair $(u_n,\tau_n)$ in the limit $n,p\rightarrow\infty,~p/n\rightarrow\kappa$. We start by analyzing the (point-wise) convergence of $\mathcal{R}(u,\tau)$. For the first three summands in \eqref{eq:AO_4}, we easily find that $$ \left\{\frac{u\tau\tn{\bar{\g}}^2}{2} + \frac{u\sigma^2}{2\tau} + \frac{u\sigma h}{\sqrt{n}}\right\}~ \stackrel{{P}}{\longrightarrow}~\left\{ \frac{u\tau}{2} + \frac{u\sigma^2}{2\tau} \right\}. $$ Next, we study the fourth summand. First, note that \begin{align} (u\sqrt{\kappa}\bar{\h})^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}(u\sqrt{\kappa}\bar{\h}) &= u^2\kappa\,\frac{1}{p}\vct{h}^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\vct{h} \notag\\ &= u^2\kappa\,\frac{1}{p}\sum_{i=1}^{p}\frac{\vct{h}_i^2}{\bSi_{i,i}^{-1}+\frac{u}{\tau}} \notag\\ &\stackrel{{P}}{\longrightarrow} u^2\kappa\,\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right]. \end{align} In the last line, $\Lambda$ is a random variable as in Definition \ref{def:Xi}. \cts{Also, we used Assumption (A2) together with the facts that $\vct{h}$ is independent of $\boldsymbol{\Sigma}$ and that the function $(x_1,x_2)\mapsto f(x_1,x_2)=x_1^2(x_2^{-1}+u/\tau)^{-1}$ is $\rm{PL}(2)$ assuming $x_2$ is bounded.} \ct{Question: Is it immediate that the empirical distribution of $(\beta,\boldsymbol{\Sigma},\vct{h})$ converges in $W_k$ to $\mu\otimes\mathcal{N}(0,1)$ given that $(\beta,\boldsymbol{\Sigma})$ converges to $\mu$ and $\vct{h}$ is independent???} Second, we find that \begin{align} (\betab^\star)^T\boldsymbol{\Sigma}^{-1/2}\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\boldsymbol{\Sigma}^{-1/2}\betab^\star &= \frac{1}{p}(\sqrt{p}\betab^\star)^T\left({\mtx{I}}+\frac{u}{\tau}\boldsymbol{\Sigma}\right)^{-1}(\sqrt{p}\betab^\star) \notag\\ &= \frac{1}{p}\sum_{i=1}^{p}\frac{\left(\sqrt{p}\betab^\star_i/\sqrt{\bSi_{i,i}}\right)^2}{\bSi_{i,i}^{-1}+\frac{u}{\tau}}\notag\\ &\stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\Lambda^{-1}+\frac{u}{\tau}}\right]. \end{align} Here, $\Lambda,B$ are random variables as in Definition \ref{def:Xi} and \cts{we also used Assumption (A2) together with the fact that the function $(x_1,x_2)\mapsto f(x_1,x_2)=x_1^2x_2^{-1}(x_2^{-1}+u/\tau)^{-1}$ is $\rm{PL}(2)$ assuming $x_2$ is bounded.} Third, \cts{by independence of $(\betab^\star, \boldsymbol{\Sigma})$ from $\vct{h}$} \begin{align} (u\sqrt{\kappa}\bar{\h})^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\boldsymbol{\Sigma}^{-1/2}\betab^\star = u\sqrt{\kappa} \cdot \frac{1}{p}\sum_{i=1} ^p \frac{\vct{h}_i\boldsymbol{\Sigma}_{i,i}^{-1/2}(\sqrt{p}\betab^\star_i)}{\boldsymbol{\Sigma}_{i,i}^{-1}+\frac{u}{\tau}{\mtx{I}}} ~\stackrel{{P}}{\longrightarrow}~ 0. \end{align} Putting these together, the objective $\mathcal{R}(u,\tau)$ in \eqref{eq:AO_4} converges point-wise in $u,\tau$ to \begin{align} \mathcal{R}(u,\tau)\stackrel{{P}}{\longrightarrow}\mathcal{D}(u,\tau) := \frac{1}{2}\left({u\tau} + \frac{u\sigma^2}{\tau} - u^2\kappa\,\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] - \operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\Lambda^{-1}+\frac{u}{\tau}}\right] \right).\label{eq:conv_pt} \end{align} Note that $\mathcal{R}(u,\tau)$ (and thus, $\mathcal{D}(u,\tau)$) is convex in $\tau$ and concave in $u$. Thus, the convergence in \eqref{eq:conv_pt} is in fact uniform (e.g., \cite{AG1982}) and we can conclude that \begin{align}\label{eq:Dc0} \phi({\vct{g}},\vct{h}) \stackrel{{P}}{\longrightarrow} \max_{u\geq 0}\min_{\tau\in\mathcal{T}}~ \mathcal{D}(u,\tau). \end{align} and \begin{align}\label{eq:Dc} (u_n,\tau_n) \stackrel{{P}}{\longrightarrow} (u_*,\tau_*):=\arg\max_{u\geq 0}\min_{\tau\in\mathcal{T}}~ \mathcal{D}(u,\tau). \end{align} In the proof of statement (iii) below, we show that the saddle point of \eqref{eq:Dc0} is $(u_*,\tau_*)$. In particular, $\tau_*$ is strictly in the interior of $\mathcal{T}$, which combined with convexity implies that $$ \max_{u\geq 0}\min_{\tau\in\mathcal{T}}~ \mathcal{D}(u,\tau) = \max_{u\geq 0}\min_{\tau>0}~ \mathcal{D}(u,\tau) =: \bar\phi. $$ This, together with the first display above proves the second statement of the lemma. \vspace{5pt} \noindent\underline{Proof of (iii):} Next, we compute the saddle point $(u_*,\tau_*)$ by studying the first-order optimality conditions of the srtictly concave-convex $\mathcal{D}(u,\tau)$. Specifically, we consider unconstrained minimization over $\tau$ and we will show that the minimum is achieved in the strict interior of $\mathcal{T}$. Direct differentiation gives \begin{subequations} \begin{align} {\tau} + \frac{\sigma^2}{\tau} - 2u\kappa\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] + \frac{u^2}{\tau}\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1}+\frac{u}{\tau}\right)^2}\right] + \frac{1}{\tau}\operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1}+\frac{u}{\tau}\right)^2}\right] &= 0, \label{eq:fo1}\\ {u} - \frac{u\sigma^2}{\tau^2} - \frac{u^3}{\tau^2}\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1} + \frac{u}{\tau}\right)^2}\right] - \frac{u}{\tau^2} \operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1}+\frac{u}{\tau}\right)^2}\right] &= 0,\label{eq:fo2} \end{align} \end{subequations} Multiplying \eqref{eq:fo2} with $\frac{\tau}{u}$ and adding to \eqref{eq:fo1} results in the following equation \begin{align} \tau = u\kappa\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] ~\Leftrightarrow ~ \operatorname{\mathbb{E}}\left[ \frac{1}{(\frac{u}{\tau}\Lambda)^{-1}+1} \right] = \frac{1}{\kappa} \label{eq:tauu}\,. \end{align} Thus, we have found that the ratio $\frac{u_*}{\tau_*}$ is the unique solution to the equation in \eqref{eq:tauu}. Note that this coincides with the Equation \eqref{eq:ksi} that defines the parameter $\xi$ in Definition \ref{def:Xi}. The fact that \eqref{eq:tauu} has a unique solution for all $\kappa>1$ can be easily seen as $F(x)=\operatorname{\mathbb{E}}\left[ \frac{1}{(x\Lambda)^{-1}+1} \right], x\in\mathbb{R}_+$ has range $(0,1)$ and is strictly increasing (by differentiation). Thus, we call $\xi=\frac{u_*}{\tau_*}$. Moreover, multiplying \label{eq:fo2} with $u$ leads to the following equation for $\tau_*$: \begin{align} u_*^2 = \sigma^2\xi^2 + u_*^2 \xi^2 \kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1} +\xi\right)^2}\right] + \xi^2 \operatorname{\mathbb{E}}\left[ \frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1} + \xi\right)^2}\right] ~\Rightarrow~ \tau_*^2 = \frac{\sigma^2 + \operatorname{\mathbb{E}}\left[ \frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1} + \xi\right)^2}\right]}{1-\xi^2\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1} +\xi\right)^2}\right]} = \frac{\sigma^2 + \operatorname{\mathbb{E}}\left[ \frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1} + \xi\right)^2}\right]}{1-\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left((\xi\Lambda)^{-1} +1\right)^2}\right]}. \end{align} {Again, note that this coincides with Equation \eqref{eq:gamma} that determines the parameter $\gamma$ in Definition \ref{def:Xi}, i.e., $\tau_*^2 = \gamma.$ } \vspace{3pt}\noindent\underline{Proof of (iv):} For convenience, define $$F_n(\hat\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma}):=\frac{1}{p} \sum_{i=1}^{p} f\left(\sqrt{p}\hat\boldsymbol{\beta}_{n,i},\sqrt{p}\betab^\star_{i},\boldsymbol{\Sigma}_{ii}\right)\quad\text{and}\quad\alpha_*:=\operatorname{\mathbb{E}}_\mu\left[f(X_{\kappa,\sigma^2}(\Lambda,B,H),B,\Lambda)\right].$$ Recall from \eqref{eq:w_n} the explicit expression for $\vct{w}_n$, repeated here for convenience. \begin{align} \vct{w}_n = -\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}\left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u_n\sqrt{\kappa}\bar{\h}\right).\notag \end{align} Also, recall that $\boldsymbol{\beta}_n = \boldsymbol{\Sigma}^{-1/2}\vct{w}_n+\betab^\star$. Thus, (and using the fact that $\bar{\h}$ is distributed as $-\bar{\h}$), \begin{align} \boldsymbol{\beta}_n &=\boldsymbol{\Sigma}^{-1/2}\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}u_n\sqrt{\kappa}\bar{\h} + \left({\mtx{I}}-\boldsymbol{\Sigma}^{-1/2}\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}\boldsymbol{\Sigma}^{-1/2}\right)\betab^\star\notag\\ \Longrightarrow\boldsymbol{\beta}_{n,i}&=\frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_n\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_n\bar{\h}_i +\left(1-\frac{1}{1+\xi_n\boldsymbol{\Sigma}_{i,i}}\right)\betab^\star_i. \end{align} For $i\in[p]$, define \begin{align} \vct{v}_{n,i} = \frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_*\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_*\bar{\h}_i +\left(1-\frac{1}{1+\xi_*\boldsymbol{\Sigma}_{i,i}}\right)\betab^\star_i \end{align} In the above, for convenience, we have denoted $\xi_n:=u_n/\tau_n$ and recall that $\xi_*:=u_*/\tau_*$. The proof proceeds in two steps. In the first step, we use the fact that $\xi_n\stackrel{{P}}{\longrightarrow}\xi_*$ and $u_n\stackrel{{P}}{\longrightarrow} u_\star$ (see \eqref{eq:Dc}) to prove that for any $\varepsilon\in(0,\xi_*/2)$, there exists absolute constant $C>0$ such that wpa 1: \begin{align}\label{eq:ivstep1} |F_n(\sqrt{p}\boldsymbol{\beta}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) - F_n(\sqrt{p}\vct{v}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) | \leq C\varepsilon. \end{align} In the second step, we use Lipschitzness of $f$ and Assumption \ref{ass:mu} to prove that \begin{align} |F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| \stackrel{{P}}{\longrightarrow} \alpha_*.\label{eq:ivstep2} \end{align} The desired follows by combining \eqref{eq:ivstep1} and \eqref{eq:ivstep2}. Thus, in what follows, we prove \eqref{eq:ivstep1} and \eqref{eq:ivstep2}. \vspace{2pt} \noindent\emph{Proof of \eqref{eq:ivstep1}.}~~Fix some $\varepsilon\in(0,\xi_*/2)$. From \eqref{eq:Dc}, we know that w.p.a. 1 $|\xi_n-\xi_*|\leq \varepsilon$ and $|u_n-u_*|\leq \varepsilon$. Thus, $\vct{w}_n$ is close to $\vct{v}_n$. Specifically, in this event, for every $i\in[p]$, it holds that: \begin{align} \notag|\boldsymbol{\beta}_{n,i} - \vct{v}_{n,i}| &\leq {|\betab^\star_i|}\left|\frac{1}{1+\xi_n\bSi_{i,i}}-\frac{1}{1+\xi_*\bSi_{i,i}}\right| + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\boldsymbol{\Sigma}_{i,i}}}\left|\frac{\tau_n}{1+(\xi_n\bSi_{i,i})^{-1}}-\frac{\tau_*}{1+(\xi_*\bSi_{i,i})^{-1}}\right| \\ \notag&= {|\betab^\star_i|}\left|\frac{1}{1+\xi_n\bSi_{i,i}}-\frac{1}{1+\xi_*\bSi_{i,i}}\right| + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\boldsymbol{\Sigma}_{i,i}}}\left|\frac{u_n}{\xi_n+\bSi_{i,i}^{-1}}-\frac{u_*}{\xi_*+\bSi_{i,i}^{-1}}\right| \\ \notag& \leq {|\betab^\star_i|}\frac{|\bSi_{i,i}||\xi_n-\xi_*|}{|1+\xi_n\bSi_{i,i}||1+\xi_*\bSi_{i,i}|} + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\bSi_{i,i}}} \frac{u_*|\xi_n-\xi_*|}{(\xi_n+\bSi_{i,i}^{-1})(\xi_*+\bSi_{i,i}^{-1})} + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\bSi_{i,i}}}\frac{|u_n-u_*|}{\xi+\bSi_{i,i}^{-1}} \\ \notag& \leq {|\betab^\star_i|}{\Sigma_{\max}\varepsilon} + \sqrt{\kappa}{|\bar{\h}_i|} u_*\Sigma_{\max}^{3/2} \varepsilon+ \sqrt{\kappa}|\bar{\h}_i|\Sigma_{\max}^{1/2}\varepsilon \\ &\leq \varepsilon \cdot \max\left\{\Sigma_{\max}^{3/2},\Sigma_{\max}^{1/2}\right\}\, \left(|\bar{\h}_i| + |\betab^\star_i|\right).\label{eq:betav} \end{align}\som{$\varepsilon$ missing} In the second line above, we recalled that $u_n=\tau_n\xi_n$ and $u_*=\tau_*\xi_*$. In the third line, we used the triangle inequality. In the fourth line, we used that $\xi_*>0$, $0<\bSi_{i,i}\leq\Sigma_{\max}$ and $\xi_n\geq \xi_*-\varepsilon \geq \xi_*/2 >0$. Now, we will use this and Lipschitzness of $f$ to argue that there exists absolute constant $C>0$ such that wpa 1: \begin{align} |F_n(\sqrt{p}\boldsymbol{\beta}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) - F_n(\sqrt{p}\vct{v}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) | \leq C\varepsilon.\notag \end{align} Denote, $\vct{a}_i=(\sqrt{p}\boldsymbol{\beta}_{n,i},\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$ and $\vct{b}_i=(\sqrt{p}\vct{v}_{n,i},\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$. Following the exact same argument as in \eqref{eq:LipC}, we have \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| &\leq \frac{L}{p}\sum_{i=1}^p (1+\max\{\|\vct{a}_i\|_2^{k-1},\|\vct{b}_i\|_2^{k-1}\})\|\vct{a}_i-\vct{b}_i\|_2\notag \\ &\leq \frac{L}{p}\sum_{i=1}^p \left(1+\max\{\|\vct{a}_i\|_2^{k-1},\|\vct{b}_i\|_2^{k-1}\}\right)\cdot|\sqrt{p}\boldsymbol{\beta}_{n,i}({\vct{g}},\vct{h}) - \sqrt{p}\vct{v}_{n,i}|\notag\\ &\leq L\left(1+\max\{\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2k-2},\frac{1}{p}\sum_{i=1}^p\|\vct{b}_i\|_2^{2k-2}\} \right)^{1/2}{\|\boldsymbol{\beta}_{n}({\vct{g}},\vct{h}) - \vct{v}_n\|_2}\notag. \end{align} From this and \eqref{eq:betav}, we find \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| &\leq L(1+\max\{\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2k-2},\frac{1}{p}\sum_{i=1}^p\|\vct{b}_i\|_2^{2k-2}\} )^{1/2} \\ &\qquad\qquad\varepsilon\cdot\sqrt{2}\max\left\{\Sigma_{\max}^{3/2},\Sigma_{\max}^{1/2}\right\}\sqrt{\|\betab^\star\|_2^2 + \|\bar{\h}\|_2^2}.\label{eq:epsS} \end{align} As in \eqref{eq:bdmom}, it can be shown that wpa 1: $\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2k-2}<\infty$ and $\frac{1}{p}\sum_{i=1}^p \|\vct{b}_i\|_2^{2k-2}<\infty$, as $p\rightarrow\infty$. Similarly, $\|\betab^\star\|_2^2 = \frac{1}{p}\sum_{i=1}^p(\sqrt{p}\betab^\star_i)^2<\infty$, as $p\rightarrow \infty$ by Assumption (A2). Finally, $\|\bar{\h}\|_2^2\leq 2$, wpa 1 as $p\rightarrow\infty$. Therefore, from \eqref{eq:epsS}, wpa 1, there exists constant $C>0$ such that \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| \leq C \cdot\varepsilon, \end{align} as desired. \vspace{2pt} \noindent\emph{Proof of \eqref{eq:ivstep2}.}~~Next, we will use Assumption \ref{ass:mu} to show that \begin{align} |F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| \stackrel{{P}}{\longrightarrow} \alpha_*.\label{eq:AO_conv} \end{align} Notice that $\vct{v}_n$ is a function of $\betab^\star,\boldsymbol{\Sigma},\bar{\h}$. Concretely, define $g:\mathbb{R}^3\rightarrow\mathbb{R}$, such that $$ g(x_1,x_2,x_3) := \frac{x_2^{-1/2}}{1+(\xi x_2)^{-1}}\sqrt{\kappa}\tau_* x_3 + (1-(1+\xi_*x_2)^{-1})x_1, $$ and notice that $$ \sqrt{p}\vct{v}_{n,i} = g\left(\sqrt{p}\betab^\star_i,\bSi_{i,i},\vct{h}_i\right) = \frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_*\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_*\vct{h}_i +\left(1-\frac{1}{1+\xi_*\boldsymbol{\Sigma}_{i,i}}\right)\sqrt{p}\betab^\star_i. $$ Thus, $$ F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma}) = \frac{1}{p}\sum_{i=1}^p f\left(g\left(\sqrt{p}\betab^\star_i,\bSi_{i,i},\vct{h}_i\right),\sqrt{p}\betab^\star_i,\bSi_{i,i}\right) =: \frac{1}{p}\sum_{i=1}^p h\left(\vct{h}_i,\sqrt{p}\betab^\star_i,\bSi_{i,i}\right), $$ where we have defined $h:\mathbb{R}^3\rightarrow\mathbb{R}$: \begin{align} h(x_1,x_2,x_3) := f\left(g(x_2,x_3,x_1),x_2,x_3\right).\label{h func} \end{align} It will suffice to prove that $h\in\rm{PL}(k+1)$. Indeed, if that were the case, then Assumption (A2) gives \begin{align} \frac{1}{p}\sum_{i=1}^p h\left(\vct{h}_i,\sqrt{p}\betab^\star_i,\bSi_{i,i}\right) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{\mathcal{N}(0,1)\otimes \mu}\left[h(H,B,\Lambda)\right] &= \operatorname{\mathbb{E}}_{\mathcal{N}(0,1)\otimes \mu}\left[f\left(g(B,\Lambda,H),B,\Lambda\right))\right]\\ & = \operatorname{\mathbb{E}}[f\left(X_{\kappa,\sigma^2}(\Lambda,B,H),B,\Lambda\right)] = \alpha_*, \end{align} where the penultimate equality follows by recognizing that (cf. Eqn. \eqref{eq:X}) $$ g(B,\Lambda,H) = (1-(1+\xi_*\Lambda)^{-1})B + \sqrt{\kappa}\frac{\tau_*\Lambda^{-1/2}}{1+(\xi_*\Lambda)^{-1}}H = X_{\kappa,\sigma^2}(\Lambda,B,H). $$ We prove that $h\in\rm{PL}(k)$ in Lemma \ref{lem:hPL} in Section \ref{SM useful fact}. \begin{lemma} The function $h$ in \eqref{h func} is $\rm{PL}(k)$ as long as $f$ is $\rm{PL}(k)$. {\color{red}The function $h$ is $\mathbb{R}^3\rightarrow\mathbb{R}$, not $\mathbb{R}^{3p}\rightarrow\mathbb{R}$! See Lemma 6 below.} \end{lemma} \begin{proof} Since $f$ is $\rm{PL}(k)$, for some $L>0$, \eqref{PL func} holds. Fix $\vct{a}=[\vct{x},\vct{y},{\vct{z}}]\in\mathbb{R}^{3p},\vct{a}'=[\vct{x}',\vct{y}',{\vct{z}}']\in\mathbb{R}^{3p}$. Let $\vct{b}=[{\vct{g}},\vct{y},{\vct{z}}]$ where ${\vct{g}}=g(\vct{y},{\vct{z}},\vct{x})$. We have that \begin{align} |h(\vct{a})-h(\vct{a}')|&\leq |f(\vct{b})-f(\vct{b}')|\\ &\leq L\left(1+\|\vct{b}\|_2^{k-1}+\|\vct{b}'\|_2^{k-1}\right)\|\vct{b}-\vct{b}'\|_2\\ &\lesssim L\left(1+\|\vct{a}\|_2^{k-1}+\|\vct{a}'\|_2^{k-1}+\|{\vct{g}}\|_2^{k-1}+\|{\vct{g}}'\|_2^{k-1}\right)(\|\vct{a}-\vct{a}'\|_2+\|{\vct{g}}-{\vct{g}}'\|_2). \end{align} Next, we need to bound the ${\vct{g}}$ term in terms of $\vct{a}$. This is accomplished as follows \begin{align} \|{\vct{g}}\|_2^{k-1}&\lesssim \frac{1}{p}\sum_{i=1}^p|g_i|^{k-1}\\ &\lesssim \frac{1}{p}\sum_{i=1}^p\left|\frac{y_i^{-1/2}}{1+(\xi y_i)^{-1}}\sqrt{\kappa}\tau_* z_i + (1-(1+\xi_*y_i)^{-1})x_i\right|\\ &\lesssim \frac{1}{p}\sum_{i=1}^p(|z_i|+|x_i|)^{k-1}\lesssim \|\vct{x}\|_2^{k-1}+\|{\vct{z}}\|_2^{k-1}\\ &\lesssim \|\vct{a}\|^{k-1}. \end{align} Secondly and similarly, we have the following perturbation bound on the ${\vct{g}}-{\vct{g}}'$. \so{Suppose the triples $(x_i,y_i,z_i)$ takes values in a fixed bounded compact set $\mathcal{M}$. We will prove the following sequence of inequalities} \begin{align} \tn{{\vct{g}}-{\vct{g}}'}^2&\leq \sum_{i=1}^p|g(x_i,y_i,z_i)-g(x'_i,y'_i,z'_i)|^2\\ &\leq C^2_{\mathcal{M}} \sum_{i=1}^p(|x_i-x'_i|^2+|y_i-y'_i|^2+|z_i-z'_i|^2)\label{sec line eq}\\ &\leq C^2_{\mathcal{M}} (\tn{\vct{x}-\vct{x}'}^2+\tn{\vct{y}-\vct{y}'}^2+\tn{{\vct{z}}-{\vct{z}}'}^2)\\ &\lesssim \tn{\vct{a}-\vct{a}'}^2. \end{align} In what follows, we prove the second line \eqref{sec line eq} i.e.~the fact that for any triples $a=(x,y,z),a'=(x',y',z')$ (with $a,a'\in\mathbb{R}^3$), we have that \[ |g(a)-g(a')|\leq C_{\mathcal{M}}\tn{a-a'}. \] Set $C_\nabla=\sup_{a\in \mathcal{M}}\tn{\nabla g(a)}$. By definition of gradient, the inequality above holds with $C_\mathcal{M}=C_\nabla$. Thus, all that remains is proving that $C_\nabla$ is upper bounded by a constant. \so{However, this automatically holds because from the definition of $g(\dots)$ function, it is clear that $C_\nabla$ is defined everywhere and continuous thus it has a finite maximum over a compact set.}\cts{Only the problem is that $z_i$ (i.e., $\vct{h}_i$) is $\mathcal{N}(0,1)$ so it is not bounded.} \end{proof} But from Assumption \ref{ass:mu} and $f\in\rm{PL(2)}$ it follows immediately that with probability approaching 1, \begin{align} |\frac{1}{p}\sum_{i=1}^{p}f(\sqrt{p}\vct{v}_{n,i})-\operatorname{\mathbb{E}}_\mu\left[X_{\kappa,\sigma^2}(\Lambda,N,H) \right]| \leq \varepsilon. \end{align} Combining the above displays and using triangle inequality completes the proof of the statement. \subsection{Asymptotic formulas on Magnitude- and Hessian- pruning} Here, we use Theorem \ref{thm:master_W2} to characterize the risk of the magnitude- and Hessian- pruned solutions. This section supplements the discussion in Section \ref{sec:risk}. First, we formally state the result of Section \ref{sec:risk} as Corollary \ref{cor:mag} characterizing magnitude pruning. Next, we further discuss Hessian pruning. \subsubsection{Magnitude-based pruning.} We begin with the following necessary definitions. Define the hard-thresholding function with fixed threshold $t\in\mathbb{R}_+$ as follows: \begin{align}\label{eq:threshold_app} \mathcal{T}_t(x) = \begin{cases} x & \text{if } |x|>t \\ 0 & \text{otherwise} \end{cases}. \end{align} Further define threshold $t^\star$ as follows: \begin{align}\label{eq:tstar_app} t^\star:=\inf\left\{t\in\mathbb{R}\,:\, \Pr(|X_{\kappa,\sigma^2}|\geq t) \geq \alpha \right\}. \end{align} \begin{corollary}[Risk of Magnitude-pruning]\label{cor:mag} Let the same assumptions and notation as in the statement of Theorem \ref{thm:master_W2} hold. Specifically, let $\hat\boldsymbol{\beta}$ be the min-norm solution in \eqref{eq:min_norm} and $\hat\beta_s^M:=\mathbb{T}_s({\boldsymbol{\beta}})$ the magnitude-pruned model at sparsity $s$. Recall the notations in \eqref{eq:threshold_app} and \eqref{eq:tstar_app}. The risk of the magnitude-pruned model satisfies the following in the limit of $n,p,s\rightarrow\infty$ at rates $\kappa:=p/n>1$ and $\alpha:=s/p\in(0,1)$ (cf. Assumption \ref{ass:linear}): \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}}^M_s) \stackrel{{P}}{\longrightarrow} \sigma^2 + \operatorname{\mathbb{E}}\left[ \Lambda\left(B-\mathcal{T}_{t^\star}(X_{\kappa,\sigma^2})\right) \right],\notag \end{align} where the expectation is over $(\Lambda,B,H)\sim\mu\otimes\mathcal{N}(0,1).$ \end{corollary} The proof of the corollary above, is given in Section \ref{sec:risk}. Below, we extend the results to Hessian-based pruning. \subsubsection{Hessian-based pruning.} Let $\hat\beta$ be the min-norm solution in \eqref{eq:min_norm}. Recall that the Hessian-pruned model $\boldsymbol{\beta}_s^H$ at sparsity $s$ is given by \begin{align}\label{eq:hp} \boldsymbol{\beta}_s^H = \hat\boldsymbol{\Sigma}^{-1/2}\mathbb{T}_s(\hat\boldsymbol{\Sigma}^{1/2}\boldsymbol{\beta}), \end{align} where $\hat\boldsymbol{\Sigma}=\diag{{\mtx{X}}^T{\mtx{X}}}/n$ the diagonal of the empirical covariance matrix. \begin{corollary}[Risk of Hessian-pruning]\label{cor:hes} Let the same assumptions and notation as in the statement of Theorem \ref{thm:master_W2} hold. Specifically, let $\hat\boldsymbol{\beta}$ be the min-norm solution in \eqref{eq:min_norm} and $\hat\beta_s^H$ the Hessian-pruned model at sparsity $s$. Recall the notation in \eqref{eq:threshold_app} and define \begin{align}\label{eq:tdiam_app} t^\diamond:=\inf\left\{t\in\mathbb{R}\,:\, \Pr(|\Lambda^{1/2}X_{\kappa,\sigma^2}|\geq t) \geq \alpha \right\}. \end{align} The risk of the magnitude-pruned model satisfies the following in the limit of $n,p,s\rightarrow\infty$ at rates $\kappa:=p/n>1$ and $\alpha:=s/p\in(0,1)$ (cf. Assumption \ref{ass:linear}): \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}}^H_s) \stackrel{{P}}{\longrightarrow} \sigma^2 + \operatorname{\mathbb{E}}\left[ \Lambda\left(B-\Lambda^{-1/2}\mathcal{T}_{t^\diamond}(\Lambda^{1/2}X_{\kappa,\sigma^2})\right) \right],\notag \end{align} where the expectation is over $(\Lambda,B,H)\sim\mu\otimes\mathcal{N}(0,1).$ \end{corollary} \begin{proof} \end{proof} \section{Facts about Lipschitz functions}\label{SM useful fact} For $k\geq 1$ we say a function $f:\mathbb{R}^m\rightarrow\mathbb{R}$ is pseudo-Lipschitz of order $k$ and denote it by $f\in \rm{PL}(k)$ if there exists a cosntant $L>0$ such that, for all $\vct{x},\vct{y}\in\mathbb{R}^m$: \begin{align} |f(\vct{x})-f(\vct{y})|\leq L\left(1+\|\vct{x}\|_2^{k-1}+\|\vct{y}\|_2^{k-1}\right)\|\vct{x}-\vct{y}\|_2.\label{PL func} \end{align} In particular, when $f\in\rm{PL}(k)$, the following properties hold: \begin{enumerate} \item There exists a constant $L'$ such that for all $\vct{x}\in\mathbb{R}^n$: $|f(\vct{x})|\leq L'(1+\|\vct{x}\|_2^k).$ \item $f$ is locally Lipschitz, that is for any $M>0$, there exists a constant $L_{M,m}<\infty$ such that for all $x,y\in[-M,M]^m$, $ |f(\vct{x})-f(\vct{y})| \leq L_{M,m}\|\vct{x}-\vct{y}\|_2. $ Further, $L_{M,m}\leq c(1+(M\sqrt{m})^{k-1})$ for some costant $c$. \end{enumerate} \begin{lemma} Let $g:\mathbb{R}\rightarrow\mathbb{R}$ be a Lipschitz function. Consider the function $f:\mathbb{R}^3\rightarrow\mathbb{R}$ defined as follows: $$ f(\vct{x}) = x_1(x_2-g(x_3))^2. $$ Then, $f\in\rm{PL}(3).$ \end{lemma} \begin{proof} Let $h:\mathbb{R}^2\rightarrow\mathbb{R}$ defined as $h({\vct{u}})=({\vct{u}}_1-g({\vct{u}}_2))^2$. The function $({\vct{u}}_1,{\vct{u}}_2)\mapsto{\vct{u}}_1-g({\vct{u}}_2)$ is clearly Lipschitz. Thus, $h\in\rm{PL}(2)$, i.e., \begin{align} |h({\vct{u}})-h(\vct{v})| \leq C(1+\|{\vct{u}}\|_2+\|\vct{v}\|_2)\|{\vct{u}}-\vct{v}\|_2\quad\text{and}\quad |h(\vct{v})|\leq C'(1+\|\vct{v}\|_2^2).\label{eq:h_pl} \end{align} Therefore, letting $\vct{x}=(x_1,{\vct{u}})\in\mathbb{R}^3$ and $\vct{y}=(y_1,\vct{v})\in\mathbb{R}^3$, we have that \begin{align} |f(\vct{x})-f(\vct{y})| &= |x_1h({\vct{u}}) - y_1h(\vct{v})| \leq |x_1||h({\vct{u}})-h(\vct{v})| + |h(\vct{v})| |x_1-y_1|\notag\\ &\leq C|x_1|(1+\|{\vct{u}}\|_2+\|\vct{v}\|_2)\|{\vct{u}}-\vct{v}\|_2 + C'(1+\|\vct{v}\|_2^2)|x_1-y_1| \notag\\ &\leq C(|x_1|^2+(1+\|{\vct{u}}\|_2+\|\vct{v}\|_2)^2)\|{\vct{u}}-\vct{v}\|_2 + C'(1+\|\vct{v}\|_2^2)|x_1-y_1| \notag\\ &\leq C(1+\|\vct{x}\|_2^2+\|\vct{y}\|_2^2)\|{\vct{u}}-\vct{v}\|_2 + C'(1+\|\vct{x}\|_2^2+\|\vct{y}\|_2^2)|x_1-y_1| \notag\\ &\leq C(1+\|\vct{x}\|_2^2+\|\vct{y}\|_2^2)\|\vct{x}-\vct{y}\|_2. \end{align} In the second line, we used \eqref{eq:h_pl}. In the third line, we used $2xy\leq x^2+y^2$. In the fourth line, we used Cauchy-Schwarz inequality. $C,C'>0$ are absolute constants that may change from line to line. This completes the proof of the lemma. \end{proof} \begin{lemma}\label{lem:hPL} Let functions $f,g:\mathbb{R}^3\rightarrow\mathbb{R}$ such that $f\in\rm{PL}(k)$ and $$ g(x_1,x_2,x_3) := \frac{x_2^{-1/2}}{1+(\xi_* x_2)^{-1}}\sqrt{\kappa}\tau_* x_3 + (1-(1+\xi_*x_2)^{-1})x_1. $$ Here, $\xi_*,\tau_*,\kappa$ are positive constants. Further define \begin{align} h(x,y,z) := f\left(g(y,z,x),y,z\right), \end{align} and assume that $y$ take values on a fixed bounded compact set $\mathcal{M}$. Then, it holds that $h\in\rm{PL}(k+1)$. \end{lemma} \begin{proof} Since $f$ is $\rm{PL}(k)$, for some $L>0$, \eqref{PL func} holds. Fix $x,x'\in\mathbb{R}$, $\vct{a}=[y,z]\in\mathbb{R}^{2}$ and $\vct{a}'=[y',z']\in\mathbb{R}^{2}$. Let $\vct{b}=[{\vct{g}},\vct{a}]=[{\vct{g}},y,z]\in\mathbb{R}^3$ where ${\vct{g}}=g(y,z,x)\in\mathbb{R}$ and define accordingly $\vct{b}'$ and ${\vct{g}}'$. We have that \begin{align} |h([x,\vct{a}])-h([x,\vct{a}'])|&= |f(\vct{b})-f(\vct{b}')|\notag\\ &\leq L\left(1+\|\vct{b}\|_2^{k-1}+\|\vct{b}'\|_2^{k-1}\right)\|\vct{b}-\vct{b}'\|_2\notag\\ &\leq C\left(1+\|\vct{a}\|_2^{k-1}+\|\vct{a}'\|_2^{k-1}+|{\vct{g}}|^{k-1}+|{\vct{g}}'|^{k-1}\right)(\|\vct{a}-\vct{a}'\|_2+|{\vct{g}}-{\vct{g}}'|),\label{eq:hlip} \end{align} for some constant $C>0$. In the last inequality we have repeatedly used the inequality $ \left(\sum_{i=1}^m \|\vct{v}_i\|_2^2\right)^{\frac{d}{2}} \leq C(m)\cdot\sum_{i=1}^m\|\vct{v}_i\|_2^{d}. $ Next, we need to bound the ${\vct{g}}$ term in terms of $\vct{a}$. This is accomplished as follows \begin{align} |{\vct{g}}|^{k-1} &= \left|\frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x + (1-(1+\xi_*y)^{-1})z\right|^{k-1}\notag\\ &\leq C (|z|+|x|)^{k-1} \notag\\ &\leq C \left(|x|^{k-1}+|z|^{k-1}\right) \leq C (|x|^{k-1} + \|\vct{a}\|_2^{k-1}).\label{eq:gb} \end{align} Here, the value of the constant $C>0$ may change from line to line. Secondly and similarly, we have the following perturbation bound on the ${\vct{g}}-{\vct{g}}'$. Recall that $(x,y)$ and $(x',y')$ are bounded. We will prove the following sequence of inequalities \begin{align} |{{\vct{g}}-{\vct{g}}'}|&= |g(y,z,x)-g(y',z',x')| \notag\\ &\leq \left|\frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x - \frac{(y')^{-1/2}}{1+(\xi y')^{-1}}\sqrt{\kappa}\tau_* x'\right| + \left|(1-(1+\xi_*y)^{-1})z-(1-(1+\xi_*y')^{-1})z'\right|\notag\\ &\leq \left|\frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x - \frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x'\right| +\left|\frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x'- \frac{(y')^{-1/2}}{1+(\xi y')^{-1}}\sqrt{\kappa}\tau_* x'\right|\notag\\ &\qquad+ \left|(1-(1+\xi_*y)^{-1})z-(1-(1+\xi_*y)^{-1})z'\right| + \left|(1-(1+\xi_*y)^{-1})z'-(1-(1+\xi_*y')^{-1})z'\right| \notag\\ &\leq C_1|x-x'| + C_2|x'||y-y'| + C_3|z-z'| + C_4|z'||y-y'|\notag\\ &\leq C(1+|x'| + |z'|)(|x-x'| + |z-z'| + |y-y'|)\\ &\leq C\sqrt{3}(1+|x'| + |z'|)\|[\vct{a},x]-[\vct{a}',x']\|_2 .\label{eq:gd} \end{align} In the fourth inequality above, we used the fact the assumption that $|y|$ is bounded. In the last line, we used Cauchy-Scwhartz. Substituting \eqref{eq:gb} and \eqref{eq:gd} in \eqref{eq:hlip} gives: \begin{align} |h(x,y,z) - h(x',y',z')| &\leq C\left(1+\|\vct{a}\|_2^{k-1}+\|\vct{a}'\|_2^{k-1}+|x|^{k-1}+|x'|^{k-1}\right)(1+|x'| + |z'|)\|[\vct{a},x]-[\vct{a}',x']\|_2\notag \\ &\leq C\left(1+\|[\vct{a},x]\|_2^{k}+\|[\vct{a}',x']\|_2^{k}\right)\|[\vct{a},x]-[\vct{a}',x']\|_2. \end{align} Thus, $h\in\rm{PL}(k+1)$, as desired. \end{proof} \section{Proofs for overparameterized least-squares}\label{sec proof thm 1} In this section, we assume the linear Gaussian problem (LGP) of Definition \ref{def LGP}, the overparameterized regime $k=p>n$ and the min-norm model $\hat\boldsymbol{\beta}$ of \eqref{eq:min_norm}. We prove Theorem \ref{thm:master_W2} that derives the asymptotic DC of $\hat\boldsymbol{\beta}$ and we show how this leads to sharp formulae for the risk of the Magnitude- and Hessian-pruned models. \subsection{Notation and Assumptions}\label{sec:ass_app} For the reader's convenience, we recall some necessary notation and assumptions from Section \ref{sec main}. We say that a function $f:\mathbb{R}^m\rightarrow\mathbb{R}$ is pseudo-Lipschitz of order $k$, denoted $f\in\rm{PL}(k)$, if there is a constant $L>0$ such that for all $\vct{x},\vct{y}\in\mathbb{R}^m$, $ |f(\vct{x}) - f(\vct{y})|\leq L(1+\tn{\vct{x}}^{k-1}+\tn{\vct{y}}^{k-1})\|\vct{x}-\vct{y}\|_2 $ (See also Section \ref{SM useful fact}). We say that a sequence of probability distributions $\nu_p$ on $\mathbb{R}^m$ {converges in $W_k$} to $\nu$, written $\nu_p\stackrel{W_k}{\Longrightarrow} \nu$, if $W_k(\nu_p,\nu) \rightarrow 0$ as $p \rightarrow \infty$. An equivalent definition is that, for any $f\in\rm{PL}(k)$, $\lim_{p\rightarrow\infty}\operatorname{\mathbb{E}} f(X_p)=\operatorname{\mathbb{E}} f(X)$, where expectation is with respect to $X_p\sim\nu_p$ and $X\sim\nu$ (e.g., \cite{montanari2017estimation}). Finally, recall that a sequence of probability distributions $\nu_n$ on $\mathbb{R}^m$ \emph{converges weakly} to $\nu$, if for any bounded Lipschitz function $f$: $\lim_{p\rightarrow\infty}\operatorname{\mathbb{E}} f(X_p)=\operatorname{\mathbb{E}} f(X)$, where expectation is with respect to $X_p\sim\nu_p$ and $X\sim\nu$. Throughout, we use $C,C',c,c'$ to denote absolute constants (not depending on $n,p$) whose value might change from line to line. We focus on a double asymptotic regime where: $$n,p,s\rightarrow\infty \text{ at fixed overparameterization ratio } \kappa:=p/n>0 \text{ and sparsity level } \alpha:=s/p\in(0,1).$$ For a sequence of random variables $\mathcal{X}_{p}$ that converge in probability to some constant $c$ in the limit of Assumption \ref{ass:linear} below, we write $\mathcal{X}_{p}\stackrel{{P}}{\longrightarrow} c$. For a sequence of event $\mathcal{E}_p$ for which $\lim_{p\rightarrow}\mathbb{P}(\mathcal{E}_p) = 1$, we say that $\mathcal{E}_p$ occurs \emph{with probability approaching 1}. For this, we will often use the shorthand ``wpa. 1". Next, we recall the set of assumption under which our analysis applies: \textbf{(A1)[Diagonal covariance].}~~The covariance matrix $\boldsymbol{\Sigma}$ is diagonal. \textbf{(A2)[Boundedness and empirical distribution].}~~There exist constants $\Sigma_{\min},\Sigma_{\max}\in(0,\infty)$ such that: $ \Sigma_{\min}\leq{\boldsymbol{{\Sigma}}}_{i,i}\leq \Sigma_{\max}. $ for all $i\in[p].$ \cts{Furthermore, the joint empirical distribution of $\{(\bSi_{i,i},\sqrt{p}\betab^\star_i)\}_{i\in[p]}$ converges weakly to a probability distribution $\mu$ on $\mathbb{R}_{>0}\times\mathbb{R}$ with bounded $(2k-2)$-th moment, and assume that $$ \frac{1}{p}\sum_{i\in[p]}\sum_{i=1}^p(\sqrt{p}\betab^\star_i)^{2k-2} \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{(\Lambda,B)\sim\mu}\left[ B^{2k-2}\right]<\infty, $$ as $p\rightarrow\infty$ for some $k\geq 3$.} We remark that Assumption (A2) above implies (see \cite[Lem.~5]{bayati2011dynamics}) that for any pseudo-Lipschitz function $\psi:\mathbb{R}^2\rightarrow\mathbb{R}$ of order $2k-2$: $$ \frac{1}{p}\sum_{i=1}^p\psi(\bSi_{i,i},\sqrt{p}\betab^\star_i) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{(\Lambda,B)\sim\mu}\left[ \psi(\Lambda,B)\right]. $$ \subsection{Proof of Asymptotic DC} In this section, we prove the following main result (which is a restatement of Theorem \ref{thm:master_W2}. \begin{theorem}[Asymptotic DC for LGP]\label{thm:master_W2} Fix $\kappa>1$. Let Assumptions (A1) and (A2) in Section \ref{sec:ass_app} hold for some $k\geq 3$. Consider $\hat{{\boldsymbol{\beta}}}$ as in \eqref{eq:min_norm} and $\hat\Pi_n(\vct{y},{\mtx{X}},\betab^\star,\boldsymbol{\Sigma}):=\frac{1}{p}\sum_{i=1}^{p}\delta_{\sqrt{p}\hat{{\boldsymbol{\beta}}}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i}}$, the joint empirical distribution of $(\sqrt{p}\hat\boldsymbol{\beta},\sqrt{p}\betab^\star,\boldsymbol{\Sigma})$. Recall the definition of the measure $\Pi_{\kappa,\sigma^2}$ in Definition \ref{def:Xi}. Then, $\hat\Pi_n(\vct{y},{\mtx{X}},\betab^\star,\boldsymbol{\Sigma})$ converges in Wasserstein-k distance to $\Pi_{\kappa,\sigma^2}\otimes\mu$. Specifically, for any function $f:\mathbb{R}^k\rightarrow\mathbb{R}$, $f\in\rm{PL}(k)$, it holds that \begin{align}\label{eq:thm} \frac{1}{p} \sum_{i=1}^{p} f(\sqrt{p}\hat\boldsymbol{\beta}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i}) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{(\Lambda,B,H)\sim\mu\otimes\mathcal{N}(0,1)}\left[f(X_{\kappa,\sigma^2},B,\Lambda) \right]. \end{align} \end{theorem} \vspace{5pt} Let ${\mtx{X}}\in\mathbb{R}^{n\times p}$ have zero-mean and normally distributed rows with a diagonal covariance matrix ${\boldsymbol{{\Sigma}}}=\operatorname{\mathbb{E}}[\vct{x}\x^T]$. Given a ground-truth vector $\betab^\star$ and labels $\vct{y}={\mtx{X}}\betab^\star+\sigma {\vct{z}},~{\vct{z}}\sim\mathcal{N}(0,{\mtx{I}}_n)$, we consider the least-squares problem subject to the minimum Euclidian norm constraint (as $\kappa=p/n>1$) given by \begin{align}\label{eq:PO_beta} \min_{{\boldsymbol{\beta}}}\frac{1}{2}\tn{{\boldsymbol{\beta}}}^2\quad\text{subject to}\quad \vct{y}={\mtx{X}}{\boldsymbol{\beta}}. \end{align} It is more convenient to work with the following change of variable: $\vct{w}:=\sqrt{\boldsymbol{\Sigma}}({\boldsymbol{\beta}}-\betab^\star)$. With this, the optimization problem in \eqref{eq:min_norm} can be rewritten as \begin{align}\label{eq:PO} \Phi({\mtx{X}})=\min_{\vct{w}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad {\mtx{\bar{X}}}\vct{w}=\sigma {\vct{z}}, \end{align} where we write ${\mtx{\bar{X}}}={\mtx{X}}\boldsymbol{\Sigma}^{-1/2}\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,1)$. First, using standard arguments, we show that the solution of \eqref{eq:PO} is bounded. Hence, we can constraint the optimization in a sufficiently large compact set without loss of generality. \begin{lemma}[Boundedness of solution]\label{lem:bd_PO} Let $\hat\vct{w}_n:=\hat\vct{w}_n({\mtx{X}},{\vct{z}})$ be the minimizer in \eqref{eq:PO}. Then, with probability approaching 1, it holds that $\hat\vct{w}_n\in\mathcal{B}$, where $$\mathcal{B}:=\left\{\vct{w}\,|\,\|\vct{w}\|_2\leq B_{+} \right\},\qquad B_+:=4\sqrt{\Sigma_{\max}}\frac{2(\sqrt{\kappa}+1)\sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}\left[B^2\right]} + \sigma}{\sqrt{\Sigma_{\min}}(\sqrt{\kappa}-1)} + \sqrt{\Sigma_{\max}}\sqrt{\operatorname{\mathbb{E}}\left[B^2\right]}. $$ \end{lemma} \begin{proof} First, we show that the min-norm solution $\hat\boldsymbol{\beta}={\mtx{X}}^T({\mtx{X}}\X^T)^{-1}\vct{y}$ of \eqref{eq:PO_beta} is bounded. Here, we used the fact that $\kappa>1$, thus ${\mtx{X}}\X^T$ is invertible wpa 1. We have, \begin{align} \tn{\hat\boldsymbol{\beta}_n}^2 = \vct{y}^T({\mtx{X}}\X^T)^{-1}\vct{y} \leq \frac{\tn{\vct{y}}^2}{\lambda_{\min}({\mtx{X}}\X^T)} = \frac{\tn{\vct{y}}^2}{\lambda_{\min}({\mtx{\bar{X}}}\boldsymbol{\Sigma}{\mtx{\bar{X}}}^T)} \leq \frac{\tn{\vct{y}}^2}{\lambda_{\min}({\mtx{\bar{X}}}\Xb^T)\,\Sigma_{\min}} = \frac{\tn{\vct{y}}^2}{\sigma_{\min}^2({\mtx{\bar{X}}})\,\Sigma_{\min}}. \label{eq:Ubb} \end{align} But, wpa 1, $ \sigma_{\min}({\mtx{\bar{X}}})/\sqrt{n} \geq \frac{1}{2}\left(\sqrt{\kappa}-1\right). $ Furthermore, $ \|\vct{y}\|_2 \leq \|{\mtx{\bar{X}}}\boldsymbol{\Sigma}^{1/2}\betab^\star\|_2 + \sigma\|{\vct{z}}\|_2 \leq \sigma_{\max}({\mtx{\bar{X}}})\sqrt{\Sigma_{\max}} \|\betab^\star\|_2 + \sigma\|{\vct{z}}\|_2. $ Hence, wpa 1, $$ \|\vct{y}\|_2/\sqrt{n} \leq 4(\sqrt{\kappa}+1)\sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}\left[B^2\right]} + 2\sigma, $$ where we used the facts that wpa 1: $\|z\|_2/\sqrt{n}\stackrel{{P}}{\longrightarrow} 1$, $\sigma_{\max}({\mtx{\bar{X}}})<2(\sqrt{\kappa}+1)$ and by Assumption \ref{ass:mu}: $$ \|\betab^\star\|_2^2 = \frac{1}{p}\sum_{i=1}^{p}(\sqrt{p}\betab^\star_i)^2 \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}\left[B^2\right]. $$ Put together in \eqref{eq:Ubb}, shows that \begin{align} \tn{\hat\boldsymbol{\beta}_n} < \frac{4(\sqrt{\kappa}+1)\sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}\left[B^2\right]} + 2\sigma}{\sqrt{\Sigma_{\min}}(\sqrt{\kappa}-1)/2} =: \tilde{B}_+.\label{eq:bd_beta} \end{align} Recalling that $\hat\vct{w}_n= \sqrt{\boldsymbol{\Sigma}}\boldsymbol{\beta} - \sqrt{\boldsymbol{\Sigma}}\betab^\star$, we conclude, as desired, that wpa 1, $ \tn{\hat\vct{w}_n} \leq \sqrt{\Sigma_{\max}}\tilde{B}_+ + \sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}[B^2]} =: B_+. $ \end{proof} \input{kth_bounded} Lemma \ref{lem:bd_PO} implies that nothing changes in \eqref{eq:PO} if we further constrain $\vct{w}\in\mathcal{B}$ in \eqref{eq:PO}. Henceforth, with some abuse of notation, we let \begin{align}\label{eq:PO_bd} \Phi({\mtx{X}}):=\min_{\vct{w}\in\mathcal{B}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad {\mtx{\bar{X}}}\vct{w}=\sigma {\vct{z}}, \end{align} Next, in order to analyze the primary optimization (PO) problem in \eqref{eq:PO_bd} in apply the CGMT \cite{thrampoulidis2015lasso}. Specifically, we use the constrained formulation of the CGMT, Theorem \ref{thm closed}. Specifically, the auxiliary problem (AO) corresponding to \eqref{eq:PO_bd} takes the following form with ${\vct{g}}\sim\mathcal{N}(0,{\mtx{I}}_n)$, $\vct{h}\sim\mathcal{N}(0,{\mtx{I}}_p)$, $h\sim \mathcal{N}(0,1)$ \begin{align} \phi({\vct{g}},\vct{h}) = \min_{\vct{w}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad \tn{{\vct{g}}}\tn{\vct{w}~{\sigma}}\leq \vct{h}^T\vct{w}+\sigma h.\label{eq:AO_con} \end{align We will prove the following result about the AO problem. \begin{lemma}[Properties of the AO -- Overparameterized regime]\label{lem:AO} Let $\phi_n=\phi({\vct{g}},\vct{h})$ be the optimal cost of the minimization in \eqref{eq:AO_con}. Define $\bar\phi$ as the optimal cost of the following deterministic min-max problem \begin{align}\label{eq:AO_det} \bar\phi:=\max_{u\geq 0}\min_{\tau>0}~ \mathcal{D}(u,\tau):=\frac{1}{2}\left({u\tau} + \frac{u\sigma^2}{\tau} - u^2\kappa\,\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] - \operatorname{\mathbb{E}}\left[\frac{N^2}{\Lambda^{-1}+\frac{u}{\tau}}\right] \right). \end{align} The following statements are true. \noindent{(i).}~The AO minimization in \eqref{eq:AO_con} is $\frac{1}{\Sigma_{\max}}$-strongly convex and has a unique minimizer $\vct{w}_n:=\vct{w}_n({\vct{g}},\vct{h})$. \noindent{(ii).}~In the limit of $n,p\rightarrow\infty, p/n=\kappa$, it holds that $\phi({\vct{g}},\vct{h})\stackrel{{P}}{\longrightarrow}\bar\phi$, i.e., for any $\varepsilon>0$: $$ \lim_{n\rightarrow\infty}\P\left(|\phi({\vct{g}},\vct{h})-\bar\phi|>\varepsilon\right) = 0. $$ \noindent{(iii).} The max-min optimization in \eqref{eq:AO_det} has a unique saddle point $(u_*,\tau*)$ satisfying the following: $$ u_*/\tau_* = \xi\quad\text{and}\quad\tau_* = \gamma, $$ where $\xi, \gamma$ are defined in Definition \ref{def:Xi}. \noindent{(iv).}~Let $f:\mathbb{R}^3\rightarrow\mathbb{R}$ be a $\rm{PL}({k})$ function. Let $\boldsymbol{\beta}_n=\boldsymbol{\Sigma}^{-1/2}\vct{w}_n + \betab^\star$. Then, $$ \frac{1}{p}\sum_{i=1}^{p}f\left(\sqrt{p}\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\sqrt{p}\betab^\star,\boldsymbol{\Sigma}\right) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{(B,\Lambda,H)\sim\mu\otimes \mathcal{N}(0,1)}\left[f\left(X_{\kappa,\sigma^2}(B,\Lambda,H),B,\Lambda\right) \right]. $$ \noindent{(v).}~\cts{The empirical distribution of $\boldsymbol{\beta}_n$ converges weakly to the measure of $X_{\kappa,\sigma^2}$, and also, \begin{align}\label{eq:k_AO} \frac{1}{p}\sum_{i=1}^{p}|\sqrt{p}\boldsymbol{\beta}_n({\vct{g}},\vct{h})|^{2k-2} < \infty. \end{align} } \end{lemma} We prove Lemma \ref{lem:AO} in Section \ref{sec:proofAO}. Here, we show how this leads to the proof of Theorem \ref{thm:master_W2} when combined with the CGMT. For convenience, define $$F_n(\hat\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma}):=\frac{1}{p} \sum_{i=1}^{p} f\left(\sqrt{p}\hat\boldsymbol{\beta}_{n,i},\sqrt{p}\betab^\star_{i},\boldsymbol{\Sigma}_{ii}\right)\quad\text{and}\quad\alpha_*:=\operatorname{\mathbb{E}}_\mu\left[f(X_{\kappa,\sigma^2}(\Lambda,B,H),B,\Lambda)\right].$$ Fix any $\varepsilon>0$. It suffices to prove that the solution $\hat\boldsymbol{\beta}_n$ of the PO in \eqref{eq:PO_beta} satisfies $\hat\boldsymbol{\beta}_n\not\in\mathcal{S}$ wpa. 1, where \begin{align}\label{eq:S_set} \mathcal{S} = \mathcal{S}(\betab^\star,\boldsymbol{\Sigma}) =\{\boldsymbol{\beta}{~\big |~} |F_n(\hat\boldsymbol{\beta}_n,\betab^\star,\boldsymbol{\Sigma})-\alpha_*|\geq 2\varepsilon\}. \end{align} In particular, define the ``perturbed" PO and AO problems (compare to \eqref{eq:PO} and \eqref{eq:AO_con}) as: \begin{align}\label{eq:PO_S} \Phi_S({\mtx{X}})=\min_{\vct{w}\in\mathcal{S}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad {\mtx{\bar{X}}}\vct{w}=\sigma {\vct{z}}, \end{align} and \begin{align} \phi_S({\vct{g}},\vct{h})=\min_{\vct{w}\in\mathcal{S}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad \tn{{\vct{g}}}\tn{\vct{w}~{\sigma}}\leq \vct{h}^T\vct{w}+\sigma h.\label{eq:AO_S} \end{align where recall that ${\mtx{\bar{X}}}={\mtx{X}}\boldsymbol{\Sigma}^{-1/2}\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,1)$, ${\vct{g}}\sim\mathcal{N}(0,{\mtx{I}}_n)$, $\vct{h}\sim\mathcal{N}(0,{\mtx{I}}_p)$, $h\sim \mathcal{N}(0,1)$ and we have used the change of variables $\vct{w}:=\sqrt{\boldsymbol{\Sigma}}(\boldsymbol{\beta}-\betab^\star)$ for convenience. Using \cite[Theorem 6.1(iii)]{thrampoulidis2018precise} it suffices to find costants $\bar\phi, \bar\phi_S$ and $\eta>0$ such that the following hold: \begin{enumerate} \item $\bar\phi_S \geq \bar\phi + 3\eta$, \item $\phi({\vct{g}},\vct{h}) \leq \bar\phi + \eta$, with probability approaching 1, \item $\phi_S({\vct{g}},\vct{h}) \geq \bar\phi_S - \eta$, with probability approaching 1. \end{enumerate} In what follows, we explicitly find $\bar\phi, \bar\phi_S,\eta$ such that the three conditions above hold. \vspace{5pt} \noindent\underline{Satisfying Condition 2}: Recall the deterministic min-max optimization in \eqref{eq:AO_det}. Choose $\bar\phi=\mathcal{D}(u_*,\tau_*)$ be the optimal cost of this optimization. From Lemma \ref{lem:AO}(ii), $\phi({\vct{g}},\vct{h})\stackrel{{P}}{\longrightarrow}\bar\phi$. Thus, for any $\eta>0$, with probability approaching 1: \begin{align}\label{eq:phi_lim} \bar\phi + \eta \geq \phi({\vct{g}},\vct{h}) \geq \bar\phi - \eta. \end{align} Clearly then, Condition 2 above holds for any $\eta>0$. \vspace{5pt} \noindent\underline{Satisfying Condition 3}: Next, we will show that the third condition holds for appropriate $\bar\phi$. Let $\vct{w}_n=\vct{w}_n({\vct{g}},\vct{h})$ be the unique minimizer of \eqref{eq:AO_con} as per Lemma \ref{lem:AO}(i), i.e., $\frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}_n+\boldsymbol{\beta}}^2 = \phi({\vct{g}},\vct{h})$. Again from Lemma \ref{lem:AO}, the minimization in \eqref{eq:AO_con} is $1/\Sigma_{\max}$-strongly convex in $\vct{w}$. Here, $\Sigma_{\max}$ is the upper bound on the eigenvalues of $\boldsymbol{\Sigma}$ as per Assumption \ref{ass:inv}. Thus, for any $\tilde\varepsilon>0$ and any feasible $\vct{w}$ the following holds (deterministically): \begin{align}\label{eq:sc} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\boldsymbol{\beta}}^2 \geq \phi({\vct{g}},\vct{h}) + \frac{\tilde\epsilon^2}{2C},~\text{provided that}~ \|\vct{w}-\vct{w}_n({\vct{g}},\vct{h})\|_2 \geq \tilde\epsilon. \end{align} Now, we argue that $\boldsymbol{\beta}\in\mathcal{S}$ implies that $\|\vct{w}-\vct{w}_n({\vct{g}},\vct{h})\|_2\geq \tilde\varepsilon$ wpa 1, for appropriate value of $\tilde\varepsilon$ and $\vct{w}=\sqrt{\boldsymbol{\Sigma}}(\boldsymbol{\beta}-\betab^\star)$. Consider any $\boldsymbol{\beta}\in\mathcal{S}$. First, by definition in \eqref{eq:S_set}, $$ |F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})-\alpha_*| \geq 2\varepsilon. $$ Second, by Lemma \ref{lem:AO}(iv), with probability approaching 1, $$ |F(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - \alpha_*| \leq \epsilon. $$ Third, we will show that wpa 1, there exists universal constant $C>0$ such that \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})| \leq C {\|\boldsymbol{\beta}_{n}({\vct{g}},\vct{h}) - \boldsymbol{\beta}\|_2}\label{eq:dev2show}. \end{align} Before proving \eqref{eq:dev2show}, let us argue how combining the above three displays shows the desired. Indeed, wpa. 1, \begin{align*} 2\varepsilon &\leq |F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})-\alpha_*| \leq |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})| + |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - \alpha_*| \\ &\leq \epsilon + C \,\|\boldsymbol{\beta}-\boldsymbol{\beta}_n\|_2. \\ &\qquad\Longrightarrow \|\boldsymbol{\beta}-\boldsymbol{\beta}_n\|_2 \geq {\varepsilon}/{C}=:\hat\varepsilon\\ &\qquad\Longrightarrow \|\vct{w}-\vct{w}_n\|_2 \geq \hat\varepsilon\sqrt{\Sigma_{\min}}=:\tilde\varepsilon. \end{align*} In the last line above, we recalled that $\boldsymbol{\beta}=\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star$ and $\boldsymbol{\Sigma}_{i,i}\geq\Sigma_{\min},~i\in[p]$ by Assumption \ref{ass:inv}. From this and \eqref{eq:sc}, we find that wpa 1, $ \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\boldsymbol{\beta}}^2 \geq \phi({\vct{g}},\vct{h}) + \frac{\tilde\epsilon^2}{2C},~\text{for all}~ \vct{w}\in\mathcal{S}. $ Thus, \begin{align} \phi_S({\vct{g}},\vct{h}) \geq \phi({\vct{g}},\vct{h}) + \frac{\tilde\epsilon^2}{2\Sigma_{\max}}.\notag \end{align} When combined with \eqref{eq:phi_lim}, this shows that \begin{align} \phi_S({\vct{g}},\vct{h}) \geq \bar\phi + \frac{\tilde\epsilon^2}{2\Sigma_{\max}} - \eta. \end{align} Thus, choosing $\bar\phi_S = \bar\phi + \frac{\tilde\epsilon^2}{2\Sigma_{\max}}$ proves the Condition 3 above. To complete the proof, let us now show \eqref{eq:dev2show}. Henceforth, $C$ is used to denote a universal constant whose value can change from line to line. To simplify notation, let $\vct{a}_i=(\sqrt{p}\boldsymbol{\beta}_{n,i}({\vct{g}},\vct{h}),\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$ and $\vct{b}_i=(\sqrt{p}\boldsymbol{\beta}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$, for $i\in[p]$. Then, using $f\in\rm{PL}(k)$, \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})| &\leq \frac{L}{p}\sum_{i=1}^p (1+\max\{\|\vct{a}_i\|_2^{k-1},\|\vct{b}_i\|_2^{k-1}\})\|\vct{a}_i-\vct{b}_i\|_2\notag \\ &= \frac{L}{p}\sum_{i=1}^p \left(1+\max\{\|\vct{a}_i\|_2^{k-1},\|\vct{b}_i\|_2^{k-1}\}\right)\cdot|\sqrt{p}\boldsymbol{\beta}_{n,i}({\vct{g}},\vct{h}) - \sqrt{p}\boldsymbol{\beta}_i|\notag\\ &\leq L\left(1+\max\{\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2k-2},\frac{1}{p}\sum_{i=1}^p\|\vct{b}_i\|_2^{2k-2}\} \right)^{1/2}{\|\boldsymbol{\beta}_{n}({\vct{g}},\vct{h}) - \boldsymbol{\beta}\|_2}\label{eq:LipC}\,. \end{align} The last inequality above follows by applying Cauchy-Schwartz. To reach \eqref{eq:dev2show} from the above, it suffices to show that \begin{align} \max\{\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2k-2},\frac{1}{p}\sum_{i=1}^p\|\vct{b}_i\|_2^{2k-2}\} \leq C,\label{eq:leqC} \end{align} for some universal constant $C$ (that may depend on $k$, but not on $n,p$). To prove \eqref{eq:leqC}, note that using $a^{\ell_1}b^{\ell_2}c^{\ell_3}\leq a^{\ell}+b^{\ell}+c^\ell,~\ell=\ell_1+\ell_2+\ell_3$, for some constant $C=C(k)>0$ it holds: \begin{align} \frac{1}{p}\sum_{i=1}^p \|\vct{b}_i\|_2^{2k-2} {\leq} C\left(\frac{1}{p}\sum_{i=1}^p |\sqrt{p}\boldsymbol{\beta}_{i}|^{2k-2} + \frac{1}{p}\sum_{i=1}^p |\sqrt{p}\betab^\star_{i}|^{2k-2} + \frac{1}{p}\sum_{i=1}^p |\boldsymbol{\Sigma}_{i,i}|^{2k-2} \right)\label{eq:bdmom}\,. \end{align} \cts{The terms $\frac{1}{p}\sum_{i=1}^p |\sqrt{p}\betab^\star_{i}|^{2k-2} $ and $ \frac{1}{p}\sum_{i=1}^p |\boldsymbol{\Sigma}_{i,i}|^{2k-2}$ are bounded by Assumption (A2).} {\color{red}Furthermore we additionally know from Lemma \ref{subexp bth} that, \begin{align} \frac{1}{p}\sum_{i=1}^p |\sqrt{p}\boldsymbol{\beta}_{i}|^{2k-2} <\infty \end{align} } These together with \eqref{eq:bdmom} show that $\frac{1}{p}\sum_{i=1}^p \|\vct{b}_i\|_2^{2k-2}<C$ wpa 1. Similarly, we can argue for $\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2k-2}$, completing the proof of \eqref{eq:leqC}. \cts{\textbf{Remark}:Note that for the specific $f(x,y,z) = z(y-g(x))^2$ that we care about for evaluating the risk (see Lemma 5) we can write \eqref{eq:LipC} simpler as follows: \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma})| &= \frac{1}{p}\sum_{i=1}^p|\bSi_{i,i}|\left| (\sqrt{p}\betab^\star_i-g(\sqrt{p}\boldsymbol{\beta}_{n,i}))^2-(\sqrt{p}\betab^\star_i-g(\sqrt{p}\boldsymbol{\beta}_{i}))^2 \right|\notag\\ &\leq \Sigma_{\max} \frac{1}{p}\sum_{i=1}^p \left| (\sqrt{p}\betab^\star_i-g(\sqrt{p}\boldsymbol{\beta}_{n,i}))^2-(\sqrt{p}\betab^\star_i-g(\sqrt{p}\boldsymbol{\beta}_{i}))^2 \right|\notag\\ &\leq \Sigma_{\max} L \frac{1}{p}\sum_{i=1}^p (1+ \|\sqrt{p}[\betab^\star_i,\boldsymbol{\beta}_{n,i}]\|_2 + \|\sqrt{p}[\betab^\star_i,\boldsymbol{\beta}_{i}]\|_2) \sqrt{p}|\boldsymbol{\beta}_{n,i}-\boldsymbol{\beta}_{i}|\notag\\ &\leq \Sigma_{\max} L \left(1+ \frac{1}{p}\sum_{i=1}^{p}\|\sqrt{p}[\betab^\star_i,\boldsymbol{\beta}_{n,i}]\|_2^2 + \frac{1}{p}\sum_{i=1}^p\|\sqrt{p}[\betab^\star_i,\boldsymbol{\beta}_{i}]\|_2^2\right) \|\boldsymbol{\beta}_{n}-\boldsymbol{\beta}\|_2\notag\\ &\leq C \left(1+ \|\betab^\star\|_2^2+ \|\boldsymbol{\beta}_{n}\|_2^2 + \|\boldsymbol{\beta}\|_2^2\right) \|\boldsymbol{\beta}_{n}-\boldsymbol{\beta}\|_2. \end{align} And everything is easy now since $\|\betab^\star\|_2^2$ is bounded as long as second moments of empirical distribution as bounded, $\|\boldsymbol{\beta}_n\|_2^2$ is bounded if $\|\betab^\star\|_2^2$ is bounded, and, $\|\boldsymbol{\beta}\|_2^2$ is bounded, since $\boldsymbol{\beta}\in\mathcal{B}$ by Lemma 1. } \vspace{5pt} \noindent\underline{Satisfying Condition 1:} To prove Condition 1, we simply pick $\eta$ to satisfy the following \begin{align} \bar\phi_S > \bar\phi + 3 \eta ~\Leftarrow~ \bar\phi + \frac{\tilde\epsilon^2}{2\Sigma_{\max}} - \eta \geq \bar\phi + 3 \eta ~\Leftarrow~ \eta \leq \frac{\tilde\epsilon^2}{8\Sigma_{\max}}. \end{align} This completes the proof of Theorem \ref{thm:master_W2}. \subsection{Proof of Lemma \ref{lem:AO}}\label{sec:proofAO} ~~~~ ~~~~ \vspace{3pt} \noindent\underline{Proof of (i):}~Strong convexity of the objective function in \eqref{eq:PO} is easily verified by the second derivative test. Note here that we use Assumption \ref{ass:inv} that $\bSi_{i,i}\leq\Sigma_{\max},~i\in[p].$ Uniqueness of the solution follows directly from strong convexity. \ct{Strictly speaking we might need to also argue existence, i.e., feasibility of the AO. An indirect way is to show feasibility using the CGMT, but it seems unnecessarily complicated?} \vspace{5pt} \noindent\underline{Proof of (ii):}~Using Lagrangian formulation, the solution $\vct{w}_n$ to \eqref{eq:AO_con} is the same as the solution to the following: \begin{align} \left(\vct{w}_n,u_n\right) :=\arg\min_{\vct{w}\in\mathcal{B}}\max_{u\geq 0} ~\frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2 + u \left( \sqrt{\tn{\vct{w}}^2+\sigma^2} \tn{\bar{\g}} - \sqrt{\kappa}\,{\bar{\h}}^T\vct{w} + \frac{\sigma h}{\sqrt{n}} \right)\label{eq:AO_2} \end{align} where we have: (i) set $\bar{\g} := {\vct{g}}/\sqrt{n}$ and $\bar{\h}:= \vct{h}/\sqrt{p}$; (ii) recalled that $p/n=\kappa$; and, (iii) used $\left(\vct{w}_n,u_n\right)$ to denote the optimal solutions in \eqref{eq:AO_2}. The subscript $n$ emphasizes the dependence of $\left(\vct{w}_n,u_n\right)$ on the problem dimensions. Also note that (even though not explicit in the notation) $\left(\vct{w}_n,u_n\right)$ are random variables depending on the realizations of $\bar{\g},\bar{\h}$ and $h$. Notice that the objective function above is convex in $\vct{w}$ and linear (thus, concave) in $u$. Thus, strong duality holds and we can flip the order of min-max. Moreover, in order to make the objective easy to optimize with respect to $\vct{w}$, we use the following variational expression for the square-root term $\sqrt{\tn{\vct{w}}^2+\sigma^2}$: $$ \tn{\bar{\g}}\sqrt{\tn{\vct{w}}^2+\sigma^2} = \tn{\bar{\g}}\cdot\min_{\tau\in[\sigma,\sqrt{\sigma^2+B_+^2}]} \left\{ \frac{\tau}{2} + \frac{\tn{\vct{w}}^2+\sigma^2}{2\tau} \right\} = \min_{\tau\in[\sigma,\sqrt{\sigma^2+B_+^2}]} \left\{ \frac{\tau\tn{\bar{\g}}^2}{2} + \frac{\sigma^2}{2\tau} + \frac{\tn{\vct{w}}^2}{2\tau} \right\}, $$ where $B$ is defined in Lemma \ref{lem:bd_PO}. For convenience define the constraint set for the variable $\tau$ as $\mathcal{T}':=[\sigma,\sqrt{\sigma^2+B_+^2}]$. For reasons to be made clear later in the proof (see proof of statement (iii)), we consider the (possibly larger) set: \[ \mathcal{T}:=[\sigma,\max\{\sqrt{\sigma^2+B_+^2},2\tau_*\}]\, \] where $\tau_*$ is as in the statement of the lemma. The above lead to the following equivalent formulation of \eqref{eq:AO_2}: \begin{align} \left(\vct{w}_n,u_n,\tau_n\right) = \max_{u\geq 0}\min_{\tau\in\mathcal{T}} ~ \frac{u\tau\tn{\bar{\g}}^2}{2} + \frac{u\sigma^2}{2\tau} + \frac{u\sigma h}{\sqrt{n}} + \min_{\vct{w}} \left\{ \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2 + \frac{u}{2\tau}\tn{\vct{w}}^2 - u \sqrt{\kappa}\,{\bar{\h}}^T\vct{w} \right\} .\label{eq:AO_3} \end{align} \ct{To be fully rigorous, need to show here that the unconstrained min over $\vct{w}$ is the same as the constrained $\vct{w}\in\mathcal{B}$.} The minimization over $\vct{w}$ is easy as it involves a strongly convex quadratic function. The optimal $\vct{w}':=\vct{w}'(\tau,u)$ (for fixed $(\tau,u)$) is given by \begin{align}\label{eq:w'} \vct{w}':=\vct{w}'(\tau,u) = -\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u\sqrt{\kappa}\bar{\h}\right), \end{align} and \eqref{eq:AO_3} simplifies to \begin{align} \left(u_n,\tau_n\right)=\max_{u\geq 0}\min_{\tau\in\mathcal{T}} ~ \frac{u\tau\tn{\bar{\g}}^2}{2} + \frac{u\sigma^2}{2\tau} + \frac{u\sigma h}{\sqrt{n}} - \frac{1}{2} \left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u\sqrt{\kappa}\bar{\h}\right)^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1} \left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u\sqrt{\kappa}\bar{\h}\right)\,=:\mathcal{R}(u,\tau) .\label{eq:AO_4} \end{align} It can be checked by direct differentiation and the second-derivative test that the objective function in \eqref{eq:AO_4} is strictly convex in $\tau$ and strictly concave in $u$ in the domain $\{(u,\tau)\in\mathbb{R}_+\times\mathbb{R}_+\}$. Thus, the saddle point $(u_n,\tau_n)$ is unique. Specifically, this implies that the optimal $\vct{w}_n$ in \eqref{eq:AO_3} is given by (cf. \eqref{eq:w'}) \begin{align}\label{eq:w_n} \vct{w}_n=\vct{w}'(\tau_n,u_n) = -\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}\left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u_n\sqrt{\kappa}\bar{\h}\right). \end{align} In what follows, we characterize the high-dimensional limit of the optimal pair $(u_n,\tau_n)$ in the limit $n,p\rightarrow\infty,~p/n\rightarrow\kappa$. We start by analyzing the (point-wise) convergence of $\mathcal{R}(u,\tau)$. For the first three summands in \eqref{eq:AO_4}, we easily find that $$ \left\{\frac{u\tau\tn{\bar{\g}}^2}{2} + \frac{u\sigma^2}{2\tau} + \frac{u\sigma h}{\sqrt{n}}\right\}~ \stackrel{{P}}{\longrightarrow}~\left\{ \frac{u\tau}{2} + \frac{u\sigma^2}{2\tau} \right\}. $$ Next, we study the fourth summand. First, note that \begin{align} (u\sqrt{\kappa}\bar{\h})^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}(u\sqrt{\kappa}\bar{\h}) &= u^2\kappa\,\frac{1}{p}\vct{h}^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\vct{h} \notag\\ &= u^2\kappa\,\frac{1}{p}\sum_{i=1}^{p}\frac{\vct{h}_i^2}{\bSi_{i,i}^{-1}+\frac{u}{\tau}} \notag\\ &\stackrel{{P}}{\longrightarrow} u^2\kappa\,\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right]. \end{align} In the last line, $\Lambda$ is a random variable as in Definition \ref{def:Xi}. \cts{Also, we used Assumption (A2) together with the facts that $\vct{h}$ is independent of $\boldsymbol{\Sigma}$ and that the function $(x_1,x_2)\mapsto f(x_1,x_2)=x_1^2(x_2^{-1}+u/\tau)^{-1}$ is $\rm{PL}(2)$ assuming $x_2$ is bounded.} \ct{Question: Is it immediate that the empirical distribution of $(\beta,\boldsymbol{\Sigma},\vct{h})$ converges in $W_k$ to $\mu\otimes\mathcal{N}(0,1)$ given that $(\beta,\boldsymbol{\Sigma})$ converges to $\mu$ and $\vct{h}$ is independent???} Second, we find that \begin{align} (\betab^\star)^T\boldsymbol{\Sigma}^{-1/2}\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\boldsymbol{\Sigma}^{-1/2}\betab^\star &= \frac{1}{p}(\sqrt{p}\betab^\star)^T\left({\mtx{I}}+\frac{u}{\tau}\boldsymbol{\Sigma}\right)^{-1}(\sqrt{p}\betab^\star) \notag\\ &= \frac{1}{p}\sum_{i=1}^{p}\frac{\left(\sqrt{p}\betab^\star_i/\sqrt{\bSi_{i,i}}\right)^2}{\bSi_{i,i}^{-1}+\frac{u}{\tau}}\notag\\ &\stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\Lambda^{-1}+\frac{u}{\tau}}\right]. \end{align} Here, $\Lambda,B$ are random variables as in Definition \ref{def:Xi} and \cts{we also used Assumption (A2) together with the fact that the function $(x_1,x_2)\mapsto f(x_1,x_2)=x_1^2x_2^{-1}(x_2^{-1}+u/\tau)^{-1}$ is $\rm{PL}(2)$ assuming $x_2$ is bounded.} Third, \cts{by independence of $(\betab^\star, \boldsymbol{\Sigma})$ from $\vct{h}$} \begin{align} (u\sqrt{\kappa}\bar{\h})^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\boldsymbol{\Sigma}^{-1/2}\betab^\star = u\sqrt{\kappa} \cdot \frac{1}{p}\sum_{i=1} ^p \frac{\vct{h}_i\boldsymbol{\Sigma}_{i,i}^{-1/2}(\sqrt{p}\betab^\star_i)}{\boldsymbol{\Sigma}_{i,i}^{-1}+\frac{u}{\tau}{\mtx{I}}} ~\stackrel{{P}}{\longrightarrow}~ 0. \end{align} Putting these together, the objective $\mathcal{R}(u,\tau)$ in \eqref{eq:AO_4} converges point-wise in $u,\tau$ to \begin{align} \mathcal{R}(u,\tau)\stackrel{{P}}{\longrightarrow}\mathcal{D}(u,\tau) := \frac{1}{2}\left({u\tau} + \frac{u\sigma^2}{\tau} - u^2\kappa\,\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] - \operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\Lambda^{-1}+\frac{u}{\tau}}\right] \right).\label{eq:conv_pt} \end{align} Note that $\mathcal{R}(u,\tau)$ (and thus, $\mathcal{D}(u,\tau)$) is convex in $\tau$ and concave in $u$. Thus, the convergence in \eqref{eq:conv_pt} is in fact uniform (e.g., \cite{AG1982}) and we can conclude that \begin{align}\label{eq:Dc0} \phi({\vct{g}},\vct{h}) \stackrel{{P}}{\longrightarrow} \max_{u\geq 0}\min_{\tau\in\mathcal{T}}~ \mathcal{D}(u,\tau). \end{align} and \begin{align}\label{eq:Dc} (u_n,\tau_n) \stackrel{{P}}{\longrightarrow} (u_*,\tau_*):=\arg\max_{u\geq 0}\min_{\tau\in\mathcal{T}}~ \mathcal{D}(u,\tau). \end{align} In the proof of statement (iii) below, we show that the saddle point of \eqref{eq:Dc0} is $(u_*,\tau_*)$. In particular, $\tau_*$ is strictly in the interior of $\mathcal{T}$, which combined with convexity implies that $$ \max_{u\geq 0}\min_{\tau\in\mathcal{T}}~ \mathcal{D}(u,\tau) = \max_{u\geq 0}\min_{\tau>0}~ \mathcal{D}(u,\tau) =: \bar\phi. $$ This, together with the first display above proves the second statement of the lemma. \vspace{5pt} \noindent\underline{Proof of (iii):} Next, we compute the saddle point $(u_*,\tau_*)$ by studying the first-order optimality conditions of the srtictly concave-convex $\mathcal{D}(u,\tau)$. Specifically, we consider unconstrained minimization over $\tau$ and we will show that the minimum is achieved in the strict interior of $\mathcal{T}$. Direct differentiation gives \begin{subequations} \begin{align} {\tau} + \frac{\sigma^2}{\tau} - 2u\kappa\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] + \frac{u^2}{\tau}\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1}+\frac{u}{\tau}\right)^2}\right] + \frac{1}{\tau}\operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1}+\frac{u}{\tau}\right)^2}\right] &= 0, \label{eq:fo1}\\ {u} - \frac{u\sigma^2}{\tau^2} - \frac{u^3}{\tau^2}\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1} + \frac{u}{\tau}\right)^2}\right] - \frac{u}{\tau^2} \operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1}+\frac{u}{\tau}\right)^2}\right] &= 0,\label{eq:fo2} \end{align} \end{subequations} Multiplying \eqref{eq:fo2} with $\frac{\tau}{u}$ and adding to \eqref{eq:fo1} results in the following equation \begin{align} \tau = u\kappa\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] ~\Leftrightarrow ~ \operatorname{\mathbb{E}}\left[ \frac{1}{(\frac{u}{\tau}\Lambda)^{-1}+1} \right] = \frac{1}{\kappa} \label{eq:tauu}\,. \end{align} Thus, we have found that the ratio $\frac{u_*}{\tau_*}$ is the unique solution to the equation in \eqref{eq:tauu}. Note that this coincides with the Equation \eqref{eq:ksi} that defines the parameter $\xi$ in Definition \ref{def:Xi}. The fact that \eqref{eq:tauu} has a unique solution for all $\kappa>1$ can be easily seen as $F(x)=\operatorname{\mathbb{E}}\left[ \frac{1}{(x\Lambda)^{-1}+1} \right], x\in\mathbb{R}_+$ has range $(0,1)$ and is strictly increasing (by differentiation). Thus, we call $\xi=\frac{u_*}{\tau_*}$. Moreover, multiplying \label{eq:fo2} with $u$ leads to the following equation for $\tau_*$: \begin{align} u_*^2 = \sigma^2\xi^2 + u_*^2 \xi^2 \kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1} +\xi\right)^2}\right] + \xi^2 \operatorname{\mathbb{E}}\left[ \frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1} + \xi\right)^2}\right] ~\Rightarrow~ \tau_*^2 = \frac{\sigma^2 + \operatorname{\mathbb{E}}\left[ \frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1} + \xi\right)^2}\right]}{1-\xi^2\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1} +\xi\right)^2}\right]} = \frac{\sigma^2 + \operatorname{\mathbb{E}}\left[ \frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1} + \xi\right)^2}\right]}{1-\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left((\xi\Lambda)^{-1} +1\right)^2}\right]}. \end{align} {Again, note that this coincides with Equation \eqref{eq:gamma} that determines the parameter $\gamma$ in Definition \ref{def:Xi}, i.e., $\tau_*^2 = \gamma.$ } \vspace{3pt}\noindent\underline{Proof of (iv):} For convenience, define $$F_n(\hat\boldsymbol{\beta},\betab^\star,\boldsymbol{\Sigma}):=\frac{1}{p} \sum_{i=1}^{p} f\left(\sqrt{p}\hat\boldsymbol{\beta}_{n,i},\sqrt{p}\betab^\star_{i},\boldsymbol{\Sigma}_{ii}\right)\quad\text{and}\quad\alpha_*:=\operatorname{\mathbb{E}}_\mu\left[f(X_{\kappa,\sigma^2}(\Lambda,B,H),B,\Lambda)\right].$$ Recall from \eqref{eq:w_n} the explicit expression for $\vct{w}_n$, repeated here for convenience. \begin{align} \vct{w}_n = -\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}\left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u_n\sqrt{\kappa}\bar{\h}\right).\notag \end{align} Also, recall that $\boldsymbol{\beta}_n = \boldsymbol{\Sigma}^{-1/2}\vct{w}_n+\betab^\star$. Thus, (and using the fact that $\bar{\h}$ is distributed as $-\bar{\h}$), \begin{align} \boldsymbol{\beta}_n &=\boldsymbol{\Sigma}^{-1/2}\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}u_n\sqrt{\kappa}\bar{\h} + \left({\mtx{I}}-\boldsymbol{\Sigma}^{-1/2}\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}\boldsymbol{\Sigma}^{-1/2}\right)\betab^\star\notag\\ \Longrightarrow\boldsymbol{\beta}_{n,i}&=\frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_n\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_n\bar{\h}_i +\left(1-\frac{1}{1+\xi_n\boldsymbol{\Sigma}_{i,i}}\right)\betab^\star_i.\label{eq:betan} \end{align} For $i\in[p]$, define \begin{align} \vct{v}_{n,i} = \frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_*\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_*\bar{\h}_i +\left(1-\frac{1}{1+\xi_*\boldsymbol{\Sigma}_{i,i}}\right)\betab^\star_i \end{align} In the above, for convenience, we have denoted $\xi_n:=u_n/\tau_n$ and recall that $\xi_*:=u_*/\tau_*$. The proof proceeds in two steps. In the first step, we use the fact that $\xi_n\stackrel{{P}}{\longrightarrow}\xi_*$ and $u_n\stackrel{{P}}{\longrightarrow} u_\star$ (see \eqref{eq:Dc}) to prove that for any $\varepsilon\in(0,\xi_*/2)$, there exists absolute constant $C>0$ such that wpa 1: \begin{align}\label{eq:ivstep1} |F_n(\sqrt{p}\boldsymbol{\beta}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) - F_n(\sqrt{p}\vct{v}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) | \leq C\varepsilon. \end{align} In the second step, we use Lipschitzness of $f$ and Assumption \ref{ass:mu} to prove that \begin{align} |F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| \stackrel{{P}}{\longrightarrow} \alpha_*.\label{eq:ivstep2} \end{align} The desired follows by combining \eqref{eq:ivstep1} and \eqref{eq:ivstep2}. Thus, in what follows, we prove \eqref{eq:ivstep1} and \eqref{eq:ivstep2}. \vspace{2pt} \noindent\emph{Proof of \eqref{eq:ivstep1}.}~~Fix some $\varepsilon\in(0,\xi_*/2)$. From \eqref{eq:Dc}, we know that w.p.a. 1 $|\xi_n-\xi_*|\leq \varepsilon$ and $|u_n-u_*|\leq \varepsilon$. Thus, $\vct{w}_n$ is close to $\vct{v}_n$. Specifically, in this event, for every $i\in[p]$, it holds that: \begin{align} \notag|\boldsymbol{\beta}_{n,i} - \vct{v}_{n,i}| &\leq {|\betab^\star_i|}\left|\frac{1}{1+\xi_n\bSi_{i,i}}-\frac{1}{1+\xi_*\bSi_{i,i}}\right| + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\boldsymbol{\Sigma}_{i,i}}}\left|\frac{\tau_n}{1+(\xi_n\bSi_{i,i})^{-1}}-\frac{\tau_*}{1+(\xi_*\bSi_{i,i})^{-1}}\right| \\ \notag&= {|\betab^\star_i|}\left|\frac{1}{1+\xi_n\bSi_{i,i}}-\frac{1}{1+\xi_*\bSi_{i,i}}\right| + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\boldsymbol{\Sigma}_{i,i}}}\left|\frac{u_n}{\xi_n+\bSi_{i,i}^{-1}}-\frac{u_*}{\xi_*+\bSi_{i,i}^{-1}}\right| \\ \notag& \leq {|\betab^\star_i|}\frac{|\bSi_{i,i}||\xi_n-\xi_*|}{|1+\xi_n\bSi_{i,i}||1+\xi_*\bSi_{i,i}|} + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\bSi_{i,i}}} \frac{u_*|\xi_n-\xi_*|}{(\xi_n+\bSi_{i,i}^{-1})(\xi_*+\bSi_{i,i}^{-1})} + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\bSi_{i,i}}}\frac{|u_n-u_*|}{\xi+\bSi_{i,i}^{-1}} \\ \notag& \leq {|\betab^\star_i|}{\Sigma_{\max}\varepsilon} + \sqrt{\kappa}{|\bar{\h}_i|} u_*\Sigma_{\max}^{3/2} \varepsilon+ \sqrt{\kappa}|\bar{\h}_i|\Sigma_{\max}^{1/2}\varepsilon \\ &\leq \varepsilon \cdot \max\left\{\Sigma_{\max}^{3/2},\Sigma_{\max}^{1/2}\right\}\, \left(|\bar{\h}_i| + |\betab^\star_i|\right).\label{eq:betav} \end{align}\som{$\varepsilon$ missing} In the second line above, we recalled that $u_n=\tau_n\xi_n$ and $u_*=\tau_*\xi_*$. In the third line, we used the triangle inequality. In the fourth line, we used that $\xi_*>0$, $0<\bSi_{i,i}\leq\Sigma_{\max}$ and $\xi_n\geq \xi_*-\varepsilon \geq \xi_*/2 >0$. Now, we will use this and Lipschitzness of $f$ to argue that there exists absolute constant $C>0$ such that wpa 1: \begin{align} |F_n(\sqrt{p}\boldsymbol{\beta}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) - F_n(\sqrt{p}\vct{v}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) | \leq C\varepsilon.\notag \end{align} Denote, $\vct{a}_i=(\sqrt{p}\boldsymbol{\beta}_{n,i},\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$ and $\vct{b}_i=(\sqrt{p}\vct{v}_{n,i},\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$. Following the exact same argument as in \eqref{eq:LipC}, we have \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| &\leq \frac{L}{p}\sum_{i=1}^p (1+\max\{\|\vct{a}_i\|_2^{k-1},\|\vct{b}_i\|_2^{k-1}\})\|\vct{a}_i-\vct{b}_i\|_2\notag \\ &\leq \frac{L}{p}\sum_{i=1}^p \left(1+\max\{\|\vct{a}_i\|_2^{k-1},\|\vct{b}_i\|_2^{k-1}\}\right)\cdot|\sqrt{p}\boldsymbol{\beta}_{n,i}({\vct{g}},\vct{h}) - \sqrt{p}\vct{v}_{n,i}|\notag\\ &\leq L\left(1+\max\{\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2k-2},\frac{1}{p}\sum_{i=1}^p\|\vct{b}_i\|_2^{2k-2}\} \right)^{1/2}{\|\boldsymbol{\beta}_{n}({\vct{g}},\vct{h}) - \vct{v}_n\|_2}\notag. \end{align} From this and \eqref{eq:betav}, we find \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| &\leq L(1+\max\{\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2k-2},\frac{1}{p}\sum_{i=1}^p\|\vct{b}_i\|_2^{2k-2}\} )^{1/2} \\ &\qquad\qquad\varepsilon\cdot\sqrt{2}\max\left\{\Sigma_{\max}^{3/2},\Sigma_{\max}^{1/2}\right\}\sqrt{\|\betab^\star\|_2^2 + \|\bar{\h}\|_2^2}.\label{eq:epsS} \end{align} As in \eqref{eq:bdmom}, it can be shown that wpa 1: $\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2k-2}<\infty$ and $\frac{1}{p}\sum_{i=1}^p \|\vct{b}_i\|_2^{2k-2}<\infty$, as $p\rightarrow\infty$. Similarly, $\|\betab^\star\|_2^2 = \frac{1}{p}\sum_{i=1}^p(\sqrt{p}\betab^\star_i)^2<\infty$, as $p\rightarrow \infty$ by Assumption (A2). Finally, $\|\bar{\h}\|_2^2\leq 2$, wpa 1 as $p\rightarrow\infty$. Therefore, from \eqref{eq:epsS}, wpa 1, there exists constant $C>0$ such that \begin{align} |F_n(\boldsymbol{\beta}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| \leq C \cdot\varepsilon, \end{align} as desired. \vspace{2pt} \noindent\emph{Proof of \eqref{eq:ivstep2}.}~~Next, we will use Assumption \ref{ass:mu} to show that \begin{align} |F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| \stackrel{{P}}{\longrightarrow} \alpha_*.\label{eq:AO_conv} \end{align} Notice that $\vct{v}_n$ is a function of $\betab^\star,\boldsymbol{\Sigma},\bar{\h}$. Concretely, define $g:\mathbb{R}^3\rightarrow\mathbb{R}$, such that $$ g(x_1,x_2,x_3) := \frac{x_2^{-1/2}}{1+(\xi x_2)^{-1}}\sqrt{\kappa}\tau_* x_3 + (1-(1+\xi_*x_2)^{-1})x_1, $$ and notice that $$ \sqrt{p}\vct{v}_{n,i} = g\left(\sqrt{p}\betab^\star_i,\bSi_{i,i},\vct{h}_i\right) = \frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_*\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_*\vct{h}_i +\left(1-\frac{1}{1+\xi_*\boldsymbol{\Sigma}_{i,i}}\right)\sqrt{p}\betab^\star_i. $$ Thus, $$ F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma}) = \frac{1}{p}\sum_{i=1}^p f\left(g\left(\sqrt{p}\betab^\star_i,\bSi_{i,i},\vct{h}_i\right),\sqrt{p}\betab^\star_i,\bSi_{i,i}\right) =: \frac{1}{p}\sum_{i=1}^p h\left(\vct{h}_i,\sqrt{p}\betab^\star_i,\bSi_{i,i}\right), $$ where we have defined $h:\mathbb{R}^3\rightarrow\mathbb{R}$: \begin{align} h(x_1,x_2,x_3) := f\left(g(x_2,x_3,x_1),x_2,x_3\right).\label{h func} \end{align} \cts{It will suffice to prove that $h\in\rm{PL}(k+1)$. Indeed, if that were the case, then Assumption (A2) (note that $2k-2\geq k+1$ for $k\geq3$) gives} \begin{align} \frac{1}{p}\sum_{i=1}^p h\left(\vct{h}_i,\sqrt{p}\betab^\star_i,\bSi_{i,i}\right) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{\mathcal{N}(0,1)\otimes \mu}\left[h(H,B,\Lambda)\right] &= \operatorname{\mathbb{E}}_{\mathcal{N}(0,1)\otimes \mu}\left[f\left(g(B,\Lambda,H),B,\Lambda\right))\right]\\ & = \operatorname{\mathbb{E}}[f\left(X_{\kappa,\sigma^2}(\Lambda,B,H),B,\Lambda\right)] = \alpha_*, \end{align} where the penultimate equality follows by recognizing that (cf. Eqn. \eqref{eq:X}) $$ g(B,\Lambda,H) = (1-(1+\xi_*\Lambda)^{-1})B + \sqrt{\kappa}\frac{\tau_*\Lambda^{-1/2}}{1+(\xi_*\Lambda)^{-1}}H = X_{\kappa,\sigma^2}(\Lambda,B,H). $$ We prove that $h\in\rm{PL}(k+1)$ in Lemma \ref{lem:hPL} in Section \ref{SM useful fact}. \vspace{5pt} \vspace{3pt}\noindent\underline{Proof of (v):} Let $\psi:\mathbb{R}\rightarrow\mathbb{R}$ be any bounded Lipschitz function. The function $f(a,b,c) = \psi(a)$ is $\rm{PL}$ of order $k$. Thus, by directly applying statement (iv) of the lemma, we find that $$ \frac{1}{p}\sum_{i=1}^p{\psi(\sqrt{p}\boldsymbol{\beta}_{n,i}({\vct{g}},\vct{h}))} \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}\left[\psi(X_{\kappa,\sigma^2})\right]. $$ Since this holds for any bounded Lipschitz function, we have shown that the empirical convergence of $\boldsymbol{\beta}_n$ converges to the distribution of $X_{\kappa,\sigma^2}$. It remains to prove boundedness of the $k$-th moment as advertised in \eqref{eq:k_AO}. Recall from \eqref{eq:betan} that \begin{align} \sqrt{p}\boldsymbol{\beta}_{n,i}&=\frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_n\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_n\vct{h}_i +\left(1-\frac{1}{1+\xi_n\boldsymbol{\Sigma}_{i,i}}\right)(\sqrt{p}\betab^\star_i).\notag \end{align} Using this, boundedness of $\boldsymbol{\Sigma}_{i,i}$ from Assumption (A2), and the fact that $\tau_n\stackrel{{P}}{\longrightarrow}\tau_\star, \xi_n\stackrel{{P}}{\longrightarrow}\xi_\star$, there exists constant $C=C(\Sigma_{\max},\Sigma_{\min},k,\tau_\star,\xi_\star)$ such that wpa. 1, \begin{align} \frac{1}{p}\sum_{i=1}^p|\sqrt{p}\boldsymbol{\beta}_{n,i}|^{2k-2} \leq C\left(\frac{1}{p}\sum_{i=1}^p|\vct{h}_{i}|^{2k-2}+\frac{1}{p}\sum_{i=1}^p|\sqrt{p}\betab^\star_{i}|^{2k-2}\right).\notag \end{align} But the two summands in the expression above are finite in the limit of $p\rightarrow\infty$. Specifically, (i) from Assumption (A2), $\frac{1}{p}\sum_{i=1}^p|\sqrt{p}\betab^\star_{i}|^{2k-2}\stackrel{{P}}{\longrightarrow}\operatorname{\mathbb{E}}[B^{2k-2}]<\infty$; (ii) $\frac{1}{p}\sum_{i=1}^p|\vct{h}_{i}|^{2k-2}\stackrel{{P}}{\longrightarrow}\operatorname{\mathbb{E}}[H^{2k-2}]<\infty$, using the facts that $\vct{h}_i\stackrel{iid}{\sim}\mathcal{N}(0,1)$ and $H\sim\mathcal{N}(0,1)$. This proves \eqref{eq:k_AO}, as desired. \begin{lemma} The function $h$ in \eqref{h func} is $\rm{PL}(k)$ as long as $f$ is $\rm{PL}(k)$. {\color{red}The function $h$ is $\mathbb{R}^3\rightarrow\mathbb{R}$, not $\mathbb{R}^{3p}\rightarrow\mathbb{R}$! See Lemma 6 below.} \end{lemma} \begin{proof} Since $f$ is $\rm{PL}(k)$, for some $L>0$, \eqref{PL func} holds. Fix $\vct{a}=[\vct{x},\vct{y},{\vct{z}}]\in\mathbb{R}^{3p},\vct{a}'=[\vct{x}',\vct{y}',{\vct{z}}']\in\mathbb{R}^{3p}$. Let $\vct{b}=[{\vct{g}},\vct{y},{\vct{z}}]$ where ${\vct{g}}=g(\vct{y},{\vct{z}},\vct{x})$. We have that \begin{align} |h(\vct{a})-h(\vct{a}')|&\leq |f(\vct{b})-f(\vct{b}')|\\ &\leq L\left(1+\|\vct{b}\|_2^{k-1}+\|\vct{b}'\|_2^{k-1}\right)\|\vct{b}-\vct{b}'\|_2\\ &\lesssim L\left(1+\|\vct{a}\|_2^{k-1}+\|\vct{a}'\|_2^{k-1}+\|{\vct{g}}\|_2^{k-1}+\|{\vct{g}}'\|_2^{k-1}\right)(\|\vct{a}-\vct{a}'\|_2+\|{\vct{g}}-{\vct{g}}'\|_2). \end{align} Next, we need to bound the ${\vct{g}}$ term in terms of $\vct{a}$. This is accomplished as follows \begin{align} \|{\vct{g}}\|_2^{k-1}&\lesssim \frac{1}{p}\sum_{i=1}^p|g_i|^{k-1}\\ &\lesssim \frac{1}{p}\sum_{i=1}^p\left|\frac{y_i^{-1/2}}{1+(\xi y_i)^{-1}}\sqrt{\kappa}\tau_* z_i + (1-(1+\xi_*y_i)^{-1})x_i\right|\\ &\lesssim \frac{1}{p}\sum_{i=1}^p(|z_i|+|x_i|)^{k-1}\lesssim \|\vct{x}\|_2^{k-1}+\|{\vct{z}}\|_2^{k-1}\\ &\lesssim \|\vct{a}\|^{k-1}. \end{align} Secondly and similarly, we have the following perturbation bound on the ${\vct{g}}-{\vct{g}}'$. \so{Suppose the triples $(x_i,y_i,z_i)$ takes values in a fixed bounded compact set $\mathcal{M}$. We will prove the following sequence of inequalities} \begin{align} \tn{{\vct{g}}-{\vct{g}}'}^2&\leq \sum_{i=1}^p|g(x_i,y_i,z_i)-g(x'_i,y'_i,z'_i)|^2\\ &\leq C^2_{\mathcal{M}} \sum_{i=1}^p(|x_i-x'_i|^2+|y_i-y'_i|^2+|z_i-z'_i|^2)\label{sec line eq}\\ &\leq C^2_{\mathcal{M}} (\tn{\vct{x}-\vct{x}'}^2+\tn{\vct{y}-\vct{y}'}^2+\tn{{\vct{z}}-{\vct{z}}'}^2)\\ &\lesssim \tn{\vct{a}-\vct{a}'}^2. \end{align} In what follows, we prove the second line \eqref{sec line eq} i.e.~the fact that for any triples $a=(x,y,z),a'=(x',y',z')$ (with $a,a'\in\mathbb{R}^3$), we have that \[ |g(a)-g(a')|\leq C_{\mathcal{M}}\tn{a-a'}. \] Set $C_\nabla=\sup_{a\in \mathcal{M}}\tn{\nabla g(a)}$. By definition of gradient, the inequality above holds with $C_\mathcal{M}=C_\nabla$. Thus, all that remains is proving that $C_\nabla$ is upper bounded by a constant. \so{However, this automatically holds because from the definition of $g(\dots)$ function, it is clear that $C_\nabla$ is defined everywhere and continuous thus it has a finite maximum over a compact set.} \cts{Only the problem is that $z_i$ (i.e., $\vct{h}_i$) is $\mathcal{N}(0,1)$ so it is not bounded.} \end{proof} But from Assumption \ref{ass:mu} and $f\in\rm{PL(2)}$ it follows immediately that with probability approaching 1, \begin{align} |\frac{1}{p}\sum_{i=1}^{p}f(\sqrt{p}\vct{v}_{n,i})-\operatorname{\mathbb{E}}_\mu\left[X_{\kappa,\sigma^2}(\Lambda,N,H) \right]| \leq \varepsilon. \end{align} Combining the above displays and using triangle inequality completes the proof of the statement. \subsection{Asymptotic formulas on Magnitude- and Hessian- pruning} Here, we use Theorem \ref{thm:master_W2} to characterize the risk of the magnitude- and Hessian- pruned solutions. This section supplements the discussion in Section \ref{sec:risk}. First, we formally state the result of Section \ref{sec:risk} as Corollary \ref{cor:mag} characterizing magnitude pruning. Next, we further discuss Hessian pruning. \subsubsection{Magnitude-based pruning.} We begin with the following necessary definitions. Define the hard-thresholding function with fixed threshold $t\in\mathbb{R}_+$ as follows: \begin{align}\label{eq:threshold_app} \mathcal{T}_t(x) = \begin{cases} x & \text{if } |x|>t \\ 0 & \text{otherwise} \end{cases}. \end{align} Further define threshold $t^\star$ as follows: \begin{align}\label{eq:tstar_app} t^\star:=\inf\left\{t\in\mathbb{R}\,:\, \Pr(|X_{\kappa,\sigma^2}|\geq t) \geq \alpha \right\}. \end{align} \begin{corollary}[Risk of Magnitude-pruning]\label{cor:mag} Let the same assumptions and notation as in the statement of Theorem \ref{thm:master_W2} hold. Specifically, let $\hat\boldsymbol{\beta}$ be the min-norm solution in \eqref{eq:min_norm} and $\hat\beta_s^M:=\mathbb{T}_s({\boldsymbol{\beta}})$ the magnitude-pruned model at sparsity $s$. Recall the notations in \eqref{eq:threshold_app} and \eqref{eq:tstar_app}. The risk of the magnitude-pruned model satisfies the following in the limit of $n,p,s\rightarrow\infty$ at rates $\kappa:=p/n>1$ and $\alpha:=s/p\in(0,1)$ (cf. Assumption \ref{ass:linear}): \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}}^M_s) \stackrel{{P}}{\longrightarrow} \sigma^2 + \operatorname{\mathbb{E}}\left[ \Lambda\left(B-\mathcal{T}_{t^\star}(X_{\kappa,\sigma^2})\right) \right],\notag \end{align} where the expectation is over $(\Lambda,B,H)\sim\mu\otimes\mathcal{N}(0,1).$ \end{corollary} The proof of the corollary above, is given in Section \ref{sec:risk}. Below, we extend the results to Hessian-based pruning. \subsubsection{Hessian-based pruning.} Let $\hat\beta$ be the min-norm solution in \eqref{eq:min_norm}. Recall that the Hessian-pruned model $\boldsymbol{\beta}_s^H$ at sparsity $s$ is given by \begin{align}\label{eq:hp} \boldsymbol{\beta}_s^H = \hat\boldsymbol{\Sigma}^{-1/2}\mathbb{T}_s(\hat\boldsymbol{\Sigma}^{1/2}\boldsymbol{\beta}), \end{align} where $\hat\boldsymbol{\Sigma}=\diag{{\mtx{X}}^T{\mtx{X}}}/n$ the diagonal of the empirical covariance matrix. \begin{corollary}[Risk of Hessian-pruning]\label{cor:hes} Let the same assumptions and notation as in the statement of Theorem \ref{thm:master_W2} hold. Specifically, let $\hat\boldsymbol{\beta}$ be the min-norm solution in \eqref{eq:min_norm} and $\hat\beta_s^H$ the Hessian-pruned model at sparsity $s$. Recall the notation in \eqref{eq:threshold_app} and define \begin{align}\label{eq:tdiam_app} t^\diamond:=\inf\left\{t\in\mathbb{R}\,:\, \Pr(|\Lambda^{1/2}X_{\kappa,\sigma^2}|\geq t) \geq \alpha \right\}. \end{align} The risk of the magnitude-pruned model satisfies the following in the limit of $n,p,s\rightarrow\infty$ at rates $\kappa:=p/n>1$ and $\alpha:=s/p\in(0,1)$ (cf. Assumption \ref{ass:linear}): \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}}^H_s) \stackrel{{P}}{\longrightarrow} \sigma^2 + \operatorname{\mathbb{E}}\left[ \Lambda\left(B-\Lambda^{-1/2}\mathcal{T}_{t^\diamond}(\Lambda^{1/2}X_{\kappa,\sigma^2})\right) \right],\notag \end{align} where the expectation is over $(\Lambda,B,H)\sim\mu\otimes\mathcal{N}(0,1).$ \end{corollary} \begin{proof} Recall the definition of the hard-thresholding operator $\mathcal{T}_t(x)$. Similar to Section \ref{sec:risk}, we consider a threshold-based pruning vector $${\boldsymbol{\hat{\beta}}}^{\mathcal{T},H}_{t} := \hat\boldsymbol{\Sigma}^{-1/2}\mathcal{T}_{t/\sqrt{p}}(\hat\boldsymbol{\Sigma}^{1/2}\hat{\boldsymbol{\beta}}),$$ where $\mathcal{T}_t$ acts component-wise. Further define $${\boldsymbol{\hat{\beta}}}^{\mathcal{T},H^\star}_{t} := \boldsymbol{\Sigma}^{-1/2}\mathcal{T}_{t/\sqrt{p}}(\boldsymbol{\Sigma}^{1/2}\hat{\boldsymbol{\beta}}).$$ Note that ${\boldsymbol{\hat{\beta}}}^{\mathcal{T},H^\star}_{t}$ uses the true (diagonal) covariance matrix $\boldsymbol{\Sigma}$ instead of its sample estimate $\hat\boldsymbol{\Sigma}$. For later reference, note here that $\hat\boldsymbol{\Sigma}$ concentrates (entry-wise) to $\boldsymbol{\Sigma}$. Specifically, using boundedness of $\boldsymbol{\Sigma}$ and standard concentration of sub-exponential random variables First, we compute the limiting risk of ${\boldsymbol{\hat{\beta}}}^{\mathcal{T},H^\star}_{t}$. Then, we will use the fact that $\hat\boldsymbol{\Sigma}$ concentrates (entry-wise) to $\boldsymbol{\Sigma}$, to show that the risks of ${\boldsymbol{\hat{\beta}}}^{\mathcal{T},H^\star}_{t}$ and ${\boldsymbol{\hat{\beta}}}^{\mathcal{T},H}_{t}$ are arbitrarily close as $p\rightarrow\infty$. We start by computing the risk of ${\boldsymbol{\hat{\beta}}}^{\mathcal{T},H^\star}_{t}$. Similar to \eqref{eq:loss_w2}, \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}}^{\mathcal{T},H^\star}_t) &= \sigma^2 + ({\boldsymbol{\beta}}^\star-{\boldsymbol{\hat{\beta}}}^{\mathcal{T},H^\star}_t)^T\boldsymbol{\Sigma}({\boldsymbol{\beta}}^\star-{\boldsymbol{\hat{\beta}}}^{\mathcal{T},H^\star}_t) \notag \\ &= \sigma^2 + \frac{1}{p}\sum_{i=1}^p\boldsymbol{\Sigma}_{i,i}\big(\sqrt{p}\betab^\star_i-\bSi_{i,i}^{-1/2}\mathcal{T}_{t}(\bSi_{i,i}^{1/2}\sqrt{p}\hat\boldsymbol{\beta}_i)\big)^2. \end{align} where in the last line we used that $\sqrt{p}\mathcal{T}_{t/\sqrt{p}}(x)=\mathcal{T}_{t}(\sqrt{p}x)$. \end{proof} \section{Facts about Lipschitz functions}\label{SM useful fact} For $k\geq 1$ we say a function $f:\mathbb{R}^m\rightarrow\mathbb{R}$ is pseudo-Lipschitz of order $k$ and denote it by $f\in \rm{PL}(k)$ if there exists a cosntant $L>0$ such that, for all $\vct{x},\vct{y}\in\mathbb{R}^m$: \begin{align} |f(\vct{x})-f(\vct{y})|\leq L\left(1+\|\vct{x}\|_2^{k-1}+\|\vct{y}\|_2^{k-1}\right)\|\vct{x}-\vct{y}\|_2.\label{PL func} \end{align} In particular, when $f\in\rm{PL}(k)$, the following properties hold: \begin{enumerate} \item There exists a constant $L'$ such that for all $\vct{x}\in\mathbb{R}^n$: $|f(\vct{x})|\leq L'(1+\|\vct{x}\|_2^k).$ \item $f$ is locally Lipschitz, that is for any $M>0$, there exists a constant $L_{M,m}<\infty$ such that for all $x,y\in[-M,M]^m$, $ |f(\vct{x})-f(\vct{y})| \leq L_{M,m}\|\vct{x}-\vct{y}\|_2. $ Further, $L_{M,m}\leq c(1+(M\sqrt{m})^{k-1})$ for some costant $c$. \end{enumerate} \begin{lemma} Let $g:\mathbb{R}\rightarrow\mathbb{R}$ be a Lipschitz function. Consider the function $f:\mathbb{R}^3\rightarrow\mathbb{R}$ defined as follows: $$ f(\vct{x}) = x_1(x_2-g(x_3))^2. $$ Then, $f\in\rm{PL}(3).$ \end{lemma} \begin{proof} Let $h:\mathbb{R}^2\rightarrow\mathbb{R}$ defined as $h({\vct{u}})=({\vct{u}}_1-g({\vct{u}}_2))^2$. The function $({\vct{u}}_1,{\vct{u}}_2)\mapsto{\vct{u}}_1-g({\vct{u}}_2)$ is clearly Lipschitz. Thus, $h\in\rm{PL}(2)$, i.e., \begin{align} |h({\vct{u}})-h(\vct{v})| \leq C(1+\|{\vct{u}}\|_2+\|\vct{v}\|_2)\|{\vct{u}}-\vct{v}\|_2\quad\text{and}\quad |h(\vct{v})|\leq C'(1+\|\vct{v}\|_2^2).\label{eq:h_pl} \end{align} Therefore, letting $\vct{x}=(x_1,{\vct{u}})\in\mathbb{R}^3$ and $\vct{y}=(y_1,\vct{v})\in\mathbb{R}^3$, we have that \begin{align} |f(\vct{x})-f(\vct{y})| &= |x_1h({\vct{u}}) - y_1h(\vct{v})| \leq |x_1||h({\vct{u}})-h(\vct{v})| + |h(\vct{v})| |x_1-y_1|\notag\\ &\leq C|x_1|(1+\|{\vct{u}}\|_2+\|\vct{v}\|_2)\|{\vct{u}}-\vct{v}\|_2 + C'(1+\|\vct{v}\|_2^2)|x_1-y_1| \notag\\ &\leq C(|x_1|^2+(1+\|{\vct{u}}\|_2+\|\vct{v}\|_2)^2)\|{\vct{u}}-\vct{v}\|_2 + C'(1+\|\vct{v}\|_2^2)|x_1-y_1| \notag\\ &\leq C(1+\|\vct{x}\|_2^2+\|\vct{y}\|_2^2)\|{\vct{u}}-\vct{v}\|_2 + C'(1+\|\vct{x}\|_2^2+\|\vct{y}\|_2^2)|x_1-y_1| \notag\\ &\leq C(1+\|\vct{x}\|_2^2+\|\vct{y}\|_2^2)\|\vct{x}-\vct{y}\|_2. \end{align} In the second line, we used \eqref{eq:h_pl}. In the third line, we used $2xy\leq x^2+y^2$. In the fourth line, we used Cauchy-Schwarz inequality. $C,C'>0$ are absolute constants that may change from line to line. This completes the proof of the lemma. \end{proof} \begin{lemma}\label{lem:hPL} Let functions $f,g:\mathbb{R}^3\rightarrow\mathbb{R}$ such that $f\in\rm{PL}(k)$ and $$ g(x_1,x_2,x_3) := \frac{x_2^{-1/2}}{1+(\xi_* x_2)^{-1}}\sqrt{\kappa}\tau_* x_3 + (1-(1+\xi_*x_2)^{-1})x_1. $$ Here, $\xi_*,\tau_*,\kappa$ are positive constants. Further define \begin{align} h(x,y,z) := f\left(g(y,z,x),y,z\right), \end{align} and assume that $y$ take values on a fixed bounded compact set $\mathcal{M}$. Then, it holds that $h\in\rm{PL}(k+1)$. \end{lemma} \begin{proof} Since $f$ is $\rm{PL}(k)$, for some $L>0$, \eqref{PL func} holds. Fix $x,x'\in\mathbb{R}$, $\vct{a}=[y,z]\in\mathbb{R}^{2}$ and $\vct{a}'=[y',z']\in\mathbb{R}^{2}$. Let $\vct{b}=[{\vct{g}},\vct{a}]=[{\vct{g}},y,z]\in\mathbb{R}^3$ where ${\vct{g}}=g(y,z,x)\in\mathbb{R}$ and define accordingly $\vct{b}'$ and ${\vct{g}}'$. We have that \begin{align} |h([x,\vct{a}])-h([x,\vct{a}'])|&= |f(\vct{b})-f(\vct{b}')|\notag\\ &\leq L\left(1+\|\vct{b}\|_2^{k-1}+\|\vct{b}'\|_2^{k-1}\right)\|\vct{b}-\vct{b}'\|_2\notag\\ &\leq C\left(1+\|\vct{a}\|_2^{k-1}+\|\vct{a}'\|_2^{k-1}+|{\vct{g}}|^{k-1}+|{\vct{g}}'|^{k-1}\right)(\|\vct{a}-\vct{a}'\|_2+|{\vct{g}}-{\vct{g}}'|),\label{eq:hlip} \end{align} for some constant $C>0$. In the last inequality we have repeatedly used the inequality $ \left(\sum_{i=1}^m \|\vct{v}_i\|_2^2\right)^{\frac{d}{2}} \leq C(m)\cdot\sum_{i=1}^m\|\vct{v}_i\|_2^{d}. $ Next, we need to bound the ${\vct{g}}$ term in terms of $\vct{a}$. This is accomplished as follows \begin{align} |{\vct{g}}|^{k-1} &= \left|\frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x + (1-(1+\xi_*y)^{-1})z\right|^{k-1}\notag\\ &\leq C (|z|+|x|)^{k-1} \notag\\ &\leq C \left(|x|^{k-1}+|z|^{k-1}\right) \leq C (|x|^{k-1} + \|\vct{a}\|_2^{k-1}).\label{eq:gb} \end{align} Here, the value of the constant $C>0$ may change from line to line. Secondly and similarly, we have the following perturbation bound on the ${\vct{g}}-{\vct{g}}'$. Recall that $(x,y)$ and $(x',y')$ are bounded. We will prove the following sequence of inequalities \begin{align} |{{\vct{g}}-{\vct{g}}'}|&= |g(y,z,x)-g(y',z',x')| \notag\\ &\leq \left|\frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x - \frac{(y')^{-1/2}}{1+(\xi y')^{-1}}\sqrt{\kappa}\tau_* x'\right| + \left|(1-(1+\xi_*y)^{-1})z-(1-(1+\xi_*y')^{-1})z'\right|\notag\\ &\leq \left|\frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x - \frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x'\right| +\left|\frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* x'- \frac{(y')^{-1/2}}{1+(\xi y')^{-1}}\sqrt{\kappa}\tau_* x'\right|\notag\\ &\qquad+ \left|(1-(1+\xi_*y)^{-1})z-(1-(1+\xi_*y)^{-1})z'\right| + \left|(1-(1+\xi_*y)^{-1})z'-(1-(1+\xi_*y')^{-1})z'\right| \notag\\ &\leq C_1|x-x'| + C_2|x'||y-y'| + C_3|z-z'| + C_4|z'||y-y'|\notag\\ &\leq C(1+|x'| + |z'|)(|x-x'| + |z-z'| + |y-y'|)\\ &\leq C\sqrt{3}(1+|x'| + |z'|)\|[\vct{a},x]-[\vct{a}',x']\|_2 .\label{eq:gd} \end{align} In the fourth inequality above, we used the fact the assumption that $|y|$ is bounded. In the last line, we used Cauchy-Scwhartz. Substituting \eqref{eq:gb} and \eqref{eq:gd} in \eqref{eq:hlip} gives: \begin{align} |h(x,y,z) - h(x',y',z')| &\leq C\left(1+\|\vct{a}\|_2^{k-1}+\|\vct{a}'\|_2^{k-1}+|x|^{k-1}+|x'|^{k-1}\right)(1+|x'| + |z'|)\|[\vct{a},x]-[\vct{a}',x']\|_2\notag \\ &\leq C\left(1+\|[\vct{a},x]\|_2^{k}+\|[\vct{a}',x']\|_2^{k}\right)\|[\vct{a},x]-[\vct{a}',x']\|_2. \end{align} Thus, $h\in\rm{PL}(k+1)$, as desired. \end{proof} \section{Proofs for overparameterized least-squares}\label{sec proof thm 1} In this section, we assume the linear Gaussian problem (LGP) of Definition \ref{def LGP}, the overparameterized regime $k=p>n$ and the min-norm model ${\boldsymbol{\hat{\beta}}}$ of \eqref{eq:min_norm}. We prove Theorem \ref{thm:master_W2} that derives the asymptotic DC of ${\boldsymbol{\hat{\beta}}}$ and we show how this leads to sharp formulae for the risk of the Magnitude- and Hessian-pruned models. \subsection{Notation and Assumptions}\label{sec:ass_app} For the reader's convenience, we recall some necessary notation and assumptions from Section \ref{sec main}. We say that a function $f:\mathbb{R}^m\rightarrow\mathbb{R}$ is pseudo-Lipschitz of order $k$, denoted $f\in\rm{PL}(k)$, if there is a constant $L>0$ such that for all $\vct{x},\vct{y}\in\mathbb{R}^m$, $ |f(\vct{x}) - f(\vct{y})|\leq L(1+\tn{\vct{x}}^{k-1}+\tn{\vct{y}}^{k-1})\|\vct{x}-\vct{y}\|_2 $ (See also Section \ref{SM useful fact}). We say that a sequence of probability distributions $\nu_p$ on $\mathbb{R}^m$ {converges in $W_k$} to $\nu$, written $\nu_p\stackrel{W_k}{\Longrightarrow} \nu$, if $W_k(\nu_p,\nu) \rightarrow 0$ as $p \rightarrow \infty$. An equivalent definition is that, for any $f\in\rm{PL}(k)$, $\lim_{p\rightarrow\infty}\operatorname{\mathbb{E}} f(X_p)=\operatorname{\mathbb{E}} f(X)$, where expectation is with respect to $X_p\sim\nu_p$ and $X\sim\nu$ (e.g., \cite{montanari2017estimation}). Finally, recall that a sequence of probability distributions $\nu_n$ on $\mathbb{R}^m$ \emph{converges weakly} to $\nu$, if for any bounded Lipschitz function $f$: $\lim_{p\rightarrow\infty}\operatorname{\mathbb{E}} f(X_p)=\operatorname{\mathbb{E}} f(X)$, where expectation is with respect to $X_p\sim\nu_p$ and $X\sim\nu$. Throughout, we use $C,C',c,c'$ to denote absolute constants (not depending on $n,p$) whose value might change from line to line. We focus on a double asymptotic regime where: $$n,p,s\rightarrow\infty \text{ at fixed overparameterization ratio } \kappa:=p/n>1 \text{ and sparsity level } \alpha:=s/p\in(0,1).$$ For a sequence of random variables $\mathcal{X}_{p}$ that converge in probability to some constant $c$ in the limit of Assumption \ref{ass:linear} below, we write $\mathcal{X}_{p}\stackrel{{P}}{\longrightarrow} c$. For a sequence of event $\mathcal{E}_p$ for which $\lim_{p\rightarrow}\mathbb{P}(\mathcal{E}_p) = 1$, we say that $\mathcal{E}_p$ occurs \emph{with probability approaching 1}. For this, we will often use the shorthand ``wpa 1". \vspace{5pt} Next, we recall the set of assumption under which our analysis applies: \asstwo* \assthree* \noindent We remark that Assumption \ref{ass:mu} above implies (see \cite[Lem.~4]{bayati2011dynamics} and \cite[Lem.~A3]{javanmard2013state}) that for any pseudo-Lipschitz function $\psi:\mathbb{R}^2\rightarrow\mathbb{R}$ of order $4$, i.e., $\psi\in\rm{PL}(4)$: $$ \frac{1}{p}\sum_{i=1}^p\psi(\bSi_{i,i},\sqrt{p}\betab^\star_i) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{(\Lambda,B)\sim\mu}\left[ \psi(\Lambda,B)\right]. $$ \subsection{Asymptotic distribution and risk characterizations} {In this section, we prove our main result Theorem \ref{thm:master_W2}. Recall that ${\boldsymbol{\hat{\beta}}}$ is the min-norm solution. Since the distribution of ${\boldsymbol{\hat{\beta}}}$ depends on the problem dimensions (as it is a function of ${\mtx{X}},\vct{y}$), when necessary, we will use ${\boldsymbol{\hat{\beta}}}_n$ notation to make its dimension dependence explicit.} Let ${\boldsymbol{\hat{\beta}}}^P={\cal{P}}({\boldsymbol{\hat{\beta}}})$ be a pruned version of the min-norm solution ${\boldsymbol{\hat{\beta}}}$. Recall from Section \ref{sec:risk}, that the first crucial step in characterizing the risk ${\cal{L}}({\boldsymbol{\hat{\beta}}}^P)$ is studying the risk ${\cal{L}}({\boldsymbol{\hat{\beta}}}^\mathcal{T}_t)$ of a threshold-based pruned vector. To keep things slightly more general, consider ${\boldsymbol{\hat{\beta}}}^{g}$ defined such that $\sqrt{p}{\boldsymbol{\hat{\beta}}}^{g}=g(\sqrt{p}{\boldsymbol{\hat{\beta}}})$, where $g$ is a Lipschitz function acting entry-wise on ${\boldsymbol{\hat{\beta}}}$ (for example, $g$ can be the {(arbitrarily close Lipschitz approximation of the)} thresholding operator $\mathcal{T}_t$ of Section \ref{sec:risk}). Then, the risk of ${\boldsymbol{\hat{\beta}}}^g$ can be written as \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}}^g) &= \operatorname{\mathbb{E}}_{\mathcal{D}}[(\vct{x}^T({\boldsymbol{\beta}}^\star-{\boldsymbol{\hat{\beta}}}^g) + \sigma z)^2] = \sigma^2 + ({\boldsymbol{\beta}}^\star-{\boldsymbol{\hat{\beta}}}^g)^T\boldsymbol{\Sigma}({\boldsymbol{\beta}}^\star-{\boldsymbol{\hat{\beta}}}^g) \notag \\ &= \sigma^2 + \frac{1}{p}\sum_{i=1}^p\boldsymbol{\Sigma}_{i,i}\big(\sqrt{p}\betab^\star_i-g(\sqrt{p}{\boldsymbol{\hat{\beta}}}_i)\big)^2\notag \\ &=: \sigma^2 + \frac{1}{p}\sum_{i=1}^p f\big(\sqrt{p}{\boldsymbol{\hat{\beta}}}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i}\big),\label{eq:risk_app_f} \end{align} where in the last line, we defined the function $f$ as $f=f_{\cal{L}}\in {\cal{F}}_{\cal{L}}\subset{\cal{F}}$ given by \[ f_{\cal{L}}(x,y,z) := z(y-g(x))^2\quad\text{where}~g~\text{is Lipschitz.} \] Here, recall the definition of the families ${\cal{F}}_{\cal{L}}$ in \eqref{eq:fdef} and ${\cal{F}}$ in \eqref{eq:pdef}. The following theorem establishes the asymptotic limit of \eqref{eq:risk_app_f}. For the reader's convenience, we repeat the notation introduced in Definition \ref{def:Xi}. Let random variables $(\Lambda,B)\sim \mu$ (where $\mu$ is defined in Assumption \ref{ass:mu}) and fix $\kappa>1$. Define parameter $\xi$ as the unique positive solution to the following equation $$ \operatorname{\mathbb{E}}_{\mu}\Big[ \big({1+(\xi\cdot\Lambda)^{-1}}\big)^{-1} \Big] = {\kappa^{-1}}\,. $$ Further define the positive parameter $\gamma$ as follows: $$ \hspace{-0.1in}\gamma := \Big({\sigma^2 + \operatorname{\mathbb{E}}_{\mu}\Big[\frac{B^2\Lambda}{(1+\xi\Lambda)^2}\Big]}\Big)\Big/\Big({1-\kappa\operatorname{\mathbb{E}}_{\mu}\Big[\frac{1}{\left(1+(\xi\Lambda)^{-1}\right)^2}\Big]}\Big). $$ With these and $H\sim\mathcal{N}(0,1)$, define the random variable $$ X_{\kappa,\sigma^2}:=X_{\kappa,\sigma^2}(\Lambda,B,H) := \Big(1-\frac{1}{1+ \xi\Lambda}\Big) B + \sqrt{\kappa}\frac{\sqrt{\gamma}\,\Lambda^{-1/2}}{1+(\xi\Lambda)^{-1}} H, $$ and let $\Pi_{\kappa,\sigma^2}$ be its distribution. \mainthm* Before we prove the theorem, let us show how it immediately leads to a sharp prediction of the risk behavior. Indeed, a direct application of \eqref{eq:thm} for $f=f_{\cal{L}}$ to \eqref{eq:risk_app_f} shows that \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}}^g)\stackrel{{P}}{\longrightarrow} \sigma^2 + \operatorname{\mathbb{E}}_{(\Lambda,B,H)\sim\mu\otimes\mathcal{N}(0,1)}\left[f_{\cal{L}}(X_{\kappa,\sigma^2},B,\Lambda) \right] = \sigma^2 + \operatorname{\mathbb{E}}_{(\Lambda,B,H)\sim\mu\otimes\mathcal{N}(0,1)}\left[\Sigma\left(B-g(X_{\kappa,\sigma^2})\right)^2 \right].\label{eq:risk_app_f2} \end{align} We further remark on the following two consequences of Theorem \ref{thm:master_W2}. First, since \eqref{eq:thm} holds for any $\rm{PL}(2)$ function, we have essentially shown that $\hat\Pi_n(\vct{y},{\mtx{X}},\betab^\star,\boldsymbol{\Sigma})$ converges in Wasserstein-2 distance to $\Pi_{\kappa,\sigma^2}\otimes\mu$, where recall that $\Pi_{\kappa,\sigma^2}$ is the distribution of the random variable $X_{\kappa,\sigma^2}$. Second, the theorem implies that the empirical distribution of $\sqrt{p}{\boldsymbol{\hat{\beta}}}_n$ converges weakly to $\Pi_{\kappa,\sigma^2}$. To see this, apply \eqref{eq:thm} for the $\rm{PL}(2)$ function $f(x,y,z) = \psi(x)$ where $\psi:\mathbb{R}\rightarrow\mathbb{R}$ is a bounded Lipschitz test function. \subsection{Proof of Theorem \ref{thm:master_W2}} \vspace{5pt} Let ${\mtx{X}}\in\mathbb{R}^{n\times p}$ have zero-mean and normally distributed rows with a diagonal covariance matrix ${\boldsymbol{{\Sigma}}}=\operatorname{\mathbb{E}}[\vct{x}\x^T]$. Given a ground-truth vector $\betab^\star$ and labels $\vct{y}={\mtx{X}}\betab^\star+\sigma {\vct{z}},~{\vct{z}}\sim\mathcal{N}(0,{\mtx{I}}_n)$, we consider the least-squares problem subject to the minimum Euclidian norm constraint (as $\kappa=p/n>1$) given by \begin{align}\label{eq:PO_beta} \min_{{\boldsymbol{\beta}}}\frac{1}{2}\tn{{\boldsymbol{\beta}}}^2\quad\text{subject to}\quad \vct{y}={\mtx{X}}{\boldsymbol{\beta}}. \end{align} It is more convenient to work with the following change of variable: \begin{align}\label{eq:w} \vct{w}:=\sqrt{\boldsymbol{\Sigma}}({\boldsymbol{\beta}}-\betab^\star). \end{align} With this, the optimization problem in \eqref{eq:min_norm} can be rewritten as \begin{align}\label{eq:PO} \Phi({\mtx{X}})=\min_{\vct{w}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad {\mtx{\bar{X}}}\vct{w}=\sigma {\vct{z}}, \end{align} where we set ${\mtx{\bar{X}}}={\mtx{X}}\boldsymbol{\Sigma}^{-1/2}\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,1)$. First, using standard arguments, we show that the solution of \eqref{eq:PO} is bounded. Hence, we can constraint the optimization in a sufficiently large compact set without loss of generality. \begin{lemma}[Boundedness of the solution]\label{lem:bd_PO} Let $\widehat{\vct{w}}_n:=\widehat{\vct{w}}_n({\mtx{X}},{\vct{z}})$ be the minimizer in \eqref{eq:PO}. Then, with probability approaching 1, it holds that $\widehat{\vct{w}}_n\in\mathcal{B}$, where $$\mathcal{B}:=\left\{\vct{w}\,|\,\|\vct{w}\|_2\leq B_{+} \right\},\qquad B_+:=5\sqrt{\frac{\Sigma_{\max}}{\Sigma_{\min}}}\frac{\sqrt{\kappa}+1}{\sqrt{\kappa}-1}(\sqrt{\Sigma_{\max}\operatorname{\mathbb{E}}\left[B^2\right]} + \sigma). $$ \end{lemma} \begin{proof} First, we show that the min-norm solution ${\boldsymbol{\hat{\beta}}}={\mtx{X}}^T({\mtx{X}}\X^T)^{-1}\vct{y}$ of \eqref{eq:PO_beta} is bounded. Note that $\kappa>1$, thus ${\mtx{X}}\X^T$ is invertible wpa 1. We have, \begin{align} \tn{{\boldsymbol{\hat{\beta}}}_n}^2 = \vct{y}^T({\mtx{X}}\X^T)^{-1}\vct{y} \leq \frac{\tn{\vct{y}}^2}{\lambda_{\min}({\mtx{X}}\X^T)} = \frac{\tn{\vct{y}}^2}{\lambda_{\min}({\mtx{\bar{X}}}\boldsymbol{\Sigma}{\mtx{\bar{X}}}^T)} \leq \frac{\tn{\vct{y}}^2}{\lambda_{\min}({\mtx{\bar{X}}}\Xb^T)\,\Sigma_{\min}} = \frac{\tn{\vct{y}}^2}{\sigma_{\min}^2({\mtx{\bar{X}}})\,\Sigma_{\min}}. \label{eq:Ubb} \end{align} But, wpa 1, $ \sigma_{\min}({\mtx{\bar{X}}})/\sqrt{n} \geq \frac{1}{2}\left(\sqrt{\kappa}-1\right). $ Furthermore, $ \|\vct{y}\|_2 \leq \|{\mtx{\bar{X}}}\boldsymbol{\Sigma}^{1/2}\betab^\star\|_2 + \sigma\|{\vct{z}}\|_2 \leq \sigma_{\max}({\mtx{\bar{X}}})\sqrt{\Sigma_{\max}} \|\betab^\star\|_2 + \sigma\|{\vct{z}}\|_2. $ Hence, wpa 1, $$ \|\vct{y}\|_2/\sqrt{n} \leq 2(\sqrt{\kappa}+1)\sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}\left[B^2\right]} + 2\sigma, $$ where we used the facts that wpa 1: $\|z\|_2/\sqrt{n}\stackrel{{P}}{\longrightarrow} 1$, $\sigma_{\max}({\mtx{\bar{X}}})<\sqrt{2n}(\sqrt{\kappa}+1)$ and \cts{by Assumption \ref{ass:mu}}: $$ \|\betab^\star\|_2^2 = \frac{1}{p}\sum_{i=1}^{p}(\sqrt{p}\betab^\star_i)^2 \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}\left[B^2\right]. $$ Put together in \eqref{eq:Ubb}, shows that \begin{align} \tn{{\boldsymbol{\hat{\beta}}}_n} < \frac{2(\sqrt{\kappa}+1)\sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}\left[B^2\right]} + 2\sigma}{\sqrt{\Sigma_{\min}}(\sqrt{\kappa}-1)/2} =: \tilde{B}_+.\label{eq:bd_beta} \end{align} Recalling that $\widehat{\vct{w}}_n= \sqrt{\boldsymbol{\Sigma}}{\boldsymbol{\hat{\beta}}}_n - \sqrt{\boldsymbol{\Sigma}}\betab^\star$, we conclude, as desired, that wpa 1, $ \tn{\widehat{\vct{w}}_n} \leq \sqrt{\Sigma_{\max}}\tilde{B}_+ + \sqrt{\Sigma_{\max}} \sqrt{\operatorname{\mathbb{E}}[B^2]} \leq B_+. $ \end{proof} Lemma \ref{lem:bd_PO} implies that nothing changes in \eqref{eq:PO} if we further constrain $\vct{w}\in\mathcal{B}$ in \eqref{eq:PO}. Henceforth, with some abuse of notation, we let \begin{align}\label{eq:PO_bd} \Phi({\mtx{X}}):=\min_{\vct{w}\in\mathcal{B}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad {\mtx{\bar{X}}}\vct{w}=\sigma {\vct{z}}, \end{align} Next, in order to analyze the primary optimization (PO) problem in \eqref{eq:PO_bd} in apply the CGMT \cite{thrampoulidis2015regularized,thrampoulidis2018precise}. Specifically, we use the constrained formulation of the CGMT given by Theorem \ref{thm closed}. Specifically, the auxiliary problem (AO) corresponding to \eqref{eq:PO_bd} takes the following form with ${\vct{g}}\sim\mathcal{N}(0,{\mtx{I}}_n)$, $\vct{h}\sim\mathcal{N}(0,{\mtx{I}}_p)$, $h\sim \mathcal{N}(0,1)$ \begin{align} \phi({\vct{g}},\vct{h}) = \min_{\vct{w}{\in\mathcal{B}}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad \tn{{\vct{g}}}\tn{\vct{w}~{\sigma}}\leq \vct{h}^T\vct{w}+\sigma h.\label{eq:AO_con} \end{align We will prove the following techincal result about the AO problem. \begin{lemma}[Properties of the AO -- Overparameterized regime]\label{lem:AO} {Let the assumptions of Theorem \ref{thm:master_W2} hold.} Let $\phi_n=\phi({\vct{g}},\vct{h})$ be the optimal cost of the minimization in \eqref{eq:AO_con}. Define $\bar\phi$ as the optimal cost of the following deterministic min-max problem \begin{align}\label{eq:AO_det} \bar\phi:=\max_{u\geq 0}\min_{\tau>0}~ \mathcal{D}(u,\tau):=\frac{1}{2}\left({u\tau} + \frac{u\sigma^2}{\tau} - u^2\kappa\,\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] - {\operatorname{\mathbb{E}}\left[\frac{B^2}{1+\frac{u}{\tau}\Lambda}\right]} \right). \end{align} The following statements are true. \noindent{(i).}~The AO minimization in \eqref{eq:AO_con} is $\frac{1}{\Sigma_{\max}}$-strongly convex and has a unique minimizer $\hat{\vct{w}}^{\rm{AO}}_n:=\hat{\vct{w}}^{\rm{AO}}_n({\vct{g}},\vct{h})$. \noindent{(ii).}~In the limit of $n,p\rightarrow\infty, p/n=\kappa$, it holds that $\phi({\vct{g}},\vct{h})\stackrel{{P}}{\longrightarrow}\bar\phi$, i.e., for any $\varepsilon>0$: $$ \lim_{n\rightarrow\infty}\P\left(|\phi({\vct{g}},\vct{h})-\bar\phi|>\varepsilon\right) = 0. $$ \noindent{(iii).} The max-min optimization in \eqref{eq:AO_det} has a unique saddle point $(u_*,\tau_*)$ satisfying the following: $$ u_*/\tau_* = \xi\quad\text{and}\quad\tau_* = \gamma, $$ where $\xi, \gamma$ are defined in Definition \ref{def:Xi}. \noindent{(iv).}~Let $f:\mathbb{R}^3\rightarrow\mathbb{R}$ be a function in \fx{$\rm{PL}(3)$}. Let ${\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n={\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n({\vct{g}},\vct{h})=\boldsymbol{\Sigma}^{-1/2}\hat{\vct{w}}^{\rm{AO}}_n + \betab^\star$. Then, $$ \frac{1}{p}\sum_{i=1}^{p}f\left(\sqrt{p}{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}\right) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{(B,\Lambda,H)\sim\mu\otimes \mathcal{N}(0,1)}\left[f\left(X_{\kappa,\sigma^2}(B,\Lambda,H),B,\Lambda\right) \right]. $$ \fx{In particular, this holds for all functions $f\in {\cal{F}}$ defined in \eqref{eq:pdef}. \noindent{(v).}~\cts{The empirical distribution of ${\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n$ converges weakly to the measure of $X_{\kappa,\sigma^2}$, and also, for some absolute constant $C>0$: \begin{align}\label{eq:k_AO} \tn{{\boldsymbol{\hat{\beta}}^{\rm{AO}}}}^2 < C\quad\text{wpa 1.} \end{align} } \end{lemma} We prove Lemma \ref{lem:AO} in Section \ref{sec:proofAO}. \fx{We remark that Assumption \ref{ass:mu} on $W_4$-convergence of the joint empirical distribution of $\{(\boldsymbol{\Sigma}_{i,i},\sqrt{p}\boldsymbol{\beta}^\star_i)\}_{i\in[p]}$ is required in the proof of the statement (iv) above. More generally if $W_k$-convergence is known for some integer $k$, then statement (iv) above holds for test functions $f\in\rm{PL}(k-1)$. This is the first place in the proof of Theorem \ref{thm:master_W2}, where we use the assumption $f\in{\cal{F}}$; indeed, we show in Lemma \ref{lem:fL} that ${\cal{F}}_{\cal{L}}\subset{\cal{F}}\subset\rm{PL}(3)$. The second part is in proving the perturbation result in \eqref{eq:dev2show} below. Unlike the former, when proving the perturbation result, the requirement $f\in{\cal{F}}$ cannot be relaxed (e.g.~to $f\in\rm{PL}(k-1)$) by simply increasing the order of $W_k$-convergence in Assumption \ref{ass:mu}.} \subsubsection{Finalizing the proof of Theorem \ref{thm:master_W2}:} Here, we show how Lemma \ref{lem:AO} leads to the proof of Theorem \ref{thm:master_W2} when combined with the CGMT framework \cite{thrampoulidis2015regularized,thrampoulidis2018precise}. \cts{Let $f:\mathbb{R}^3\rightarrow\mathbb{R}$ be a function in ${\cal{F}}$, where ${\cal{F}}$ was defined in \eqref{eq:pdef}.} For convenience, define $$F_n({\boldsymbol{\hat{\beta}}}_n,\betab^\star,\boldsymbol{\Sigma}):=\frac{1}{p} \sum_{i=1}^{p} f\left(\sqrt{p}{\boldsymbol{\hat{\beta}}}_{n,i},\sqrt{p}\betab^\star_{i},\boldsymbol{\Sigma}_{ii}\right)\quad\text{and}\quad\alpha_*:=\operatorname{\mathbb{E}}_\mu\left[f(X_{\kappa,\sigma^2}(\Lambda,B,H),B,\Lambda)\right].$$ Fix any $\varepsilon>0$ and define the set \begin{align}\label{eq:S_set} \mathcal{S} = \mathcal{S}(\betab^\star,\boldsymbol{\Sigma}) =\big\{\vct{w}=\sqrt{\boldsymbol{\Sigma}}(\boldsymbol{\beta}-\boldsymbol{\beta}^\star) \in\mathcal{B} {~\big |~} |F_n({\boldsymbol{\beta}},\betab^\star,\boldsymbol{\Sigma})-\alpha_*|\geq 2\varepsilon\big\}. \end{align} \fy{With this definition, observe that, it suffices to prove that the solution $\hat\vct{w}_n=\sqrt{\boldsymbol{\Sigma}}({\boldsymbol{\hat{\beta}}}_n-\boldsymbol{\beta}^\star)$ of the PO in \eqref{eq:PO_beta} satisfies $\hat\vct{w}_n\not\in\mathcal{S}$ wpa 1.} To prove the desired, we need to consider the ``perturbed" PO and AO problems (compare to \eqref{eq:PO} and \eqref{eq:AO_con}) as: \begin{align}\label{eq:PO_S} \Phi_S({\mtx{X}})=\min_{\vct{w}\in\mathcal{S}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad {\mtx{\bar{X}}}\vct{w}=\sigma {\vct{z}}, \end{align} and \begin{align} \phi_S({\vct{g}},\vct{h})=\min_{\vct{w}\in\mathcal{S}} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2\quad\text{subject to}\quad \tn{{\vct{g}}}\tn{\vct{w}~{\sigma}}\leq \vct{h}^T\vct{w}+\sigma h.\label{eq:AO_S} \end{align Recall here, that ${\mtx{\bar{X}}}={\mtx{X}}\boldsymbol{\Sigma}^{-1/2}\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,1)$, ${\vct{g}}\sim\mathcal{N}(0,{\mtx{I}}_n)$, $\vct{h}\sim\mathcal{N}(0,{\mtx{I}}_p)$, $h\sim \mathcal{N}(0,1)$ and we have used the change of variables $\vct{w}:=\sqrt{\boldsymbol{\Sigma}}({\boldsymbol{\beta}}-\betab^\star)$ for convenience. Using \cite[Theorem 6.1(iii)]{thrampoulidis2018precise} it suffices to find costants $\bar\phi, \bar\phi_S$ and $\eta>0$ such that the following three conditions hold: \begin{enumerate} \item $\bar\phi_S \geq \bar\phi + 3\eta$, \item $\phi({\vct{g}},\vct{h}) \leq \bar\phi + \eta$, with probability approaching 1, \item $\phi_S({\vct{g}},\vct{h}) \geq \bar\phi_S - \eta$, with probability approaching 1. \end{enumerate} In what follows, we explicitly find $\bar\phi, \bar\phi_S,\eta$ such that the three conditions above hold. \vspace{5pt} \noindent\underline{Satisfying Condition 2}: Recall the deterministic min-max optimization in \eqref{eq:AO_det}. Choose $\bar\phi=\mathcal{D}(u_*,\tau_*)$ be the optimal cost of this optimization. From Lemma \ref{lem:AO}(ii), $\phi({\vct{g}},\vct{h})\stackrel{{P}}{\longrightarrow}\bar\phi$. Thus, for any $\eta>0$, with probability approaching 1: \begin{align}\label{eq:phi_lim} \bar\phi + \eta \geq \phi({\vct{g}},\vct{h}) \geq \bar\phi - \eta. \end{align} Clearly then, Condition 2 above holds for any $\eta>0$. \vspace{5pt} \noindent\underline{Satisfying Condition 3}: Next, we will show that the third condition holds for appropriate $\bar\phi$. Let $\hat{\vct{w}}^{\rm{AO}}_n=\hat{\vct{w}}^{\rm{AO}}_n({\vct{g}},\vct{h})$ be the unique minimizer of \eqref{eq:AO_con} as per Lemma \ref{lem:AO}(i), i.e., $\frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\hat{\vct{w}}^{\rm{AO}}_n+{\boldsymbol{\beta}}}^2 = \phi({\vct{g}},\vct{h})$. Again from Lemma \ref{lem:AO}, the minimization in \eqref{eq:AO_con} is $1/\Sigma_{\max}$-strongly convex in $\vct{w}$. Here, $\Sigma_{\max}$ is the upper bound on the eigenvalues of $\boldsymbol{\Sigma}$ as per Assumption \ref{ass:mu}. Thus, for any $\tilde\varepsilon>0$ and any feasible $\vct{w}$ the following holds (deterministically): \begin{align}\label{eq:sc} \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+{\boldsymbol{\beta}}}^2 \geq \phi({\vct{g}},\vct{h}) + \frac{\tilde\epsilon^2}{2{\Sigma_{\max}}},~\text{provided that}~ \|\vct{w}-\hat{\vct{w}}^{\rm{AO}}_n\|_2 \geq \tilde\epsilon. \end{align} Now, we argue that {wpa 1,} \begin{align}\label{eq:dev_arg} \text{for all}~\vct{w}\in \mathcal{S}~\text{it holds that}~\|\vct{w}-\hat{\vct{w}}^{\rm{AO}}_n\|_2\geq \tilde\varepsilon, \end{align} for an appropriate value of a constant $\tilde\varepsilon>0$. Consider any $\vct{w}\in\mathcal{S}$. First, by definition in \eqref{eq:S_set}, for $\boldsymbol{\beta}=\boldsymbol{\Sigma}^{-1/2}\vct{w}+\boldsymbol{\beta}^\star$ we have that $$ |F_n({\boldsymbol{\beta}},\betab^\star,\boldsymbol{\Sigma})-\alpha_*| \geq 2\varepsilon. $$ Second, by Lemma \ref{lem:AO}(iv), with probability approaching 1, $$ |F({\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n,\betab^\star,\boldsymbol{\Sigma}) - \alpha_*| \leq \epsilon. $$ Third, we will show that wpa 1, there exists universal constant $C>0$ such that \begin{align} |F_n({\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n,\betab^\star,\boldsymbol{\Sigma}) - F_n({\boldsymbol{\beta}},\betab^\star,\boldsymbol{\Sigma})| \leq C {\|{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n - {\boldsymbol{\beta}}\|_2}\label{eq:dev2show}. \end{align} Before proving \eqref{eq:dev2show}, let us argue how combining the above three displays shows the desired. Indeed, in that case, wpa 1, \begin{align*} 2\varepsilon &\leq |F_n({\boldsymbol{\beta}},\betab^\star,\boldsymbol{\Sigma})-\alpha_*| \leq |F_n({\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n,\betab^\star,\boldsymbol{\Sigma}) - F_n({\boldsymbol{\beta}},\betab^\star,\boldsymbol{\Sigma})| + |F_n({\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n,\betab^\star,\boldsymbol{\Sigma}) - \alpha_*| \\ &\leq \epsilon + C \,\|{\boldsymbol{\beta}}-{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n\|_2. \\ &\qquad\Longrightarrow \|{\boldsymbol{\beta}}-{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n\|_2 \geq {\varepsilon}/{C}=:\hat\varepsilon\\ &\qquad\Longrightarrow \|\vct{w}-\hat{\vct{w}}^{\rm{AO}}_n\|_2 \geq \hat\varepsilon\sqrt{\Sigma_{\min}}=:\tilde\varepsilon. \end{align*} In the last line above, we recalled that ${\boldsymbol{\beta}}=\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star$ and $\boldsymbol{\Sigma}_{i,i}\geq\Sigma_{\min},~i\in[p]$ by Assumption \ref{ass:mu}. This proves \eqref{eq:dev_arg}. Next, combining \eqref{eq:dev_arg} and \eqref{eq:sc}, we find that wpa 1, $ \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+{\boldsymbol{\beta}}}^2 \geq \phi({\vct{g}},\vct{h}) + \frac{\tilde\epsilon^2}{2\Sigma_{\max}},~\text{for all}~ \vct{w}\in\mathcal{S}. $ Thus, \begin{align} \phi_S({\vct{g}},\vct{h}) \geq \phi({\vct{g}},\vct{h}) + \frac{\tilde\epsilon^2}{2\Sigma_{\max}}.\notag \end{align} When combined with \eqref{eq:phi_lim}, this shows that \begin{align} \phi_S({\vct{g}},\vct{h}) \geq \bar\phi + \frac{\tilde\epsilon^2}{2\Sigma_{\max}} - \eta. \end{align} Thus, choosing $\bar\phi_S = \bar\phi + \frac{\tilde\epsilon^2}{2\Sigma_{\max}}$ proves the Condition 3 above. \vspace{3pt} \noindent{\textbf{Perturbation analysis via Pseudo-Lipschitzness (Proof of \eqref{eq:dev2show}).}} To complete the proof, let us now show \eqref{eq:dev2show}. Henceforth, $C$ is used to denote a universal constant whose value can change from line to line. \fy{Recall that $f\in {\cal{F}}$ where ${\cal{F}}:\mathbb{R}^2\times {\cal{Z}}\rightarrow\mathbb{R}$ is the set of $\rm{PL}(3)$ functions such that $f(\cdot,\cdot,z)$ is $\rm{PL}(2)$ for all $z\in{\cal{Z}}$. Suppose that the $\rm{PL}(2)$ constant of $f(\cdot,\cdot,z)$ is upper bounded over $z\in {\cal{Z}}$ by some $C>0$. We also let $C$ change from line to line for notational simplicity. Then, we have the following chain of inequalities: \begin{align} |F_n({\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n({\boldsymbol{\beta}},\betab^\star,\boldsymbol{\Sigma})| &=\frac{1}{p}\sum_{i=1}^p|f(\sqrt{p}{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i},\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})-f(\sqrt{p}{\boldsymbol{\beta}}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})| \notag\\ &\leq \frac{C}{p}\sum_{i=1}^p (1+ \|\sqrt{p}[\betab^\star_i,{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i}]\|_2 + \|\sqrt{p}[\betab^\star_i,{\boldsymbol{\beta}}_{i}]\|_2) \sqrt{p}|{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i}-{\boldsymbol{\beta}}_{i}|\notag\\ &\leq C \Big(1+ \frac{1}{\sqrt{p}}\big(\sum_{i=1}^{p}\|\sqrt{p}[\betab^\star_i,{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i}]\|_2^2\big)^{1/2} + \frac{1}{\sqrt{p}}\big(\sum_{i=1}^p\|\sqrt{p}[\betab^\star_i,{\boldsymbol{\beta}}_{i}]\|_2^2\big)^{1/2}\Big) \|{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n-{\boldsymbol{\beta}}\|_2\notag\\ &\leq C \left(1+ \max\{\|\betab^\star\|_2^2,\|{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n\|_2^2,\|{\boldsymbol{\beta}}\|_2^2\}^{1/2} \right) \|{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n-{\boldsymbol{\beta}}\|_2.\label{eq:fcase_main} \end{align} In the second line above, we used the fact that $f(\cdot,\cdot,z)$ is $\rm{PL}(2)$. The third line follows by Cauchy-Schwartz inequality. Finally, in the last line, we used the elementary fact that $a+b+c\leq 3\max\{a,b,c\}$ for $a=2\sum_{i=1}^p(\betab^\star_i)^2$ and $b=\sum_{i=1}^p({\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i})^2$ and $c=\sum_{i=1}^p{\boldsymbol{\beta}}_{i}^2$.} \begin{comment} First, consider the case $f=f_{\cal{L}}\in{\cal{F}}_{\cal{L}}$, i.e., $f(x,y,z) = z(y-g(x))^2$ for Lipschitz $g$. We have the following chain of inequalities: \begin{align} |F_n({\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n({\boldsymbol{\beta}},\betab^\star,\boldsymbol{\Sigma})| &= \frac{1}{p}\sum_{i=1}^p|\bSi_{i,i}|\left| (\sqrt{p}\betab^\star_i-g(\sqrt{p}{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i}))^2-(\sqrt{p}\betab^\star_i-g(\sqrt{p}{\boldsymbol{\beta}}_{i}))^2 \right|\notag\\ &\leq \Sigma_{\max} \frac{1}{p}\sum_{i=1}^p \left| (\sqrt{p}\betab^\star_i-g(\sqrt{p}{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i}))^2-(\sqrt{p}\betab^\star_i-g(\sqrt{p}{\boldsymbol{\beta}}_{i}))^2 \right|\notag\\ &\leq {C} \Sigma_{\max} \frac{1}{p}\sum_{i=1}^p (1+ \|\sqrt{p}[\betab^\star_i,{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i}]\|_2 + \|\sqrt{p}[\betab^\star_i,{\boldsymbol{\beta}}_{i}]\|_2) \sqrt{p}|{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i}-{\boldsymbol{\beta}}_{i}|\notag\\ &\leq {C} \Sigma_{\max} \Big(1+ \frac{1}{\sqrt{p}}\big(\sum_{i=1}^{p}\|\sqrt{p}[\betab^\star_i,{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i}]\|_2^2\big)^{1/2} + \frac{1}{\sqrt{p}}\big(\sum_{i=1}^p\|\sqrt{p}[\betab^\star_i,{\boldsymbol{\beta}}_{i}]\|_2^2\big)^{1/2}\Big) \|{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n-{\boldsymbol{\beta}}\|_2\notag\\ &\leq C \left(1+ \max\{\|\betab^\star\|_2^2,\|{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n\|_2^2,\|{\boldsymbol{\beta}}\|_2^2\}^{1/2} \right) \|{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n-{\boldsymbol{\beta}}\|_2.\label{eq:fcase1} \end{align} In the second line above, we used boundedness of $\bSi_{i,i}$ as per Assumption \ref{ass:mu}. {In the third line, we used the fact that the function $\psi(a,b) = (a-g(b))^2$ is $\rm{PL}(2)$ as the quadratic of a Lipschitz function.} The fourth line follows by Cauchy-Schwartz inequality. Finally, in the last line, we used the elementary fact that $a+b+c\leq 3\max\{a,b,c\}$ for $a=2\sum_{i=1}^p(\betab^\star_i)^2$ and $b=\sum_{i=1}^p({\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i})^2$ and $c=\sum_{i=1}^p{\boldsymbol{\beta}}_{i}^2$. Second, consider the case $f\in\rm{PL}(2)$. Let $\vct{a}_i=(\sqrt{p}{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i},\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$ and $\vct{b}_i=(\sqrt{p}{\boldsymbol{\beta}}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$, for $i\in[p]$. A similar chain of inequality holds: \begin{align} |F_n({\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n,\betab^\star,\boldsymbol{\Sigma}) - F_n({\boldsymbol{\beta}},\betab^\star,\boldsymbol{\Sigma})| &\leq \frac{{C}}{p}\sum_{i=1}^p (1+\max\{\|\vct{a}_i\|_2,\|\vct{b}_i\|_2\})\|\vct{a}_i-\vct{b}_i\|_2\notag \\ &= \frac{{C}}{p}\sum_{i=1}^p \left(1+\max\{\|\vct{a}_i\|_2,\|\vct{b}_i\|_2\}\right)\cdot|\sqrt{p}{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i} - \sqrt{p}{\boldsymbol{\beta}}_i|\notag\\ &\leq {C}\left(1+\max\{\frac{1}{p}\sum_{i=1}^p \|\vct{a}_i\|_2^{2},\frac{1}{p}\sum_{i=1}^p\|\vct{b}_i\|_2^{2}\} \right)^{1/2}{\|{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n - {\boldsymbol{\beta}}\|_2}\notag\\ &\leq C\left(1+\max\{\|{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n\|_2^2,\|\betab^\star\|_2^2,\|{\boldsymbol{\beta}}\|_2^2,\frac{1}{p}\sum_{i=1}^p\bSi_{i,i}^2\} \right)^{1/2}{\|{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n - {\boldsymbol{\beta}}\|_2}\notag\\ &\leq C\Sigma_{\max}^2\left(1+\max\{\|{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n\|_2^2,\|\betab^\star\|_2^2,\|{\boldsymbol{\beta}}\|_2^2\} \right)^{1/2}{\|{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n - {\boldsymbol{\beta}}\|_2}.\label{eq:fcase2} \end{align} The first inequality uses the fact that $f\in\rm{PL}(2)$. The second inequality in the third line follows by Cauchy-Schwartz. The last inequality used Assumption \ref{ass:mu} on boundedness of $\bSi_{i,i}$. \end{comment} Hence, it follows from \eqref{eq:fcase_main} that in order to prove \eqref{eq:dev2show}, we need to show boundedness of the following terms: $\|{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n\|_2$, $\|\betab^\star\|_2$ and $\|{\boldsymbol{\beta}}\|_2$. {By feasibility of ${\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n$ and ${\boldsymbol{\beta}}$, we know that ${\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n,{\boldsymbol{\beta}}\in\mathcal{B}$. Thus, the desired $\|{\boldsymbol{\beta}}\|_2<\infty$ and $\|{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n\|_2<\infty$ follow directly by Lemma \ref{lem:bd_PO} (Alternatively, for ${\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n$ we conclude the desired by directly applying Lemma \ref{lem:AO}(v)).} Finally, to prove $\|\betab^\star\|_2<\infty$, note that $$ \|\betab^\star\|_2^2 =\frac{1}{p}\sum_{i=1}^p(\sqrt{p}\betab^\star_i)^2, $$ \cts{which is bounded wpa 1 by Assumption \ref{ass:mu}, which implies bounded second moments of $\sqrt{p}\betab^\star$. } This completes the proof of \eqref{eq:dev2show}, as desired. \vspace{5pt} \noindent\underline{Satisfying Condition 1:} To prove Condition 1, we simply pick $\eta$ to satisfy the following \begin{align} \bar\phi_S > \bar\phi + 3 \eta ~\Leftarrow~ \bar\phi + \frac{\tilde\epsilon^2}{2\Sigma_{\max}} - \eta \geq \bar\phi + 3 \eta ~\Leftarrow~ \eta \leq \frac{\tilde\epsilon^2}{8\Sigma_{\max}}.\notag \end{align} This completes the proof of Theorem \ref{thm:master_W2}. ~~~~ ~~~~ \section{Supporting Results on CGMT}\label{SM cgmt res} The following theorem replaces the compactness constraint with closedness in the CGMT and is borrowed from \cite{li2020exploring}. For related statements see also \cite[App.~A]{deng2019model}. \begin{theorem} [CGMT with Closedness Constrains]\label{thm closed} Let $\psi$ be a convex function obeying $\lim_{\tn{\vct{w}}\rightarrow\infty}\psi(\vct{w})=\infty$. Given a closed set $\mathcal{S}$, define \begin{align} \Phi_\lambda({\mtx{X}})&=\min_{\vct{w}\in\mathcal{S}}\lambda\tn{{\mtx{X}}\vct{w}}+\psi(\vct{w})\\ \phi_\lambda({\vct{g}},\vct{h})&=\min_{\vct{w}\in\mathcal{S}}\lambda(\tn{\vct{w}}\tn{{\vct{g}}}-\vct{h}^T\vct{w})_++\psi(\vct{w}), \end{align} and \begin{align} &\Phi_\infty({\mtx{X}})=\min_{\vct{w}\in\mathcal{S},{\mtx{X}}\vct{w}=0}\psi(\vct{w})\\ &\phi_\infty({\vct{g}},\vct{h})=\min_{\vct{w}\in\mathcal{S},\tn{\vct{w}}\tn{{\vct{g}}}\leq \vct{h}^T\vct{w}}\psi(\vct{w}). \end{align} For all $\lambda\in[0,\infty)\cup\{\infty\}$, we have that \begin{itemize} \item $\mathbb{P}(\Phi_\lambda({\mtx{X}})<t)\leq2\mathbb{P}(\phi_\lambda({\mtx{X}})\leq t)$. \item If $\mathcal{S}$ is additionally convex, we additionally have that $\mathbb{P}(\Phi_\lambda({\mtx{X}})>t)\leq2\mathbb{P}(\phi_\lambda({\mtx{X}})\geq t)$. Combining with the first statement, this implies that for any $\mu,t>0$ \[ \mathbb{P}(|\Phi_\lambda({\mtx{X}})-\mu|>t)\leq2\mathbb{P}(|\phi_\lambda({\mtx{X}})-\mu|\geq t) \] \end{itemize} \end{theorem} \cmt{ \section{Proof of Constrained CGMT} \subsection{Proof for the convex case} \begin{lemma} \label{lem convex}Given a convex and compact $\mathcal{S}$, define the PO and AO problem \begin{align} &\Phi_\infty({\mtx{X}})=\min_{\vct{w}\in\mathcal{S},{\mtx{X}}\vct{w}=0}\psi(\vct{w})\\ &\phi_\infty({\vct{g}},\vct{h})=\min_{\vct{w}\in\mathcal{S},\tn{\vct{w}}\tn{{\vct{g}}}\leq \vct{h}^T\vct{w}}\psi(\vct{w}). \end{align} Suppose ${\mtx{X}},{\vct{g}},\vct{h}\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,1)$. Then, we have that \begin{align} \mathbb{P}(\Phi_\infty({\mtx{X}})> t)\leq2\mathbb{P}(\phi_\infty({\vct{g}},\vct{h})\geq t). \end{align} \end{lemma} \subsection{Proof for the general case} \begin{lemma} \label{lem general constraint}Given a compact set $\mathcal{S}$, define the PO and AO problems as in Lemma \ref{lem convex}. We have that \begin{align} \mathbb{P}(\Phi_\infty({\mtx{X}})<t)\leq2\mathbb{P}(\phi_\infty({\vct{g}},\vct{h})< t). \end{align} \end{lemma} \begin{proof} The proof is similar to that of Lemma \ref{lem convex}. For a general compact set $\mathcal{S}$, application of Gordon's theorem yields the one-sided bound \begin{align} \mathbb{P}(\Phi_\lambda({\mtx{X}})<t)\leq2\mathbb{P}(\phi_\lambda({\vct{g}},\vct{h})\leq t). \end{align} To move from finite $\lambda$ to infinite, we make use of Lemma \ref{lem continuous limit}. Define the indicator function $E_\lambda=1_{\Phi_\lambda({\mtx{X}})\leq t}$. Using Lemma \ref{lem continuous limit}, for any choice of ${\mtx{X}}$, $\lim_{\lambda\rightarrow\infty}E_\lambda=\lim_{\lambda\rightarrow\infty}1_{\Phi_\lambda({\mtx{X}})< t}=1_{\Phi_\infty({\mtx{X}})< t}$. Note again that, if the problem is infeasible, then $\lim_{\lambda\rightarrow\infty}E_\lambda=E_\infty=0$. To proceed, we are in a position to apply Dominated Convergence Theorem to find \begin{align} &\lim_{\lambda \rightarrow\infty}\operatorname{\mathbb{E}}[E_\lambda]=\operatorname{\mathbb{E}}[E_\infty]\iff\mathbb{P}(\Phi_\infty({\mtx{X}})< t)=\lim_{\lambda\rightarrow\infty}\mathbb{P}(\Phi_\lambda({\mtx{X}})< t). \end{align} Applying the identical argument on $\phi_{{\vct{g}},\vct{h}}$ to find $\mathbb{P}(\phi_\infty({\vct{g}},\vct{h})\leq t)=\lim_{\lambda\rightarrow\infty}\mathbb{P}(\phi_\lambda({\vct{g}},\vct{h})\leq t)$, we obtain the desired relation \begin{align} \mathbb{P}(\Phi_\infty({\mtx{X}})< t)&=\lim_{\lambda\rightarrow\infty}\mathbb{P}(\Phi_\lambda({\mtx{X}})< t)\\ &\leq 2\lim_{\lambda\rightarrow\infty}\mathbb{P}(\phi_\lambda({\vct{g}},\vct{h})\leq t)\\ &= 2\mathbb{P}(\phi_\infty({\vct{g}},\vct{h})\leq t). \end{align} \end{proof} \begin{lemma}\label{lem continuous limit} Let $\mathcal{S}$ be a compact set and $\psi(\cdot)$ be a continuous function and $f(\vct{w})$ be a non-negative continuous function. Then \[ \lim_{\lambda\rightarrow\infty}\min_{\vct{w}\in\mathcal{S}}\lambda f(\vct{w})+\psi(\vct{w})=\min_{\vct{w}\in\mathcal{S},f(\vct{w})=0}\psi(\vct{w}) \] Thus, setting $f(\vct{w})=\tn{{\mtx{X}}\vct{w}}$ and $f(\vct{w})=\tn{\vct{w}}\tn{{\vct{g}}}-\vct{h}^T\vct{w}$, we have that \begin{align*} &\lim_{\lambda\rightarrow\infty}\Phi_{\lambda}({\mtx{X}})=\Phi_{\infty}({\mtx{X}})\\ &\lim_{\lambda\rightarrow\infty}\phi_{\lambda}({\vct{g}},\vct{h})=\phi_{\infty}({\vct{g}},\vct{h}). \end{align*} \end{lemma}} \section{Conclusions and Future Directions}\label{sec discuss} This paper sheds light on under-explored phenomena in pruning practices for neural network model compression. On a theoretical level, we prove an accurate distributional characterization (DC) for the solution of overparameterized least-squares for linear models with correlated Gaussian features. Our DC allows to precisely characterize the pruning performance of popular pruning methods, such as magnitude pruning. Importantly, our DC combined with a linear Gaussian equivalence, leads to precise analytic formulas for the pruning performance of nonlinear random feature models. On the experimental side, we provide a thorough study of overparameterization and pruning with experiments on linear models, random features and neural nets with growing complexity. Our experiments reveal striking phenomena such as a novel double descent behavior for model pruning and the power of overparameterization. They also shed light on common practices such as retraining after pruning. Going forward, there are several exciting directions to pursue. First, it would be insightful to study whether same phenomena occur for other loss functions in particular for cross-entropy. Second, this work focuses on unregularized regression tasks and it is important to identify optimal regularization schemes for pruning purposes. For instance, should we use classical $\ell_1/\ell_2$ regularization or can we refine them by injecting problem priors such as covariance information? Finally, going beyond pruning, using DC, one can investigate other compression techniques that process the output of the initial overparameterized learning problem, such as model quantization and distillation. \section{Motivating Examples}\label{sec mot} \begin{figure}[t!] \begin{subfigure}{1.5in}\vspace{-5pt} \centering \begin{tikzpicture} \node at (0,0) {\includegraphics[scale=0.2]{figs/FLAT_SIM_s10_n30_p100_SCL25}}; \node at (-2.1,0) [rotate=90,scale=.9]{Test Risk}; \node at (0,-1.7) [scale=.9]{Problem Size ($k/p$)} \end{tikzpicture}\caption{\small{Identity covariance, spiked latent weights.}}\label{fig1a}\vspace{-0.2cm} \end{subfigure}~~~~~\begin{subfigure}{1.5in}\vspace{-5pt} \centering \begin{tikzpicture} \node at (0,0) {\includegraphics[scale=0.2]{figs/SPIKE_SIM_s10_n30_p100_SCL25}}; \node at (0,-1.7) [scale=.9]{Problem Size ($k/p$)} \end{tikzpicture}\caption{\small{Spiked covariance, identical latent weights.}}\label{fig1b}\vspace{-0.2cm} \end{subfigure}\caption{\small{Our theoretical predictions for various pruning strategies in linear models with $s/p=0.1$ and $n/p=0.3$. We solve ERM using the first $k$ features and then prune to obtain an $s$-sparse model. The vertical dashed line shows the $k=s$ point. The horizontal dashed line highlights the minimum risk among all underparameterized solutions ($k\leq n$) and all solutions obtained by a final retraining. \fy{Retraining curves are omitted here, but they can be found in Fig.~7 of SM.}}}\label{fig1}\vspace{-15pt} \end{figure} \subsection{Linear Gaussian Problems} We begin our study with linear Gaussian problems (LGP), which we formally define as follows. \begin{definition}[Linear Gaussian Problem (LGP)] \label{def LGP}Given latent vector ${\boldsymbol{\beta}}^\star\in\mathbb{R}^d$, covariance ${\boldsymbol{{\Sigma}}}$ and noise level $\sigma$, assume that each example in $\mathcal{S}$ is generated independently as $y_i=\vct{x}_i^T{\boldsymbol{\beta}}^\star+ \sigma z_i$ where $z_i\sim\mathcal{N}(0,1)$ and $\vct{x}_i\sim\mathcal{N}(0,{\boldsymbol{{\Sigma}}})$. Additionally, the map $\phi(\cdot)$ is identity and $p=d$. \end{definition} Albeit simple, LGPs are of fundamental importance for the following reasons: (1) We show in Sec. \ref{sec main} that our theoretical framework rigorously characterizes pruning strategies for LGPs; (2) Through a ``linear Gaussian equivalence", we will use our results for linear models to obtain analytic predictions for nonlinear random features; (3) Our theoretical predictions and numerical experiments discussed next demonstrate that LGPs already capture key phenomena observed in more complex models (e.g., Fig. \ref{figNN}). In Fig.~\ref{fig1}, we consider LGPs with diagonal covariance ${\boldsymbol{{\Sigma}}}$. We set the sparsity level $s/p=0.1$ and the relative dataset size $n/p=0.3$. To parameterize the covariance and ${\boldsymbol{\beta}}^\star$, we use a {\em{spiked}} vector $\boldsymbol{\lambda}$, the first $s$ entries of which are set equal to $C=25\gg 1$ and the remaining entries equal to $1$. $\boldsymbol{\lambda}$ corresponds to the latent saliency score (cf. ~\eqref{saliency eq}) of the indices. To understand the role of overparameterization, we vary the number of features used in the optimization. Specifically, we solve \eqref{eq:ERM} with $\Delta=[k]$ and vary the number of features $k$ from $0$ to $p$. Here we consider the {\em{train$\rightarrow$prune}} algorithm, where we first solve for ${\boldsymbol{\hat{\beta}}}([k])$ and obtain our pruned model ${\boldsymbol{\hat{\beta}}}^P_s([k])$ by applying magnitude, Hessian or Oracle pruning (cf. ~$P\in \{M,H,O\}$). Since $\boldsymbol{\lambda}$ is non-increasing, the indices are sorted by saliency score; thus, Oracle pruning always picks the first $s$ indices. Solid lines represent analytic predictions, while markers are empirical results. The vertical dashed line is the sparsity level $s/p$. \cmt{confusing about why setups of Fig.~\ref{fig1a}, \ref{fig1b}. Are we trying to keep saliency score the same?} In Fig.~\ref{fig1a}, we set ${\boldsymbol{{\Sigma}}}={\mtx{I}}_p$ and ${\boldsymbol{\beta}}^\star=\sqrt{\boldsymbol{\lambda}}$. Note, that the analytic curves correctly predict the test risk and the double descent behavior. Observe that the Hessian and Magnitude pruning coincide here, since the diagonal of the empirical covariance is essentially identity. In contrast, Fig.~\ref{fig1b} emphasizes the role of the feature covariance by setting ${\boldsymbol{{\Sigma}}}=\text{diag}(\boldsymbol{\lambda})$ and ${\boldsymbol{\beta}}^\star$ to be the all ones vector. In this scenario, we observe that Hessian pruning performs better compared to Fig.~\ref{fig1a} and also outperforms Magnitude pruning. This is because the empirical covariance helps distinguish the salient indices. Importantly, for Hessian and Oracle pruning, the optimal sparse model is achieved in the highly overparameterized regime $k=p$. Notably, the achieved performance at $k=p$ is strictly better than the horizontal dashed line, which highlights the optimal risk among all underparameterized solutions $k\leq n$ and all retraining solutions (see also SM Sec. A). This has two striking consequences. First, {\em{retraining can in fact hurt the performance}}; because the {\em{train$\rightarrow$prune}} performance at $k=p$ is strictly better than {\em{train$\rightarrow$prune$\rightarrow$retrain}} for all $k$. Second, {\em{overparameterized pruning can be provably better than solving the sparse model with the knowledge of the most salient features}} as $k=p$ is also strictly better than $k=s$. \begin{figure}[t!] \centering \begin{tikzpicture} \node at (0,0) {\includegraphics[scale=0.28]{figs2/RF_4s_80_n200_p1500}}; \node at (-3.1,0) [rotate=90,scale=1.]{Test Risk}; \node at (0,-2.2) [scale=.9]{Overparameterization ($p/n$)} \end{tikzpicture} \vspace{-10pt} \caption{\small{Illustration of the mismatch between pruning with retraining (red markers) and pruning with fresh samples (cyan markers/line). The setting here is exactly the same as in Fig.~\ref{figRF}, but we only show the case of sparsity $4s$ for which the mismatch is observed. Observe that our analytical predictions accurately capture the risk of retraining with fresh samples. However, we observe a discrepancy with the true risk of retraining (without fresh samples) around the interpolation threshold. Also shown the risk of the original ERM solution before pruning (in blue) and of the magnitude-pruned model (before any retraining). } } \label{figRF2}\vspace{-15pt} \end{figure} \subsection{Random Features Regression} We relate an ERM problem \eqref{eq:ERM} with nonlinear map $\phi$ to an equivalent LGP. This will allow us to use our theoretical results about the latter to characterize the properties of the original nonlinear map. We ensure the equivalence by properly setting up the LGP to exhibit similar second order statistics as the original problem. \begin{definition}[Equivalent Linear Problem] Given distribution $(\vct{x},y)$ $\sim\mathcal{D}$, the equivalent LGP(${\boldsymbol{\beta}},{\boldsymbol{{\Sigma}}},\sigma$) with $n$ samples is given with parameters ${\boldsymbol{{\Sigma}}}=\operatorname{\mathbb{E}}[\vct{x}\x^T]$, ${\boldsymbol{\beta}}^\star={\boldsymbol{{\Sigma}}}^{-1}\operatorname{\mathbb{E}}[y\vct{x}]$ and $\sigma=\operatorname{\mathbb{E}}[(y-\vct{x}^T{\boldsymbol{\beta}}^\star)^2]^{1/2}$. \end{definition} In Section \ref{sec main}, we formalize the DC of LGPs, which enables us to characterize pruning/retraining dynamics. Then, we empirically verify that DC and pruning dynamics of equivalent LGPs can successfully predict the original problem \eqref{eq:ERM} with non-linear features. The idea of setting up and studying equivalent LGPs as a proxy to nonlinear models, has been recently used in the emerging literature of high-dimensional learning, for predicting the performance of the original ERM task \cite{montanari2019generalization,goldt2020gaussian,abbasi2019universality,derezinski2019exact}. This work goes beyond prior art, which focuses on ERM, by demonstrating that we can also successfully predict the pruning/retraining dynamics. Formalizing the performance equivalence between LGP and equivalent problem is an important future research avenue and it can presumably be accomplished by building on the recent high-dimensional universality results such as \cite{oymak2018universality,hu2020universality,abbasi2019universality,goldt2020gaussian}. In Fig. \ref{figRF}, we study random feature regression to approximate a synthetic nonlinear distribution. Specifically, data has the following distribution: Given input $\vct{a}\sim\mathcal{N}(0,{\mtx{I}}_d)$, we generate random unit norm ${\boldsymbol{\beta}}^1\in\mathbb{R}^d,{\boldsymbol{\beta}}^2\in\mathbb{R}^d$ and set the label to be a quadratic function given by $y=\vct{a}^T{\boldsymbol{\beta}}^1+(\vct{a}^T{\boldsymbol{\beta}}^2)^2$. Then, we fix ${\mtx{R}}\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,1)$ and we generate ReLU features $\vct{x}=\text{ReLU}({\mtx{R}}\vct{a})$, where ${\mtx{R}}$ corresponds to the input layer of a two-layer network. The markers in Fig. \ref{figRF} are obtained by solving RFR and pruning and retraining with varying sparsity targets ($s,2s,4s$ with $s/n=10\%$). Here, $d=10, n=200$. For each marker, the results are averages of 50 ${\mtx{R}}\in\mathbb{R}^{p\times d}$ realizations and 10 iterations for each choice of ${\mtx{R}}$. The lines are obtained via our DC of the equivalent LGP (by using Defs.~\ref{aux_def} and \ref{RT_def}) where the latent parameter ${\boldsymbol{\beta}}^\star$, noise $\sigma$ and the covariance ${\boldsymbol{{\Sigma}}}$ of the RFR problem are calculated for fixed realization of the input layer ${\mtx{R}}$ (similarly averaged over 50 random ${\mtx{R}}$). Our theory and empirical curves exhibit a good match. The results demonstrate the importance of overparameterization for RF pruning, which corresponds to picking {\em{random features smartly}}. Here, the coefficients of least-squares act like a scoring function for the saliency of random features and capture how well they are aligned with the target function. The fact that the risk of the pruned models is minimized in the overparameterized regime implies that least-squares regression succeeds in properly selecting salient random features from a larger candidate set. In the context of deep learning, our discussion can be interpreted as {\em{pruning hidden nodes of the network}}. \noindent\textbf{Predicting retraining performance.} As discussed in Sec.~\ref{sec main} and Def.~\ref{RT_def}, for the retraining stage, our DC is accomplished by assuming that retraining phase uses $n$ fresh training examples (i.e.~a new dataset $\mathcal{S}_{\text{fresh}}$). Let us denote the resulting model by ${\boldsymbol{\hat{\beta}}}^{RT}_{\text{fresh}}$. Perhaps surprisingly, Fig.~\ref{figRF} shows that this DC correctly captures the performance of ${\boldsymbol{\hat{\beta}}}^{RT}$ with the exception of the red curve ($4s$). Fig.~\ref{figRF2} focuses on this instance and shows that our DC indeed perfectly predicts the fresh retraining performance and verifies the slight empirical mismatch between ${\boldsymbol{\hat{\beta}}}^{RT}$ and ${\boldsymbol{\hat{\beta}}}^{RT}_{\text{fresh}}$. \vspace{-6pt} \subsection{Neural Network Experiments}\label{ssec:NNE} Finally, we study pruning deep neural networks. Inspired by \cite{nakkiran2019deep}, we train ResNet-20 with changeable filters over CIFAR-10. Here, the filter number $k$ is equivalent to the width/channel of the model. As the width of ResNet-20 changes, the fitting performance of the dataset varies. Here, we apply {\em{train$\rightarrow$prune$\rightarrow$retrain}}. Select $s$ as the sparsity target and $s$-filter ResNet-20 model as the base model with $N_s$ parameters. First, we train a dense model with $k$ filters and $N_k$ parameters, $N_k\gg N_s$, and prune it by only keeping the largest $N_s$ entries in absolute value non-zero. $N_k$ grows approximately quadratically in $k$. Now, the sparse model shares the same number of parameters amenable to training as the base model. Finally, we retain the pruned network and record its performance on the same dataset and same configuration. In Fig.~\ref{figNN}, we plot the training and test errors of dense and sparse models. All the neural experiments are trained with Adam optimization and $0.001$ learning rate for $1000$ epochs, with data augmentation. Green, yellow and red lines correspond to $5$, $8$ or $10$ sparsity targets, with around 28,000, 70,000 and 109,000 trainable parameters, respectively. As the width $k$ grows, the training and test errors decrease for all $5$-,$8$-,$10$-filter base models, except for the shaded double descent range. These experiments again verify the main insight revealed to us by studying simpler linear and random-feature models, that is, training a larger model, followed by appropriate pruning, can preform better than training a small model from the beginning. Another worth-mentioning observation is that with appropriate sparsity level (here, $10$) the pruned model has prediction performance comparable to the dense model. Finally and interestingly, the test error dynamics of the pruned model exhibit a double descent that resembles that of the dense model (previously observed in \cite{nakkiran2019deep}). \section{Introduction} Large model size and overparameterization in deep learning are known to improve generalization performance \cite{neyshabur2017geometry}, and, state-of-the-art deep neural networks (DNNs) can be outrageously large. However, such large models are not suitable for certain important application domains, such as mobile computing \cite{tan2019mnasnet,sandler2018mobilenetv2}. Pruning algorithms aim to address the challenge of building lightweight DNNs for such domains. While there are several pruning methods, their common goal is to compress large DNN models by removing weak connections/weights with minimal decline in accuracy. Here, a key empirical phenomenon is that {\em{it is often better to train and prune a large model rather than training a small model from scratch}}. Unfortunately, the mechanisms behind this phenomenon are poorly understood especially for practical gradient-based algorithms. This paper sheds light on this by answering: {\em{What are the optimization and generalization dynamics of pruning overparameterized models? Does gradient descent naturally select the good weights?}} \vspace{3pt} \noindent{\bf{Contributions:}} We analytically study the performance of popular pruning strategies. First, we analyze linear models, and then, generalize the results to nonlinear feature maps. Through extensive simulations, we show that our analytical findings predict similar behaviors in more complex settings. \noindent\textbf{(a)} {\bf{Distributional characterization (DC):}} The key innovation facilitating our results is a theoretical characterization of the distribution of the solution of overparameterized least-squares. This DC enables us to accurately answer {\em{``what happens to the accuracy if X\% of the weights are pruned?''}}. \noindent\textbf{(b)} {\bf{Benefits of overparameterization:}} Using DC, we {obtain rigorous precise characterizations of the pruning performance in linear problems. Furthermore, we use, so called ``linear gaussian equivalences", to obtain sharp analytic predictions for nonlinear maps, which we verify via extensive numerical simulations.} By training models of growing size and compressing them to fixed sparsity, we identify a novel double descent behavior, where the risk of the pruned model is {consistently} minimized in the overparameterized regime. Using our theory, we uncover rather surprising scenarios where pruning an overparameterized model is provably better than training a small model with the exact information of optimal nonzero locations. \noindent\textbf{(c)} {\bf{Benefits of retraining:}} An important aspect of pruning is retraining the model using the favorable nonzero locations identified during the initial training. We show that retraining can actually hurt the performance when features are uncorrelated. However, it becomes critical as correlations increase. Importantly, we devise the DC of the {\em{train$\rightarrow$prune$\rightarrow$retrain process}} (see Figs.~\ref{figRF} and \ref{figRF2} and the discussion around Def.~\ref{RT_def} for details), and, we demonstrate that it correctly captures the pruning performance of random features that are known to be good proxies for understanding DNN behavior \cite{jacot2018neural}. {We anticipate that our techniques towards establishing the DC of the overparameterized problems might be useful, beyond the context of pruning, in other statistical inference tasks that require careful distributional studies.} \begin{figure}[t!] \centering \begin{tikzpicture} \node at (0,0) {\includegraphics[scale=0.33]{figs/CIFAR10_New_DD}}; \node at (-3.5,0) [rotate=90,scale=1.]{Training / Test Error}; \node at (0,-2.6) [scale=.9]{Width Parameter (\# of filters $k$)} \end{tikzpicture} \vspace{-10pt} \caption{\small{We train sparse ResNet-20 models on the CIFAR-10 dataset with varying width (i.e. number of filters) and sparsity targets. The width parameter controls the overall model size. The solid (resp. dashed) lines are test (resp. training) errors. The blue line corresponds to training of a dense model with width-$k$. The other three curves correspond to sparsity targets $s\in\{5,8,10\}$, for which a dense model of width-$k$ is first pruned to achieve the exact same number of nonzeros as a dense model of width-$s$ and then retrained over the identified nonzero pattern. Surprisingly, all curves interpolate (achieve zero training error) around the same width parameter despite varying sparsity. The best test error is always achieved in the overparameterized regime (large width). Test error curves have two local minima which uncovers a novel double descent phenomena for pruning. {The shaded region highlights the transition to zero training error, where the test error peaks.}}} \label{figNN}\vspace{-15pt} \end{figure} \subsection{Prior Art} This work relates to the literature on model compression and overparameterization in deep learning. \vspace{-2pt}\noindent {\bf{Neural network pruning:}} Large model sizes in deep learning have led to a substantial interest in model pruning/quantization \cite{han2015deep,hassibi1993second,lecun1990optimal}. DNN pruning has a diverse literature with various architectural, algorithmic, and hardware considerations \cite{sze2017efficient,han2015learning}. The pruning algorithms can be applied before, during, or after training a dense model \cite{lee2018snip,wang2020picking,jin2016training,oymak2018learning} and in this work we focus on after training. Related to over-parameterizarion, \cite{frankle2018lottery} shows that a large DNN contains a small subset of favorable weights (for pruning), which can achieve similar performance to the original network when trained with the same initialization. \cite{zhou2019deconstructing,malach2020proving,pensia2020optimal} demonstrate that there are subsets with good test performance even without any training and provide theoretical guarantees. However, these works do not answer why practical gradient-based algorithms lead to good pruning outcomes. {Closer to us, \cite{li2020exploring} derives formulas for predicting the pruning performance of over-parameterized least-squares without proofs. In contrast, we provide provable guarantees, and, also obtain DC for more complex problems with general design matrices and nonlinearities.} \begin{figure}[t!] \centering \begin{tikzpicture} \node at (0,0) {\includegraphics[scale=0.33]{figs2/RF_COMBINED_80_n200_p1500}}; \node at (-3.5,0) [rotate=90,scale=1.]{Test Risk}; \node at (0,-2.6) [scale=.9]{Overparameterization ($p/n$)} \end{tikzpicture} \vspace{-10pt} \caption{\small{Random feature regression (RFR) with ReLU feature-map $\phi(\vct{a})=\text{ReLU}({\mtx{R}}\vct{a})$. Here ${\mtx{R}}$ has i.i.d.~standard normal entries corresponding to the input layer of a shallow neural net and we regress the output layer. Solid lines follow from our distributional characterization and the markers are obtained by solving random feature regression, which exhibit a good match. The blue line is the performance of usual RFR with growing number of features $p$. The other lines are obtained by solving RFR with $p$ features and pruning and retraining the solution to fixed sparsity levels ($s,2s,4s$) with $s/n=0.1$. Importantly, the risks of the retrained models exhibit double descent and are minimized when $p\gg n$ despite fixed model size / sparsity. The slight mismatch of the red curve/markers is explained in Fig.~\ref{figRF2}.} \cmt{We emphasize that RFR is a well-recognized proxy for the DNN regression due to the equivalence between kernels and wide DNNs \cite{jacot2018neural}.} \label{figRF}\vspace{-15pt} \end{figure} \cmt{The green line prunes the resulting coefficients to find a sparse model with fixed sparsity $s/n=0.1$. The red line resolves RFR using the features identified after pruning. All lines exhibit double descent at $n=p$.} \noindent {\bf{Benefits of overparameterization:}} Studies on the optimization and generalization properties of DNNs demonstrate that overparameterization acts as a catalyst for learning. \cite{arora2018optimization,neyshabur2014search,gunasekar2017implicit,ji2018risk} argue that gradient-based algorithms are implicitly biased towards certain favorable solutions (even without explicit regularization) to explain benign overfitting \cite{bartlett2020benign,oymak2020towards,du2019gradient,chizat2019lazy,belkin2018understand,belkin2019does,tsigler2020benign,liang2018just,mei2019generalization,ju2020overfitting}. More recently, these studies have led to interesting connections between kernels and DNNs and a flurry of theoretical developments. Closest to us, \cite{nakkiran2019deep,belkin2019two,belkin2019reconciling} uncover a double-descent phenomenon: the test risk has two minima as a function of model size. One minimum occurs in the classical underparameterized regime whereas the other minimum occurs when the model is overparameterized and the latter risk can in fact be better than former. Closer to our theory, \cite{derezinski2019exact,hastie2019surprises,montanari2019generalization,deng2019model,kini2020analytic,liang2020precise,salehi2020performance,ju2020overfitting} characterize the asymptotic performance of overparameterized learning problems. However these works are limited to characterizing the test error of regular (dense) training. In contrast, we use distributional characterization (DC) to capture the performance of more challenging pruning strategies and we uncover novel double descent phenomena (see Fig.~\ref{figNN}). \cmt{For linear models, implicit bias phenomena have been studied for various loss functions and algorithms (e.g.~logistic loss converging to max-margin solution on separable data) \cite{ji2018risk,soudry2018implicit,nacson2019stochastic}. Follow-up works show that such results continue to hold for nonlinear problems \cite{gunasekar2017implicit,oymak2019overparameterized,azizan2018stochastic}. More recently, this line of works has further motivated the study of generalization/optimization guarantees for deep networks and their connections to random features \cite{du2019gradient,allen2019convergence,chizat2019lazy,belkin2018understand,belkin2019does,liang2018just,mei2019generalization}.} \subsection{Proof of Lemma \ref{lem:AO}}\label{sec:proofAO} \vspace{3pt} \subsubsection{Proof of (i).} Strong convexity of the objective function in \eqref{eq:AO_con} is easily verified by the second derivative test and use of Assumption \ref{ass:mu} that $\bSi_{i,i}\leq\Sigma_{\max},~i\in[p].$ Uniqueness of the solution follows directly from strong convexity. \ct{Strictly speaking we might need to also argue existence, i.e., feasibility of the AO. An indirect way is to show feasibility using the CGMT, but it seems unnecessarily complicated?} \vspace{5pt} \subsubsection{Proof of (ii).}Using Lagrangian formulation, the solution $\hat{\vct{w}}^{\rm{AO}}_n$ to \eqref{eq:AO_con} is the same as the solution to the following: \begin{align} \left(\hat{\vct{w}}^{\rm{AO}}_n,u_n\right) :=\arg\min_{\vct{w}\in\mathcal{B}}\max_{u\geq 0} ~\frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2 + u \left( \sqrt{\tn{\vct{w}}^2+\sigma^2} \tn{\bar{\g}} - \sqrt{\kappa}\,\bar{\h}^T\vct{w} + \frac{\sigma h}{\sqrt{n}} \right)\label{eq:AO_2} \end{align} where we have: (i) set $\bar{\g} := {\vct{g}}/\sqrt{n}$ and $\bar{\h}:= \vct{h}/\sqrt{p}$; (ii) recalled that $p/n=\kappa$; and, (iii) used $\left(\hat{\vct{w}}^{\rm{AO}}_n,u_n\right)$ to denote the optimal solutions in \eqref{eq:AO_2}. The subscript $n$ emphasizes the dependence of $\left(\hat{\vct{w}}^{\rm{AO}}_n,u_n\right)$ on the problem dimensions. Also note that (even though not explicit in the notation) $\left(\hat{\vct{w}}^{\rm{AO}}_n,u_n\right)$ are random variables depending on the realizations of $\bar{\g},\bar{\h}$ and $h$. Notice that the objective function above is convex in $\vct{w}$ and linear (thus, concave) in $u$. Also, $\mathcal{B}$ is compact. Thus, strong duality holds and we can flip the order of min-max \cite{fan1953minimax}. Moreover, in order to make the objective easy to optimize with respect to $\vct{w}$, we use the following variational expression for the square-root term $\sqrt{\tn{\vct{w}}^2+\sigma^2}$: $$ \tn{\bar{\g}}\sqrt{\tn{\vct{w}}^2+\sigma^2} = \tn{\bar{\g}}\cdot\min_{\tau\in[\sigma,\sqrt{\sigma^2+B_+^2}]} \left\{ \frac{\tau}{2} + \frac{\tn{\vct{w}}^2+\sigma^2}{2\tau} \right\} = \min_{\tau\in[\sigma,\sqrt{\sigma^2+B_+^2}]} \left\{ \frac{\tau\tn{\bar{\g}}^2}{2} + \frac{\sigma^2}{2\tau} + \frac{\tn{\vct{w}}^2}{2\tau} \right\}, $$ where $B_+$ is defined in Lemma \ref{lem:bd_PO}. For convenience define the constraint set for the variable $\tau$ as $\mathcal{T}':=[\sigma,\sqrt{\sigma^2+B_+^2}]$. For reasons to be made clear later in the proof (see proof of statement (iii)), we consider the (possibly larger) set: \[ \mathcal{T}:=[\sigma,\max\{\sqrt{\sigma^2+B_+^2},2\tau_*\}]\, \] where $\tau_*$ is as in the statement of the lemma. The above lead to the following equivalent formulation of \eqref{eq:AO_2}, \begin{align} \left(\hat{\vct{w}}^{\rm{AO}}_n,u_n,\tau_n\right) = \max_{u\geq 0}\min_{\vct{w}\in\mathcal{B},\tau\in\mathcal{T}} ~ \frac{u\tau\tn{\bar{\g}}^2}{2} + \frac{u\sigma^2}{2\tau} + \frac{u\sigma h}{\sqrt{n}} + \min_{\vct{w}\in\mathcal{B}} \left\{ \frac{1}{2}\tn{\boldsymbol{\Sigma}^{-1/2}\vct{w}+\betab^\star}^2 + \frac{u}{2\tau}\tn{\vct{w}}^2 - u \sqrt{\kappa}\,{\bar{\h}}^T\vct{w} \right\} .\label{eq:AO_3} \end{align} The minimization over $\vct{w}$ is easy as it involves a strongly convex quadratic function. First, note that the unconstrained optimal $\vct{w}':=\vct{w}'(\tau,u)$ (for fixed $(\tau,u)$) is given by \begin{align}\label{eq:w'} \vct{w}':=\vct{w}'(\tau,u) = -\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u\sqrt{\kappa}\bar{\h}\right), \end{align} and \eqref{eq:AO_3} simplifies to \begin{align} \left(u_n,\tau_n\right)=\max_{u\geq 0}\min_{\tau\in\mathcal{T}} ~ \frac{u\tau\tn{\bar{\g}}^2}{2} + \frac{u\sigma^2}{2\tau} + \frac{u\sigma h}{\sqrt{n}} - \frac{1}{2} \left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u\sqrt{\kappa}\bar{\h}\right)^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1} \left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u\sqrt{\kappa}\bar{\h}\right)\,=:\mathcal{R}(u,\tau) .\label{eq:AO_4} \end{align} It can be checked by direct differentiation and the second-derivative test that the objective function in \eqref{eq:AO_4} is strictly convex in $\tau$ and strictly concave in $u$ over the domain $\{(u,\tau)\in\mathbb{R}_+\times\mathbb{R}_+\}$ \footnote{{To analyze the matrix-vector product term in \eqref{eq:AO_4} for $(\tau,u)$ one can use the fact that ${\boldsymbol{{\Sigma}}}$ is diagonal. This way, as a function of $u$ and $\tau$ the analysis reduces to the properties of relatively simple functions. For instance, for $\tau$, this function is in the form $f(\tau)=-(a+b/\tau)^{-1}$ for $a,b>0$, which is strictly convex.}}. Thus, the saddle point $(u_n,\tau_n)$ is unique. Specifically, this implies that the optimal $\hat{\vct{w}}^{\rm{AO}}_n$ in \eqref{eq:AO_3} is given by (cf. \eqref{eq:w'}) \begin{align}\label{eq:w_n} \hat{\vct{w}}^{\rm{AO}}_n=\vct{w}'(\tau_n,u_n) = -\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}\left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u_n\sqrt{\kappa}\bar{\h}\right). \end{align} In Lemma \ref{lem:AO}(v) we will prove that wpa 1, in the limit of $p\rightarrow\infty$, $\|\hat{\vct{w}}^{\rm{AO}}_n\|_2\leq C$ for sufficiently large absolute constant $C>0$. Thus, by choosing the upper bound in the definition of $\mathcal{B}$ in Lemma \ref{lem:bd_PO} strictly larger than C, guarantees that the unconstrained $\hat{\vct{w}}^{\rm{AO}}_n$ in \eqref{eq:w_n} is feasible in \eqref{eq:AO_3}. \noindent{\textbf{Asymptotic limit of the key quantities $\tau_n,u_n$:}} In what follows, we characterize the high-dimensional limit of the optimal pair $(u_n,\tau_n)$ in the limit $n,p\rightarrow\infty,~p/n\rightarrow\kappa$. We start by analyzing the (point-wise) convergence of $\mathcal{R}(u,\tau)$. For the first three summands in \eqref{eq:AO_4}, we easily find that $$ \left\{\frac{u\tau\tn{\bar{\g}}^2}{2} + \frac{u\sigma^2}{2\tau} + \frac{u\sigma h}{\sqrt{n}}\right\}~ \stackrel{{P}}{\longrightarrow}~\left\{ \frac{u\tau}{2} + \frac{u\sigma^2}{2\tau} \right\}. $$ Next, we study the fourth summand. First, note that \begin{align} (u\sqrt{\kappa}\bar{\h})^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}(u\sqrt{\kappa}\bar{\h}) &= u^2\kappa\,\frac{1}{p}\vct{h}^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\vct{h} \notag\\ &= u^2\kappa\,\frac{1}{p}\sum_{i=1}^{p}\frac{\vct{h}_i^2}{\bSi_{i,i}^{-1}+\frac{u}{\tau}} \notag\\ &\stackrel{{P}}{\longrightarrow} u^2\kappa\,\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right]. \end{align} In the last line, $\Lambda$ is a random variable as in Definition \ref{def:Xi}. {Also, we used Assumption \ref{ass:mu} together with the facts that $\vct{h}$ is independent of $\boldsymbol{\Sigma}$ and that the function $(x_1,x_2)\mapsto x_1^2(x_2^{-1}+u/\tau)^{-1}$ is $\rm{PL}(3)$ assuming $x_2$ is bounded (see Lemma \ref{lem:PLbdd} for proof).} \ct{Question: Is it immediate that the empirical distribution of $(\beta,\boldsymbol{\Sigma},\vct{h})$ converges in $W_k$ to $\mu\otimes\mathcal{N}(0,1)$ given that $(\beta,\boldsymbol{\Sigma})$ converges to $\mu$ and $\vct{h}$ is independent???} Second, we find that \begin{align} (\betab^\star)^T\boldsymbol{\Sigma}^{-1/2}\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\boldsymbol{\Sigma}^{-1/2}\betab^\star &= \frac{1}{p}(\sqrt{p}\betab^\star)^T\left({\mtx{I}}+\frac{u}{\tau}\boldsymbol{\Sigma}\right)^{-1}(\sqrt{p}\betab^\star) \notag\\ &= \frac{1}{p}\sum_{i=1}^{p}\frac{\left(\sqrt{p}\betab^\star_i/\sqrt{\bSi_{i,i}}\right)^2}{\bSi_{i,i}^{-1}+\frac{u}{\tau}}\notag\\ &\stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\Lambda^{-1}+\frac{u}{\tau}}\right]. \end{align} Here, $\Lambda,B$ are random variables as in Definition \ref{def:Xi} and {we also used Assumption \ref{ass:mu} together with the fact that the function $(x_1,x_2)\mapsto x_1^2x_2^{-1}(x_2^{-1}+u/\tau)^{-1}$ is $\rm{PL}(3)$ assuming $x_2$ is bounded (see Lemma \ref{lem:PLbdd} for proof).} Third, \cts{by independence of $(\betab^\star, \boldsymbol{\Sigma})$ from $\vct{h}$} \begin{align} (u\sqrt{\kappa}\bar{\h})^T\left(\boldsymbol{\Sigma}^{-1}+\frac{u}{\tau}{\mtx{I}}\right)^{-1}\boldsymbol{\Sigma}^{-1/2}\betab^\star = u\sqrt{\kappa} \cdot \frac{1}{p}\sum_{i=1} ^p \frac{\vct{h}_i\boldsymbol{\Sigma}_{i,i}^{-1/2}(\sqrt{p}\betab^\star_i)}{\boldsymbol{\Sigma}_{i,i}^{-1}+\frac{u}{\tau}{\mtx{I}}} ~\stackrel{{P}}{\longrightarrow}~ 0. \end{align} Putting these together, the objective $\mathcal{R}(u,\tau)$ in \eqref{eq:AO_4} converges point-wise in $u,\tau$ to \begin{align} \mathcal{R}(u,\tau)\stackrel{{P}}{\longrightarrow}\mathcal{D}(u,\tau) := \frac{1}{2}\left({u\tau} + \frac{u\sigma^2}{\tau} - u^2\kappa\,\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] - \operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\Lambda^{-1}+\frac{u}{\tau}}\right] \right).\label{eq:conv_pt} \end{align} Note that $\mathcal{R}(u,\tau)$ (and thus, $\mathcal{D}(u,\tau)$) is convex in $\tau$ and concave in $u$. Thus, the convergence in \eqref{eq:conv_pt} is in fact uniform (e.g., \cite{AG1982}) and we can conclude that \begin{align}\label{eq:Dc0} \phi({\vct{g}},\vct{h}) \stackrel{{P}}{\longrightarrow} \max_{u\geq 0}\min_{\tau\in\mathcal{T}}~ \mathcal{D}(u,\tau). \end{align} and {using strict concave/convexity of $\mathcal{D}(u,\tau)$, we also have the parameter convergence \cite[Lem. 7.75]{NF36}} \begin{align}\label{eq:Dc} {(u_n,\tau_n) \stackrel{{P}}{\longrightarrow} (u_*,\tau_*):=\arg\max_{u\geq 0}\min_{\tau\in\mathcal{T}}~ \mathcal{D}(u,\tau).} \end{align} In the proof of statement (iii) below, we show that the saddle point of \eqref{eq:Dc0} is $(u_*,\tau_*)$. In particular, $\tau_*$ is strictly in the interior of $\mathcal{T}$, which combined with convexity implies that $$ \max_{u\geq 0}\min_{\tau\in\mathcal{T}}~ \mathcal{D}(u,\tau) = \max_{u\geq 0}\min_{\tau>0}~ \mathcal{D}(u,\tau) =: \bar\phi. $$ This, together with the first display above proves the second statement of the lemma. \vspace{5pt} \subsubsection{Proof of (iii).} Next, we compute the saddle point $(u_*,\tau_*)$ by studying the first-order optimality conditions of the strictly concave-convex $\mathcal{D}(u,\tau)$. Specifically, we consider the unconstrained minimization over $\tau$ and we will show that the minimum is achieved in the strict interior of $\mathcal{T}$. Direct differentiation of $\mathcal{D}(u,\tau)$ gives \begin{subequations} \begin{align} {\tau} + \frac{\sigma^2}{\tau} - 2u\kappa\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] + \frac{u^2}{\tau}\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1}+\frac{u}{\tau}\right)^2}\right] + \frac{1}{\tau}\operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1}+\frac{u}{\tau}\right)^2}\right] &= 0, \label{eq:fo1}\\ {u} - \frac{u\sigma^2}{\tau^2} - \frac{u^3}{\tau^2}\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1} + \frac{u}{\tau}\right)^2}\right] - \frac{u}{\tau^2} \operatorname{\mathbb{E}}\left[\frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1}+\frac{u}{\tau}\right)^2}\right] &= 0,\label{eq:fo2} \end{align} \end{subequations} Multiplying \eqref{eq:fo2} with $\frac{\tau}{u}$ and adding to \eqref{eq:fo1} results in the following equation \begin{align} \tau = u\kappa\operatorname{\mathbb{E}}\left[ \frac{1}{\Lambda^{-1}+\frac{u}{\tau}} \right] ~\Leftrightarrow ~ \operatorname{\mathbb{E}}\left[ \frac{1}{(\frac{u}{\tau}\Lambda)^{-1}+1} \right] = \frac{1}{\kappa} \label{eq:tauu}\,. \end{align} Thus, we have found that the ratio $\frac{u_*}{\tau_*}$ is the unique solution to the equation in \eqref{eq:tauu}. Note that this coincides with the Equation \eqref{eq:ksi} that defines the parameter $\xi$ in Definition \ref{def:Xi}. The fact that \eqref{eq:tauu} has a unique solution for all $\kappa>1$ can be easily seen as $F(x)=\operatorname{\mathbb{E}}\left[ \frac{1}{(x\Lambda)^{-1}+1} \right], x\in\mathbb{R}_+$ has range $(0,1)$ and is strictly increasing (by differentiation). Thus, we call $\xi=\frac{u_*}{\tau_*}$. Moreover, multiplying \eqref{eq:fo2} with $u$ leads to the following equation for $\tau_*$: \begin{align} u_*^2 = \sigma^2\xi^2 + u_*^2 \xi^2 \kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1} +\xi\right)^2}\right] + \xi^2 \operatorname{\mathbb{E}}\left[ \frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1} + \xi\right)^2}\right] ~\Rightarrow~ \tau_*^2 = \frac{\sigma^2 + \operatorname{\mathbb{E}}\left[ \frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1} + \xi\right)^2}\right]}{1-\xi^2\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left(\Lambda^{-1} +\xi\right)^2}\right]} = \frac{\sigma^2 + \operatorname{\mathbb{E}}\left[ \frac{B^2\Lambda^{-1}}{\left(\Lambda^{-1} + \xi\right)^2}\right]}{1-\kappa \operatorname{\mathbb{E}}\left[ \frac{1}{\left((\xi\Lambda)^{-1} +1\right)^2}\right]}. \end{align} {Again, note that this coincides with Equation \eqref{eq:gamma} that determines the parameter $\gamma$ in Definition \ref{def:Xi}, i.e., $\tau_*^2 = \gamma.$ By definition of $\mathcal{T}$ and of $\tau_*$, it is clear that $\tau_\star$ is in the strict interior of $\mathcal{T}$.} \vspace{5pt} \subsubsection{Proof of (iv).} For convenience, define $$F_n({\boldsymbol{\hat{\beta}}^{\rm{AO}}},\betab^\star,\boldsymbol{\Sigma}):=\frac{1}{p} \sum_{i=1}^{p} f\left(\sqrt{p}{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i},\sqrt{p}\betab^\star_{i},\boldsymbol{\Sigma}_{ii}\right)\quad\text{and}\quad\alpha_*:=\operatorname{\mathbb{E}}_\mu\left[f(X_{\kappa,\sigma^2}(\Lambda,B,H),B,\Lambda)\right].$$ Recall from \eqref{eq:w_n} the explicit expression for $\hat{\vct{w}}^{\rm{AO}}_n$, repeated here for convenience. \begin{align} \hat{\vct{w}}^{\rm{AO}}_n = -\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}\left(\boldsymbol{\Sigma}^{-1/2}\betab^\star-u_n\sqrt{\kappa}\bar{\h}\right).\notag \end{align} Also, recall that ${\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n = \boldsymbol{\Sigma}^{-1/2}\hat{\vct{w}}^{\rm{AO}}_n+\betab^\star$. Thus, (and using the fact that $\bar{\h}$ is distributed as $-\bar{\h}$), \begin{align} {\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n &=\boldsymbol{\Sigma}^{-1/2}\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}u_n\sqrt{\kappa}\bar{\h} + \left({\mtx{I}}-\boldsymbol{\Sigma}^{-1/2}\left(\boldsymbol{\Sigma}^{-1}+\frac{u_n}{\tau_n}{\mtx{I}}\right)^{-1}\boldsymbol{\Sigma}^{-1/2}\right)\betab^\star\notag\\ \Longrightarrow{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i}&=\frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_n\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_n\bar{\h}_i +\left(1-\frac{1}{1+\xi_n\boldsymbol{\Sigma}_{i,i}}\right)\betab^\star_i.\label{eq:betan} \end{align} For $i\in[p]$, define \begin{align} \vct{v}_{n,i} = \frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_*\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_*\bar{\h}_i +\left(1-\frac{1}{1+\xi_*\boldsymbol{\Sigma}_{i,i}}\right)\betab^\star_i \end{align} In the above, for convenience, we have denoted $\xi_n:=u_n/\tau_n$ and recall that $\xi_*:=u_*/\tau_*$. The proof proceeds in two steps. In the first step, we use the fact that $\xi_n\stackrel{{P}}{\longrightarrow}\xi_*$ and $u_n\stackrel{{P}}{\longrightarrow} u_\star$ (see \eqref{eq:Dc}) to prove that for any $\varepsilon\in(0,\xi_*/2)$, there exists an absolute constant $C>0$ such that wpa 1: \begin{align}\label{eq:ivstep1} |F_n(\sqrt{p}{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) - F_n(\sqrt{p}\vct{v}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) | \leq C\varepsilon. \end{align} In the second step, we use pseudo-Lipschitzness of $f$ and Assumption \ref{ass:mu} to prove that \begin{align} |F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| \stackrel{{P}}{\longrightarrow} \alpha_*.\label{eq:ivstep2} \end{align} The desired follows by combining \eqref{eq:ivstep1} and \eqref{eq:ivstep2}. Thus, in what follows, we prove \eqref{eq:ivstep1} and \eqref{eq:ivstep2}. \vspace{2pt} \noindent\underline{Proof of \eqref{eq:ivstep1}.}~~Fix some $\varepsilon\in(0,\xi_*/2)$. From \eqref{eq:Dc}, we know that w.p.a. 1 $|\xi_n-\xi_*|\leq \varepsilon$ and $|u_n-u_*|\leq \varepsilon$. Thus, $\hat{\vct{w}}^{\rm{AO}}_n$ is close to $\vct{v}_n$. Specifically, in this event, for every $i\in[p]$, it holds that: \begin{align} \notag|{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i} - \vct{v}_{n,i}| &\leq {|\betab^\star_i|}\left|\frac{1}{1+\xi_n\bSi_{i,i}}-\frac{1}{1+\xi_*\bSi_{i,i}}\right| + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\boldsymbol{\Sigma}_{i,i}}}\left|\frac{\tau_n}{1+(\xi_n\bSi_{i,i})^{-1}}-\frac{\tau_*}{1+(\xi_*\bSi_{i,i})^{-1}}\right| \\ \notag&= {|\betab^\star_i|}\left|\frac{1}{1+\xi_n\bSi_{i,i}}-\frac{1}{1+\xi_*\bSi_{i,i}}\right| + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\boldsymbol{\Sigma}_{i,i}}}\left|\frac{u_n}{\xi_n+\bSi_{i,i}^{-1}}-\frac{u_*}{\xi_*+\bSi_{i,i}^{-1}}\right| \\ \notag& \leq {|\betab^\star_i|}\frac{|\bSi_{i,i}||\xi_n-\xi_*|}{|1+\xi_n\bSi_{i,i}||1+\xi_*\bSi_{i,i}|} + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\bSi_{i,i}}} \frac{u_*|\xi_n-\xi_*|}{(\xi_n+\bSi_{i,i}^{-1})(\xi_*+\bSi_{i,i}^{-1})} + \sqrt{\kappa}\frac{|\bar{\h}_i|}{\sqrt{\bSi_{i,i}}}\frac{|u_n-u_*|}{\xi_n+\bSi_{i,i}^{-1}} \\ \notag& \leq {|\betab^\star_i|}{\Sigma_{\max}\varepsilon} + \sqrt{\kappa}{|\bar{\h}_i|} u_*\Sigma_{\max}^{3/2} \varepsilon+ \sqrt{\kappa}|\bar{\h}_i|\Sigma_{\max}^{1/2}\varepsilon \\ &\leq C\varepsilon \left(|\bar{\h}_i| + |\betab^\star_i|\right).\label{eq:betav} \end{align where $C=C(\Sigma_{\max},\kappa,u_*)$ is an absolute constant. In the second line above, we recalled that $u_n=\tau_n\xi_n$ and $u_*=\tau_*\xi_*$. In the third line, we used the triangle inequality. In the fourth line, we used that $\xi_*>0$, $0<\bSi_{i,i}\leq\Sigma_{\max}$ and $\xi_n\geq \xi_*-\varepsilon \geq \xi_*/2 >0$. Now, we will use this and Lipschitzness of $f$ to argue that there exists absolute constant $C>0$ such that wpa 1, \begin{align} |F_n(\sqrt{p}{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) - F_n(\sqrt{p}\vct{v}_n,\sqrt{p}\betab^\star,\boldsymbol{\Sigma}) | \leq C\varepsilon.\notag \end{align} Denote, $\vct{a}_i=(\sqrt{p}{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i},\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$ and $\vct{b}_i=(\sqrt{p}\vct{v}_{n,i},\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})$. Following the exact same argument as in \eqref{eq:dev2show} (just substitute ${\boldsymbol{\beta}}\leftrightarrow\vct{v}_n$ in the derivation), we have that for some absolute constant $C>0$ wpa 1: \begin{align} |F_n({\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| &\leq C \|{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n-\vct{v}_n\|_2. \end{align} From this and \eqref{eq:betav}, we find that \begin{align} |F_n({\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| &\leq C\varepsilon \left(\sum_{i=1}^p \left(|\bar{\h}_i|+|\betab^\star_i|\right)^2\right)^{1/2}\notag \\ &\leq C\varepsilon\sqrt{2}\sqrt{\|\betab^\star\|_2^2 + \|\bar{\h}\|_2^2}.\label{eq:epsS} \end{align} But, \cts{recall that $\|\betab^\star\|_2^2 = \frac{1}{p}\sum_{i=1}^p(\sqrt{p}\betab^\star_i)^2<\infty$, as $p\rightarrow \infty$ by Assumption \ref{ass:mu}.} Also, since $\bar{\h}_i\sim\mathcal{N}(0,1/p)$, it holds that $\|\bar{\h}\|_2^2\leq 2$, wpa 1 as $p\rightarrow\infty$. Therefore, from \eqref{eq:epsS}, wpa 1, there exists constant $C>0$ such that \begin{align} |F_n({\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n({\vct{g}},\vct{h}),\betab^\star,\boldsymbol{\Sigma}) - F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| \leq C \cdot\varepsilon,\notag \end{align} as desired. \vspace{2pt} \noindent\underline{Proof of \eqref{eq:ivstep2}.}~~Next, we will use Assumption \ref{ass:mu} to show that \begin{align} |F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma})| \stackrel{{P}}{\longrightarrow} \alpha_*.\label{eq:AO_conv} \end{align} Notice that $\vct{v}_n$ is a function of $\betab^\star,\boldsymbol{\Sigma},\bar{\h}$. Concretely, define ${\widetilde{g}}:\mathbb{R}^3\rightarrow\mathbb{R}$, such that $$ \widetilde{g}(x_1,x_2,x_3) := \frac{x_2^{-1/2}}{1+(\xi_* x_2)^{-1}}\sqrt{\kappa}\tau_* x_3 + (1-(1+\xi_*x_2)^{-1})x_1, $$ and notice that $$ \sqrt{p}\vct{v}_{n,i} = \widetilde{g}\left(\sqrt{p}\betab^\star_i,\bSi_{i,i},\vct{h}_i\right) = \frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_*\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_*\vct{h}_i +\left(1-\frac{1}{1+\xi_*\boldsymbol{\Sigma}_{i,i}}\right)\sqrt{p}\betab^\star_i. $$ Thus, $$ F_n(\vct{v}_n,\betab^\star,\boldsymbol{\Sigma}) = \frac{1}{p}\sum_{i=1}^p f\left(g\left(\sqrt{p}\betab^\star_i,\bSi_{i,i},\vct{h}_i\right),\sqrt{p}\betab^\star_i,\bSi_{i,i}\right) =: \frac{1}{p}\sum_{i=1}^p h\left(\vct{h}_i,\sqrt{p}\betab^\star_i,\bSi_{i,i}\right), $$ where we have defined $h:\mathbb{R}^3\rightarrow\mathbb{R}$: \begin{align} h(x_1,x_2,x_3) := f\left(\widetilde{g}(x_2,x_3,x_1),x_2,x_3\right).\label{h func} \end{align} \cts{We will prove that $h\in\rm{PL}(4)$. Indeed, if that were the case, then Assumption \ref{ass:mu} gives} \begin{align} \frac{1}{p}\sum_{i=1}^p h\left(\vct{h}_i,\sqrt{p}\betab^\star_i,\bSi_{i,i}\right) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{\mathcal{N}(0,1)\otimes \mu}\left[h(H,B,\Lambda)\right] &= \operatorname{\mathbb{E}}_{\mathcal{N}(0,1)\otimes \mu}\left[f\left(\widetilde{g}(B,\Lambda,H),B,\Lambda\right))\right]\\ & = \operatorname{\mathbb{E}}[f\left(X_{\kappa,\sigma^2}(\Lambda,B,H),B,\Lambda\right)] = \alpha_*, \end{align} where the penultimate equality follows by recognizing that (cf. Eqn. \eqref{eq:X}) $$ \widetilde{g}(B,\Lambda,H) = (1-(1+\xi_*\Lambda)^{-1})B + \sqrt{\kappa}\frac{\tau_*\Lambda^{-1/2}}{1+(\xi_*\Lambda)^{-1}}H = X_{\kappa,\sigma^2}(\Lambda,B,H). $$ It remains to show that $h\in\rm{PL}(4)$. Lemma \ref{lem:hPL} in Section \ref{SM useful fact} shows that if $f\in\rm{PL}(k)$, then $h\in\rm{PL}(k+1)$ for all integers $k\geq 2$. \fy{Using this and the fact that ${\cal{F}}\subset\rm{PL}(3)$, for any $f\in{\cal{F}}$, we find that $h\in \rm{PL}(4)$. This completes the proof of \eqref{eq:ivstep2}.} \vspace{5pt} \subsubsection{Proof of (v):} Let $\psi:\mathbb{R}\rightarrow\mathbb{R}$ be any bounded Lipschitz function. The function $f(a,b,c) = \psi(a)$ is trivially $\rm{PL}$(2). Thus, by directly applying statement (iv) of the lemma, we find that $$ \frac{1}{p}\sum_{i=1}^p{\psi(\sqrt{p}{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i}({\vct{g}},\vct{h}))} \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}\left[\psi(X_{\kappa,\sigma^2})\right]. $$ Since this holds for any bounded Lipschitz function, we have shown that the empirical distribution of ${\boldsymbol{\hat{\beta}}^{\rm{AO}}}_n$ converges weakly to the distribution of $X_{\kappa,\sigma^2}$. It remains to prove boundedness of the $2$nd moment as advertised in \eqref{eq:k_AO}. Recall from \eqref{eq:betan} that \begin{align} \sqrt{p}{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i}&=\frac{{\boldsymbol{\Sigma}_{i,i}^{-1/2}}}{1+(\xi_n\boldsymbol{\Sigma}_{i,i})^{-1}}\sqrt{\kappa}\tau_n\vct{h}_i +\left(1-\frac{1}{1+\xi_n\boldsymbol{\Sigma}_{i,i}}\right)(\sqrt{p}\betab^\star_i).\notag \end{align} Using this, boundedness of $\boldsymbol{\Sigma}_{i,i}$ from Assumption \ref{ass:mu}, and the fact that $\tau_n\stackrel{{P}}{\longrightarrow}\tau_\star, \xi_n\stackrel{{P}}{\longrightarrow}\xi_\star$, there exists constant $C=C(\Sigma_{\max},\Sigma_{\min},k,\tau_\star,\xi_\star)$ such that wpa 1, \begin{align} \frac{1}{p}\sum_{i=1}^p|\sqrt{p}{\boldsymbol{\hat{\beta}}^{\rm{AO}}}_{n,i}|^{2} \leq C\left(\frac{1}{p}\sum_{i=1}^p|\vct{h}_{i}|^{2}+\frac{1}{p}\sum_{i=1}^p|\sqrt{p}\betab^\star_{i}|^{2}\right).\notag \end{align} But the two summands in the expression above are finite in the limit of $p\rightarrow\infty$. Specifically, (i) from Assumption \ref{ass:mu}, $\frac{1}{p}\sum_{i=1}^p|\sqrt{p}\betab^\star_{i}|^{2}\stackrel{{P}}{\longrightarrow}\operatorname{\mathbb{E}}[B^{2}]<\infty$; (ii) $\frac{1}{p}\sum_{i=1}^p|\vct{h}_{i}|^{2}\stackrel{{P}}{\longrightarrow}\operatorname{\mathbb{E}}[H^{2}]=1$, using the facts that $\vct{h}_i\stackrel{iid}{\sim}\mathcal{N}(0,1)$ and $H\sim\mathcal{N}(0,1)$. This proves \eqref{eq:k_AO}, as desired. \section{Proof of Lemma \ref{lem rank one}}\label{SM lem proof} \begin{lemma} [Lemma \ref{lem rank one} restated]Suppose $\mathcal{S}$ is drawn from an LGP$(\sigma,{\boldsymbol{{\Sigma}}},{\boldsymbol{\beta}}_\star)$ as in Def.~\ref{def LGP} where $\text{rank}({\boldsymbol{{\Sigma}}})=1$ with ${\boldsymbol{{\Sigma}}}=\boldsymbol{\lambda}\bla^T$ for $\boldsymbol{\lambda}\in\mathbb{R}^p$. Define $\zeta=\mathbb{T}_s(\boldsymbol{\lambda})^2/\tn{\boldsymbol{\lambda}}^2$. For magnitude and Hessian pruning ($P\in\{M,H\}$) and the associated retraining, we have the following excess risks with respect to ${\boldsymbol{\beta}}^\star \begin{align &\operatorname{\mathbb{E}}_{\mathcal{S}}[{\cal{L}}({\boldsymbol{\hat{\beta}}}_s^P)]-{\cal{L}}({\boldsymbol{\beta}}^\star)={\frac{\zeta^2\sigma^2}{n-2}}+\underbrace{(1-\zeta)^2(\boldsymbol{\lambda}^T{\boldsymbol{\beta}}^\star)^2}_{\text{Error due to bias}}\\ &\operatorname{\mathbb{E}}_{\mathcal{S}}[{\cal{L}}({\boldsymbol{\hat{\beta}}}_s^{RT})]-{\cal{L}}({\boldsymbol{\beta}}^\star)={\sigma^2}/({n-2}). \end{align} \end{lemma} \begin{proof} \noindent \textbf{Retraining analysis:} We claim that for any feature set $\Delta$ with $\boldsymbol{\lambda}_{\Delta}\neq 0$, the test risk of ${\boldsymbol{\hat{\beta}}}(\Delta)$ is exactly identical. Secondly, pruning is guaranteed to pick a nonzero support satisfying $\boldsymbol{\lambda}_{\Delta}\neq 0$ \footnote{This is because ${\boldsymbol{\hat{\beta}}}=c\boldsymbol{\lambda}$ for some scalar $c\neq 0$ as ${\boldsymbol{\hat{\beta}}}$ lies in the row space of ${\mtx{X}}$. Then, Hessian/Magnitude-pruning would pick a nonzero support of ${\boldsymbol{\hat{\beta}}}$ which corresponds to the nonzero support of $\boldsymbol{\lambda}$.}. Thus, as described next, retraining always achieves a fixed risk. Set $c^\star=\boldsymbol{\lambda}^T{\boldsymbol{\beta}}^\star$. By definition, each input example $\vct{x}_i$ has the form $\vct{x}_i=g_i\boldsymbol{\lambda}$ and $y_i=g_ic^\star+\sigma z_i$. Set ${\vct{g}}=[g_1~\dots~g_n]^T$ and $\bar{{\vct{g}}}={\vct{g}}/\tn{{\vct{g}}}$. Thus, we have ${\mtx{X}}={\vct{g}}\boldsymbol{\lambda}^T$ and $\vct{y}={\vct{g}}\boldsymbol{\lambda}^T{\boldsymbol{\beta}}^\star+\sigma{\vct{z}}$. Decompose ${\vct{z}}=\bar{{\vct{z}}}+\bar{{\vct{g}}}^T{\vct{z}}\bar{{\vct{g}}}$ where $\bar{{\vct{z}}}$ is orthogonal to ${\vct{g}}$. When solving the regression of $\Delta$, we have that \[ {\mtx{X}}_\Delta={\vct{g}}\boldsymbol{\lambda}_\Delta^T,~\vct{y}=c^\star{\vct{g}}+\sigma(\bar{{\vct{z}}}+\bar{{\vct{g}}}^T{\vct{z}}\bar{{\vct{g}}}) \] The least-squares solution has the form ${\boldsymbol{\hat{\beta}}}={\boldsymbol{\hat{\beta}}}(\Delta)=\hat{c}\boldsymbol{\lambda}_\Delta/\tn{\boldsymbol{\lambda}_\Delta}^2$ where \begin{align} &\hat{c}=\arg\min_{c}\tn{(c^\star-c){\vct{g}}+\sigma{\vct{z}}}\implies\hat{c}=c^\star+\sigma\gamma\label{beta}. \end{align} where $\gamma=\frac{\bar{{\vct{g}}}^T{\vct{z}}}{\tn{{\vct{g}}}}$. Observe that $\sqrt{p}\gamma$ has Student's t-distribution with $p$ degrees of freedom. Set $h$, $\epsilon\overset{\text{i.i.d.}}{\sim} \mathcal{N}(0,1)$. Now, observe that a fresh test sample with $y=\vct{x}^T{\boldsymbol{\beta}}^\star+\sigma \epsilon$ with $\vct{x}=g\boldsymbol{\lambda}$, the test error obeys \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}}(\Delta))&=\operatorname{\mathbb{E}}(y-\vct{x}_{\Delta}^T{\boldsymbol{\hat{\beta}}}(\Delta))^2\\ &=\mathbb{E}[((c^\star-\hat{c})g+\sigma\epsilon)^2]\\ &=(\gamma^2+1)\sigma^2 \end{align} Now, observe that the minimum risk is obviously ${\cal{L}}({\boldsymbol{\beta}}^\star)=\sigma^2$. Thus, the excess retraining risk becomes \[ {\cal{L}}({\boldsymbol{\hat{\beta}}}(\Delta))-{\cal{L}}({\boldsymbol{\beta}}^\star)=\gamma^2\sigma^2. \] regardless of choice of $\Delta$. Finally, averaging this risk over $\mathcal{S}$ returns $\operatorname{\mathbb{E}}[\sigma^2\gamma^2]=\sigma^2/(n-2)$. Thus retraining risk has the fixed excess risk same as the one advertised in Lemma \ref{lem rank one}. \noindent \textbf{Pruning analysis:} For pruning setting $\Delta=[p]$ above, we have that ${\boldsymbol{\hat{\beta}}}=\hat{c}\boldsymbol{\lambda}/\tn{\boldsymbol{\lambda}}^2$. This means that, for both Magnitude and Hessian pruning\footnote{They yield the same result since diagonal covariance is proportional to $\boldsymbol{\lambda}$ in magnitude.}, pruned vector takes the form ${\boldsymbol{\hat{\beta}}}_s=\hat{c}\mathbb{T}_s(\boldsymbol{\lambda})/\tn{\boldsymbol{\lambda}}^2$. Using the fact that $\boldsymbol{\lambda}^T\mathbb{T}_s(\boldsymbol{\lambda})=\tn{\mathbb{T}_s(\boldsymbol{\lambda})}^2=\zeta\tn{\boldsymbol{\lambda}}^2$, we find \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}}_s)-{\cal{L}}({\boldsymbol{\beta}}^\star)&=\mathbb{E}[(c^\star- \hat{c}\frac{\boldsymbol{\lambda}^T\mathbb{T}_s(\boldsymbol{\lambda})}{\tn{\boldsymbol{\lambda}}^2})g+\sigma\epsilon)^2]-\sigma^2\\ &=\mathbb{E}[(c^\star- \hat{c}\zeta)g+\sigma\epsilon)^2]-\sigma^2\\ &=\operatorname{\mathbb{E}}[(((1-\zeta)c^\star-\zeta\sigma\gamma)g+\sigma\epsilon)^2]-\sigma^2\\ &=((1-\zeta)c^\star-\zeta\sigma\gamma)^2. \end{align} Finally, using zero-mean $\gamma$, we find \[ \operatorname{\mathbb{E}}_{\mathcal{S}}[{\cal{L}}({\boldsymbol{\hat{\beta}}}_s)]-{\cal{L}}({\boldsymbol{\beta}}^\star)=\operatorname{\mathbb{E}}_{\mathcal{S}}[((1-\zeta)c^\star-\zeta\sigma\gamma)^2]=(1-\zeta)^2{c^\star}^2+\frac{\zeta^2\sigma^2}{n-2}, \] which concludes the proof after observing ${c^\star}^2=(\boldsymbol{\lambda}^T{\boldsymbol{\beta}}^\star)^2$. Here, we call $(1-\zeta)^2{c^\star}^2$ ``the error due to bias''. The reason is that the predictable signal in the data is the noiseless component $\vct{x}^T{\boldsymbol{\beta}}^\star$. Pruning leads to an error in this predictable component by resulting in a biased estimate of the label (when conditioned on the random variable $g$ which controls the signal). \cmt{ Now let $|\lambda_{k_1}|\geq|\lambda_{k_2}|\geq...\geq|\lambda_{k_p}|$. Assume we solved ERM to get $\hat{c}$ and ${\boldsymbol{\hat{\beta}}}=\hat{c}\boldsymbol{\lambda}$. Prune the trained model ${\boldsymbol{\hat{\beta}}}$ to $s$-sparse by keeping the largest entries. Set ${\vct{u}}=\mathbb{T}_s(\boldsymbol{\lambda})$ and $\zeta=\tn{{\vct{u}}}^2/\tn{\boldsymbol{\lambda}}^2$. We get ${\boldsymbol{\hat{\beta}}}_s=\hat{c}{\vct{u}}$. \begin{align} {\cal{L}}(\boldsymbol{\hat{\theta}})&=\mathbb{E}[((\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-{\vct{u}}^T\boldsymbol{\hat{\theta}})h+\sigma\epsilon)^2]\\ &=\mathbb{E}[((\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-\sum_{i=1}^s\lambda_{k_i}^2\hat{c})h+\sigma\epsilon)^2]\\ &=[(1-\zeta)\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-\zeta\sigma\gamma]^2+\sigma^2 \end{align} \textbf{Case 1: } Now, assume that we have already known the optimal entries and do pruning before training. Then the pruned model can be seen as pruning the inputs and then putting it through a non-sparse $s$-feature model. Let $\lambda_{t_1}{\boldsymbol{\beta}}_{t_1}\geq\lambda_{t_2}{\boldsymbol{\beta}}_{t_2}\geq...\geq\lambda_{t_s}{\boldsymbol{\beta}}_{t_s}$, $\vct{w}=[\lambda_{t_1}~\lambda_{t_2}~...~\lambda_{t_s}]$ and $\vct{t}=[{\boldsymbol{\beta}}_{t_1}~...~{\boldsymbol{\beta}}_{t_s}]$. Set data sample $\vct{x}_i'\overset{\text{i.i.d.}}{\sim} \mathcal{N}(0,{\boldsymbol{{\Sigma}}}')\in\mathbb{R}^s$ where are ${\boldsymbol{{\Sigma}}}'=\vct{w}\w^T$. Following what done in \ref{beta}, similarly \[ \boldsymbol{\hat{\theta}}'=\theta\vct{w}\quad\text{where}\quad\theta=\frac{1}{\sum_{i=1}^s\lambda_{t_i}^2}(\vct{w}^T\vct{t}+\frac{\sigma}{\tn{{\vct{g}}}^2}{\vct{g}}^T{\vct{z}}) \] \begin{align} {\cal{L}}(\boldsymbol{\hat{\theta}}')&=\mathbb{E}[((\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-\sum_{i=1}^s\lambda_{t_i}^2\theta)h+\sigma\epsilon)^2]\\ &=[(\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-\vct{w}^T\vct{t})-\sigma\gamma]^2+\sigma^2 \end{align} \textbf{Case 2: } Now retrain with the pruned entries $\lambda_{k_!}$, ..., $\lambda_{k_s}$. Then the pruned model can be seen as pruning the inputs and then putting it through a non-sparse $s$-feature model. Let $\vct{t}=[{\boldsymbol{\beta}}_{k_1}~...~{\boldsymbol{\beta}}_{k_s}]$. Set data sample $\vct{x}_i'\overset{\text{i.i.d.}}{\sim} \mathcal{N}(0,{\boldsymbol{{\Sigma}}}')\in\mathbb{R}^s$ where are ${\boldsymbol{{\Sigma}}}'={\vct{u}}\ub^T$. Following what done in \ref{beta}, similarly \[ \boldsymbol{\hat{\theta}}'=\theta\vct u\quad\text{where}\quad\theta=\frac{1}{\sum_{i=1}^s\lambda_{k_i}^2}(\vct u^T\vct{t}+\frac{\sigma}{\tn{{\vct{g}}}^2}{\vct{g}}^T{\vct{z}}) \] \begin{align} {\cal{L}}(\boldsymbol{\hat{\theta}}')&=\mathbb{E}[((\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-\sum_{i=1}^s\lambda_{k_i}^2\theta)h+\sigma\epsilon)^2]\\ &=[(\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-\vct u^T\vct{t})-\sigma\gamma]^2+\sigma^2 \end{align} \textbf{It is obvious to know that loss in case 1 is always smaller than it in case 2. Then for both case, } Set ${\boldsymbol{\beta}}^T{\boldsymbol{{\Sigma}}}{\boldsymbol{\beta}}=\alpha^2$ and $\vct{t}^T{\boldsymbol{{\Sigma}}}'\vct{t}=\rho^2$. We can write ${\cal{L}}(\boldsymbol{\hat{\theta}})$ and ${\cal{L}}(\boldsymbol{\hat{\theta}}')$ as \[ {\cal{L}}(\boldsymbol{\hat{\theta}})=((1-\zeta)\alpha-\zeta\sigma\gamma)^2+\sigma^2\iff{\cal{L}}(\boldsymbol{\hat{\theta}}')=(\alpha-\rho-\sigma\gamma)^2+\sigma^2 \] Now consider a special case which satisfies ${\cal{L}}(\boldsymbol{\hat{\theta}})<{\cal{L}}(\boldsymbol{\hat{\theta}}')$. \[ 0\leq(1-\zeta)\alpha-\zeta\sigma\gamma<\alpha-\rho-\sigma\gamma \] \[ \frac{\rho+\sigma\gamma}{\alpha+\sigma\gamma}<\zeta\leq\frac{\alpha}{\alpha+\sigma\gamma} \]} \end{proof} \section{Main Results}\label{sec main} \cmt{\begin{definition}[Linear Gaussian Problem (LGP)] \label{def LGP}Given latent vector ${\boldsymbol{\beta}}^\star\in\mathbb{R}^d$, covariance ${\boldsymbol{{\Sigma}}}$ and noise level $\sigma$, suppose each example in $\mathcal{S}$ is generated independently as $y_i=\vct{x}_i^T{\boldsymbol{\beta}}^\star+ z_i$ where $z_i\sim\mathcal{N}(0,\sigma^2)$ and $\vct{x}_i\sim\mathcal{N}(0,{\boldsymbol{{\Sigma}}})$. Additionally, the map $\phi(\cdot)$ is identity and $p=d$. \end{definition}} \cmt{Given an ERM problem \eqref{erm} with nonlinear map $\phi$, we will relate it to an equivalent LGP to characterize its properties. The equivalence is ensured by setting up LGP to exhibit similar second order characteristics as the original problem. \begin{definition}[Equivalent Linear Problem] Given distribution $(\vct{x},y)$ $\sim\mathcal{D}$, the equivalent LGP(${\boldsymbol{\beta}},{\boldsymbol{{\Sigma}}},\sigma$) with $n$ samples is given with parameters ${\boldsymbol{{\Sigma}}}=\operatorname{\mathbb{E}}[\vct{x}\x^T]$, ${\boldsymbol{\beta}}^\star={\boldsymbol{{\Sigma}}}^{-1}\operatorname{\mathbb{E}}[y\vct{x}]$ and $\sigma=\operatorname{\mathbb{E}}[(y-\vct{x}^T{\boldsymbol{\beta}}^\star)^2]^{1/2}$. \end{definition} Our key theoretical contribution is formalizing the DC of the LGPs which also enables us to characterize pruning/retraining dynamics. We then empirically verify that DC and pruning dynamics of equivalent LGPs can successfully predict the original problem which can be random feature regression. In the context of high-dimensional learning literature, equivalent LGP is known to be a useful proxy for predicting the performance of the original ERM task \cite{}. This work goes beyond the existing works by demonstrating it can also successfully predict pruning/retraining dynamics. Formalizing this connection is an important future research avenue and it can presumably be accomplished by building on the recent high-dimensional universality results such as \cite{}.} \cmt{ \noindent\textbf{Covariance diagonalization:} Let ${\boldsymbol{{\Sigma}}}$ have eigenvalue decomposition ${\mtx{U}}\bar{{\boldsymbol{{\Sigma}}}}{\mtx{U}}^T$. Let ${\boldsymbol{\hat{\beta}}}$ be the minimizer of empirical risk. Observe that ${\mtx{X}}=\bar{{\mtx{X}}}{\mtx{U}}^T$ where $\bar{{\mtx{X}}}$ has features with diagonal covariance $\bar{{\boldsymbol{{\Sigma}}}}$. Let ${\hat{\bar{\boldsymbol{\beta}}}}$ be the solution of ERM for $(\vct{y},\bar{{\mtx{X}}})$ pair. Then ${\boldsymbol{\hat{\beta}}}={\mtx{U}}{\hat{\bar{\boldsymbol{\beta}}}}$. \begin{definition}[Linear model] \label{d model}Fix a positive semidefinite covariance matrix ${\boldsymbol{{\Sigma}}}\in\mathbb{R}^{p\times p}$ and latent parameter ${\boldsymbol{\beta}}\in\mathbb{R}^p$ satisfying ${\boldsymbol{\beta}}^T{\boldsymbol{{\Sigma}}}{\boldsymbol{\beta}}=\alpha$. Suppose $(\vct{x}_i)_{i=1}^n\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,{\boldsymbol{{\Sigma}}})$. The samples $(\vct{x}_i,y_i)_{i=1}^n$ are generated as \[ y_i=\vct{x}_i^T{\boldsymbol{\beta}}+\sigma z_i, \] where $\sigma^2$ is the noise variance and $(z_i)_{i=1}^n$ is the noise sequence. \end{definition} Declare the first $s$ entries of ${\boldsymbol{\beta}}$ to be $\vct{t}=\mathbb{F}_s({\boldsymbol{\beta}})$. We estimate $\vct{t}$ via \begin{align} \boldsymbol{\hat{\theta}}=\mathbb{F}_s({\boldsymbol{\hat{\beta}}})\quad\text{where}\quad {\boldsymbol{\hat{\beta}}}=\arg\min_{{\boldsymbol{\beta}}'} \tn{\vct{y}-{\mtx{X}}{\boldsymbol{\beta}}'}.\label{optim me} \end{align} If the problem is over-parameterized ($p>n$), there are infinitely many feasible solutions ${\boldsymbol{\hat{\beta}}}$ achieving zero empirical loss. In this case, we investigate the minimum $\ell_2$ norm solution which is pseudo-inverse given by \begin{align} \boldsymbol{\hat{\theta}}=\mathbb{F}_s({\boldsymbol{\hat{\beta}}})\quad\text{where}\quad {\boldsymbol{\hat{\beta}}}=\arg\min_{{\boldsymbol{\beta}}'} \tn{{\boldsymbol{\beta}}'}\quad\text{subject to}\quad \vct{y}={\mtx{X}}{\boldsymbol{\beta}}'.\label{optim me2} \end{align} For the following discussion we set ${\mtx{X}}={\mtx{\bar{X}}}\sqrt{\bSi}$ so that ${\mtx{\bar{X}}}\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,1)$.} Here, we present our main theoretical result: a sharp asymptotic characterization of the distribution of the solution to overparameterized least-squares for correlated designs. We further show how this leads to a sharp prediction of the risk of magnitude-based pruning. Concretely, for the rest of this section, we assume the linear Gaussian problem (LGP) of Definition \ref{def LGP}, the overparameterized regime $k=p>n$ and the min-norm model \begin{align} \hat{\boldsymbol{\beta}} = \arg\min_{\boldsymbol{\beta}} \tn{\boldsymbol{\beta}} ~\text{s.t.}~\vct{y}={\mtx{X}}{\boldsymbol{\beta}}.\label{eq:min_norm} \end{align} As mentioned in Sec.~\ref{sec:setup}, $\hat{\boldsymbol{\beta}}$ is actually given in closed-form as ${\boldsymbol{\hat{\beta}}}={\mtx{X}}^\dagger \vct{y}$. Interestingly, our analysis of the distribution of ${\boldsymbol{\hat{\beta}}}$ does not rely on the closed-form expression, but rather follows by viewing ${\boldsymbol{\hat{\beta}}}$ as the solution to the convex linearly-constrained quadratic program in \eqref{eq:min_norm}. Specifically, our analysis uses the framework of the convex Gaussian min-max Theorem (CGMT) \cite{thrampoulidis2015regularized}, which allows to study rather general inference optimization problems such as the one in \eqref{eq:min_norm}, by relating them with an auxiliary optimization that is simpler to analyze \cite{StoLASSO,oymak2013squared,thrampoulidis2015regularized,thrampoulidis2018precise,salehi2019impact,taheri2020fundamental}. Due to space considerations, we focus here on the more challenging overparameterized regime and defer the analysis of the underparameterized regime to the SM. \subsection{Distributional Characterization of the Overparameterized Linear Gaussian Models} \noindent\emph{Notation:} We first introduce additional notation necessary to state our theoretical results. $\odot$ denotes the entrywise product of two vectors and ${\mathbf{1}}_p$ is the all ones vector in $\mathbb{R}^p$. The \emph{empirical distribution} of a vector $\vct{x}\in\mathbb{R}^p$ is given by $ \frac{1}{p}\sum_{i=1}^p \delta_{x_i}$, where $\delta_{x_i}$ denotes a Dirac delta mass on $x_i$. Similarly, the empirical joint distribution of vectors $\vct{x}, \vct{x}'\in \mathbb{R}^p$ is $\frac{1}{p} \sum_{i=1}^p \delta_{(x_i, x'_i)}$. The \emph{Wasserstein-$k$} ($W_k$) distance between two measures $\mu$ and $\nu$ is defined as $W_k(\mu,\nu) \equiv \left(\inf_{\rho}\operatorname{\mathbb{E}}_{(X,Y)\sim \rho}|X-Y|^k\right)^{1/k},$ where the infimum is over all the couplings of $\mu$ and $\nu$, i.e. all random variables $(X,Y)$ such that $X\sim\mu$ and $Y\sim\nu$ marginally. A sequence of probability distributions $\nu_p$ on $\mathbb{R}^m$ {converges in $W_k$} to $\nu$, written $\nu_p\stackrel{W_k}{\Longrightarrow} \nu$, if $W_k(\nu_p,\nu) \rightarrow 0$ as $p \rightarrow \infty$. Finally, we say that a function $f:\mathbb{R}^m\rightarrow\mathbb{R}$ is pseudo-Lipschitz of order $k$, denoted $f\in\rm{PL}(k)$, if there is a constant $L>0$ such that for all $\vct{x},\vct{y}\in\mathbb{R}^m$, $ |f(\vct{x}) - f(\vct{y})|\leq L(1+\tn{\vct{x}}^{k-1}+\tn{\vct{y}}^{k-1})\|\vct{x}-\vct{y}\|_2. $ \fy{We call $L$ the $\rm{PL}(k)$ constant of $f$.} An equivalent definition of $W_k$ convergence is that, for any $f\in\rm{PL}(k)$, $\lim_{p\rightarrow\infty}\operatorname{\mathbb{E}} f(X_p)=\operatorname{\mathbb{E}} f(X)$, where expectation is with respect to $X_p\sim\nu_p$ and $X\sim\nu$. For a sequence of random variables $\mathcal{X}_{p}$ that converge in probability to some constant $c$ in the limit of Assumption \ref{ass:linear} below, we write $\mathcal{X}_{p}\stackrel{{P}}{\longrightarrow} c$. \vspace{3pt} Next, we formalize the set of assumption under which our analysis applies. Our asymptotic results hold in the linear asymptotic regime specified below. \begin{assumption}\label{ass:linear} We focus on a double asymptotic regime where $n,p,s\rightarrow\infty$ at fixed overparameterization ratio $\kappa:=p/n>0$ and sparsity level $\alpha:=s/p\in(0,1)$. \end{assumption} Additionally, we require certain mild assumptions on the behavior of the covariance matrix $\boldsymbol{\Sigma}$ and of the true latent vector ${\boldsymbol{\beta}}^\star$. For simplicity, we assume here that $\boldsymbol{\Sigma} = \diag{[\boldsymbol{\Sigma}_{1,1},\ldots,\boldsymbol{\Sigma}_{p,p}]}$ \begin{restatable}{assumption}{asstwo}\label{ass:inv} {The covariance matrix $\boldsymbol{\Sigma}$ is diagonal} and there exist constants $\Sigma_{\min},\Sigma_{\max}\in(0,\infty)$ such that: $ \Sigma_{\min}\leq{\boldsymbol{{\Sigma}}}_{i,i}\leq \Sigma_{\max}, $ for all $i\in[p].$ \end{restatable} \begin{restatable}{assumption}{assthree}\label{ass:mu} The joint empirical distribution of $\{(\bSi_{i,i},\sqrt{p}\betab^\star_i)\}_{i\in[p]}$ converges in {Wasserstein-k} distance to a probability distribution $\mu$ on $\mathbb{R}_{>0}\times\mathbb{R}$ {for some {$k\geq 4$}}. That is $ \frac{1}{p}\sum_{i\in[p]}\delta_{(\bSi_{i,i},\sqrt{p}\betab^\star_i)} \stackrel{W_k}{\Longrightarrow} \mu. $ \end{restatable} With these, we are ready to define, what will turn out to be, the asymptotic DC in the overparameterized regime. \begin{definition}[Asymptotic DC -- Overparameterized regime]\label{def:Xi} Let random variables $(\Lambda,B)\sim \mu$ (where $\mu$ is defined in Assumption \ref{ass:mu}) and fix $\kappa>1$. Define parameter $\xi$ as the unique positive solution to the following equation \begin{align}\label{eq:ksi} \operatorname{\mathbb{E}}_{\mu}\Big[ \big({1+(\xi\cdot\Lambda)^{-1}}\big)^{-1} \Big] = {\kappa^{-1}}\,. \end{align} Further define the positive parameter $\gamma$ as follows: \begin{align} \label{eq:gamma} \hspace{-0.1in}\gamma := \Big({\sigma^2 + \operatorname{\mathbb{E}}_{\mu}\Big[\frac{B^2\Lambda}{(1+\xi\Lambda)^2}\Big]}\Big)\Big/\Big({1-\kappa\operatorname{\mathbb{E}}_{\mu}\Big[\frac{1}{\left(1+(\xi\Lambda)^{-1}\right)^2}\Big]}\Big). \end{align} With these and $H\sim\mathcal{N}(0,1)$, define the random variable \begin{align} X_{\kappa,\sigma^2}(\Lambda,B,H) := \Big(1-\frac{1}{1+ \xi\Lambda}\Big) B + \sqrt{\kappa}\frac{\sqrt{\gamma}\,\Lambda^{-1/2}}{1+(\xi\Lambda)^{-1}} H, \label{eq:X} \end{align} and let $\Pi_{\kappa,\sigma^2}$ be its distribution. \end{definition} \fy{Our main result establishes asymptotic convergence of the empirical distribution of $(\sqrt{p}{\boldsymbol{\hat{\beta}}},\sqrt{p}\betab^\star,\boldsymbol{\Sigma})$ for a rich class of test functions. These are the functions within $\rm{PL}(3)$ that become $\rm{PL}(2)$ when restricted to the first two indices. Formally, we define this class of functions as follows \begin{align}\label{eq:pdef} {\cal{F}} :=\{&f:\mathbb{R}^2\times {\cal{Z}}\rightarrow\mathbb{R},~f\in \rm{PL}(3)~\text{and}~\\ &\sup_{z\in{\cal{Z}}}\text{``}\rm{PL}(2)~\text{constant~of}~f(\cdot,\cdot,z)\text{''}<\infty\}.\notag \end{align} For pruning analysis, we set ${\cal{Z}}=[\Sigma_{\min},\Sigma_{\max}]$ and define \begin{align}\label{eq:fdef} {\cal{F}}_{\cal{L}}:= \{ f:\mathbb{R}^2\times {\cal{Z}}\rightarrow\mathbb{R}~\big|~&f(x,y,z) = z(y-g(x))^2\notag\\ &~\text{where}~g(\cdot)~\text{is Lipschitz}\}. \end{align} As discussed below, ${\cal{F}}_{\cal{L}}$ is important for predicting the risk of the (pruned) model. In the SM, we prove that ${\cal{F}}_{\cal{L}}\subset {\cal{F}}$. We are now ready to state our main theoretical result. \cts{ \begin{restatable}[Asymptotic DC -- Overparameterized LGP]{theorem}{mainthm}\label{thm:master_W2} Fix $\kappa>1$ and suppose Assumptions \ref{ass:inv} and \ref{ass:mu} hold. Recall the solution ${\boldsymbol{\hat{\beta}}}$ from \eqref{eq:min_norm} and let \[ \hat\Pi_n(\vct{y},{\mtx{X}},\betab^\star,\boldsymbol{\Sigma}):=\frac{1}{p}\sum_{i=1}^{p}\delta_{(\sqrt{p}{\boldsymbol{\hat{\beta}}}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i})} \] be the joint empirical distribution of $(\sqrt{p}{\boldsymbol{\hat{\beta}}},\sqrt{p}\betab^\star,\boldsymbol{\Sigma})$. Let $f:\mathbb{R}^3\rightarrow\mathbb{R}$ be a function in ${\cal{F}}$ defined in \eqref{eq:pdef}. We have that \begin{align}\label{eq:thm} \hspace{-0.1in}\frac{1}{p} \sum_{i=1}^{p} f(\sqrt{p}\hat\boldsymbol{\beta}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i}) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}\left[f(X_{\kappa,\sigma^2},B,\Lambda) \right]. \end{align} \end{restatable} } As advertised, Theorem \ref{thm:master_W2} fully characterizes the joint empirical distribution of the min-norm solution, the latent vector and the covariance spectrum. The asymptotic DC allows us to precisely characterize several quantities of interest, such as estimation error, generalization error etc.. For example, a direct application of \eqref{eq:thm} to the function $f(x,y,z)=z(y-x)^2\in {\cal{F}}_{\cal{L}}\subset{\cal{F}}$ directly yields the risk prediction of the min-norm solution recovering \cite[Thm.~3]{hastie2019surprises} as a special case. Later in this section, we show how to use Theorem \ref{thm:master_W2} towards the more challenging task of precisely characterizing the risk of magnitude-based pruning. Before that, let us quickly remark on the technical novelty of the theorem. Prior work has mostly applied the CGMT to isotropic features. Out of these, only very few obtain DC, \cite{thrampoulidis2018symbol,miolane2018distribution}, while the majority focuses on simpler metrics, such as squared-error. Instead, Theorem \ref{thm:master_W2} considers correlated designs and the overparameterized regime. The most closely related work in that respect is \cite{montanari2019generalization}, which very recently obtained the DC of the max-margin classifier. Similar to us, they use the CGMT, but their analysis of the auxiliary optimization is technically different to ours. Our approach is similar to \cite{thrampoulidis2018symbol}, but extra technical effort is needed to account for correlated designs and the overparameterized regime. \subsection{From DC to Risk Characterization}\label{sec:risk} First, we consider a simpler ``threshold-based" pruning method that applies a fixed threshold at every entry of $\hat\boldsymbol{\beta}$. Next, we relate this to magnitude-based pruning and obtain a characterization for the performance of the latter. In order to define the threshold-based pruning vector, let \[ \mathcal{T}_t(x) = \begin{cases} x & \text{if } |x|>t \\ 0 & \text{otherwise} \end{cases}, \] be the hard-thresholding function with fixed threshold $t\in\mathbb{R}_+$. Define ${\boldsymbol{\hat{\beta}}}^\mathcal{T}_{t} := \mathcal{T}_{t/\sqrt{p}}(\hat{\boldsymbol{\beta}})$, where $\mathcal{T}_t$ acts component-wise. Then, the population risk of ${\boldsymbol{\hat{\beta}}}^\mathcal{T}_t$ becomes \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}}^\mathcal{T}_t) &= \operatorname{\mathbb{E}}_{\mathcal{D}}[(\vct{x}^T({\boldsymbol{\beta}}^\star-{\boldsymbol{\hat{\beta}}}^\mathcal{T}_t) + \sigma z)^2] \notag\\ \cmt{&= \sigma^2 + ({\boldsymbol{\beta}}^\star-{\boldsymbol{\hat{\beta}}}^\mathcal{T}_t)^T\boldsymbol{\Sigma}({\boldsymbol{\beta}}^\star-{\boldsymbol{\hat{\beta}}}^\mathcal{T}_t) \notag \\} &= \sigma^2 + \frac{1}{p}\sum_{i=1}^p\boldsymbol{\Sigma}_{i,i}\big(\sqrt{p}\betab^\star_i-\mathcal{T}_{t}(\sqrt{p}\hat\boldsymbol{\beta}_i)\big)^2\notag\\ &\stackrel{{P}}{\longrightarrow} \sigma^2 + \operatorname{\mathbb{E}}\left[ \Lambda\left(B-\mathcal{T}_t(X_{\kappa,\sigma^2})\right)^2 \right]\,. \label{eq:loss_w2} \end{align} In the second line above, we note that $\sqrt{p}\mathcal{T}_{t'}(x)=\mathcal{T}_{\sqrt{p}t'}(\sqrt{p}x)$. In the last line, we apply \eqref{eq:thm}, after recognizing that the function $(x,y,z)\mapsto z(y-\mathcal{T}_t(x))^2$ is a member of the ${\cal{F}}_{\cal{L}}$ family defined in \eqref{eq:fdef}. As in \eqref{eq:thm}, the expectation here is with respect to $(\Lambda,B,H)\sim\mu\otimes\mathcal{N}(0,1)$. Now, we show how to use \eqref{eq:loss_w2} and Theorem \ref{thm:master_W2} to characterize the risk of the magnitude-based pruned vector $\boldsymbol{\beta}^M_s:=\mathbb{T}_s({\boldsymbol{\hat{\beta}}})$. Recall, here from Assumption \ref{ass:linear} that $s=\alpha p$. To relate $\hat{\boldsymbol{\beta}}^M_s$ to ${\boldsymbol{\hat{\beta}}}^\mathcal{T}_t$, consider the set $\mathcal{S}_t:=\{i\in[p]\,:\,\sqrt{p}|\hat\boldsymbol{\beta}_i| \geq t \}$ for some constant $t\in\mathbb{R}_+$ (not scaling with $n,p,s$). Note that the ratio ${|\mathcal{S}_t|}/{p}$ is equal to \begin{align} p^{-1}\sum_{i=1}^p\mathbb{1}_{[\sqrt{p}|\hat\boldsymbol{\beta}_i| \geq t]} \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}[\mathbb{1}_{[|X_{\kappa,\sigma^2}|\geq t]}] = \P\left(|X_{\kappa,\sigma^2}|\geq t\right).\notag \end{align} Here, $\mathbb{1}$ denotes the indicator function and the convergence follows from Theorem \ref{thm:master_W2} when applied to a sequence of bounded Lipschitz functions approximating the indicator. Thus, by choosing \begin{align}\label{eq:tstar} t^\star:=\sup\left\{t\in\mathbb{R}\,:\, \P(|X_{\kappa,\sigma^2}|\geq t) \geq \alpha \right\}, \end{align} it holds that ${|\mathcal{S}_t|}/{p}\stackrel{{P}}{\longrightarrow}\alpha$. In words, and {observing that $X_{\kappa,\sigma^2}$ admits a continuous density (due to the Gaussian variable $H$)}: for any $\varepsilon>0$, in the limit of $n,p,s\rightarrow\infty$, the vector ${\boldsymbol{\hat{\beta}}}^\mathcal{T}_{t^\star}$ has $(1\pm\varepsilon) \alpha p= (1\pm\varepsilon) s$ non-zero entries, which correspond to the largest magnitude entries of ${\boldsymbol{\hat{\beta}}}$, with probability approaching1. Since this holds for arbitrarily small $\varepsilon>0$, recalling $t^\star$ as in \eqref{eq:tstar}, we can conclude from \eqref{eq:loss_w2} that the risk of the magnitude-pruned model converges as follows. {\begin{restatable}[Risk of Magnitude-pruning]{corollary}{cormag}\label{cor:mag} Let the same assumptions and notation as in the statement of Theorem \ref{thm:master_W2} hold. Specifically, let $\hat\boldsymbol{\beta}$ be the min-norm solution in \eqref{eq:min_norm} and ${\boldsymbol{\hat{\beta}}}_s^M:=\mathbb{T}_s({\boldsymbol{\beta}})$ the magnitude-pruned model at sparsity $s$. Recall the threshold $t^\star$ from \eqref{eq:tstar}. The risk of ${\boldsymbol{\hat{\beta}}}^M_s$ satisfies the following in the limit of $n,p,s\rightarrow\infty$ at rates $\kappa:=p/n>1$ and $\alpha:=s/p\in(0,1)$ (cf. Assumption \ref{ass:linear}): \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}}^M_s) \stackrel{{P}}{\longrightarrow} \sigma^2 + \operatorname{\mathbb{E}}\left[ \Lambda\left(B-\mathcal{T}_{t^\star}(X_{\kappa,\sigma^2})\right)^2 \right],\notag \end{align} where the expectation is over $(\Lambda,B,H)\sim\mu\otimes\mathcal{N}(0,1).$ \end{restatable}} \cmt{LET US NOT FORGET TO ADD OR COMMENT ABOUT UNDERPARAM!} \subsection{Non-asymptotic DC and Retraining Formula} While Theorem \ref{thm:master_W2} is stated in the asymptotic regime, during analysis, the DC arises in a non-asymptotic fashion. The following definition is the non-asymptotic counterpart of Def.~\ref{def:Xi}. We remark that this definition applies to arbitrary covariance (not necessarily diagonal) by applying a simple eigen-rotation before and after the DC formula associated with the diagonalized covariance. \cmt{ \begin{definition}[Non-asymptotic DC] \label{aux_def}Fix $p>n\geq 1$ and set $\kappa=p/n>1$. Given $\sigma>0$, covariance ${\boldsymbol{{\Sigma}}}={\mtx{U}}\text{diag}(\boldsymbol{\lambda}){\mtx{U}}^T$ and latent vector ${\boldsymbol{\beta}}$, set $\bar{{\boldsymbol{\beta}}}={\mtx{U}}^T{\boldsymbol{\beta}}$ and define the unique non-negative terms $\Xi,\Gamma,\boldsymbol{\zeta}\in\mathbb{R}^p$ and $\boldsymbol{\phi}\in\mathbb{R}^p$ as follows\vspace{-0pt} \begin{align} &\Xi>0\quad\text{is the solution of}\quad 1=\frac{\kappa}{p}\sum_{i=1}^p\frac{1}{1+(\Xi\boldsymbol{\lambda}_i)^{-1}},\notag\\ &\Gamma=\frac{\sigma^2+\sum_{i=1}^p\boldsymbol{\lambda}_i\boldsymbol{\zeta}_i^2\bar{{\boldsymbol{\beta}}}_i^2}{\kappa(1-\frac{\kappa}{p}\sum_{i=1}^p{(1+(\Xi\boldsymbol{\lambda}_i)^{-1})^{-2}})},\notag\\ &\boldsymbol{\zeta}_i=\frac{1}{1+\Xi\boldsymbol{\lambda}_i}\quad\text{and}\quad \boldsymbol{\phi}_i=\frac{\kappa\sqrt{\Gamma}}{1+(\Xi\boldsymbol{\lambda}_i)^{-1}}\quad\text{for}\quad 1\leq i\leq p.\notag \end{align} The non-asymptotic OP-LS distribution is defined as the following ${\mtx{U}}$-rotated normal distribution \[ \mathcal{D}_{\sigma,{\boldsymbol{{\Sigma}}},{\boldsymbol{\beta}}}={\mtx{U}}\mathcal{N}(({\mathbf{1}}_p-\boldsymbol{\zeta})\odot\bar{{\boldsymbol{\beta}}},p^{-1}\text{diag}(\boldsymbol{\lambda}^{-1}\odot\boldsymbol{\phi}^2)). \] \end{definition}} \begin{definition}[Non-asymptotic DC] \label{aux_def}Fix $p>n\geq 1$ and set $\kappa=p/n>1$. Given $\sigma>0$, covariance ${\boldsymbol{{\Sigma}}}={\mtx{U}}\text{diag}(\boldsymbol{\lambda}){\mtx{U}}^T$ and latent vector ${\boldsymbol{\beta}}$, set $\bar{{\boldsymbol{\beta}}}={\mtx{U}}^T{\boldsymbol{\beta}}$ and define the unique non-negative terms $\xi,\gamma,\boldsymbol{\zeta}\in\mathbb{R}^p$ and $\boldsymbol{\phi}\in\mathbb{R}^p$ as follows:\vspace{-0pt} \begin{align} &\xi>0\quad\text{is the solution of}\quad \kappa^{-1}={p^{-1}}\sum_{i=1}^p\big({1+(\xi\boldsymbol{\lambda}_i)^{-1}}\big)^{-1},\notag\\ &\gamma=\frac{\sigma^2+\sum_{i=1}^p\boldsymbol{\lambda}_i\boldsymbol{\zeta}_i^2\bar{{\boldsymbol{\beta}}}_i^2}{1-\frac{\kappa}{p}\sum_{i=1}^p{(1+(\xi\boldsymbol{\lambda}_i)^{-1})^{-2}}},\notag\\ &\boldsymbol{\zeta}_i=({1+\xi\boldsymbol{\lambda}_i})^{-1}\quad\text{,}\quad \boldsymbol{\phi}_i={\kappa\gamma}(1+(\xi\boldsymbol{\lambda}_i)^{-1})^{-2},~ 1\leq i\leq p.\notag \end{align} The non-asymptotic distributional prediction is given by the following ${\mtx{U}}$-rotated normal distribution \[ \mathcal{D}_{\sigma,{\boldsymbol{{\Sigma}}},{\boldsymbol{\beta}}}={\mtx{U}}\mathcal{N}(({\mathbf{1}}_p-\boldsymbol{\zeta})\odot\bar{{\boldsymbol{\beta}}},p^{-1}\text{diag}(\boldsymbol{\lambda}^{-1}\odot\boldsymbol{\phi})). \] \end{definition} {We remark that this definition is similar in spirit to the concurrent/recent work \cite{li2020exploring}. However, unlike this work, here we prove the asymptotic correctness of the DC, we use it to rigorously predict the pruning performance and also extend this to retraining DC as discussed next.} \noindent \textbf{Retraining DC.} As the next step, we would like to characterize the DC of the solution after retraining, i.e.,~${\boldsymbol{\hat{\beta}}}^{RT}$. We carry out the retraining derivation (for magnitude pruning) as follows. Let ${\mathcal{I}}\subset[p]$ be the nonzero support of the pruned vector ${\boldsymbol{\hat{\beta}}}^M_s$. Re-solving \eqref{eq:ERM} restricted to the features over ${\mathcal{I}}$ corresponds to a linear problem with effective feature covariance ${\boldsymbol{{\Sigma}}}_{\mathcal{I}}$ with support of non-zeros restricted to ${\mathcal{I}}\times {\mathcal{I}}$. For this feature covariance, we can also calculate the effective noise level and global minima of the population risk ${\boldsymbol{\beta}}^\star_{\mathcal{I}}$. The latter has the closed-form solution ${\boldsymbol{\beta}}^\star_{\mathcal{I}}={\boldsymbol{{\Sigma}}}_{\mathcal{I}}^\dagger{\boldsymbol{{\Sigma}}}{\boldsymbol{\beta}}^\star$. The effective noise is given by accounting for the risk change due to the missing features via $\sigma_{\mathcal{I}}=(\sigma^2+{{\boldsymbol{\beta}}^\star}^T{\boldsymbol{{\Sigma}}}{\boldsymbol{\beta}}^\star-{{\boldsymbol{\beta}}^\star_{\mathcal{I}}}^T{\boldsymbol{{\Sigma}}}_{\mathcal{I}}{\boldsymbol{\beta}}^\star_{\mathcal{I}})^{1/2}$. With these terms in place, fixing ${\mathcal{I}}$ and using Def.~\ref{aux_def}, the retraining prediction becomes $\mathcal{D}_{\sigma_{{\mathcal{I}}},{\boldsymbol{{\Sigma}}}_{{\mathcal{I}}},\boldsymbol{\beta}^\star_{\mathcal{I}}}$. This process is summarized below. \begin{definition}[Retraining DC] \label{RT_def}Consider the setting of Def.~\ref{aux_def} with $\sigma,{\boldsymbol{{\Sigma}}},{\boldsymbol{\beta}}^\star$ and sparsity target $s$. The sample ${\boldsymbol{\hat{\beta}}}^{RT}$ from the retraining distribution $\mathcal{D}^{\text{RT,s}}_{\sigma,{\boldsymbol{{\Sigma}}},{\boldsymbol{\beta}}^\star}$ is constructed as follows. Sample ${\boldsymbol{\hat{\beta}}}\sim \mathcal{D}_{\sigma,{\boldsymbol{{\Sigma}}},{\boldsymbol{\beta}}^\star}$ and compute the set of the top-$s$ indices ${\mathcal{I}}={\mathcal{I}}(\mathbb{T}_s({\boldsymbol{\hat{\beta}}}))$. Given ${\mathcal{I}}$, obtain the effective covariance ${\boldsymbol{{\Sigma}}}_{\mathcal{I}}\in\mathbb{R}^{p\times p}$, population minima ${\boldsymbol{\beta}}^\star_{\mathcal{I}}\in\mathbb{R}^p$, and the noise level $\sigma_{{\mathcal{I}}}>0$ as described above. Draw ${\boldsymbol{\hat{\beta}}}^{RT}\sim\mathcal{D}_{\sigma_{{\mathcal{I}}},{\boldsymbol{{\Sigma}}}_{{\mathcal{I}}},\boldsymbol{\beta}^\star_{\mathcal{I}}}$. \cmt{Obtain ${\boldsymbol{{\Sigma}}}_{\mathcal{I}}\in\mathbb{R}^{p\times p}$ by restricting the nonzero support of ${\boldsymbol{{\Sigma}}}$ to ${\mathcal{I}}\times {\mathcal{I}}$. Set ${\mathcal{I}}$ restricted population minima ${\boldsymbol{\beta}}^\star_{\mathcal{I}}={\boldsymbol{{\Sigma}}}_{\mathcal{I}}^\dagger{\boldsymbol{{\Sigma}}}{\boldsymbol{\beta}}^\star$ and set the new noise level $\sigma_{{\mathcal{I}}}=(\sigma^2+{{\boldsymbol{\beta}}^\star}^T{\boldsymbol{{\Sigma}}}{\boldsymbol{\beta}}^\star-{{\boldsymbol{\beta}}^\star_{\mathcal{I}}}^T{\boldsymbol{{\Sigma}}}_{\mathcal{I}}{\boldsymbol{\beta}}^\star_{\mathcal{I}})^{1/2}$. Draw ${\boldsymbol{\hat{\beta}}}^{RT}\sim\mathcal{D}_{\sigma_{{\mathcal{I}}},{\boldsymbol{{\Sigma}}}_{{\mathcal{I}}},{\boldsymbol{\beta}}_{\mathcal{I}}}$. } \end{definition} Observe that, the support ${\mathcal{I}}$ depends on the samples $\mathcal{S}$ via ${\boldsymbol{\hat{\beta}}}$. Thus, our retraining DC is actually derived for the scenario when the retraining phase uses a fresh set of $n$ samples to break the dependence between ${\mathcal{I}},\mathcal{S}$ (which obtains ${\boldsymbol{\hat{\beta}}}^{RT}_{\text{fresh}}$). Despite this, we empirically observe that the retraining DC predicts the regular retraining (reusing $\mathcal{S}$) performance remarkably well and perfectly predicts ${\boldsymbol{\hat{\beta}}}^{RT}_{\text{fresh}}$ as discussed in Figs.~\ref{figRF} and \ref{figRF2}. Finally, we defer the formalization of the retraining analysis to a future work. This includes proving that ${\boldsymbol{\hat{\beta}}}^{RT}_{\text{fresh}}$ obeys Def.~\ref{RT_def} asymptotically as well as directly studying ${\boldsymbol{\hat{\beta}}}^{RT}$ by capturing the impact of the ${\mathcal{I}},\mathcal{S}$ dependency. \subsection{Overdetermined Analysis} \begin{theorem}[Overdetermined estimation] Consider a linear model described in Definition \ref{d model}. Assume $\kappa=p/n<1$. Let $\vct{h}\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,{\mtx{I}}_p)$ and $\bar{\h}=\vct{h}/\tn{\vct{h}}$. Define \[ {\boldsymbol{\hat{\beta}}}_{AO}={\boldsymbol{\beta}}+w_*{\boldsymbol{{\Sigma}}}^{-1/2}\bar{\h}\qquad\text{and}\qquad w_*=\sqrt{\frac{\kappa}{1-\kappa}}\sigma \] Then, for any $1$-Lipschitz function $F$, with probability $1-C\mathrm{e}^{-c\varepsilon^2p}$, we have that \[ |\tn{F({\boldsymbol{\hat{\beta}}})}-\operatorname{\mathbb{E}}[\tn{F({\boldsymbol{\hat{\beta}}}_{AO})}]|\leq \varepsilon \] \end{theorem}\som{I think we can do a change of variable to fully get rid of the role of ${\boldsymbol{{\Sigma}}}$} \begin{proof} Fix $h\in\mathbb{R},{\vct{g}}\in\mathbb{R}^n,\vct{h}\in\mathbb{R}^p,{\mtx{\bar{X}}}\in\mathbb{R}^{n\times p}\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,1)$. We are interested in ordinary least-square solution ${\boldsymbol{\hat{\beta}}}=\arg\min_{{\boldsymbol{\beta}}}{\tn{\vct{y}-{\mtx{\bar{X}}}\sqrt{{\boldsymbol{{\Sigma}}}}{\boldsymbol{\beta}}}}$. Set $\vct{w}={\boldsymbol{\beta}}-{\boldsymbol{\hat{\beta}}}$, ${\mtx{X}}'=[{\mtx{\bar{X}}}~{\vct{z}}]$ and $\boldsymbol{\omega}=\sqrt{{\boldsymbol{{\Sigma}}}}\vct{w}$. Hence consider CGMT with $\lambda=1$ and $\psi(\cdot)=0$, we have \begin{align} \Phi_\mathcal{S}({\mtx{X}})&=\min_{\boldsymbol{\omega}\in\mathcal{S}}\tn{{\mtx{X}}'\left[\begin{matrix} \boldsymbol{\omega} \\ \sigma \end{matrix}\right]}\label{overder Phi}\\ \phi_\mathcal{S}({\vct{g}},\vct{h}, h)&=\min_{\boldsymbol{\omega}\in\mathcal{S}}(\tn{\left[\begin{matrix} \boldsymbol{\omega} \\ \sigma \end{matrix}\right]}\tn{{\vct{g}}}-\vct{h}^T\boldsymbol{\omega}+h\sigma)_+\label{overder phi} \end{align} We will argue that the solution of \ref{overder phi} has similar statistical properties to \[ \vct{w}_{AO}=w_*{\boldsymbol{{\Sigma}}}^{-1/2}\bar{\h}\qquad\text{where}\qquad w_*=\sqrt{\frac{\kappa}{1-\kappa}}\sigma \] We see that the loss function is almost in the format of \eqref{overder Phi} except for a set restriction $\boldsymbol{\omega}\in\mathcal{S}$. To proceed, following Lemma \ref{dist cont lem} with a proper choice set $\mathcal{S}$, the solution of unconstrained problem lies in $\mathcal{S}^c$ with high probability. Specifically, we are interested in showing similar behavior to the $1$-Lipschitz function $F'(\boldsymbol{\omega}_{AO})=F(\sqrt{{\boldsymbol{{\Sigma}}}}{\boldsymbol{\beta}}-\boldsymbol{\omega}_{AO})$ where $\boldsymbol{\omega}_{AO}=\sqrt{{\boldsymbol{{\Sigma}}}}\vct{w}_{AO}$. Hence, in the following discussion, we choose \[ \mathcal{S}=\{\boldsymbol{\omega}{~\big |~} |\tn{F'(\boldsymbol{\omega})}-{\operatorname{\mathbb{E}}[\tn{F'(\boldsymbol{\omega}_{AO})}]}|\geq 2\varepsilon\}. \] and will argue that with high probability, $\boldsymbol{\omega}_{PO}\not\in\mathcal{S}$. From Gaussian concentration of Lipschitz functions, we have that \begin{align} \mathbb{P}(|\tn{F'(\boldsymbol{\omega}_{AO})}-\operatorname{\mathbb{E}}[\tn{F'(\boldsymbol{\omega}_{AO})}]|\geq \varepsilon)\leq C\mathrm{e}^{-c\varepsilon^2p}.\label{con gauss} \end{align} Define the set \[ \mathcal{B}=\{\boldsymbol{\omega}{~\big |~}\tn{\boldsymbol{\omega}-\boldsymbol{\omega}_{AO}}\geq \varepsilon\}. \] Let $E$ be the event that $\mathcal{B}\supseteq\mathcal{S}$. Then $\mathbb{P}(E)\geq 1-C\mathrm{e}^{-c\varepsilon^2p}$, as whenever \eqref{con gauss} holds, for any $\boldsymbol{\omega}\not\in\mathcal{B}$, we find $\boldsymbol{\omega}\not\in\mathcal{S}$ as follows \begin{align} |\tn{F'(\boldsymbol{\omega})}-\operatorname{\mathbb{E}}[\tn{F'(\boldsymbol{\omega}_{AO})}]|&\leq|\tn{F'(\boldsymbol{\omega})}-\tn{F'(\boldsymbol{\omega}_{AO})}|+|\operatorname{\mathbb{E}}[\tn{F'(\boldsymbol{\omega}_{AO})}]-\tn{F'(\boldsymbol{\omega}_{AO})}|\\ &\leq\tn{F'(\boldsymbol{\omega})-F'(\boldsymbol{\omega}_{AO})}+\varepsilon\\ &< 2\varepsilon. \end{align} Thus, in light of Lemma \ref{dist cont lem}, observe that \[ \mathbb{P}(\phi_\mathcal{S}({\vct{g}},\vct{h})\leq t)\leq \mathbb{P}(E^c)+\mathbb{P}(\{\phi_{\mathcal{S}}({\vct{g}},\vct{h})\leq t\}\cap E)\leq C\mathrm{e}^{-c\varepsilon^2p}+\mathbb{P}(\phi_{\mathcal{B}}({\vct{g}},\vct{h})\leq t). \] In the subsequent discussion, we will bound $\mathbb{P}(\phi_{\mathcal{B}}({\vct{g}},\vct{h})\leq t)$ and $\mathbb{P}(\phi_{\mathbb{R}^p}({\vct{g}},\vct{h})\geq t)$ for a proper choice of $t$. \noindent{\bf{Case 1: Upper bound analysis over $\mathbb{R}^p$}} \som{These are minor but you are supposed to show that $l_g>l_h$ and the objective $\phi_{\mathbb{R}^p}>0$} Let $\tn{{\vct{g}}}=l_g$, $\tn{\vct{h}}=l_h$, $h'=h/l_g$, $\rho=l_h^2/l_g^2<1$ and $\omega=\tn{\boldsymbol{\omega}}$. With at least probability $1-C\mathrm{e}^{-n(1-\sqrt{\kappa})^2/8}$, $l_g-l_h+h'>0$ and $\phi_{\mathbb{R}^p}>0$. We consider the auxiliary problem \begin{align} \phi_{\mathbb{R}^p}({\vct{g}},\vct{h},h)&=\min_{\boldsymbol{\omega}\in\mathbb{R}^p}(\tn{\left[\begin{matrix} \boldsymbol{\omega} \\ \sigma \end{matrix}\right]}\tn{{\vct{g}}}-\vct{h}^T\boldsymbol{\omega}+h\sigma)_+\\ &=\min_{\omega\in\mathbb{R}}(\sqrt{\omega^2+\sigma^2}l_g-\omega l_h+h\sigma)_+\\ &=l_g\min_{\omega\in\mathbb{R}}\sqrt{\omega^2+\sigma^2}-\omega \sqrt{\rho}+h'\sigma\\ &=(\sqrt{1-\rho}+h')\sigma l_g \end{align} We can derive the global solution \begin{align} \boldsymbol{\omega}^*=\sqrt{\frac{\rho}{1-\rho}}\sigma\bar{\h}\label{wo over R} \end{align} \noindent{\bf{Case 2: Lower bound analysis over $\mathcal{B}$}} \som{Assuming ${\boldsymbol{{\Sigma}}}$ is full rank, you can do change of variable $\vct{v}\leftrightarrow{\boldsymbol{{\Sigma}}}^{-1/2}\vct{v}$ to simplify notation. You can get rid of ${\boldsymbol{{\Sigma}}}$ and $\gamma$!} \som{How do you show: ``This implies that'' explain further please} Let $\tn{{\vct{g}}}=l_g$, $\tn{\vct{h}}=l_h$, $h'=h/l_g$ and $\rho=l_h^2/l_g^2<1$. Set $\boldsymbol{\omega}\in\mathcal{B}$ as $\boldsymbol{\omega}=\boldsymbol{\omega}_{AO}+\vct{v}$ where $\tn{\vct{v}}\geq\varepsilon$. From \ref{wo over R} we can see that $\vct{v}*=(\sqrt{\frac{\rho}{1-\rho}}-\sqrt{\frac{\kappa}{1-\kappa}})\sigma\bar{\h}$ over $\phi_{\mathbb{R}^p}$. Hence for any $\rho$ making $\varepsilon\leq|\sqrt{\frac{\rho}{1-\rho}}-\sqrt{\frac{\kappa}{1-\kappa}}|\sigma$, $\phi_{\mathcal{B}}=\phi_{\mathbb{R}^p}$. However for sufficiently large $n$ and $p$ and any $\varepsilon>0$, with high probability, $\varepsilon>|\sqrt{\frac{\rho}{1-\rho}}-\sqrt{\frac{\kappa}{1-\kappa}}|\sigma$ and $\phi_{\mathcal{B}}>\phi_{\mathbb{R}^p}$. There exists sufficiently small $\gamma>0$, the auxiliary problem can be presented as \begin{align} \phi_{\mathcal{B}}({\vct{g}},\vct{h},h)&=\min_{\tn{\vct{v}}\geq\varepsilon}\tn{\left[\begin{matrix} w_*\bar{\h}+\vct{v} \\ \sigma \end{matrix}\right]}\tn{{\vct{g}}}-(w_*\tn{\vct{h}}+\vct{h}^T\vct{v})+h\sigma\\ &\geq \end{align} Write $\phi_{\mathcal{B}}$ as $\phi_{\mathcal{B}}=l_g\min_{\vct{v}}f(\vct{v})$ where $f(\vct{v})=\sqrt{(w_*\bar{\h}+\vct{v})^2+\sigma^2}-(w_*+\bar{\h}\vct{v})\sqrt{\rho}+h'\sigma$. Clearly $f(\vct{v})$ is convex over $\vct{v}$. Do derivation directly to find optima. \begin{align} \frac{w_*\bar{\h}+\vct{v}}{\sqrt{(w_*\bar{\h}+\vct{v})^2+\sigma^2}}-\bar{\h}\sqrt{\rho}=0\implies \vct{v}=(\sqrt{\frac{\rho}{1-\rho}}\sigma-w_*)\bar{\h} \end{align} This implies that $\vct{v}=v\frac{{\boldsymbol{{\Sigma}}}^{-1/2}\bar{\h}}{\tn{{\boldsymbol{{\Sigma}}}^{-1/2}\bar{\h}}}=v/\gamma{\boldsymbol{{\Sigma}}}^{-1/2}\bar{\h}$ where $v=\tn{\vct{v}}\geq\varepsilon$. Then for any $\varepsilon>(\sqrt{\frac{\rho}{1-\rho}}\sigma-w_*)\gamma$, $v^*=\varepsilon$ \[ \vct{v}*=\varepsilon/\gamma{\boldsymbol{{\Sigma}}}^{-1/2}\bar{\h}\implies\vct{w}^*=(w_*+\varepsilon/\gamma){\boldsymbol{{\Sigma}}}^{-1/2}\bar{\h} \] {\color{red} $f(\vct{v})=\tn{w_*\bar{\h}+\sqrt{{\boldsymbol{{\Sigma}}}}\vct{v}~\sigma}\tn{{\vct{g}}}-(w_*\tn{\vct{h}}+\vct{h}^T\sqrt{{\boldsymbol{{\Sigma}}}}\vct{v})+h\sigma$ is convex over $\vct{v}$. Do derivation directly to find optima. } \som{You want to simplify your bound on $\phi_{\mathcal{B}}$ and argue it is larger than $\phi_{\mathbb{R}^p}$} \begin{align} \phi_{\mathcal{B}}({\vct{g}},\vct{h},h)&=\min_{v\geq\varepsilon}l_g\sqrt{(v/\gamma+w_*)^2+\sigma^2}-l_h(v/\gamma+w_*)+h\sigma\\ &=l_g\sqrt{(\varepsilon/\gamma+w_*)^2+\sigma^2}-l_h(\varepsilon/\gamma+w_*)+h\sigma \end{align} \som{I don't follow this condition on $\varepsilon$}Or if $\varepsilon\leq(\sqrt{\frac{\rho}{1-\rho}}\sigma-w_*)\gamma$, \[ v*=(\sqrt{\frac{\rho}{1-\rho}}\sigma-w_*)\gamma\implies\phi_{\mathcal{B}}({\vct{g}},\vct{h},h)=\phi_{\mathbb{R}^p}({\vct{g}},\vct{h},h \] {\color{red} For any ${\vct{g}},\vct{h},h$, we have $\phi_{\mathcal{B}}\geq\phi_{\mathbb{R}}$. Only when $\varepsilon>(\sqrt{\frac{\rho}{1-\rho}}\sigma-w_*)\gamma$, we have $\phi_{\mathcal{B}}>\phi_{\mathbb{R}}$ } Set $\kappa=p/n$. For any $\varepsilon>(\sqrt{\frac{\rho}{1-\rho}}-\sqrt{\frac{\kappa}{1-\kappa}})\sigma\gamma$, we have proper choice $t$\som{You need a $t$ that achieves high probability. Inequality is not enough} {\color{red}\\\\ 1. With high probability, $(\sqrt{\frac{\rho}{1-\rho}}-\sqrt{\frac{\kappa}{1-\kappa}})\sigma\gamma<\epsilon$ where $\epsilon$ is small and positive\\ 2. Then, there exists $\varepsilon<\epsilon$ that inequalities below hold\\ 3. For any $t\in(\sqrt{n}(\sqrt{1-\kappa}\sigma+\varepsilon_1),\sqrt{n}(\sqrt{(\varepsilon/\gamma+w_*)^2+\sigma^2}-\sqrt{\kappa}(\varepsilon/\gamma+w_*)-\varepsilon_1))$ where $\sqrt{(\varepsilon/\gamma+w_*)^2+\sigma^2}-\sqrt{\kappa}(\varepsilon/\gamma+w_*)-\sqrt{1-\kappa}\sigma>2\varepsilon_1$ with high probability $Ce^{-cn\varepsilon_1^2/\sigma^2}$, we have $\phi_{\mathcal{B}}>\phi_{\mathbb{R}}$. } \begin{align} \sqrt{n-p}\sigma+h\sigma<&t<\sqrt{n}\sqrt{(\varepsilon/\gamma+w_*)^2+\sigma^2}-\sqrt{p}(\varepsilon/\gamma+w_*)+h\sigma\\ \sqrt{1-\kappa}\sigma<&\frac{t-h\sigma}{\sqrt{n}}<\sqrt{(\varepsilon/\gamma+w_*)^2+\sigma^2}-\sqrt{\kappa}(\varepsilon/\gamma+w_*) \end{align} and \som{This is not a rigorous conclusion. You are supposed to show >0} \[ \sqrt{(\varepsilon/\gamma+w_*)^2+\sigma^2}-\sqrt{\kappa}(\varepsilon/\gamma+w_*)-\sqrt{1-\kappa}\sigma\nrightarrow0 \] \end{proof} \section{Underparameterized analysis}\label{SM overdet} This section provides our results for the asymptotic DC in the underparameterized regime. This results establish direct counterparts of the overparameterized results Definition \ref{def:Xi} and Theorem \ref{thm:master_W2}. However, underparameterized DC is substantially less involved compared to overparameterized. A key reason is that underparameterized least-squares returns an unbiased estimate of the ground-truth parameter. Similar to Section \ref{sec proof thm 1}, for simplicity, we assume diagonal covariance however results can be translated to arbitrary covariance via eigen-rotation trick (e.g.~recall Def.~\ref{aux_def}). Throughout, we solve the following proble \begin{align} {\boldsymbol{\hat{\beta}}}={\mtx{X}}^\dagger\vct{y}=\arg\min_{{\boldsymbol{\beta}}} \tn{\vct{y}-{\mtx{X}}{\boldsymbol{\beta}}}^2\label{bth up} \end{align} where $\vct{y}={\mtx{X}}\boldsymbol{\beta}^\star+\sigma{\vct{z}}$ and ${\mtx{X}}={\mtx{\bar{X}}}\sqrt{{\boldsymbol{{\Sigma}}}}$. Now, set $\boldsymbol{\omega}=\sqrt{{\boldsymbol{{\Sigma}}}}({\boldsymbol{\beta}}-\boldsymbol{\beta}^\star)$ as previously. We can rewrite \begin{align} {\boldsymbol{\hat{\beta}}}={\mtx{X}}^\dagger\vct{y}=\boldsymbol{\beta}^\star+{\boldsymbol{{\Sigma}}}^{-1/2}\vct{w}^\star\quad\text{where}\quad \vct{w}^\star=\arg\min_{\boldsymbol{\omega}} \tn{\sigma{\vct{z}}-{\mtx{\bar{X}}}\boldsymbol{\omega}}^2.\label{wst up} \end{align} We will prove the following DC for the underparameterized problem with $n<p$ and $p/n=\kappa<1$. \begin{definition}[Asymptotic DC -- Underparameterized regime]\label{def:Xi_under} Let random variables $(B,\Lambda)\sim \mu$ (where $\mu$ is defined in Assumption \ref{ass:mu}) and fix $\kappa<1$. Let $H\sim\mathcal{N}(0,1)$ and define the random variable \begin{align} X_{\kappa,\sigma^2}(B,H) := B + \sigma\frac{\Lambda^{-1/2}H}{\sqrt{\kappa^{-1}-1}}, \label{eq:X \end{align} and let $\Pi_{\kappa,\sigma^2}$ be its distribution. \end{definition} We are now ready to state our main theoretical result. \cmt{ \begin{theorem}[Asymptotic DC -- Underparameterized LGP]\label{thm:master_W2_under} Let Assumption \ref{ass:linear} hold with $\kappa<1$ and further let Assumptions \ref{ass:inv} and \ref{ass:mu} hold. Consider $\hat{{\boldsymbol{\beta}}}$ as in \eqref{bth up} and $\hat\Pi_n(\vct{y},{\mtx{X}},\betab^\star,\boldsymbol{\Sigma}):=\frac{1}{p}\sum_{i=1}^{p}\delta_{\sqrt{p}\hat{{\boldsymbol{\beta}}}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i}}$, the joint empirical distribution of $(\sqrt{p}\hat\boldsymbol{\beta},\sqrt{p}\betab^\star,\boldsymbol{\Sigma})$. Recall the definition of the measure $\Pi_{\kappa,\sigma^2}$ in Def.~\ref{def:Xi_under}. Then, $\hat\Pi_n(\vct{y},{\mtx{X}},\betab^\star,\boldsymbol{\Sigma})$ converges in Wasserstein-k distance to $\Pi_{\kappa,\sigma^2}\otimes\mu$. Specifically, for any function $f:\mathbb{R}^3\rightarrow\mathbb{R}$, $f\in\rm{PL}(k)$ with $k\geq 3$, it holds that \begin{align}\label{eq:thm_up} \hspace{-0.1in}p^{-1} \sum_{i=1}^{p} f(\sqrt{p}\hat\boldsymbol{\beta}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i}) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}\left[f(X_{\kappa,\sigma^2},B,\Lambda) \right], \end{align} where the expectation is over $(\Lambda,B,H)\sim\mu\otimes\mathcal{N}(0,1)$. Specifically, the asymptotic test risk is given by $\frac{\sigma^2}{1-\kappa}$. \end{theorem}} \begin{theorem}[Asymptotic DC -- Underparameterized LGP]\label{thm:master_W2_under} Fix $\kappa<1$. Let Assumptions \ref{ass:inv} and \ref{ass:mu} hold. Consider $\hat{{\boldsymbol{\beta}}}$ as in \eqref{bth up} and $\hat\Pi_n(\vct{y},{\mtx{X}},\betab^\star,\boldsymbol{\Sigma}):=\frac{1}{p}\sum_{i=1}^{p}\delta_{\sqrt{p}\hat{{\boldsymbol{\beta}}}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i}}$, the joint empirical distribution of $(\sqrt{p}\hat\boldsymbol{\beta},\sqrt{p}\betab^\star,\boldsymbol{\Sigma})$. Recall the definition of the measure $\Pi_{\kappa,\sigma^2}$ in Def.~\ref{def:Xi_under}. {Let $f:\mathbb{R}^3\rightarrow\mathbb{R}$ be a function in ${\cal{F}}$ where ${\cal{F}}$ is defined in \eqref{eq:pdef}.} We have that \begin{align}\label{eq:thm_up} \frac{1}{p} \sum_{i=1}^{p} f(\sqrt{p}\hat\boldsymbol{\beta}_i,\sqrt{p}\betab^\star_i,\boldsymbol{\Sigma}_{i,i}) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}_{(\Lambda,B,H)\sim\mu\otimes\mathcal{N}(0,1)}\left[f(X_{\kappa,\sigma^2},B,\Lambda) \right]. \end{align} Specifically, the asymptotic test risk of ${\boldsymbol{\hat{\beta}}}$ is given by $\frac{\sigma^2}{1-\kappa}$. \end{theorem} \begin{proof} \so{To avoid repetition, we will not provide the full proof as the technical details of the proofs for over/under-parameterized overlap to a significant extent. Instead, we will provide the part of the proof that deviates from the overparameterized.} Since $\kappa<1$, the problem has a unique solution. Set $\boldsymbol{\omega}=\sqrt{{\boldsymbol{{\Sigma}}}}({\boldsymbol{\beta}}-\boldsymbol{\beta}^\star)$. Define ${\mtx{X}}_{\vct{z}}=[{\mtx{\bar{X}}}~{\vct{z}}]$ and $\boldsymbol{\omega}_\sigma=[\boldsymbol{\omega}~\sigma]$. This leads to the optimization problem \[ \hat{\boldsymbol{\omega}}=\arg\min_{\boldsymbol{\omega}} \tn{{\mtx{\bar{X}}}\boldsymbol{\omega}+\sigma {\vct{z}}}=\arg\min_{\boldsymbol{\omega}} \tn{{\mtx{X}}_{\vct{z}}\boldsymbol{\omega}_\sigma}. \] Fix ${\vct{g}}\sim\mathcal{N}(0,{\mtx{I}}_p),\vct{h}\sim\mathcal{N}(0,{\mtx{I}}_n),g\sim\mathcal{N}(0,1)$. Applying CGMT leads to the following Auxiliary Optimizatio \begin{align} \phi({\vct{g}},\vct{h})&=\min_{\boldsymbol{\omega}} \max_{\tn{\vct{a}}\leq 1} \vct{h}^T\vct{a} \tn{\boldsymbol{\omega}_{\sigma}}-\tn{\vct{a}}{\vct{g}}^T\boldsymbol{\omega}+g\sigma\\ &=\min_{\boldsymbol{\omega}} \tn{\vct{h}} \tn{\boldsymbol{\omega}_{\sigma}}-{\vct{g}}^T\boldsymbol{\omega}+g\sigma. \end{align} Solving for optimal $\boldsymbol{\omega}$ leads to the solution \[ \boldsymbol{\omega}^{\text{AO}}=\arg\min_{\boldsymbol{\omega}}\tn{\vct{h}} \tn{\boldsymbol{\omega}_{\sigma}}-{\vct{g}}^T\boldsymbol{\omega}\implies \tn{\vct{h}}\frac{\boldsymbol{\omega}^{\text{AO}}}{\sqrt{\tn{\boldsymbol{\omega}^{\text{AO}}}^2+\sigma^2}}-{\vct{g}}\implies \boldsymbol{\omega}^{\text{AO}}=\frac{\sigma{\vct{g}}}{\sqrt{\tn{\vct{h}}^2-\tn{{\vct{g}}}^2}}. \] Observing $\tn{\boldsymbol{\omega}^{\text{AO}}}^2+\sigma^2=\frac{\sigma^2\tn{\vct{h}}^2}{\tn{\vct{h}}^2-\tn{{\vct{g}}}^2}$ and plugging $\boldsymbol{\omega}^{\text{AO}}$ in, we find \[ \sigma^{-1}\phi({\vct{g}},\vct{h})=\frac{\tn{\vct{h}}^2-\tn{{\vct{g}}}^2}{\sqrt{\tn{\vct{h}}^2-\tn{{\vct{g}}}^2}}+g=\sqrt{\tn{\vct{h}}^2-\tn{{\vct{g}}}^2}+g. \] Thus, in the asymptotic regime $\phi({\vct{g}},\vct{h})$ converges to the objectiv \[ \phi({\vct{g}},\vct{h})\stackrel{{P}}{\longrightarrow} \bar{\phi}=\sigma\sqrt{n-p}. \] The remaining arguments are same as in Lemma \ref{lem:AO}. First, the problem is strongly convex with $\sigma^2_{\min}({\mtx{X}})$, which satisfies $\sigma^2_{\min}({\mtx{X}})/p\gtrsim 1$ wpa.~1. Thus, the solution $\vct{w}^\star$ of the primary problem \eqref{wst up} will not deviate from $\boldsymbol{\omega}^{\text{AO}}$. Secondly, the empirical distribution of \[ \sqrt{p}\boldsymbol{\omega}^\star=\frac{\sigma\sqrt{p}{\vct{g}}}{\sqrt{\tn{\vct{h}}^2-\tn{{\vct{g}}}^2}}\stackrel{{P}}{\longrightarrow} \frac{\sigma\sqrt{p}{\vct{g}}}{\sqrt{n-p}}= \frac{\sigma{\vct{g}}}{\sqrt{n/p-1}}=\frac{\sigma{\vct{g}}}{\sqrt{\kappa^{-1}-1}}, \] converges to $\sigma H/\sqrt{\kappa^{-1}-1}$. By Assumption \ref{ass:mu}, the empirical distribution of $\sqrt{p}{\boldsymbol{\hat{\beta}}}=\sqrt{p}({\boldsymbol{\beta}}^\star+{\boldsymbol{{\Sigma}}}^{-1/2}\boldsymbol{\omega}^\star)$ converges to $B+\sigma \Lambda^{-1/2}H/\sqrt{\kappa^{-1}-1}\sim \Pi_{\kappa,\sigma^2}$. Finally, again by Assumption \ref{ass:mu}, for any $f\in {\cal{F}}$, we obtain the advertised result \eqref{eq:thm_up}. The asymptotic test risk is given by \[ {\cal{L}}({\boldsymbol{\hat{\beta}}})=\operatorname{\mathbb{E}}[\tn{{\vct{g}}^T\sqrt{{\boldsymbol{{\Sigma}}}}({\boldsymbol{\hat{\beta}}}-\boldsymbol{\beta}^\star)+\sigma z}^2]=\sigma^2+\sum_{i=1}^p ({\boldsymbol{\hat{\beta}}}_i-\boldsymbol{\beta}^\star)^2{\boldsymbol{{\Sigma}}}_{i,i}\stackrel{{P}}{\longrightarrow}\sigma^2+\frac{\sigma^2}{\kappa^{-1}-1}=\frac{\sigma^2}{1-\kappa}. \] \end{proof} In the main body of the paper, we claim that the optimal $s$ features to use in the underparameterized regime is given by the features with the maximum saliency score. This is proven below. \begin{lemma}[Optimal $s$ features to use]\label{lem best s} Fix a sequence of sets $\Delta_p\subset[p]$ of size $s$ such that $\sum_{i\in \Delta_p} {\boldsymbol{\beta}^\star_i}^2{\boldsymbol{{\Sigma}}}_{i,i}\stackrel{{P}}{\longrightarrow} B(\Delta)$. Set $\kappa=s/n$. Under same assumptions as in Thm~\ref{thm:master_W2_under}, the asymptotic test risk of ${\boldsymbol{\hat{\beta}}}(\Delta)$ is given by \[ {\cal{L}}({\boldsymbol{\hat{\beta}}}(\Delta))\stackrel{{P}}{\longrightarrow} \frac{B-B(\Delta)+\sigma^2}{1-\kappa}. \] Thus, the optimal feature set $\Delta$ chooses the indices with maximum Saliency Score \eqref{saliency eq} which maximizes $B(\Delta)$. \end{lemma} \begin{proof} The key idea is the fact that we can treat the missing features as uncorrelated noise. First, due to diagonal covariance, observe that, over the feature set $\Delta$, the optimal population model (i.e.~infinite sample) is $\boldsymbol{\beta}^\star_{\Delta}$. Thus, the $s$ feature problem minimized by ${\boldsymbol{\hat{\beta}}}(\Delta)$ can be written as the dataset model \[ y=\vct{x}_{\Delta}^T\boldsymbol{\beta}^\star_{\Delta}+\sigma_{\Delta}^2, \] where the noise level is given by \[ \operatorname{\mathbb{E}}[(y-\vct{x}_{\Delta}\boldsymbol{\beta}^\star_{\Delta})^2]=\sigma^2+\operatorname{\mathbb{E}}[(\vct{x}_{\bar{\Delta}}\boldsymbol{\beta}^\star_{\bar{\Delta}})^2]=\sigma^2+\sum_{i\not\in\Delta}{\boldsymbol{{\Sigma}}}_{i,i}{\boldsymbol{\beta}^\star_{i}}^2. \] The latter quantity converges to $B-B(\Delta)$ wpa.~1. Thus, applying Theorem \ref{thm:master_W2_under}, ${\boldsymbol{\hat{\beta}}}(\Delta)$ achieves the advertised asymptotic risk. \end{proof} \cmt{ where $\mathcal{D}(u,\tau)=\dots$. Specifically, we have that \begin{align}\\ &=\min_{\vct{w}} \sqrt{n} \tn{\boldsymbol{\omega}_{\sigma}}-{\vct{g}}^T\boldsymbol{\omega}_{\sigma}\\ &=\min_{\vct{w}} \sqrt{n} \sqrt{w^2+\sigma^2}-w\tn{{\vct{g}}}\\ &\propto\min_{\vct{w}} \sqrt{w^2+\sigma^2}-w\sqrt{{\bar{p}}}. \end{align} This implies $w=\sqrt{\frac{{\bar{p}}}{1-{\bar{p}}}}\sigma$ via \[ \sqrt{{\bar{p}}}=\frac{w}{\sqrt{w^2+\sigma^2}}\iff {\bar{p}} (w^2+\sigma^2)=w^2\iff w=\sqrt{\frac{{\bar{p}}}{1-{\bar{p}}}}\sigma \] Now, recall that ${\boldsymbol{\hat{\beta}}}={\boldsymbol{\beta}}+{\boldsymbol{{\Sigma}}}^{-1/2}\boldsymbol{\omega}$. Since the entries of $\boldsymbol{\omega}$ are normally distributed, we have that \begin{align} \sqrt{{\boldsymbol{{\Sigma}}}}\boldsymbol{\hat{\theta}}&=\sqrt{{\boldsymbol{{\Sigma}}}}\mathbb{F}_s({\boldsymbol{\hat{\beta}}})=\sqrt{{\boldsymbol{{\Sigma}}}}(\mathbb{F}_s({\boldsymbol{\beta}})+\mathbb{F}_s({\boldsymbol{{\Sigma}}}^{-1/2}\boldsymbol{\omega}))\\ &=\sqrt{{\boldsymbol{{\Sigma}}}}\mathbb{F}_s({\boldsymbol{\beta}})+\mathbb{F}_s(\boldsymbol{\omega})\\ &=\vct{t}+\mathbb{F}_s(\boldsymbol{\omega}). \end{align} Note that $\tn{\mathbb{F}_s(\boldsymbol{\omega})}=\sqrt{\frac{s}{p}}\sqrt{\frac{{\bar{p}}}{1-{\bar{p}}}}\sigma=\sqrt{\frac{{\bar{s}}}{1-{\bar{p}}}}\sigma$. Thus the test error \eqref{test formula} of ${\boldsymbol{\hat{\beta}}}$ and $\boldsymbol{\hat{\theta}}$ are \[ {\cal{L}}({\boldsymbol{\hat{\beta}}})=\sigma^2+w^2=\frac{\sigma^2}{1-{\bar{p}}}\quad\text{and}\quad {\cal{L}}(\boldsymbol{\hat{\theta}})=\frac{{\bar{s}}}{1-{\bar{p}}}\sigma^2+\alpha-\theta+\sigma^2. \]} \cmt{ \begin{lemma}[To be proven rigorously] Set ${\bar{p}}=p/n$ and ${\bar{s}}=s/n$. Suppose ${\bar{p}}<1$ and suppose $\vct{t}^T{\boldsymbol{{\Sigma}}}\vct{t}=\theta$. Then \[ {\cal{L}}({\boldsymbol{\hat{\beta}}})=\sigma^2+w^2=\frac{\sigma^2}{1-{\bar{p}}}\quad\text{and}\quad {\cal{L}}(\boldsymbol{\hat{\theta}})=\frac{1-{\bar{p}}+{\bar{s}}}{1-{\bar{p}}}\sigma^2+\alpha-\theta. \] \end{lemma} \subsection{Analysis} Since $\kappa<1$, the problem has a unique solution. Set $\boldsymbol{\omega}=\sqrt{{\boldsymbol{{\Sigma}}}}\vct{w}$ where $\vct{w}={\boldsymbol{\beta}}-{\boldsymbol{\beta}}'$. Define ${\mtx{X}}_{\vct{z}}=[{\mtx{\bar{X}}}~{\vct{z}}]$ and $\boldsymbol{\omega}_\sigma=[\boldsymbol{\omega}^T~\sigma]^T$. This leads to the optimization problem \[ \hat{\boldsymbol{\omega}}=\arg\min_{\boldsymbol{\omega}} \tn{{\mtx{\bar{X}}}\boldsymbol{\omega}+\sigma {\vct{z}}}=\arg\min_{\boldsymbol{\omega}} \tn{{\mtx{X}}_{\vct{z}}\boldsymbol{\omega}_\sigma}. \] Fix ${\vct{g}}\sim\mathcal{N}(0,{\mtx{I}}_p),\vct{h}\sim\mathcal{N}(0,{\mtx{I}}_n)$. Note that that $s/p={\bar{s}}/{\bar{p}}$. Applying Gordon's Lemma (non-rigorously) and noticing optimal $\boldsymbol{\omega}$ has form $\boldsymbol{\omega}=w\bar{{\vct{g}}}$ where $\bar{{\vct{g}}}={\vct{g}}/\tn{{\vct{g}}}$, we find \begin{align} \min_{\vct{w}} \max_{\tn{\vct{a}}\leq 1} \vct{h}^T\vct{a} \tn{\boldsymbol{\omega}_{\sigma}}-\tn{\vct{a}}{\vct{g}}^T\boldsymbol{\omega}_{\sigma}&=\min_{\vct{w}} \sqrt{n} \tn{\boldsymbol{\omega}_{\sigma}}-{\vct{g}}^T\boldsymbol{\omega}_{\sigma}\\ &=\min_{\vct{w}} \sqrt{n} \sqrt{w^2+\sigma^2}-w\tn{{\vct{g}}}\\ &\propto\min_{\vct{w}} \sqrt{w^2+\sigma^2}-w\sqrt{{\bar{p}}}. \end{align} This implies $w=\sqrt{\frac{{\bar{p}}}{1-{\bar{p}}}}\sigma$ via \[ \sqrt{{\bar{p}}}=\frac{w}{\sqrt{w^2+\sigma^2}}\iff {\bar{p}} (w^2+\sigma^2)=w^2\iff w=\sqrt{\frac{{\bar{p}}}{1-{\bar{p}}}}\sigma \] Now, recall that ${\boldsymbol{\hat{\beta}}}={\boldsymbol{\beta}}+{\boldsymbol{{\Sigma}}}^{-1/2}\boldsymbol{\omega}$. Since the entries of $\boldsymbol{\omega}$ are normally distributed, we have that \begin{align} \sqrt{{\boldsymbol{{\Sigma}}}}\boldsymbol{\hat{\theta}}&=\sqrt{{\boldsymbol{{\Sigma}}}}\mathbb{F}_s({\boldsymbol{\hat{\beta}}})=\sqrt{{\boldsymbol{{\Sigma}}}}(\mathbb{F}_s({\boldsymbol{\beta}})+\mathbb{F}_s({\boldsymbol{{\Sigma}}}^{-1/2}\boldsymbol{\omega}))\\ &=\sqrt{{\boldsymbol{{\Sigma}}}}\mathbb{F}_s({\boldsymbol{\beta}})+\mathbb{F}_s(\boldsymbol{\omega})\\ &=\vct{t}+\mathbb{F}_s(\boldsymbol{\omega}). \end{align} Note that $\tn{\mathbb{F}_s(\boldsymbol{\omega})}=\sqrt{\frac{s}{p}}\sqrt{\frac{{\bar{p}}}{1-{\bar{p}}}}\sigma=\sqrt{\frac{{\bar{s}}}{1-{\bar{p}}}}\sigma$. Thus the test error \eqref{test formula} of ${\boldsymbol{\hat{\beta}}}$ and $\boldsymbol{\hat{\theta}}$ are \[ {\cal{L}}({\boldsymbol{\hat{\beta}}})=\sigma^2+w^2=\frac{\sigma^2}{1-{\bar{p}}}\quad\text{and}\quad {\cal{L}}(\boldsymbol{\hat{\theta}})=\frac{{\bar{s}}}{1-{\bar{p}}}\sigma^2+\alpha-\theta+\sigma^2. \] } \subsection{Overparameterized Analysis} \begin{lemma}[Asymptotic Strong Convexity]\label{asym str} Fix $\sigma>0$ and $\rho>1$. Consider the loss function over nonnegative variables $v,w,\gamma$ \[ f(\gamma,w,v)=(1-\gamma)^2+w^2+v^2+\max_{\lambda\geq 0}\lambda (v^2+\gamma^2+\sigma^2-(\rho-1)w^2), \] and the optimal value \[ f^*=\min_{w^2+v^2+\gamma^2+\sigma^2\leq w^2\rho}(1-\gamma)^2+w^2+v^2. \] Then, $f$ has a unique global minima $(\gamma^*,w^*,v^*)$ given by \begin{align} \gamma^*=1-\frac{1}{\rho},~w^*=\sqrt{\frac{\sigma^2}{\rho-1}+\frac{\rho-1}{\rho^2}},~v^*=0.\label{opt choices} \end{align} Additionally, for any $(\gamma,w,v)$, we have $f(\gamma,w,v)-f^*\geq (\gamma-\gamma^*)^2+v^2+(w-w^*)^2$. \end{lemma} \begin{proof} First observe that, we can restrict our attention to feasible values satisfying $v^2+\gamma^2+\sigma^2\leq (\rho-1)w^2$. Suppose $v,w,\gamma$ be a feasible triple. Then $0,w_\gamma=\sqrt{\frac{\gamma^2+\sigma^2}{\rho-1}},\gamma$ is also a feasible triple and obeys \[ f(\gamma,w,v)-f(\gamma,_\gamma,0)\geq v^2+w^2-w_\gamma^2. \] Plugging in $w_\gamma$ we get \[ f(\gamma,w_\gamma,0)=\frac{\gamma^2+\sigma^2}{\rho-1}+(1-\gamma)^2. \] Differentiating we find $1=\gamma^*+\frac{\gamma^*}{\rho-1}\implies \gamma^*=1-1/\rho$ and \[ w^*=w_{\gamma^*}=\sqrt{\frac{\sigma^2}{\rho-1}+\frac{\rho-1}{\rho^2}}. \]. Observe that $f$ is $\frac{2\rho}{\rho-1}$-strongly convex function of $\gamma$ thus \[ f(\gamma,w_\gamma,0)\geq f^*+\frac{\rho}{\rho-1}(\gamma-\gamma^*)^2\geq f^*+(\gamma-\gamma^*)^2+(w_\gamma-w^*)^2. \] In summary, we find \[ f(\gamma,w,v)-f^*\geq (\gamma-\gamma^*)^2+[w^2-w_\gamma^2+(w_\gamma-w^*)^2]+v^2. \] To conclude, note that \[ w^2-w_\gamma^2+(w_\gamma-w^*)^2=w^2-2w_\gamma w^*+{w^*}^2=(w-w^*)^2+2(w-w_\gamma) w^*\geq (w-w^*)^2. \] \end{proof} \begin{theorem}[Overparameterized estimation, Identity ${\boldsymbol{{\Sigma}}}$] Consider a dataset according to linear model with $\tn{{\boldsymbol{\beta}}}=1$ and assume $\kappa=p/n>1$. Let $\vct{h}\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,1)$ and $\bar{\h}=\vct{h}/\tn{\vct{h}}$. Define \[ {\boldsymbol{\hat{\beta}}}_{AO}=(1-\gamma_*){\boldsymbol{\beta}}+w_*\bar{\h}\quad\text{and}\quad w_*=\sqrt{\frac{\sigma^2}{\kappa-1}+\frac{\kappa-1}{\kappa^2}},~\gamma_*=1-\frac{1}{\kappa}. \] Then, for any $1$-Lipschitz function $F$, with probability $1-C\mathrm{e}^{-c\varepsilon^2p}$, we have that \[ |\tn{F({\boldsymbol{\hat{\beta}}})}-\operatorname{\mathbb{E}}[\tn{F({\boldsymbol{\hat{\beta}}}_{AO})}]|\leq \varepsilon \] {\bf{Asymptotic:}} Then, for any $1$-Lipschitz function $F$, we have that \[ \lim_{p\rightarrow\infty}\tn{F({\boldsymbol{\hat{\beta}}})}= \lim_{p\rightarrow\infty}\tn{F({\boldsymbol{\hat{\beta}}}_{AO})}. \]\som{``for convex functions pointwise convergence in probability implies uniform convergence in compact subsets''} \end{theorem} \begin{proof} Fix $h,{\vct{g}}\in\mathbb{R}^n,\vct{h}\in\mathbb{R}^p,{\mtx{X}}\in\mathbb{R}^{n\times p}\overset{\text{i.i.d.}}{\sim} \mathcal{N}(0,1)$. Set $\vct{w}={\boldsymbol{\beta}}-{\boldsymbol{\hat{\beta}}}$. We are interested in the minimum norm solution to ${\mtx{X}}{\boldsymbol{\beta}}+\sigma{\vct{z}}={\mtx{X}}{\boldsymbol{\hat{\beta}}}$ i.e.~${\mtx{X}}'\vct{w}_\sigma=0$ where $\vct{w}_\sigma=[\vct{w}^T~\sigma]^T$ and ${\mtx{X}}'=[{\mtx{X}}~{\vct{z}}]$. Thus, with a change of variable, following Theorem \ref{lem cgmt constrained}, we consider \begin{align} &\Phi_\mathcal{S}({\mtx{X}}')=\min_{\vct{w}\in\mathcal{S},{\mtx{X}}'\vct{w}_\sigma=0}\tn{{\boldsymbol{\beta}}-\vct{w}}\\ &\phi_\mathcal{S}({\vct{g}},\vct{h})=\min_{\vct{w}\in\mathcal{S},\tn{\vct{w}_\sigma}\tn{{\vct{g}}}\leq \vct{h}^T\vct{w}+\sigma h}\tn{{\boldsymbol{\beta}}-\vct{w}}.\label{overparm phi} \end{align} To proceed, we will apply Lemma \ref{dist cont lem} with a proper choice of set $\mathcal{S}$ to conclude that the solution $\vct{w}_{PO}$ of the unconstrained least-squares problem lies inside $\mathcal{S}^c$. Set the normalized vector $\bar{\h}=\vct{h}/\tn{\vct{h}}$. Using CGMT and following Lemma \ref{asym str}, we will argue that the solution exhibits similar statistical properties to \[ \vct{w}_{AO}=\gamma_*{\boldsymbol{\beta}}+w_*\bar{\h}\quad\text{where}\quad w_*=\sqrt{\frac{\sigma^2}{\kappa-1}+\frac{\kappa-1}{\kappa^2}},~\gamma_*=1-\frac{1}{\kappa}. \] Specifically, we are interested in showing similar behavior to the $1$-Lipschitz function $F'(\vct{w}_{AO})=F({\boldsymbol{\beta}}-\vct{w}_{AO})$. Hence, in the following discussion, we choose \[ \mathcal{S}=\{\vct{w}{~\big |~} |\tn{F'(\vct{w})}-{\operatorname{\mathbb{E}}[\tn{F'(\vct{w}_{AO})}]}|\geq 2\varepsilon\}. \] and will argue that with high probability, $\vct{w}_{PO}\not\in\mathcal{S}$. From Gaussian concentration of Lipschitz functions, we have that \begin{align} \mathbb{P}(|\tn{F'(\vct{w}_{AO})}-\operatorname{\mathbb{E}}[\tn{F'(\vct{w}_{AO})}]|\geq \varepsilon)\leq C\mathrm{e}^{-c\varepsilon^2p}.\label{cond gauss} \end{align} Define the set \[ \mathcal{B}=\{\vct{w}{~\big |~}\tn{\vct{w}-\vct{w}_{AO}}\geq \varepsilon\}. \] Let $E$ be the event that $\mathcal{B}\supseteq\mathcal{S}$. Then $\mathbb{P}(E)\geq 1-C\mathrm{e}^{-c\varepsilon^2p}$, as whenever \eqref{cond gauss} holds, for any $\vct{w}\not\in\mathcal{B}$, we find $\vct{w}\not\in\mathcal{S}$ as follows \begin{align} |\tn{F'(\vct{w})}-\operatorname{\mathbb{E}}[\tn{F'(\vct{w}_{AO})}]|&\leq|\tn{F'(\vct{w})}-\tn{F'(\vct{w}_{AO})}|+|\operatorname{\mathbb{E}}[\tn{F'(\vct{w}_{AO})}]-\tn{F'(\vct{w}_{AO})}|\\ &\leq\tn{F'(\vct{w})-F'(\vct{w}_{AO})}+\varepsilon\\ &< 2\varepsilon. \end{align} Thus, in light of Lemma \ref{dist cont lem}, observe that \[ \mathbb{P}(\phi_\mathcal{S}({\vct{g}},\vct{h})\leq t)\leq \mathbb{P}(E^c)+\mathbb{P}(\{\phi_{\mathcal{S}}({\vct{g}},\vct{h})\leq t\}\cap E)\leq C\mathrm{e}^{-c\varepsilon^2p}+\mathbb{P}(\phi_{\mathcal{B}}({\vct{g}},\vct{h})\leq t). \] In the subsequent discussion, we will bound $\mathbb{P}(\phi_{\mathcal{B}}({\vct{g}},\vct{h})\leq t)$ and $\mathbb{P}(\phi_{\mathbb{R}^p}({\vct{g}},\vct{h})\geq t)$ for a proper choice of $t$. \noindent{\bf{Case 1: Upper bound analysis}} \noindent{\bf{Case 2: Lower bound analysis over $\mathcal{B}$}} Let $\tn{{\vct{g}}}=l_g,\tn{\vct{h}}=l_h$, $\rho=l_h^2/l_g^2$. Set $b=\bar{\h}^T{\boldsymbol{\beta}}$ and $\widetilde\vct{b}=\frac{{\boldsymbol{\beta}}-\bar{\h}\hb^T{\boldsymbol{\beta}}}{\tn{{\boldsymbol{\beta}}-\bar{\h}\hb^T{\boldsymbol{\beta}}}}=\frac{{\boldsymbol{\beta}}-\bar{\h} b}{\tn{{\boldsymbol{\beta}}-\bar{\h} b}}$. Observe that \[ \tn{{\boldsymbol{\beta}}-\bar{\h} b}^2=1-2b^2+b^2=1-b^2\quad\text{and}\quad {\boldsymbol{\beta}}^T\widetilde\vct{b}=\sqrt{1-b^2}. \] Let us represent our variable $\vct{w}$ as \[ \vct{w}=w\bar{\h}+\gamma\widetilde\vct{b}+\vct{v} \] where $v=\tn{\vct{v}}$. Observe that $\bar{\h},\widetilde\vct{b}$ are orthonormal vectors. We consider the objective \begin{align} \phi_\mathcal{S}^2({\vct{g}},\vct{h})&=\min_{\vct{w}\in\mathcal{S}}\tn{{\boldsymbol{\beta}}-\vct{w}}^2\quad\text{s.t.}\quad \tn{\vct{w}_\sigma}\tn{{\vct{g}}}\leq \vct{h}^T\vct{w}+\sigma h. \end{align} Let us rewrite both sides carefully as follows. Objective can be written as \begin{align} \tn{{\boldsymbol{\beta}}-\vct{w}}^2&=\tn{{\boldsymbol{\beta}}-\gamma\widetilde\vct{b}-w\vct{h}+\vct{v}}^2=\tn{({\boldsymbol{\beta}}-\widetilde\vct{b})+(1-\gamma)\widetilde\vct{b}-w\vct{h}-\vct{v}}^2\\ &=w^2+v^2+(1-\gamma)^2+\tn{{\boldsymbol{\beta}}-\widetilde\vct{b}}^2+2\left< {\boldsymbol{\beta}}-\widetilde\vct{b},(1-\gamma)\widetilde\vct{b}-w\vct{h}\right>\\ &=w^2+v^2+(1-\gamma)^2+2(1-\sqrt{1-b^2})+2(1-\gamma)(\sqrt{1-b^2}-1)-2wb\\ &=w^2+v^2+(1-\gamma)^2+2(\gamma (1-\sqrt{1-b^2})-wb). \end{align} Here, we will argue that the $b$ term is small and ignorable when $p$ is sufficiently large. Set $h'=\sigma h/l_g$. Next, the constraint can be written as \begin{align} \tn{\vct{w}_\sigma}\tn{{\vct{g}}}\leq \vct{h}^T\vct{w}+\sigma h&\iff \sqrt{w^2+\gamma^2+v^2+\sigma^2}l_g\leq wl_h+\sigma h\\ &\iff \sqrt{w^2+\gamma^2+v^2+\sigma^2}\leq w\sqrt{\rho}+h'\\ &\iff \gamma^2+v^2+\sigma^2\leq (\rho-1)w^2+2\sqrt{\rho}h'w+h'^2. \end{align} Together these two yield the parameterized loss function (which depends on ${\vct{g}},\vct{h},h$) \[ L(w,\gamma,v)=w^2+v^2+(1-\gamma)^2+2(\gamma (1-\sqrt{1-b^2})-wb)~\text{s.t.}~\gamma^2+v^2+\sigma^2\leq (\rho-1)w^2+2\sqrt{\rho}h'w+h'^2. \] Also define the proxy loss function which is identical to the setup of Lemma \ref{asym str} \[ L'(w,\gamma,v)=w^2+v^2+(1-\gamma)^2~\text{s.t.}~\gamma^2+v^2+\sigma^2\leq (\rho-1)w^2. \] We have the following lemma relating these two loss functions. \begin{lemma} \label{lem nearby} Fix $\delta>0$. With probability $1-C\mathrm{e}^{-c\delta^2p}$, for any feasible solution $(w,\gamma,v)$ of the loss $L$, there exists a feasible solution $(w',\gamma,v)$ such that $|w-w'|\leq \delta$ and $|L(w,\gamma,v)-(w',\gamma,v)|\leq \delta$ and vice versa (i.e.~similar statement holds for mapping the solutions from $L'$ to $L$). \end{lemma} \begin{proof} Fix $(w,\gamma,v)$. The proof of the converse statement is similar. \end{proof} Using this lemma, let us first bound $\mathbb{P}(\phi_{\mathbb{R}^p}({\vct{g}},\vct{h})\geq t)$. Via Lemma \ref{asym str}, observe that \[ \phi_*=\min_{w,\gamma,v}L'(w,\gamma,v)=L'(w_*,\gamma_*,0) \] where $w_*,\gamma_*$ is as in \eqref{opt choices} and $\rho=l_h^2/l_g^2$. Via Lemma \ref{lem nearby}, there exists $w'$ such that $|w'-w| \leq\delta$ and $L(w',\gamma_*,0)\leq\phi_*+\delta$. \end{proof} \newpage \section{Overdetermined analysis} \begin{lemma}[To be proven rigorously] Set ${\bar{p}}=p/n$ and ${\bar{s}}=s/n$. Suppose ${\bar{p}}<1$ and suppose $\vct{t}^T{\boldsymbol{{\Sigma}}}\vct{t}=\theta$. Then \[ {\cal{L}}({\boldsymbol{\hat{\beta}}})=\sigma^2+w^2=\frac{\sigma^2}{1-{\bar{p}}}\quad\text{and}\quad {\cal{L}}(\boldsymbol{\hat{\theta}})=\frac{1-{\bar{p}}+{\bar{s}}}{1-{\bar{p}}}\sigma^2+\alpha-\theta. \] \end{lemma} \subsection{Analysis} Since ${\bar{p}}<1$, \eqref{optim me} has a unique solution. Set $\boldsymbol{\omega}=\sqrt{{\boldsymbol{{\Sigma}}}}\vct{w}$ where $\vct{w}={\boldsymbol{\beta}}-{\boldsymbol{\beta}}'$. Define ${\mtx{X}}_{\vct{z}}=[{\mtx{\bar{X}}}~{\vct{z}}]$ and $\boldsymbol{\omega}_\sigma=[\boldsymbol{\omega}^T~\sigma]^T$. This leads to the optimization problem \[ \hat{\boldsymbol{\omega}}=\arg\min_{\boldsymbol{\omega}} \tn{{\mtx{\bar{X}}}\boldsymbol{\omega}+\sigma {\vct{z}}}=\arg\min_{\boldsymbol{\omega}} \tn{{\mtx{X}}_{\vct{z}}\boldsymbol{\omega}_\sigma}. \] Fix ${\vct{g}}\sim\mathcal{N}(0,{\mtx{I}}_p),\vct{h}\sim\mathcal{N}(0,{\mtx{I}}_n)$. Note that that $s/p={\bar{s}}/{\bar{p}}$. Applying Gordon's Lemma (non-rigorously) and noticing optimal $\boldsymbol{\omega}$ has form $\boldsymbol{\omega}=w\bar{{\vct{g}}}$ where $\bar{{\vct{g}}}={\vct{g}}/\tn{{\vct{g}}}$, we find \begin{align} \min_{\vct{w}} \max_{\tn{\vct{a}}\leq 1} \vct{h}^T\vct{a} \tn{\boldsymbol{\omega}_{\sigma}}-\tn{\vct{a}}{\vct{g}}^T\boldsymbol{\omega}_{\sigma}&=\min_{\vct{w}} \sqrt{n} \tn{\boldsymbol{\omega}_{\sigma}}-{\vct{g}}^T\boldsymbol{\omega}_{\sigma}\\ &=\min_{\vct{w}} \sqrt{n} \sqrt{w^2+\sigma^2}-w\tn{{\vct{g}}}\\ &\propto\min_{\vct{w}} \sqrt{w^2+\sigma^2}-w\sqrt{{\bar{p}}}. \end{align} This implies $w=\sqrt{\frac{{\bar{p}}}{1-{\bar{p}}}}\sigma$ via \[ \sqrt{{\bar{p}}}=\frac{w}{\sqrt{w^2+\sigma^2}}\iff {\bar{p}} (w^2+\sigma^2)=w^2\iff w=\sqrt{\frac{{\bar{p}}}{1-{\bar{p}}}}\sigma \] Now, recall that ${\boldsymbol{\hat{\beta}}}={\boldsymbol{\beta}}+{\boldsymbol{{\Sigma}}}^{-1/2}\boldsymbol{\omega}$. Since the entries of $\boldsymbol{\omega}$ are normally distributed, we have that \begin{align} \sqrt{{\boldsymbol{{\Sigma}}}}\boldsymbol{\hat{\theta}}&=\sqrt{{\boldsymbol{{\Sigma}}}}\mathbb{F}_s({\boldsymbol{\hat{\beta}}})=\sqrt{{\boldsymbol{{\Sigma}}}}(\mathbb{F}_s({\boldsymbol{\beta}})+\mathbb{F}_s({\boldsymbol{{\Sigma}}}^{-1/2}\boldsymbol{\omega}))\\ &=\sqrt{{\boldsymbol{{\Sigma}}}}\mathbb{F}_s({\boldsymbol{\beta}})+\mathbb{F}_s(\boldsymbol{\omega})\\ &=\vct{t}+\mathbb{F}_s(\boldsymbol{\omega}). \end{align} Note that $\tn{\mathbb{F}_s(\boldsymbol{\omega})}=\sqrt{\frac{s}{p}}\sqrt{\frac{{\bar{p}}}{1-{\bar{p}}}}\sigma=\sqrt{\frac{{\bar{s}}}{1-{\bar{p}}}}\sigma$. Thus the test error \eqref{test formula} of ${\boldsymbol{\hat{\beta}}}$ and $\boldsymbol{\hat{\theta}}$ are \[ {\cal{L}}({\boldsymbol{\hat{\beta}}})=\sigma^2+w^2=\frac{\sigma^2}{1-{\bar{p}}}\quad\text{and}\quad {\cal{L}}(\boldsymbol{\hat{\theta}})=\frac{{\bar{s}}}{1-{\bar{p}}}\sigma^2+\alpha-\theta+\sigma^2. \] \section{Overparameterized analysis} Let $\lambda_i$ be the $i$th diagonal entry of the covariance matrix ${\boldsymbol{{\Sigma}}}$. \begin{lemma}[To be proven rigorously] Set ${\bar{p}}=p/n$ and ${\bar{s}}=s/n$. Then, define the quantities \begin{align} &\Lambda\quad\text{is solution of}\quad n=\sum_{i=1}^p\frac{1}{1+(\Lambda\lambda_i)^{-1}},\\ &\zeta_i=\frac{1}{1+\Lambda \lambda_i},\\ &\gamma_i=\frac{\Gamma}{n(1+(\Lambda \lambda_i)^{-1})}\quad\text{where}\quad n(\sigma^2+\sum_{i=1}^n \gamma_i^2+\lambda_i\zeta_i^2{\boldsymbol{\beta}}_i^2)=\Gamma^2. \end{align} $\bar{\gamma}=\sqrt{p}\gamma,\bar{\Gamma}=\Gamma/\sqrt{p}$ \begin{align} &\bar{\gamma}_i=\frac{\sqrt{p}\sqrt{p}\bar{\Gamma}}{n(1+(\Lambda \lambda_i)^{-1})}\quad\text{where}\quad n(\sigma^2+\sum_{i=1}^n \frac{\bar{\gamma}_i^2}{p}+\lambda_i\zeta_i^2{\boldsymbol{\beta}}_i^2)=p\bar{\Gamma}^2. \end{align} Then, the distribution of $\hat{{\boldsymbol{\beta}}}$ can be approximated as \[ \hat{{\boldsymbol{\beta}}}\sim (1-\zeta)\odot{\boldsymbol{\beta}}-{\boldsymbol{{\Sigma}}}^{-1/2}\gamma\odot{\vct{g}}. \] Then, the test errors are given by \begin{align} &{\cal{L}}({\boldsymbol{\hat{\beta}}})=\sigma^2+\sum_{i=1}^p\gamma_i^2+\lambda_i\zeta_i^2{\boldsymbol{\beta}}_i^2\\ &{\cal{L}}(\boldsymbol{\hat{\theta}})=\sigma^2+\sum_{i=1}^s(\gamma_i^2+\lambda_i\zeta_i^2{\boldsymbol{\beta}}_i^2)+\sum_{i=s+1}^p\lambda_i{\boldsymbol{\beta}}_i^2. \end{align} \end{lemma} \subsection{Derivation} Since ${\bar{p}}>1$, we solve the least-squares problem \eqref{optim me2} subject to the min norm constraint. Using change of variable, this yields \begin{align} \min_{\vct{w}} \tn{{\boldsymbol{\beta}}-\vct{w}}\quad\text{subject to}\quad \tn{{\mtx{X}}\vct{w}+\sigma {\vct{z}}}=0. \end{align} Noticing $\tn{{\mtx{X}}\vct{w}+\sigma {\vct{z}}}=\tn{{\mtx{\bar{X}}}\sqrt{{\boldsymbol{{\Sigma}}}}\vct{w}+\sigma {\vct{z}}}$, Gordon's Lemma formulation takes the form (non-rigorously) \begin{align} \min_{\vct{w}} \tn{{\boldsymbol{\beta}}-\vct{w}}\quad\text{subject to}\quad \sqrt{n}\tn{\sqrt{{\boldsymbol{{\Sigma}}}}\vct{w}~{\sigma}}={\vct{g}}^T\sqrt{{\boldsymbol{{\Sigma}}}}\vct{w}. \end{align} Setting $w_i=\frac{\gamma_i}{\sqrt{\lambda_i}}g_i+\zeta_i{\boldsymbol{\beta}}_i$, we have $\operatorname{\mathbb{E}}[{\vct{g}}^T\sqrt{{\boldsymbol{{\Sigma}}}}\vct{w}]=\operatorname{\mathbb{E}}[\sum_{i=1}^p\gamma_ig_i^2]=\sum_{i=1}^p\gamma_i:=\Gamma$. Taking expectations, we can write \begin{align} \min_{\gamma_i} \sum_{i=1}^p (1-\zeta_i)^2{\boldsymbol{\beta}}_i^2+\frac{\gamma_i^2}{\lambda_i} \quad\text{subject to}\quad n(\sigma^2+\sum_{i=1}^n \gamma_i^2+\lambda_i\zeta_i^2{\boldsymbol{\beta}}_i^2)=\Gamma^2. \end{align} In Lagrangian form, we obtain \begin{align} \min_{\gamma_i} \sum_{i=1}^p (1-\zeta_i)^2{\boldsymbol{\beta}}_i^2+\frac{\gamma_i^2}{\lambda_i} +\Lambda [(\sigma^2+\sum_{i=1}^n \gamma_i^2+\lambda_i\zeta_i^2{\boldsymbol{\beta}}_i^2)-\frac{\Gamma^2}{n}]. \end{align} Differentiating with respect to $\gamma_i,\zeta_i$, we obtain the equations \begin{align} \frac{\gamma_i}{\lambda_i}+\Lambda [\gamma_i-\Gamma/n]=0&\iff \gamma_i=\frac{\Gamma}{n(1+(\Lambda\lambda_i)^{-1})}\\ (\zeta_i-1){\boldsymbol{\beta}}_i^2+\Lambda \lambda_i{\boldsymbol{\beta}}_i^2\zeta_i=0&\iff \zeta_i=\frac{1}{1+\Lambda \lambda_i}. \end{align} $\Lambda$ has to satisfy the inequality \begin{align} n=\sum_{i=1}^p\frac{1}{1+(\Lambda\lambda_i)^{-1}}\iff \sum_{i=1}^p\gamma_i=\Gamma\sum_{i=1}^p\frac{1}{n(1+(\Lambda\lambda_i)^{-1})}. \end{align} Finally, we pick $\Gamma>0$ and $\gamma_i=\frac{\Gamma}{n(1+(\Lambda \lambda_i)^{-1})}$ such that the following equality is satisfied \[ n(\sigma^2+\sum_{i=1}^n \gamma_i^2+\lambda_i\zeta_i^2{\boldsymbol{\beta}}_i^2)=\Gamma^2. \] Finally, fixing a fresh example $\vct{x}=\sqrt{{\boldsymbol{{\Sigma}}}}\bar{\vct{x}}$, the test error is given as follows \[ {\cal{L}}({\boldsymbol{\hat{\beta}}})=\sigma^2+\tn{\sum_{i=1}^p \bar{x}_i\sqrt{\lambda_i}(\frac{\gamma_i}{\sqrt{\lambda_i}}g_i+\zeta_i{\boldsymbol{\beta}}_i)}^2=\sigma^2+\sum_{i=1}^p\gamma_i^2+\lambda_i\zeta_i^2{\boldsymbol{\beta}}_i^2. \] To proceed, the error of the sparse model can be calculated as follows. \[ {\cal{L}}(\boldsymbol{\hat{\theta}})=\sigma^2+\tn{\sum_{i=1}^s\bar{x}_i \sqrt{\lambda_i}(\frac{\gamma_i}{\sqrt{\lambda_i}}g_i+\zeta_i{\boldsymbol{\beta}}_i)+\sum_{i=s+1}^p\bar{x}_i\sqrt{\lambda_i}{\boldsymbol{\beta}}_i}^2=\sigma^2+\sum_{i=1}^s(\gamma_i^2+\lambda_i\zeta_i^2{\boldsymbol{\beta}}_i^2)+\sum_{i=s+1}^p\lambda_i{\boldsymbol{\beta}}_i^2. \] \section{Linear Random Features} \subsection{When $k>p$} Let ${\mtx{F}}\in\mathbb{R}^{k\times p}$ be the feature matrix. In this case, we solve \[ \min_{\vct{t}}\tn{\vct{y}-{\mtx{X}}{\mtx{F}}^T\vct{t}}=\min_{\vct{t}}\tn{{\mtx{X}}{\boldsymbol{\beta}}+\sigma{\vct{z}}-{\mtx{X}}{\mtx{F}}^T\vct{t}} \] Let ${\boldsymbol{\hat{\beta}}}$ be the min-norm solution of $\min_{{\boldsymbol{\beta}}'}\tn{\vct{y}-{\mtx{X}}{\boldsymbol{\beta}}'}$. Since ${\mtx{F}}$ is unitary, we have that \[ \boldsymbol{\hat{\theta}}={\mtx{F}}{\boldsymbol{\hat{\beta}}}. \] Thus random features has the effect of diluting the target vector before thresholding. The norm of ${\boldsymbol{\hat{\beta}}}$ is preserved but each coordinate has less say in the decision. Specifically, the sparsified $\boldsymbol{\hat{\theta}}_{\text{sparse}}=\mathbb{T}_s(\boldsymbol{\hat{\theta}})$ leads to the error \[ {\cal{L}}(\boldsymbol{\hat{\theta}}_{\text{sparse}})=\tn{{\boldsymbol{\beta}}-{\mtx{F}}^T\mathbb{T}_s({\mtx{F}}{\boldsymbol{\hat{\beta}}})}^2 \] Let $\vct{w}={\boldsymbol{\beta}}-{\boldsymbol{\beta}}'$. Draw $\vct{h}\sim\mathcal{N}(0,{\mtx{I}}_p),h\sim\mathcal{N}(0,1)$ and ${\vct{g}}\sim\mathcal{N}(0,{\mtx{I}}_n)$. Consider the primary optimization (PO) \begin{align} \Phi({\mtx{X}})&=\min_{\vct{w}}\tn{{\mtx{X}}\vct{w}+\sigma {\vct{z}}}\\ &=\min_{\vct{w}}\max_{\tn{\vct{a}}\leq 1}\vct{a}^T{\mtx{X}}_{{\vct{z}}}\vct{w}_{\sigma}, \end{align} \begin{align} \Phi({\mtx{X}})&=\min_{\vct{w}}0.5\lambda\tn{{\mtx{X}}_{\vct{z}}\vct{w}_\sigma}^2+0.5\tn{{\boldsymbol{\beta}}-\vct{w}}^2\\ &=\min_{\vct{w}}\max_{\vct{a}}\lambda\vct{a}^T{\mtx{X}}_{{\vct{z}}}\vct{w}_{\sigma}-0.5\lambda\tn{\vct{a}}^2+0.5\tn{{\boldsymbol{\beta}}-\vct{w}}^2 \end{align} Differentiating the first line, we obtain \[ \vct{w}-{\boldsymbol{\beta}}+\lambda {\mtx{X}}^T({\mtx{X}}\vct{w}+\sigma {\vct{z}})=0\implies \vct{w}=(\lambda {\mtx{X}}^T{\mtx{X}}+{\mtx{I}})^{-1}({\boldsymbol{\beta}}-\sigma\lambda{\mtx{X}}^T{\vct{z}}) \] {\bf{Opt 1:}} and the corresponding auxiliary optimization (AO) \begin{align} \phi({\vct{g}},\vct{h})&=\min_{\vct{w}}\max_{\vct{a}} \lambda(\tn{\vct{w}_{\sigma}}{\vct{g}}^T\vct{a}+\tn{\vct{a}}(\vct{w}^T\vct{h}+\sigma h)-0.5\tn{\vct{a}}^2)+0.5\tn{{\boldsymbol{\beta}}-\vct{w}}^2\\ &=\min_{\vct{w}}\max_{a} \lambda(a\tn{\vct{w}_{\sigma}}\tn{{\vct{g}}}+a(\vct{w}^T\vct{h}+\sigma h)-0.5a^2)+0.5\tn{{\boldsymbol{\beta}}-\vct{w}}^2\\ &=\min_{\vct{w}} 0.5\lambda(\tn{\vct{w}_{\sigma}}\tn{{\vct{g}}}+(\vct{w}^T\vct{h}+\sigma h))^2+0.5\tn{{\boldsymbol{\beta}}-\vct{w}}^2. \end{align} \[ \vct{w}-{\boldsymbol{\beta}}+\lambda(\vct{h}+\frac{\tn{{\vct{g}}}}{\sqrt{\tn{\vct{w}}^2+\sigma^2}}\vct{w})(\tn{\vct{w}_{\sigma}}\tn{{\vct{g}}}+(\vct{w}^T\vct{h}+\sigma h))=0. \] {\bf{Opt 2:}} and the corresponding auxiliary optimization (AO) \begin{align} \phi({\vct{g}},\vct{h})&=\min_{\vct{w}}\max_{\vct{a}} \tn{\vct{w}_{\sigma}}{\vct{g}}^T\vct{a}+\tn{\vct{a}}(\vct{w}^T\vct{h}+\sigma h)\\\ &=\min_{\vct{w}}(\tn{\vct{w}_{\sigma}}\tn{{\vct{g}}}+\vct{w}^T\vct{h}+\sigma h)_+\\ &=(\min_{\vct{w}}\sqrt{\tn{\vct{w}}^2+\sigma^2}\tn{{\vct{g}}}+\vct{w}^T\vct{h}+\sigma h)_+ \end{align} Regularized version becomes \begin{align} \phi({\vct{g}},\vct{h})&=\lambda (\min_{\vct{w}}\sqrt{\tn{\vct{w}}^2+\sigma^2}\tn{{\vct{g}}}+\vct{w}^T\vct{h}+\sigma h)_++\tn{{\boldsymbol{\beta}}-\vct{w}}^2. \end{align} Differentiating, we have two options \begin{align} \vct{w}-{\boldsymbol{\beta}}+\lambda(\vct{h}+\frac{\tn{{\vct{g}}}}{\sqrt{\sigma^2+\tn{\vct{w}}^2}}\vct{w})=0. \end{align} \[ (1+\lambda \frac{l_g}{\sqrt{\sigma^2+w^2}})\vct{w}={\boldsymbol{\beta}}-\lambda \vct{h}. \] Decompose $\vct{w}=w\omega$ where $\omega=\frac{{\boldsymbol{\beta}}-\lambda \vct{h}}{\tn{{\boldsymbol{\beta}}-\lambda \vct{h}}}$. We find \[ (1+\lambda \frac{l_g}{\sqrt{\sigma^2+w^2}})w=\tn{{\boldsymbol{\beta}}-\lambda \vct{h}}. \] Primary problem is \[ \min_{{\boldsymbol{\beta}}}\lambda \tn{\vct{y}-{\mtx{X}}{\boldsymbol{\beta}}}+0.5\tn{{\boldsymbol{\beta}}}^2\implies {\boldsymbol{\beta}}+\lambda \frac{{\mtx{X}}^T({\mtx{X}}{\boldsymbol{\beta}}-\vct{y})}{\tn{{\mtx{X}}{\boldsymbol{\beta}}-\vct{y}}}=0 \] Setting $\lambda'=\lambda/\tn{{\mtx{X}}{\boldsymbol{\beta}}-\vct{y}}$ \[ {\boldsymbol{\beta}}=(\frac{{\mtx{I}}}{\lambda'}+{\mtx{X}}^T{\mtx{X}})^{-1}{\mtx{X}}^T\vct{y} \] \newpage and the corresponding auxiliary optimization (AO) \begin{align} \phi({\vct{g}},\vct{h})&=\min_{\vct{w}}\max_{\vct{a}} \tn{\vct{w}_{\sigma}}{\vct{g}}^T\vct{a}+\tn{\vct{a}}(\vct{w}^T\vct{h}+\sigma h)\\\ &=\min_{\vct{w}}(\tn{\vct{w}_{\sigma}}\tn{{\vct{g}}}+\vct{w}^T\vct{h}+\sigma h)_+\\ &=(\min_{\vct{w}}\sqrt{\tn{\vct{w}}^2+\sigma^2}\tn{{\vct{g}}}+\vct{w}^T\vct{h}+\sigma h)_+ \end{align} Additionally denoting the pseudo-inverse by ${\mtx{X}}^+$, define the minimum norm solution of PO via \begin{align} \vct{w}_\Phi({\mtx{X}})&={\boldsymbol{\beta}}-{\mtx{X}}^+({\mtx{X}}{\boldsymbol{\beta}}+\sigma{\vct{z}})\\ &=\begin{cases}\arg\min_{\vct{w}}\tn{{\mtx{X}}\vct{w}+\sigma {\vct{z}}}\quad \text{if}\quad n\geq p\\\arg\min_{\vct{w}}\tn{{\boldsymbol{\beta}}-\vct{w}}\quad\text{subject to}\quad{\mtx{X}}\vct{w}+\sigma {\vct{z}}=0\quad\text{if}\quad n<p\end{cases} \end{align} \subsection{Overparameterized analysis} \subsubsection{General idea - overparameterized line of attack} Suppose $\Phi({\mtx{X}})=0$ and we are interested in \begin{align} {\cal{L}}_{\text{PO}}'(\vct{w})&=\min_{\vct{w}} \|\vct{w}\|\quad\text{subject to}\quad {\cal{L}}_{\text{PO}}(\vct{w},{\mtx{X}})=0\\ &=\min_{\vct{w}}\max_{\lambda} \|\vct{w}\|+\lambda{\cal{L}}_{\text{PO}}(\vct{w},{\mtx{X}}). \end{align} \subsubsection{Proof stuff} Fix a scalar $\theta>0$ and define the set $\Theta=\{x{~\big |~} \theta(1-\varepsilon)\leq x\leq \theta(1+\varepsilon)\}$. Consider the optimization \[ \min_{\tn{{\boldsymbol{\beta}}}\not\in \Theta}\tn{{\mtx{X}}\vct{w}} \] We would like to assess the properties of the solution ${\boldsymbol{\hat{\beta}}}$. In this case, we solve least squares subject to min norm constraint. Gordon takes the form \begin{align} \min_{{\boldsymbol{\beta}}'} \tn{{\boldsymbol{\beta}}'}\quad\text{subject to}\quad \sqrt{n}\tn{\vct{w}_{\sigma}}={\vct{g}}^T\vct{w}_{\sigma}. \end{align} This time $\vct{w}$ will choose the form \[ \vct{w}=w\bar{{\vct{g}}}-\gamma {\boldsymbol{\beta}}. \] which yields the scalar problem \[ \min_{w,\gamma} \alpha^2(1-\gamma)^2+w^2\quad\text{subject to}\quad (w^2+\alpha^2\gamma^2+\sigma^2)=w^2\kappa. \] This means \[ w^2=\frac{\alpha^2\gamma^2+\sigma^2}{\kappa-1}\implies \min_{\gamma} \alpha^2(1-\gamma)^2+\frac{\alpha^2\gamma^2+\sigma^2}{\kappa-1} \] This implies \[ 1-\gamma=\frac{\gamma}{\kappa-1}\implies 1=\gamma(1+\frac{1}{\kappa-1})\implies \gamma=\frac{\kappa-1}{\kappa}. \] In terms of $w,\gamma$, \begin{align} &{\boldsymbol{\hat{\beta}}}=(1-\gamma){\boldsymbol{\beta}}+w\bar{{\vct{g}}}=\frac{{\boldsymbol{\beta}}}{\kappa}+w\bar{{\vct{g}}}\\ &\boldsymbol{\hat{\theta}}=(1-\gamma)\vct{t}+w\bar{{\vct{g}}}[1:s] \end{align} Thus, \begin{align} &{\boldsymbol{\beta}}-{\boldsymbol{\hat{\beta}}}={\boldsymbol{\beta}}(1-\frac{1}{\kappa})+{\boldsymbol{\beta}}[k:]+w\bar{{\vct{g}}}\\ &{\boldsymbol{\beta}}-\boldsymbol{\hat{\theta}}={\boldsymbol{\beta}}[1:s](1-\frac{1}{\kappa})+{\boldsymbol{\beta}}[s:]+w\bar{{\vct{g}}}[1:s] \end{align} Secondly, note that \[ w^2=\frac{\alpha^2\gamma^2+\sigma^2}{\kappa-1}=\frac{\sigma^2}{\kappa-1}+\frac{\alpha^2(\kappa-1)}{\kappa^2} \] Thus the test error of ${\boldsymbol{\hat{\beta}}}$ is \[ err({\boldsymbol{\hat{\beta}}})=\sigma^2+w^2+\alpha^2(1-\frac{1}{\kappa})^2=\frac{\kappa \sigma^2}{\kappa-1}+\alpha^2\frac{\kappa-1}{\kappa} \] Similarly, the error will be proportionally distributed over $\boldsymbol{\hat{\theta}}$ thus test error of $\boldsymbol{\hat{\theta}}$ is \[ err(\boldsymbol{\hat{\theta}})=1-\theta^2+\bar{\sigma}^2+\frac{\xi}{\kappa}w^2+\theta^2(1-\frac{1}{\kappa})^2=1-\theta^2+\bar{\sigma}^2+\frac{\xi (1-\alpha^2+\bar{\sigma}^2)}{\kappa(\kappa-1)}+\frac{\kappa-1}{\kappa^2}(\theta^2(\kappa-1)+\frac{\xi}{\kappa}\alpha^2) \] \section{Intuitions for Understanding the Benefits of Overparameterization and Retraining}\label{sec intu} So far we have a couple of interesting conclusions. First, solving overparameterized problem and then pruning can be better than pruning with optimal sparse features. Secondly, retraining may hurt the performance in theory however it helps the performance for neural nets and random features. This section aims to provide further insights into these. \noindent\textbf{Denoising effect of overparameterization:} Consider a simple linear model with noise level $\sigma=0$, $n\geq p\gg s$ and identity covariance. Pick index set $\Delta\subset[p]$ with $|\Delta|=s$. Suppose we wish to estimate the coefficients ${\boldsymbol{\beta}}^\star_{\Delta}$. For pruning, we can pick $\Delta$ to be the most salient/largest entries. If we solve the smaller problem over $\Delta$, ${\boldsymbol{\hat{\beta}}}[\Delta]$ will only provide a noisy estimate of ${\boldsymbol{\beta}}^\star_{\Delta}$. The reason is that, the signal energy of missing features $[p]-\Delta$ act as noise uncorrelated with features over $\Delta$. Conversely, if we solve ERM with all features (the larger problem), we perfectly recover ${\boldsymbol{\beta}}^\star$ due to lack of noise and $n>p$ from which we perfectly estimate ${\boldsymbol{\beta}}^\star_{\Delta}$. This simple argument, which is in similar spirit to \cite{}, shows that solving the larger problem with more parameters can have a denoising like effect and perform better than the small problem. It also explains why retraining again with few features can hurt the performance. Our contribution obviously goes well beyond this discussion and theoretically characterizes exact asymptotics and also the important overparameterized regime $n\ll p$. \som{also see SM for DNN experiments} \noindent\textbf{Why \& When Retraining Helps:} In practice, as seen in the RFR experiments of Fig.~\ref{figRF2}, retraining improves the performance. Here, we argue that the benefit of retraining is connected to the correlations among input features. Indeed, covariance/Hessian associated with RF and DNN regressions are not diagonal matrices. Imagine only a single feature is sufficient to explain the label. If there are multiple other features that can similarly explain the label, the prediction of ${\boldsymbol{\hat{\beta}}}$ will be shared across these features. Then, pruning will lead to a biased estimate which can be mitigated by retraining. The following lemma formalizes this and demonstrates improvement thanks to retraining. This lemma considers a simple setup where the features are perfectly correlated via a rank-1 covariance \cmt{ train$\rightarrow$prune With growing correlations, the This is in contrast to the diagonal covariance with orthogonal features where retraining may hurt. wheredemonstrate a simple scenario which shows that retraining can actually retraining is critical for training sparse neural networks \cite{frankle2019lottery}. In this section, we identify feature correlation as a critical factor that necessitates retraining. This is in contrast to our results in Section \ref{doubdec} which considers independent features. In order to convey the point, let us focus on a simplistic scenario where covariance matrix is rank one and features are perfectly correlated with each other. In this case, the diagonal entries of the covariance matrix essentially dictates the form of the solution. } \begin{lemma} Suppose $\mathcal{S}$ is drawn from an LGP$(\sigma,{\boldsymbol{{\Sigma}}},{\boldsymbol{\beta}}_\star)$ as in Def.~\ref{def LGP} where $\text{rank}({\boldsymbol{{\Sigma}}})=1$ with ${\boldsymbol{{\Sigma}}}=\boldsymbol{\lambda}\bla^T$ for $\boldsymbol{\lambda}\in\mathbb{R}^p$. Define $\zeta=\mathbb{T}_s(\boldsymbol{\lambda})^2/\tn{\boldsymbol{\lambda}}^2$. For magnitude and Hessian pruning ($P\in\{M,H\}$) and the associated retraining, we have the following excess risks with respect to ${\boldsymbol{\beta}}^\star \begin{align &\operatorname{\mathbb{E}}_{\mathcal{S}}[{\cal{L}}({\boldsymbol{\hat{\beta}}}_s^P)]-{\cal{L}}({\boldsymbol{\beta}}^\star)={\frac{\zeta^2\sigma^2}{n-2}}+\underbrace{(1-\zeta)^2(\boldsymbol{\lambda}^T{\boldsymbol{\beta}}^\star)^2}_{\text{Error due to bias}}\\ &\operatorname{\mathbb{E}}_{\mathcal{S}}[{\cal{L}}({\boldsymbol{\hat{\beta}}}_s^{RT})]-{\cal{L}}({\boldsymbol{\beta}}^\star)=\frac{\sigma^2}{n-2}. \end{align} \end{lemma} In essence, this lemma says that pruning the model leads to a biased estimator of the label where the bias coefficient $1-\zeta$ arises from the missing predictions of pruned features. These correspond to the small coefficients of $\boldsymbol{\lambda}$. In contrast, regardless of $s$, retraining always results in an unbiased estimator with the exact same risk as the dense model which quickly decays in sample size $n$. The reason is that retraining gives the remaining features to re-explain the label and account for the missing predictions and they can do it well since features are perfectly correlated. While this lemma provides insights for a simplistic model, we emphasize that our distributional predictions in the next section enables us to capture the retraining benefits for arbitrary covariance matrices \cmt{ \begin{proof} Set $c^\star=\boldsymbol{\lambda}^T{\boldsymbol{\beta}}^\star$. By definition, each input example $\vct{x}_i$ has the form $\vct{x}_i=g_i\boldsymbol{\lambda}$ and $y_i=g_ic^\star+\sigma z_i$. Set ${\vct{g}}=[g_1~\dots~g_n]^T$ and $\bar{{\vct{g}}}={\vct{g}}/\tn{{\vct{g}}}$. Thus, we have ${\mtx{X}}={\vct{g}}\boldsymbol{\lambda}^T$ and $\vct{y}={\vct{g}}\boldsymbol{\lambda}^T{\boldsymbol{\beta}}^\star+\sigma{\vct{z}}$. Decompose ${\vct{z}}=\bar{{\vct{z}}}+\bar{{\vct{g}}}^T{\vct{z}}\bar{{\vct{g}}}$. The least-squares solution has the form ${\boldsymbol{\hat{\beta}}}=\hat{c}\boldsymbol{\lambda}/\tn{\boldsymbol{\lambda}}^2$ where \begin{align} &\hat{c}=\arg\min_{c}\tn{(c^\star-c){\vct{g}}+\sigma{\vct{z}}}\implies\\ &\hat{c}=c^\star+\sigma\gamma\label{beta}. \end{align} where $\gamma=\frac{\bar{{\vct{g}}}^T{\vct{z}}}{\tn{{\vct{g}}}}$. Set $h$, $\epsilon\overset{\text{i.i.d.}}{\sim} \mathcal{N}(0,1)$. Note that \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}})=\mathbb{E}[((c^\star-\hat{c})h+\sigma\epsilon)^2] =(\gamma^2+1)\sigma^2 \end{align} \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}})&=\mathbb{E}[(c^\star- \hat{c}\frac{\boldsymbol{\lambda}^T{\vct{u}}}{\tn{\boldsymbol{\lambda}}^2})h+\sigma\epsilon)^2]\\ &=\mathbb{E}[(c^\star- \hat{c}\zeta)h+\sigma\epsilon)^2]\\ &=((1-\zeta)c^\star-\zeta\sigma\gamma)^2 \end{align} Now let $|\lambda_{k_1}|\geq|\lambda_{k_2}|\geq...\geq|\lambda_{k_p}|$. Assume we solved ERM to get $\hat{c}$ and ${\boldsymbol{\hat{\beta}}}=\hat{c}\boldsymbol{\lambda}$. Prune the trained model ${\boldsymbol{\hat{\beta}}}$ to $s$-sparse by keeping the largest entries. Set ${\vct{u}}=\mathbb{T}_s(\boldsymbol{\lambda})$ and $\zeta=\tn{{\vct{u}}}^2/\tn{\boldsymbol{\lambda}}^2$. We get ${\boldsymbol{\hat{\beta}}}_s=\hat{c}{\vct{u}}$. \begin{align} {\cal{L}}(\boldsymbol{\hat{\theta}})&=\mathbb{E}[((\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-{\vct{u}}^T\boldsymbol{\hat{\theta}})h+\sigma\epsilon)^2]\\ &=\mathbb{E}[((\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-\sum_{i=1}^s\lambda_{k_i}^2\hat{c})h+\sigma\epsilon)^2]\\ &=[(1-\zeta)\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-\zeta\sigma\gamma]^2+\sigma^2 \end{align} \textbf{Case 1: } Now, assume that we have already known the optimal entries and do pruning before training. Then the pruned model can be seen as pruning the inputs and then putting it through a non-sparse $s$-feature model. Let $\lambda_{t_1}{\boldsymbol{\beta}}_{t_1}\geq\lambda_{t_2}{\boldsymbol{\beta}}_{t_2}\geq...\geq\lambda_{t_s}{\boldsymbol{\beta}}_{t_s}$, $\vct{w}=[\lambda_{t_1}~\lambda_{t_2}~...~\lambda_{t_s}]$ and $\vct{t}=[{\boldsymbol{\beta}}_{t_1}~...~{\boldsymbol{\beta}}_{t_s}]$. Set data sample $\vct{x}_i'\overset{\text{i.i.d.}}{\sim} \mathcal{N}(0,{\boldsymbol{{\Sigma}}}')\in\mathbb{R}^s$ where are ${\boldsymbol{{\Sigma}}}'=\vct{w}\w^T$. Following what done in \ref{beta}, similarly \[ \boldsymbol{\hat{\theta}}'=\theta\vct{w}\quad\text{where}\quad\theta=\frac{1}{\sum_{i=1}^s\lambda_{t_i}^2}(\vct{w}^T\vct{t}+\frac{\sigma}{\tn{{\vct{g}}}^2}{\vct{g}}^T{\vct{z}}) \] \begin{align} {\cal{L}}(\boldsymbol{\hat{\theta}}')&=\mathbb{E}[((\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-\sum_{i=1}^s\lambda_{t_i}^2\theta)h+\sigma\epsilon)^2]\\ &=[(\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-\vct{w}^T\vct{t})-\sigma\gamma]^2+\sigma^2 \end{align} \textbf{Case 2: } Now retrain with the pruned entries $\lambda_{k_!}$, ..., $\lambda_{k_s}$. Then the pruned model can be seen as pruning the inputs and then putting it through a non-sparse $s$-feature model. Let $\vct{t}=[{\boldsymbol{\beta}}_{k_1}~...~{\boldsymbol{\beta}}_{k_s}]$. Set data sample $\vct{x}_i'\overset{\text{i.i.d.}}{\sim} \mathcal{N}(0,{\boldsymbol{{\Sigma}}}')\in\mathbb{R}^s$ where are ${\boldsymbol{{\Sigma}}}'={\vct{u}}\ub^T$. Following what done in \ref{beta}, similarly \[ \boldsymbol{\hat{\theta}}'=\theta\vct u\quad\text{where}\quad\theta=\frac{1}{\sum_{i=1}^s\lambda_{k_i}^2}(\vct u^T\vct{t}+\frac{\sigma}{\tn{{\vct{g}}}^2}{\vct{g}}^T{\vct{z}}) \] \begin{align} {\cal{L}}(\boldsymbol{\hat{\theta}}')&=\mathbb{E}[((\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-\sum_{i=1}^s\lambda_{k_i}^2\theta)h+\sigma\epsilon)^2]\\ &=[(\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-\vct u^T\vct{t})-\sigma\gamma]^2+\sigma^2 \end{align} \textbf{It is obvious to know that loss in case 1 is always smaller than it in case 2. Then for both case, } Set ${\boldsymbol{\beta}}^T{\boldsymbol{{\Sigma}}}{\boldsymbol{\beta}}=\alpha^2$ and $\vct{t}^T{\boldsymbol{{\Sigma}}}'\vct{t}=\rho^2$. We can write ${\cal{L}}(\boldsymbol{\hat{\theta}})$ and ${\cal{L}}(\boldsymbol{\hat{\theta}}')$ as \[ {\cal{L}}(\boldsymbol{\hat{\theta}})=((1-\zeta)\alpha-\zeta\sigma\gamma)^2+\sigma^2\iff{\cal{L}}(\boldsymbol{\hat{\theta}}')=(\alpha-\rho-\sigma\gamma)^2+\sigma^2 \] Now consider a special case which satisfies ${\cal{L}}(\boldsymbol{\hat{\theta}})<{\cal{L}}(\boldsymbol{\hat{\theta}}')$. \[ 0\leq(1-\zeta)\alpha-\zeta\sigma\gamma<\alpha-\rho-\sigma\gamma \] \[ \frac{\rho+\sigma\gamma}{\alpha+\sigma\gamma}<\zeta\leq\frac{\alpha}{\alpha+\sigma\gamma} \] \end{proof}} \cmt{ \begin{proof} Let ${\boldsymbol{{\Sigma}}}=\boldsymbol{\lambda}\bla^T$. Each $\vct{x}_i$ has the form $\vct{x}_i=g_i\boldsymbol{\lambda}$ and $y_i=x_i{\boldsymbol{\beta}}^T\boldsymbol{\lambda}+\sigma z_i$. Thus, we have ${\mtx{X}}={\vct{g}}\boldsymbol{\lambda}$ and $\vct{y}={\vct{g}}\boldsymbol{\lambda}^T{\boldsymbol{\beta}}+\sigma{\vct{z}}$. Let ${\vct{z}}=\bar{{\vct{z}}}+\frac{{\vct{g}}^T{\vct{z}}}{\tn{{\vct{g}}}^2}{\vct{g}}$. The least-squares solution has the form ${\boldsymbol{\hat{\beta}}}=\hat{c}\boldsymbol{\lambda}$ where \[ \hat{c} \] \end{proof}} \subsection{Further Intuitions on The Denoising Effect of Overparameterization} To provide further insights into the pruning benefits of overparameterization, consider a simple linear model (as in Def~\ref{def LGP}) with $n\geq p\geq s$, noise level $\sigma=0$ and identity covariance. Suppose our goal is estimating the coefficients ${\boldsymbol{\beta}}^\star_{\Delta}$ for some fixed index set $\Delta\subset[p]$ with $|\Delta|=s$. For pruning, we can pick $\Delta$ to be the most salient/largest entries. If we solve the smaller regression problem over $\Delta$, ${\boldsymbol{\hat{\beta}}}(\Delta)$ will only provide a noisy estimate of ${\boldsymbol{\beta}}^\star_{\Delta}$. The reason is that, the signal energy of the missing features $[p]-\Delta$ acts as a noise uncorrelated with the features in $\Delta$. Conversely, if we solve ERM with all features (the larger problem), we perfectly recover ${\boldsymbol{\beta}}^\star$ due to zero noise and invertibility ($n\geq p$). Then one can also perfectly estimate ${\boldsymbol{\beta}}^\star_{\Delta}$. This simple argument, which is partly inspired by the missing feature setup in \cite{hastie2019surprises}, shows that solving the larger problem with more parameters can have a ``denoising-like effect" and perform better than the small problem. Our contribution obviously goes well beyond this discussion and theoretically characterizes the exact asymptotics, handles the general covariance model and all $(n,p,s)$ regimes, and also highlights the importance of the overparameterized regime $n\ll p$. \section{Understanding the Benefits of Retraining}\label{sec intu} \cmt{\noindent\textbf{Denoising effect of overparameterization:} Consider a simple linear model with noise level $\sigma=0$, $n\geq p\gg s$ and identity covariance. Pick index set $\Delta\subset[p]$ with $|\Delta|=s$. Suppose we wish to estimate the coefficients ${\boldsymbol{\beta}}^\star_{\Delta}$. For pruning, we can pick $\Delta$ to be the most salient/largest entries. If we solve the smaller problem over $\Delta$, ${\boldsymbol{\hat{\beta}}}[\Delta]$ will only provide a noisy estimate of ${\boldsymbol{\beta}}^\star_{\Delta}$. The reason is that, the signal energy of the missing features $[p]-\Delta$ act as noise uncorrelated with features over $\Delta$. Conversely, if we solve ERM with all features (the larger problem), we perfectly recover ${\boldsymbol{\beta}}^\star$ due to lack of noise and $n>p$ from which we perfectly estimate ${\boldsymbol{\beta}}^\star_{\Delta}$. This simple argument, which is in similar spirit to \cite{}, shows that solving the larger problem with more parameters can have a denoising like effect and perform better than the small problem. It also explains why retraining again with few features can hurt the performance. Our contribution obviously goes well beyond this discussion and theoretically characterizes exact asymptotics and also the important overparameterized regime $n\ll p$.} On the one hand, the study of LGPs in \fx{Fig.~\ref{fig1} and Fig.~7 of SM} suggest that retraining can actually hurt the performance. On the other hand, in practice and in the RFR experiments of Fig.~\ref{figRF2}, retraining is crucial; compare the green ${\boldsymbol{\hat{\beta}}}^M$ and red ${\boldsymbol{\hat{\beta}}}^{RT}$ curves and see SM Section A for further DNN experiments. Here, we argue that the benefit of retraining is connected to the correlations between input features. Indeed, the covariance/Hessian matrices associated with RF and DNN regression are not diagonal (as was the case in Fig.~\ref{fig1}). To build intuition, imagine that only a single feature suffices to explain the label. If there are multiple other features that can similarly explain the label, the model prediction will be shared across these features. Then, pruning will lead to a biased estimate, which can be mitigated by retraining. The following lemma formalizes this intuition under an instructive setup, where the features are perfectly correlated \cmt{ train$\rightarrow$prune With growing correlations, the This is in contrast to the diagonal covariance with orthogonal features where retraining may hurt. wheredemonstrate a simple scenario which shows that retraining can actually retraining is critical for training sparse neural networks \cite{frankle2019lottery}. In this section, we identify feature correlation as a critical factor that necessitates retraining. This is in contrast to our results in Section \ref{doubdec} which considers independent features. In order to convey the point, let us focus on a simplistic scenario where covariance matrix is rank one and features are perfectly correlated with each other. In this case, the diagonal entries of the covariance matrix essentially dictates the form of the solution. } \begin{lemma} \label{lem rank one}Suppose $\mathcal{S}$ is drawn from an LGP$(\sigma,{\boldsymbol{{\Sigma}}},\boldsymbol{\beta}^\star)$ as in Def.~\ref{def LGP} where $\text{rank}({\boldsymbol{{\Sigma}}})=1$ with ${\boldsymbol{{\Sigma}}}=\boldsymbol{\lambda}\bla^T$ for $\boldsymbol{\lambda}\in\mathbb{R}^p$. Define $\zeta=\mathbb{T}_s(\boldsymbol{\lambda})^2/\tn{\boldsymbol{\lambda}}^2$. For magnitude and Hessian pruning ($P\in\{M,H\}$) and the associated retraining, we have the following excess risks with respect to ${\boldsymbol{\beta}}^\star \begin{align &\operatorname{\mathbb{E}}_{\mathcal{S}}[{\cal{L}}({\boldsymbol{\hat{\beta}}}_s^P)]-{\cal{L}}({\boldsymbol{\beta}}^\star)={\frac{\zeta^2\sigma^2}{n-2}}+\underbrace{(1-\zeta)^2(\boldsymbol{\lambda}^T\boldsymbol{\beta}^\star)^2}_{\text{Error due to bias}}\\ &\operatorname{\mathbb{E}}_{\mathcal{S}}[{\cal{L}}({\boldsymbol{\hat{\beta}}}_s^{RT})]-{\cal{L}}({\boldsymbol{\beta}}^\star)={\sigma^2}/({n-2}). \end{align} \end{lemma} The lemma reveals that pruning the model leads to a biased estimator of the label. Specifically, the bias coefficient $1-\zeta$ arises from the missing predictions of the pruned features (which correspond to the small coefficients of $|\boldsymbol{\lambda}|$). In contrast, regardless of $s$, retraining always results in an unbiased estimator with the exact same risk as the dense model which quickly decays in sample size $n$. The reason is that retraining enables the remaining features to account for the missing predictions. Here, this is accomplished perfectly, due to the fully correlated nature of the problem. {In particular, this is in contrast to the diagonal covariance (Fig.~\ref{fig1}), where the missing features act like uncorrelated noise during retraining.} \cmt{Our distributional predictions in the next section enable us to capture the benefits of retraining for arbitrary covariances going beyond this instructive example. \cmt{ \begin{proof} Set $c^\star=\boldsymbol{\lambda}^T{\boldsymbol{\beta}}^\star$. By definition, each input example $\vct{x}_i$ has the form $\vct{x}_i=g_i\boldsymbol{\lambda}$ and $y_i=g_ic^\star+\sigma z_i$. Set ${\vct{g}}=[g_1~\dots~g_n]^T$ and $\bar{{\vct{g}}}={\vct{g}}/\tn{{\vct{g}}}$. Thus, we have ${\mtx{X}}={\vct{g}}\boldsymbol{\lambda}^T$ and $\vct{y}={\vct{g}}\boldsymbol{\lambda}^T{\boldsymbol{\beta}}^\star+\sigma{\vct{z}}$. Decompose ${\vct{z}}=\bar{{\vct{z}}}+\bar{{\vct{g}}}^T{\vct{z}}\bar{{\vct{g}}}$. The least-squares solution has the form ${\boldsymbol{\hat{\beta}}}=\hat{c}\boldsymbol{\lambda}/\tn{\boldsymbol{\lambda}}^2$ where \begin{align} &\hat{c}=\arg\min_{c}\tn{(c^\star-c){\vct{g}}+\sigma{\vct{z}}}\implies\\ &\hat{c}=c^\star+\sigma\gamma\label{beta}. \end{align} where $\gamma=\frac{\bar{{\vct{g}}}^T{\vct{z}}}{\tn{{\vct{g}}}}$. Set $h$, $\epsilon\overset{\text{i.i.d.}}{\sim} \mathcal{N}(0,1)$. Note that \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}})=\mathbb{E}[((c^\star-\hat{c})h+\sigma\epsilon)^2] =(\gamma^2+1)\sigma^2 \end{align} \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}})&=\mathbb{E}[(c^\star- \hat{c}\frac{\boldsymbol{\lambda}^T{\vct{u}}}{\tn{\boldsymbol{\lambda}}^2})h+\sigma\epsilon)^2]\\ &=\mathbb{E}[(c^\star- \hat{c}\zeta)h+\sigma\epsilon)^2]\\ &=((1-\zeta)c^\star-\zeta\sigma\gamma)^2 \end{align} Now let $|\lambda_{k_1}|\geq|\lambda_{k_2}|\geq...\geq|\lambda_{k_p}|$. Assume we solved ERM to get $\hat{c}$ and ${\boldsymbol{\hat{\beta}}}=\hat{c}\boldsymbol{\lambda}$. Prune the trained model ${\boldsymbol{\hat{\beta}}}$ to $s$-sparse by keeping the largest entries. Set ${\vct{u}}=\mathbb{T}_s(\boldsymbol{\lambda})$ and $\zeta=\tn{{\vct{u}}}^2/\tn{\boldsymbol{\lambda}}^2$. We get ${\boldsymbol{\hat{\beta}}}_s=\hat{c}{\vct{u}}$. \begin{align} {\cal{L}}(\boldsymbol{\hat{\theta}})&=\mathbb{E}[((\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-{\vct{u}}^T\boldsymbol{\hat{\theta}})h+\sigma\epsilon)^2]\\ &=\mathbb{E}[((\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-\sum_{i=1}^s\lambda_{k_i}^2\hat{c})h+\sigma\epsilon)^2]\\ &=[(1-\zeta)\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-\zeta\sigma\gamma]^2+\sigma^2 \end{align} \textbf{Case 1: } Now, assume that we have already known the optimal entries and do pruning before training. Then the pruned model can be seen as pruning the inputs and then putting it through a non-sparse $s$-feature model. Let $\lambda_{t_1}{\boldsymbol{\beta}}_{t_1}\geq\lambda_{t_2}{\boldsymbol{\beta}}_{t_2}\geq...\geq\lambda_{t_s}{\boldsymbol{\beta}}_{t_s}$, $\vct{w}=[\lambda_{t_1}~\lambda_{t_2}~...~\lambda_{t_s}]$ and $\vct{t}=[{\boldsymbol{\beta}}_{t_1}~...~{\boldsymbol{\beta}}_{t_s}]$. Set data sample $\vct{x}_i'\overset{\text{i.i.d.}}{\sim} \mathcal{N}(0,{\boldsymbol{{\Sigma}}}')\in\mathbb{R}^s$ where are ${\boldsymbol{{\Sigma}}}'=\vct{w}\w^T$. Following what done in \ref{beta}, similarly \[ \boldsymbol{\hat{\theta}}'=\theta\vct{w}\quad\text{where}\quad\theta=\frac{1}{\sum_{i=1}^s\lambda_{t_i}^2}(\vct{w}^T\vct{t}+\frac{\sigma}{\tn{{\vct{g}}}^2}{\vct{g}}^T{\vct{z}}) \] \begin{align} {\cal{L}}(\boldsymbol{\hat{\theta}}')&=\mathbb{E}[((\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-\sum_{i=1}^s\lambda_{t_i}^2\theta)h+\sigma\epsilon)^2]\\ &=[(\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-\vct{w}^T\vct{t})-\sigma\gamma]^2+\sigma^2 \end{align} \textbf{Case 2: } Now retrain with the pruned entries $\lambda_{k_!}$, ..., $\lambda_{k_s}$. Then the pruned model can be seen as pruning the inputs and then putting it through a non-sparse $s$-feature model. Let $\vct{t}=[{\boldsymbol{\beta}}_{k_1}~...~{\boldsymbol{\beta}}_{k_s}]$. Set data sample $\vct{x}_i'\overset{\text{i.i.d.}}{\sim} \mathcal{N}(0,{\boldsymbol{{\Sigma}}}')\in\mathbb{R}^s$ where are ${\boldsymbol{{\Sigma}}}'={\vct{u}}\ub^T$. Following what done in \ref{beta}, similarly \[ \boldsymbol{\hat{\theta}}'=\theta\vct u\quad\text{where}\quad\theta=\frac{1}{\sum_{i=1}^s\lambda_{k_i}^2}(\vct u^T\vct{t}+\frac{\sigma}{\tn{{\vct{g}}}^2}{\vct{g}}^T{\vct{z}}) \] \begin{align} {\cal{L}}(\boldsymbol{\hat{\theta}}')&=\mathbb{E}[((\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-\sum_{i=1}^s\lambda_{k_i}^2\theta)h+\sigma\epsilon)^2]\\ &=[(\boldsymbol{\lambda}^T{\boldsymbol{\beta}}-\vct u^T\vct{t})-\sigma\gamma]^2+\sigma^2 \end{align} \textbf{It is obvious to know that loss in case 1 is always smaller than it in case 2. Then for both case, } Set ${\boldsymbol{\beta}}^T{\boldsymbol{{\Sigma}}}{\boldsymbol{\beta}}=\alpha^2$ and $\vct{t}^T{\boldsymbol{{\Sigma}}}'\vct{t}=\rho^2$. We can write ${\cal{L}}(\boldsymbol{\hat{\theta}})$ and ${\cal{L}}(\boldsymbol{\hat{\theta}}')$ as \[ {\cal{L}}(\boldsymbol{\hat{\theta}})=((1-\zeta)\alpha-\zeta\sigma\gamma)^2+\sigma^2\iff{\cal{L}}(\boldsymbol{\hat{\theta}}')=(\alpha-\rho-\sigma\gamma)^2+\sigma^2 \] Now consider a special case which satisfies ${\cal{L}}(\boldsymbol{\hat{\theta}})<{\cal{L}}(\boldsymbol{\hat{\theta}}')$. \[ 0\leq(1-\zeta)\alpha-\zeta\sigma\gamma<\alpha-\rho-\sigma\gamma \] \[ \frac{\rho+\sigma\gamma}{\alpha+\sigma\gamma}<\zeta\leq\frac{\alpha}{\alpha+\sigma\gamma} \] \end{proof}} \cmt{ \begin{proof} Let ${\boldsymbol{{\Sigma}}}=\boldsymbol{\lambda}\bla^T$. Each $\vct{x}_i$ has the form $\vct{x}_i=g_i\boldsymbol{\lambda}$ and $y_i=x_i{\boldsymbol{\beta}}^T\boldsymbol{\lambda}+\sigma z_i$. Thus, we have ${\mtx{X}}={\vct{g}}\boldsymbol{\lambda}$ and $\vct{y}={\vct{g}}\boldsymbol{\lambda}^T{\boldsymbol{\beta}}+\sigma{\vct{z}}$. Let ${\vct{z}}=\bar{{\vct{z}}}+\frac{{\vct{g}}^T{\vct{z}}}{\tn{{\vct{g}}}^2}{\vct{g}}$. The least-squares solution has the form ${\boldsymbol{\hat{\beta}}}=\hat{c}\boldsymbol{\lambda}$ where \[ \hat{c} \] \end{proof}} \section{Ridge Regression Analysis} We estimate $\vct{t}$ via the ridge-regression \begin{align} \boldsymbol{\hat{\theta}}=\mathbb{F}_s({\boldsymbol{\hat{\beta}}})\quad\text{where}\quad {\boldsymbol{\hat{\beta}}}=\arg\min_{{\boldsymbol{\beta}}'} 0.5\tn{\vct{y}-{\mtx{X}}{\boldsymbol{\beta}}'}^2+0.5\lambda n \tn{{\boldsymbol{\beta}}'}^2.\label{optim me3} \end{align} The residual formulation is given via \[ \hat{\vct{w}}=\arg\min_{\vct{w}} 0.5\tn{{\mtx{X}}_{\vct{z}}\vct{w}_\sigma}^2+0.5\lambda n \tn{{\boldsymbol{\beta}}-\vct{w}}^2 \] Observing $0.5\tn{\vct{v}}^2=\max_{\vct{a}} \vct{a}^T\vct{v}-0.5\tn{\vct{a}}^2$, we find \[ \hat{\vct{w}}=\arg\min_{\vct{w}_{\sigma}} \max_{\vct{a}} \vct{a}^T{\mtx{X}}_{\vct{z}}\vct{w}_\sigma-0.5\tn{\vct{a}}^2+0.5\lambda n \tn{{\boldsymbol{\beta}}-\vct{w}}^2. \] Fix ${\vct{g}}\sim\mathcal{N}(0,{\mtx{I}}_n),\vct{h}\sim\mathcal{N}(0,{\mtx{I}}_p)$. The associated Gordon's form is given by \[ \hat{\vct{w}}=\arg\min_{\vct{w}_{\sigma}} \max_{\vct{a}}\tn{\vct{w}_\sigma}{\vct{g}}^T\vct{a}- \tn{\vct{a}}\vct{w}_\sigma^T\vct{h}-0.5\tn{\vct{a}}^2+0.5\lambda n \tn{{\boldsymbol{\beta}}-\vct{w}}^2. \] Setting $\vct{a}=a\bar{{\vct{g}}}$, this yields \[ \min_{\vct{w}_{\sigma}} \max_{a\geq 0}a(\tn{\vct{w}_\sigma}\tn{{\vct{g}}}- \vct{w}_\sigma^T\vct{h})-0.5a^2+0.5\lambda n \tn{{\boldsymbol{\beta}}-\vct{w}}^2. \] Differentiating and setting $a=\tn{\vct{w}_\sigma}\tn{{\vct{g}}}- \vct{w}_\sigma^T\vct{h}$, we obtain \textcolor{red}{Here: need to be more careful. This holds only if $\tn{\vct{w}_\sigma}\tn{{\vct{g}}}- \vct{w}_\sigma^T\vct{h}>0$} \[ \min_{\vct{w}_{\sigma}} \lambda n \tn{{\boldsymbol{\beta}}-\vct{w}}^2+(\tn{\vct{w}_\sigma}\tn{{\vct{g}}}- \vct{w}_\sigma^T\vct{h})^2. \] Now, set $\vct{w}=h\bar{\vct{h}}+\gamma {\boldsymbol{\beta}}$. We obtain \[ \tn{\vct{w}_\sigma}\tn{{\vct{g}}}- \vct{w}_\sigma^T\vct{h}\approx \sqrt{n}\sqrt{h^2+\alpha\gamma^2+\sigma^2}-h\sqrt{p}. \] Secondly, note that \[ \tn{{\boldsymbol{\beta}}-\vct{w}}^2=\alpha(1-\gamma)^2+h^2. \] Normalizing by $n$ and setting ${\bar{p}}=p/n$, we obtain \begin{align}\label{eq:min_hgamma_reg} \min_{h,\gamma} \lambda (\alpha(1-\gamma)^2+h^2)+(\sqrt{h^2+\alpha\gamma^2+\sigma^2}-h\sqrt{{\bar{p}}})^2. \end{align} Set $T=\sqrt{h^2+\alpha\gamma^2+\sigma^2}$. Differentiating, we find \begin{align} &\lambda \alpha (\gamma-1)+(T-h\sqrt{{\bar{p}}})\frac{\alpha\gamma}{T}=0\implies \gamma=\frac{1}{1+\lambda^{-1}(1-\frac{h\sqrt{{\bar{p}}}}{T})}\label{eq:reg1}\\ &\lambda h+(T-h\sqrt{{\bar{p}}})(\frac{h}{T}-\sqrt{{\bar{p}}})=0.\label{eq:reg2} \end{align} From \eqref{eq:reg1}, we find that \begin{align} T =\Big( \frac{\gamma\sqrt{{\bar{p}}}}{\lambda(\gamma-1)+\gamma}\Big) h \end{align} Substitute this in \eqref{eq:reg2} and use the fact that $T>0\rightarrow h\neq 0$, yields: \begin{align} \gamma = \frac{1}{2{\bar{p}}}\,\Big( -1 - \lambda + {\bar{p}} + \sqrt{(1+\lambda-{\bar{p}})^2+4\lambda {\bar{p}}} \,\Big) = \frac{1}{2}\,\Big( 1 - \labar -{\bar{p}}^{-1} + \sqrt{\Big(1 - \labar-{\bar{p}}^{-1} \Big)^2+4\labar} \,\Big)\label{eq:reg_gamma}, \end{align} where we have also used that optimal $\gamma$ must be non-negative, which is easily seen from \eqref{eq:min_hgamma_reg}. We have also defined, $$ \labar = \lambda/{\bar{p}}. $$ Note that as $\lambda\rightarrow0$: $$ \gamma \stackrel{\lambda\rightarrow0}{\longrightarrow} \frac{1}{2{\bar{p}}}\Big( {\bar{p}} - 1 + \sqrt{(1-{\bar{p}})^2} \,\Big) = \begin{cases} 0 &, \text{ if } {\bar{p}}<1,\\ 1-\frac{1}{{\bar{p}}} &, \text{ if } {\bar{p}}>1. \end{cases} $$ Next, we can solve \eqref{eq:reg1} to find $h^2$: \begin{align}\label{eq:h2_reg} h^2 &= \frac{\alpha\gamma^2+\sigma^2}{\frac{\gamma^2 {\bar{p}}}{(\gamma\lambda+\gamma-\lambda)^2}-1} = \frac{\alpha\gamma^2+\sigma^2}{\frac{{\bar{p}}^{-1}}{\left(\labar+{\bar{p}}^{-1}-\frac{\labar}{\gamma}\right)^2}-1}\\ &= \frac{\frac{\alpha}{4}\left( 1 - \labar -{\bar{p}}^{-1} + \sqrt{\big(1 - \labar-{\bar{p}}^{-1} \Big)^2+4\labar} \,\right)^2 + \sigma^2}{\frac{4{\bar{p}}^{-1}}{\left(1+{\bar{p}}^{-1} + \labar - \sqrt{(1+{\bar{p}}^{-1} + \labar)^2-4{\bar{p}}^{-1}} \right)^2}-1}\notag \end{align} where to arrive in the last expression we used \eqref{eq:reg_gamma} and the fact that $$ \labar+{\bar{p}}^{-1}-\frac{\labar}{\gamma} = \frac{1}{2}\left(1+{\bar{p}}^{-1} + \labar - \sqrt{(1+{\bar{p}}^{-1} + \labar)^2-4{\bar{p}}^{-1}} \right). $$ With this and using the fact that $a-\sqrt{a^2-b}<\sqrt{b}$ it can be verified that the denominator in \eqref{eq:h2_reg} is positive. From \eqref{eq:h2_reg} note that as $\lambda\rightarrow 0$ $$ h^2 \stackrel{\lambda\rightarrow0}{\longrightarrow} \begin{cases} \sigma^2\frac{{\bar{p}}}{1-{\bar{p}}} &, \text{ if } {\bar{p}}<1,\\ \sigma^2\frac{1}{{\bar{p}}-1} \textcolor{red}{+ \alpha {\bar{p}}^{-1}({\bar{p}}^{-1}-1)} &, \text{ if } {\bar{p}}>1 \end{cases} $$ \textcolor{red}{something is wrong in the ${\bar{p}}>1$ case above} {\bf{Possibly useful idea:}} Bias-variance decomposition (for Gordon setup). \noindent {\bf{Step 1:}} Set $\sigma=0$. In this case, show that $h=0$\dots? \noindent {\bf{Step 2:}} Set ${\boldsymbol{\beta}}=\alpha=0$. In this case, we find $\sqrt{h^2+\sigma^2}$ and \[ \min_{h} \lambda h^2+(\sqrt{h^2+\sigma^2}-h\sqrt{{\bar{p}}})^2\dots \] \newpage \section{Asymptotic formulas on Magnitude- and Hessian- pruning}\label{sec prune risk} Here, we use Theorem \ref{thm:master_W2} to characterize the risk of the magnitude- and Hessian- pruned solutions. This section supplements the discussion in Section \ref{sec:risk}. For completeness, first, we recall the magnitude-pruning results of Section \ref{sec:risk} and restate Corollary \ref{cor:mag} below. This corollary characterizes the performance of magnitude pruning. Following this, we shall further discuss Hessian pruning. \subsection{Magnitude-based pruning} We begin with the following necessary definitions. Define the hard-thresholding function with fixed threshold $t\in\mathbb{R}_+$ as follows: \begin{align}\label{eq:threshold_app} \mathcal{T}_t(x) = \begin{cases} x & \text{if } |x|>t \\ 0 & \text{otherwise} \end{cases}. \end{align} Further, {given model sparsity target $1>\alpha>0$}, define the threshold $t^\star$ as follows: \begin{align}\label{eq:tstar_app} t^\star:=\sup\left\{t\in\mathbb{R}\,:\, \Pr(|X_{\kappa,\sigma^2}|\geq t) \geq \alpha \right\}. \end{align} \cormag* The proof of the corollary above, is given in Section \ref{sec:risk}. Below, we extend the results to Hessian-based pruning. \subsection{Hessian-based pruning} Let ${\boldsymbol{\hat{\beta}}}$ be the min-norm solution in \eqref{eq:min_norm}. Recall that the Hessian-pruned model (via Optimal Brain Damage) $\boldsymbol{\beta}_s^H$ at sparsity $s$ is given by \begin{align}\label{eq:hp} \boldsymbol{\beta}_s^H = \hat\boldsymbol{\Sigma}^{-1/2}\mathbb{T}_s(\hat\boldsymbol{\Sigma}^{1/2}\boldsymbol{\beta}), \end{align} where $\hat\boldsymbol{\Sigma}=\diag{{\mtx{X}}^T{\mtx{X}}}/n$ the diagonal of the empirical covariance matrix. We will argue that the following formula characterizes the asymptotic risk of the Hessian pruning solution. Recall the notation in \eqref{eq:threshold_app} and define \begin{align}\label{eq:tdiam_app} t^\diamond:=\sup\left\{t\in\mathbb{R}\,:\, \Pr(|\Lambda^{1/2}X_{\kappa,\sigma^2}|\geq t) \geq \alpha \right\}. \end{align} The risk of the Hessian-pruned model satisfies the following in the limit of $n,p,s\rightarrow\infty$ at rates $\kappa:=p/n>1$ and $\alpha:=s/p\in(0,1)$ (cf. Assumption \ref{ass:linear}): \begin{align}\label{eq:hessian_risk} {\cal{L}}({\boldsymbol{\hat{\beta}}}^H_s) \stackrel{{P}}{\longrightarrow} \sigma^2 + \operatorname{\mathbb{E}}\left[ \left(\Lambda^{1/2}B-\mathcal{T}_{t^\diamond}(\Lambda^{1/2}X_{\kappa,\sigma^2})\right)^2 \right], \end{align} where the expectation is over $(\Lambda,B,H)\sim\mu\otimes\mathcal{N}(0,1)$. In our LGP experiments, we used this formula \eqref{eq:hessian_risk} to accurately predict the Hessian-based pruning performance. Recall the definition of the hard-thresholding operator $\mathcal{T}_t(x)$. Similar to Section \ref{sec:risk}, we consider a threshold-based pruning vector $${\boldsymbol{\hat{\beta}}}^{\mathcal{T},H}_{t} := \hat\boldsymbol{\Sigma}^{-1/2}\mathcal{T}_{t/\sqrt{p}}(\hat\boldsymbol{\Sigma}^{1/2}\hat{\boldsymbol{\beta}}),$$ where $\mathcal{T}_t$ acts component-wise. Further define $${\boldsymbol{\hat{\beta}}}^{\mathcal{T},H^\star}_{t} := \boldsymbol{\Sigma}^{-1/2}\mathcal{T}_{t/\sqrt{p}}(\boldsymbol{\Sigma}^{1/2}\hat{\boldsymbol{\beta}}).$$ Note that ${\boldsymbol{\hat{\beta}}}^{\mathcal{T},H^\star}_{t}$ uses the true (diagonal) covariance matrix $\boldsymbol{\Sigma}$ instead of its sample estimate $\hat\boldsymbol{\Sigma}$. For later reference, note here that $\hat\boldsymbol{\Sigma}$ concentrates (entry-wise) to $\boldsymbol{\Sigma}$. Using boundedness of $\boldsymbol{\Sigma}$ and standard concentration of sub-exponential random variables. First, we compute the limiting risk of ${\boldsymbol{\hat{\beta}}}^{\mathcal{T},H^\star}_{t}$. Then, we will use the fact that $\hat\boldsymbol{\Sigma}$ concentrates (entry-wise) to $\boldsymbol{\Sigma}$, to show that the risks of ${\boldsymbol{\hat{\beta}}}^{\mathcal{T},H^\star}_{t}$ and ${\boldsymbol{\hat{\beta}}}^{\mathcal{T},H}_{t}$ are arbitrarily close as $p\rightarrow\infty$. Similar to \eqref{eq:loss_w2}, \begin{align} {\cal{L}}({\boldsymbol{\hat{\beta}}}^{\mathcal{T},H^\star}_t) &= \sigma^2 + ({\boldsymbol{\beta}}^\star-{\boldsymbol{\hat{\beta}}}^{\mathcal{T},H^\star}_t)^T\boldsymbol{\Sigma}({\boldsymbol{\beta}}^\star-{\boldsymbol{\hat{\beta}}}^{\mathcal{T},H^\star}_t) \notag \\ &= \sigma^2 + \frac{1}{p}\sum_{i=1}^p\boldsymbol{\Sigma}_{i,i}\big(\sqrt{p}\betab^\star_i-\bSi_{i,i}^{-1/2}\mathcal{T}_{t}(\bSi_{i,i}^{1/2}\sqrt{p}\hat\boldsymbol{\beta}_i)\big)^2 \notag = \sigma^2 + \frac{1}{p}\sum_{i=1}^p\big(\bSi_{i,i}^{1/2}\sqrt{p}\betab^\star_i-\mathcal{T}_{t}(\bSi_{i,i}^{1/2}\sqrt{p}\hat\boldsymbol{\beta}_i)\big)^2 \\ &= \sigma^2 + \frac{1}{p}\sum_{i=1}^p\big(\bSi_{i,i}^{1/2}\sqrt{p}\betab^\star_i-\mathcal{T}_{t}(\widehat{\vct{w}}_i + \bSi_{i,i}^{1/2}\sqrt{p}\betab^\star_i\big)^2 \notag \\ &=: \sigma^2 + \frac{1}{p}\sum_{i=1}^p\big(\sqrt{p}\bla^\st_i-\mathcal{T}_{t}(\widehat{\vct{w}}_i + \bla^\st_i)\big)^2.\label{eq:hesa} \end{align} In the second line above, we used that $\sqrt{p}\mathcal{T}_{t/\sqrt{p}}(x)=\mathcal{T}_{t}(\sqrt{p}x)$. In the third line, we recalled the change of variable in \eqref{eq:w}, i.e., $\widehat{\vct{w}}$ is the solution to \eqref{eq:PO}. Finally, in the last line we defined $\bla^\st:=\sqrt{\boldsymbol{\Sigma}}\betab^\star$ (note that this is related to the saliency score $\boldsymbol{\lambda}$ defined in \eqref{saliency eq}). To evaluate the limit of the empirical average in \eqref{eq:hesa}, we proceed as follows. First, we claim that the empirical distribution of $\sqrt{p}\bla^\st$ converges weakly to the distribution of the random variable $B\sqrt{\Lambda}$, where $(\Lambda,B)\sim\mu$. \so{Note that this convergence is already implied by the proof of Theorem \ref{thm:master_W2} by setting the $g$ function to be zero in \eqref{eq:fdef}.} For an explicit proof, take any bounded Lipschitz test function $\psi:\mathbb{R}\rightarrow\mathbb{R}$ and call $\psi'(x,y):=\psi({\sqrt{x}}y)$. Then, \begin{align} |\psi'(\bSi_{i,i},\sqrt{p}\betab^\star_i)-\psi'(\bSi_{i,i}',\sqrt{p}{\betab^\star_i}')| &= |\psi(\sqrt{\bSi_{i,i}}\sqrt{p}\betab^\star_i)-\psi(\sqrt{\bSi_{i,i}'}\sqrt{p}{\betab^\star_i}')| \leq C |\sqrt{\bSi_{i,i}}\sqrt{p}\betab^\star_i - \sqrt{\bSi_{i,i}'}\sqrt{p}{\betab^\star_i}'| \notag \\ &\leq C |\sqrt{p}\betab^\star_i - \sqrt{p}{\betab^\star_i}'| + C'|\sqrt{p}{\betab^\star_i}'| |\sqrt{\bSi_{i,i}}- \sqrt{\bSi_{i,i}'}|\notag \\ &\leq C (|\sqrt{p}\betab^\star_i - \sqrt{p}{\betab^\star_i}'| + |\sqrt{p}{\betab^\star_i}'| |{\bSi_{i,i}}- {\bSi_{i,i}'}|)\notag \\ &\leq C (1 + \|[\sqrt{p}\betab^\star_i,\bSi_{i,i}]\|_2 +\|[\sqrt{p}{\betab^\star_i}',\bSi_{i,i}']\|_2 ) \sqrt{|\sqrt{p}\betab^\star_i - \sqrt{p}{\betab^\star_i}'|^2 + |{\bSi_{i,i}}- {\bSi_{i,i}'}|^2}\notag. \end{align} Thus, $\psi'$ is $\rm{PL(2)}$. Hence, from Assumption \ref{ass:mu}, \begin{align} \frac{1}{p}\sum_{i=1}^p \psi(\sqrt{p}\bla^\st_i) = \frac{1}{p}\sum_{i=1}^p \psi'(\bSi_{i,i},\sqrt{p}\betab^\star_i) \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}[\psi'(B,\sqrt{\Lambda})] = \operatorname{\mathbb{E}}[\psi(B\sqrt{\Lambda})]\label{eq:convvvv} \end{align} Besides, from Theorem \ref{thm:master_W2} applied for $f_{\cal{L}}(x,y,z)=zy^2$ (i.e., set $g$ the zero function in \eqref{eq:fdef}), we have that $$ \frac{1}{p}\sum_{i=1}^p \sqrt{p}(\bla^\st_i)^2 \stackrel{{P}}{\longrightarrow} \operatorname{\mathbb{E}}[B^2\Lambda]. $$ Therefore, convergence in \eqref{eq:convvvv} actually holds for any $\psi\in\rm{PL}(2)$. Next, observe that, $\boldsymbol{\omega}$ of \eqref{eq:w_n} can be written in terms of $\bla^\st$ via \begin{align}\label{eq:w_n2} \vct{w}_n=\vct{w}'(\tau_n,u_n)& = -\left({\mtx{I}}+\frac{u_n}{\tau_n}\boldsymbol{\Sigma}\right)^{-1}\left(\boldsymbol{\Sigma}^{1/2}\betab^\star-u_n\sqrt{\kappa}\boldsymbol{\Sigma}\bar{\h}\right)\\ &=-\left({\mtx{I}}+\frac{u_n}{\tau_n}\boldsymbol{\Sigma}\right)^{-1}\left(\bla^\st-u_n\sqrt{\kappa}\boldsymbol{\Sigma}\bar{\h}\right). \end{align} After this observation, the convergence proof can be finalized by using a modified version of Assumption \ref{ass:mu} as follows { \begin{assumption}[Empirical distribution for saliency] \label{ass:lambda} Set $\bla^\st_i=\sqrt{\bSi_{i,i}}\boldsymbol{\beta}^\star_i$. The joint empirical distribution of $\{(\bSi_{i,i},\bla^\st_i)\}_{i\in[p]}$ converges in {Wasserstein-k} distance to a probability distribution $\mu=\mu(\Lambda,S)$ on $\mathbb{R}_{>0}\times\mathbb{R}$ for some \fx{$k\geq 4$}. That is $ \frac{1}{p}\sum_{i\in[p]}\delta_{(\bSi_{i,i},\sqrt{p}\bla^\st_i)} \stackrel{W_k}{\Longrightarrow} \mu. $ \end{assumption} } Under this assumption, it can be verified that, the exact same proof strategy we used for magnitude-based pruning would apply to Hessian-based pruning by replacing $\boldsymbol{\beta}^\star$ with $\bla^\st$. The reason is that the Hessian pruning risk is a $\text{PL}(4)$ function of $\vct{h},\bla^\st,{\boldsymbol{{\Sigma}}}$ (e.g.~can be shown in a similar fashion to Lemma \ref{lem:hPL}). Observe that Assumption \ref{ass:lambda} is a reasonable assumption given the naturalness of the saliency score. If we only wish to use the earlier Assumption \ref{ass:mu} rather than Assumption \ref{ass:lambda}, one can obtain the equivalent result by modifying \ref{ass:mu} to enforce a slightly higher order bounded moment and convergence condition. Finally, one needs to address the perturbation due to the finite sample estimation of the covariance. Note that, even if the empirical covariance doesn't converge to the population, its diagonal weakly converges to the population (as we assumed the population is diagonal). The (asymptotically vanishing) deviation due to the finite sample affects can be addressed in an identical fashion to the deviation analysis of $\tau_n,u_n$ at \eqref{eq:ivstep1} and \eqref{eq:betav}. While these arguments are reasonably straightforward and our Hessian pruning formula accurately predicts the empirical performance, the fully formal proof of the Hessian-based pruning is rather lengthy to write and does not provide additional insights. \cmt{ if one assumes Assumption \ref{ass:mu} with the The overall function $f(\bla^\st_i,$ becomes \[ h(x,y,z)=f(g(y,z,x),y,z)=y(x-g(z))^2 \]} \section{Problem Setup}\label{sec:setup} Let us fix the notation. Let $[p]=\{1,2,\dots,p\}$. Given ${\boldsymbol{\beta}}\in \mathbb{R}^p$, let $\mathbb{T}_s({\boldsymbol{\beta}})$ be the pruning operator that sets the smallest $p-s$ entries in absolute value of ${\boldsymbol{\beta}}$ to zero. Let ${\mathcal{I}}({\boldsymbol{\beta}})\subset[p]$ return the index of the nonzero entries of ${\boldsymbol{\beta}}$. ${\mtx{I}}_n$ denotes the $n\times n$ identity matrix and $\mathcal{N}({\boldsymbol{{\mu}}},{\boldsymbol{{\Sigma}}})$ denotes the normal distribution with mean ${\boldsymbol{{\mu}}}$ and covariance ${\boldsymbol{{\Sigma}}}$. ${\mtx{X}}^\dagger$ denotes the pseudoinverse of matrix ${\mtx{X}}$. \vspace{3pt} \noindent \textbf{Data:} Let $(\vct{a}_i,y_i)_{i=1}^n\subset \mathbb{R}^d\times \mathbb{R}$ with i.i.d.~input-label pairs. Let $\phi(\cdot):\mathbb{R}^d\rightarrow\mathbb{R}^p$ be a (nonlinear) feature map. We generate $\vct{x}_i=\phi(\vct{a}_i)$ and work with the dataset $\mathcal{S}=(\vct{x}_i,y_i)_{i=1}^n$ coming i.i.d. from some distribution $\mathcal{D}$. As an example, of special interest to the rest of the paper, consider random feature regression, where $\vct{x}_i=\psi({\mtx{R}}\vct{a}_i)$ for a nonlinear activation function $\psi$ that acts entry-wise and a random matrix ${\mtx{R}}\in \mathbb{R}^{p\times d}$ with i.i.d.~$\mathcal{N}(0,1)$ entries; see Fig.~\ref{figRF}. In matrix notation, we let $\vct{y}=[y_1~\dots~y_n]^T\in\mathbb{R}^n$ and ${\mtx{X}}=[\vct{x}_1~\dots~\vct{x}_n]^T\in\mathbb{R}^{n\times p}$ denote the vector of labels and the feature matrix, respectively. Throughout, we focus on regression tasks, in which the training and the test risks of a model ${\boldsymbol{\beta}}$ are defined a \begin{align} &\text{Population risk:}~~~{\cal{L}}({\boldsymbol{\beta}})=\operatorname{\mathbb{E}}_{\mathcal{D}}[(y-\vct{x}^T{\boldsymbol{\beta}})^2].\label{test formula}\\ &\text{Empirical risk:}~~~~{\hat{\cal{L}}}({\boldsymbol{\beta}})=\frac{1}{n}\tn{\vct{y}-{\mtx{X}}{\boldsymbol{\beta}}}^2.\label{erm} \end{align} \cmt{Let $\phi(\cdot):\mathbb{R}^d\rightarrow \mathbb{R}^k$ be a nonlinear map for feature extraction. $\phi$ will be important for random feature analysis.} During training, we will solve the empirical risk minimization (ERM) problem over a set of selected features $\Delta\subset[p]$, from which we obtain the least-squares solution \begin{align} \label{eq:ERM} {\boldsymbol{\hat{\beta}}}(\Delta)=\arg\min_{{\boldsymbol{\beta}}\,:\,{\mathcal{I}}({\boldsymbol{\beta}})=\Delta} {\hat{\cal{L}}}({\boldsymbol{\beta}}). \end{align} For example, regular ERM corresponds to $\Delta=[p]$, and we simply use ${\boldsymbol{\hat{\beta}}}={\boldsymbol{\hat{\beta}}}([p])$ to denote its solution above. Let ${\boldsymbol{{\Sigma}}}=\operatorname{\mathbb{E}}[\vct{x}\x^T]$ be the covariance matrix and $\vct{b}=\operatorname{\mathbb{E}}[y\vct{x}]$ be the cross-covariance. The parameter minimizing the test error is given by ${\boldsymbol{\beta}}^\star={\boldsymbol{{\Sigma}}}^{-1}\vct{b}$. We are interested in training a model over the training set $\mathcal{S}$ that not only achieves small test error, but also, it is sparse. We do this as follows. First, we run stochastic gradient descent (SGD) to minimize the empirical risk (starting from zero initialization). It is common knowledge that SGD on least-squares converges to the minimum $\ell_2$ norm solution given by ${\boldsymbol{\hat{\beta}}}={\mtx{X}}^\dagger \vct{y}$. Next, we describe our pruning strategies to compress the model. \vspace{3pt} \noindent \textbf{Pruning strategies:} Given dataset $\mathcal{S}$ and target sparsity level $s$, a pruning function $P$ takes a model ${\boldsymbol{\beta}}$ as input and outputs an $s$-sparse model ${\boldsymbol{\beta}}^P_s$. Two popular pruning functions are magnitude-based (MP) and Hessian-based (HP) (a.k.a.~optimal brain damage) pruning \cite{lecun1990optimal}. The latter uses a diagonal approximation of the covariance via $\hat{{\boldsymbol{{\Sigma}}}}=\text{diag}({\mtx{X}}^T{\mtx{X}})/n$ to capture \emph{saliency} (see \eqref{saliency eq}). Formally, we have the following definitions: \begin{itemize} \item {\em{Magnitude-based pruning:}} ${\boldsymbol{\beta}}^M_s=\mathbb{T}_s({\boldsymbol{\beta}})$. \item {\em{Hessian-based pruning:}} ${\boldsymbol{\beta}}^H_s=\hat{{\boldsymbol{{\Sigma}}}}^{-1/2}\mathbb{T}_s(\hat{{\boldsymbol{{\Sigma}}}}^{1/2}{\boldsymbol{\beta}})$. \item {\em{Oracle pruning:}} Let $\Delta^\star\subset[p]$ be the optimal $s$ indices so that ${\boldsymbol{\hat{\beta}}}(\Delta^\star)$ achieves the minimum population risk (in expectation over $\mathcal{S}$) among all ${\boldsymbol{\hat{\beta}}}(\Delta)$ and any subset $\Delta$ in \eqref{eq:ERM}. When ${\boldsymbol{{\Sigma}}}$ is diagonal and $s<n$, using rather classical results, it can be shown that (see Lemma 7 in the Supplementary Material (SM)) these {\em{oracle indices}} are the ones with the top-$s$ saliency score given by \begin{align} \text{Saliency score}={\boldsymbol{{\Sigma}}}_{i,i}{{\boldsymbol{\beta}}^\star_i}^2.\label{saliency eq} \end{align} Oracle pruning {employs these latent saliency scores and} returns ${\boldsymbol{\beta}}^O_s$ by pruning the weights of ${\boldsymbol{\beta}}$ outside of $\Delta^\star$. \end{itemize} We remark that our distributional characterization might allow us to study more complex pruning strategies, such as optimal brain surgeon \cite{hassibi1994optimal}. However, we restrict our attention to the three aforementioned core strategies to keep the discussion focused. \noindent\textbf{Pruning algorithm:} To shed light on contemporary pruning practices, we will study the following three-stage {\em{train$\rightarrow$prune$\rightarrow$retrain}} algorithms. \begin{enumerate} \item Find the empirical risk minimizer ${\boldsymbol{\hat{\beta}}}={\mtx{X}}^\dagger \vct{y}$. \item Prune ${\boldsymbol{\hat{\beta}}}$ with strategy $P$ to obtain ${\boldsymbol{\hat{\beta}}}^P_s$. \item {\em{Retraining:}} Obtain ${\boldsymbol{\hat{\beta}}}^{RT}_s={\boldsymbol{\hat{\beta}}}({\mathcal{I}}({\boldsymbol{\hat{\beta}}}^P_s))$. \end{enumerate} The last step obtains a new $s$-sparse model by solving ERM in \eqref{eq:ERM} with the features $\Delta={\mathcal{I}}({\boldsymbol{\hat{\beta}}}^P_s)$ identified by pruning. Figures \ref{figNN} and \ref{figRF} illustrate the performance of this procedure for ResNet-20~on the CIFAR-10 dataset and for a random feature regression on a synthetic problem, respectively . Our analytic formulas for RF, as seen in Fig.~\ref{figRF}, very closely match the empirical observations (see Sec.~\ref{sec mot}~for further explanations). Interestingly, the arguably simpler RF model already captures key behaviors (double-descent, better performance in the overparameterized regime, performance of sparse model comparable to large model) in ResNet. \cmt{I think it is nice to add a sentence here pointing out the similarities between Fig. 1 and 2. In particular noting that the arguably simpler RF model already captures key behavior (double-descent, better performance in deep overparameterized regime, performance of sparse model comparable to large model) in ResNet. And then say: we have analytic formulas for the latter which as seen in Fig. 1 very closely match the empirical observations.} \cmt{We remark that this does not necessarily hold in general (see~supplementary material (SM)).} \cmt{The next section provides our results on distributional characterization of ${\boldsymbol{\hat{\beta}}}$ and provable guarantees on ${\boldsymbol{\hat{\beta}}}^P_s$. We will then explore when and how retraining stage is critical for the pruning performance.} Sections \ref{sec mot} and \ref{sec intu} present numerical experiments on pruning that verify our analytical predictions, as well as, our insights on the fundamental principles behind the roles of overparameterization and retraining. Sec \ref{sec main} establishes our theory on the DC of ${\boldsymbol{\hat{\beta}}}$ and provable guarantees on pruning. All proofs are deferred to the Supplementary Material (SM) \section{Further Experiments and Intuitions}\label{SM mot} \subsection{Further discussion and experiments on CIFAR-10} \label{ssec:SMCF} First, we provide further discussion on Figure \ref{figNN}. Recall that, in this figure, we apply \emph{train$\rightarrow$prune$\rightarrow$retrain} to obtain the sparse neural networks. The test error and the training errors for the sparse models are evaluated at the end of the retraining phase. Thus, it is rather surprising that sparse models manage to achieve zero training error around the same width parameter $k$ as the dense model because while parameter count of the dense model increases in $k$, it is fixed for sparse models. Secondly, we complement Figure \ref{figNN} with two additional experiments. The first experiment assesses the benefit of pruning compared to using a random nonzero pattern with the same sparsity. The second experiment assesses the benefit of retraining by comparing the curves in Fig \ref{figNN} with the test errors obtained without retraining. These two experiments are shown in Figure \ref{figCFa} and \ref{figCFb} and all of them are trained over same dataset and configured as given in Section \ref{ssec:NNE}. Instead of applying magnitude-based pruning, dotted red and green lines in Fig \ref{figCFa} are sparse models over $5$ or $10$ sparsity targets, pruned randomly to achieve same number of nonzeros as magnitude-based pruning strategy. Although the double descent phenomenon and downward trend are still present on the dotted lines, the performance is worse than magnitude-base pruning method. Fig. \ref{figCFb} shows how retraining benefits pruning ResNet-20 models. The results agree with our intuition that the non-retrained (dotted) lines achieve much bigger test error than retrained (solid) lines and overparameterization does not help in improving performance. \subsection{MNIST Experiments with two layers} In Figure \ref{figMNIST} we train the simplest neural model with only 2 fully-connected layers over MNIST with various number of nodes to explore properties of magnitude-based pruning, random pruning and non-retraining on simple neural networks. Here, the number of nodes is equivalent to the width of the model, which directly controls the model size. Same as in Section \ref{ssec:NNE}, we select an $s$-width model as base model and prune trained dense models to the same sparsity. All experiments are trained with Adam optimization, $0.001$ learning rate and $200$ epochs under MNIST. Solid red, green and blue lines in Figure \ref{figMNIST} correspond to test error of $4$-, $8$-sparsity targets and dense models. In Figure \ref{figMNISTa} dotted lines are training errors of dense and $s$-sparse models. As the width $k$ grows, the training and test error decrease for all dense and sparse models. The behavior is similar to Figure \ref{figNN} and training larger models benefit pruned-model accuracy however double descent is not really visible. We suspect that this may be because of the simpler nature of the MNIST dataset and LeNet architecture compared to the CIFAR10 dataset and ResNet-20 model. In Figure \ref{figMNISTb}, dotted lines apply randomly pruning. Different to magnitude pruning, where training bigger models and then pruning results in better performance, randomly pruning hurts when the sparsity level $s/k$ is relatively low. This is because under magnitude-based pruning, we can identity most of optimal entries of weights from trained dense model and retraining with these entries achieves lower errors. In constrast, random pruning learns nothing from the trained model and as the sparsity level decreases, the probability that random operator selects the limited optimal entries by chance also decreases, leading to worse performance. Dotted lines in Figure \ref{figMNISTc} show test errors of sparse models before retraining which educes the same conclusion in Section \ref{ssec:SMCF}, that is retraining is crucial to improve the performance in neural networks. \subsection{Experiments on LGP} In Figure \ref{figSM1}, we carry out the identical experiments as in Figure \ref{fig1}. The difference is that we display two more figures which are the retraining curves for Magnitude- and Hessian-based pruning strategies shown in purple and yellow lines respectively. Figure \ref{figSM1a} is the counterpart of Figure \ref{fig1a} and Figure \ref{figSM1b} is the counterpart of Figure \ref{fig1b}. The main message in these experiments is that \emph{retraining hurts the performance}. This performance degradation is more emphasized in the overparameterized regime. Specifically, both retrained versions of Magnitude and Hessian pruning ${\boldsymbol{\hat{\beta}}}^{RT,M}$ and ${\boldsymbol{\hat{\beta}}}^{RT,H}$ perform consistently worse compared to their pruning-only counterparts ${\boldsymbol{\hat{\beta}}}^{M}$ and ${\boldsymbol{\hat{\beta}}}^{H}$. Observe that, the only regime where retraining outperforms the pruning-only approach is at the peak of double descent. This is the region where pruning-only risk diverges to infinity whereas retraining attains finite risk. This is because the retraining stage solves a well-conditioned problem and avoids the ill-conditioning occurring at $n=k$. Recall that, in light of Lemma \ref{lem rank one}, unlike the rank-one covariance case, retraining hurts because covariance is diagonal; thus, features are uncorrelated and do not have overlapping predictions. \begin{figure}[t!] \centering \begin{subfigure}{3.5in}\vspace{-5pt} \centering \begin{tikzpicture} \node at (0,0) {\includegraphics[scale=0.33]{figs/FLAT_SIM_RT_s10_n30_p100_SCL25}}; \node at (-3.5,0) [rotate=90,scale=.9]{Test Risk}; \node at (0,-2.8) [scale=.9]{Problem Size ($k/p$)} \end{tikzpicture}\caption{\small{Identity covariance, spiked latent weights.}}\label{figSM1a}\vspace{-0.2cm} \end{subfigure}~~~~~\begin{subfigure}{3.5in}\vspace{-5pt} \centering \begin{tikzpicture} \node at (0,0) {\includegraphics[scale=0.33]{figs/SPIKE_SIM_RT_s10_n30_p100_SCL25}}; \node at (-3.5,0) [rotate=90,scale=.9]{Test Risk}; \node at (0,-2.8) [scale=.9]{Problem Size ($k/p$)} \end{tikzpicture}\caption{\small{Spiked covariance, identical latent weights.}}\label{figSM1b}\vspace{-0.2cm} \end{subfigure}\caption{\small{Same as Figure \ref{fig1} however retraining curves are included. Our asymptotic prediction for various pruning strategies in linear gaussian models with $s/p=0.1$ and $n/p=0.3$. We solve ERM using the first $k$ features and then prune to obtain an $s$-sparse model. The vertical dashed line shows the $k=s$ point. The horizontal dashed line highlights the minimum risk among all underparameterized solutions including retraining. Retraining curves are not displayed.}}\label{figSM1}\vspace{-15pt} \end{figure} \section*{Acknowledgments} S. Oymak is partially supported by the NSF award CNS-1932254. C. Thrampoulidis is partially supported by the NSF under Grant Numbers CCF-2009030. \section*{Potential Ethical Impacts} While deep learning is transformative in wide swath of applications, it comes at a cost: State-of-the-art deep learning models tend to be very large and consume significant energy during inference. The race for larger and better models and growing list of applications exacerbates this carbon footprint problem. Thus there is an urgent need for better and more principled model compression methods to help build environmentally friendly ML models. This work responds to this need by establishing the fundamental algorithmic principles and guarantees behind the contemporary model compression algorithms and by shedding light on the design of lightweight energy- and compute-efficient neural networks. We do not see an ethical concern associated with this work. \cmt{\subsection{Random Features}} \section{Main Results}\label{doubdec} \input{overdetermined} \input{overparam} \subsection{Distributional Control via CGMT} \begin{lemma} [AO solution to PO solution] \label{dist cont lem}Let ${\mtx{X}}\in\mathbb{R}^{n\times p},{\vct{g}}\in\mathbb{R}^n,\vct{h}\in\mathbb{R}^p\overset{\text{i.i.d.}}{\sim}\mathcal{N}(0,1)$. Suppose we have two loss functions ${\cal{L}}_{PO}(\vct{w};{\mtx{X}})$ and ${\cal{L}}_{AO}(\vct{w};{\vct{g}},\vct{h})$ as a function of $\vct{w}$\footnote{${\cal{L}}(\vct{w},\vct{a})$ can account for additional set constraints of type $\vct{w}\in\mathcal{C}$ by adding the indicator penalty $\max_{\lambda\geq 0}\lambda 1_{\vct{w}\not\in\mathcal{C}}$.}. Given a set $\mathcal{S}$, define the objectives \[ \Phi_{\mathcal{S}}({\mtx{X}})=\min_{\vct{w}\in\mathcal{S}}{\cal{L}}_{PO}(\vct{w},\vct{a})\quad\text{and}\quad\phi_{\mathcal{S}}({\vct{g}},\vct{h})=\min_{\vct{w}\in\mathcal{S}}{\cal{L}}_{AO}(\vct{w},\vct{b}). \] Suppose $\Phi$ and $\phi$ satisfies the following conditions for any closed set $\mathcal{S}$ and $t$ \begin{itemize} \item $\mathbb{P}(\Phi_{\mathcal{S}}({\mtx{X}}) < t)\leq2\mathbb{P}(\phi_{\mathcal{S}}({\vct{g}},\vct{h})\leq t)$. \item Furthermore, if $\mathcal{S}$ is convex, $\mathbb{P}(\Phi_{\mathcal{S}}({\mtx{X}}) > t)\leq2\mathbb{P}(\phi_{\mathcal{S}}({\vct{g}},\vct{h})\geq t)$ \end{itemize} Define the set of global minima $\mathcal{M}=\{\vct{w}{~\big |~} {\cal{L}}(\vct{w};{\mtx{X}})=\Phi({\mtx{X}})\}$. For any closed set $\mathcal{S}$, we have that \begin{align} \mathbb{P}(\mathcal{M}\in\mathcal{S}^c)\geq 1-2\min_{t}(\mathbb{P}(\phi_{\mathbb{R}^p}({\vct{g}},\vct{h})\geq t)+\mathbb{P}(\phi_{\mathcal{S}}({\vct{g}},\vct{h})\leq t)).\label{min inside} \end{align} \end{lemma} \begin{proof} Let $\vct{w}^*\in\mathcal{M}$. Suppose the events $\Phi_{\mathbb{R}^p}({\vct{g}},\vct{h})\leq t$ and $\Phi_{\mathcal{S}}({\vct{g}},\vct{h})> t$ hold. These two imply that $\vct{w}^*\not\in\mathcal{S}$ hence $\mathcal{M}\subseteq\mathcal{S}^c$. To proceed, for any choice of $t$ \begin{align} \mathbb{P}(\mathcal{M}\in\mathcal{S}^c)&\geq \mathbb{P}(\{\Phi_{\mathbb{R}^p}({\vct{g}},\vct{h})\leq t\}\cap \{\Phi_{\mathcal{S}}({\vct{g}},\vct{h})> t\})\\ &\geq 1-\mathbb{P}(\Phi_{\mathbb{R}^p}({\vct{g}},\vct{h})> t)-\mathbb{P}(\Phi_{\mathcal{S}}({\vct{g}},\vct{h})\leq t)\\ &\geq 1-\mathbb{P}(\Phi_{\mathbb{R}^p}({\vct{g}},\vct{h})> t)-\lim_{t'\rightarrow t^+}\mathbb{P}(\Phi_{\mathcal{S}}({\vct{g}},\vct{h})<t')\\ &\geq 1-2\mathbb{P}(\phi_{\mathbb{R}^p}({\vct{g}},\vct{h})\geq t)-2\lim_{t'\rightarrow t^+}\mathbb{P}(\phi_{\mathcal{S}}({\vct{g}},\vct{h})\leq t'). \end{align} Since this holds for all $t$ and cumulative distribution function is continuous, we get the advertised bound \eqref{min inside}. \end{proof} \newpage \section{Useful results about pseudo-Lipschitz functions and CGMT}\label{SM useful fact} For $k\geq 1$ we say a function $f:\mathbb{R}^m\rightarrow\mathbb{R}$ is pseudo-Lipschitz of order $k$ and denote it by $f\in \rm{PL}(k)$ if there exists a constant $L>0$ such that, for all $\vct{x},\vct{y}\in\mathbb{R}^m$: \begin{align} |f(\vct{x})-f(\vct{y})|\leq L\left(1+\|\vct{x}\|_2^{k-1}+\|\vct{y}\|_2^{k-1}\right)\|\vct{x}-\vct{y}\|_2.\label{PL func} \end{align} In particular, when $f\in\rm{PL}(k)$, the following properties hold; see \cite{bayati2011dynamics}: \begin{enumerate} \item There exists a constant $L'$ such that for all $\vct{x}\in\mathbb{R}^n$: $|f(\vct{x})|\leq L'(1+\|\vct{x}\|_2^k).$ \item $f$ is locally Lipschitz, that is for any $M>0$, there exists a constant $L_{M,m}<\infty$ such that for all $x,y\in[-M,M]^m$, $ |f(\vct{x})-f(\vct{y})| \leq L_{M,m}\|\vct{x}-\vct{y}\|_2. $ Further, $L_{M,m}\leq c(1+(M\sqrt{m})^{k-1})$ for some costant $c$. \end{enumerate} Using the above properties, we prove the following two technical lemmas used in the proof of Theorem \ref{thm:master_W2} \begin{lemma}\label{lem:fL} Let $g:\mathbb{R}\rightarrow\mathbb{R}$ be a Lipschitz function. Consider the function $f:\mathbb{R}^3\rightarrow\mathbb{R}$ defined as follows: $$ f(\vct{x}) = x_3(x_2-g(x_1))^2. $$ Then, $f\in\rm{PL}(3)$. If additionally, $f:\mathbb{R}^2\times {\cal{Z}}\rightarrow\mathbb{R}$ for a bounded set ${\cal{Z}}\subset\mathbb{R}$, then $f\in{\cal{F}}\subset\rm{PL}(3)$. Specifically, setting ${\cal{Z}}=[\Sigma_{\min},\Sigma_{\max}]$ (as per Assumption \ref{ass:mu}), we find that ${\cal{F}}_{\cal{L}}\subset{\cal{F}}$, where ${\cal{F}}_{\cal{L}}$ is defined in \eqref{eq:fdef}. \end{lemma} \begin{proof} We first prove that $f\in\rm{PL}(3)$. Let $h:\mathbb{R}^2\rightarrow\mathbb{R}$ defined as $h({\vct{u}})=({\vct{u}}_2-g({\vct{u}}_1))^2$. The function $({\vct{u}}_1,{\vct{u}}_2)\mapsto{\vct{u}}_2-g({\vct{u}}_1)$ is clearly Lipschitz. Thus, $h\in\rm{PL}(2)$, i.e., \begin{align} |h({\vct{u}})-h(\vct{v})| \leq C(1+\|{\vct{u}}\|_2+\|\vct{v}\|_2)\|{\vct{u}}-\vct{v}\|_2\quad\text{and}\quad |h(\vct{v})|\leq C'(1+\|\vct{v}\|_2^2).\label{eq:h_pl} \end{align} Therefore, letting $\vct{x}=({\vct{u}},x_3)\in\mathbb{R}^3$ and $\vct{y}=(\vct{v},y_3)\in\mathbb{R}^3$, we have that \begin{align} |f(\vct{x})-f(\vct{y})| &= |x_3h({\vct{u}}) - y_3h(\vct{v})| \leq |x_3||h({\vct{u}})-h(\vct{v})| + |h(\vct{v})| |x_3-y_3|\notag\\ &\leq C|x_3|(1+\|{\vct{u}}\|_2+\|\vct{v}\|_2)\|{\vct{u}}-\vct{v}\|_2 + C'(1+\|\vct{v}\|_2^2)|x_3-y_3| \notag\\ &\leq C(|x_3|^2+(1+\|{\vct{u}}\|_2+\|\vct{v}\|_2)^2)\|{\vct{u}}-\vct{v}\|_2 + C'(1+\|\vct{v}\|_2^2)|x_3-y_3| \notag\\ &\leq C(1+\|\vct{x}\|_2^2+\|\vct{y}\|_2^2)\|{\vct{u}}-\vct{v}\|_2 + C'(1+\|\vct{x}\|_2^2+\|\vct{y}\|_2^2)|x_3-y_3| \notag\\ &\leq C(1+\|\vct{x}\|_2^2+\|\vct{y}\|_2^2)\|\vct{x}-\vct{y}\|_2. \end{align} In the second line, we used \eqref{eq:h_pl}. In the third line, we used $2xy\leq x^2+y^2$. In the fourth line, we used Cauchy-Schwarz inequality. $C,C'>0$ are absolute constants that may change from line to line. \fy{Now, we shall prove that $f\in{\cal{F}}$. To accomplish this, we simply need to show that for all $z\in {\cal{Z}}$, $f(\cdot,\cdot,z)$ is $\rm{PL}(2)$ (for some uniform PL constant). This can be shown as follows. Let $C=\sup_{z\in{\cal{Z}}}|z|$. Then \begin{align} |f(x,y,z) - f(x',y',z)| &=|z(y-g(x))^2-z(y'-g(x'))^2|\\ &\leq C|(y-g(x))^2-(y'-g(x'))^2|\\ &\leq C(1+\tn{{\vct{u}}}+\tn{\vct{v}})\tn{{\vct{u}}-\vct{v}}, \end{align} where ${\vct{u}}=[x,y]$ and $\vct{v}=[x',y']$. In the second line above, we used boundedness of ${\cal{Z}}$. In the third line, we used the fact that the function $\psi(x,y) = (y-g(x))^2$ is $\rm{PL}(2)$ as it is a quadratic of a Lipschitz function. } This completes the proof of the lemma. \end{proof} { \begin{lemma}[PL with Bounded Variables]\label{lem:PLbdd Let $f:\mathbb{R}^{d_1}\rightarrow \mathbb{R}$ be a $PL(k)$ function, $\mathcal{M}\subset \mathbb{R}^{d_2}$ be a compact set and $g$ be a continuously differentiable function over $\mathcal{M}$. Then $h(\vct{x},\vct{y})=f(\vct{x})g(\vct{y})$ is $PL(k+1)$ over $\mathbb{R}^{d_1}\times \mathcal{M}$. \end{lemma} \begin{proof} First observe that $g$ has continuous derivatives and is continuous over a compact set. Thus $g$ and its gradient are bounded and $g$ is Lipschitz over $\mathcal{M}$. Let $B=\sup_{\vct{x}\in \mathcal{M}}\max |g(x)|,\tn{\nabla g(\vct{x})}$. To proceed, given pairs $(\vct{x},\vct{y})$ and $(\vct{x}',\vct{y}')$ over $\mathbb{R}\times \mathcal{M}$, we have that \begin{align} |h(\vct{x},\vct{y})-h(\vct{x}',y')|&\leq |h(\vct{x},\vct{y})-h(\vct{x}',\vct{y})|+ |h(\vct{x}',\vct{y})-h(\vct{x}',\vct{y}')|\\ &\leq |f(\vct{x})-f(\vct{x}')||g(\vct{y})|+ |f(\vct{x}')||g(\vct{y})-g(\vct{y}')|\\ &\leq B|f(\vct{x})-f(\vct{x}')|+ B\tn{\vct{y}-\vct{y}'}|f(\vct{x}')|\\ &\leq B(1+\tn{\vct{x}'}^{k-1}+\tn{\vct{x}}^{k-1})\tn{\vct{x}-\vct{x}'}+ B\tn{\vct{y}-\vct{y}'}(1+\tn{\vct{x}'}^k)\\ &\leq C (1+\tn{{\vct{z}}}^k+\tn{{\vct{z}}'}^{k})\tn{{\vct{z}}-{\vct{z}}'}, \end{align} where ${\vct{z}}=[\vct{x}~\vct{y}]^T$ and $C$ an absolute constant. This shows the desired $\text{PL}(k+1)$ guarantee. \end{proof} The following lemma is in similar spirit to Lemma \ref{lem:PLbdd} and essentially follows from similar lines of arguments (i.e.~using Lipschitzness induced by boundedness). } \begin{lemma}\label{lem:hPL} Let functions $f,g:\mathbb{R}^3\rightarrow\mathbb{R}$ such that $f\in\rm{PL}(k)$ and $$ g(x,y,z) := \frac{y^{-1/2}}{1+(\xi_* y)^{-1}}\sqrt{\kappa}\tau_* z + (1-(1+\xi_*y)^{-1})x. $$ Here, $\xi_*,\tau_*,\kappa$ are positive constants. Further define \begin{align} h(x,y,z) := f\left(g(y,z,x),y,z\right), \end{align} and assume that $y$ take values on a fixed bounded compact set $\mathcal{M}{\subset\mathbb{R}^+}$. Then, it holds that $h\in\rm{PL}(k+1)$. \end{lemma} \begin{proof} Since $f$ is $\rm{PL}(k)$, for some $L>0$, \eqref{PL func} holds. Fix $x,x'\in\mathbb{R}$, $\vct{a}=[y,z]\in\mathbb{R}^{2}$ and $\vct{a}'=[y',z']\in\mathbb{R}^{2}$. Let $\vct{b}=[{\vct{g}},\vct{a}]=[{\vct{g}},y,z]\in\mathbb{R}^3$ where ${\vct{g}}=g(y,z,x)\in\mathbb{R}$ and define accordingly $\vct{b}'=[{\vct{g}}',\vct{a}']$ and ${\vct{g}}'=g(y',z',x')$. We have that \begin{align} |h([x,\vct{a}])-h([x',\vct{a}'])|&= |f(\vct{b})-f(\vct{b}')|\notag\\ &\leq L\left(1+\|\vct{b}\|_2^{k-1}+\|\vct{b}'\|_2^{k-1}\right)\|\vct{b}-\vct{b}'\|_2\notag\\ &\leq C\left(1+\|\vct{a}\|_2^{k-1}+\|\vct{a}'\|_2^{k-1}+|{\vct{g}}|^{k-1}+|{\vct{g}}'|^{k-1}\right)(\|\vct{a}-\vct{a}'\|_2+|{\vct{g}}-{\vct{g}}'|),\label{eq:hlip} \end{align} for some constant $C>0$. In the last inequality we have repeatedly used the inequality $ \left(\sum_{i=1}^m \|\vct{v}_i\|_2^2\right)^{\frac{d}{2}} \leq C(m)\cdot\sum_{i=1}^m\|\vct{v}_i\|_2^{d}. $ Next, we need to bound the ${\vct{g}}$ term in terms of $(x,\vct{a})$. This is accomplished as follows \begin{align} |{\vct{g}}|^{k-1} &= \left|\frac{y^{-1/2}}{1+(\xi y)^{-1}}\sqrt{\kappa}\tau_* z + (1-(1+\xi_*y)^{-1})x\right|^{k-1}\notag\\ &\leq C (|z|+|x|)^{k-1} \notag\\ &\leq C \left(|x|^{k-1}+|z|^{k-1}\right) \leq C (|x|^{k-1} + \|\vct{a}\|_2^{k-1}).\label{eq:gb} \end{align} Here, the value of the constant $C>0$ may change from line to line. Secondly and similarly, we have the following perturbation bound on the ${\vct{g}}-{\vct{g}}'$. Recall that $y,y'\subset \mathcal{M}$ are bounded. Additionally, since $\mathcal{M}\subset\mathbb{R}^+$ and is compact, $\mathcal{M}$ is strictly bounded away from $0$. Let \[ g_1(y)=\sqrt{\kappa}\tau_*\frac{y^{-1/2}}{1+(\xi_* y)^{-1}}\quad\text{and}\quad g_2(y)=1-(1+\xi_*y)^{-1}. \] It can be seen that $g_1,g_2$ are continuously differentiable functions over $\mathcal{M}$. Thus $g_1,g_2$ are bounded and have bounded derivatives over $\mathcal{M}$. We will prove the following sequence of inequalities \begin{align} |{{\vct{g}}-{\vct{g}}'}|&= |g(y,z,x)-g(y',z',x')| \notag\\ &\leq \left|g_1(y) x - g_1(y') x'\right| + \left|g_2(y)z-g_2(y')z'\right|\notag\\ &\leq \left|g_1(y) x - g_1(y) x'\right| +\left|g_1(y) x'- g_1(y') x'\right|\notag\\ &\qquad+ \left|g_2(y)z-g_2(y)z'\right| + \left|g_2(y)z'-g_2(y')z'\right| \notag\\ &\leq C_1|x-x'| + C_2|x'||y-y'| + C_3|z-z'| + C_4|z'||y-y'|\notag\\ &\leq C(1+|x'| + |z'|)(|x-x'| + |z-z'| + |y-y'|)\\ &\leq C\sqrt{3}(1+|x'| + |z'|)\|[\vct{a},x]-[\vct{a}',x']\|_2 .\label{eq:gd} \end{align} In the fourth inequality above, we used the fact that $|g_i(y)|,|g_i'(y)|$ are bounded. In the last line, we used Cauchy-Scwhartz. Substituting \eqref{eq:gb} and \eqref{eq:gd} in \eqref{eq:hlip} gives: \begin{align} |h(x,y,z) - h(x',y',z')| &\leq C\left(1+\|\vct{a}\|_2^{k-1}+\|\vct{a}'\|_2^{k-1}+|x|^{k-1}+|x'|^{k-1}\right)(1+|x'| + |z'|)\|[\vct{a},x]-[\vct{a}',x']\|_2\notag \\ &\leq C\left(1+\|[\vct{a},x]\|_2^{k}+\|[\vct{a}',x']\|_2^{k}\right)\|[\vct{a},x]-[\vct{a}',x']\|_2. \end{align} Thus, $h\in\rm{PL}(k+1)$, as desired. \end{proof}
{'timestamp': '2020-12-17T02:09:34', 'yymm': '2012', 'arxiv_id': '2012.08749', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08749'}
arxiv
\section{Introduction} \vspace{-8pt} Over the recent eight years, deep generative models have demonstrated stunning performance in generating photorealistic images, considerably boosted by the revolutionary technique of generative adversarial networks (GANs)~\citep{gan14nips,radford2015dcgan,gulrajani2017wgan,miyato2018spectral,brock2018BigGAN,karras2017ProGAN,karras2019StyleGAN,karras2019StyleGAN2}. However, with the closing margins between real and fake, a flood of strong concerns arise~\citep{harris2018deepfakes,chesney2019deepfakes,brundage2018malicious}: how if these models are misused to spoof sensors, generate deep fakes, and enable misinformation at scale? Not only human beings have difficulties in distinguishing deep fakes, but dedicated research efforts on deep fake detection~\citep{durall2019unmasking,zhang2019detecting,frank2020dct2d_detect,zhang2020not} and attribution~\citep{marra2019gans,ning2019iccv_gan_detection,wang2020cnn} are also unable to sustain longer against the evolution of generative models. For example, researchers delve into details on how deep fake detection works, and learn to improve generation that better fits the detection criteria~\citep{zhang2020not,margret2020upconvolution}. In principle, any successful detector can play an auxiliary role in augmenting the discriminator in the next iteration of GAN techniques, and consequently results in an even stronger generator. The dark side of deep generative models delays its industrialization process. For example, when commercializing the GPT-2~\citep{radford2019language} and GPT-3~\citep{brown2020language} models, OpenAI leans conservative to open-source their models but rather only release the black-box APIs\footnote{\url{https://openai.com/blog/openai-api/}}. They involve expensive human labor in the loop to review user downloads and monitor the usage of their APIs. Yet still, it is a challenging and industry-wide task on how to trace the responsibility of the downstream use cases in an open end. \begin{wrapfigure}[13]{R}{0.6\textwidth} \centering \includegraphics[width=\linewidth]{teaser.pdf} \vspace{-8pt} \caption{The diagram of our fingerprinting mechanism for generators. See main text for descriptions. \label{fig:teaser} \vspace{-16pt} \end{wrapfigure} To pioneer in this task, we propose a model fingerprinting mechanism that enables responsible release and regulation of generative models. In particular, we allow responsible model inventors to fingerprint their generators and disclose their responsibilities. As a result, the generated samples contain fingerprints that can be accurately detected and attributed to their sources. This is achieved by an efficient and scalable ad-hoc generation of a large population of generator instances with distinct fingerprints. See Figure~\ref{fig:teaser} Middle. Similar in the spirit of the dynamic filter networks~\citep{jia2016dynamic} and style-based generator architectures~\citep{karras2019StyleGAN,karras2019StyleGAN2} where their network filters are not freely learned but conditioned on an input, we learn to parameterize a unique fingerprint into the filters of each generator instance. The core gist is to incorporate a fingerprint auto-encoder into a GAN framework while preserving the original generation performance. See Figure~\ref{fig:teaser} Left. In particular, given a GAN backbone, we use the fingerprint embedding from the encoder to modulate each convolutional filter of the generator (Figure~\ref{fig:modulation}), and try to decode this fingerprint from the generated images. We jointly train the fingerprint auto-encoder and GAN with our fingerprint related losses and the original adversarial loss. See Figure~\ref{fig:pipeline} for the diagram, and~\ref{sec:loss_design} for details. After training, the responsible model inventor is capable of efficiently fingerprinting and releasing different generator instances to different user downloads, which are equipped with the same generation performance but with different fingerprints. \ning{Each user download corresponds to a unique fingerprint, which is maintained by the inventor's database.} As a result, when misuse of a model happens, the model inventor can use the decoder to detect the fingerprint from the generated images, \ning{match it in the database,} and then trace the responsibility of the user. See Figure~\ref{fig:teaser} Right. Based on this form of responsible disclosure, responsible model inventors, like OpenAI, have a way to mitigate adverse side effects on society when releasing their powerful models, while at the same time should have an automatic way to attribute misuses. There are several key properties of our mechanism. The \textbf{efficiency} to instantiate a generator is inherently satisfied because, after training, the fingerprint encoding and filter modulation run with little overhead. We evaluate the \textbf{effectiveness} of our fingerprinting and obtain almost perfect fingerprint detection accuracy. We also justify the \textbf{fidelity} with a negligible side effect on the original generation quality. See Section~\ref{sec:effectiveness_fidelity}. Our recommended operation point uses a 128-bit fingerprint (Section~\ref{sec:capacity}) which in principle results in a \textbf{capacity} of more than $10^{38}$ identifiable generator instances. The \textbf{scalability} benefits from the fact that fingerprints are randomly sampled on the fly during training so that fingerprint detection generalizes well for the entire fingerprint space. See Section~\ref{sec:scalability} for validation. In addition, we validate in Section~\ref{sec:secrecy} the \textbf{secrecy} of presence and value of our fingerprints against shadow model attacks. We validate in Section~\ref{sec:robustness_immunizability} the \textbf{robustness} and \textbf{immunizability} against perturbation on generated images. To target the initial motivation, we move the deep fake detection and attribution solutions from \textit{passive} detectors to \textit{proactive} fingerprinting. We show in Section~\ref{sec:detection_attribution} saturated performance and advantages over two state-of-the-art discriminative methods~\citep{ning2019iccv_gan_detection,wang2020cnn} especially in the open world. This is because, conditioned on user-specific fingerprint inputs, the presence of such fingerprints in generated images guarantees the margin between real and fake, and facilitates the attribution and responsibility tracing of deep fakes to their sources. Our \textbf{contributions} are in four thrusts: (1) We \revise{enhance} the concept of fingerprinting for generative models that enables a responsible disclosure of state-of-the-art GAN models. (2) We pioneer in the novel direction for efficient and scalable GAN fingerprinting mechanism, i.e., only one generic GAN model is trained while more than $10^{38}$ fingerprinted generator instances can be obtained with little overhead during deployment. (3) We also justify several key properties of our fingerprinting, including effectiveness, fidelity, large capacity, scalability, secrecy, robustness, and immunizability. (4) Finally, for the deep fake detection and attribution tasks, we move the solution from \textit{passive} classifiers to \textit{proactive} fingerprinting, and validate its saturated performance and advantages. It makes our responsible disclosure independent of the evolution of GAN techniques. \vspace{-8pt} \section{Related work} \vspace{-8pt} \textbf{Deep fake detection and attribution.} These tasks come along with the increasing concerns on deep fake misuse~\citep{harris2018deepfakes,chesney2019deepfakes,brundage2018malicious}. Deep fake detection is a binary classification problem to distinguish fake samples from real ones, while attribution further traces their sources. The findings of visually imperceptible but machine-distinguishable patterns in GAN-generated images make these tasks viable by noise pattern matching~\citep{marra2019gans}, deep classifiers~\citep{afchar2018mesonet,hsu2018learning,ning2019iccv_gan_detection}, or deep Recurrent Neural Networks~\citep{guera2018deepfake}. \citep{zhang2019detecting,durall2019unmasking,margret2020upconvolution,liu2020texture_fake} observe that mismatches between real and fake in frequency domain or in texture representation can facilitate deep fake detection. \revise{\citep{wang2020cnn,girish2021towards} follow up with generalization across different GAN techniques towards open world. Beyond attribution, \citep{albright2019source,asnani2021reverse} even reverse the engineering to predict in the hyper-parameter space of potential generator sources.} However, \ning{these \textit{passive} detection methods heavily rely on the inherent clues in deep fakes. Therefore, they can barely sustain a long time against the adversarial iterations of GAN techniques.} For example, \citep{margret2020upconvolution} improves generation realism by closing the gap in generated high-frequency components. To handle this situation, artificial fingerprinting is proposed in~\citep{yu2021artificial} to \textit{proactively} embed clues into generative models by rooting fingerprints into training data. This makes deep fake detection independent of GAN evolution. Yet, \ning{as \textit{indirect} fingerprinting}, \citep{yu2021artificial} cannot scale up to a large number of fingerprints because they have to pre-process training data for each individual fingerprint and re-train a generator with each fingerprint. Our method is similar in spirit to~\citep{yu2021artificial}, but possesses fundamental advantages \ning{by \textit{directly} and \textit{efficiently} fingerprinting generative models}: after training one generic fingerprinting model, we can instantiate a large number of generators ad-hoc with different fingerprints. \textbf{Image steganography and watermarking.} \revise{Steganography targets to manipulate carrier images in a hidden manner such that the communication through the images can only be understood by the sender and the intended recipient~\citep{fridrich2009steganography}. Traditional methods rely on Fourier transform~\citep{cox2002digital,cayre2005watermarking}, JPEG compression\footnote{\url{http://www.outguess.org/}}\footnote{\url{http://steghide.sourceforge.net}}, or least significant bits modification~\citep{pevny2010using,holub2014universal}. Recent works utilize deep neural encoder and decoder to hide information~\citep{baluja2017hiding,tancik2019stegastamp,luo2020distortion}. Watermarking targets to embed ownership information into carrier images such that the owner's identity and authenticity can be verified. It belongs to a form of steganography that sometimes interacts with physical images~\citep{tancik2019stegastamp}. Existing methods rely on log-polar frequency domain~\citep{pereira2000robust,kang2010efficient}, printer-camera transform~\citep{solanki2006print,pramila2018increasing}, or display-camera transform~\citep{yuan2013spatially,fang2018screen}. Recent works also use deep neural networks to detect when an image has been re-imaged~\citep{fan2018rebroadcast,tancik2019stegastamp}. The concept and function of our fingerprinting solution is similar in spirit of watermarking, but differs fundamentally.} In particular, we did not retouch individual images. Rather, our solution is the first to retouch generator parameters so as to encode information into the model. \textbf{Network watermarking.} Network watermarking techniques~\citep{uchida2017embedding,adi2018turning,zhang2018protecting,chen2019deepmarks,rouhani2019deepsigns,ong2021protecting,yu2021artificial} embed watermarks into network parameters rather than pixels while not deteriorating the original utility. Our solution shares motivations with them but substantially differs in terms of concepts, motivations, and techniques. For concepts, most existing works are applicable to only image classification models, \revise{only~\citep{ong2021protecting,yu2021artificial} work for generative models but suffer from poor efficiency and scalability.} For motivations, the existing works target to fingerprint a single model, while we are motivated by the limitation of~\citep{ong2021protecting,yu2021artificial} to scale up the fingerprinting to as many as $10^{38}$ various generator instances within one-time training. For techniques, most existing works embed fingerprints in the input-output behaviors~\citep{adi2018turning,zhang2018protecting,ong2021protecting}, while \revise{our solution gets rid of such trigger input for improved scalability.} \vspace{-8pt} \section{GAN fingerprinting networks} \vspace{-8pt} \label{sec:loss_design} Throughout the paper, we stand for the responsible model inventor’s perspective, which is regarded as the regulation hub of our experiments. None of the encoder, decoder, and training data should be accessible to the public. Only fingerprinted generator instances are released to the open end. We list symbol notations at the beginning. We use latent code ${\bm{z}}\sim\mathcal{N}(\mathbf{0},\mathbf{I}^{d_z})$ to control generated contents. We set $d_z=512$. We represent fingerprint ${\bm{c}}\sim\text{Ber}(0.5)^{d_c}$ as a sequence of bits. It follows Bernoulli distribution with probability $0.5$. We non-trivially choose the fingerprint length $d_c$ in Section~\ref{sec:capacity}. We denote encoder $E$ mapping ${\bm{c}}$ to its embedding, generator $G$ mapping $({\bm{z}},E({\bm{c}}))$ to the image domain, discriminator $D$ mapping an image ${\bm{x}}\sim p_\text{data}$ to the real/fake classification probability, and decoder $F$ mapping an image to the decoded latent code and fingerprint $(\widehat{{\bm{z}}},\widehat{{\bm{c}}})$. In the following formulations, we denote $G({\bm{z}}, E({\bm{c}}))$ as $G ({\bm{z}},{\bm{c}})$ for brevity. \vspace{-8pt} \subsection{Pipeline} \vspace{-8pt} We consider three goals in our training. First, we preserve the original functionality of GANs to generate realistic images, as close to real distribution as possible. We use the unsaturated logistic loss as in~\citep{gan14nips,karras2019StyleGAN,karras2019StyleGAN2} for real/fake binary classification: \begin{equation} {\mathcal{L}}_\textit{adv} = \underset{{\bm{x}}\sim p_\text{data}}{\mathbb{E}} \log D({\bm{x}})+ \underset{\substack{{\bm{z}}\sim\mathcal{N}(\mathbf{0},\mathbf{I}^{d_z})\\{\bm{c}}\sim\text{Ber}(0.5)^{d_c}}}{\mathbb{E}} \log \Big(1-D\big(G({\bm{z}},{\bm{c}})\big)\Big) \label{eq:Ladv} \end{equation} In addition, similar to~\citep{srivastava2017veegan}, we reconstruct the latent code through the decoder $F$ to augment generation diversity and mitigate the mode collapse issue of GANs~\citep{srivastava2017veegan,li2018implicit,yu2020inclusive}. \begin{equation} {\mathcal{L}}_\textit{z}= \underset{\substack{{\bm{z}}\sim\mathcal{N}(\mathbf{0},\mathbf{I}^{d_z})\\{\bm{c}}\sim\text{Ber}(0.5)^{d_c}}}{\mathbb{E}} \sum_{k=1}^{d_z} \Big(z_k - F\big( G({\bm{z}},{\bm{c}}) \big)_k \Big)^2 \label{eq:Lz} \end{equation} where we use the first $d_z$ output elements of $F$ that correspond to the decoded latent code. \begin{figure} \centering \subfigure[Pipeline.]{ \includegraphics[width=0.45\columnwidth]{method.pdf} \label{fig:pipeline} } \centering \subfigure[Modulated convolutional layer.]{ \includegraphics[width=0.45\columnwidth]{modulate.pdf} \label{fig:modulation}} \vspace{-8pt} \caption{The diagrams of our fingerprinting pipeline and the modulated convolutional layer.} \vspace{-8pt} \end{figure} The second goal is to reconstruct the fingerprint so as to allow fingerprint detection. \begin{equation} {\mathcal{L}}_\textit{c} = \underset{\substack{{\bm{z}}\sim\mathcal{N}(\mathbf{0},\mathbf{I}^{d_z})\\{\bm{c}}\sim\text{Ber}(0.5)^{d_c}}}{\mathbb{E}} \sum_{k=1}^{d_c} \Big[c_k \log\sigma\Big(F\big(G({\bm{z}}, {\bm{c}})\big)_{d_z+k}\Big) +(1-c_k) \log\Big(1-\sigma\Big(F\big(G({\bm{z}}, {\bm{c}})\big)_{d_z+k}\Big)\Big)\Big] \label{eq:Lc} \end{equation} where we use the last $d_c$ output elements of $F$ as the decoded fingerprint. $\sigma(\cdot)$ denotes the sigmoid function that differentiably clips the output to the range of $[0,1]$. The reconstruction is therefore a combination of cross-entropy binary classification for each bit. It is worth noting that we use one decoder to decode both the latent code and fingerprint, which benefits explicit \textbf{disentanglement} between their representations as discussed below. The third goal is to disentangle the representation between latent code and fingerprint. Desirably, latent code should have exclusive control over the generated content. This sticks to the original generation functionality. Therefore, two images with different fingerprints but with identical latent code should have a consistent appearance. We formulate the consistency loss as: \begin{align} \label{eq:Lconst} {\mathcal{L}}_\textit{const} = \underset{\substack{{\bm{z}}\sim\mathcal{N}(\mathbf{0},\mathbf{I}^{d_z})\\{\bm{c}}_1,{\bm{c}}_2\sim\text{Ber}(0.5)^{d_c}}}{\mathbb{E}} \Vert G({\bm{z}},{\bm{c}}_1) -G({\bm{z}},{\bm{c}}_2)\Vert_2^2 \end{align} The disentangled effect is demonstrated in Figure~\ref{fig:samples} and Appendix Figure~\ref{fig:more_samples}. Our final training objective is as follows. We optimize it under the adversarial training framework w.r.t. $E$, $G$, $F$, and $D$. \begin{align} \min_{E,F,G} \max_D \lambda_1 {\mathcal{L}}_\textit{adv} + \lambda_2 {\mathcal{L}}_z + \lambda_3 {\mathcal{L}}_c + \lambda_4 {\mathcal{L}}_\textit{const} \label{eq:final_loss} \end{align} where $\lambda_1 = 1.0$, $\lambda_2 = 1.0$, $\lambda_3 = 2.0$, and $\lambda_4 = 2.0$ are hyper-parameters to balance the magnitude of each loss term, \revise{Each loss contributes to a property of our solution. The weight settings are empirically not sensitive within its magnitude level.} See Figure~\ref{fig:pipeline} for the diagram. \vspace{-8pt} \subsection{Fingerprint modulation} \vspace{-8pt} At the architectural level, it is non-trivial how to embed $E({\bm{c}})$ into $G$. The gist is to embed fingerprints into the generator parameters rather than generator input, so that after training a generic model we can instantiate a large population of generators with different fingerprints. This is critical to make our fingerprinting efficient and scalable, as validated in Section~\ref{sec:scalability}. We then deploy only the fingerprinted generator instances to user downloads, not including the encoder. We achieve this by modulating convolutional filters in the generator backbone with our fingerprint embedding, similar in spirit of~\citep{karras2019StyleGAN2}. Given a convolutional kernel $\mathbf{W}\in\mathbb{R}^{3 \times 3 \times d_l}$ at layer $l$, we first project the fingerprint embedding $E({\bm{c}})$ through an affine transformation $\phi_l$ such that $\phi_l(E({\bm{c}}))\in\mathbb{R}^{d_l}$. The transformation is implemented as a fully-connect neural layer with learnable parameters. We then scale each channel of $\mathbf{W}$ with the corresponding value in $\phi_l$. In specific, \begin{equation} \widetilde{\mathbf{W}}_{i,j,k} = \phi_l\big(E({\bm{c}})\big)_k \cdot \mathbf{W}_{i,j,k},\;\;\forall i,j,k \label{eq:modulation} \end{equation} See Figure~\ref{fig:modulation} for a diagram illustration. We compare to the other fingerprint embedding architectures in Section~\ref{sec:effectiveness_fidelity} and validate the advantages of this one. We conduct modulation for all the convolutional filters at layer $l$ with the same fingerprint embedding. And we investigate in Appendix Section~\ref{sec:ablation} at which layer to modulate we can achieve the optimal performance. A desirable trade-off is to modulate all convolutional layers. Note that, during training, latent code ${\bm{z}}$ and fingerprint ${\bm{c}}$ are jointly sampled. Yet for deployment, the model inventor first samples a fingerprint ${\bm{c}}_0$, then modulates the generator $G$ with ${\bm{c}}_0$, and then deploys only the modulated generator $G(\cdot,{\bm{c}}_0)$ to a user. For that user there allows only one input, i.e. the latent code, to the modulated generator. Once a misuse happens, the inventor uses the decoder to decode the fingerprint and attribute it to the user, so as to achieve responsible disclosure. \vspace{-8pt} \section{Experiments} \vspace{-8pt} \textbf{Datasets}. We conduct experiments on CelebA face dataset~\citep{liu2015faceattributes}, LSUN Bedroom and Cat datasets~\citep{yu2015lsun}. \ning{LSUN Cat is the most challenging one reported in StyleGAN2~\citep{karras2019StyleGAN2}}. We train/evaluate on 30k/30k CelebA, 30k/30k LSUN Bedroom at the size of 128$\times$128, \ning{and 50k/50k LSUN Cat at the size of 256$\times$256}. \textbf{GAN backbone}. We build upon the most recent state-of-the-art StyleGAN2~\citep{karras2019StyleGAN2} config E. \ning{This aligns to the settings in~\citep{yu2021artificial} and facilitates our direct comparisons.} See Appendix for the implementation details. \vspace{-8pt} \subsection{Effectiveness and fidelity} \vspace{-8pt} \label{sec:effectiveness_fidelity} \textbf{Evaluation.} The effectiveness indicates that the input fingerprints consistently appear in the generated images and can be accurately detected by the decoder. This is measured by fingerprint detection bitwise accuracy over 30k random samples (with random latent codes and random fingerprint codes). We use 128 bits to represent a fingerprint. This is a non-trivial setting as analyzed in Section~\ref{sec:capacity}. \ning{In addition, bit matching may happen by chance. Following~\citep{yu2021artificial}, we perform a null hypothesis test to evaluate the chance, the lower the more desirable. Given the number of matching bits $k$ between the decoded fingerprint and its encoded ground truth, the null hypothesis $H_0$ is getting this number of matching bits by chance. It is calculated as $Pr(X>k|H_0) = \sum_{i=k}^{d_c} \binom{d_c}{i} 0.5^{d_c}$, according to the binomial probability distribution with $d_c$ trials, where $d_c$ is the fingerprint bit length. $p$-value should be lower than 0.05 to reject the null hypothesis.} The fidelity reflects how imperceptibly the original generation is affected by fingerprinting. It also helps avoid one's suspect of the presence of fingerprints which may attract adversarial fingerprint removal. We report Fr\'{e}chet Inception Distance~(FID)~\citep{heusel2017gans} between 30k generated images and 30k real testing images. A lower value indicates the generated images are more realistic. \textbf{Baselines.} We compare seven baseline methods. The first baseline is the StyleGAN2~\citep{karras2019StyleGAN2} backbone. It provides the upper bound of fidelity while has no fingerprinting functionality. The second baseline is~\citep{yu2021artificial} which is the other proactive but \textit{indirect} fingerprinting method for GANs. Another two baselines, outguess\footnote{\url{http://www.outguess.org/}} and steghide\footnote{\url{http://steghide.sourceforge.net}}, are similar to \citep{yu2021artificial}. They just replace the deep image fingerprinting auto-encoder in \citep{yu2021artificial} with traditional JPEG-compression-based image watermarking techniques, and still suffer from low efficiency/scalability. We also compare our mechanism to three architectural variants. The motivation of these variants is to incorporate fingerprints in different manners. Variant I: modulating convolutional filters with only latent code embedding, while instead feeding the fingerprint code through the input of the generator. \ning{This is to test the necessity of fingerprint modulation.} Variant II: modulating filters twice, with latent code embedding and fingerprint code embedding separately. Variant III: modulating filters with the embedding from the concatenation of latent code and fingerprint code. \begin{table} \begin{center} \small \resizebox{\linewidth}{!}{ \begin{tabular}{l|ccc|ccc|ccc}\toprule & \multicolumn{3}{c|}{CelebA} & \multicolumn{3}{c|}{LSUN Bedroom} & \multicolumn{3}{c}{LSUN Cat}\\ Method & Bit acc $\Uparrow$ & $p$-value $\Downarrow$ & FID $\Downarrow$ & Bit acc $\Uparrow$ & $p$-value $\Downarrow$ & FID $\Downarrow$ & Bit acc $\Uparrow$ & $p$-value $\Downarrow$ & FID $\Downarrow$\\ \midrule StyleGAN2 & - & - & 9.37 & - & - & 19.24 & - & - & 31.01\\ outguess & 0.533 & 0.268 & 10.02 & 0.526 & 0.329 & 20.15 & 0.523 & 0.329 & 32.30\\ steghide & 0.535 & 0.268 & 9.48 & 0.530 & 0.268 & 19.77 & 0.541 & 0.213 & 31.67\\ \citep{yu2021artificial} & 0.989 & $<10^{-36}$ & 14.13 & 0.983 & $<10^{-34}$ & 21.31 & 0.990 & $<10^{-36}$ & 32.60\\ \midrule Ours & 0.991 & $<10^{-36}$ & 11.50 & 0.993 & $<10^{-36}$ & 20.50 & 0.996 & $<10^{-36}$ & 33.94\\ Ours Variant I & 0.999 & $<10^{-38}$ & 12.98 & 0.999 & $<10^{-38}$ & 20.68 & 0.500 & 0.535 & 34.23\\ Ours Variant II & 0.987 & $<10^{-36}$ & 13.86 & 0.927 & $<10^{-25}$ & 21.70 & 0.869 & $<10^{-17}$ & 34.33\\ Ours Variant III & 0.990 & $<10^{-36}$ & 22.59 & 0.896 & $<10^{-21}$ & 64.91 & 0.901 & $<10^{-23}$ & 51.74\\ \bottomrule \end{tabular}} \end{center} \vspace{-8pt} \caption{Fingerprint detection in bitwise accuracy with $p$-value to accept the null hypothesis test, and generation fidelity in FID. $\Uparrow$/$\Downarrow$ indicates a higher/lower value is more desirable. \revise{The baseline results are directly copied from \citep{yu2021artificial}.}} \label{tab:effectiveness_fidelity} \vspace{-8pt} \end{table} \begin{wrapfigure}[20]{R}{0.3\textwidth} \centering \vspace{-8pt} \includegraphics[width=0.3\columnwidth]{samples_celeba.png} \vspace{-8pt} \captionsetup{width=0.3\textwidth} \captionof{figure}{Fidelity and disentangled control on CelebA: generated samples from five generator instances. For each row, we use a unique fingerprint to instantiate a generator. For each column, we feed in the same latent code to the generator instances. More samples are in Appendix Figure~\ref{fig:more_samples}.} \vspace{-8pt} \label{fig:samples} \end{wrapfigure} \textbf{Results.} From Table~\ref{tab:effectiveness_fidelity}, we find that: (1) The two traditional image watermarking methods, outguess and steghide, fail to deliver fingerprints in generated images, indicated by the random guess ($\sim 0.5$) detection accuracy. We attribute this to the representation gap between deep generative models and shallow watermarking techniques. (2) On CelebA, all the other methods achieve almost perfect fingerprint detection accuracy with $p$-value close to zero. \ning{This is because CelebA is a landmark-aligned dataset with limited diversity. Fingerprinting synergizes well with generation regardless of model configuration.} (3) On LSUN Bedroom and Cat, only \citep{yu2021artificial} and our optimal model obtain saturated fingerprint detection accuracy. Ours Variant I, II, and III do not always achieve saturated performance. \ning{Especially Ours Variant I fails on LSUN Cat. We reason that filter modulation is a strong formulation for reconstruction. Modulating fingerprints is necessary for their detection while modulating latent code along with fingerprint code distracts fingerprint reconstruction.} (4) Our method has comparable performance to~\citep{yu2021artificial}, plus substantial advantages in practice: \ning{during deployment, we can fingerprint a generator instance in \textbf{5 seconds}, in contrast to \citep{yu2021artificial} that has to retrain a generator instance in \textbf{3-5 days}. This is a $\mathbf{50000\times}$ gain of efficiency.} (5) Our method results in negligible $\leq$2.93 FID degradation. This is a worthy trade-off \revise{to introduce the fingerprinting function}. (6) We show in Figure~\ref{fig:samples} and Appendix Figure~\ref{fig:more_samples} uncurated generated samples from several generator instances. Image qualities are high. Fingerprints are imperceptible. \ning{Thanks to the consistency loss ${\mathcal{L}}_\textit{const}$ in Eq.~\ref{eq:Lconst}, different generator instances can generate identical images given the same latent code. Their fingerprints are clued only in the non-salient background and distinguishable by our decoder.} \vspace{-8pt} \subsection{Capacity} \vspace{-8pt} \label{sec:capacity} The capacity indicates the number of unique fingerprints our mechanism can accommodate without crosstalk between two fingerprints. This is determined by $d_c$, fingerprint bit length, and by our detection accuracy (according to Section~\ref{sec:effectiveness_fidelity}). The choice of fingerprint bit length is however non-trivial. A longer length can accommodate more fingerprints but is more challenging to reconstruct/detect \begin{wrapfigure}[12]{R}{0.3\textwidth} \centering \vspace{-8pt} \includegraphics[width=0.3\textwidth]{collisions_0911.png} \vspace{-20pt} \captionsetup{width=0.3\textwidth} \captionof{figure}{Capacity: fingerprint detection bitwise accuracy and its bottom line requirement w.r.t. fingerprint bit length on CelebA. \vspace{-16pt} \label{fig:capacity} \end{wrapfigure} To figure out the optimal fingerprint bit length, we conduct the following experiments. On one hand, given one length, we evaluate our detection accuracy. On the other hand, we estimate the bottom-line requirement for detection accuracy. This is simulated as the maximal percentage of bit overlap among a large bag (1 million) of fingerprint samples. The gap between the detection accuracy and bottom-line requirement should be the larger the better. In Figure~\ref{fig:capacity}, we vary the fingerprint bit length in the options of $\{32, 64, 128, 256, 512\}$, and plot the bitwise detection accuracy in red and the bottom line requirement in blue. We find: (1) The bottom line requirement is monotonically decreasing w.r.t. the bit length of fingerprint because a larger bit length leads to less heavy fingerprint overlaps. (2) The testing accuracy is also monotonically decreasing w.r.t. the bit length of fingerprints. This is due to the challenge of fingerprint reconstruction/detection. (3) The testing accuracy is empirically decreasing more slowly at the beginning and then faster than its bottom-line requirement. We, therefore, pick the bit length 128 as the optimal choice for the maximal gap. We stick to this for all our experiments. (4) Considering our detection bitwise accuracy $\geq$0.991 and our fingerprint bit length as 128, we derive in principle our mechanism can hold a large capacity of $2^{128\times0.991}\approx10^{38}$ identifiable fingerprints. \vspace{-8pt} \subsection{Scalability} \vspace{-8pt} \label{sec:scalability} \begin{wraptable}[11]{r}{0.45\textwidth} \vspace{-8pt} \small \resizebox{\linewidth}{!}{ \begin{tabular}{lcc}\toprule Fingerprint set size & Training acc $\Uparrow$ & Testing acc $\Uparrow$\\% & FID \\ \midrule 10 & 1.000 & 0.512\\% & $389.10$\\ 100 & 1.000 & 0.537\\% & $13.01$\\ 1k & 1.000 & 0.752\\% & $12.56$\\ 10k & 0.990 & 0.988\\% & $14.20$\\ 100k & 0.983 & 0.981\\% & $17.32$\\ Sampling on the fly & 0.991 & 0.991\\% 11.50\\ \bottomrule \end{tabular}} \vspace{-8pt} \captionof{table}{Scalability: fingerprint detection in bitwise accuracy w.r.t. set size on CelebA. $\Uparrow$ indicates a higher value is more desirable. \vspace{-16pt} \label{tab:scalability} \end{wraptable} Scalability is one of the advantageous properties of our mechanism: during training, we can efficiently instantiate a large capacity of generators with arbitrary fingerprints on the fly, so that fingerprint detection generalizes well during testing. To validate this, we compare to the baselines where we intentionally downgrade our method with access to only a finite set of fingerprints. These baselines stand for the category of non-scalable fingerprinting methods that have to re-train a generator instance for each fingerprint, e.g.~\citep{yu2021artificial}. We cannot directly compare to~\citep{yu2021artificial} because it is impractical (time-consuming) to instantiate a large number of their generators for analysis. \revise{As a workaround, we trained our detector using $\leq$1k real samples to simulate the non-scalable nature of the baseline.} From Table~\ref{tab:scalability} we show that fingerprint detection fails to generalize unless we can instantiate generators with 10k or more fingerprint samples. This indicates the necessity to equip GANs with an efficient and scalable fingerprinting mechanism, preferably the one on the fly \vspace{-8pt} \subsection{Secrecy} \vspace{-8pt} \label{sec:secrecy} \ning{The presence and value of a fingerprint should not be easily spotted by a third party, otherwise it would be potentially removed. In fact, secrecy of our fingerprints is another advantageous property, because our fingerprint encoder, different from image steganography or watermarking, does not directly retouch generated images. As a result, traditional secrecy attack protocols, e.g. Artificial Training Sets (ATS) attack used in~\citep{lerch2016unsupervised,yu2021artificial}, is \textbf{not} applicable.} \ning{Instead, we employ the shadow-model-based attack~\citep{salem2020updates} to try detecting the presence and value of a fingerprint from generated images. We assume the attacker can access the model inventor's training data, fingerprint space, and training mechanism. He re-trains his own shadow fingerprint auto-encoder. For the \textbf{fingerprint presence attack}, on CelebA dataset, the attacker trains a \revise{ResNet-18-based~\citep{he2016deep}} binary classifier to distinguish 10k non-fingerprinted images \revise{(5k real plus 5k generated)} against 10k generated images from his fingerprinted generators. \revise{We find near-saturated 0.981 training accuracy.} Then he applies the classifier to 1k inventor's generated images. As a result, we find only \textbf{0.505} \revise{testing} accuracy on the presence of fingerprints, close to random guess. For the \textbf{fingerprint value attack}, on CelebA dataset, the attacker applies his shadow decoder \revise{(0.991 training bitwise accuracy)} to 1k inventor's generated images. As a result, we find only \textbf{0.513} \revise{testing} bitwise accuracy, also close to random guess. We conclude that the mismatch between different versions of fingerprinting systems disables the attacks, which guarantees its secrecy.} \vspace{-8pt} \subsection{Robustness and immunizability} \vspace{-8pt} \label{sec:robustness_immunizability} Deep fakes in the open end may undergo post-processing environments and result in quality deterioration. Therefore, robustness against image perturbations is equally important to our mechanism. When it does not hold for some perturbations, our immunizability property compensates for it. Following the protocol in~\citep{ning2019iccv_gan_detection}, we evaluate the robustness against five types of image perturbation: cropping and resizing, blurring with Gaussian kernel, JPEG compression, additive Gaussian noise, and random combination of them. We consider two versions of our model: the original version and the immunized version. An immunized model indicates that during training we augment generated images with the corresponding perturbation in random strengths before feeding them to the fingerprint decoder. It is worth noting that none of the encoder, decoder, and training data are accessible to the public. Therefore, the robustness against perturbation has to be experimented with the black-box assumption, as protocoled in~\citep{ning2019iccv_gan_detection}. In other words, white-box perturbations such as adversarial image modifications~\citep{goodfellow2014explaining} and fingerprint overwriting, which requires access to the encoder, decoder, and/or training data, are not applicable in our scenario. \begin{figure*}[b!] \center \vspace{-8pt} \subfigure[]{ \centering \includegraphics[width=0.19\linewidth]{robustness_plot_crop_comparisons.png} \subfigure[]{ \centering \includegraphics[width=0.19\linewidth]{robustness_plot_blur_comparisons.png} \subfigure[]{ \centering \includegraphics[width=0.19\linewidth]{robustness_plot_jpeg_comparisons.png} \subfigure[]{ \centering \includegraphics[width=0.19\linewidth]{robustness_plot_noise_comparisons.png} \subfigure[]{ \centering \includegraphics[width=0.19\linewidth]{robustness_plot_combo_.png} \vspace{-8pt} \caption{Robustness and immunizability: red/blue plots show, on CelebA, the fingerprint detection of our original/immunized model in bitwise accuracy w.r.t. the strength of perturbations. \revise{Green plots show those of~\citep{yu2021artificial} as references. The data points are directly copied from their paper.} \vspace{-8pt} \label{fig:robutstness_immunizability} \end{figure*} We plot in Figure~\ref{fig:robutstness_immunizability} the \revise{comparisons of fingerprint detection accuracy among our original/immunized models and the models of~\citep{yu2021artificial}} w.r.t. the strength of each perturbation. We find: (1) For all the perturbations, fingerprint detection accuracy drops monotonically as we increase the strength of perturbation. For some perturbations in red plots, i.e., blurring and JPEG compression, accuracy drops slowly in a reasonably large range. We consider accepting accuracy $\geq$75\%. As a result, the robust working range under blurring is: Gaussian blur kernel size $\sim[0, 7]$; under JPEG compression is: JPEG quality $\sim[80, 100]$. Usually, the images turn not functional with perturbations heavier than this range. We, therefore, validate the robustness against blurring and JPEG compression. (2) For the other perturbations, although our original model is not robust enough, perturbed augmentation compensates significantly in blue dots. We consider accepting accuracy $\geq$75\%. As a result, the immunized working range under cropping is: cropping size $\sim[60, 128]$; under Gaussian noise is: noise standard deviation $\sim[0.0, 0.4]$; under combined perturbation is: the combination of the original or immunized working ranges aforementioned. We, therefore, validate the immunizability of our model against cropping, Gaussian noise, and the combined perturbation. \revise{(3) Comparing between~\citep{yu2021artificial} and our models, for blurring, their model in green plot is less robust than our original/immunized models. For the other perturbations, theirs are more robust than our original models but are outperformed by our immunized models. This indicates the importance of immunizability of a fingerprinting solution, which is however lacking in~\citep{yu2021artificial}.} \vspace{-8pt} \subsection{Deep fake detection and attribution} \vspace{-8pt} \label{sec:detection_attribution} The effectiveness, robustness, and immunizability in turn benefit our initial motivation: deep fake detection and attribution. The former task is a binary classification problem to distinguish between real and fake. The latter task is to further finely label the source of a generated image. We move the solution from \textit{passive} classifiers to \textit{proactive} fingerprinting, and merge the two tasks into one with 1+$N$ classes: 1 real-world source and $N$ GAN sources, where $N$ can be extremely large, as large as our capacity $10^{38}$ in Section~\ref{sec:capacity}. Then the tasks are converted to verifying if one decoded fingerprint is in our database or not. This is achieved by comparing the decoded fingerprint to each fingerprint in the database given a threshold of bit overlap. According to our $\geq$0.991 fingerprint detection accuracy, it should be reliable to set the threshold at $128\times0.95\approx121$. Then the attribution is trivial because we can directly look up the generator instance according to the fingerprint. If the fingerprint is not in the database, it should be a random fingerprint decoded from a real image. We use our immunized model against the combined perturbations in Section~\ref{sec:robustness_immunizability}. \textbf{Baselines.} We compare to two state-of-the-art deep fake classifiers~\citep{ning2019iccv_gan_detection,wang2020cnn} as learning-based baselines \textit{passively} relying on inherent visual clues. Because a learning-based method can only enumerate a finite set of training labels, we consider two scenarios for it: closed world and open world. The difference is whether the testing GAN sources are seen during training or not. This does not matter to our method because ours can work with any $N\leq10^{38}$. For the closed world, we train/evaluate a baseline classifier on 10k/1k images from each of the $N+1$ sources. For the open world, we train $N+1$ 1-vs-the-other binary classifiers, and predict as "the other" label if and only if all the classifiers predict negative results. We test on 1k images from each of the real sources or $N$ unseen GAN sources. \ning{We in addition refer to~\citep{yu2021artificial} in comparisons as the other \textit{proactive} but \textit{indirect} model fingerprinting baseline.} \begin{wraptable}[9]{R}{0.6\textwidth} \vspace{-20pt} \begin{center} \small \resizebox{\linewidth}{!}{ \begin{tabular}{l|ccc|ccc} \toprule & \multicolumn{3}{c|}{Closed world \#GANs} & \multicolumn{3}{c}{Open world \#GANs} \\ Method & 1 & 10 & 100 & 1 & 10 & 100 \\ \midrule \citep{ning2019iccv_gan_detection} & 0.997 & 0.998 & 0.955 & 0.893 & 0.102 & N/A \\ \citep{wang2020cnn} & 0.890 & N/A & N/A & 0.883 & N/A & N/A \\ \citep{yu2021artificial} & 1.000 & 1.000 & N/A & 1.000 & 1.000 & N/A \\ Ours & 1.000 & 1.000 & 1.000 & 1.000 & 1.000 & 1.000 \\ \bottomrule \end{tabular}} \end{center} \vspace{-8pt} \caption{Deep fake detection and attribution accuracy on CelebA. A higher value is more desirable. \revise{The baseline results are directly copied from \citep{yu2021artificial}.} \label{tab:detection_attribution} \vspace{-8pt} \end{wraptable} \textbf{Results.} From Table~\ref{tab:detection_attribution} we find: (1) Deep fake detection and attribution based on our fingerprints perform equally perfectly ($\sim100\%$ accuracy) \ning{to most of the baselines in the closed world when the number of GAN sources is not too large. However, when $N=100$, \citep{yu2021artificial} is not applicable due to its limited efficiency and scalability. Neither is \citep{wang2020cnn} due to its binary classification nature.} (2) Open world is also a trivial scenario to our method but challenges the baseline classifiers~\citep{ning2019iccv_gan_detection,wang2020cnn}. When the number of unseen GAN sources increases to 10, \citep{ning2019iccv_gan_detection} even degenerates close to random guess. This is a common generalization issue of the learning-based method. \ning{\citep{yu2021artificial} is still impractical when $N$ is large.} (3) Since deep fake detection and attribution is a trivial task to our method, it makes our advantages independent of the evolution of GAN techniques. It benefits model tracking and \revise{pushes forward} the emerging direction of model inventors' responsible disclosure. \vspace{-8pt} \section{Conclusion} \vspace{-8pt} We achieve responsible disclosure of generative models by a novel fingerprinting mechanism. It allows scalable ad-hoc generation of a large population of models with distinct fingerprints. We further validate its saturated performance in the deep fake detection and attribution tasks. \revise{We appeal to the initiatives of our community to maintain responsible release and regulation of generative models. We hope responsible disclosure would serve as one major foundation for AI security.} \vspace{-8pt} \section*{Reproducibility statement} \vspace{-8pt} The authors strive to make this work reproducible. The appendix contains plenty of implementation details. The source code and well-trained models are available at \href{https://github.com/ningyu1991/ScalableGANFingerprints}{GitHub}. \vspace{-8pt} \section*{Ethics statement} \vspace{-8pt} This work does not involve any human subject, nor is our dataset related to any privacy concerns. The authors strictly comply with the ICLR Code of Ethics\footnote{\url{https://iclr.cc/public/CodeOfEthics}}. \vspace{-8pt} \section*{Acknowledgement} \vspace{-8pt} Ning Yu was partially supported by Twitch Research Fellowship. Vladislav Skripniuk was partially supported by IMPRS scholarship from Max Planck Institute. This work was also supported, in part, by the US Defense Advanced Research Projects Agency (DARPA) Media Forensics (MediFor) Program under FA87501620191 and Semantic Forensics (SemaFor) Program under HR001120C0124. Any opinions, findings, conclusions, or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the DARPA. We acknowledge the Maryland Advanced Research Computing Center for providing computing resources. We thank David Jacobs, Matthias Zwicker, Abhinav Shrivastava, and Yaser Yacoob for constructive advice in general.
{'timestamp': '2022-03-21T01:04:35', 'yymm': '2012', 'arxiv_id': '2012.08726', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08726'}
arxiv
\section{Introduction} Deep neural networks (DNNs) have achieved an outstanding performance for various learning tasks such as speech recognition, image classification, and visual object recognition etc.\cite{lecun2015deep}. It is well known that DNNs can apprioximate almost any nonlinear functions and make end-to-end learning possible \cite{mallat2016understanding, RaghuPKGS17}. Most recently, there has been a surge of interest in graph neural networks (GNNs) since they can capture the dependency of graphs by accounting for the message passing between nodes \cite{zhou2018graph, abs-1901-00596}. This appealing feature has renewed interest in answering a variety of fundamental questions involving the interpretation, generalization, model selection, and convergence of GNNs (DNNs) \cite{NovakBAPS18}. When developing innovative GNN techniques, it is imperative to explore the physical and mathematical principles that explain the observed phenomenon, which ultimately provides guidelines for creative designs. There is a rich literature studying the effectiveness of GNNs from various aspects \cite{RaghuPKGS17, DongSZZ17}. \footnote{This field is called the interpretability or expressivity, and here we use the later terminology to encompass all efforts in this area.} For example, Scarselli et al. \cite{Scarselli2009Computational} first showed that GNNs can approximate a large class of functions in probability. Kawamoto et al. \cite{KawamotoTO18} provided a theoretical analysis of GNNs based on mean-field theory for graph partitioning tasks. Lei et al. \cite{lei2017deriving} designed a recurrent neural architecture inspired by graph kernels and discussed its equivalence between Weisfeiler-Lehman kernels. Moreover, Xu et al. \cite{xu2018powerful} proved that the expressivity of GNNs was as powerful as that of the Weisfeler-Lehman graph isomorphism test. These efforts have deepened our understanding of the expressive power of GNNs, however, general guidelines are still largely needed for designing better neural architectures and overcoming issues in the training of neural networks, such as parametric choices (e.g., width and depth), vanishing, and exploding gradient problems. Based on the previous research regarding the expressivity of DNNs \cite{RaghuPKGS17, zhang2019expressivity}, we understand that DNNs use the spatial space that offers an informational representation and evolve toward a critical state (i.e., critical points $\bm{0}$) as the depth increase, corresponding to increasing informational entropy. The main goal of this paper is to further study the optimal topology design on GNNs based on the criticality theorem. The main contributions of this paper can be summarized as follows: \begin{itemize} \item We propose a tree-pipeline training framework involving global skeleton determination (width determination) and local topological link rewiring. \item The weak improvement of current pruning algorithms is examined, in which a rank-constrained or sparsity-constrained regularization imposed on non-convex optimization will prevent the tendency toward the critical state $\bm{0}$. \item The modularity (clustering) phenomenon in network topology is utilized for erroneous weight rewiring in the weight matrix, which in turn verify the modularity phenomenon in GNNs. \end{itemize} \section{Graph Neural Network and Its Critical Representation}\label{sec:GraphNeuralNetworks} The goal of this paper is to explore the representation capabilities of GNNs on graphs. To this end, we consider a vanilla GNN with feedforward dynamics. Suppose the input graphs are characterized by a vertex set of size $V$ and a $D$-dimensional feature vector with elements $X_{iu} (i\in V, u\in \{1,\dots, D\})$, then the state matrix $\bm{X} =[X_{iu}]$ is given by \begin{equation}\label{eq:GNNModel} X_{i u}^{t+1}=\sum_{j v} \phi\left(A_{i j} X_{j v}^{t}W_{v u}^{t}\right) +b_{i u}^{t}, \end{equation} where $\phi(\cdot)$ is a non-linear activation function, $\bm{A}=[A_{ij}]$ is the adjacency matrix of network topology, $\bm{W}^{t}=\left[W_{vu}^{t}\right]$ is a linear transformation of feature space, $\bm{b}^{t}=\left[b_{i u}^{t}\right]$ is a bias term, and the layer is indexed by $t \in \{1,\dots, T\} $. The general idea behind GNNs is that nodes can be recursively aggregated and propagated to the next layer for complex calculations. In this respect, the network structure of neural networks is typically described as graphs in which nodes act as neurons, and each edge links the output of one neuron to the input of another. Graph matching refers to a computational problem of establishing a one-to-one bijective correspondence between the vertex set of graphs. Therefore, graph matching between a pair of graphs is analogous to representing graphs using GNN \cite{LiGDVK19}. In the next, we discuss the dynamics aspects of the graph matching. Based on the Banach Fixed Point Theorem in dynamics, we know that the unique solution of differential equations in (\ref{eq:GNNModel}) can be obtained through an iterative process \begin{equation}\label{eq:RecursionDynamics} {{\bf{X}}^{t + 1}} = \phi(\bm{A}\dots\phi(\bm{A}\phi\left( \bm{A}{{{\bm{X}}^1}{\bm{W}^1}} \right){\bm{W}^2})\dots{\bm{W}^t}). \end{equation} To prevent the system from being chaotic, the eigenvalue of hidden states should satisfy $|\lambda_i(\bm{X}^t)|)<1, i\in {1,\dots,\infty}$. Assume that the weight matrix $\bm{W}^t$ is randomly distributed. Then both forward propagation and backpropagation are the information transfer powered by dynamics from $[\lambda_1(\bm{X}^t),\dots,\lambda_i(\bm{X}^t),\dots]$ toward the critical state, i,e., critical points $\bm{0}$, which has abundant expressivity \cite{zhang2019expressivity}. The results can be generalized to local topological vector spaces via Schauder fixed point theorem \cite{Bonsall1962}. The theorem illustrates that there always exists a fixed point if $X$ is a closed convex subset of local topological space $S$ and $f$ is a continuous self-mapping such that $f(X)$ is contained in a compact subset of $X$. In this respect, training a GNN is to construct an inexact graph matching through convex-relaxation. In the next sections, we will further demonstrate this point in more detail. \section{The Training Issues and Global Skeleton in Graph Neural Networks}\label{sec:SkeletonDesign} From the Schauder fixed point theorem, to reach the critical state, one should construct a convex network structure and an input convex topological space. First, we examine the topological structure issue. The current training methods in GNNs are mainly based on backpropagation, including those gradient-based methods. However, ordinary gradient descent cannot guarantee convergence to the global minimum, since the cost function is always non-convex. Another impediment to the convex optimization is the presence of saddle points in high dimensional representation. The current network structure is pre-set before training, and usually over-parameterized, which may generate many saddle points \cite{ChoromanskaHMAL15}. In addition, (\ref{eq:RecursionDynamics}) suggests that a global minimum in low dimension may attenuate to a saddle point $0$ in a high dimensional setting by layer-wise multiplying $\lambda_i$, the so-called proliferation of saddle points \cite{DauphinPGCGB14}. Mathematically, to determine whether a solution is a local minimum, a global minimum or a saddle point, one needs to calculate the eigenvalues of its Hessian matrix at any given point. If all the eigenvalues have both positive and negative values, there will also be a zero value, corresponding to a saddle point. If all the eigenvalues are positive at any point, there exists a global minimum. Although some recent work addressed this issue either by adopting noisy stochastic gradient descent (SGD) or second-order Hessian information (e.g., Adam), they only avoided the local minimums, and the saddle point issue remains unresolved. In addition to the backpropagation, another popular method for solving non-convex optimization is the alternating direction method (e.g., PARAFAC for matrix/tensor decomposition) \cite{cichocki2016tensor, AghasiANR17}, which is an alternating matrix optimization algorithm that solves optimization problems by breaking down the convex optimization into smaller parts. Taylor et al. \cite{taylor2016training} pointed out that the alternating direction method of multipliers (ADMM) could overcome the gradient vanishing or explosion issue in backpropagation, and could be implemented in parallel and distributed computing environment. However, the theoretical understanding of the convergence of ADMM remains challenging when the objective function is non-convex, and simulation examples showed that ADMM could achieve high precision very slowly \cite{BoydPCPE11}. To avoid the saddle points caused by over-parameterization and high-dimensional representation, it is recommended that the network structure should have a pyramid-like shrinkage property \footnote{Some literature calls it as model compression, here we are prone to dimensional contraction to describe the relationship between successive layers.}. The shrinkage characteristics refer to the situation that the width of the next layer needs to shrink down compared to the current layer. Specifically, a network structure is typically characterized by the width (i.e., the number of nodes in each layer) and the depth (measured by the number of hidden layers) of GNNs. In theory, the depth relies on the time dependence and period of data itself. Hence there is no definitive way to determine the optimal value for depth given a specific dataset, and this is usually obtained by numerical trials. Therefore we here mainly focus on estimating the width. In mathematics, given a complete input, network width can be determined by identifying the latent rank of the observable matrix. This field is called low-rank recovery (or low-rank matrix completion). By imposing a rank constraint at each layer, the network width should show a pyramid-like structure. We provide more details about low-rank recovery in Appendix, and examine the proposed hypothesis via simulation experiments. \subsection{What is Wrong with Existing Pruning Algorithms}\label{sec:PruningAlgorithm} This section discuss the criticality issue by examining the current pruning algorithms. Initially, Denil et al. showed in Denil et al. \cite{DenilSDRF13} that there was a considerable redundant structure in existing networks. To reduce the number of parameters and nodes, researchers have developed various network pruning algorithms to eliminate unnecessary connections or neurons without negatively affecting convergence. A typical pruning algorithm has a three-stage pipeline, i.e., 1) training a large, over-parameterized model; 2) pruning the trained over-parameterized model according to specific criteria; 3) fine-tuning the pruned model to regain the optimal accuracy. The core pruning procedure is divided into three categories: weight pruning, structured pruning, and layer pruning. Since the layer pruning depends on the matching between the model and actual data, this paper focuses on the first two pruning techniques. Weight pruning also learns networks by adding sparsity or rank constraints on GNNs, i.e., \begin{equation} \bm{W}=\mathop{\arg\min}_{\bm{W}} (\bm{X}^{t+1}- \phi(\bm{A}\bm{X}\bm{W}^t)+\lVert\bm{W}^t\lVert). \end{equation} From the critical analysis, this constraint by imposing regularization will reverse the tendency toward criticality when the network approaches the critical state $\bm{0}$. From a searching perspective, by mixing up the topology search with weight evolution in one model, the resulting algorithm cannot achieve representation with high precision. Liu et al. \cite{LiuSZHD19} also showed in an experimental analysis that current pruning algorithms only gave a comparable or worse performance than training models with randomly initialized weights. They also emphasized that the pruned architecture, rather than ``significant'' weights, was more important in improving convergence, which is consistent with our analysis. \section{Robust Topological link Rewiring} As mentioned earlier, the assumption in global network skeleton design is built on a complete observation of the input $\bm{X}$. In real-world scenes, however, graphs often suffer from the missing edge or missing node features, and the inputs are incomplete \cite{DavenportR16}. Besides, specific-task based backpropagation learn quickly from current inputs and may ``forget" the previous learning experience. As a result, the potential accumulated erroneous inputs may eventually form an erroneous topology structure \cite{nelwamondo2007missing}. In such settings, we need to recover a complete and accurate network topology via a robust design. Therefore, this section introduces a robust topological design for potential erroneous wights. A classical approach for increasing network robustness is the use of local (geometric) topological structures. An intuitive understanding of the topological robustness is to provide path redundancy between vertices. When one path fails, communication can continue through other alternative routes. Besides, the experiments visualizing the hidden states during training also observed a growing modularity or clustering phenomenon \cite{KawamotoTO18,hou2020learning}. This phenomenon generally appears in the real-world coupled systems consisting of dynamics and local topological structures \cite{li2010global}. In all, this general phenomenon implies one can rewire the possible erroneous links by exploiting the local topological structures as an informational redundancy for self-checking. The modularity presented in the network topology can be viewed as a cluster consensus that each cluster consists of multiple interacting intelligent agents, and training the network topology is a process of building consensus among each cluster. Most consensus problem would converge to the average (proof is given in the Appendix), that is, the current state of each agent is an average of local objective function \begin{equation} \min \frac{1}{n} \sum_{i=1}^{n} f_{i}(x_i)=\sum_{j=1}^n A_{ij}x_j(t), i=1,\dots,n, \quad \bm{x_i} \in \mathcal{X},\\ \end{equation} where $f_i(\cdot)$ is the loss function corresponding to agent $i$, and $x \in \mathcal{X}$ is an unknown state to be optimized. Since network topology in GNNs can be viewed as a graph, its convergence can be handled via graph theory. For weights in GNNs, there are both positive and negative values. For an undirected graph with all positive weights, that belongs to a class of $Z$ matrix admitting many favorable properties, has been widely studied. For example, the spectrum of the positive weighted graph Laplacian $\mathfrak{S}(\bm{L})$ has the form: $\mathfrak{S}(L)=\left\{0=\lambda_{1} \leq \lambda_{2} \leq \cdots \leq \lambda_{\infty}\right\}$. The second smallest Laplacian eigenvalue $\lambda_2(\bm{L})$ is considered as a measure of algebraic connectivity on graphs. For directed graphs, algebraic connectivity also holds (proof is given in the Appendix). The consensus can be reached when all weights within a connected graph are positive. In contrast, negative weights indicate an antagonistic or anticorrelated interaction between nodes. The existence of both positive and negative weights in the neural architecture may lead to network modularity (clustering) \cite{zelazo2014definiteness}. The consensus of a graph with negative weights relies on the specific algebraic connectivity measure. On the other hand, one can make graph cuts or graph partitioning in which the link with positively weighted edges is within one module and the negative ones are between modules. Given the modularity feature exhibited in the evolutionary dynamics, an intuitive idea is to exploit local connectivity as redundant information to fine-tune the local link during training. Since the original weights are in general randomly generated, and the algebraic connectivity increases monotonously to form clustering, one can impose the algebraic connectivity based regularization on the loss function after several epochs waiting for the cluster forming \cite{tam2020fiedler} \begin{equation}\label{eq:coupledConstraint} \min _{\bm{W}} \mathcal{L}\left(Y, \hat{\bm{f}}_{\bm{W}}(X)\right)+\delta \lambda_{2}(|\bm{L}|), \end{equation} where $\bm{L}$ is the Laplacian matrix converted from the weight matrix $\bm{W}$, $\lambda_{2}(|\cdot|)$ is the Fielder value of the graph of each cluster, and $\delta$ is a tuning parameter. By imposing the regularization term in the loss function, (\ref{eq:coupledConstraint}) becomes less transparent to observe the specific erroneous links. Meanwhile, the link should be pruned to exert a localized influence, i.e., the regularization imposed on the overall topology may offset the effects of local link rewiring. To achieve a better interpretation of the results, we choose to use a greedy algorithm to verify our hypothesis, rewire possible erroneous links and better understand the clustering phenomena in the training procedure. We discuss the localized link rewiring in GNNs in the next section. \subsection{Link's Weight Rewiring to Enhance Algebraic Connectivity}\label{subsec:Rewiringedges} \begin{figure*}[htpb!] \centering \includegraphics[width=\textwidth]{SGNNFrameworkNew.pdf} \caption{A graph neural network architecture design. The tree-pipeline successively includes global width contraction, weight evolution, and link's weight rewiring. In the initial dynamics, information transfer is from front to back. In supervised learning, information transfer is in the opposite direction since it is subject to specific task constraints imposed by outputs, accompanied by declining transfer capacity in backpropagation caused by numerous local minimums or saddle points. To accelerate the informational transfer, the global architecture should have a pyramid-like shrinkage shape to prevent the saddle points caused by over-parameterized settings. After the weight evolution forming the modularity in topological structure, one can use the topological structure as redundant information to rewire possible erroneous topological links. } \label{fig:Frameworks} \end{figure*} For a disconnected graph, its algebraic connectivity is $0$, and one can increase the algebraic connectivity by rewiring links. Note that in addition to the adjacency matrix, incidence matrices can also be used to reprensent a gragh \begin{equation}\label{eq:LaplacianIncidenceMatrix} \mathbf{L}=\mathbf{H} \mathbf{H}^{T}=\sum_{l=1}^{m} \mathbf{h}_{l} \mathbf{h}_{l}^{T}. \end{equation} $\bm{H} = [\bm{h}_1, \dots, \bm{h}_m]\in \mathbb{R}^{n\times m}$ is the node-edge incidence matrix of graph $\mathcal{G}_{\text{sub}}$, and each edge vector $\bm{h}_l$ denotes vertex $V_i$ joining with vertex $V_j$ whose entries are $[h_l]_i = 1, [h_l]_j =-1$ and $0$ elsewhere. Given an initial graph $\mathcal{G}_0$, the connectivity of weighted Laplacian matrix $\bm{L}_0$ can be increased by adding new edges \begin{equation}\label{eq:addingEdges} \bm{L}(x)=\bm{L}_{0}+\sum_{l=1}^{L} \beta_l w_{l} \bm{h}_{l} \bm{h}_{l}^{T}, \end{equation} where $\beta_l \in \{0, 1\}$ is a boolean variable indicating whether the $l$th edge is selected, and $w_l$ is the weight being added to edge $l$. If edge $l$ is added to graph $\mathbb{G}$, the partial derivative of $\lambda_2(\bm{L}(\beta))$ with respect to $\beta_l$ gives the first order approximation of the increase of $\lambda_2(\bm{L}(\beta))$. According to the algebraic connectivity of directed graphs in Appendix, we have \begin{equation}\label{eq:derivative} \frac{\partial}{\partial \beta_l \lambda_{2}(L(\beta))}=\bm{v}^{T} \frac{\partial L(\beta)}{\partial \beta_{l}} \bm{v}. \end{equation} Substitute (\ref{eq:addingEdges}) into (\ref{eq:derivative}), we obtain \begin{equation}\label{eq:ChoosingEdges} \begin{aligned} & \frac{\partial}{\partial \beta_{l}} \lambda_{2}(\bm{L}(\beta)) \\ =& \bm{v}^{T} \frac{\partial\left(\bm{L}_{0}+\sum_{l=1}^L\beta_{l} w_{l} \bm{h}_{l} \bm{h}_{l}^{T}\right)}{\partial \beta_{l}} \bm{v} \\ =& \bm{v}^{T}\left(w_{l} \bm{h}_{l} \bm{h}_{l}^{T}\right) \bm{v}=w_{l}\left(\bm{v}^{T} \bm{h}_{l}\right)\left(\bm{h}_{l}^{T} \bm{v}\right) \\ =& w_{l}\left(v_{i}-v_{j}\right)^{2}. \end{aligned} \end{equation} which indicates that the largest connected edge can be found by maximizing $w_l(v_i-v_j)^2$, where $v_i$ and $v_j$ are the $i$th and $j$th items of Fielder vector $\bm{v}$. Since the algebraic connectivity of a weighted graph can be measured with respect to each edge, we can first use the graph partitioning for GNN's node classification, then if the nodes in one classification change in the later training, we can detect them based on the greedy algorithm of algebraic connectivity, and rewire them via a link prediction method. In real-world scenes, the dynamics and local connectivity also exhibit coupling characteristics, therefore, one can use a coupling coefficient to measure their relationship. Based on the above analysis on global skeleton and local link rewiring, we now present the new GNN architecture design in Fig.\ref{fig:Frameworks}. \section{Experiments}\label{sec:experiments} This section provides some empirical evaluations for the proposed architecture design via node classification tasks (the datasets and parameters is outlined in the Appendix). \subsection{Model Contraction} we Fig. \ref{fig:ActivationCompare} show the model contraction properties, where the results are based on $20$ Monte Carlo experiments. Subfigure(above) show the network width after automatic pruning. Here we indeed observe a layer-by-layer shrinkage width, confirming our proposed shrinkage property when the depth increases. These contraction ratios, however, seem to be relatively small. Subfigure(bottom) compare the learning rates on test datasets, we find that the convergence continues to decrease even adopting a large rate (i.e., 0.2, 0.5), which illustrates that shrinkage structure can overcome the saddle point problem, and ultimately improves the convergence. To enhance the interpretability of GNN, Fig. \ref{fig:EvolutionDynamics} demonstrates the evolutionary dynamics with respect to $5$ prominent eigenvalues of hidden states. We observe the eigenvalues of each layer conversation from descending to ascending during the training procedure, confirming the proposed information transfer in dynamics. \begin{figure*} \centering \begin{subfigure}[b]{0.9\textwidth} \centering \includegraphics[width=\textwidth]{NewNetworkSizeAdjustCompare-GCN.pdf} \end{subfigure} \begin{subfigure}[b]{0.9\textwidth} \centering \includegraphics[width=\textwidth]{LRCompare-GCN.pdf} \end{subfigure} \caption[] {\small Performance analysis of the proposed framework. (Above) the observed shrinking property of network width after automatical pruning. (Bottom) the impact of learning rate on convergence.} \label{fig:ActivationCompare} \end{figure*} \begin{figure*}[htpb!] \centering \includegraphics[width=\textwidth]{DiagElement-GCN.pdf}\\ \caption{Evolutionary dynamics in training process. Each figure contains the $5$ prominent eigenvalues of hidden states. } \label{fig:EvolutionDynamics} \end{figure*} \subsection{Multi-agent Consensus-based Link's Weight Rewiring}\label{subsec:LinkRewiring} This section investigates the performance of multi-agents consensus-based link's weight rewiring. Fig. \ref{fig:LinkRewiring} shows the effects of coupling coefficients on the convergence of test error. We see the link rewiring on Citeseer, Pubmed and CoraFull are clear, while it is not obvious on Cora datasets, since the erroneous weights are not obvious. Tab. \ref{Tab:AlgoComp} shows the test accuracy of different graph classification methods. The results show our shrinkage-rewiring structure (SRGCN and SRChebNet) could greatly improve the node classification accuracy after automatic width pruning. \begin{figure*}[htpb!] \centering \includegraphics[width=\textwidth]{WeightRewiringCoefficientCompare-GCN.pdf}\\ \caption{The effect of coupling coefficient on convergence.} \label{fig:LinkRewiring} \end{figure*} \begin{table} \vspace{0in} \centering \begin{tabular}{l||c|c|c|c} \toprule \toprule Method&\textbf{Cora} & \textbf{Citeseer} & \textbf{Pubmed} &\textbf{CoraFull}\\ \midrule DeepWalk &67.2 & 43.2 &65.3 &80.3\\ GAT &56.8 &72.5 &79.0 &82.5\\ ChebNet & 62.1 &69.8 &74.4&81.4\\ GraphSAGE &64.2 &70.6 &70.5&82.2\\ Planetoid &75.7 &64.7 &77.2&80.5\\ GPNN & 68.1 &79.0 &73.6 &80.4\\ MPNN &72.0& 64.0&75.6&79.8\\ GCN &76.5 &81.5 &79.0 &86.6\\ SRGCN (ours)&80.45 &83.43 &80.16&87.13\\ SRChebNet (ours)&79.96 &82.93&80.98 &86.09\\ \hline \end{tabular} \centering \caption{Performance comparison of different graph classification methods.}\label{Tab:AlgoComp} \end{table} \section{Related Works}\label{sec:RelatedWorks} More recently, many innovative GNN frameworks have been developed. Notable methods include gated GNN \cite{li2016detecting}, GraphSAGE \cite{hamilton2017inductive}, message-passing neural networks \cite{GilmerSRVD17}, and pruning networks \cite{0022KDSG17}. In terms of architecture design on topological spaces, the most related work to ours is that Li et al. \cite{LiGDVK19}, where the authors established the equivalence between GNN and graph matching, and emphasized modeling in GNN was a convex optimization process. The major difference is that their work does not provide a specific network skeleton design, while our method provides a shrinkage network skeleton. Various regularization methods performed by randomly deleting hidden weights or activations are all for forming convex sets \cite{srivastava2014dropout, Rodriguez0CGR17}. Zhang \cite{ZhangSS19} showed that the success of several recently proposed architectures (e.g., ResNet, Wide ResNet, Xception, SqueezeNet, and Inception) was mainly related to the fact that multi-branch structures help reduce the non-convex property of network topology.i Regarding the observed modularity (clustering) features in weight evolution, several authors suggested defining convolutional neural network or recurrent neural network modules composed of topologically identical or similar blocks to simplify the topology design. Results illustrated these methods could achieve a large compression ratio in terms of parameters with excellent performance guarantees \cite{zoph2018learning}. Compared to their works, our method offers a theoretical explanation for the observed modularity phenomenon, and further employ it as an informational redundancy to guarantee local topological accuracy. \section{Concluding Remarks}\label{sec:conclusions} This paper presents a three-pipeline training framework based on global criticality and local topological connectivity. From the critical Theorem on topological spaces, to reach the critical state, input and network structure should match to build a convex matching (optimization). In specific training, to promote the information transfer under the over-parameterized setting, we propose a layer-wise shrinkage topological structure to prevent the proliferation of saddle points in high dimensional spaces. In facing actual erroneous inputs, we give a robust topological link rewiring method based on the local connectivity required by cluster consensus, which is similar to the idea of self-supervised learning that applies structural information as redundant information for self-checking. Our work contributes by shedding light on the success of GNNs from dynamics and topological spaces aspect. Due to current topological structure constraints, this paper only involves the intra-layer erroneous weight rewiring, the inter-layer link imputation is still unresolved. Further exploiting the modularity in more general topological architecture and more complex data (e.g., attacked data) is our next concern, which may provide guidelines to approach the critical expressivity. \bibliographystyle{unsrt}
{'timestamp': '2020-12-17T02:08:17', 'yymm': '2012', 'arxiv_id': '2012.08717', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08717'}
arxiv
\section{TRNNGCN} \begin{algorithm}[!h] \SetAlgoLined \SetKwInOut{Input}{Input} \SetKwInOut{Output}{Output} \Input{Temporal graph $(A_1,A_2,...,A_T)$,\\ Membership matrix of training data $\Theta_T^{train}$} \Output{Membership matrix estimate $\hat{\Theta}_T$} $\hat{A}=A_0$, $H_0=I_N$\; \For{\text{iteration} $i=1,...,I$}{ \For{$ t=2,...,T$ }{ $ \hat{A}_t=(1-\hat{\Theta}_{i-1} \Lambda (\hat{\Theta}_{i-1})^T) \circ \hat{A}_{t-1}+\hat{\Theta}_{i-1} \Lambda (\hat{\Theta}_{i-1})^T \circ \hat{A}_t.$} $H^{(1)}=\sigma_1(\hat{A}_TH^{(0)}W^{(1)})$\\ $H^{(2)}=\sigma_2(\hat{A}_TH^{(1)}W^{(2)})$\\ CrossEntropyLoss($H_i^{train}$, ${\Theta}_i^{train}$)\\ Backward()\\ $\hat{\Theta}_{i}=\text{Onehot}(\argmax_{1\leq j \leq n}H_{jk}^{(2)})$\\ } $\hat{\Theta}_T=\text{Onehot}(\argmax_{1\leq j \leq n}H_{jk}^{(2)})$ \caption{TRNNGCN} \label{algo:TRNNGCN} \end{algorithm} \section{Recovery Requirements} The goal of clustering or community detection is to recover the membership $\Theta$ by observing the graph $G$, up to some level of accuracy. We next define the relative error and rate of recovery. \begin{definition} [Relative error of $\hat{\Theta}$] The relative error of a clustering estimate $\hat{\Theta}$ is \begin{equation} E(\hat{\Theta},\Theta)=\frac{1}{n} \min_{\pi\in \mathcal{P}} \|\hat{\Theta} \pi-\Theta\|_0, \end{equation} where $n$ denotes the number of nodes in graph $G$, $\mathcal{P}$ is the set of all $K\times K$ permutation matrices and $\|.\|_0$ counts the number of non-zero elements of a matrix. \end{definition} \begin{definition} [Agreement or accuracy of $\hat{\Theta}$] \begin{equation} A(\hat{\Theta},\Theta)=1-E(\hat{\Theta},\Theta). \end{equation} \end{definition} \begin{definition}{(Recovery rate of $\hat{\Theta}$)} A clustering estimate $\hat{\Theta}$ achieves \begin{itemize} \item Exact Recovery when \begin{equation*} \mathbb{P}\{A(\hat{\Theta},\Theta)=1\}=1-o(1), \end{equation*} \item Almost Exact Recovery when \begin{equation*} \mathbb{P}\{A(\hat{\Theta},\Theta)=1-o(1)\}=1-o(1), \end{equation*} \item Partial Recovery when \begin{equation*} \mathbb{P}\{A(\hat{\Theta},\Theta)\geq \alpha\}=1-o(1),\alpha\in(\frac{1}{k},1). \end{equation*} \end{itemize} \end{definition} \begin{lemma} \label{lemma:almost} If \begin{equation} \mathbb{E}(A(\hat{\Theta},\Theta))=1-o(1), \end{equation}where $\mathbb{E}$ denotes the expectation, then $\hat{\Theta}$ achieves almost exact recovery. \end{lemma} \begin{lemma} \label{lemma:partial} If \begin{equation} \mathbb{E}(A(\hat{\Theta},\Theta))\geq \alpha-o(1), \alpha\in(\frac{1}{k},1), \end{equation} then $\hat{\Theta}$ achieves partial recovery. \end{lemma} \section{Proof of Proposition 1} \begin{lemma} In \cite{abbe2017community}, by genie-aided hypothesis test, if the link probability $\alpha=\mathcal{O}(\frac{\log n}{n})$, at time step $t$, by spectral estimator, we have $$\mathbb{P}(\hat{\Theta}_{t,i}=\Theta_{t,i})=\left\{ \begin{aligned} 1-o(1) & , & \frac t 2\geq \max {C_i}\\ o(1) & , & \frac t 2 < \max {C_i}, \end{aligned} \right.$$ where $\Theta^t_i$ denotes the i-th row (membership of node $i$) of membership matrix $\Theta$ at timestep $t$ and $C_i$ denotes the most recent change time of node $i$. \end{lemma} \begin{prop}[Partial Recovery of Spectral Clustering]\label{prop:recover_rate_appendix} When nodes change their cluster membership over time with change probabilities $\mathcal{O}(\frac{\log n}{n})$, Spectral Clustering recovers the true clusters at time $T$ with relative error $\mathcal{O}(\frac{\log n}{n} T)$. \end{prop} \begin{proof} Let $X^c_t$ denote the set of changed nodes from timestep $1$ to timestep $t$, and $X^u_t$ denote the set of the remaining unchanged nodes. $\Theta^c_t$ means the membership matrix of $X^c_t$ and $\Theta^u_t$ is the membership matrix of $X^u_t$ . We have \begin{equation*} \begin{aligned} &\mathbb{E}(A(\hat{\Theta}_t,\Theta_t))\\=&\mathbb{E}(A(\hat{\Theta}^u_{t}\cup \hat{\Theta}^c_{t},\Theta^u_{t}\cup \Theta^c_{t})=1)\\ \leq&\sum_{i\in X^u_{t}} \mathbb{E}(\hat{\Theta}_{t,i}=\Theta_{t,i})+\sum_{j\in X^c_{t}} \mathbb{E}(\hat{\Theta}_{t,j}=\Theta_{t,j})\\ =&\sum_{i\in X^u_{t}} \mathbb{E}(\hat{\Theta}_{t,i}=\Theta_{t,i})+\sum_{s=1}^{t}\sum_{j\in X^c_{s}/X^c_{s-1}} \mathbb{E}(\hat{\Theta}_{t,j}=\Theta_{t,j})\\ =&(1-\mathcal{O}(\frac{\log n}{n}t))\mathbb{P}(\hat{\Theta}_{t,i}=\Theta_{t,i})_{i\in X^u_{t}}\\ &+\mathcal{O}(\frac{\log n}{2n}t)\mathbb{P}(\hat{\Theta}_{t,j},\Theta_{t,j})_{j\in X^c_{t}, \frac{t}{2}\geq \max C_j}\\ &+\mathcal{O}(\frac{\log n}{2n}t)\mathbb{P}(\hat{\Theta}_{t,j},\Theta_{t,j})_{j\in X^c_{t}, \frac{t}{2}< \max C_j}\\ =&(1-\mathcal{O}(\frac{\log n}{n}t))(1-o(1))\\ &+\mathcal{O}(\frac{\log n}{2n}t)(1-o(1))+\mathcal{O}(\frac{\log n}{2n}t)o(1)\\ =& 1-\mathcal{O}(\frac{\log n}{n}t) \end{aligned} \end{equation*} Then the expectation of relative error at timestep $T$ is \begin{equation} \mathbb{E}(E(\hat{\Theta}_T,\Theta_T))= \mathcal{O}(\frac{\log n}{n} T). \end{equation} When $T=\mathcal{O}(\frac{n}{\log n})$, we have $\mathbb{E}(A(\hat{\Theta}_T,\Theta_T))=1-\mathcal{O}(1)$. By Lemma \ref{lemma:partial}(Technical Appendix), it only solves partial recovery. \end{proof} \section{Proof of Proposition 2} \begin{prop}[Optimal Decay Rate]\label{prop:opt_appendix} The concentration of each block $k$ is upper-bounded by \begin{equation} \label{equ:bound} \left\|\hat{A}_{t}^{k}-P_{t}^{k}\right\|\lesssim E_1(\beta_{k})+E_2(\beta_{k}), \end{equation} where $\beta_k$ denotes the max decay rate of class $k$ and \begin{equation} E_1(\beta_{k}) = \sqrt{ n \alpha \beta_{k}},\; E_2(\beta_{k}) = \alpha \sqrt{\frac{n^2 \varepsilon_k}{\beta_{k}}}, \end{equation} which is minimized when $\beta_{k}=\sqrt{ n \alpha \varepsilon_k}$. \end{prop} \subsection{Decay rule} In dynamic SBM, we use the following decay rule: \begin{equation} \hat{A}_t=(1-\Theta_t \Lambda (\Theta_t)^T)\hat{A}_{t-1}+\Theta_t \Lambda (\Theta_t)^T A_t. \end{equation} Let $\hat{A}_{t}^{k}$ denote the block matrix corresponding to cluster $k$, and similarly consider $K$ blocks $P_t^k$ of the connection probability matrix $P_t$. Let $\lambda_k$ denote the $k$-th element in the diagonal of $\Lambda$. We have \begin{equation} \hat{A}_t^k=(1-\lambda_k)\hat{A}_{t-1}^k+\lambda_k A_t^k, \end{equation} which can also be written as \begin{equation} \hat{A}_t^k=\sum_{s=0}^{t}\beta_s^k {A}_{t-s}^k, \end{equation} where $\beta_s^k=\lambda_k (1-\lambda_k)^s$ for $s<t$ and $\beta_{t}^k=(1-\lambda)^t$. Then we denote the maximum of $\beta_s^k$ as $\beta_k$ and we have $\beta_k=\lambda_k$. Similarly, we define \begin{equation} \hat{P}_t^k=\sum_{s=0}^{t}\beta_s^k {P}_{t-s}^k. \end{equation} \subsection{Error Bound} The error bound $\left\|\hat{A}_{t}^{k}-P_{t}^{k}\right\|$ can be divided into two terms: \begin{equation} \left\|\hat{A}_{t}^{k}-P_{t}^{k}\right\|\leq \left\|\hat{A}_{t}^{k}-\hat{P}_{t}^{k}\right\|+ \left\|\hat{P}_{t}^{k}-P_{t}^{k}\right\| \end{equation} \subsubsection{Preliminaries} The result is valid for any estimator with weights $\beta_s^k\geq 0$ that satisfy the property that there are constants $C_\beta,C'_\beta>0$ such that: \begin{equation} \begin{aligned} &\sum_{s=0}^t \beta_s^k =1,\;\; \beta_s^k \leq \beta_{k},\;\;\sum_{s=0}^t (\beta_s^k)^2\leq C_\beta \beta_{k} \\ &\sum_{s=0}^t \beta_s^k \min(1,\sqrt{s \varepsilon_k})\leq C'_\beta \sqrt{\frac{\varepsilon_k}{\beta_k}} \end{aligned} \end{equation} Our defined decay rate naturally satisfy the first three preliminaries. The last preliminary is satisfied when $t\geq \frac{\min (\log(\varepsilon_k/\beta_k),\log \beta_k)}{2 \log (1-\beta_k)}$ \subsubsection{Bound the first term} \begin{theorem} \cite{keriven2020sparse} Let $A_1,...,A_t\in\{0,1\}^{n}$ be $t$ symmetric Bernoulli matrices whose elements $a^{s}_{ij}$ are independent random variables: \begin{equation} a^{s}_{ij} \backsim Ber(p^{s}_{ij}), a^{s}_{ji}=a^{s}_{ij}, a^{s}_{ii}=0 \end{equation} Assume $p^{s}_{ij}\leq \alpha$. Consider non-negative weights $\beta_s$ and $A=\sum_{s=0}^t \beta_s A_{t-s}$ and $P=\mathbb{E}(A)$, there is a universal constant $C$ such that for all $c>0$, we have \begin{equation} \begin{aligned} &\mathbb{P}\left(\left\|A-P\right\|\geq C(1+c)\sqrt{n \alpha \beta_{\max}}\right)\\ &\leq e^{-(\frac{c^2/2}{2C_\beta + 2c/3}-\log14)n} +e^{-\frac{c^2/2}{2C_\beta + 2c/3}\frac{n \alpha}{\beta_{\max}}+\log n}+n^{-\frac{c}{4}+6}. \end{aligned} \end{equation} \label{theorem:first_term} \end{theorem} By applying Theorem \ref{theorem:first_term}, for fixed block $\Theta_0^k,...,\Theta_t^k$, if ${\frac{n \alpha}{\beta_k}}\gtrsim \log n$, then for any $\nu>0$, there is a constant $C_\nu$ such that with probability at least $1-n^\nu$ \begin{equation} \begin{aligned} \left\|\hat{A}_{t}^{k}-\hat{P}_{t}^{k}\right\| &\leq \left\|\hat{A}_{t}^{k}-\mathbb{E}(\hat{A}_{t}^{k})\right\|+\left\|diag(\hat{P}_t^k) \right\|\\ &\leq C_\nu \sqrt{n\alpha \beta_k} + \alpha \end{aligned} \end{equation} In all considered case, $\beta_k \gg \frac{1}{n}$, $\alpha$ is negligible, we have \begin{equation} \left\| \hat{A}_t^k - \hat{P}_t^k\right\|\lesssim \sqrt{n \alpha \beta_k} \end{equation} \subsubsection{Bound the second term} Since $\sum_{s=0}^t \beta_s^k=1$, we have \begin{equation} \left\| \hat{P}_t^k - P_t^k\right\|\leq \sum_{s=0}^t \beta_s^k \left\|P_{t-s}^k-P_t^k \right\|\leq \sum_{s=0}^t \beta_s^k \left\|P_{t-s}^k-P_t^k \right\|_F, \end{equation} where $\|.\|_F$ is the Frobenius norm. \begin{lemma} \label{lemma:bound_p} Consider $P=\Theta B \Theta^T$ and $P'=\Theta' B (\Theta')^T$. Let $S$ denotes the set of nodes that have changed clusters between $\Theta$ and $\Theta'$. Then we have \begin{equation} \begin{aligned} \left\| P-P'\right\|^2_F &=\sum_{i\in S}\sum_j(p_{ij}-p'_{ij})+(p_{ji}-p'_{ji}) \\ &\leq 4 \sum_{i\in S} \sum_j p_{ij}^2 + (p'_{ij})^2 \\ & \leq 8 \alpha^2 |S| n \max_k \sum_l (B)^2_{kl} \\ &\leq 8 \alpha^2 |S| n \end{aligned} \end{equation} \end{lemma} By using Lemma \ref{lemma:bound_p} and the Lemma \cite{keriven2020sparse} \begin{equation} \begin{aligned} \mathbb{P}( \exists k,\; \left\|P_{t-k}-P_t\right\|^2_F \geq (8+&C) \alpha n^2 \min (1,k\varepsilon) )\\ &\leq e^{-2C^2\varepsilon^2n+\log \frac{1}{\varepsilon}} \end{aligned} \end{equation} we have, with probability at least $1-n^{\nu}$, \begin{equation} \left\|P_{t-s}^k-P_t^k \right\|_F\leq 2 \alpha n^2 \min (1,k\varepsilon_k)) \end{equation} By the preliminary of $\sum_{s=0}^t \beta_s^k \min(1,\sqrt{s \varepsilon_k})$, we obtain the desired bound. \begin{equation} \left\| \hat{P}_t^k - P_t^k\right\|\lesssim \alpha \sqrt{\frac{n^2 \varepsilon_k}{\beta_{k}}} \end{equation} \section{Proof of Proposition 3} \begin{prop}[Almost Exact Recovery]\label{prop:bound_appendix} Let $\lambda_{\max}$ denote the maximum element on the diagonal of $\Lambda$. With probability at least $1-n^{-\nu}$ for any $\nu > 0$, at any time $t$ we have \begin{equation} \left\|\hat{A}_t-P_t\right\|\lesssim \sqrt{ n \alpha \lambda_{\max}} \end{equation} When $K$ is constant, $\varepsilon_k=\mathcal{O}(\frac{\log n}{n})$ and $\alpha=\mathcal{O}(\frac{\log n}{n})$, the relative error is $\mathcal{O}\left(\frac{1}{n^{\frac{1}{4}}\log n}\right)$, which implies almost exact recovery at time $T$. \end{prop} \begin{proof} By Equation \ref{equ:bound}(Technical Appendix), we have \begin{equation} \left\|\hat{A}_{t}^{k}-P_{t}^{k}\right\| \lesssim \sqrt{ n \alpha \lambda_{k}}. \end{equation} We define the decay rates as \begin{equation} \Lambda_{jk}=\left\{ \begin{aligned} \min(1,\sqrt{n \alpha \varepsilon_k})& , &j=k\\ 1& , &j\neq k. \end{aligned} \right. \end{equation} We can separate $\hat{A}_t$ into $K^2$ blocks based on their belonging of clusters. Let $\hat{A}_t^d$ denote the matrix include the diagonal block of $\hat{A}_t$ and $\hat{A}_t^n$ denote the matrix include the non-diagonal block of $\hat{A}_t$. The same goes in $\hat{A}_t^d$ and $\hat{P}_t^n$. We have \begin{equation} \left\|\hat{A}_t-P_t\right\|\leq \left\|\hat{A}_t^d-P_t^d\right\| + \left\|\hat{A}_t^n-P_t^n\right\| \end{equation} For $\left\|\hat{A}_t^n-P_t^n\right\|$, since $\tau \ll 1$, by setting $\Lambda_{jk}=1, (j\neq k)$, spectral norms of the matrix is negligible. Then we have \begin{equation} \left\|\hat{A}_t-P_t\right\|\lesssim \left\|\hat{A}_t^d-P_t^d\right\| \end{equation} Since $K$ is constant, by the property of spectral norm, we have \begin{equation} \left\|\hat{A}_t-P_t\right\|\lesssim \max_k{\left\|\hat{A}_{t}^{k}-P_{t}^{k}\right\|} =\sqrt{ n \alpha \lambda_{\max}} \end{equation} When $\varepsilon_k=\mathcal{O}(\frac{\log n}{n})$ and $\alpha=\mathcal{O}(\frac{\log n}{n})$, \begin{equation} \begin{aligned} &E(\hat{\Theta},\Theta)\\ \lesssim &(1+\delta)\frac{n_{\max}' K}{n\alpha^2 n_{\min}^2 \tau^2}\|\hat{A}-P\|^2\\ \lesssim & (1+\delta)\frac{n K}{n\alpha^2 n^2 \tau^2} \sqrt{ n \alpha \lambda_{\max}}\\ = & (1+\delta)\frac{K}{\mathcal{O}(\frac{\log n}{n})^2 n^2 \tau^2} \sqrt{ n \mathcal{O}(\frac{\log n}{n}) \sqrt{n \mathcal{O}(\frac{\log n}{n}) \mathcal{O}(\frac{\log n}{n})}}\\ =&(1+\delta)\frac{K}{\mathcal{O}({\log n})^2 \tau^2} \sqrt{ \mathcal{O}({\log n})^2 \sqrt{ \mathcal{O}(\frac{1}{n}) }}\\ =&(1+\delta)\frac{K}{ \tau^2} \mathcal{O}\left(\frac{1}{n^{\frac{1}{4}} \log n}\right). \end{aligned} \end{equation} The relative error is $\mathcal{O}\left(\frac{1}{n^{\frac{1}{4}}\log n}\right)$ By Lemma \ref{lemma:almost}(Technical Appendix), it implies almost exact recovery at time $T$. \end{proof} \section{GCN and Spectral Clustering} Figure \ref{fig:spec_norm_appendix} shows that Spectral Clustering and GCN have qualitatively similar accuracy on simulated data as we vary the decay rate $\lambda$ (the same $\lambda$ is used for all nodes). As expected from Proposition~\ref{prop:opt_appendix}, the optimal decay rate $\lambda$ increases as we increase the link probability $\alpha$, as does the value of $\lambda$ that minimizes the spectral norm $\|\hat{A} - P\|$. The optimal decay rate for GCN matches the decay rate value that minimizes the spectral norm, while the optimal decay rate for spectral clustering is larger than the one minimizing the spectral norm. \begin{figure}[ht] \centering \includegraphics[width=0.23\textwidth,trim={0.3cm 0 0.8cm 0.3cm}, clip]{figure/alpha_specnorm_acc.eps} \includegraphics[width=0.23\textwidth,trim={0.3cm 0 0.8cm 0.3cm}, clip]{figure/alpha_specnorm_norm.eps} \caption{Accuracy and Spectral Norm as we vary $\alpha$. The optimal decay rate $\lambda$ increases with $\alpha$, as in Proposition~\ref{prop:opt_appendix}.} \label{fig:spec_norm_appendix} \end{figure} \section{Experiment result on simulated data} Figure \ref{fig:bar_simu} shows the accuracy, AUC, and F1 score comparison of all baseline methods on simulated data, averaged over all 50 timesteps. Our TRNNGCN and RNNGCN methods show the best performance across all three metrics. \begin{figure}[ht] \centering \includegraphics[width=0.47\textwidth]{figure/simulate_bar.eps} \caption{Comparison of methods on simulated data with heterogeneous cluster transition probabilities.} \label{fig:bar_simu} \end{figure} \section{Introduction} Clustering nodes based on their connections to each other is a common goal of analyzing graphs, with applications ranging from social to biological to logistics networks. Most such clustering approaches assume that the connections (i.e., edges) between nodes, and thus the optimal clusters, do not change over time~\cite{lei2015consistency,qin2013regularized}. In practice, however, many graph structures will evolve over time. Users in social networks, for example, may migrate from one community to another as their interests or employment status changes, forming new connections with other users (i.e., new edges in the graph) and changing the cluster or community to which they belong. Thus, clustering algorithms on such evolving graphs should be able to track changes in cluster membership over time. A major challenge in tracking cluster membership changes is to carefully handle historical information and assess its value in predicting the current cluster membership. Since clusters will often evolve relatively slowly, an extreme approach that does not consider edges formed in the past risks ignoring useful information about the majority of nodes whose memberships have not changed. On the other hand, making no distinction between historical and more recently formed edges may lead to slow detection of nodes' membership changes, as the historically formed edges would dominate until the nodes have enough time to make connections within their new clusters. Prior works have balanced these effects by introducing a \emph{decay rate}: the weight of each edge is reduced by a constant decay factor in each time step between the connection formation and the time at which cluster membership is estimated. The cluster membership can then be estimated at any given time, by taking the weighted connections as input to a static algorithm like the well-studied spectral clustering~\cite{abbe2017community}. Accounting for historical node connections with a single decay rate parameter offers the advantage of interpretability: the decay rate quantifies the emphasis put on historically formed edges, which can be tuned for specific datasets. Yet while prior works have examined the optimal decay rate for stylized network models, they use a single decay rate for all edges~\cite{keriven2020sparse}. In practice, the optimal rate will likely vary, e.g., with higher decay rates for clusters with higher membership turnover where historical information might reflect outdated cluster memberships, making it less useful. Introducing different decay rates for each cluster, on the other hand, raises a new challenge: since we do not know the true cluster memberships for each node, we may use the wrong decay rate if a node is erroneously labeled. Moreover, the optimal decay rates for different clusters will be correlated due to connections between nodes in different clusters that themselves must be optimally weighted, potentially making the decay rates difficult to optimize. More sophisticated semi-supervised clustering methods combine LSTM (long-short-term memory) or RNN (recurrent neural network) structures with graph convolutional networks (GCNs), producing a neural network that classifies nodes based on their cluster membership labels. This network can be carefully trained to optimize the use of historical edge information, without explicitly specifying different node decay rates~\cite{pareja2020evolvegcn}. However, while such algorithms show impressive empirical performance on large graph datasets, they are generally not easily interpretable. Our work seeks to connect the theoretical analysis of graph clustering algorithms with the graph neural networks commonly used in practice. Our key insight in doing so is that \emph{prefacing a GCN with a RNN layer} can be interpreted as imposing a decay rate on node connections that depends on each node's current cluster membership, and then approximating spectral clustering on the resulting weighted graph via the GCN. Following this insight, we propose two new \emph{transitional RNN-GCN neural network architectures} (RNNGCN and TRNNGCN) for semi-supervised clustering. We derive the theoretically optimal decay rates for nodes in each cluster under stylized graph models, and show that the weights learned for the RNN layer in TRNNGCN qualitatively match the theoretically optimal ones. After reviewing related work on theoretical and empirical graph clustering, we make the following specific contributions: \begin{itemize} \item A \textbf{theoretical analysis of the optimal decay rates} for spectral clustering algorithms applied to the dynamic stochastic block model, a common model of graph clustering dynamics~\cite{keriven2020sparse}. \item Two \textbf{new RNN-GCN neural network architectures} that use an interpretable RNN layer to capture the dynamics of evolving graphs and GCN layers to cluster the nodes. \item Our algorithm can achieve \textbf{almost exact recovery} by including a RNN layer that decays historical edge information. Static methods can only partially recover the true clusters when nodes change their cluster memberships with probability $\mathcal{O}\left(\frac{\log n}{n}\right)$, $n$ being the number of nodes. \item \textbf{Experimental results} on real and simulated datasets that show our proposed RNN-GCN architectures outperform state-of-the-art graph clustering algorithms. \end{itemize} \section{Spectral Clustering with Decay Rates} We now introduce the Spectral Clustering algorithm and optimize the decay rates to minimize its relative error. \subsection{Spectral Clustering Algorithm} Spectral Clustering is a commonly used unsupervised method for graph clustering. The key idea is to apply $K$-means clustering to the $K$-leading left singular vectors of the adjacency matrix $A$~\cite{stella2003multiclass}; we denote the corresponding matrix of singular vectors as $E_K$. We then estimate the membership matrix $\bar{\Theta}$ by solving \begin{equation} (\bar{\Theta},\bar{C})\in \argmin_{\Theta\in \{0,1\}^{n\times K}, C\in\mathbb{R}^{K\times K}} \|\Theta C - E_K\|_F^2, \label{eq:kmeans} \end{equation} where $\|.\|_F$ denotes the Frobenius norm. It is well known that finding a global minimizer of Eq.~\eqref{eq:kmeans} is NP-hard. However, efficient algorithms~\cite{kumar2004simple} can find a $(1+\delta)$-approximate solution $(\hat{\Theta},\hat{C})$, i.e., with $\|\hat{\Theta}\hat{C}-E_K\|_F^2\leq (1+\delta) \|\bar{\Theta}\bar{C}-E_K\|_F^2$. \subsection{Introducing Decay Rates} {In the dynamic SBM, the adjacency matrix $A$ includes edges formed from the initial time step $1$ to the current time step $T$. Let $A_t$ denotes the adjacency matrix only including edges formed at time step $t$. We have $A = \sum_{t=1}^T A_t$}. Spectral clustering performs poorly on the dynamic SBM: \begin{prop}[Partial Recovery of Spectral Clustering]\label{prop:recover_rate} When nodes change their cluster membership over time with probabilities $\varepsilon_j = \mathcal{O}(\frac{\log n}{n})$, {by using the adjacency matrix $A$}, Spectral Clustering recovers the true clusters at time $T$ with relative error $E(\hat{\Theta}_T,\Theta_T) = \mathcal{O}(\frac{\log n}{n} T)$. \end{prop} To improve the performance, {one can use an exponentially smoothed version $\hat{A}_t$ as input for clustering:} \begin{equation} \hat{A}_t=(1-\lambda)\hat{A}_{t-1}+\lambda A_t \end{equation} where $\hat{A}_1 = A_1$ and we call $\lambda\in[0,1]$ the \emph{decay rate}~\cite{chi2009evolutionary}. Intuitively, a larger value of $\lambda$ puts less weight on the past information, ``forgetting'' it faster. However, in the dynamic SBM, each cluster $j$ may have a different change probability $\varepsilon_j$, implying that they may benefit from using different decay rates $\lambda$. We thus introduce a decay matrix $\Lambda\in[0,1]^{K\times K}$ that gives a different decay rate to connections between each pair of clusters: \begin{equation} \hat{A}_t=(1-\Theta_t \Lambda (\Theta_t)^T)\odot \hat{A}_{t-1}+\Theta_t \Lambda (\Theta_t)^T \odot A_t. \end{equation} \subsection{Bounding the Relative Error} Our analysis uses \citet{lei2015consistency}'s result that the relative error rate of the Spectral Clustering on the dynamic SBM at each time $t$ is bounded by the concentration of the adjacency matrix around its expectation: \begin{equation} E(\hat{\Theta},\Theta)\lesssim (1+\delta)\frac{n_{\max}' K}{n\alpha^2 n_{\min}^2 \tau^2}\|\hat{A}-P\|^2, \label{eq:errorbound} \end{equation} where $n_{\max}'$ and $n_{\min}$ are respectively the second largest and smallest cluster sizes, and $\|.\|$ denotes the spectral norm. Thus, $E(\hat{\Theta},\Theta)$ is determined by the concentration $\|\hat{A}-P\|$, where {$\hat{A}=\hat{A}_t$} and $P=P_t=\Theta_t B (\Theta_t)^T$ as defined in the SBM model. To bound this concentration, we consider $K$ diagonal blocks of the adjacency matrix $\hat{A}_t$, with each block corresponding to edges between nodes in a single cluster, after re-indexing the nodes as necessary. Let $\hat{A}_{t}^{k}$ denote the block matrix corresponding to cluster $k$, and similarly consider $K$ blocks $P^t_k$ of the connection probability matrix $P_t$. We can then upper-bound $\left\|\hat{A}_{t}^{k}-P_{t}^{k}\right\|$ in terms of the decay rate: \begin{prop}[Optimal Decay Rate]\label{prop:opt} The concentration of each block $k$ is upper-bounded by \begin{equation} \left\|\hat{A}_{t}^{k}-P_{t}^{k}\right\|\lesssim E_1(\beta_{k})+E_2(\beta_{k}), \end{equation} where $\beta_k$ denotes the maximum decay rate of class $k$ and \begin{equation} E_1(\beta_{k}) = \sqrt{ n \alpha \beta_{k}},\; E_2(\beta_{k}) = \alpha \sqrt{\frac{n^2 \varepsilon_k}{\beta_{k}}}, \end{equation} which is minimized when $\beta_{k}=\sqrt{ n \alpha \varepsilon_k}$. \end{prop} We formally prove this result in our supplementary material. The intuition is that if the change probability $\varepsilon_k$ is larger, we need a higher decay rate to remember less past information. We thus define the decay rates as \begin{equation} \Lambda_{jk}=\left\{ \begin{aligned} \min(1,\sqrt{n \alpha \varepsilon_k})& , &j=k\\ 1& , &j\neq k. \end{aligned} \right. \end{equation} This decay rate yields almost exact recovery: \begin{prop}[Almost Exact Recovery]\label{prop:bound} Let $\lambda_{\max}$ denote the maximum element on the diagonal of $\Lambda$. With probability at least $1-n^{-\nu}$ for any $\nu > 0$, at any time $t$ we have \begin{equation} \left\|\hat{A}_t-P_t\right\|\lesssim \sqrt{ n \alpha \lambda_{\max}} \end{equation} When $K$ is constant, $\varepsilon_k=\mathcal{O}\left(\frac{\log n}{n}\right)$ and $\alpha=\mathcal{O}\left(\frac{\log n}{n}\right)$, the relative error is $\mathcal{O}\left(\frac{1}{n^{\frac{1}{4}}\log n}\right)$, which implies almost exact recovery at time $T$. \end{prop} \subsection{Connection between GCN and Spectral Clustering} We empirically demonstrate that Proposition~\ref{prop:opt}'s decay rate is optimal by varying the decay rates used in both spectral clustering and the commonly used Graph Convolutional Network (GCN), which is a first-order approximation of spectral convolutions on graphs~\cite{kipf2016semi}. A multi-layer GCN has the layer-wise propagation rule: \begin{equation} H^{(l+1)}=\sigma(\widetilde{D}^{-\frac{1}{2}}\widetilde{A}\widetilde{D}^{-\frac{1}{2}}H^{(l)}W^{(l)}), \end{equation} where $\widetilde{A}=A+I_N$, $I_N$ is the identity matrix, $\widetilde{D}_{ii}=\sum_j \widetilde{A}_{ij}$ and $W^{(l)}$ is a layer-specific trainable weight matrix. The activation function is $\sigma$, typically ReLU (rectified linear units), with a softmax in the last layer for graph clustering. The node embedding matrix in the $l$-th layer is $H^{(l)}\in \mathbb{R}^{N\times D}$, which contains high-level representations of the graph nodes transformed from the initial features; $H^{(0)}=I_N$. \begin{figure}[htp] \centering \includegraphics[width=0.23\textwidth,trim={0.25cm 0.3cm 1.2cm 0.55cm}, clip]{figure/specnorm_acc.eps} \includegraphics[width=0.23\textwidth,trim={0.25cm 0.3cm 1.2cm 0.55cm}, clip]{figure/specnorm_norm.eps} \caption{Accuracy and Spectral Norm as we vary $n$. The optimal decay rate $\lambda$ increases with $n$, as in Proposition~\ref{prop:opt}.} \label{fig:spec_norm} \end{figure} \begin{figure}[ht] \centering \includegraphics[width=0.23\textwidth,trim={0cm 0.1cm 0cm 0cm}, clip]{figure/heat_map_spec.eps} \includegraphics[width=0.23\textwidth,trim={0cm 0.1cm 0cm 0cm}, clip]{figure/heat_map_gcn.eps} \caption{Accuracy as we vary $\Lambda_{1,1}$ and $\Lambda_{2,2}$. Spectral Clustering(left) and GCN(right) have similar optimal decay matrix. The change probabilities are $\varepsilon_1=0.05, \varepsilon_2=0.1$.} \label{fig:heat_map} \end{figure} Figure \ref{fig:spec_norm} shows that Spectral Clustering and GCN have qualitatively similar accuracy on simulated data as we vary the decay rate $\lambda$ (the same $\lambda$ is used for all nodes). As expected from Eq.~\eqref{eq:errorbound} and Proposition~\ref{prop:opt}, the optimal decay rate $\lambda$ increases as we increase the number of nodes $n$, as does the value of $\lambda$ that minimizes the spectral norm $\|\hat{A} - P\|$. Although the optimal decay rate is consistently larger than the one minimizing the spectral norm (which upper-bounds the relative error as in Eq.~\eqref{eq:errorbound}), GCN's accuracy is more correlated with the spectral norm, which is the first singular value of the smoothed adjacency matrix. We then perform a grid search for the optimal decay matrix $\Lambda$ on simulated data with $n = 200$ nodes and change probabilities $\varepsilon_1 = 0.05$ and $\varepsilon_2 = 0.1$. As shown in Figure \ref{fig:heat_map}, GCN and Spectral Clustering achieve high accuracy. Cluster 2, which has a higher $\varepsilon_2$, has larger decay rate $\Lambda_{2,2}$, as expected from Proposition~\ref{prop:opt}, for both GCN and Spectral Clustering. \section{Decay Rates as RNNs} Although searching for the optimal decay matrix in Spectral Clustering can result in good performance, this method is expensive: the grid search for the optimal decay matrix can be time-consuming, and the time complexity of calculating the spectral norm is $\mathcal{O}(n^3)$. In this section, we propose two neural network architectures, RNNGCN and TRNNGCN, that use a single decay rate $\lambda$ and decay matrix $\Lambda$, respectively, and then show they perform well on simulated data. \subsubsection{RNNGCN} \begin{algorithm}[htp] \SetAlgoLined \SetAlgoLined \SetKwInOut{Input}{Input} \SetKwInOut{Output}{Output} \Input{Temporal graph $(A_1,A_2,...,A_T)$,\\ Membership matrix of training data $\Theta^{train}_T$} \Output{Membership matrix estimate $\hat{\Theta}_T$} $\hat{A}=A_0$, $H_0=I_N$\; \For{\text{iteration} $i=1,...,I$}{ \For{$ t=2,...,T$ }{$\hat{A}_t=(1-\lambda)\hat{A}_{t-1}+\lambda {A}_t$} $H^{(1)}=\sigma_1(\hat{A}_TH^{(0)}W^{(1)})$\\ $H^{(2)}=\sigma_2(\hat{A}_TH^{(1)}W^{(2)})$\\ CrossEntropyLoss($H^{train}$, ${\Theta}_T^{train}$)\\ Backward() } $\hat{\Theta}_T=\text{Onehot}(\argmax_{1\leq j \leq n}H_{jk}^{(2)})$ \caption{RNNGCN} \label{algo:RNNGCN} \end{algorithm} The RNNGCN model uses a single decay rate $\lambda\in[0,1]$ as the RNN parameter. RNNGCN first uses a Recurrent Neural Network to learn the decay rate, then uses a two-layer GCN to cluster the weighted graphs. The formal model is shown in Algorithm \ref{algo:RNNGCN}, where $\sigma_1$ denotes a ReLU layer and $\sigma_2$ is a Softmax layer. \subsubsection{Transitional RNNGCN (TRNNGCN)} The TRNNGCN network is similar to the RNNGCN, but uses a matrix $\Lambda\in[0,1]^{K\times K}$ to learn the decay rates for different pairs of classes. During the training process, the labels (cluster memberships) of the training nodes are known while the labels of other nodes remain unknown, so we use the cluster prediction $\hat{\Theta}_{i-1}$ from each iteration $i-1$ to determine the decay rates for each node in iteration $i$. The TRNNGCN model replaces the decay method (line 4 of Algorithm 1) with \begin{equation*} \hat{A}_t=(1-\hat{\Theta}_{i-1} \Lambda (\hat{\Theta}_{i-1})^T) \odot \hat{A}_{t-1}+\hat{\Theta}_{i-1} \Lambda (\hat{\Theta}_{i-1})^T \odot \hat{A}_t, \end{equation*} where $\odot$ denotes element-wise multiplication. After each iteration, it calculates $\hat{\Theta}_i$ as the input of the next iteration. \subsubsection{Empirical Validation} We validate the performance of RNNGCN and TRNNGCN on data generated by the dynamic stochastic block model. Our graph has 200 nodes, 23190 edges, 50 time steps and 2 clusters. The probabilities of forming an edge between two nodes of the same or different clusters are $\alpha = 0.02$ and $\tau\alpha = 0.001$, respectively, and a node changes its cluster membership with probability $\varepsilon_1 = 0.05$ and $\varepsilon_2 = 0.1$ for clusters 1 and 2 respectively. \begin{figure*}[ht] \centering \includegraphics[width=0.27\textwidth,trim={0.3cm 0 0.8cm 0.3cm}, clip]{figure/simulate_ACC.eps} \includegraphics[width=0.27\textwidth,trim={0.3cm 0 0.8cm 0.3cm}, clip]{figure/simulate_AUC.eps} \includegraphics[width=0.27\textwidth,trim={0.3cm 0 0.8cm 0.3cm}, clip]{figure/simulate_F1.eps} \caption{On simulated data with heterogeneous cluster transition probabilities, TRNNGCN and RNNGCN, which use optimized decay rates to account for historical information, outperform the static GCN and Spectral Clustering methods. TRNNGCN slightly outperforms RNNGCN.} \label{fig:simulate} \end{figure*} Figure \ref{fig:simulate} compares the RNNGCN and TRNNGCN performance with the static Spectral Clustering and GCN methods. For better visualization, the value at each time step is averaged with the 2 timesteps immediately before and after. The performance of GCN and Spectral Clustering decreases over time, as in later timesteps they use accumulated historical information that may no longer be relevant. RNNGCN and TRNNGCN show consistently high performance over time, indicating that they optimally utilize historical information. On average over time, TRNNGCN leads to 5\% accuracy and AUC (area under the ROC curve) improvement, and a 10\% higher F1-score, than RNNGCN, due to using a lower decay rate for the class with smaller change probability. \section{Experiments} In this section, we validate the performance of RNNGCN and TRNNGCN on real datasets, compared to state-of-the-art baselines. We first describe the datasets used and the baselines considered, and then present our results. \subsection{Datasets} We conducted experiments on five real datasets, as shown in Table \ref{tab:datasets}, which have the properties shown in Table \ref{tab:dataattr}. All datasets have edges that form at different times, although only nodes in DBLP-E change their class (cluster membership) over time. We include four datasets with separate, time-varying features associated with each node (DBLP-3, DBLP-5, Brain and Reddit) to test RNNGCN's and TRNNGCN's ability to generalize to datasets with node features. \begin{table}[h] \centering \begin{tabular}{ccccc} \hline Dataset& Nodes &Edges & Time Steps &Classes \\ \hline DBLP-E & 6942 & 327392 & 14 &2 \\ DBLP-3 & 4257 & 23540 & 10 &3\\ DBLP-5 & 6606 & 42815 & 10 & 5\\ Brain & 5000 & 1955488 & 12 &10\\ Reddit & 8291 & 264050 & 10 &4\\ \hline \end{tabular} \caption{Real datasets used to evaluate our methods.} \label{tab:datasets} \end{table} \begin{table}[h] \centering \begin{tabular}{ccccc} \hline Dataset& Dynamic Edge & Dynamic Class & Features\\ \hline DBLP-E & $\surd$ & $\surd$ &$\times$\\ DBLP-3 & $\surd$ & $\times$ &100\\ DBLP-5 & $\surd$ & $\times$ & 100\\ Brain & $\surd$ & $\times$ &20\\ Reddit & $\surd$ & $\times$ &20\\ \hline \end{tabular} \caption{Properties of datasets in Table~\ref{tab:datasets}.} \label{tab:dataattr} \end{table} \subsubsection{DBLP-E} dataset is extracted from the computer science bibliography website DBLP\footnote{https://dblp.org}, which provides open bibliographic information on major computer science journals and conferences. Nodes represent authors, and edges represent co-authorship from 2004 to 2018. Each year is equivalent to one timestep, and co-author edges are added in the year a coauthored paper is published. Labels represent the author research area (``computer networks'' or ``machine learning'') and may change as authors switch their research focus. \subsubsection{DBLP-3 \& DBLP-5} use the same node and edge definitions as DBLP-E, but also include node features extracted by \texttt{word2vec}~\cite{mikolov2013efficient} from the authors' paper titles and abstracts. The authors in DBLP-3 and DBLP-5 are clustered into three and five classes (research areas) respectively that do not change over time. \subsubsection{Reddit} dataset is generated from Reddit\footnote{https://www.reddit.com/}, a social news aggregation and discussion website. The nodes represent posts and two posts are connected if they share keywords. Node features are generated by \texttt{word2vec} on the post comments~\cite{hamilton2017inductive}. \subsubsection{Brain} dataset is generated from functional magnetic resonance imaging (fMRI) data\footnote{https://tinyurl.com/y4hhw8ro}. Nodes represent cubes of brain tissue, and two nodes are connected if they show similar degrees of activation during the time period. Node features are generated by principal component analysis on the fMRI. \subsection{Baselines and Metrics} We compare our RNNGCN and TRNNGCN with multiple baselines. GCN, GAT~\cite{velivckovic2017graph} and GraphSage~\cite{hamilton2017inductive} are supervised methods that include node features, while Spectral Clustering is unsupervised without features; all of these methods ignore temporal information. DynAERNN~\cite{goyal2020dyngraph2vec} is an unsupervised method, and GCNLSTM~\cite{chen2018gc} and EGCN~\cite{pareja2020evolvegcn} are supervised methods, which all utilize temporal information of both graphs and features. We evaluate the performance of methods with the standard accuracy (ACC), area under the ROC curve (AUC) and F1-score classification metrics. \subsection{Experiment Settings} We divide each dataset into 70\% training/ 20\% validation/ 10\% test points. Each method uses two hidden Graph Neural Network layers (GCN, GAT, GraphSage, etc.) with the layer size equal to the number of classes in the dataset. We add a dropout layer between the two layers with dropout rate $0.5$. We use the Adam optimizer with learning rate $0.0025$. Each method is trained with $500$ iterations. For static methods (GCN, GAT, GraphSage and Spectral Clustering) we first accumulate the adjacency matrices of graphs at each time step, then cluster on the normalized accumulated matrix. DynAERNN, GCNLSTM, and EGCN use the temporal graphs and temporal node features as input. For our RNNGCN and TRNNGCN, we use the temporal graphs and the node features at the last time step as input. The code of all methods and datasets are publicly available\footnote{https://github.com/InterpretableClustering/InterpretableClustering}. \subsection{Experimental Results} \begin{figure}[ht] \centering \includegraphics[width=0.44\textwidth]{figure/dblp_double.eps} \caption{The two classes in DBLP-E exhibit different change probabilities, with computer network authors more likely to change their labels to machine learning. This trend accelerates after 2014.} \label{fig:dblpe_num} \end{figure} \subsubsection{Node Classification with Temporal Labels} We first compare the predictions of temporally changing labels in DBLP-E. Figure \ref{fig:dblpe_num} shows the number of authors in the Machine Learning and Computer Network fields in the years 2004-2018, as well as the probabilities that authors in each class change their labels. We observe that (i) the classes have different change probabilities (with users more likely to move from computer networks to machine learning) and (ii) the change probabilities evolve over time, with more users migrating to machine learning since 2013. This dataset thus allows us to test RNNGCN's and TRNNGCN's abilities to adapt the optimal decay rate for each class. \begin{figure*}[ht] \centering \includegraphics[width=0.23\textwidth,trim={0.25cm 0cm 0.8cm 0.5cm}, clip]{figure/dblpe_ACC.eps} \includegraphics[width=0.23\textwidth,trim={0.25cm 0cm 0.8cm 0.5cm}, clip]{figure/dblpe_AUC.eps} \includegraphics[width=0.23\textwidth,trim={0.25cm 0cm 0.8cm 0.5cm}, clip]{figure/dblpe_F1.eps} \includegraphics[width=0.23\textwidth,trim={0.25cm 0cm 1.2cm 0cm}, clip]{figure/dblpe_bar.eps} \caption{On DBLP-E data, TRNNGCN and RNNGCN outperform the static GCN and spectral clustering methods and show better performance over time, indicating that they can optimize their decay rates to account for historical information. TRNNGCN slightly outperforms RNNGCN.} \label{fig:dblpe} \end{figure*} \begin{table*}[ht] \centering \begin{tabular}{ccccccccccccc} \hline & \multicolumn{3}{c|}{DBLP-3} &\multicolumn{3}{c|}{DBLP-5} &\multicolumn{3}{c|}{Reddit} &\multicolumn{3}{c}{Brain}\\ \hline & ACC&AUC&F1& ACC&AUC&F1&ACC&AUC&F1&ACC&AUC&F1 \\ \hline GCN&71.6&62.2&35.8&64.9&51.0&\textbf{\textit{58.7}}&31.0&24.5&47.4&35.2&25.0&80.3\\ GAT&70.9&59.4&57.8&62.3&48.2&51.4&16.8&4.8&50.0&34.6&26.4&81.6\\ GraphSage &74.5&63.6&55.0&\textbf{\textit{66.5}}&53.9&55.1&29.2&20.7&42.5&\textbf{44.2}&\textbf{\textit{41.9}}&\textbf{86.7}\\ Spectral&45.7&51.6&51.2&43.8&45.6&51.3&30.1&24.1&51.7&42.7&41.7&68.1\\ DynAERNN &48.1&54.2&50.8&33.1&39.1&51.2&31.1&\textbf{31.7}&\textbf{54.1}&20.5&20.3&55.6\\ GCNLSTM&74.5&63.6&48.4&\textbf{\textit{66.5}}&53.2&54.6&31.9&25.5&46.1&38.8&32.9&\textbf{\textit{85.9}}\\ EGCN&72.3&60.7&48.1&63.2&50.6&53.2&28.3&12.5&50.0&28.6&26.1&73.7\\ RNNGCN&\textbf{\textit{75.9}}&\textbf{\textit{68.0}}&\textbf{\textit{66.7}}&65.7&\textbf{\textit{55.4}}&58.6&\textbf{33.6}&20.5&49.7&41.0&38.6&84.7\\ TRNNGCN&\textbf{78.0}&\textbf{72.1}&\textbf{73.8}&\textbf{67.4}&\textbf{57.9}&\textbf{63.5}&\textbf{33.6}&\textbf{\textit{25.6}}&\textbf{\textit{53.2}}&\textbf{\textit{43.8}}&\textbf{42.4}&85.7\\ \hline \end{tabular} \caption{TRNNGCN consistently achieves the best (bold) or second-best (bold italics) accuracy (ACC), area under the ROC curve (AUC), and F1 score compared to baseline algorithms on four temporal datasets.} \label{tab:result_temporal} \end{table*} Figure \ref{fig:dblpe} shows the performance of RNNGCN and TRNNGCN in DBLP-E. Similar to Figure~\ref{fig:simulate}'s result on the simulated data, GCN's performance decreases over time as the accumulated effect of class change increases. Spectral Clustering consistently performs poorly since it cannot learn the high-dimensional patterns of the DBLP-E graph. RNNGCN and TRNNGCN maintain good performance and fully utilize the temporal information. As the two classes have different change probabilities, TRNNGCN learns a better decay rate and performs better. We further show the average accuracy, AUC, and F1-score for each baseline method at each timestep; RNNGCN and TRNNGCN consistently outperform the other baselines. GCNLSTM comes the closest to matching their performance. GCNLSTM uses a LSTM layer to account for historical information, which is similar to our methods but lacks interpretability as the LSTM operates on the output of the GCN layer (which is not readily interpretable) instead of the original graph adjacency information. We use a RNN instead of LSTM layer in our algorithms for computational efficiency. \textbf{Node Classification with Temporal Features} Although our analysis is based on dynamic networks without features, Table \ref{tab:result_temporal}'s performance results demonstrate the applicability of our RNNGCN and TRNNGCN algorithms to the DBLP-3, DBLP-5, Brain, and Reddit datasets with node features. TRNNGCN achieves the best or second-best performance consistently on all datasets, even outperforming EGCN and GCNLSTM, which unlike TRNNGCN fully utilize the historical information of node features. While GraphSAGE shows good accuracy, AUC, and F1-score on the Brain dataset, no other baseline method does well across all three metrics for any other dataset. RNNGCN performs second-best on DBLP-3 but worse on the other datasets, likely because those datasets have more than three classes, which would likely have different optimal decay rates. TRNNGCN can account for these differences, but RNNGCN cannot. We further highlight the importance of taking into account historical information by noting that the static baselines (GCN, GAT, GraphSAGE, and spectral clustering) generally perform poorly compared to the dynamic baselines (DynAERNN, GCNLSTM, EGCN). DynAERNN can perform significantly worse than GCNLSTM and EGCN, likely because it is an unsupervised method that cannot take advantage of labeled training data. Thus, RNNGCN and TRNNGCN's good performance is likely due to their ability to optimally take advantage of historical graph information, even if they cannot use historical node feature information. \section{Conclusion} This work proposes RNNGCN and TRNNGCN, two new neural network architectures for clustering on dynamic graphs. These methods are inspired by the insight that RNNs progressively decrease the weight placed on their inputs over time according to a learned decay rate parameter. This decay rate can in turn be interpreted as the importance of historical connection information associated with each community or cluster in the graph. We show that decaying historical connection information can achieve almost exact recovery when used for spectral clustering on dynamic stochastic block models, and that the RNN decay rates on simulated data match the theoretically optimal decay rates for such stochastic block models. We finally validate the performance of RNNGCN and TRNNGCN on a range of real datasets, showing that TRNNGCN consistently outperforms static clustering methods as well as previously proposed dynamic clustering methods. This performance is particularly remarkable compared to dynamic clustering methods that account for historical information of both the connections between nodes and the node features; TRNNGCN ignores the historical feature information. We plan to investigate neural network architectures that reveal the importance of these dynamic node features in our future work. Much work also remains on better establishing the models' interpretability. \newpage \section*{Acknowledgements} This research was partially supported by NSF grant CNS-1909306. The authors would like to thank Jinhang Zuo, Mengqiu Teng and Xiao Zeng for their inputs to the work. \section{Model} We first introduce a dynamic version of the Stochastic Block Model (SBM) often used to study graph clustering~\cite{holland1983stochastic,abbe2017community}, which we will use for our theoretical analysis in the rest of the paper. \subsection{Stochastic Block Model} For positive integers $K$ and $n$, a probability vector $p\in [0,1]^K$, and a symmetric connectivity matrix $B\in[0,1]^{K\times K}$, the SBM defines a random graph with $n$ nodes split into $K$ clusters. The goal of a prediction method for the SBM is to correctly divide nodes into their corresponding clusters, based on the graph structure. Each node is independently and randomly assigned a cluster in $\{1,...,K\}$ according to the distribution $p$; we can then say that a node is a ``member'' of this cluster. Undirected edges are independently created between any pair of nodes in clusters $i$ and $j$ with probability $B_{ij}$, where the $(i,j)$ entry of $B$ is \begin{equation} B_{ij}=\left\{ \begin{aligned} \alpha& ,\;i=j\\ \tau \alpha & ,\;i\neq j, \end{aligned} \right. \end{equation} for $\alpha\in(0,1)$ and $\tau\in(0,1)$, implying that the probability of an edge forming between nodes in the same cluster is $\alpha$ (which is the same for each cluster) and the edge formation probability between nodes in different clusters is $\tau \alpha$. Let $\Theta \in {\{0,1\}}^{n\times K}$ denotes the matrix representing the nodes' cluster memberships, where $\Theta_{ik}=1$ indicates that node $i$ belongs to the $k$-th cluster, and is $0$ otherwise. We use $A\in\{0,1\}^{n \times n}$ to denote the (symmetric) adjacency matrix of the graph, where $A_{ij}$ indicates whether there is a connection (edge) between node $i$ and node $j$. From our node connectivity model, we find that given $\Theta$, for $i<j$, we have \begin{equation} A_{ij}|\{\Theta_{ik}=1,\Theta_{jl}=1\} \backsim \text{Ber}(B_{kl}), \end{equation} where $\text{Ber}(p)$ indicates a Bernoulli random variable with parameter $p$. We define $A_{ii}=0$ (nodes are not connected directly to themselves) and since all edges are undirected, $A_{ij}=A_{ji}$. We further define the connection probability matrix $P=\Theta B \Theta^T \in [0,1]^{n\times n}$, where $P_{ij}$ is the connection probability of node $i$ and node $j$ and $\mathbb{E}[A]=P-\text{diag}(P)$. \subsection{Dynamic Stochastic Block Model} We now extend the SBM model to include how the graph evolves over time. We consider a set of discrete time steps $t = 1,2,\ldots,T$. At each time step $t$, the Dynamic SBM generates new intra- and inter-cluster edges according to the probabilities $\alpha$ and $\tau\alpha$ as defined for the SBM above. All edges persist over time. We assume a constant number of nodes $n$, number of clusters $K$, and connectivity matrix $B$, but the node membership matrix $\Theta_t$ depends on time $t$, i.e., nodes' cluster memberships may change over time. We similarly define the connectivity matrix $P_t = \Theta_t B (\Theta_t)^T$. We model changes in nodes' cluster memberships as a Markov process with a constant transition probability matrix $H\in[0,1]^{K\times K}$. Let $\varepsilon_j\in(0,1)$ denotes the change probability of nodes in cluster $j$, i.e., the probability a node in cluster $j$ changes its membership. At each time step, node $v_i$ in cluster $j$ changes its membership to cluster $k$ with the following probability (independently from other nodes): \begin{equation*} H_{j,k}=\mathbb{P}\left[\Theta_{ik}^{t}=1|\Theta_{ij}^{t-1}=1\right]=\left\{ \begin{aligned} 1-\varepsilon_j & , & j=k\\ \frac{\varepsilon_{j}}{K-1} & , & j\neq k, \end{aligned} \right. \end{equation*} Note that $\varepsilon_j$ may be specific to cluster $j$, e.g., if some clusters experience less membership turnover. We give an example of such a graph in our experimental evaluation. The goal of a clustering algorithm on a graph is to recover the membership matrix $\Theta$ up to column permutation. Static clustering algorithms give an estimate $\hat{\Theta}$ of the node membership; a dynamic clustering algorithm should produce such an estimate for each time $t$. We define two performance metrics for these estimates (in dynamic graphs, they may be evaluated for an estimate $\hat{\Theta} = \hat{\Theta}_t$ relative to $\Theta = \Theta_t$ at any time $t$): \begin{definition} [Relative error of $\hat{\Theta}$] The relative error of a clustering estimate $\hat{\Theta}$ is \begin{equation} E(\hat{\Theta},\Theta)=\frac{1}{n} \min_{\pi\in \mathcal{P}} \|\hat{\Theta} \pi-\Theta\|_0, \end{equation} where $\mathcal{P}$ is the set of all $K\times K$ permutation matrices and $\|.\|_0$ counts the number of non-zero elements of a matrix. \end{definition} \begin{definition} [Almost Exact Recovery] A clustering estimate $\hat{\Theta}$ achieves almost exact recovery when \begin{equation} \mathbb{P}\left[1- \frac{1}{n} \min_{\pi\in \mathcal{P}} \|\hat{\Theta} \pi-\Theta\|_0=1-o(1)\right]=1-o(1). \end{equation} which also implies that the expectation of $E(\hat{\Theta},\Theta)$ is $o(1)$. \end{definition} Our goal is then to find an algorithm that produces an estimate $\hat{\Theta}$ minimizing $E(\hat{\Theta},\Theta)$. In the next section, we discuss the well-known (static) spectral clustering algorithm and analyze a simple decay-based method that allows a static algorithm to make dynamic membership estimates. \section{Related Work} Over the past few years, there has been significant research dedicated to graph clustering algorithms, motivated by applications such as community detection in social networks. While some works consider theoretical analysis of such clustering algorithms, more recently representation learning algorithms have been proposed that perform well in practice with few theoretical guarantees. We aim to \emph{connect} these approaches by using a theoretical analysis of decay-based dynamic clustering algorithms to design a new neural network-based approach that is easily interpretable. \textbf{Theoretical analyses.} Traditional spectral clustering algorithms use the spectrum of the graph adjacency matrix to generate a compact representation of the graph connectivity~\cite{lei2015consistency,qin2013regularized}. A line of work on static clustering algorithms uses the stochastic block model for graph connectivity~\cite{abbe2017community}, which more recent works have extended to a dynamic stochastic block model~\cite{keriven2020sparse,pensky2019spectral}. While these works do not distinguish between clusters with different transition probabilities, earlier models incorporate such heterogeneity~\cite{xu2015stochastic}. Other works use a Bayesian approach~\cite{yang2011detecting}, scoring metrics~\cite{agarwal2018dyperm,zhuang2019dynamo}, or multi-armed bandits~\cite{mandaglio2019dynamic} to detect communities and their evolution, while~\citet{xu2010evolutionary} use a decay rate similar to the one we propose. As \textbf{representation learning} becomes popular, graph neural networks~\cite{zhang2018link,wu2020comprehensive,kipf2016semi} such as GraphSage~\cite{hamilton2017inductive} have been used to cluster nodes in graphs based on (static) connections between nodes and node features. Graph Attention Networks (GAT)~\cite{velivckovic2017graph,xu2019self} use attention-based methods to construct a neural network that highlights the relative importance of each feature, while dynamic supervised~\cite{kumar2019predicting} and unsupervised~\cite{goyal2020dyngraph2vec} methods can track general network dynamics, or may be designed for clustering on graphs with dynamic edges and dynamic node features~\cite{chen2018gc,xu2019spatio,xu2020inductive}. EvolveGCN~\cite{pareja2020evolvegcn} usesa GCN to evolve the RNN weights, which is similar to our approach; however, we ensure interpretability of the RNN weights by placing the RNN before the GCN layers, which we show improves the clustering performance. Finally, several works have considered the \textbf{interpretability of general GCN and RNN structures}~\cite{dehmamy2019understanding,liang2017interpretable,guo2019exploring}, such as GNNExplainer~\cite{ying2019gnnexplainer}. In the context of graph clustering, some works have used attention mechanisms to provide interpretable weights on node features~\cite{xu2019spatio}, but attention may not capture true feature importance~\cite{serrano2019attention}. Moreover, these works do not consider the importance of \emph{historical} information, as we consider in this work.
{'timestamp': '2021-06-24T02:03:28', 'yymm': '2012', 'arxiv_id': '2012.08740', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08740'}
arxiv
\section{Introduction} The \ac{iot} provides a number of benefits, to consumers as well as business organisations. Flexibility and ease of use, coupled with low management overhead and cost make it a desirable concept. Smart cities, for example, can benefit from \ac{iot} solutions~\cite{formisano2015advantages}, as well as cloud applications~\cite{nastic2014provisioning}. For business organisations, logistics and asset management can be aided by the \ac{iot}~\cite{ding2013study}. The \ac{iot} is characterised by its heterogeneity, as an abundance of different devices can constitute an \ac{iot}. Communication as well as embedded computation capabilities mark the common denominator on which \ac{iot} devices and networks depend. While these features are a given in the age of constant mobile connectivity and open \acp{wlan}, they also constitute the vulnerabilities of \ac{iot} networks. Being connected to networks leads to an increased attack surface. Furthermore, \ac{iot} devices are often cheap and manufactured in large numbers for short periods of time, until they become obsolete. After that, newer versions are produced, often for small prices. Consequently, re-use of hard- and software as well as low effort in programming contribute to insecure operating conditions~\cite{Spring.2016}. The \ac{iot} is but a part of the development towards increased connectivity that inherently carries higher risks of cyber attacks. Botnets targeting \ac{iot} devices, such as \textit{Mirai}~\cite{kolias2017ddos}, industrial environments falling prey to attackers, such as the power grid in the Ukraine in December 2015~\cite{Cherepanov.2017}, and ransomware attacks on healthcare infrastructure~\cite{slayton2018ransomware} and consumers~\cite{richardson2017ransomware} alike show the need for increased automated security in this brave new digital world. As the networking paradigms are shifting from classic home and office networks to heterogeneous ad hoc networks, security solutions have to adapt as well~\cite{Plaga.2019}. Offensive security measures become an administrators friend to discover vulnerabilities along the attack phases. By preemptive security, such as vulnerability checking, threats can be mitigated before an attacker can exploit them. These capabilities are more relevant in the heterogeneous environments presented today. Furthermore, an insight regarding methods as well as tools of cyber criminals is becoming crucial for \ac{it} security professionals. Since criminals often rely on publicly available tools, an understanding of those allows security professionals to gain insight about the threat potential and possible attack vectors. Furthermore, if \ac{it} security professionals adapt to the methodology of a cyber criminal, they obtain a new understanding of attacking a system, potentially allowing for a more suited defense against attacks. Additionally, any vulnerability found by methods and tools of attackers is a vulnerability that can be mitigated before a real attack occurs. The contribution of this work is \begin{itemize} \item the identification and collection of the most well-known and used open source security assessment tools and \item the mapping of these tools to well-established attack models and. \item the analysis, comparison and discussion of the capabilities of these tools. \end{itemize} The remainder of this work is structured as follows. The state of the art is presented in Section~\ref{sec:sota}. The methodology underlying this paper is introduced in Section~\ref{sec:methodology}. The tools are introduced and evaluated in Section~\ref{sec:offsec_tools}. A conclusion is drawn in Section~\ref{sec:conc}. \section{State of the Art} \label{sec:sota} There is an abundance in literature regarding tools for offensive security purposes, in numerous blogs, but also in specialist books. However, an objective indication why the tools were chosen to be presented is not provided. Either they are used and recommended by the author, who usually is a security professional that has built a tool-box for themselves. Or the tools are contained in a suite, such as Kali Linux~\cite{kalilinux}. \textit{Velu} presents the usage of Kali Linux for penetration testing in his book, discussing the tools he deems most relevant~\cite{Velu.2016}. \textit{Oakley} introduces red teaming in his book, where tools are introduced in the respective stages based on experience of the author~\cite{Oakley.2019}. \textit{Kim} presents practical penetration testing with the tools chosen in a similar fashion~\cite{Kim.2018}. \textit{Forshaw} reduces the focus to tools for attacking network protocols, thus setting a scope~\cite{Forshaw.2017}. However, the tools chosen are derived from his long experience. In general, it is beneficial to have tools introduced by professionals with a long experience in the fields, as they took a long time to chose the right tool-box and become acquainted with it. In this work, however, the focus is on creating tangible, objective criteria for rating offensive security tools. \section{Methodology} \label{sec:methodology} This section presents the methodology on which this work is founded. First, definitions of the terms are presented, after that, the sources from which the tools are collected. Furthermore, the scope of tools and applications is discussed, a metric for attack stages is presented as well as the feature criteria of the tools. \subsection{Definitons} \label{ssec:definitions} This paragraph presents the definitions of terms used in this work that are underlying to the evaluation. \par \textit{Offensive information security}: Often called red teaming or penetration testing. It is a concept that describes using tools and methods of an attacker to detect security vulnerabilities which then can be fixed before an attacker can exploit them. \par \textit{Tool}: Finding a definition of the term tool in the context of software is exceedingly difficult. For this work, a tool is defined as a software program that can be used as such without further software, except for operating system and corresponding environment. A tool can consist of related parts that could be used in a stand alone-fashion, but are distributed and commonly used together as they follow purposes along the path of a security assessment. \par \textit{Freeware}: In the context of this work, this term describes tools which can be obtained by private persons and professionals alike free of charge. The free usage is not limited regarding the time of usage, so trial versions of commercial software are not considered. They are not specific to organisations. \par \textit{Enterprise networks}: Consisting of \ac{it} infrastructures, such as computers and servers. Specifically excluded are \ac{ot} environments as found in industrial environments. \subsection{Data Sources} As the collection of exhaustive, consistent lists of security tools with their attribution to a specific attack phase is difficult, several sources were considered when identifying tools to evaluate in this work. First, the literature presented in Section~\ref{sec:sota} was used to extract the tools the authors used. Second, comprehensive lists that can be found online were employed. The nmap project~\cite{nmap} provides a list of security tools, called sectools~\cite{sectools}. Furthermore, \textit{r0lan} provides an overview of tools that is attributed to the phases they are used in~\cite{awesome-red-teaming}. From these sources, the most relevant tools were extracted. Third, well-known security distributions such as Kali~\cite{kalilinux} and Parrot~\cite{parrotlinux} Linux contain the tools that are most established in the security community. \subsection{Scope} The scope of this work are enterprise networks as discussed in Section~\ref{ssec:definitions}, consisting of computers, servers and auxiliary devices. Furthermore, the scope regarding the tools is limited on tools with a security focus. Since there is a trend in security research as well as cyber criminals to use tools that are already installed on the target machine for exploitation purposes, many tasks in security assessment can be performed without security-specific tools. This technique is called living off the land. An example is the use of Microsoft PowerShell for enumerating users and directories. \subsection{Attack Metrics: MITRE ATT\&CK} \label{sec:attack_metrics} The MITRE ATT\&CK matrix~\cite{mitre} was developed based on the well-established Lockheed Martin Cyber Kill Chain~\cite{cyberkillchain}. Both aim at splitting a cyber attack into distinct phases during which an attacker follows a certain goal. This is used to aid in comprehending the objectives of an attack and ultimately mitigating it. The structure of the MITRE ATT\&CK model is shown in Figure~\ref{fig:mitre}. \begin{figure*} \includegraphics[width=\textwidth,height=7cm]{crop.pdf} \caption{MITRE ATT\&CK Model} \label{fig:mitre} \end{figure*} Each of these phases requires a different set of tools, so the aim of this work is mapping tools to these phases as discussed in Section~\ref{sec:offsec_tools}. The phases used in the MITRE ATT\&CK Enterprise matrix are as follows, with the description according to the MITRE-homepage~\cite{mitre}. \par \textit{Reconnaissance}: The phase during which an adversary collects information about the target. Generally, reconnaissance techniques are categorised in active, i.e. with the adversary interacting with the target system in an unexpected way, and passive, i.e. the adversary not directly interacting with the target system.\par \textit{Resource Development}: The adversary is obtaining resources that can aid in attacking the system, such as accounts, systems, and other capabilities. The resources might be used in later phases, such as \ac{cc}.\par \textit{Initial Access}: The adversary attempts to gain an initial foothold on the target system. This is the first phase with direct adversarial action on the target.\par \textit{Execution}: The adversary executes malicious code on the target system. This code execution usually follows an underlying goal. Often, on-board capabilities of the target system, such as compilers and interpreters, aid in the execution of malicious code.\par \textit{Persistence}: The phase in which the adversary aims to secure the foothold. Persistence allows re-entry and access to the system after the adversary logged out or the system rebooted.\par \textit{Privilege Escalation}: In this phase, the adversary aims at obtaining higher privileges. Often, certain users are restricted from performing security-critical tasks, and the first foothold was performed with such restricted accounts. Elevating privileges allows the adversary to perform a wider variety of actions.\par \textit{Defense Evasion}: After gaining access and elevating the privileges, the adversary actively evades detection by \ac{ids}. Obfuscation of the tools as well as deactivation of security measures are performed in this phase.\par \textit{Credential Access}: The adversary aims at stealing account credentials for further use and to aid in following phases.\par \textit{Discovery}: In this phase, the adversary is gaining information about the environment in which the target system is located. This includes machines and services, accounts and users.\par \textit{Lateral Movement}: In this phase, the adversary is moving through the target environment and infecting new systems. Often, the foothold with which entry to the network was gained does not contain the desired target, so lateral movement is necessary to reach devices that are not directly reachable from the outside.\par \textit{Collection}: In this phase, the adversary gathers the desired information from the target machine.\par \textit{Command and Control (C\&C)}: In this phase, the adversary executes control over the targeted systems and communicates with them.\par \textit{Exfiltration}: The phase in which the adversary attempts to steal and obtain data without the owner of the target system noticing. The data has to be sent in a fashion that does not cause suspicion.\par \textit{Impact}: In this phase, the adversary maliciously impacts the target system by destroying or restricting its functionality. This activity can easily be detected by the owner of the system.\par \subsection{Tool Features} In order to evaluate and rate the tools, a metric needs to be defined. This metric should contain tangible, verifiable features. The features used in this work are listed as follows: \begin{itemize} \item Actively maintained: This feature is evaluated according to the latest release and the average number of releases per year. Actively maintained tools provide bug fixes and the integration of new features and protocols as well as a more active support. \item Usage: This feature discusses the licence a tool is published under, the support a user can expect and whether or not a paid version of the tool is available. \item Technical: This feature describes the interface of the tool for a user as well as the programming language the tool is programmed in. This is important as the way of interaction can make a tool more difficult or easier to apply, while the programming language in open source tools describes whether or not a user could adapt and extend the tool. \end{itemize} These features allow an assessment of the tools according to several dimensions. It can be derived if the tool is actively developed and likely to be adapted to new technologies. Furthermore, the capabilities for extending and embedding the tool into a toolchain can be obtained from these features. \section{Analysis} \label{sec:offsec_tools} In this section the relevant tools are identified and the metric is applied for comparison. Then, the results for the comparison are discussed. \subsection{Identification} For the evaluation, well-established, commonly used security tools tailored for each of the phases as presented in Section~\ref{sec:attack_metrics} were identified, collected and compared. As it is not trivial to find an exhaustive overview of security tools, several sources were used to obtain information. Apart from books presented in Section~\ref{sec:sota}, web resources were considered as well. The nmap network scanner~\cite{nmap} hosts a list of security tools~\cite{sectools}. Every tool that fits the scope of this work in the top 50 tools of the sectools-list is evaluated in this work. Thus, a good coverage of relevant tools is expected. Furthermore, \textit{r0lan} provides an overview of tools commonly used for the individual phases~\cite{awesome-red-teaming}. Among links to tools, \textit{r0lan} provides an abundance of sources that describe methods rather than tools, and information how to employ tools without a first focus on security, such as PowerShell, to perform security-relevant tasks. From these sources, the most used tools were extracted. They are listed in Table~\ref{tab:methodology_vulnerabilities_siemens_overview}, categorised according to the phases of the MITRE ATT\&CK metric. \subsection{Comparison} The tools identified in the previous subsection are listed in Table~\ref{tab:methodology_vulnerabilities_siemens_overview}, with the criteria alongside which they are evaluated. \begin{table*}[ht] \renewcommand{\arraystretch}{1.3} \caption{Security Assessment Tools Categorised According to the Phases They Are Used During} \label{tab:methodology_vulnerabilities_siemens_overview} \centering \scriptsize \begin{tabular}{l c c c c c c c c c c c} \toprule \textbf{Tools} & \phantom{a} & \multicolumn{3}{c}{\textbf{Releases}} & \phantom{a} & \multicolumn{3}{c}{\textbf{Usage aspects}} & \phantom{a} & \multicolumn{2}{c}{\textbf{Technical aspects}} \\ & & First & p.a. & Latest & & Licence & Supp. & Paid & & Interf. & Lang. \\ \cmidrule{1-1} \cmidrule{3-5} \cmidrule{7-9} \cmidrule{11-12} \textbf{Reconnaissance} \\ nmap~\cite{nmap} & & 1997 & 10 & 2020 & & Nmap Publ. Src. & Forum & no & & GUI, CLI & Lua, C, C++, Python, Shell \\ OpenVAS~\cite{openvas} & & 2006 & 9 & 2020 & & GNU GPLv2 2.0 & Forum & no & & GUI, CLI & C, NASL, Yacc, Shell, C++ \\ Maltego~\cite{maltego} & & 2007 & 11 & 2020 & & Proprietary & Forum & yes & & GUI & Java \\ Shodan~\cite{shodan} & & 2009 & n/a & 2020 & & Proprietary & Forum & yes & & WUI, CLI & n/a \\ TheHarvester~\cite{theharvester} & & 2011 & 3 & 2020 & & GPLv2 & Forum & no & & CLI & Python \\ \cmidrule{1-1} \cmidrule{3-5} \cmidrule{7-9} \cmidrule{11-12} \textbf{Initial Access} \\ Aircrack-ng~\cite{aircrackng} & & 2006 & 2 & 2020 & & GPLv2 & Forum & no & & GUI, CLI & C, M4, C\#, Shell, Python, Roff \\ GoPhish~\cite{gophish} & & 2013 & 2 & 2020 & & MIT & GitHub & no & & WUI, CLI & Go, JavaScript \\ msf~\cite{msf} & & 2014 & 2 & 2020 & & Apache 2.0 & Forum & no & & GUI, CLI & C++ \\ \cmidrule{1-1} \cmidrule{3-5} \cmidrule{7-9} \cmidrule{11-12} \textbf{Persistence} \\ C99 webshell~\cite{c99webshell} & & 2005 & n/a & n/a & & n/a & n/a & no & & CLI & PHP \\ Reptile~\cite{reptile} & & 2018 & 1 & 2020 & & n/a & n/a & no & & CLI & C, C++, Yacc, Perl, Shell \\ SharPersist~\cite{sharpersist} & & 2019 & 1 & 2020 & & Apache 2.0 & Forum & no & & CLI & C\# \\ \cmidrule{1-1} \cmidrule{3-5} \cmidrule{7-9} \cmidrule{11-12} \textbf{Privilege Escalation} \\ searchsploit~\cite{searchsploit} & & 2014 & n/a & 2020 & & GPL-2.0 & Forum & no & & CLI & C, Python, Ruby, Perl, PHP \\ msf~\cite{msf} & & 2014 & 2 & 2020 & & Apache 2.0 & Forum & yes & & GUI, CLI & C++ \\ \cmidrule{1-1} \cmidrule{3-5} \cmidrule{7-9} \cmidrule{11-12} \textbf{Defense Evasion} \\ veil-evasion~\cite{veil-evasion} & & 2015 & 21 & 2016 & & GPL-3.0 & Forum & no & & CLI & Python, C, Shell, C++ \\ shellter~\cite{shellter} & & 2014 & 14.7 & 2017 & & special & Forum & yes & & CLI & n/a \\ msf~\cite{msf} & & 2014 & 2 & 2020 & & Apache 2.0 & Forum & yes & & GUI, CLI & C++ \\ \cmidrule{1-1} \cmidrule{3-5} \cmidrule{7-9} \cmidrule{11-12} \textbf{Credential Access} \\ LaZange~\cite{lazagne} & & 2015 & 3.6 & 2019 & & LGPL-3.0 & Forum & no & & CLI & Python \\ Responder~\cite{responder} & & 2014 & 7.5 & 2015\footnotemark & & GPL-3.0 & Forum & no & & CLI & Python \\ Mimikatz~\cite{mimikatz} & & 2007 & 0.5 & 2020 & & CC-BY 4.0 & Forum & no & & CLI & C \\ msf~\cite{msf} & & 2014 & 2 & 2020 & & Apache 2.0 & Forum & no & & GUI, CLI & C++ \\ \cmidrule{1-1} \cmidrule{3-5} \cmidrule{7-9} \cmidrule{11-12} \textbf{Discovery} \\ linuxprivchecker~\cite{linuxprivchecker} & & 2015 & n/a & 2020 & & - & Forum & no & & CLI & Python \\ windows-privesc-check~\cite{windows-privesc-check} & & 2010 & n/a & 2015 & & GPL-2.0 & Forum & no & & CLI & Python \\ Bloodhound~\cite{bloodhound} & & 2016 & 7 & 2020 & & GPL-3.0 & Forum & no & & GUI, CLI & C++ \\ \cmidrule{1-1} \cmidrule{3-5} \cmidrule{7-9} \cmidrule{11-12} \textbf{Lateral Movement} \\ Mimikatz~\cite{mimikatz} & & 2007 & 0.5 & 2020 & & CC-BY 4.0 & Forum & no & & CLI & C \\ Rubeus~\cite{rubeus} & & 2018 & n/a & 2020 & & BSD 3-clause & Forum & no & & CLI & C\# \\ msf~\cite{msf} & & 2014 & 2 & 2020 & & Apache 2.0 & Forum & yes & & GUI, CLI & C++ \\ \cmidrule{1-1} \cmidrule{3-5} \cmidrule{7-9} \cmidrule{11-12} \textbf{Collection} \\ Veil-Pillage~\cite{veil-pillage} & & 2014 & n/a & 2015 & & GPL-3.0 & Forum & no & & CLI & PowerShell, Python \\ msf~\cite{msf} & & 2014 & 2 & 2020 & & Apache 2.0 & Forum & yes & & GUI, CLI & C++ \\ \cmidrule{1-1} \cmidrule{3-5} \cmidrule{7-9} \cmidrule{11-12} \textbf{Command and Control} \\ empire~\cite{empire} & & 2015 & 4.33 & 2018\footnotemark[\value{footnote}] & & BSD 3-clause & Forum & no & & CLI & PowerShell, Python \\ msf~\cite{msf} & & 2014 & 2 & 2020 & & Apache 2.0 & Forum & yes & & GUI, CLI & C++ \\ \cmidrule{1-1} \cmidrule{3-5} \cmidrule{7-9} \cmidrule{11-12} \textbf{Exfiltration} \\ DET~\cite{det} & & 2016 & n/a & 2019 & & MIT & Forum & no & & CLI & Python \\ Cloakify-Factory~\cite{cloakifyfactory} & & 2018 & 4 & 2018 & & MIT & Forum & no & & GUI, CLI & Python \\ msf~\cite{msf} & & 2014 & 2 & 2020 & & Apache 2.0 & Forum & yes & & GUI, CLI & C++ \\ \cmidrule{1-1} \cmidrule{3-5} \cmidrule{7-9} \cmidrule{11-12} \textbf{Impact} \\ Veil-Pillage~\cite{veil-pillage} & & 2014 & n/a & 2015 & & GPL-3.0 & Forum & no & & CLI & PowerShell, Python \\ msf~\cite{msf} & & 2014 & 2 & 2020 & & Apache 2.0 & Forum & yes & & GUI, CLI & C++ \\ \bottomrule \end{tabular} \end{table*} \footnotetext{These tools are indicated to be no longer actively maintained.} It can be seen that the first stage has the most extensive number of tools available. Most tools are still actively maintained, meaning new releases are provided at the time of this work. However, a few tools, empire~\cite{empire} and Responder~\cite{responder}, are indicated to be deprecated. Furthermore, several tools, Veil-Evasion~\cite{veil-evasion}, Veil-Pillage~\cite{veil-pillage} shellter~\cite{shellter}, windows-privesc-check~\cite{windows-privesc-check}, and Cloakify-Facory~\cite{cloakifyfactory} have their latest releases older than a year, which indicates limited maintenance of these tools. Since most versions are free, do not have a paid version and are developed by members of the community, most support is provided in terms of forums or mailing lists. Every tool provides a \ac{cli}, some tools additionally provide a \ac{gui} or \ac{wui}. The \ac{cli}-capabilities allow for the tool to be integrated into toolchains, with the output being piped into other applications. Furthermore, since a number of tools is written in Python, integration of the source code into user tools is easily possible. All tools, except for Maltego~\cite{maltego} and shellter~\cite{shellter}, provide their code for a user to extend and adapt. \subsection{Discussion} The features based on which the tools are evaluated are intended to provide information for a user to pick a tool that fits her need. Furthermore, the quality and suitability of tools, as well as their versatility is evaluated. For example, msf~\cite{msf} can be used in nine of 14 phases, making it the most versatile and powerful tool in this comparision. This is due to the toolbox-approach that allows msf to load different modules for specific tasks. Furthermore, research underlying this work shows that some phases have significantly more tools created for them than others. For example, the execution phase does not have a singular tool dedicated to it. Instead, board measures of the target system are used, or tools that are not security-specific, such as web servers or communication tools. Furthermore, the variety of tools, especially in the reconnaissance-phase, is an indicator of knowledge and experience an \ac{it} security professional should have. \section{Conclusion} \label{sec:conc} This work highlights a few insights. First, there is a plethora of \ac{it} security assessment tools available that can be used by professionals as well as cyber criminals. Being aware of these tools and gaining familiarity is therefore crucial for security experts. The majority is freely available and actively maintained, with examples and help readily available. Second, some phases have more tools dedicated to them than others. Reconnaissance has an abundance of publicly available tools solely for the purpose of gathering information that can be used to exploit a target. The initial access phase has several tools as well, as attacks can be aimed at different types of targets. For example, there is a number of tools to attack websites, a different set of tools for attacking databases and further tools for other attack vectors. Understanding these as a professional is crucial for hardening any potential attack vector and preventing attacks from happening in the first place. Other phases rely on tools already available on the target systems, such as programming compilers and interpreters, PowerShell, netcat and other tools. These can be misused to perform malicious activity, a fact of which \ac{it} security professionals need to be aware of as well. This living off the land can be discussed in a future work, as there is an abundance of tools that can be misused under the right circumstances. Furthermore, tools for cracking passwords and for monitoring and exploiting wireless devices were not considered in this work, as they would exceed the scope. An exhaustive overview of such tools can be discussed in a future work as well. This work shows that gaining insight about attacks is crucial for defense. A method commonly used to obtain information about attackers, their tools and aims is honeypots~\cite{Fraunholz.2017c,Fraunholz.2017h}. Attributing attackers and attacks is similarly important in order to implement counter measures suitable for the attacks which are identified as most likely or having most impact~\cite{Fraunholz.2017f}. In general, detecting attacks is becoming increasingly difficult due to the changes in \ac{it} infrastructure. Using context information~\cite{Duque_Anton.2017c}, employing novel machine learning approaches~\cite{anton2019anomaly} and creating and providing data to train \acp{ids}~\cite{Duque_Anton.2019a} on are required to secure \ac{it} network against current and future attacks.
{'timestamp': '2020-12-17T02:13:09', 'yymm': '2012', 'arxiv_id': '2012.08811', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08811'}
arxiv
\section{Introduction} Robots are predicted to increasingly participate in everyday life of humans over the next decade, but so far most research applications deal with interactions between a robot and a single human. However, if robots are to perform general tasks such as pick-up and delivery in public spaces, they will need to be able to cope and interact with large crowds. This poses a specific challenge for navigation control, where robots are supposed to move fast and efficient, while not endangering the safety of humans walking about in the same location. Most work so far on robot navigation in environments with moving obstacles has been focused on a combination of pathfinding algorithms and human behaviour prediction \cite{bai2015intention}. However, more recently, reinforcement learning has been proposed for robot navigation through crowds \cite{chen2017decentralized}, but there has been no conclusive empirical comparison so far to pathfinding with prediction. In this paper, we present an evaluation of various pedestrian prediction techniques combined with the state-of-the-art pathfinding algorithm D* Lite \cite{d-star-lite}, and a recent reinforcement learning approach SA-CADRL \cite{chen2017socially}. We evaluate the different approaches on a dataset extracted from real crowd movements recorded by CCTV at Grand Central Station in New York \cite{yi2015understanding}. The evaluation criteria are speed of movement from start to end point, and number of collisions of the virtual robot with humans. Our empirical results demonstrate that the reinforcement learning approach results in one of the fastest robots, while significantly reducing the number of collisions with humans, as measured in simulation based on real human movement data. \section{Related work} Research in the area of socially aware robot motion follows three main directions: behavior prediction, reinforcement learning, and behavior cloning. Most of the work so far has focused on predicting humans' trajectories and plan the robot movement accordingly \cite{ferrer2014proactive}. For the prediction of humans' trajectories, clustering and typical behavior extraction was shown to be effective (e.g. \cite{ferrer2014behavior}). More recently, Deep Learning techniques have been successfully applied to the prediction of individual and crowd motion \cite{yi2016pedestrian}, which is currently the best performing technique. For robot route planning with dynamic obstacles the approaches vary. The simplest approach is to use a pre-defined set of rules to move the robot \cite{sisbot2007human}. Another approach is to compute attracting and repelling steering forces based on current and (where available) predicted future positions of obstacles \cite{reynolds1999steering}. This steering technique has been extended with Markov Decision Processes to deal with uncertainty in the predictions \cite{bai2015intention}. Svenstrup et al. \cite{svenstrup2010trajectory} iteratively improve the current best path using a Rapidly-exploring Random Tree with obstacles represented as potential fields. In a recent reinforcement learning approach \cite{chen2017decentralized}, the robot was trained in simulation to move optimally through a crowd. The third main approach to socially aware robot motion, behavior cloning, relies on the fact that humans can navigate in human crowds quite successfully and tries to imitate human behavior. This movement behaviour imitation problem has recently been tackled with inverse reinforcement learning, computing a reward function for crowd navigation from human crowd movement demonstrations, that was subsequently used to train a reinforcement learning agent \cite{kretzschmar2016socially}. In this paper, we are focusing on the first two approaches, and perform a comparative evaluation in a simulation based on real-world pedestrian crowd recordings. \section{Crowd movement dataset} In order to simulate realistic crowd movements, we used a dataset obtained from surveillance video from Grand Central Station (New York, USA). The dataset consists of 6001 frames of camera images taken from the top, and 12684 labeled pedestrian trajectories as obtained by Yi et al. \cite{yi2015understanding}. An example frame with a single pedestrian trajectory is shown in Figure~\ref{fig:big_path}. The frames were sampled from a video of 4000 secs (i.e., a frequency is $1.5$ frames per second), and each frame has a resolution of $1920 \times 1080$. Trajectories were filtered by minimum length, where only those with at least 10 frames were retained. This left 12244 valid trajectories in the dataset with an average length of $37$ frames. \begin{figure}[htpb] \centering \includegraphics[width=0.45\textwidth]{images/big_path.jpg} \caption{Example frame with sample trajectory for one person.} \label{fig:big_path} \end{figure} In a data pre-processing step, we overlaid the frames with a $64 \times 36$ grid, as shown in Figure~\ref{fig:grid}. This allows discretization of the pedestrian positions and reduces the size of the state space for the path planning. The grid resolution was chosen based on average human speed from frame to frame which are $35$ pixels for the horizontal coordinate and $30$ pixels for the vertical one. \begin{figure}[htpb] \centering \includegraphics[width=0.45\textwidth]{images/frame.jpg} \caption{Overlaying a $64 \times 36$ grid.} \label{fig:grid} \end{figure} \section{Path planning methods} \label{sec:prediction} We employed two general approaches to the path planning problem. In the first approach pedestrians are considered as moving obstacles and the goal is to predict their positions over the next five time steps. These positions are then used as dynamic obstacles for the path planning algorithms such as D* Lite \cite{d-star-lite}, which will be described later. The second approach is to learn a robot movement policy via reinforcement learning in simulation based on the recorded pedestrian movements. We start with a discussion of prediction methods for pedestrian positions. \subsection{Pedestrian position prediction approach} We compared several methods for position prediction in our study to demonstrate their impact on the robot policy. \subsubsection{Baseline prediction} A very simple method to predict the future position of a pedestrian is to assume that the pedestrian can move into any neighboring grid square in a time step. All these squares are considered to be occupied by the pedestrian in the next time step when performing the path planning. \subsubsection{Random forest regression prediction} A more sophisticated approach is to employ machine learning techniques for the prediction task. We chose Random Forest Regressor \cite{liaw2002classification} for this as a standard technique which has demonstrated robust performance in the literature. In this method, the prediction outputs are the five expected coordinates of the pedestrian over the next five time steps, relative to their original position. The state for which a prediction is made was represented using features based on the five previous grid positions of the pedestrian as follows: \begin{itemize} \item Absolute coordinates (10 features). \item Coordinates relative to the previous point ($x$ and $y$ speed, 8 features). \item Speed (distance between neighboring points, 4 features) and average speed (1 feature). \item Acceleration (change in speed from one step to the next one, 3 features) and average acceleration (1 feature). \item Angle of movement for each step (4 features). \end{itemize} The features are illustrated on Fig. \ref{fig:features} \begin{figure} \centering \includegraphics[width=0.49\textwidth]{images/features_white_corrected.jpg} \caption{Features for Random Forest Regressor. The top left shows the x and y coordinates of the last five trajectory points. The top right picture shows the distance between neighbouring trajectory points. The bottom left picture shows the coordinates relative to the previous trajectory point. The bottom right picture shows the changes in movement angle between two time steps.} \label{fig:features} \end{figure} \subsubsection{Behavior-CNN prediction} Behavior-CNN \cite{yi2016pedestrian} is a Neural Network architecture which was designed especially for movement prediction. It takes as input the embedded positions of the pedestrian over the last five time steps, and outputs the predicted positions over the next five time steps. These embedded positions are called a displacement volume and correspond to a three-dimensional matrix of size $X \times Y \times 10$, where $X$ and $Y$ denote the area size (in our case $X = 1920$ and $Y = 1080$). The third dimension corresponds to the distances between the pedestrian positions over the last 5 time steps, along the x and y dimension. This results in 10 values. The distance values are first normalized to be between 0 and 1 according to $X$ and $Y$ respectively, and then 1 is added to is to avoid too small numbers. More formally, the 10-dimensional vector is computed as given in equation~\ref{eq:bcnn}, where ($x_t$,$y_t$) is the $i$-th position of the pedestrian with $t=1$ being the time five steps ago, and $t=5$ the current time step: \begin{equation} \label{eq:bcnn} [1 + \frac{x_5 - x_1}{X}, 1 + \frac{y_5 - y_1}{Y}, ..., 1 + \frac{x_5 - x_5}{X}, 1 + \frac{y_5 - y_5}{Y}] \end{equation} All other cells in the matrix are set to zero. The output the CNN has the same shape as the input and represents the predicted embedded positions over the next five time steps. For other technical details we refer the reader to the original paper. \begin{figure*} \centering \includegraphics[width=1\textwidth]{images/beh_framework.png} \caption{Behaviour-CNN framework \cite{yi2016pedestrian}.} \label{fig:beh-cnn} \end{figure*} \subsubsection{Path planning with the D* Lite algorithm} \label{sec:d-star-lite} D* Lite \cite{d-star-lite} is a heuristic path planning algorithm that takes as input a start and goal position, and recalculates the current path at each step taking into account the predicted coordinates of obstacles over a number of time steps. The method uses the freespace assumption, i.e. it assumes that unknown space is empty unless the predictions tell otherwise. We refer the reader to the original paper for more details. Realization in Python 3 was based on the java implementation GitHub \footnote{https://github.com/daniel-beard/DStarLiteJava}. \subsection{Reinforcement learning approach} \subsubsection{SA-CADRL} A state-of-the-art RL approach to socially aware robot movement is SA-CADRL (Socially Aware Collision Avoidance with Deep Reinforcement Learning) \cite{chen2017socially} which aims to learn an optimal robot policy based on the observed state of the robot and nearby agents (i.e. pedestrians). During training, the robot receives a positive reward for reaching the destination and a negative reward for delays and collisions. The policy is represented as a neural network whose input is formed from state information on the robot and nearby agents (pedestrians) and that outputs the robot velocity. This state information includes the current position, size, and velocity of the agent/robot. Formally speaking, by using SA-CADRL architecture authors are trying to restore robot's policy $\pi$ such as expected value to goal would be minimal: $$\arg \min_{\pi(s)} \mathbf{E}[t_g | \pi]$$ With the following restrictions: \begin{itemize} \item $||p_t - \hat{p}_t||_2 \geq r + \hat{r}$ -- for any frame distance between robot and other agents should be greater than their radii sum. \item $p_{t_g} = p_g$ -- at the last frame robot should be in the goal coordinates. \item $p_t = p_{t-1} + \Delta t \cdot \pi(s)$ -- current robot's position is defined by previous position and chosen action (moving direction). \end{itemize} To evaluate this approach on the same trajectories and with the same metrics as the other approaches, we used the pre-trained network provided by the Chen et al. which can be found in the SA-CADRL project GitHub page \footnote{https://github.com/mfe7/cadrl\_ros}. \begin{figure} \centering \includegraphics[width=0.45\textwidth]{images/sacadrl.png} \caption{Original SA-CADRL network architecture \cite{chen2017socially}.} \label{fig:sa-cadrl} \end{figure} \subsubsection{Grid-SA-CADRL} A limitation of the SA-CADRL approach is that the robot can't move backwards. We extended the SA-CADRL approach to provide the robot with these abilities. Furthermore, we modified SA-CADRL to work on a grid-environment rather than a coordinate space as the original approach. This means that rather than having a continuous movement action, the actions are made discrete corresponding to a move into one of the 8 neighboring grid squares or standing still. The resulting network architecture is shown in Figure~\ref{fig:network}. It takes the robots and three nearby pedestrians' states as inputs into an LSTM layer (size 64), followed by 3 fully connected layers with the last one outputting probabilities of actions through a softmax transformation. The robot then choose the action with the highest probability. \begin{figure}[htpb] \centering \includegraphics[width=0.45\textwidth]{images/jbrsacadrl.png} \caption{Grid-SA-CADRL network architecture.} \label{fig:network} \end{figure} We trained the Grid-SA-CADRL network for 1000 episodes, taking the pre-trained SA-CADRL network as a starting point. In each training episode we randomly picked a start and goal position for the robot, and a random starting time from the recordings. The pedestrians in the simulation walk according to the recording data, and an episode ends as soon as the robot has reached the goal position, or the recording has reached its end. \section{Evaluation} We first present the evaluation of the prediction method accuracy, followed by the evaluation of the path planning approaches. \subsection{Evaluation of prediction methods} We chose the Normalized Mean Square Error (NMSE, see equation below) to evaluate the pedestrian position prediction methods presented in Section~\ref{sec:prediction}, and optimize the hyper-parameters. \begin{equation} NMSE = \frac{1}{n}\sum^{n}_{i=1}{\sqrt{(\frac{x_i - \hat{x_i}}{X})^2 + (\frac{y_i - \hat{y_i}}{Y})^2}} \end{equation} Here $x_i$ and $y_i$ are ground truth values, $x_i$ and $y_i$ are predicted. $X$ and $Y$ are upper limits for $x_i$ and $y_i$ respectively, and in our case set to $X = 1920$ and $Y = 1080$. We randomly split the data set of pedestrian trajectories into 80\% training, 10\% validation, and 10\% test data. For Random Forest Regression, the NMSE was 0.27, and Behavioral CNN significantly lowered this to 0.02. To show how this accuracy difference impacts on the performance of the robot, we used both prediction methods in the D* lite path planning algorithm. \subsection{Evaluation of path planning} All path planning algorithms were evaluated in terms of pedestrian safety and time taken to move from the start to the goal position. These metrics were measured as follows: \begin{itemize} \item Number of collisions (i.e. states in which the robot ends up in the same cell as a pedestrian) which were split into 3 groups as shown in Figure~\ref{fig:collision_types}. These represent a robot colliding a stationary pedestrian, a pedestrian colliding with a stationary robot, and a moving robot and a moving pedestrian colliding with each other. \item Relative delay compared to the time of the optimal route with no pedestrians present, as computed by $D = (\frac{\hat{t}}{t} - 1) \times 100\%$, where $t$ is the time taken to move along the optimal route from start to goal, and $\hat{t}$ is the actual time taken. \end{itemize} In order to evaluate the path planning approaches, we generated 1000 episodes with random start and goal positions for the robot, and random starting times of the recording data. While the SA-CADRL agent moves in a continuous coordinate space, this movement needed to be transformed into the grid-space model of the environment. Figure~\ref{fig:route} shows an example of this mapping. In the first time step the SA-CADRL agent moves one step to the north, and then moves diagonally to the north east. In the third step, however, the agent moves, but does not leave the current grid cell. This means that the agent was stationary for one time step in the grid-space representation. Note that the preferred speed of the SA-CADRL agent was set to match the grid cell size. \begin{figure}[htpb] \centering \includegraphics[width=0.45\textwidth]{images/route.jpg} \caption{Mapping of vector space movement of SA-CADRL agent to the grid-space representation.} \label{fig:route} \end{figure} Note that the pedestrian movement was recorded without a robot being present, which limits the realism of the simulation to some extent since it ignores the effect that robot movements could influence pedestrian decisions. However, the definition of the three different collision types has been specifically designed to take this limitation into account. Specifically, a moving robot colliding with a moving pedestrian is always an indicator for sub-optimal robot behaviour, no matter whether the pedestrian movement was influenced by the robot or not. \section{Results} The results of our evaluation are shown in table~\ref{tab:results}. While the baseline prediction approach may appear to be the most cautious one by assuming that a pedestrian is going to occupy all neighboring squares in the next time step, it caused the most collisions. There were due to some pedestrians moving faster than one square per time step. Increasing the range of squares that are assumed to be occupied to two does not improve the solution, since this causes the robot to stop moving at all. This confirms that a simple over-cautious solution is not feasible in a crowded space. In terms of movement speed, all other techniques demonstrate comparable performance. The D* Lite method does not cause any SR collisions because it never is stationary. While the RL approaches do cause a relatively large number of these collisions, these are not indicative of poor robot behaviour, since pedestrians in a real-world situation are unlikely to collide with a stationary robot, and if they do it would not be the robot's fault. SP collisions do not occur for any of the approaches. Most importantly, MRP collisions are relatively frequent for the D* Lite methods, corresponding to the accuracy of the chosen prediction method. The RL methods clearly outperform D* Lite on this measure, and our adaptation of SA-CADRL is more than halving the count of MRP collisions to a relatively small number of 3 in 1000. This clearly shows the superiority of Grid-SA-CADRL in this environment. \begin{figure}[htpb] \centering \includegraphics[width=0.45\textwidth]{images/collision_types.jpg} \caption{The three types of collisions between the robot (red square) and a pedestrian (blue square).} \label{fig:collision_types} \end{figure} \begin{table}[ht] \caption{Evaluation of different approaches to robots navigation in crowded environment (taken over 1000 paths)} \begin{tabular}{|l|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|} \hline \multirow{3}{*}{Approach} & \multirow{3}{*}{delay} & \multicolumn{3}{c|}{collisions} \\ \cline{3-5} & & SR & SP & MRP \\ \hline \hline \multicolumn{5}{|c|}{D* Lite based approach} \\ \hline \hline Perfect prediction (0.0) & $1.44\%$ & 0 & 0 & 0 \\ \hline Baseline & $7.57\%$ & 0 & 0 & 143 \\ \hline \hline RFR (0.27) & $1.39\%$ & 0 & 0 & 67 \\ \hline Behavior-CNN (0.02) & $1.42\%$ & 0 & 0 & 25 \\ \hline \hline \multicolumn{5}{|c|}{Deep Reinforcement Learning approach} \\ \hline \hline SA-CADRL (checkpoint) & $1.57\%$ & 183 & 0 & 8 \\ \hline Grid-SA-CADRL & $1.46\%$ & 51 & 0 & 3 \\ \hline \end{tabular} \label{tab:results} \end{table} \section{Conclusions} In this paper, we have presented a comparative evaluation of various path planning methods for robot navigation through crowds. The evaluation was carried out in a simulation based on real-world recorded pedestrian data in a crowded space. The results show the clear superiority of reinforcement learning in terms of number of collisions with moving pedestrians, while also never colliding with stationary pedestrians. \section{Introduction} Robots are predicted to increasingly participate in everyday life of humans over the next decade, but so far most research applications deal with interactions between a robot and a single human. However, if robots are to perform general tasks such as pick-up and delivery in public spaces, they will need to be able to cope and interact with large crowds. This poses a specific challenge for navigation control, where robots are supposed to move fast and efficient, while not endangering the safety of humans walking about in the same location. Most work so far on robot navigation in environments with moving obstacles has been focused on a combination of pathfinding algorithms and human behaviour prediction \cite{bai2015intention}. However, more recently, reinforcement learning has been proposed for robot navigation through crowds \cite{chen2017decentralized}, but there has been no conclusive empirical comparison so far to pathfinding with prediction. In this paper, we present an evaluation of various pedestrian prediction techniques combined with the state-of-the-art pathfinding algorithm D* Lite \cite{d-star-lite}, and a recent reinforcement learning approach SA-CADRL \cite{chen2017socially}. We evaluate the different approaches on a dataset extracted from real crowd movements recorded by CCTV at Grand Central Station in New York \cite{yi2015understanding}. The evaluation criteria are speed of movement from start to end point, and number of collisions of the virtual robot with humans. Our empirical results demonstrate that the reinforcement learning approach results in one of the fastest robots, while significantly reducing the number of collisions with humans, as measured in simulation based on real human movement data. \section{Related work} Research in the area of socially aware robot motion follows three main directions: behavior prediction, reinforcement learning, and behavior cloning. Most of the work so far has focused on predicting humans' trajectories and plan the robot movement accordingly \cite{ferrer2014proactive}. For the prediction of humans' trajectories, clustering and typical behavior extraction was shown to be effective (e.g. \cite{ferrer2014behavior}). More recently, Deep Learning techniques have been successfully applied to the prediction of individual and crowd motion \cite{yi2016pedestrian}, which is currently the best performing technique. For robot route planning with dynamic obstacles the approaches vary. The simplest approach is to use a pre-defined set of rules to move the robot \cite{sisbot2007human}. Another approach is to compute attracting and repelling steering forces based on current and (where available) predicted future positions of obstacles \cite{reynolds1999steering}. This steering technique has been extended with Markov Decision Processes to deal with uncertainty in the predictions \cite{bai2015intention}. Svenstrup et al. \cite{svenstrup2010trajectory} iteratively improve the current best path using a Rapidly-exploring Random Tree with obstacles represented as potential fields. In a recent reinforcement learning approach \cite{chen2017decentralized}, the robot was trained in simulation to move optimally through a crowd. The third main approach to socially aware robot motion, behavior cloning, relies on the fact that humans can navigate in human crowds quite successfully and tries to imitate human behavior. This movement behaviour imitation problem has recently been tackled with inverse reinforcement learning, computing a reward function for crowd navigation from human crowd movement demonstrations, that was subsequently used to train a reinforcement learning agent \cite{kretzschmar2016socially}. In this paper, we are focusing on the first two approaches, and perform a comparative evaluation in a simulation based on real-world pedestrian crowd recordings. \section{Crowd movement dataset} In order to simulate realistic crowd movements, we used a dataset obtained from surveillance video from Grand Central Station (New York, USA). The dataset consists of 6001 frames of camera images taken from the top, and 12684 labeled pedestrian trajectories as obtained by Yi et al. \cite{yi2015understanding}. An example frame with a single pedestrian trajectory is shown in Figure~\ref{fig:big_path}. The frames were sampled from a video of 4000 secs (i.e., a frequency is $1.5$ frames per second), and each frame has a resolution of $1920 \times 1080$. Trajectories were filtered by minimum length, where only those with at least 10 frames were retained. This left 12244 valid trajectories in the dataset with an average length of $37$ frames. \begin{figure}[htpb] \centering \includegraphics[width=0.45\textwidth]{images/big_path.jpg} \caption{Example frame with sample trajectory for one person.} \label{fig:big_path} \end{figure} In a data pre-processing step, we overlaid the frames with a $64 \times 36$ grid, as shown in Figure~\ref{fig:grid}. This allows discretization of the pedestrian positions and reduces the size of the state space for the path planning. The grid resolution was chosen based on average human speed from frame to frame which are $35$ pixels for the horizontal coordinate and $30$ pixels for the vertical one. \begin{figure}[htpb] \centering \includegraphics[width=0.45\textwidth]{images/frame.jpg} \caption{Overlaying a $64 \times 36$ grid.} \label{fig:grid} \end{figure} \section{Path planning methods} \label{sec:prediction} We employed two general approaches to the path planning problem. In the first approach pedestrians are considered as moving obstacles and the goal is to predict their positions over the next five time steps. These positions are then used as dynamic obstacles for the path planning algorithms such as D* Lite \cite{d-star-lite}, which will be described later. The second approach is to learn a robot movement policy via reinforcement learning in simulation based on the recorded pedestrian movements. We start with a discussion of prediction methods for pedestrian positions. \subsection{Pedestrian position prediction approach} We compared several methods for position prediction in our study to demonstrate their impact on the robot policy. \subsubsection{Baseline prediction} A very simple method to predict the future position of a pedestrian is to assume that the pedestrian can move into any neighboring grid square in a time step. All these squares are considered to be occupied by the pedestrian in the next time step when performing the path planning. \subsubsection{Random forest regression prediction} A more sophisticated approach is to employ machine learning techniques for the prediction task. We chose Random Forest Regressor \cite{liaw2002classification} for this as a standard technique which has demonstrated robust performance in the literature. In this method, the prediction outputs are the five expected coordinates of the pedestrian over the next five time steps, relative to their original position. The state for which a prediction is made was represented using features based on the five previous grid positions of the pedestrian as follows: \begin{itemize} \item Absolute coordinates (10 features). \item Coordinates relative to the previous point ($x$ and $y$ speed, 8 features). \item Speed (distance between neighboring points, 4 features) and average speed (1 feature). \item Acceleration (change in speed from one step to the next one, 3 features) and average acceleration (1 feature). \item Angle of movement for each step (4 features). \end{itemize} The features are illustrated on Fig. \ref{fig:features} \begin{figure} \centering \includegraphics[width=0.49\textwidth]{images/features_white_corrected.jpg} \caption{Features for Random Forest Regressor. The top left shows the x and y coordinates of the last five trajectory points. The top right picture shows the distance between neighbouring trajectory points. The bottom left picture shows the coordinates relative to the previous trajectory point. The bottom right picture shows the changes in movement angle between two time steps.} \label{fig:features} \end{figure} \subsubsection{Behavior-CNN prediction} Behavior-CNN \cite{yi2016pedestrian} is a Neural Network architecture which was designed especially for movement prediction. It takes as input the embedded positions of the pedestrian over the last five time steps, and outputs the predicted positions over the next five time steps. These embedded positions are called a displacement volume and correspond to a three-dimensional matrix of size $X \times Y \times 10$, where $X$ and $Y$ denote the area size (in our case $X = 1920$ and $Y = 1080$). The third dimension corresponds to the distances between the pedestrian positions over the last 5 time steps, along the x and y dimension. This results in 10 values. The distance values are first normalized to be between 0 and 1 according to $X$ and $Y$ respectively, and then 1 is added to is to avoid too small numbers. More formally, the 10-dimensional vector is computed as given in equation~\ref{eq:bcnn}, where ($x_t$,$y_t$) is the $i$-th position of the pedestrian with $t=1$ being the time five steps ago, and $t=5$ the current time step: \begin{equation} \label{eq:bcnn} [1 + \frac{x_5 - x_1}{X}, 1 + \frac{y_5 - y_1}{Y}, ..., 1 + \frac{x_5 - x_5}{X}, 1 + \frac{y_5 - y_5}{Y}] \end{equation} All other cells in the matrix are set to zero. The output the CNN has the same shape as the input and represents the predicted embedded positions over the next five time steps. For other technical details we refer the reader to the original paper. \begin{figure*} \centering \includegraphics[width=1\textwidth]{images/beh_framework.png} \caption{Behaviour-CNN framework \cite{yi2016pedestrian}.} \label{fig:beh-cnn} \end{figure*} \subsubsection{Path planning with the D* Lite algorithm} \label{sec:d-star-lite} D* Lite \cite{d-star-lite} is a heuristic path planning algorithm that takes as input a start and goal position, and recalculates the current path at each step taking into account the predicted coordinates of obstacles over a number of time steps. The method uses the freespace assumption, i.e. it assumes that unknown space is empty unless the predictions tell otherwise. We refer the reader to the original paper for more details. Realization in Python 3 was based on the java implementation GitHub \footnote{https://github.com/daniel-beard/DStarLiteJava}. \subsection{Reinforcement learning approach} \subsubsection{SA-CADRL} A state-of-the-art RL approach to socially aware robot movement is SA-CADRL (Socially Aware Collision Avoidance with Deep Reinforcement Learning) \cite{chen2017socially} which aims to learn an optimal robot policy based on the observed state of the robot and nearby agents (i.e. pedestrians). During training, the robot receives a positive reward for reaching the destination and a negative reward for delays and collisions. The policy is represented as a neural network whose input is formed from state information on the robot and nearby agents (pedestrians) and that outputs the robot velocity. This state information includes the current position, size, and velocity of the agent/robot. Formally speaking, by using SA-CADRL architecture authors are trying to restore robot's policy $\pi$ such as expected value to goal would be minimal: $$\arg \min_{\pi(s)} \mathbf{E}[t_g | \pi]$$ With the following restrictions: \begin{itemize} \item $||p_t - \hat{p}_t||_2 \geq r + \hat{r}$ -- for any frame distance between robot and other agents should be greater than their radii sum. \item $p_{t_g} = p_g$ -- at the last frame robot should be in the goal coordinates. \item $p_t = p_{t-1} + \Delta t \cdot \pi(s)$ -- current robot's position is defined by previous position and chosen action (moving direction). \end{itemize} To evaluate this approach on the same trajectories and with the same metrics as the other approaches, we used the pre-trained network provided by the Chen et al. which can be found in the SA-CADRL project GitHub page \footnote{https://github.com/mfe7/cadrl\_ros}. \begin{figure} \centering \includegraphics[width=0.45\textwidth]{images/sacadrl.png} \caption{Original SA-CADRL network architecture \cite{chen2017socially}.} \label{fig:sa-cadrl} \end{figure} \subsubsection{Grid-SA-CADRL} A limitation of the SA-CADRL approach is that the robot can't move backwards. We extended the SA-CADRL approach to provide the robot with these abilities. Furthermore, we modified SA-CADRL to work on a grid-environment rather than a coordinate space as the original approach. This means that rather than having a continuous movement action, the actions are made discrete corresponding to a move into one of the 8 neighboring grid squares or standing still. The resulting network architecture is shown in Figure~\ref{fig:network}. It takes the robots and three nearby pedestrians' states as inputs into an LSTM layer (size 64), followed by 3 fully connected layers with the last one outputting probabilities of actions through a softmax transformation. The robot then choose the action with the highest probability. \begin{figure}[htpb] \centering \includegraphics[width=0.45\textwidth]{images/jbrsacadrl.png} \caption{Grid-SA-CADRL network architecture.} \label{fig:network} \end{figure} We trained the Grid-SA-CADRL network for 1000 episodes, taking the pre-trained SA-CADRL network as a starting point. In each training episode we randomly picked a start and goal position for the robot, and a random starting time from the recordings. The pedestrians in the simulation walk according to the recording data, and an episode ends as soon as the robot has reached the goal position, or the recording has reached its end. \section{Evaluation} We first present the evaluation of the prediction method accuracy, followed by the evaluation of the path planning approaches. \subsection{Evaluation of prediction methods} We chose the Normalized Mean Square Error (NMSE, see equation below) to evaluate the pedestrian position prediction methods presented in Section~\ref{sec:prediction}, and optimize the hyper-parameters. \begin{equation} NMSE = \frac{1}{n}\sum^{n}_{i=1}{\sqrt{(\frac{x_i - \hat{x_i}}{X})^2 + (\frac{y_i - \hat{y_i}}{Y})^2}} \end{equation} Here $x_i$ and $y_i$ are ground truth values, $x_i$ and $y_i$ are predicted. $X$ and $Y$ are upper limits for $x_i$ and $y_i$ respectively, and in our case set to $X = 1920$ and $Y = 1080$. We randomly split the data set of pedestrian trajectories into 80\% training, 10\% validation, and 10\% test data. For Random Forest Regression, the NMSE was 0.27, and Behavioral CNN significantly lowered this to 0.02. To show how this accuracy difference impacts on the performance of the robot, we used both prediction methods in the D* lite path planning algorithm. \subsection{Evaluation of path planning} All path planning algorithms were evaluated in terms of pedestrian safety and time taken to move from the start to the goal position. These metrics were measured as follows: \begin{itemize} \item Number of collisions (i.e. states in which the robot ends up in the same cell as a pedestrian) which were split into 3 groups as shown in Figure~\ref{fig:collision_types}. These represent a robot colliding a stationary pedestrian, a pedestrian colliding with a stationary robot, and a moving robot and a moving pedestrian colliding with each other. \item Relative delay compared to the time of the optimal route with no pedestrians present, as computed by $D = (\frac{\hat{t}}{t} - 1) \times 100\%$, where $t$ is the time taken to move along the optimal route from start to goal, and $\hat{t}$ is the actual time taken. \end{itemize} In order to evaluate the path planning approaches, we generated 1000 episodes with random start and goal positions for the robot, and random starting times of the recording data. While the SA-CADRL agent moves in a continuous coordinate space, this movement needed to be transformed into the grid-space model of the environment. Figure~\ref{fig:route} shows an example of this mapping. In the first time step the SA-CADRL agent moves one step to the north, and then moves diagonally to the north east. In the third step, however, the agent moves, but does not leave the current grid cell. This means that the agent was stationary for one time step in the grid-space representation. Note that the preferred speed of the SA-CADRL agent was set to match the grid cell size. \begin{figure}[htpb] \centering \includegraphics[width=0.45\textwidth]{images/route.jpg} \caption{Mapping of vector space movement of SA-CADRL agent to the grid-space representation.} \label{fig:route} \end{figure} Note that the pedestrian movement was recorded without a robot being present, which limits the realism of the simulation to some extent since it ignores the effect that robot movements could influence pedestrian decisions. However, the definition of the three different collision types has been specifically designed to take this limitation into account. Specifically, a moving robot colliding with a moving pedestrian is always an indicator for sub-optimal robot behaviour, no matter whether the pedestrian movement was influenced by the robot or not. \section{Results} The results of our evaluation are shown in table~\ref{tab:results}. While the baseline prediction approach may appear to be the most cautious one by assuming that a pedestrian is going to occupy all neighboring squares in the next time step, it caused the most collisions. There were due to some pedestrians moving faster than one square per time step. Increasing the range of squares that are assumed to be occupied to two does not improve the solution, since this causes the robot to stop moving at all. This confirms that a simple over-cautious solution is not feasible in a crowded space. In terms of movement speed, all other techniques demonstrate comparable performance. The D* Lite method does not cause any SR collisions because it never is stationary. While the RL approaches do cause a relatively large number of these collisions, these are not indicative of poor robot behaviour, since pedestrians in a real-world situation are unlikely to collide with a stationary robot, and if they do it would not be the robot's fault. SP collisions do not occur for any of the approaches. Most importantly, MRP collisions are relatively frequent for the D* Lite methods, corresponding to the accuracy of the chosen prediction method. The RL methods clearly outperform D* Lite on this measure, and our adaptation of SA-CADRL is more than halving the count of MRP collisions to a relatively small number of 3 in 1000. This clearly shows the superiority of Grid-SA-CADRL in this environment. \begin{figure}[htpb] \centering \includegraphics[width=0.45\textwidth]{images/collision_types.jpg} \caption{The three types of collisions between the robot (red square) and a pedestrian (blue square).} \label{fig:collision_types} \end{figure} \begin{table}[ht] \caption{Evaluation of different approaches to robots navigation in crowded environment (taken over 1000 paths)} \begin{tabular}{|l|p{1cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|} \hline \multirow{3}{*}{Approach} & \multirow{3}{*}{delay} & \multicolumn{3}{c|}{collisions} \\ \cline{3-5} & & SR & SP & MRP \\ \hline \hline \multicolumn{5}{|c|}{D* Lite based approach} \\ \hline \hline Perfect prediction (0.0) & $1.44\%$ & 0 & 0 & 0 \\ \hline Baseline & $7.57\%$ & 0 & 0 & 143 \\ \hline \hline RFR (0.27) & $1.39\%$ & 0 & 0 & 67 \\ \hline Behavior-CNN (0.02) & $1.42\%$ & 0 & 0 & 25 \\ \hline \hline \multicolumn{5}{|c|}{Deep Reinforcement Learning approach} \\ \hline \hline SA-CADRL (checkpoint) & $1.57\%$ & 183 & 0 & 8 \\ \hline Grid-SA-CADRL & $1.46\%$ & 51 & 0 & 3 \\ \hline \end{tabular} \label{tab:results} \end{table} \section{Conclusions} In this paper, we have presented a comparative evaluation of various path planning methods for robot navigation through crowds. The evaluation was carried out in a simulation based on real-world recorded pedestrian data in a crowded space. The results show the clear superiority of reinforcement learning in terms of number of collisions with moving pedestrians, while also never colliding with stationary pedestrians.
{'timestamp': '2020-12-17T02:13:28', 'yymm': '2012', 'arxiv_id': '2012.08822', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08822'}
arxiv
\section{Introduction} Person re-identification (ReID) is an important task that matches person images across times/spaces/cameras, which has many applications such as people tracking in smart retail, image retrieval for finding lost children. Existing approaches achieve remarkable performance when the training and testing data are from the same dataset/domain. But they usually fail to generalize well to other datasets where there are domain gaps~\cite{ge2020mutual}. To address this practical problem, unsupervised domain adaptive (UDA) person ReID attracts much attention for both the academic and industrial communities, where labeled source domain and unlabeled target domain data are exploited for training. Typical UDA person ReID approaches~\cite{ge2020mutual,zhai2020adcluster,zhong2019invariance,2020Hierarchical,song2020unsupervised} include three steps: feature pre-training with labeled source domain data, clustering-based pseudo-label prediction for the target domain data, and feature representation learning/fine-tuning with the pseudo-labels. The last two steps are usually iteratively conducted to promote each other. However, the pseudo-labels obtained/assigned through clustering usually contain noisy (wrong) labels due to the divergence/domain gap between the source and target data, and the imperfect results of the clustering algorithm. Such noisy labels would mislead the feature learning and harm the domain adaptation performance. Thus, \emph{alleviating the negative effects of those samples with unreliable/noisy pseudo labels is important for the success of domain adaptation}. The challenge lies in 1) how to identify samples that are prone to have noisy pseudo labels; 2) how to alleviate their negative effects during the optimization. In this paper, to answer the first question, we have observed abundant samples and analyzed the relationship between the characteristics of the samples and the correctness of pseudo labels. Based on the theory on uncertainty~\cite{kendall2017uncertainties}, a model has uncertainty on its prediction of an input sample. Here, we measure the inconsistency level of the output features of two models (the student model and the teacher model based on the mean teacher method~\cite{tarvainen2017mean}) and take it as the estimated uncertainty of a target domain sample. \textcolor{black}{As shown in Fig.~\ref{fig:intro}, we observe the distribution of the uncertainty (inconsistency levels) for correct/clean pseudo labels and wrong pseudo labels. We found that the uncertainty values for the samples with wrong pseudo labels are usually larger} than those with correct pseudo labels. This motivates us to estimate and exploit the uncertainty of samples to alleviate the negative effects of noisy pseudo labels, enabling effective domain adaptation. We answer the second question by carefully incorporating the uncertainty of samples into classification loss, triplet loss, and contrastive loss, respectively. We summarize our main contributions as follows: \begin{itemize}[leftmargin=*,noitemsep,nolistsep] \item We propose a network named Uncertainty-guided Noise Resilient Network (UNRN) to explore the credibility of the predicted pseudo labels of target domain samples for effective domain adaptive person ReID. \item We develop an uncertainty estimation strategy by calculating the inconsistency of two models in terms of their predicted soft multilabels. \item We incorporate the uncertainty of samples to the ID classification loss, triplet loss, and contrastive loss through re-weighting to alleviate the negative influence of noisy pseudo labels. \end{itemize} Extensive experiments demonstrate the effectiveness of our framework and the designed components on unsupervised person ReID benchmark datasets. Our scheme achieves the state-of-the-art performance on all the benchmark datasets. \section{Related Work} \subsection{Unsupervised Domain Adaptive Person ReID} Existing unsupervised domain adaptive person ReID approaches can be grouped into three main categories. \noindent\textbf{Clustering-based methods} in general generate hard or soft pseudo labels based on clustering results and then fine-tune/train the models based on the pseudo labels ~\cite{fan2018unsupervised,zhang2019self,yang2019selfsimilarity,ge2020mutual,yu2019unsupervised,zhong2019invariance, song2020unsupervised, jin2020global}. They are widely used due to their superior performance. PUL~\cite{fan2018unsupervised} iteratively obtains hard clustering labels and trains the model in self-training manner. SSG~\cite{yang2019selfsimilarity} exploits the potential similarity for the global body and local body parts, respectively, to build multiple independent clusters. These clusters are then assigned with labels to supervise the training. PAST~\cite{zhang2019self} optimizes the network with triplet-based loss function (to capture the local structure of target-domain data points) and classification loss by appending a classification layer (to use global information about the data distribution) based on clustering results. Pseudo label noise caused by unsupervised clustering is always an obstacle to the self-training. Such noisy labels would mislead the feature learning and impede the achievement of high performance. Recently, some methods introduce mutual learning among two/three collaborative networks to mutually exploit the refined soft pseudo labels of the peer networks as supervision \cite{ge2020mutual,zhai2020multiple}. To suppress the noises in the pseudo labels, NRMT \cite{zhao2020unsupervised} maintains two networks during training to perform collaborative clustering and mutual instance selection, which reduces the fitting to noisy instances by using the mutual supervision and the reliable instance selection. These approaches need mutual learning of two or more networks and are somewhat complicated. Besides, the selection of reliable instances in NRMT~\cite{zhao2020unsupervised} is a hard rather than a soft selection, which requires a careful determination of threshold parameters and may lose the chance of exploiting useful information of the abandoned samples. Different from the above works, in this paper, we propose a simple yet effective framework which estimates the reliability of the pseudo labels through uncertainty estimation and softly exploit them in the ReID losses to alleviate the negative effects of noise-prone samples. Note that we do not need two networks for mutual learning. We build our framework based on the mean teacher method, which maintains a temporally averaged model of the base network during the training, to facilitate the estimation of the uncertainty of each target domain sample. \noindent\textbf{Domain translation-based methods} \cite{deng2018image,huang2020real,wei2018person,ge2020structured} transfer source domain labeled images to the style of the target domain images and use these transferred images and the inherited ground-truth labels to fine-tune the model. However, the quality of translated images is still not very satisfactory which hinders the advancement of these approaches. \noindent\textbf{Memory bank based methods} have been widely used for unsupervised representation learning which facilitates the introduction of contrastive loss~\cite{he2020momentum} for the general tasks. He \textit{et al}.~ leverage the memory bank to better train the model to exploit the similarity between a sample and the instances in the global memory bank~\cite{he2020momentum}. Wang et al. propose to use memory bank to facilitate hard negative instance mining across batches \cite{wang2020cross}. ECN~\cite{zhong2019invariance} leverages memory bank to enforce exemplar-invariance, camera-invariance and neighborhood-invariance over global training data (instead of local batch) for UDA person ReID. We introduce contrastive loss to the target instance memory bank to enable the joint optimization of positive pairs and negative pairs for a query/anchor sample over all the samples in the memory bank, which serves as our strong baseline. \begin{figure*}[t] \centering \includegraphics[width=0.90\linewidth]{figure2_1.jpg} \caption{Overview of the proposed Uncertainty-guided Noise Resilient Network (UNRN) for UDA person ReID. We build our baseline framework with the mean teacher method (where the mean teacher model is a temporally moving average of weights of the student network) together with contrastive loss (supported by a memory bank). Our method belongs to clustering-based methods. In the model pre-training stage, we pre-train the network using source domain labeled data. In the clustering stage, we do clustering on the unlabeled target domain data using the more accurate features from the mean teacher model and assign pseudo labels based on the clustering results. Because of domain gap, some of the pseudo-labels are noisy/incorrect. In the joint fine-tuning stage, we propose to exploit the estimated uncertainty to evaluate the reliability of the pseudo-labels to alleviate the negative influence of the samples with error-prone pseudo-labels, by carefully incorporating the uncertainty to re-weight the contribution of samples in ID classification loss, triplet loss, and contrastive loss, respectively. Stage 2 and Stage 3 are performed alternatively. \label{fig:fm} \end{figure*} \subsection{Uncertainty Estimation} Uncertainty modeling helps us to understand what a model does not know (or is not confident). In order to suppress the noise during the training, existing works~\cite{kendall2017uncertainties, chang2020data, zheng2020rectifying,zheng2019abstract} have explored uncertainty estimation from different aspects, such as the data-dependent uncertainty, model uncertainty, and the uncertainty on annotation. For fully supervised learning tasks with clean groudtruth labels, some works learn the data-dependent uncertainty in an end-to-end manner to alleviate the influence of observation noise of an input sample for better network optimization~\cite{kendall2017uncertainties, chang2020data}. Zheng \textit{et al}.~~\cite{zheng2020rectifying} use an extra auxiliary classifier to help estimate the uncertainty of the predicted pseudo labels for semantic segmentation. For clustering-based UDA person ReID, some of the pseudo labels generated by clustering are incorrect/noisy. However, the investigation on how to softly evaluate the reliability of clustering-generated pseudo labels is still underexplored. In this work, we explore the reliability estimation of the clustering-generated pseudo labels and alleviate the influence of noise-prone samples by re-weighting their contributions in ReID losses. \section{\!\!\!\!Uncertainty-guided Noise Resilient Network} Unsupervised domain adaptive person ReID aims at adapting the model trained on a labeled source domain dataset $\mathbb{D}_{s}\!\!=\!\!\left\{\!\!\left.\left(\boldsymbol{x}_{i}^{s}, {y}_{i}^{s}\right)\right|_{i=1} ^{N_{s}}\!\right\}$ \textcolor{black}{of $C_{s}$ identities} to an annotation-free target domain dataset $\mathbb{D}_{t}\!\!=\!\!\left\{\!\left.\boldsymbol{x}_{i}^{t}\right|_{i=1} ^{N_{t}}\right\}$. $N_{s}$ and $N_{t}$ denote the number of samples. $\boldsymbol{x}_{i}$ denotes a sample and ${y}_{i}$ denotes its groudtruth label. Fig.~\ref{fig:fm} shows an overview of our proposed Uncertainty-guided Noise Resilient Network (UNRN) for UDA person ReID. We aim to address the negative influence of noise-prone pseudo labels during adaptation/fine-tuning under the clustering-based framework. We build a clustering-based strong baseline scheme \emph{SBase.} for UDA person ReID. On top of the strong baseline, we introduce an uncertainty calculation module to estimate the reliability of psedudo labels and incorporate the uncertainty into the ReID losses (ID classification loss (ID loss), triplet loss, and contrastive loss, respectively) to alleviate the influence of noise-prone pseudo labels. Our uncertainty-guided optimization design brings significant improvement on top of this strong baseline. We introduce the strong baseline in Section \ref{subsec:baseline} and elaborate on our proposed uncertainty-guided noise-resilient optimization designs in Section \ref{subsec:uncertainty}. \subsection{Clustering-based Strong Baseline} \label{subsec:baseline} We build a clustering-based strong baseline scheme \emph{SBase.} for UDA person ReID. We follow the general pipeline of clustering-based UDA methods \cite{fan2018unsupervised, song2020unsupervised, jin2020global} which consists of three main stages, \textit{i}.\textit{e}., model pre-training, clustering, and fine-tuning. As shown in Fig.~\ref{fig:fm}, we exploit the labeled source domain data for fine-tuning, incorporate contrastive loss, and leverage the simple yet effective mean teacher method to have a strong baseline. We will present the ablation study of each component in the experimental section. In the model pre-training stage, we pre-train the network using source domain labeled data. In the clustering stage, we do clustering on the unlabeled target domain data using the more accurate features from the mean teacher model and generate pseudo labels based on the clustering results. \noindent\textbf{Joint fine-tuning using source data.} In the fine-tuning stage~\cite{zhang2019self}, \textcolor{black}{most works} fine-tune the networks only using target domain pseudo labels. Here, we also re-use the valuable source domain data with reliable groudtruth labels. \textcolor{black}{For a source sample, we add ID classification loss, where maintained $C_{s}$ class centers are used as the classification weight vectors for classification.} \noindent\textbf{Contrastive loss across memory bank.} For image retrieval task, to enable the pair similarity optimization over informative negative instances, Wang \textit{et al}.~ propose a cross-batch memory mechanism that memorizes the feature embeddings of the past iterations to allow collecting sufficient hard negative pairs across the memory bank for network optimization~\cite{wang2020cross}. Motivated by this, for a \textcolor{black}{target domain} query sample $a$, we add contrastive loss to maximize the within-class similarity and minimize the between-class similarity across \textcolor{black}{the memory bank. Particularly, the memory bank consists of $N$ target domain instances (which is maintained similar to \cite{wang2020cross}) and $C_{s}$ source class center features (as the negative samples). Based on the pseudo labels of the target domain samples and the additional source class centers, we have $N_a^+$ positive samples and $N_a^- = N-N_a^+ + C_{s}$ negative samples. We optimize their similarities with respect to the query sample.} Following circle loss \cite{sun2020circle}, we use self-paced weighting to softly emphasize harder sample pairs by giving larger weights to them to get effective update. \noindent\textbf{Mean teacher method.} Mean teacher is a method that temporally averages model weights over training steps, which tends to produce a more accurate model than using the final weights directly \cite{tarvainen2017mean}. As illustrated in Fig.~\ref{fig:fm}, there is no gradient back-propagation over the teacher model which just maintains a temporal moving average of the student model. This method is simple yet effective. We use the features from the teacher model to perform clustering and the final ReID inference. \subsection{Uncertainty-guided Optimization} \label{subsec:uncertainty} \begin{figure}[!t] \centering \includegraphics[width=1.0\linewidth]{figure3.jpg} \caption{Uncertainty estimation module. For a sample $\boldsymbol{x}_i$ and its feature $\boldsymbol{\tilde{f}}_i$ from the mean teacher model and feature $\boldsymbol{f}_i$ from the student model, we estimate the uncertainty of its pseudo label by calculating the KL divergence of their soft multilabels.} \label{fig:fm2} \end{figure} The noisy pseudo labels would mislead the feature learning in the fine-tuning stage and hurt the adaptation performance. We aim to reduce the negative influence of noisy pseudo labels by evaluating the credibility of the pseudo label of each sample and suppress the contributions of samples with error-prone pseudo labels in the ReID losses. \noindent{\textbf{Uncertainty estimation.}} Intuitively, the higher of the uncertainty the model has on its output of a sample, the lower of the reliability (larger of observation noise) of the output and it is more likely to have incorrect pseudo labels through clustering. We have observed in Fig.~\ref{fig:intro} that the samples with wrong pseudo labels in general have higher uncertainty values than those with correct pseudo labels. We leverage the uncertainty to softly assess the credibility of samples. We estimate the uncertainty based on the output consistency between the mean teacher model and the student model. For a sample $\boldsymbol{x}_i$ of the target domain, we denote the extracted feature from the student model as $\boldsymbol{f}_i \in \mathbb{R}^{D}$ of $D$ dimensions, and the feature from the teacher model as $\boldsymbol{\tilde{f}}_i \in \mathbb{R}^{D}$. One straightforward solution to calculate the consistency between the mean teacher model and the student model is to calculate the distance (\egno, cosine distance) between the two features. However, this is clustering ignorance which does not capture/explore the global distribution of the target domain samples. In MAR \cite{yu2019unsupervised}, they measure the class likelihood vector (\textit{i}.\textit{e}., soft multilabel) of a person image with a set of reference persons (from an auxiliary domain). The inconsistency with the soft multilabel vector of an anchor sample is used to mine the hard negative sample that is visually similar to the anchor image but is of a different identity. Inspired by this, we propose to evaluate the uncertainty based on the inconsistency of the two features $\boldsymbol{f}_i$ and $\boldsymbol{\tilde{f}}_i$, by calculating the distance (\egno, KL distance, L1 distance) of their soft multilabels with respect to the same set of cluster centers. Particularly, as illustrated in Fig.~\ref{fig:fm2}, we use the class centers of source dataset and the cluster centers of the target domain data together to form the set of ``reference persons''. The soft multilabel agreement is analog to the voting by the ``reference persons'' to evaluate the relative consistency. Besides, through the comparison with the cluster centers of the target domain data, the soft multilabel captures some global information of the clustering centers which is related to pseudo label assignment. As an auxiliary domain, the source centers provide additional references. Let ${R} =[R_t, R_s] \in \mathbb{R}^{K_r \times D}$ denote a matrix which stores the features of the $K_r$ ``reference persons'', with each column denoting the feature of a ``reference person''. $R_t \in \mathbb{R}^{K_t \times D}$ denotes the $K_t$ cluster centers of the target domain data, and $R_s \in \mathbb{R}^{K_s \times D}$ denotes the $K_s$ class centers of the source domain data (which are obtained from the weights of the fully-connected layer of the ID classifier). $K_r=K_t+K_s$. For a feature $\boldsymbol f_i \in \mathbb{R}^{D}$ from the student model, we calculate the similarity to the $K_r$ ``reference persons'' and obtain the soft multilabel (likelihood vector) as: \begin{equation} \boldsymbol p_i = {\rm{Softmax}} \left( R \cdot \boldsymbol f_i \right), \end{equation} where Softmax($\cdot$) denotes softmax function which normalizes the similarity scores. Similarly, for the feature $\boldsymbol{\tilde{f}}_i$ from the mean teacher model, we obtain its soft multilabel as $\boldsymbol{\tilde{p}}_i$. We use KL divergence to measure the difference between the two probability distributions from the two models as the uncertainty $u_i$ of the sample $\boldsymbol x_i$: \begin{equation} u_i = D_{KL}(\boldsymbol{\tilde{p}}_i || \boldsymbol p_i)= \sum_{k=1}^{K_r} \tilde{p}_{i,k} \log \frac{\tilde{p}_{i,k}}{p_{i,n}}.\\ \end{equation} \noindent{\textbf{Optimization.}} We have observed that a sample with a wrong pseudo-label (through clustering), in general, has a higher uncertainty. Based on this observation, we propose to exploit the uncertainty to estimate the unreliability of the pseudo-label of a sample and use it to re-weight the contributions of samples in various ReID losses. For a sample $\boldsymbol{x}_i$ with high uncertainty, we will reduce its contribution to the losses. Therefore, we could assign $\omega_i= 1/u_{i}$ as the credibility weight. To enable more stable training, we adopt the policy in~\cite{kendall2017uncertainties} and define $\omega_i = {\rm{exp}}({-u_i})$. We incorporate the uncertainty-guided optimization in the classification loss, triplet loss, and contrastive loss, respectively. For \emph{ID Classification loss}, we define the uncertainty-guided ID classification loss in a min-batch of $n_t$ target domain samples as \begin{equation} \mathcal{L}_{UID} =-\frac{1}{n_{t}} \sum_{i=1}^{n_{t}} \mathcal \omega_{i} \log p\left(\tilde{y}_{i} | \boldsymbol{x}_{i}\right), \label{eq:9} \end{equation} where $p\left(\tilde{y}^t_{i} | \boldsymbol{x}^t_{i}\right)$ denotes the probability of being class $\tilde{y}^t_{i}$, where $\tilde{y}^t_{i}$ denotes the pseudo groudtruth class (based on the pseudo label assigned after clustering). For a sample with high uncertainty, a smaller weight is used to reduce its contribution to the overall loss to reduce its negative effect. As a typical sample-pair similarity optimization, triplet loss is widely used in ReID to make the similarity between an anchor sample and a positive sample to be much larger than that between this anchor sample and negative sample. For the $j^{th}$ triplet of an anchor sample, a positive sample and a negative sample that correspond to three pseudo labels, we approximate the reliability of a sample pair, \egno, the positive sample pair, by a function of the two uncertainties as \begin{equation} \mathcal{\omega}_{ap}^j = \varphi(u_{a}^j, u_{p}^j), \label{eq:omega} \end{equation} where $u_a^j$ and $u_p^j$ denote the estimated uncertainty for the anchor sample and positive sample in the $j^{th}$ triplet, respectively. For simplicity, we define the pair credibility as the average of two credibility as $\varphi(u_{a}^j, u_{p}^j) = \omega_a^j + \omega_p^j = {\rm{exp}}({-u_a^j}) + {\rm{exp}}({-u_p^j})$. Similarly, we get $\mathcal{\omega}_{an}^j$ for the negative sample pair. For \emph{triplet loss}, we define the uncertainty-guided triplet loss in a min-batch of $n_{tr}$ triplets as \small \begin{equation} \mathcal{L}_{UTRI}\!=-\frac{1}{n_{tr}} \sum\limits_{j=1}^{n_{tr}} \log \frac{\omega_{ap}^j \exp(s_{ap}^j)}{ \omega_{ap}^j \exp(s_{ap}^j)\!+\! \omega_{an}^j \exp(s_{an}^j)}, \end{equation} \normalsize where $s_{an}^j$ denotes the similarity for the $j^{th}$ positive sample pair. Mathematically, the lower credibility (higher uncertainty) of a sample pair, the smaller of a weight on the similarity and thus a smaller gradient in optimization, \textit{i}.\textit{e}., contributing smaller to the optimization. For \emph{contrastive loss}, given a query/anchor sample $\boldsymbol{x}_k$, we have $N_k^+$ positive samples and $N_k^-$ negative samples in the memory bank. For a batch of $n_t$ samples, by introducing the sample pair credibility weights, the uncertainty-guided contrastive loss is as \small \begin{equation} \mathcal{L}_{\text {UCT}}\!=\!\frac{1}{n_t} {\sum\limits_{k=1}^{n_t}}\log\!\!\left[\!\! 1+{\sum\limits_{j=1}^{N_k^-} \omega_{kj}^- {\rm{exp}}(s_{kj}^-) \sum\limits_{i=1}^{N_k^+} \omega_{ki}^+ {\rm{exp}}(-s_{ki}^+) }\right], \label{eq:UCT} \end{equation} \normalsize where $s_{kj}^-$ denotes the similarity between the query sample $\boldsymbol{x}_k$ and the $j^{th}$ negative sample, and $\omega_{kj}^-$ denotes the approximated reliability of the sample pair (see (\ref{eq:omega})). The lower credibility of a sample pair, the smaller the gradient and the contribution of this pair to the optimization. \textcolor{black}{Note that similar to our strong baseline, we also use self-paced weighting ~\cite{sun2020circle} to softly emphasize harder sample pairs (whose similarity score deviates far from the optimum) by giving larger weights to them to get effective update. For simplicity, we do not present it in (\ref{eq:UCT}), where $s_{kj}^-$, $s_{ki}^+$ denote the similarities that already re-weighted. } The total loss for the target domain data in the fine-tuning stage could be formulated as: \begin{equation} \mathcal L_{target} = \mathcal L_{UID} + \lambda_{tri} \mathcal L_{UTRI} + \lambda_{ct} \mathcal L_{UCT} + \lambda_{reg} \mathcal L_{reg}, \end{equation} where $L_{reg} = \frac{1}{n_t} {\sum_{i=1}^{n_t}} u_i$ is a regularization loss which prevents large uncertainty (\textit{i}.\textit{e}., small credibility which could reduce the first three losses) all the time. $\lambda_{tri}$, $\lambda_{ct}$, and $\lambda_{reg}$ are weighting factors. \begin{comment} ================================================== \begin{equation} \mathcal{L}_{u i d} =-\frac{1}{m_{t}} \sum_{i=1}^{m_{t}} \mathcal U_{i} \log p\left(\tilde{y}^t_{i} | \boldsymbol{x}^t_{i}\right), \label{eq:9} \end{equation} For the pair similarity optimization losses, triplet loss When we obtain a pair uncertainty about a similarity score, it should get a weighting factor so as to get effective update with different gradient. Large uncertainty should bring the small gradient and vice versa. To this end, we define the triplet loss with uncertainty re-weighting: \begin{equation} \mathcal{L}_{utri} =\frac{1}{m_{t}} \sum\limits_{i=1}^{m_{t}} \max \left(0,s^n_i (\mathcal U_{n}+\mathcal U_{i})/2 - s^p_i (\mathcal U_{p}+\mathcal U_{i})/2 \right), \end{equation} where $U_{i}$ indicates the uncertainty of anchor, $U_{n}$and $U_{p}$ indicate the uncertainty of negative and positive samples, respectively. In a similar spirit, weighted contrastive loss and identification loss also can be rectified by the uncertainty: \begin{equation} \mathcal{L}_{\text {ucl}}=\frac{1}{m_t} \sum_{i=1}^{m_t}\log\left[ 1+{\sum\limits_{j=1}^{L} S_{i,j}^p (\mathcal U_{i}+\mathcal U_{j})\sum\limits_{k=1}^{K} S_{i,k}^n (\mathcal U_{i}+\mathcal U_{k})} \right],\\ \end{equation} \begin{equation} \mathcal{L}_{u i d} =-\frac{1}{m_{t}} \sum_{i=1}^{m_{t}} \mathcal U_{i} \log p\left(\tilde{y}^t_{i} | \boldsymbol{x}^t_{i}\right), \label{eq:9} \end{equation} Since most pseudo labels are correct, the model still could learn from the noisy labels. In Section 4.4, we show the uncertainty with pseudo labels further boosts the performance on the target domain despite the noise in pseudo labels. We could obtain two distributions by the student model and the mean-teacher model, respectively. To rectify the learning from noisy labels, we calculate the KL divergence between predicted likelihood of classification of two models as the uncertainty of samples: \begin{equation} \mathcal L_{KL}(\boldsymbol p_i,\boldsymbol{\tilde{p}}_i)= \sum_{n=1}^{N_t+N_s} p_{i,n} \log{p_{i,n}/\tilde{p}}_{i,n}\\ \end{equation} It is worthy to note that the larger the KL divergence, the less the sample uncertainty. Therefore, we can use the $1/L_{kl}$ to re-weight the ReID loss. \begin{equation} [\boldsymbol V, \boldsymbol W]=[\boldsymbol V_1, \boldsymbol V_2, ..., \boldsymbol V_{N_t} , \boldsymbol W_1, \boldsymbol W_2, ..., \boldsymbol W_{N_s}], \end{equation} =========== Particularly, we calculate the similarity distribution of features between samples and the target cluster centers. Then we adopt the Kullback-Leibler divergence between the two similarity distribution as the uncertainty of the sample. The consistency levels for the samples with wrong pseudo labels are much lower than those with correct pseudo labels. Let $\boldsymbol{V} \in \mathbb{R}^{N_t \times D}$ denotes a target prototype which stores all target clustering center and $\boldsymbol W \in \mathbb{R}^{N_s \times D}$ denotes a source prototype which stores all source center. These prototype weight vectors indicates the fully-connected weights or the identification center of features. $D$ is the feature dimension in the last linear layer: \begin{equation} [\boldsymbol V, \boldsymbol W]=[\boldsymbol V_1, \boldsymbol V_2, ..., \boldsymbol V_{N_t} , \boldsymbol W_1, \boldsymbol W_2, ..., \boldsymbol W_{N_s}], \end{equation} As shown in Fig.~\ref{fig:fm2}, given a feature $\boldsymbol f_i \in \mathbb{R}^{1 \times D}$ from student model and a feature $\boldsymbol{\tilde{f}}_i \in \mathbb{R}^{1 \times D}$ from mean teacher model, we calculate the similarity to target clustering center and source center for each mini-batch of target features: \begin{equation} \boldsymbol p_i = [\boldsymbol V, \boldsymbol W] \cdot {\boldsymbol f_i}^{T} \in \mathbb{R}^{(N_t+N_s) \times 1}, \end{equation} where $\boldsymbol p_i$ indicates the similarity distribution from the student model, the $\boldsymbol{\tilde{p}}_i$ is from the mean-teacher model. We could obtain two distributions by the student model and the mean-teacher model, respectively. To rectify the learning from noisy labels, we calculate the KL divergence between predicted likelihood of classification of two models as the uncertainty of samples: \begin{equation} \mathcal L_{KL}(\boldsymbol p_i,\boldsymbol{\tilde{p}}_i)= \sum_{n=1}^{N_t+N_s} p_{i,n} \log{p_{i,n}/\tilde{p}}_{i,n}\\ \end{equation} It is worthy to note that the larger the KL divergence, the less the sample uncertainty. Therefore, we can use the $1/L_{kl}$ to re-weight the ReID loss. To stabilize the training, we adopt the policy in~\cite{kendall2017uncertainties} that replace $1/L_{kl}$ as $\exp^{-L_{kl}}$: \begin{equation} \mathcal U_i= \exp(-L_{KL}(\boldsymbol p_i,\boldsymbol{\tilde{p}}_i)) \label{eq:uncer} \end{equation} where $\mathcal U_i$ indicates the credibility of the $i$-th samples. We have observed that a sample with a wrong pseudo-label through clustering, in general, has a weaker consistency between the output of the mean teacher model and the student model. Based on this observation, we propose to exploit the uncertainty (measured by consistency levels) to evaluate the reliability of the pseudo-label of a sample and incorporate the uncertainty to re-weight its contributions in ReID losses. We incorporate the uncertainty-guided optimization in the classification loss, triplet loss, and contrastive loss for ReID. When we obtain a pair uncertainty about a similarity score, it should get a weighting factor so as to get effective update with different gradient. Large uncertainty should bring the small gradient and vice versa. To this end, we define the triplet loss with uncertainty re-weighting: \begin{equation} \mathcal{L}_{utri} =\frac{1}{m_{t}} \sum\limits_{i=1}^{m_{t}} \max \left(0,s^n_i (\mathcal U_{n}+\mathcal U_{i})/2 - s^p_i (\mathcal U_{p}+\mathcal U_{i})/2 \right), \end{equation} where $U_{i}$ indicates the uncertainty of anchor, $U_{n}$and $U_{p}$ indicate the uncertainty of negative and positive samples, respectively. In a similar spirit, weighted contrastive loss and identification loss also can be rectified by the uncertainty: \begin{equation} \mathcal{L}_{\text {ucl}}=\frac{1}{m_t} \sum_{i=1}^{m_t}\log\left[ 1+{\sum\limits_{j=1}^{L} S_{i,j}^p (\mathcal U_{i}+\mathcal U_{j})\sum\limits_{k=1}^{K} S_{i,k}^n (\mathcal U_{i}+\mathcal U_{k})} \right],\\ \end{equation} \begin{equation} \mathcal{L}_{u i d} =-\frac{1}{m_{t}} \sum_{i=1}^{m_{t}} \mathcal U_{i} \log p\left(\tilde{y}^t_{i} | \boldsymbol{x}^t_{i}\right), \label{eq:9} \end{equation} Since most pseudo labels are correct, the model still could learn from the noisy labels. In Section 4.4, we show the uncertainty with pseudo labels further boosts the performance on the target domain despite the noise in pseudo labels. \subsection{Optimization} We integrate the above-mentioned losses. The total loss of the training could be formulated as: \begin{equation} \mathcal L_{target} = \mathcal L_{utri} + \mathcal L_{uid} + \mathcal L_{ucl} + \lambda_{kl} \mathcal L_{kl}, \end{equation} where $lambda_{kl}$ is the weight for the consistency regularization. We do not intend to minimize the ReID loss under all conditions. If the uncertainty has received one large value, we will not punish the ReID loss. Meanwhile, to prevent that the model predicts the credibility all the time, as a trade-off, we introduce the regularization term via adding $L_{kl}$. ...... \paragraph{Overview} Deep-cluster framework is the general pipeline due to the conciseness and effectiveness of this framework. To be specific, a ReID model $F(\cdot | \boldsymbol{\theta})$ is generally pre-trained via a supervised task on source domain data, where $\theta$ denotes the parameters of network. Then we adopt this pre-trained network to extract the features of target domain images which denote as $\left\{\boldsymbol{f_i^t}=F\left(\boldsymbol{x}_{i}^{t} | \boldsymbol{\theta}\right)\right\}|_{i=1} ^{N_{t}} \in \mathbb{R}^{D}$. After that, the target domain images are grouped into $K$ classes by clustering these embedding features. Let $\{\tilde{\boldsymbol{y}}_{i}^{t}\}|^{N_t}_i\in\{1, \ldots, K\}$ denotes the pseudo labels generated for target domain images $\{x_{i}^{t}\}|_{i}^{N_t}$, which contain the noisy label. Then, to calculate a cross-entropy loss, a classification head $FC_k: \mathbb{R}^{D} \rightarrow \mathbb{R}^{K}$ is adopted to convert the embedding feature to a score vector, in the form of $p\left(\tilde{y}^{t}_{i} | \boldsymbol{x}^{t}_{i}\right)=\operatorname{softmax}\left(FC( F(\boldsymbol{x}_{i}^{t} | \boldsymbol{\theta}))\right)$. The network parameters $\theta$ and a learnable target-domain classifier $FC_k$ are then optimized with respect to a cross-entropy loss $\mathcal{L}_{i d}^{t}(\boldsymbol{\theta})$ and a triplet loss $\mathcal{L}_{t r i}^{t}(\boldsymbol{\theta})$ in the form of, \begin{equation} \begin{aligned} \mathcal{L}_{i d}^{t}(\boldsymbol{\theta}) =-\frac{1}{m_{t}} \sum_{i=1}^{m_{t}} \log p\left(\tilde{y}^t_{i} | \boldsymbol{x}^t_{i}\right) \\ \mathcal{L}_{t r i}^{t}(\boldsymbol{\theta}) =\frac{1}{m_{t}} \sum_{i=1}^{m_{t}} \max \left(0,s^n_i-s^p_i+m\right), \end{aligned} \label{eq:1} \end{equation} where $m_t$ is the mini-batch size of target data, $s^p_i=\boldsymbol{f}_{i}^{t} \boldsymbol{f}_{i, p}^{t}/ \| {\boldsymbol{f}_{i}^{t}}^T \| \cdot \| \boldsymbol{f}_{i, p}^{t}\|$ denotes the hardest positive cosine similarity, $s^n_i=\boldsymbol{f}_{i}^{t} \boldsymbol{f}_{i, n}^{t}/ \| {\boldsymbol{f}_{i}^{t}}^T \| \cdot \| \boldsymbol{f}_{i, n}^{t}\|$ denotes the hardest negative cosine similarity, scripts $i,p$ and $j,n$ indicate the indices of hardest positive and negative feature in each mini-batch for the sample $x^t_i$, and $m = 0$ denotes the triplet distance margin. In the stage of clustering, some noisy labels may be generated. This can be partly alleviated by using the mean teacher model~\cite{tarvainen2017mean} at inference time, and consequently a mean teacher can yield more accurate targets. Therefore, we use the mean teacher model to enhance our baseline, which maintains a exponential moving average (EMA) parameters from student model. The parameters of the temporally average model at current iteration $T$ are denoted $\boldsymbol\theta_T$ respectively, which can be calculated as: \begin{equation} \boldsymbol\theta^T_{t} = \alpha \boldsymbol\theta^{T-1}_{t} + (1-\alpha) \boldsymbol\theta^{T}_{s}, \end{equation} where $\boldsymbol\theta^T_{t}$ indicates the temporal average parameters in the $T$-th iteration and $\boldsymbol\theta^{T}_{s}$ indicates the parameters of student model. The initial temporal average parameter of teacher model is same as the student model. Existing methods for person ReID mostly use the triplet loss and classification loss to train the model. However, the hard-mining strategy of these works is intrinsically limited by mini-batch training. It means that only the local negative and positive pairs are accessible. Mining informative negative and positive instances are of central importance to this task. Thus, we adopt a memory bank to memorize the embeddings of past iterations, which allows the model to collect sufficient negative and positive pairs from multiple mini-batches to over the whole dataset. Such two steps, pseudo label generation by clustering and feature learning with pseudo labels, are alternated until the training converges. However, because of domain gap, the pseudo-labels are not always reliable and there are noisy labels. This would mislead the feature representation learning towards learning noisy information. So, we need to exploit the credibility of the assigned pseudo-label of each sample to alleviate the influence of noisy labels, by suppressing the contribution of noisy samples and encouraging a higher contribution of good samples in the optimization. As illustrated in Fig.~\ref{fig:fm}, the framework is alternated to gradually train the ReID model on target domain with the guidance of pseudo labels. \subsection{Target Instance Memory Bank} We first describe our target instance memory bank module, with updating mechanism. Then we show that a weighting scheme focusing on informative pairs is beneficial for contrastive loss with multiple positive samples. \paragraph{Updating mechanism.} We use the memory bank~\cite{he2019momentum} to memory the features of whole dataset. When the mini-batch of samples are coming, we maintain the memory bank as a queue of data samples. This allows us to reuse the embeddings of features from the immediate preceding mini-batches. The introduction of a queue decouples the memory bank size from the mini-batch size. Our memory bank size can be much larger than a typical mini-batch size, and can be flexibly and independently set as a hyper-parameter. The samples in the dictionary are progressively replaced. The current mini-batch is enqueued to the dictionary, and the oldest mini-batch in the queue is removed. The dictionary always represents a sampled subset of all data, while the extra computation of maintaining this dictionary is manageable. Moreover, removing the oldest mini-batch can be beneficial, because its encoded keys are the most outdated and thus the least consistent with the newest ones. \paragraph{Weighted contrastive loss} Then we use the cosine distance to calculate the similarity $s$ of features between mini-batch and memory bank. Moreover, according to the pseudo labels, we split the samples to the $L$ negative pairs and $K$ positive pairs, where weighted contrastive loss~\cite{sun2020circle} is suitable for this issue. Thus, weighted contrastive loss is proposed to better calculate the loss in terms of multiple positive samples, which is beneficial for the optimization of model: \begin{equation} \begin{aligned} \mathcal{L}_{\text {cl}}=-\frac{1}{m_t} \sum_{i=1}^{m_t}\log[ \frac{\sum_{j=1}^{L} S_{i,j}^p}{\sum_{j=1}^{L} S_{i,j}^p+\sum_{k=1}^{K} S_{i,k}^n} ], \end{aligned} \label{eq:9} \end{equation} where $S_{i,j}^n= \exp \left( \alpha^{n}_{j}\left(s^{n}_{j}-m\right)\right)$ refers to the multiple positive paired similarity, $S_{i,k}^p= \exp \left( \alpha^{p}_{k}\left(s^{p}_{k}-1+m\right)\right)$ indicates the multiple negative paired similarity, $\alpha^{n}_{j}=[m+s^n_j]_{+}$ and $\alpha^{p}_{k}=[1+m-s^p_k]_{+}$ are non-negative weighting factors respectively, $[\cdot]_{+}$ is the ``cut-off at zero'' operation, $m$ refers to a margin in order to better separate similarity, and $L$ and $K$ denote the number of negative pairs and positive pairs in the memory bank for the sample $x^t_i$ of mini-batch. ========================================== \end{comment} \section{Experiments} \begin{table*}[t!] \footnotesize \centering \caption{Performance (\%) comparison with the state-of-the-art methods for UDA person ReID on the datasets of DukeMTMC-reID, Market-1501 and MSMT17. We mark the results of the second best by \underline{underline} and the best results by \textbf{bold} text. } \vspace{-3mm} \begin{center} \begin{tabular}{|P{6.0cm}|C{1.0cm}C{1.0cm}C{1.0cm}C{1.0cm}|C{1.0cm}C{1.0cm}C{1.0cm}C{1.0cm}|} \hline \multicolumn{1}{|c|}{\multirow{2}{*}{Methods}} & \multicolumn{4}{c|}{DukeMTMC$\to$Market1501} & \multicolumn{4}{c|}{Market1501$\to$DukeMTMC} \\ \cline{2-9} \multicolumn{1}{|c|}{} & mAP & R1 & R5 & R10 & mAP & R1 & R5 & R10 \\ \hline ATNet~\cite{Liu2019cvpr}(CVPR'19) & 25.6& 55.7& 73.2& 79.4& 24.9 &45.1 &59.5& 64.2\\ SPGAN+LMP~\cite{DengWeijian2018cvpr}(CVPR'18) &26.7 &57.7 &75.8 &82.4& 26.2&46.4 &62.3 &68.0 \\ CFSM~\cite{chang2018disjoint} (AAAI'19) & 28.3 & 61.2 & - & - & 27.3 & 49.8 &- & - \\ BUC~\cite{lin2019aBottom} (AAAI'19) & 38.3 & 66.2 & 79.6 & 84.5 & 27.5 & 47.4 & 62.6 & 68.4 \\ ECN~\cite{zhong2019invariance} (CVPR'19) & 43.0 & 75.1 & 87.6 & 91.6 & 40.4 & 63.3 & 75.8 & 80.4 \\ UCDA~\cite{qi2019novel} (ICCV'19) & 30.9 & 60.4 & - & - & 31.0 & 47.7 & - & - \\ PDA-Net~\cite{li2019cross} (ICCV'19) & 47.6 & 75.2 & 86.3 & 90.2 & 45.1 & 63.2 & 77.0 & 82.5 \\ PCB-PAST~\cite{zhang2019self} (ICCV'19) & 54.6 & 78.4 & - & - & 54.3 & 72.4 & - & - \\ SSG~\cite{yang2019selfsimilarity} (ICCV'19) & 58.3 & 80.0 & 90.0 & 92.4 & 53.4 & 73.0 & 80.6 & 83.2 \\ ACT~\cite{Yang2019Asymmetric} (AAAI'20) & 60.6 & 80.5 & - & - & 54.5 & 72.4 & - & - \\ MPLP~\cite{WANG2020cvpr1} (CVPR'20) & 60.4 &84.4 &92.8& 95.0 & 51.4&72.4 &82.9& 85.0 \\ DAAM~\cite{Huang2020aaai} (AAAI'20)& {67.8} & {86.4} & {-} & {-} & {63.9} & {77.6} & {-} & {-} \\ AD-Cluster~\cite{zhai2020adcluster} (CVPR'20)& {68.3} & {86.7} & {94.4} & {96.5} & {54.1} & {72.6} & {82.5} & {85.5} \\ MMT~\cite{ge2020mutual} (ICLR'20) & {71.2} & {87.7} & {94.9} & {96.9} & {65.1} & {78.0} & \underline{88.8} & \underline{92.5} \\ NRMT~\cite{zhao2020unsupervised}(ECCV'20) & 71.7& 87.8& 94.6& 96.5& 62.2& 77.8& 86.9& 89.5 \\ B-SNR+GDS-H~\cite{jin2020global}(ECCV'20) & 72.5 & 89.3 & - & - & 59.7 & 76.7 &- &-\\ MEB-Net~\cite{zhai2020multiple}(ECCV'20) & \underline{76.0} &\underline{89.9}& \underline{96.0}& \underline{97.5}& \underline{66.1}& \underline{79.6} & 88.3& 92.2 \\ \hline UNRN (Ours) & \textbf{78.1} & \textbf{91.9} & \textbf{96.1} & \textbf{97.8} & \textbf{69.1} & \textbf{82.0} & \textbf{90.7} & \textbf{93.5} \\ \hline \end{tabular}\\ \begin{tabular}{|P{6.0cm}|C{1.0cm}C{1.0cm}C{1.0cm}C{1.0cm}|C{1.0cm}C{1.0cm}C{1.0cm}C{1.0cm}|} \hline \multicolumn{1}{|c|}{\multirow{2}{*}{Methods}} & \multicolumn{4}{c|}{Marke1501$\to$MSMT17} & \multicolumn{4}{c|}{DukeMTMC$\to$MSMT17} \\ \cline{2-9} \multicolumn{1}{|c|}{} & mAP & R1 & R5 & R10 & mAP & R1 & R5 & R10 \\ \hline ECN~\cite{zhong2019invariance} (CVPR'19) & 8.5 & 25.3 & 36.3 & 42.1 & 10.2 & 30.2 & 41.5 & 46.8 \\ SSG~\cite{yang2019selfsimilarity} (ICCV'19) & 13.2 & 31.6 &- & 49.6 & 13.3 & 32.2 & - & 51.2 \\ DAAM~\cite{Huang2020aaai} (AAAI'20)& {20.8} & { 44.5} & {-} & {-} & { 21.6} & { 46.7} & {-} & {-} \\ NRMT~\cite{zhao2020unsupervised}(ECCV'20) & 19.8& 43.7& 56.5 &62.2& 20.6 &45.2& 57.8& 63.3 \\ MMT~\cite{ge2020mutual} (ICLR'20) & \underline{22.9} & \underline{49.2} & \underline{63.1} & \underline{68.8} & \underline{23.3} & \underline{50.1} & \underline{63.9} & \underline{69.8} \\ \hline UNRN (Ours) & \textbf{25.3} & \textbf{52.4} & \textbf{64.7} & \textbf{69.7} & \textbf{26.2} & \textbf{54.9} & \textbf{67.3} & \textbf{70.6} \\ \hline \hline \end{tabular} \end{center} \label{tab:sota} \end{table*} \subsection{Datasets and Evaluation Metrics} We evaluate our methods using three person ReID datasets, including DukeMTMC-reID (Duke) ~\cite{dukemtmc}, Market-1501 (Market) ~\cite{market} and MSMT17~\cite{wei2018person}. DukeMTMC-reID~\cite{dukemtmc} has 36,411 images, where 702 identities are used for training and 702 identities for testing. Market-1501~\cite{market} contains 12,936 images of 751 identities for training and 19,281 images of 750 identities for testing. MSMT17~\cite{wei2018person} contains 126,441 images of 4,101 identities, where 1,041 identities and 3060 identities are used for training and testing respectively. We adopt mean average precision (mAP) and CMC Rank-1/5/10 (R1/R5/R10) accuracy for evaluation. \subsection{Implementation Details} \label{sec:imp} We use ResNet50 pretrained on ImageNet as our backbone networks. As ~\cite{luo2019bag}, we perform data agumentation of randomly erasing, cropping, and flipping. For source pre-training, each mini-batch contains 64 images of 4 identities. For our fine-tuning stage, when the source data is also used, each mini-batch contains 64 source-domain images of 4 identities and 64 target-domain images of 4 pseudo identities, where there are 16 images for each identity. All images are resized to 256$\times$128. Similar to \cite{ge2020mutual,yang2019selfsimilarity}, we use the clustering algorithm of DBSCAN. For DBSCAN, the maximum distance between neighbors is set to $eps=0.6$ and the minimal number of neighbors for a dense point is set to 4. ADAM optimizer is adopted. The initial learning rate is set to 0.00035. We set the weighting factors $\lambda_{tri}=1$, $\lambda_{ct}=0.05$, and $\lambda_{reg}=1$, where we determine them simply by making the several losses on the same order of magnitude. \subsection{Comparison with the State-of-the-arts} We compare our proposed UNRN with the state-of-the-art methods on four domain adaptation settings in Tab.~\ref{tab:sota}. Our UNRN significantly outperforms the second best UDA methods by $2.1\%$, $3.0\%$, $2.4\%$ and $2.9\%$, in mAP accuracy, for Duke$\to$Market, Market$\to$Duke, Market$\to$MSMT, and Duke$\to$MSMT, respectively. SSG~\cite{yang2019selfsimilarity} performs multiple clustering on both global body and local body parts. DAAM~\cite{Huang2020aaai} introduces an attention module and incorporates domain alignment constraints. MMT~\cite{ge2020mutual} use two networks (four models) and MEB-Net~\cite{Zhai2020} use three networks (six models) to perform mutual mean teacher training, which have high computation complexity in training. Our UNRN uses only one network (two models) in training but still significantly outperforms the best-performing MEB-Net ~\cite{Zhai2020}. % \subsection{Ablation Studies} \begin{table}[h!] \caption{Ablation studies on the effectiveness of components in our proposed UNRN on Market and Duke. \textbf{Source}: source data is also used in fine-tuning stage with ID classification loss. \textbf{Contrastive loss (CT)}: pair similarity optimization across the memory bank. \textbf{Mean teacher}: use mean teacher method where a temporally moving averaged model is taken as the mean teacher. \textbf{ID}: target domain identity classification loss. \textbf{UID}: ID loss with \emph{uncertainty}. \textbf{TRI}: target domain triplet loss. \textbf{UTRI}: target domain triplet loss with \emph{uncertainty}. \textbf{UCT}: contrastive loss with \emph{uncertainty}.} \centering \footnotesize \vspace{-5pt} \label{tab:ablation1} \begin{center} \begin{tabular}{P{3.4cm}|C{0.7cm}C{0.7cm}|C{0.7cm}C{0.85cm}} \hline \multicolumn{1}{c|}{\multirow{2}{*}{Methods}} & \multicolumn{2}{c|}{Duke$\to$Market}&\multicolumn{2}{c}{Market$\to$Duke} \\ \cline{2-5} \multicolumn{1}{c|}{}& mAP & R1 & mAP & R1 \\ \hline \hline Supervised learning &85.7&94.1&75.8&86.2\\ \hline \hline Model pretraining &32.9&62.6&35.2&53.3\\ \hline Baseline &68.2&87.9&60.4&75.9\\ +Source &70.4&88.3&61.3&76.4\\ +Contrastive loss &72.1&88.7&62.1&77.6\\ +Mean teacher (SBase.) &75.4&89.8&64.8&79.7\\ \hline SBase.~(ID+TRI+CT) &75.4&89.8&64.8&79.7\\ SBase.~w/~UID &77.3&91.2&68.2&81.3\\ SBase.~w/~UTRI &76.1&90.9&66.3&81.0\\ SBase.~w/~UID+UTRI &77.8&91.5&68.9&81.7\\ SBase.~w/~UID+UTRI+UCT &78.1&91.9&69.1&82.0\\ \hline \end{tabular} \end{center} \vspace{-15pt} \end{table} \noindent\textbf{Effectiveness of components in our strong baseline.} We build our basic baseline \emph{Baseline} following the commonly used baselines in UDA methods~\cite{ge2020mutual,song2020unsupervised,jin2020global}, where in the fine-tuning stage, the identity classification loss and triplet loss are used to fine-tune the network based on the pseudo labels for the target domain data. On top of \emph{Baseline}, we add three components (as described in Section \ref{subsec:baseline}. Tab.~\ref{tab:ablation1} shows that each component brings additional significant gain and finally we have a strong baseline \emph{SBase.}. \noindent\textbf{Effectiveness of our uncertainty-guided optimization.} We validate the effectiveness of our proposed design on top of a strong baseline \emph{SBase.}. In general, the stronger of a baseline, the harder one can achieve gains since the cases easy to address are mostly handled by the strong baseline. Once the new design is complementary to the strong baseline, it is valuable to advance the development of techniques. In the strong baseline \emph{SBase.}, for the target domain samples, identity classification loss (ID), triplet loss (TRI), and contrastive loss (CT) are used for supervision based on pseudo labels. To alleviate the negative influence of noisy/wrong pseudo labels, we exploit uncertainty to re-weight the contributions of samples. Tab.~\ref{tab:ablation1} shows the comparisons. When we replace ID loss by UID loss, which is the ID loss with uncertainty, the mAP accuracy is significantly improved by 1.9\% and 3.4\% for Duke$\to$Market and Market$\to$Duke, respectively. When we replace triplet (TRI) loss by UTRI loss, similar improvements are observed. We have our final scheme \emph{UNRN} when the uncertainty-guided optimization is applied to all the three losses and it achieves \textbf{2.7\%} and \textbf{4.3\%} improvement in mAP accuracy over \emph{SBase.} for Duke$\to$Market and Market$\to$Duke, respectively. \subsection{Design Choices} \noindent\textbf{Influence of different designs in uncertainty estimation.} We have discussed the estimation of uncertainty in Section \ref{subsec:uncertainty}. There are some design choices and Tab.~\ref{tab:ablation2} shows the comparisons. \textbf{1)} \emph{UNRN-feat. consist.} denotes that we estimate the uncertainty based on the distance of the features $\boldsymbol{\tilde{f}_i}$ and $\boldsymbol{{f}_i}$ instead of the distance of derived soft multilabels. We can see that the gain over \emph{SBase.} is negligible due to the poor estimation of uncertainty. In contrast, using the consistency between soft multilabels (\textit{i}.\textit{e}. \emph{UNRN-$R$ (Ours)}) captures global information of the target cluster centers and brings significant improvement. \textbf{2)} When we estimate the uncertainty, we leverage a set of ``reference persons'' to get the soft multilabels. \emph{UNRN-$R_t$} denotes the scheme when only the target cluster centers (see Fig.~\ref{fig:fm2}) are used as ``reference persons''. \emph{UNRN-$R_s$} denotes the scheme when only the source centers are used as ``reference persons''. \emph{UNRN-$R$} denotes both are used as ``reference persons''. We can see that the performance of \emph{UNRN-$R_s$} is very similar to that of \emph{SBase.}, where the source centers only cannot provide the clustering information of target domain data and is helpless to estimate the reliability of pseudo labels. \emph{UNRN-$R_t$} outperforms \emph{SBase.} significantly, which captures the target domain global clustering information that is helpful to estimate the reliability of pseudo labels. Interestingly, \emph{UNRN-$R$} which jointly considers the target cluster centers and source centers provides the best performance. That may be because the source centers provide more references which enables the soft multilabels more informative. \noindent\textbf{Influence of regularization loss $\mathcal{L}_{reg}$.} The regularization loss $\mathcal{L}_{reg}$ prevents larger uncertainty all the time. As shown in Tab.~\ref{tab:ablation2}, our final scheme \emph{UNRN-$R$} outperforms \emph{UNRN w/o $\mathcal{L}_{reg}$} by 0.6\% and 1.1\% in mAP accuracy for Duke$\to$Market and Market$\to$Duke, respectively. \begin{table}[t \caption{Influence of different designs in uncertainties estimation, and the influence of regularization loss $\mathcal{L}_{reg}$ on performance under our framework.} \centering \small \vspace{-2mm} \label{tab:ablation2} \begin{center} \begin{tabular}{P{3.6cm}|C{0.7cm}C{0.7cm}|C{0.7cm}C{0.85cm}} \hline \multicolumn{1}{c|}{\multirow{2}{*}{Methods}} & \multicolumn{2}{c}{Duke$\to$Market}&\multicolumn{2}{c}{Market$\to$Duke} \\ \cline{2-5} \multicolumn{1}{c|}{}& mAP & R1 & mAP& R1 \\ \hline \hline SBase. &75.4&89.8&64.8&79.7\\ \hline UNRN w/o $\mathcal{L}_{reg}$ &77.5&91.4&68.0&81.4\\ \hline UNRN-feat. consist. &76.5&91.0&66.7&80.9 \\ UNRN-$R_s$ &76.0&91.3&66.6&81.0 \\ UNRN-$R_t$ &77.8&91.7&68.3&81.7 \\ UNRN-$R$ (Ours) &78.1&91.9&69.1&82.0 \\ \hline \end{tabular} \end{center} \vspace{-10pt} \end{table} \noindent\textbf{Influence of size of memory bank.} We use a queue to maintain \textcolor{black}{$N$ target domain instances in the} memory bank. Tab.~\ref{tab:memory-size} shows that as the queue length $N$ increases, the performance increases but saturates when the size is around 8192. \begin{table}[t] \caption{Influence of the number ($N$) of target instances in the memory bank. We study this on top of baseline scheme \emph{Baseline+Source+Contrastive loss} (see Tab.~\ref{tab:ablation1}). ``All'' denotes the size is equal to the size of target training dataset.} \label{tab:memory-size} \vspace{-8pt} \begin{center} \small \begin{tabular}{c|c|c|c|c|c} \hline \multicolumn{1}{c|}{\multirow{2}{*}{Size of memory bank}} & \multicolumn{5}{c}{Market$\to$Duke}\\ \cline{2-6} \multicolumn{1}{c|}{}& 0 & 1024 & 4096 & 8192 & All \\ \hline \hline mAP & 62.8 & 63.4 & 63.9 & 64.8 & 64.5 \\ \hline R1 & 77.9 & 78.9 & 79.3 & 79.7 & 79.3 \\ \hline \end{tabular} \end{center} \end{table} \vspace{-8pt} \section{Conclusion} In this paper, for clustering-based UDA person ReID, we aim to alleviate the negative influence of wrong/noisy labels during the adaptation. We have observed that a sample with a wrong pseudo-label through clustering in general has a weaker consistency between the output of the mean teacher model and the student model. Based on this finding, we propose to exploit the uncertainty (measured by consistency levels) to evaluate the reliability of the pseudo-label of a sample and incorporate the uncertainty to re-weight its contribution within various ReID losses, including the ID classification loss per sample, the triplet loss, and the contrastive loss. Our uncertainty-guided optimization brings significant improvement over our strong baseline and our scheme achieves the state-of-the-art performance on benchmark datasets. \section{Acknowledgments} This work was in part supported by the National Key R$\&$D Program of China under Grand 2020AAA0105702, National Natural Science Foundation of China (NSFC) under Grants U19B2038 and 61620106009. \section{Ethical Impact} Our method is proposed to help match/identify different persons across images, which can facilitate the development of smart retail systems in the future. When the person re-ID system is used to identify the pedestrian, it may cause a violation of human privacy. Therefore, governments and officials need to carefully formulate strict regulations and laws to ensure the legal use of ReID technology and strictly protect the data. \bibliographystyle{aaai}
{'timestamp': '2020-12-18T02:11:49', 'yymm': '2012', 'arxiv_id': '2012.08733', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08733'}
arxiv
\section{Introduction} One of the prominent fields in robotics is the development of artificial or prosthetic limbs. The most advanced devices are controlled via electromagnetic sensors that measure sEMG signals either from muscles \cite{fajardo2015} or the central nervous system \cite{Li2017}. Artificial limbs are normally controlled via gesture recognition from the sEMG sensor data. This gesture recognition can be either discrete \cite{Du2017} or continuous \cite{Quivira2018}. In the discrete case, there is a limited number of available gestures that the limb can perform, and the goal is to map the sensor data to one of these gestures. Therefore, the recognition task is a classification problem. In our work, we focus instead on continuous gesture recognition, which derives the angles of the limb joints from the data and allows for more life-like limb movement. In this paper, we perform experiments on the task of controlling a robotic hand via an arm band sensor. Previous work (e.g. \cite{fajardo2015, Du2017, Quivira2018}) assumed robotic hands with immobile wrists, which significantly restricts the functionality of the robotic limb. We present, for the first time, experiments with both immobile and mobile wrist data, and show that our proposed techniques outperform the state-of-the-art in both cases. The most successful gesture recognition from the sEMG sensor data methods to date employ recurrent neural networks (RNNs) \cite{Quivira2018}. However, RNNs take a very long time to train to reach a desirable accuracy \cite{Lei2017}. In our work, we propose to use RNNs with simple recurrent units (SRU) \cite{Lei2017}, instead, for continuous gesture recognition. This method has the advantage of reaching a higher gesture recognition accuracy than regular RNNs in the same training time. In addition, we show how domain adaptation techniques \cite{Ganin2014} can be used for continuous gesture recognition, and for the first time empirically demonstrate that these techniques improve the transferability between subjects, where a limb controller trained on data from one person is used for gesture recognition of another person. \section{Background and Related Work} \subsection{sEMG sensors} Surface electromyography is the method of obtaining electric signals coming from neurons that are responsible from muscle contractions. As the name suggests, it is a non-invasive method and electrodes are attached to the skin surface. These signals can be then used in a control system for powered upper-limb prostheses because motions of wrist and fingers are mostly controlled by muscles in the forearm \cite{phinyomark2012}. sEMG sensors range from non-portable units with high measurement accuracy to light and wearable units, albeit with a lower accuracy. In order to retrieve sEMG data, we utilized the Myo armband \cite{Sathiyanarayanan2016}, as shown in Figure~\ref{img:myo}. This device has the advantages of being wearable and having an affordable price\footnote{At the time of writing the price is in the range of \$200}. The Myo armband consists of 8 sEMG sensors capable of recording sEMG data at frequency of 200 Hz. The raw signal is digitized with 8-bit analog-to-digital converter to yield a $[-128,+128]$ range. For wireless connection the Myo armband uses Bluetooth Low Energy technology. \begin{figure}[thtb] \centering \includegraphics[width=0.45\textwidth]{images/band_on_my_arm} \caption{Myo Armband} \label{img:myo} \end{figure} \subsection{Motion capture system} In order to tackle the task of continuous gesture recognition, a motion capture system to extract the limb angles is required for the generation of the data set. Existing motion capture systems are based on a wide range of technologies, including video recording \cite{kim2008}, ultrasound \cite{hettiarachchi2015}, and tracking gloves \cite{kim2009}. In our work, the Leap Motion Controller \cite{leapmotion} was used, which provided a cheap and efficient way to track and record the limb angles of a user's hand. This device is specifically designed for hand movement detection. The controller itself consists of two monochromatic IR cameras and three IR LEDs. The overall accuracy of the controller was shown to be 0.7 millimeters. Motion capture data is transmitted with a frequency from 50 Hz up to 120 Hz. \subsection{Recurrent Neural Networks} Recurrent neural networks (RNNs) \cite{Jain:1999:RNN} are a special type of neural networks designed to work with (numerical) sequence data. The input of an RNN is the sequence and the output is a numerical vector. In our case, the input sequence are the sEMG measurements, and the output is a vector of limb angles. Every neuron of the network on each element of the input sequence updates its state and outputs a value as defined by: \begin{equation} h_t = \sigma_h(W_h x_t + U_h h_{t - 1} + b_h) \\ \end{equation} \begin{equation} y_t = \sigma_y(W_y h_t + b_y) \end{equation} where $x_t$ is the sequence element, $h_t$ is the hidden state, $y_t$ is the output vector, $W, U, b$ are cell parameters, and $\sigma_h$ and $\sigma_y$ are activation functions. \subsection{Hand Gesture Recognition} Initial work on controlling artificial limbs using EMG signals focused on creating a control scheme, i.e. mapping specific signals to specific actions of the limb (e.g. \cite{fajardo2015}). These approaches are not able to tackle a large variety of gestures and the resulting controllers are specific to an individual and can not be transferred to other persons. Gesture recognition methods have been introduced to overcome these limitations. The gesture recognition task can be split into: \begin{enumerate} \item Classification with a number of discrete gestures or poses. \item Regression with respect to recognizing continuous values such as joint angles. \end{enumerate} In most recent and advanced work, Du et al.\ \cite{Du2017} propose a hand gesture classification method employing domain adaption (specifically adaptive batch normalization, AdaBN). The authors generated several datasets with the number of gestures varying from 8 to 12, none of which involved wrist movement. The results showed that AdaBN can improve generalization and tranferability of a convolutional neural network with respect to accuracy on the discrete gesture recognition tasks. Following up on this work, \cite{Quivira2018} focused on continuous gesture recognition (joint angles) using Gaussian processes. Again, unlike our work, this research did not involve any wrist movement. \section{Method} In this section, we present our approach for continuous gesture recognition. Specifically, we propose the use of RNNs with simple recurrent units (SRUs) to achieve a higher accuracy in the same time of training than regular RNNs using gated recurrent units (GRUs). Furthermore, we introduce a novel technique to apply domain adaptation to continuous gesture recognition. \subsection{Simple Recurrent Units} Due to vanishing gradient and exploding gradient problems vanilla RNN is not used nowadays \cite{chung2014}. The most common approach to date is to employ RNNs with GRU cells. \subsubsection{GRU-cell} The GRU-cell features special gates to reduce vanishing and exploding gradient problems. It is defined as: \begin{equation} \label{eq:gru_z_t} z_t = \sigma_g (W_z x_t + U_z h_{t - 1} + b_z) \end{equation} \begin{equation} \label{eq:gru_r_t} r_t = \sigma_g (W_r x_t + U_r h_{t - 1} + b_r) \end{equation} \begin{equation} h_t = (1 - z_t) \odot h_{t - 1} + z_t \odot \sigma_h (W_h x_t + U_h (r_t \odot h_{t - 1}) + b_h) \end{equation} where $x_t$ is the sequence element, $h_t$ is the hidden state and output, $z_t$ is the update gate, $r_t$ is the reset gate, and $W, U, b$ are cell parameters. Figure~\ref{img:rec_scheme_num} illustrates an RNN architecture with GRU cells. \begin{figure}[thtb] \centering \includegraphics[width=0.40\textwidth]{images/rec_scheme_num} \caption{Recurrent neural network architecture \newline 1 - Input data, \newline 2 - The first GRU/SRU layer, \newline 3 - The second GRU/SRU layer, \newline 4 - Fully-connected layer of Predictor, \newline 5 - Fully-connected layer without activation-function - result vector.} \label{img:rec_scheme_num} \end{figure} \subsubsection{SRU-cell} The GRU-cell, due to its internal dependencies, is difficult to parallelize efficiently. In order to reduce computation cost for RNN training and inference, a simple recurrent unit was proposed in \cite{Lei2017} as follows: \begin{equation} \hat{x_t} = W x_t \end{equation} \begin{equation} f_t = \sigma(W_f x_t + b_f) \end{equation} \begin{equation} r_t = \sigma(W_r x_t + b_r) \end{equation} \begin{equation} c_t = f_t \odot c_{t - 1} + (1 - f_t) \odot \hat{x_t} \end{equation} \begin{equation} h_t = r_t \odot \sigma(c_t) + (1 - r_t) \odot x_t \end{equation} where $x_t$ is a sequence element, $h_t$ is the output vector, $c_t$ is the hidden state, $f_t$ is the forget gate, $r_t$ is the reset gate, and $W, U, b$ are cell parameters. The RNN architecture with SRU cells is analogous to the RNN architecture shown in Figure~\ref{img:rec_scheme_num}. \subsection{Domain adaptation} When transferring a gesture recognition network trained on one person to another person, specialized transfer learning techniques are required. Adversarial domain adaptation (ADA) has been shown in recent work \cite{ganin2014unsupervised} to perform well for transfer learning tasks, and we have thus selected it for our research. ADA employs an additional neural network that predicts the current domain of input data from a feature vector. There is a gradient reversal layer between the feature vector and the discriminator network. This layer multiplies gradients by some value between -1 and 0. To train a neural network with ADA, we sum the loss function of the predictor and the loss function of the discriminator and perform back-propagation with a reversal of the discriminator gradient before the feature layer. The goal of this process is to inhibit domain-specific features and thus prevent over-fitting. Figure~\ref{img:rec_scheme_adapt} shows the RNN architecture with domain adaptation. We have also tried adaptive batch normalization, as used for discrete hand gesture recognition in \cite{Du2017}, but this did not show good performance on our continuous gesture recognition tasks. \begin{figure}[thtb] \centering \includegraphics[width=0.40\textwidth]{images/rec_scheme_num_adapt} \caption{Recurrent neural network with domain adaptation architecture \newline 1 - Input data, \newline 2 - The first GRU/SRU layer, \newline 3 - The second GRU/SRU layer, \newline 4 - Fully-connected layer of Predictor, \newline 5 - Fully-connected layer without activation-function - result vector, \newline 6 - Fully-connected layer of Discriminator, \newline 7 - Fully-connected layer without activation function - vector of classes (domains) probabilities.} \label{img:rec_scheme_adapt} \end{figure} \section{Data acquisition} sEMG data was obtained by means of the Myo armband device and finger and wrist angles were captured with the Leap Motion motion capture system. We recorded data recorded from 5 healthy volunteers ranging in age from 20 to 28 years. Each participant was asked to sit on a chair and establish a relaxed position with the wrist slightly above the Leap Motion sensor to ensure accurate motion capture. The participant was then asked to perform a given sequence of hand movements such as bending or stretching the index finger. Two datasets were collected: the first dataset only included movement of fingers with a static wrist (similar to \cite{Quivira2018}, and the second one was aimed to add wrist movements and some casual gestures. Data was collected in sessions with a duration of 4 minutes each. The specifics of the datasets are as follows. \hfill \noindent Immobile wrist dataset: \hfill \begin{enumerate} \item Movements of distinct fingers, 150 s \item Simultaneous movement of all fingers, 60 s \item Free finger movements, 30 s \end{enumerate} \hfill \noindent Mobile wrist dataset: \hfill \begin{enumerate} \item Movements of distinct fingers, 60 s \item Simultaneous movement of all fingers, 30 s \item Pinch, 30 s \item Open palm movements, 30 s \item Thumb movements, 30 s \item Free finger movements, 30 s \end{enumerate} \hfill For each volunteer 8 sessions per dataset were recorded. For the mobile wrist dataset, the volunteers were asked to do the finger movements while keeping the wrist angle at one of 6 specified positions, including four angles on the up-down axis of the wrist, bending the wrist to the right, and keeping it straight. Due to different data acquisition rates of the Myo armband and Leap Motion there is a need for data synchronization and alignment. Global alignment was achieved by matching the dataframes from the two devices, minimizing the difference between the time stamps of the individual dataframes, with a maximum difference of 10 ms. After alignment, the sEMG and limb angle data was filtered with a low pass filter with a frequency of 10 Hz and 4Hz respectively to achieve noise reduction. The sEMG data was split into windows of size 128, which formed the input vector for the recurrent neural network. \section{Experiment Setup} In this section we provide the design parameters of the two RNN approaches used in our experiments. The first approach represents standard RNN technology, while the second approach incorporates optimizations selected by us for the task of continuous gesture recognition. Adversarial domain adaptation was implemented with a gradient reversal layer after the feature generation block. The discriminator block consists of 2 fully connected layers with 256 neurons in the first layer and 15 or 18 neurons in the second (output) layer, since there are 15 angles to predict in the case of an immobile wrist and 18 in case of a mobile wrist. The hyper-parameters of the recurrent neural network with GRU used in our experiments are: \begin{itemize} \item 2 GRU recurrent layers with 256 neurons each. Only the last output was fed to the next layer. \item 2 fully connected layers with 256 and 15 (18) neurons respectively. \item Optimizer: Adam \cite{kingma2014adam} with a learning rate of 0.001. \item Trained for 30 epochs or until there was no validation gain during 8 epochs. \end{itemize} The hyper-parameters for the recurrent neural network with SRU are: \begin{itemize} \item 2 SRU recurrent layers with 256 neurons each. \item Global Average Pooling layer. \item 2 fully connected layers with 256 and 15 (18) neurons respectively. \item Optimizer: Adam with learning rate equals to 0.001. \item Net was trained for 30 epochs or until there was no validation gain during 8 epochs. \end{itemize} \section{Evaluation Metrics} \makeatletter \DeclareRobustCommand{\vardivision}{% \mathbin{\mathpalette\@vardivision\relax } \newcommand{\@vardivision}[2]{% \reflectbox{$\m@th\smallsetminus$}% } \makeatother In our evaluation, we measure the root mean square error (RMSE) and normalized root mean square error (NRMSE). RMSE is used as a standard way to measure regression error. In addition, we used NRMSE to normalize the errors to account for different limb movement ranges. RMSE and NRMSE are given in equations~\ref{rmse} and~\ref{nrmse} respectively. $y_i$ denote the real values and $\hat{y_i}$ the predicted values. $y_{range}$ is the range of real values. $\Theta_i = y_i \vardivision y_{range}$ and $\hat{\Theta_i} = \hat{y_i} \vardivision y_{range}$. where $n$ is the number of angles predicted (15 for an immobile wrist and 18 for a mobile wrist). \begin{equation} \label{rmse} RMSE = \sqrt[]{\frac{1}{n}\sum^{n}_{i=0}{(y_i - \hat{y_i})^2}} \end{equation} \begin{equation} \label{nrmse} NRMSE = \sqrt[]{\frac{1}{n}\sum^{n}_{i=0}{(\Theta_i - \hat{\Theta_i})^2}} \end{equation} \newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}} \begin{table*}[tb] \centering \caption{Results for immobile wrist} \label{all_table_static} \begin{tabular}{|l|p{32mm}|c||C{20mm}|C{20mm}||C{20mm}|C{20mm}|} \hline \multirow{2}{10mm}{Metric} & \multirow{2}{12mm}{Model} & \multirow{2}{15mm}{Intra session} & \multicolumn{2}{p{16mm}||}{Inter session} & \multicolumn{2}{p{16mm}|}{Inter subjects} \\ \cline{4-7} & & & no ADA & with ADA & no ADA & with ADA \\ \hline \multirow{3}{*}{RMSE} & Gaussian Process & 23.29$\pm$0.15 & 23.44$\pm$0.05 & - & 23.91$\pm$0.01 & - \\ \cline{2-7} & GRU Recurrent neural net & 18.26$\pm$0.04 & 19.80$\pm$0.14 & 20.50$\pm$0.07 & 23.45$\pm$0.30 & \textbf{22.29$\pm$0.24} \\ \cline{2-7} & SRU Recurrent neural net & \textbf{17.99$\pm$0.04} & \textbf{19.24$\pm$0.04} & 19.70$\pm$0.03 & 23.14$\pm$0.06 & \textbf{22.07$\pm$0.18} \\ \cline{2-7} \hline \hline \multirow{3}{*}{NRMSE} & Gaussian Process & 0.2456$\pm$0.0016 & 0.1924$\pm$0.0000 & - & 0.2034$\pm$0.0001 & - \\ \cline{2-7} & GRU Recurrent neural net & 0.1552$\pm$0.0004 & 0.1604$\pm$0.0008 & 0.1684$\pm$0.0005 & 0.1984$\pm$0.0023 & \textbf{0.1890$\pm$0.0021} \\ \cline{2-7} & SRU Recurrent neural net & \textbf{0.1512$\pm$0.0004} & \textbf{0.1558$\pm$0.0004} & 0.1613$\pm$0.0004 & 0.1967$\pm$0.0002 & \textbf{0.1879$\pm$0.0019} \\ \cline{2-7} \hline \end{tabular} \end{table*} \begin{table*}[tb] \centering \caption{Results for mobile wrist} \label{all_table_wrist} \begin{tabular}{|l|p{32mm}|c||C{20mm}|C{20mm}||C{20mm}|C{20mm}|} \hline \multirow{2}{10mm}{Metric} & \multirow{2}{12mm}{Model} & \multirow{2}{15mm}{Intra session} & \multicolumn{2}{p{16mm}||}{Inter session} & \multicolumn{2}{p{16mm}|}{Inter subjects} \\ \cline{4-7} & & & no ADA & with ADA & no ADA & with ADA \\ \hline \multirow{3}{*}{RMSE} & Gaussian Process & 22.33$\pm$0.24 & 22.23$\pm$0.00 & - & 22.39$\pm$0.01 & - \\ \cline{2-7} & GRU Recurrent neural net & 18.60$\pm$0.05 & 19.19$\pm$0.05 & 19.93$\pm$0.06 & 21.74$\pm$0.20 & \textbf{20.94$\pm$0.17} \\ \cline{2-7} & SRU Recurrent neural net & \textbf{18.26$\pm$0.11} & \textbf{18.83$\pm$0.04} & 19.55$\pm$0.03 & 21.50$\pm$0.11 & \textbf{20.89$\pm$0.09} \\ \cline{2-7} \hline \hline \multirow{3}{*}{NRMSE} & Gaussian Process & 0.2360$\pm$0.0033 & 0.1770$\pm$0.0000 & - & 0.1824$\pm$0.0001 & - \\ \cline{2-7} & GRU Recurrent neural net & 0.1558$\pm$0.0004 & 0.1518$\pm$0.0004 & 0.1580$\pm$0.0006 & 0.1757$\pm$0.0016 & \textbf{0.1698$\pm$0.0012} \\ \cline{2-7} & SRU Recurrent neural net & \textbf{0.1516$\pm$0.0013} & \textbf{0.1490$\pm$0.0000} & 0.1550$\pm$0.0000 & 0.1742$\pm$0.0008 & \textbf{0.1695$\pm$0.0007} \\ \cline{2-7} \hline \end{tabular} \end{table*} \section{Evaluation} \label{sec:evaluation} In order to show the superiority of the improved RNN approach (RNN with SRU) over other recent approaches from the literature, namely a standard RNN with GRU approach (similar to \cite{Du2017}) and Gaussian Process (as in \cite{Quivira2018}), we applied these three methods to our datasets with and without mobile wrists. In addition, we applied adversarial domain adaption (ADA) to the RNN approaches to evaluate the transfer ability of each of these methods. Note, that ADA is not applicable to Gaussian Processes. We split the data into training, validation and test sets as follows: \begin{enumerate} \item Each session was split into blocks of 12 seconds each. \item A period of 3 seconds was randomly sampled from each block. \item Half of these periods formed a validation set, while the other half formed the test set \item The training set was created from the sessions after removing all periods that were used for the validation and test set. \end{enumerate} In other words, to get intra-session results all training, validation and test sets from all session were combined together. Half of this data was used for training, 25\% was used for validation and the remaining 25\% for testing. In order to obtain inter-session results, we split the data set into five partitions, where the partitions do not share data from the same session. We used four of the partitions for training and validation, and the remaining partition for testing. This was repeated five times where each partition is used as a test set exactly once. A similar approach was used to evaluate inter-subject performance, where each of the five partitions contained data from a single person. \section{Results} The results of the evaluation with immobile wrist and mobile wrist data are shown in tables~\ref{all_table_static} and~\ref{all_table_wrist} respectively. The evaluation results for the three machine learning algorithms are presented in terms of RMSE and NRMSE for the three types of experiments: intra-session, inter-session, and inter-subject (as described in Section~\ref{sec:evaluation}). For inter-session and inter-subject we also compare results with and without the application of adversarial domain adaptation (ADA). First of all, recurrent neural networks with SRUs show better performance in most cases, and comparable performance in the case of inter-subject experiments. These results hold for both mobile and immobile wrists. The apparent gesture recognition accuracy improvement when comparing mobile wrist with immobile wrist results is due to an increased number of predicted angles in the mobile wrist case (18 vs. 15). Therefore, the two cases are not really comparable to each other. As can be seen, adversarial domain adaptation (ADA) improves inter-subject accuracy, while actually showing worse results for inter-session experiments. This demonstrates that inter-session differences are not significant enough for the inhibition of session-specific features (and the resulting prevention of over-fitting) offered by ADA to have a positive impact on accuracy. However the case is different for inter-subject testing, where the difference in recorded data can be quite substantial. \section{Conclusion and Outlook} In this paper, we presented experiments with three machine learning approaches applied to continuous gesture recognition based on sEMG measurements. Our main contributions are: \begin{enumerate} \item We presented for the first time an evaluation of machine learning techniques with mobile wrists, which significantly enhance the functionality of artificial limbs. \item We demonstrated that RNNs with SRUs are superior to other state-of-the-art approaches to gesture recognition proposed in the literature, specifically Gaussian Processes and RNNs with GRUs. \item We presented for the first time inter-subject gesture recognition experiments and showed the advantages of adversarial domain adaption for this task. \end{enumerate} In future work, we intend to further investigate the case of inter-subject gesture recognition, including the development of improved and customized domain adaptation techniques. Also, we plan to look into the application of Bayesian methods to further improve continuous gesture recognition accuracy. \section{Introduction} One of the prominent fields in robotics is the development of artificial or prosthetic limbs. The most advanced devices are controlled via electromagnetic sensors that measure sEMG signals either from muscles \cite{fajardo2015} or the central nervous system \cite{Li2017}. Artificial limbs are normally controlled via gesture recognition from the sEMG sensor data. This gesture recognition can be either discrete \cite{Du2017} or continuous \cite{Quivira2018}. In the discrete case, there is a limited number of available gestures that the limb can perform, and the goal is to map the sensor data to one of these gestures. Therefore, the recognition task is a classification problem. In our work, we focus instead on continuous gesture recognition, which derives the angles of the limb joints from the data and allows for more life-like limb movement. In this paper, we perform experiments on the task of controlling a robotic hand via an arm band sensor. Previous work (e.g. \cite{fajardo2015, Du2017, Quivira2018}) assumed robotic hands with immobile wrists, which significantly restricts the functionality of the robotic limb. We present, for the first time, experiments with both immobile and mobile wrist data, and show that our proposed techniques outperform the state-of-the-art in both cases. The most successful gesture recognition from the sEMG sensor data methods to date employ recurrent neural networks (RNNs) \cite{Quivira2018}. However, RNNs take a very long time to train to reach a desirable accuracy \cite{Lei2017}. In our work, we propose to use RNNs with simple recurrent units (SRU) \cite{Lei2017}, instead, for continuous gesture recognition. This method has the advantage of reaching a higher gesture recognition accuracy than regular RNNs in the same training time. In addition, we show how domain adaptation techniques \cite{Ganin2014} can be used for continuous gesture recognition, and for the first time empirically demonstrate that these techniques improve the transferability between subjects, where a limb controller trained on data from one person is used for gesture recognition of another person. \section{Background and Related Work} \subsection{sEMG sensors} Surface electromyography is the method of obtaining electric signals coming from neurons that are responsible from muscle contractions. As the name suggests, it is a non-invasive method and electrodes are attached to the skin surface. These signals can be then used in a control system for powered upper-limb prostheses because motions of wrist and fingers are mostly controlled by muscles in the forearm \cite{phinyomark2012}. sEMG sensors range from non-portable units with high measurement accuracy to light and wearable units, albeit with a lower accuracy. In order to retrieve sEMG data, we utilized the Myo armband \cite{Sathiyanarayanan2016}, as shown in Figure~\ref{img:myo}. This device has the advantages of being wearable and having an affordable price\footnote{At the time of writing the price is in the range of \$200}. The Myo armband consists of 8 sEMG sensors capable of recording sEMG data at frequency of 200 Hz. The raw signal is digitized with 8-bit analog-to-digital converter to yield a $[-128,+128]$ range. For wireless connection the Myo armband uses Bluetooth Low Energy technology. \begin{figure}[thtb] \centering \includegraphics[width=0.45\textwidth]{images/band_on_my_arm} \caption{Myo Armband} \label{img:myo} \end{figure} \subsection{Motion capture system} In order to tackle the task of continuous gesture recognition, a motion capture system to extract the limb angles is required for the generation of the data set. Existing motion capture systems are based on a wide range of technologies, including video recording \cite{kim2008}, ultrasound \cite{hettiarachchi2015}, and tracking gloves \cite{kim2009}. In our work, the Leap Motion Controller \cite{leapmotion} was used, which provided a cheap and efficient way to track and record the limb angles of a user's hand. This device is specifically designed for hand movement detection. The controller itself consists of two monochromatic IR cameras and three IR LEDs. The overall accuracy of the controller was shown to be 0.7 millimeters. Motion capture data is transmitted with a frequency from 50 Hz up to 120 Hz. \subsection{Recurrent Neural Networks} Recurrent neural networks (RNNs) \cite{Jain:1999:RNN} are a special type of neural networks designed to work with (numerical) sequence data. The input of an RNN is the sequence and the output is a numerical vector. In our case, the input sequence are the sEMG measurements, and the output is a vector of limb angles. Every neuron of the network on each element of the input sequence updates its state and outputs a value as defined by: \begin{equation} h_t = \sigma_h(W_h x_t + U_h h_{t - 1} + b_h) \\ \end{equation} \begin{equation} y_t = \sigma_y(W_y h_t + b_y) \end{equation} where $x_t$ is the sequence element, $h_t$ is the hidden state, $y_t$ is the output vector, $W, U, b$ are cell parameters, and $\sigma_h$ and $\sigma_y$ are activation functions. \subsection{Hand Gesture Recognition} Initial work on controlling artificial limbs using EMG signals focused on creating a control scheme, i.e. mapping specific signals to specific actions of the limb (e.g. \cite{fajardo2015}). These approaches are not able to tackle a large variety of gestures and the resulting controllers are specific to an individual and can not be transferred to other persons. Gesture recognition methods have been introduced to overcome these limitations. The gesture recognition task can be split into: \begin{enumerate} \item Classification with a number of discrete gestures or poses. \item Regression with respect to recognizing continuous values such as joint angles. \end{enumerate} In most recent and advanced work, Du et al.\ \cite{Du2017} propose a hand gesture classification method employing domain adaption (specifically adaptive batch normalization, AdaBN). The authors generated several datasets with the number of gestures varying from 8 to 12, none of which involved wrist movement. The results showed that AdaBN can improve generalization and tranferability of a convolutional neural network with respect to accuracy on the discrete gesture recognition tasks. Following up on this work, \cite{Quivira2018} focused on continuous gesture recognition (joint angles) using Gaussian processes. Again, unlike our work, this research did not involve any wrist movement. \section{Method} In this section, we present our approach for continuous gesture recognition. Specifically, we propose the use of RNNs with simple recurrent units (SRUs) to achieve a higher accuracy in the same time of training than regular RNNs using gated recurrent units (GRUs). Furthermore, we introduce a novel technique to apply domain adaptation to continuous gesture recognition. \subsection{Simple Recurrent Units} Due to vanishing gradient and exploding gradient problems vanilla RNN is not used nowadays \cite{chung2014}. The most common approach to date is to employ RNNs with GRU cells. \subsubsection{GRU-cell} The GRU-cell features special gates to reduce vanishing and exploding gradient problems. It is defined as: \begin{equation} \label{eq:gru_z_t} z_t = \sigma_g (W_z x_t + U_z h_{t - 1} + b_z) \end{equation} \begin{equation} \label{eq:gru_r_t} r_t = \sigma_g (W_r x_t + U_r h_{t - 1} + b_r) \end{equation} \begin{equation} h_t = (1 - z_t) \odot h_{t - 1} + z_t \odot \sigma_h (W_h x_t + U_h (r_t \odot h_{t - 1}) + b_h) \end{equation} where $x_t$ is the sequence element, $h_t$ is the hidden state and output, $z_t$ is the update gate, $r_t$ is the reset gate, and $W, U, b$ are cell parameters. Figure~\ref{img:rec_scheme_num} illustrates an RNN architecture with GRU cells. \begin{figure}[thtb] \centering \includegraphics[width=0.40\textwidth]{images/rec_scheme_num} \caption{Recurrent neural network architecture \newline 1 - Input data, \newline 2 - The first GRU/SRU layer, \newline 3 - The second GRU/SRU layer, \newline 4 - Fully-connected layer of Predictor, \newline 5 - Fully-connected layer without activation-function - result vector.} \label{img:rec_scheme_num} \end{figure} \subsubsection{SRU-cell} The GRU-cell, due to its internal dependencies, is difficult to parallelize efficiently. In order to reduce computation cost for RNN training and inference, a simple recurrent unit was proposed in \cite{Lei2017} as follows: \begin{equation} \hat{x_t} = W x_t \end{equation} \begin{equation} f_t = \sigma(W_f x_t + b_f) \end{equation} \begin{equation} r_t = \sigma(W_r x_t + b_r) \end{equation} \begin{equation} c_t = f_t \odot c_{t - 1} + (1 - f_t) \odot \hat{x_t} \end{equation} \begin{equation} h_t = r_t \odot \sigma(c_t) + (1 - r_t) \odot x_t \end{equation} where $x_t$ is a sequence element, $h_t$ is the output vector, $c_t$ is the hidden state, $f_t$ is the forget gate, $r_t$ is the reset gate, and $W, U, b$ are cell parameters. The RNN architecture with SRU cells is analogous to the RNN architecture shown in Figure~\ref{img:rec_scheme_num}. \subsection{Domain adaptation} When transferring a gesture recognition network trained on one person to another person, specialized transfer learning techniques are required. Adversarial domain adaptation (ADA) has been shown in recent work \cite{ganin2014unsupervised} to perform well for transfer learning tasks, and we have thus selected it for our research. ADA employs an additional neural network that predicts the current domain of input data from a feature vector. There is a gradient reversal layer between the feature vector and the discriminator network. This layer multiplies gradients by some value between -1 and 0. To train a neural network with ADA, we sum the loss function of the predictor and the loss function of the discriminator and perform back-propagation with a reversal of the discriminator gradient before the feature layer. The goal of this process is to inhibit domain-specific features and thus prevent over-fitting. Figure~\ref{img:rec_scheme_adapt} shows the RNN architecture with domain adaptation. We have also tried adaptive batch normalization, as used for discrete hand gesture recognition in \cite{Du2017}, but this did not show good performance on our continuous gesture recognition tasks. \begin{figure}[thtb] \centering \includegraphics[width=0.40\textwidth]{images/rec_scheme_num_adapt} \caption{Recurrent neural network with domain adaptation architecture \newline 1 - Input data, \newline 2 - The first GRU/SRU layer, \newline 3 - The second GRU/SRU layer, \newline 4 - Fully-connected layer of Predictor, \newline 5 - Fully-connected layer without activation-function - result vector, \newline 6 - Fully-connected layer of Discriminator, \newline 7 - Fully-connected layer without activation function - vector of classes (domains) probabilities.} \label{img:rec_scheme_adapt} \end{figure} \section{Data acquisition} sEMG data was obtained by means of the Myo armband device and finger and wrist angles were captured with the Leap Motion motion capture system. We recorded data recorded from 5 healthy volunteers ranging in age from 20 to 28 years. Each participant was asked to sit on a chair and establish a relaxed position with the wrist slightly above the Leap Motion sensor to ensure accurate motion capture. The participant was then asked to perform a given sequence of hand movements such as bending or stretching the index finger. Two datasets were collected: the first dataset only included movement of fingers with a static wrist (similar to \cite{Quivira2018}, and the second one was aimed to add wrist movements and some casual gestures. Data was collected in sessions with a duration of 4 minutes each. The specifics of the datasets are as follows. \hfill \noindent Immobile wrist dataset: \hfill \begin{enumerate} \item Movements of distinct fingers, 150 s \item Simultaneous movement of all fingers, 60 s \item Free finger movements, 30 s \end{enumerate} \hfill \noindent Mobile wrist dataset: \hfill \begin{enumerate} \item Movements of distinct fingers, 60 s \item Simultaneous movement of all fingers, 30 s \item Pinch, 30 s \item Open palm movements, 30 s \item Thumb movements, 30 s \item Free finger movements, 30 s \end{enumerate} \hfill For each volunteer 8 sessions per dataset were recorded. For the mobile wrist dataset, the volunteers were asked to do the finger movements while keeping the wrist angle at one of 6 specified positions, including four angles on the up-down axis of the wrist, bending the wrist to the right, and keeping it straight. Due to different data acquisition rates of the Myo armband and Leap Motion there is a need for data synchronization and alignment. Global alignment was achieved by matching the dataframes from the two devices, minimizing the difference between the time stamps of the individual dataframes, with a maximum difference of 10 ms. After alignment, the sEMG and limb angle data was filtered with a low pass filter with a frequency of 10 Hz and 4Hz respectively to achieve noise reduction. The sEMG data was split into windows of size 128, which formed the input vector for the recurrent neural network. \section{Experiment Setup} In this section we provide the design parameters of the two RNN approaches used in our experiments. The first approach represents standard RNN technology, while the second approach incorporates optimizations selected by us for the task of continuous gesture recognition. Adversarial domain adaptation was implemented with a gradient reversal layer after the feature generation block. The discriminator block consists of 2 fully connected layers with 256 neurons in the first layer and 15 or 18 neurons in the second (output) layer, since there are 15 angles to predict in the case of an immobile wrist and 18 in case of a mobile wrist. The hyper-parameters of the recurrent neural network with GRU used in our experiments are: \begin{itemize} \item 2 GRU recurrent layers with 256 neurons each. Only the last output was fed to the next layer. \item 2 fully connected layers with 256 and 15 (18) neurons respectively. \item Optimizer: Adam \cite{kingma2014adam} with a learning rate of 0.001. \item Trained for 30 epochs or until there was no validation gain during 8 epochs. \end{itemize} The hyper-parameters for the recurrent neural network with SRU are: \begin{itemize} \item 2 SRU recurrent layers with 256 neurons each. \item Global Average Pooling layer. \item 2 fully connected layers with 256 and 15 (18) neurons respectively. \item Optimizer: Adam with learning rate equals to 0.001. \item Net was trained for 30 epochs or until there was no validation gain during 8 epochs. \end{itemize} \section{Evaluation Metrics} \makeatletter \DeclareRobustCommand{\vardivision}{% \mathbin{\mathpalette\@vardivision\relax } \newcommand{\@vardivision}[2]{% \reflectbox{$\m@th\smallsetminus$}% } \makeatother In our evaluation, we measure the root mean square error (RMSE) and normalized root mean square error (NRMSE). RMSE is used as a standard way to measure regression error. In addition, we used NRMSE to normalize the errors to account for different limb movement ranges. RMSE and NRMSE are given in equations~\ref{rmse} and~\ref{nrmse} respectively. $y_i$ denote the real values and $\hat{y_i}$ the predicted values. $y_{range}$ is the range of real values. $\Theta_i = y_i \vardivision y_{range}$ and $\hat{\Theta_i} = \hat{y_i} \vardivision y_{range}$. where $n$ is the number of angles predicted (15 for an immobile wrist and 18 for a mobile wrist). \begin{equation} \label{rmse} RMSE = \sqrt[]{\frac{1}{n}\sum^{n}_{i=0}{(y_i - \hat{y_i})^2}} \end{equation} \begin{equation} \label{nrmse} NRMSE = \sqrt[]{\frac{1}{n}\sum^{n}_{i=0}{(\Theta_i - \hat{\Theta_i})^2}} \end{equation} \newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}} \begin{table*}[tb] \centering \caption{Results for immobile wrist} \label{all_table_static} \begin{tabular}{|l|p{32mm}|c||C{20mm}|C{20mm}||C{20mm}|C{20mm}|} \hline \multirow{2}{10mm}{Metric} & \multirow{2}{12mm}{Model} & \multirow{2}{15mm}{Intra session} & \multicolumn{2}{p{16mm}||}{Inter session} & \multicolumn{2}{p{16mm}|}{Inter subjects} \\ \cline{4-7} & & & no ADA & with ADA & no ADA & with ADA \\ \hline \multirow{3}{*}{RMSE} & Gaussian Process & 23.29$\pm$0.15 & 23.44$\pm$0.05 & - & 23.91$\pm$0.01 & - \\ \cline{2-7} & GRU Recurrent neural net & 18.26$\pm$0.04 & 19.80$\pm$0.14 & 20.50$\pm$0.07 & 23.45$\pm$0.30 & \textbf{22.29$\pm$0.24} \\ \cline{2-7} & SRU Recurrent neural net & \textbf{17.99$\pm$0.04} & \textbf{19.24$\pm$0.04} & 19.70$\pm$0.03 & 23.14$\pm$0.06 & \textbf{22.07$\pm$0.18} \\ \cline{2-7} \hline \hline \multirow{3}{*}{NRMSE} & Gaussian Process & 0.2456$\pm$0.0016 & 0.1924$\pm$0.0000 & - & 0.2034$\pm$0.0001 & - \\ \cline{2-7} & GRU Recurrent neural net & 0.1552$\pm$0.0004 & 0.1604$\pm$0.0008 & 0.1684$\pm$0.0005 & 0.1984$\pm$0.0023 & \textbf{0.1890$\pm$0.0021} \\ \cline{2-7} & SRU Recurrent neural net & \textbf{0.1512$\pm$0.0004} & \textbf{0.1558$\pm$0.0004} & 0.1613$\pm$0.0004 & 0.1967$\pm$0.0002 & \textbf{0.1879$\pm$0.0019} \\ \cline{2-7} \hline \end{tabular} \end{table*} \begin{table*}[tb] \centering \caption{Results for mobile wrist} \label{all_table_wrist} \begin{tabular}{|l|p{32mm}|c||C{20mm}|C{20mm}||C{20mm}|C{20mm}|} \hline \multirow{2}{10mm}{Metric} & \multirow{2}{12mm}{Model} & \multirow{2}{15mm}{Intra session} & \multicolumn{2}{p{16mm}||}{Inter session} & \multicolumn{2}{p{16mm}|}{Inter subjects} \\ \cline{4-7} & & & no ADA & with ADA & no ADA & with ADA \\ \hline \multirow{3}{*}{RMSE} & Gaussian Process & 22.33$\pm$0.24 & 22.23$\pm$0.00 & - & 22.39$\pm$0.01 & - \\ \cline{2-7} & GRU Recurrent neural net & 18.60$\pm$0.05 & 19.19$\pm$0.05 & 19.93$\pm$0.06 & 21.74$\pm$0.20 & \textbf{20.94$\pm$0.17} \\ \cline{2-7} & SRU Recurrent neural net & \textbf{18.26$\pm$0.11} & \textbf{18.83$\pm$0.04} & 19.55$\pm$0.03 & 21.50$\pm$0.11 & \textbf{20.89$\pm$0.09} \\ \cline{2-7} \hline \hline \multirow{3}{*}{NRMSE} & Gaussian Process & 0.2360$\pm$0.0033 & 0.1770$\pm$0.0000 & - & 0.1824$\pm$0.0001 & - \\ \cline{2-7} & GRU Recurrent neural net & 0.1558$\pm$0.0004 & 0.1518$\pm$0.0004 & 0.1580$\pm$0.0006 & 0.1757$\pm$0.0016 & \textbf{0.1698$\pm$0.0012} \\ \cline{2-7} & SRU Recurrent neural net & \textbf{0.1516$\pm$0.0013} & \textbf{0.1490$\pm$0.0000} & 0.1550$\pm$0.0000 & 0.1742$\pm$0.0008 & \textbf{0.1695$\pm$0.0007} \\ \cline{2-7} \hline \end{tabular} \end{table*} \section{Evaluation} \label{sec:evaluation} In order to show the superiority of the improved RNN approach (RNN with SRU) over other recent approaches from the literature, namely a standard RNN with GRU approach (similar to \cite{Du2017}) and Gaussian Process (as in \cite{Quivira2018}), we applied these three methods to our datasets with and without mobile wrists. In addition, we applied adversarial domain adaption (ADA) to the RNN approaches to evaluate the transfer ability of each of these methods. Note, that ADA is not applicable to Gaussian Processes. We split the data into training, validation and test sets as follows: \begin{enumerate} \item Each session was split into blocks of 12 seconds each. \item A period of 3 seconds was randomly sampled from each block. \item Half of these periods formed a validation set, while the other half formed the test set \item The training set was created from the sessions after removing all periods that were used for the validation and test set. \end{enumerate} In other words, to get intra-session results all training, validation and test sets from all session were combined together. Half of this data was used for training, 25\% was used for validation and the remaining 25\% for testing. In order to obtain inter-session results, we split the data set into five partitions, where the partitions do not share data from the same session. We used four of the partitions for training and validation, and the remaining partition for testing. This was repeated five times where each partition is used as a test set exactly once. A similar approach was used to evaluate inter-subject performance, where each of the five partitions contained data from a single person. \section{Results} The results of the evaluation with immobile wrist and mobile wrist data are shown in tables~\ref{all_table_static} and~\ref{all_table_wrist} respectively. The evaluation results for the three machine learning algorithms are presented in terms of RMSE and NRMSE for the three types of experiments: intra-session, inter-session, and inter-subject (as described in Section~\ref{sec:evaluation}). For inter-session and inter-subject we also compare results with and without the application of adversarial domain adaptation (ADA). First of all, recurrent neural networks with SRUs show better performance in most cases, and comparable performance in the case of inter-subject experiments. These results hold for both mobile and immobile wrists. The apparent gesture recognition accuracy improvement when comparing mobile wrist with immobile wrist results is due to an increased number of predicted angles in the mobile wrist case (18 vs. 15). Therefore, the two cases are not really comparable to each other. As can be seen, adversarial domain adaptation (ADA) improves inter-subject accuracy, while actually showing worse results for inter-session experiments. This demonstrates that inter-session differences are not significant enough for the inhibition of session-specific features (and the resulting prevention of over-fitting) offered by ADA to have a positive impact on accuracy. However the case is different for inter-subject testing, where the difference in recorded data can be quite substantial. \section{Conclusion and Outlook} In this paper, we presented experiments with three machine learning approaches applied to continuous gesture recognition based on sEMG measurements. Our main contributions are: \begin{enumerate} \item We presented for the first time an evaluation of machine learning techniques with mobile wrists, which significantly enhance the functionality of artificial limbs. \item We demonstrated that RNNs with SRUs are superior to other state-of-the-art approaches to gesture recognition proposed in the literature, specifically Gaussian Processes and RNNs with GRUs. \item We presented for the first time inter-subject gesture recognition experiments and showed the advantages of adversarial domain adaption for this task. \end{enumerate} In future work, we intend to further investigate the case of inter-subject gesture recognition, including the development of improved and customized domain adaptation techniques. Also, we plan to look into the application of Bayesian methods to further improve continuous gesture recognition accuracy.
{'timestamp': '2020-12-17T02:13:12', 'yymm': '2012', 'arxiv_id': '2012.08816', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08816'}
arxiv
\section{Introduction} Replicating human movements and behaviour in humanoid robots is a formidable challenge with many exciting applications, ranging from health care (e.g. artificial limbs \cite{alshamsi2016}) to space exploration \cite{nasa2015}. Since the manual engineering of controllers for such tasks is extremely difficult, machine learning and specifically reinforcement learning has received much attention in this area. A recent NIPS competition \cite{kidzinski2018learningtorun} focused on the creation of a simulated humanoid running robot in a continuous and high-dimensional environment. The top entries to the competition employed state-of-the-art deep reinforcement learning techniques \cite{jaskowski2018rltorunfast,kidzinski2018l2rsolutions}, which resulted in strong, but not optimal, performance. In this paper, we demonstrate that videos showing human running behaviour can be used to significantly improve the learning performance. In our approach, we use the coordinates of specific body parts (e.g. the foot) to define a potential function that is fed into potential-based reward shaping \cite{ng1999policy}. To create a strong baseline for the evaluation of our approach, we combined selected RL techniques of the top ten competition entries with further optimizations to create a running agent that displays a significantly faster learning rate than the top entry. We then add the reward shaping from video data sampled from various YouTube videos, which resulted in a running agent that reached twice the running speed as our baseline in 12 hours of training. Since potential-based reward shaping has the nice theoretical property of not changing the optimal policy \cite{ng1999policy}, data taken from sub-optimal running behaviour does not prevent the RL agent from overcoming the sub-optimalities and produce humanoid running that outperforms the data source. We demonstrate this theoretical property empirically by sampling limb positions from a slower-running agent and show how our approach generates a running robot, that after a relatively short time of training, starts to run faster than the original agent. Overall, the main contribution of our work is to demonstrate how data extracted from videos of human movements can be used to significantly speed up the reinforcement learning of humanoid robots. While our work focuses on the training of humanoid running behaviour, the proposed techniques can easily be applied to any other form of humanoid movements. \section{Background} \subsection{Reinforcement Learning} Reinforcement learning is a paradigm which allows agents to learn by reward and punishment from interactions with the environment \cite{sutton1984temporal}. The numeric feedback received from the environment is used to improve the agent's actions. The majority of work in the area of reinforcement learning applies a Markov Decision Process (MDP) as a mathematical model \cite{puterman2014markov}. An MDP is a tuple $\big(S, A, T, R)$, where $S$ is the state space, A is the action space, $T(s,a,s') = Pr(s'|s,a)$ is the probability that action a in state s will lead to state $s'$, and $R(s, a, s')$ is the immediate reward $r$ received when action $a$ taken in state $s$ results in a transition to state $s'$. The problem of solving an MDP is to find a policy (i.e., mapping from states to actions) which maximises the accumulated reward. When the environment dynamics (transition probabilities and reward function) are available, this task can be solved using policy iteration \cite{bertsekas1995dynamic}. When the environment dynamics are not available, as with most real problem domains, policy iteration cannot be used. However, the concept of an iterative approach remains the backbone of the majority of reinforcement learning algorithms. These algorithms apply so called temporal-difference updates to propagate information about values of states and/or state-action pairs, $Q(s, a)$ [20]. These updates are based on the difference of the two temporally different estimates of a particular state or state-action value. The Q-learning algorithm is such a method [21]. After each transition, $(s, a) \rightarrow (s', r)$, in the environment, it updates state-action values by the formula: \begin{equation} \label{eq:qlearn} Q(s,a) \leftarrow Q(s,a) + \alpha[r + \gamma\max Q(s',a') - Q(s,a)] \end{equation} where $\alpha$ is the rate of learning and $\gamma$ is the discount factor. It modifies the value of taking action $a$ in state $s$, when after executing this action the environment returned reward $r$, and moved to a new state $s'$. \subsection{Potential Based reward shaping} The idea of reward shaping is to provide an additional reward representative of prior knowledge to reduce the number of suboptimal actions made and so reduce the time needed to learn \cite{ng1999policy, randlov1998learning}. This concept can be represented by the following formula for the Q-learning algorithm: \begin{equation} \label{eq:shaping} Q(s,a) \leftarrow Q(s,a)+\alpha[r+F(s,s')+\gamma\max Q(s',a') - Q(s,a)] \end{equation} where $F(s,s')$ is the general form of any state-based shaping reward. Even though reward shaping has been powerful in many experiments it quickly became apparent that, when used improperly, it can change the optimal policy \cite{randlov1998learning}. To deal with such problems, potential-based reward shaping was proposed \cite{ng1999policy} as the difference of some potential function $\Phi$ defined over a source s and a destination state $s':F(s,s')=\gamma \Phi(s') - \Phi(s)$ where $\gamma$ must be the same discount factor as used in the agent's update rule (see Equation \ref{eq:qlearn}). Ng et al. \cite{ng1999policy} proved that potential-based reward shaping, defined according to Equation \ref{eq:shaping}, guarantees learning a policy which is equivalent to the one learned without reward shaping in both infinite and finite horizon MDPs. Wiewiora \cite{wiewiora2003potential} later proved that an agent learning with potential-based reward shaping and no knowledge-based Q-table initialization will behave identically to an agent without reward shaping when the latter agent's value function is initialized with the same potential function. These proofs, and all subsequent proofs regarding potential-based reward shaping including those presented in this paper, require actions to be selected by an advantage-based policy \cite{wiewiora2003potential}. Advantage-based policies select actions based on their relative differences in value and not their exact value. Common examples include greedy, $\epsilon$-greedy and Boltzmann softmax. \subsection{Deep-RL} In Deep RL, the Q value function is represented as a multi-layer neural network \cite{Goodfellow-et-al-2016}. Deep RL algorithms have been shown to perform strongly on RL tasks which have been infeasible to tackle before. Over recent years, a number of algorithms and optimizations have been proposed, and we have chosen to apply the Deep Deterministic Policy Gradient (DDPG) algorithm for our application domain \cite{lillicrap2015continuous}. DDPG has been shown to be effective in continuous action domains where classic reinforcement learning methods struggled. Specifically, in the DDPG algorithm two neural networks are used: $\mu(S)$ is a network (the {\it actor}) that returns the action vector whose components are the values of the corresponding control signals. $Q^w(s, a)$ is a second neural network (the {\it critic}, that returns the $Q$ value, i.e. the value estimate of the action of $a$ in state $s$. \begin{equation} \label{eq:policy5} \begin{aligned} \nabla_\theta J(\pi_\theta) & =\int_{S}\rho^\pi(s)\int_{A}\nabla_\theta\pi_\theta(a|s)Q^w(s,a) da ds \\ &=\mathbb{E}_{s\sim \rho^\pi,a\sim\pi_\theta}[\nabla_\theta \log \pi_\theta (a|s)Q^w(s,a)] \end{aligned} \end{equation} where $\theta$ is the parameter vector of the probabilistic policy and $\rho^\pi(s)$ is the probability of reaching state $s$ with policy $\pi$. For a more complete description of DDPG, see \cite{lillicrap2015continuous}. \subsection{Reinforcement Learning from Demonstration} Human expert demonstrations have been demonstrated to improve the learning speed and accuracy of RL agent on a wide range of tasks. Most work in this area (e.g. \cite{suay2016learning, brys2015reinforcement}) focused on the use of state-action recordings as demonstration. This is infeasible in the case of video data, where only state information is available and the demonstration actions are not explicitly provided and often can not be derived either (as is the case with running). More recently, various methods for state-only demonstrations have been proposed (e.g. \cite{peng2018deepmimic, liu2017imitation}). However, all of these methods target the imitation of demonstrations. Our work is employing potential-based reward shaping which uses the demonstrations to speed up the learning, but is also able to overcome any sub-optimalities in the demonstration rather than purely imitating them. \section{Simulation Environment} \label{sec:domain} \begin{figure} \centering \includegraphics[width=0.40\textwidth]{img/opensim3.jpg} \caption{A screenshot of the "Learning to Run" simulation environment} \label{img:environment} \end{figure} The simulation environment has been provided by the "Learning to Run" competition and is based on the OpenSim environment employing the Simbody physics engine. The environment simulates a three-dimensional race course with small obstacles, along which a humanoid robot with 6 joints (ankle, knee, and hip on two legs) and corresponding muscles is running (see Figure \ref{img:environment}). The actions of the running humanoid robot are excitation values applied to the muscles implemented in the robot model. The next state of the environment is computed by the physics engine based on the resulting muscle activations, forces, velocities and positions of the joints. The OpenSim \cite{kidzinski2018learningtorun} model environment represents the robot state using a vector of 41 features: \begin{itemize} \item position of the pelvis (rotation, x, y) \item velocity of the pelvis (rotation, x, y) \item rotation of each ankle, knee and hip (6 values) \item angular velocity of each ankle, knee and hip (6 values) \item position of the center of mass (2 values) \item velocity of the center of mass (2 values) \item positions of head, pelvis, torso, left and right toes, left and right talus (14 values) \item strength of left and right psoas (a muscle at the lower spine) \item next obstacle: x distance from the pelvis, y position of the center relative to the the ground, radius. \end{itemize} The reward of an agent is provided at each simulation step and is the distance covered in the run minus the muscle strain as computed by the simulation environment. \section{Baseline Agent} When designing the baseline agent, we combined selected techniques from the top 10 competition entries \cite{kidzinski2018l2rsolutions} with further optimizations. In this section, we summarize the most beneficial techniques used, all of which are taken from various contributions published in \cite{kidzinski2018l2rsolutions}. In all exerimental results presented in the remainder of this paper, the experiments have been repeated 5 times, and the graphs show the standard error from the mean. The RL parameter choice was $\alpha = 0.08$ and $\gamma = 0.9$, which have been determined experimentally. \subsection{State representation} The original state representation provided by the competition software contained 41 features, described in Section \ref{sec:domain}. In our state representation we added 71 features, including: \begin{itemize} \item Two-dimensional coordinates of key body positions relative to the pelvis at the center point (0,0). \item Two-dimensional velocity and acceleration vectors for key body points. \end{itemize} The new state representation allowed us to significantly speed up the learning process as seen on Figure \ref{img:centerandfeatures}. \begin{figure} \includegraphics[width=0.47\textwidth]{img/modified.jpg} \caption{This Figure shows significant learning speed increase after adding velocity and acceleration features and centering the coordinates system at the pelvis position} \label{img:centerandfeatures} \end{figure} \subsection{Additional training experience} After running a simulation episode, we trained the RL agent with additional mirrored data, which represented the agents experience during the episode and reflecting it along the $xy$ plane. This adds valuable training for the value estimator (i.e. the critic), since the task is symmetrical. Figure \ref{img:mirrored} shows the resulting performance improvement. \begin{figure} \includegraphics[width=0.47\textwidth]{img/mirrored.jpg} \caption{Speeding up learning process through adding mirrored data} \label{img:mirrored} \end{figure} \subsection{Repeating the chosen action} Each time the running agent chooses an action, this is repeated three times. Because we employed an actor-critic method, this reduced the number of computations needed to generate the next action during an episode by a factor of three. The resulting performance gain can be seen in Figure \ref{img:flipaction}. \begin{figure} \includegraphics[width=0.47\textwidth]{img/flip.jpg} \caption{Performance gains when repeating each action three times} \label{img:flipaction} \end{figure} \subsection{Reducing state resolution} In this optimization step, all the state representation data was changed from {\it double} to {\it float}. This resulted in a speed-up of the computations and a somewhat smaller state space, while also reducing the precision of the state representation. Figure \ref{img:doublefloat} shows the resulting performance increase. \begin{figure} \includegraphics[width=0.47\textwidth]{img/Speedup.jpg} \caption{Switching from double to float} \label{img:doublefloat} \end{figure} \subsection{Neural network topology} After applying all of the techniques above, we compared 5 different network architectures by arbitrarily varying the number of layers and neurons per layer. The results are presented in Figure \ref{img:architectures}. For our baseline agent we chose the best performing layer, using 5 layers with 128 neurons each. \begin{figure} \includegraphics[width=0.47\textwidth]{img/6.jpg} \caption{Various neural network topologies: LxN denotes L layers with N neurons per layer} \label{img:architectures} \end{figure} \section{Reward Shaping from Video Data} After designing our baseline, we added potential-based reward shaping from video data taken from arbitrary YouTube videos depicting running of humans and human-like characters. In this section we describe how the potential function was generated. \subsection{Potential function} The overall potential function is defined as the sum of potential functions for every body part: pelvis, two knees and two feet. Following the potential-based reward shaping approach, an additional reward is given to an agent on each simulation step corresponding to the change in potentials of the source and target state. We considered the following three different potential functions for each body part (knee and foot) in our research, all of them based on the inverse of the distance between the respective body part coordinate in the video-generated data and the humanoid robot. The three potential functions represent three different inverse distance functions: \begin{itemize} \item PF1: $\frac{1}{dx + dy}$ \item PF2: $\frac{1}{\sqrt{dx^2 + dy^2}} $ \item PF3: $\frac{1}{dx^2 + dy^2}$ \end{itemize} where $dx$ ($dy$) is the absolute difference between the x (y) coordinate of the respective body part taken from the video data and the x (y) coordinate of the body part of the humanoid robot. \subsection{Data collection} For our potential function we have used the following three sources of video data: \begin{itemize} \item A video of a cartoon character running (see Figure \ref{img:cartoon} for a screenshot) \item A video of a running character in a computer game (see Figure \ref{img:videogame} for a screenshot) \item A video of a running human (see Figure \ref{img:runninghuman} for a screenshot) \end{itemize} \begin{figure} \centering \includegraphics[width=0.3\textwidth]{img/cartoon.jpg} \caption{Screenshot from a video depicting a cartoon character running (taken from http://y2u.be/2y6aVz0Acx0)} \label{img:cartoon} \end{figure} \begin{figure} \centering \includegraphics[width=0.3\textwidth]{img/videogame.jpg} \caption{Screenshot from a video depicting a computer game character running (taken from http://y2u.be/YbYOsE7JyXs)} \label{img:videogame} \end{figure} \begin{figure} \centering \includegraphics[width=0.3\textwidth]{img/runninghuman.jpg} \caption{Screenshot from a video depicting a human running (taken from http://y2u.be/5mVgThl-yMU)} \label{img:runninghuman} \end{figure} Each of the sources was used to define a potential function. The performance of the resulting potential functions in RL are compared in Figure \ref{img:var_potential}. Note that the learning curves were not trained until final convergence, which would require much more time and based on the theoretical properties of potential-based reward shaping would ultimately reach the same performance. In each source we recorded the positions of the two knees and the two feet relative to the pelvis as a two-dimensional coordinate. The recording frequency was four positions per half step. The resulting coordinates were normalized according to the OpenSim simulation. While in our work the extraction of the coordinates was done manually, algorithms to accurately extract body part positions in images with a clear view of the body do exist (e.g. \cite{toshev2014deeppose,guler2018densepose}), and we intend to use these in future work. \subsection{Selecting the data source and the potential function} We first compared the performance of the potential functions based on three videos and the inverse distance measure PF2. The results for this experiment is shown in Figure \ref{img:differentvideo}, and demonstrates that the human video is the best data source for the reward shaping. \begin{figure} \includegraphics[width=0.47\textwidth]{img/differentvideo.jpg} \caption{Comparing the three videos as a data source for the potential function based on PF2} \label{img:differentvideo} \end{figure} After selecting the running human video as the data source, we compared the three different potential functions as depicted in Figure \ref{img:var_potential}. The results show that PF3 performs best. \begin{figure} \includegraphics[width=0.47\textwidth]{img/pot_functions.JPG} \caption{Comparing three potential functions} \label{img:var_potential} \end{figure} \section{Evaluation of Video-based Reward Shaping} Figure \ref{img:baseline_vs_shaping} shows the comparison of our chosen reward shaping approach (PF3) to the RL baseline. The results show that the reward shaping speeds up the learning significantly, reaching double the running speed at 12 hours of training. The end result after 24 hours of training still shows a significant advantage of the reward shaping approach. It is also worth noting that the demonstration video is of a running human who is using his arms, while the simulation model does not include these. \begin{figure} \includegraphics[width=0.47\textwidth]{img/rewardshaping.jpg} \caption{Performance comparison between the baseline and the reward shaping approach} \label{img:baseline_vs_shaping} \end{figure} An important advantage of potential-based reward shaping is the theoretical guarantee that the shaping will not change the optimal policy. In order to demonstrate this advantage in our context, we used a weak running robot generated by the baseline RL agent after 12 hours of training as a sub-optimal data source for the potential function. Clearly, the resulting agent is not running optimally, and the positions of the feet and knees will not be in optimal positions most of the time. We then train our RL agent with the reward shaping generated from these sub-optimal coordinates (using PF3), and compared the performance to the weak runner. The results are shown in Figure \ref{img:suboptimal}, and demonstrate that the RL agent is able to overcome the suboptimal performance of the data source. In fact, after 20 hours of training, the performance is more than double that of the suboptimal running agent. Also, note that the suboptimal shaping did not hurt the learning performance significantly. After 12 hours of training the shaped agent performs comparable to the baseline agent with 12 hours of training. \begin{figure} \includegraphics[width=0.47\textwidth]{img/sim.jpg} \caption{Performance of the reward shaping approach with suboptimal data. The dotted vertical line represents 12 hours of training (the training time of the shaping source).} \label{img:suboptimal} \end{figure} \section{Conclusions} In this paper, we presented a method to use videos of human and human-like running to shape the reward of an RL agent learning to run. Our results demonstrate that a significant improvement in learning speed can be achieved by our proposed method, as compared to a strong baseline which we designed combining selected techniques of the top ten entries to the "Learning to Run" competition at NIPS 2017. In future work, we intend to employ automated body pose extraction methods such as the one presented in \cite{guler2018densepose} and widen our investigation to other humanoid movement apart from running, e.g. jumping. \section{Introduction} The \textit{proceedings} are the records of a conference.\footnote{This is a footnote} ACM seeks to give these conference by-products a uniform, high-quality appearance. To do this, ACM has some rigid requirements for the format of the proceedings documents: there is a specified format (balanced double columns), a specified set of fonts (Arial or Helvetica and Times Roman) in certain specified sizes, a specified live area, centered on the page, specified size of margins, specified column width and gutter size. \section{The Body of The Paper} Typically, the body of a paper is organized into a hierarchical structure, with numbered or unnumbered headings for sections, subsections, sub-subsections, and even smaller sections. The command \texttt{{\char'134}section} that precedes this paragraph is part of such a hierarchy.\footnote{This is a footnote.} \LaTeX\ handles the numbering and placement of these headings for you, when you use the appropriate heading commands around the titles of the headings. If you want a sub-subsection or smaller part to be unnumbered in your output, simply append an asterisk to the command name. Examples of both numbered and unnumbered headings will appear throughout the balance of this sample document. Because the entire article is contained in the \textbf{document} environment, you can indicate the start of a new paragraph with a blank line in your input file; that is why this sentence forms a separate paragraph. \subsection{Type Changes and {\itshape Special} Characters} We have already seen several typeface changes in this sample. You can indicate italicized words or phrases in your text with the command \texttt{{\char'134}textit}; emboldening with the command \texttt{{\char'134}textbf} and typewriter-style (for instance, for computer code) with \texttt{{\char'134}texttt}. But remember, you do not have to indicate typestyle changes when such changes are part of the \textit{structural} elements of your article; for instance, the heading of this subsection will be in a sans serif\footnote{Another footnote here. Let's make this a rather long one to see how it looks.} typeface, but that is handled by the document class file. Take care with the use of\footnote{Another footnote.} the curly braces in typeface changes; they mark the beginning and end of the text that is to be in the different typeface. You can use whatever symbols, accented characters, or non-English characters you need anywhere in your document; you can find a complete list of what is available in the \textit{\LaTeX\ User's Guide} \cite{Lamport:LaTeX}. \subsection{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. \subsubsection{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). \subsubsection{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. \subsection{Citations} Citations to articles~\cite{bowman:reasoning, clark:pct, braams:babel, herlihy:methodology}, conference proceedings~\cite{clark:pct} or maybe books \cite{Lamport:LaTeX, salas:calculus} listed in the Bibliography section of your article will occur throughout the text of your article. You should use BibTeX to automatically produce this bibliography; you simply need to insert one of several citation commands with a key of the item cited in the proper location in the \texttt{.tex} file~\cite{Lamport:LaTeX}. The key is a short reference you invent to uniquely identify each work; in this sample document, the key is the first author's surname and a word from the title. This identifying key is included with each item in the \texttt{.bib} file for your article. The details of the construction of the \texttt{.bib} file are beyond the scope of this sample document, but more information can be found in the \textit{Author's Guide}, and exhaustive details in the \textit{\LaTeX\ User's Guide} by Lamport~\shortcite{Lamport:LaTeX}. This article shows only the plainest form of the citation command, using \texttt{{\char'134}cite}. Some examples. A paginated journal article \cite{Abril07}, an enumerated journal article \cite{Cohen07}, a reference to an entire issue \cite{JCohen96}, a monograph (whole book) \cite{Kosiur01}, a monograph/whole book in a series (see 2a in spec. document) \cite{Harel79}, a divisible-book such as an anthology or compilation \cite{Editor00} followed by the same example, however we only output the series if the volume number is given \cite{Editor00a} (so Editor00a's series should NOT be present since it has no vol. no.), a chapter in a divisible book \cite{Spector90}, a chapter in a divisible book in a series \cite{Douglass98}, a multi-volume work as book \cite{Knuth97}, an article in a proceedings (of a conference, symposium, workshop for example) (paginated proceedings article) \cite{Andler79}, a proceedings article with all possible elements \cite{Smith10}, an example of an enumerated proceedings article \cite{VanGundy07}, an informally published work \cite{Harel78}, a doctoral dissertation \cite{Clarkson85}, a master's thesis: \cite{anisi03}, an online document / world wide web resource \cite{Thornburg01, Ablamowicz07, Poker06}, a video game (Case 1) \cite{Obama08} and (Case 2) \cite{Novak03} and \cite{Lee05} and (Case 3) a patent \cite{JoeScientist001}, work accepted for publication \cite{rous08}, 'YYYYb'-test for prolific author \cite{SaeediMEJ10} and \cite{SaeediJETC10}. Other cites might contain 'duplicate' DOI and URLs (some SIAM articles) \cite{Kirschmer:2010:AEI:1958016.1958018}. Boris / Barbara Beeton: multi-volume works as books \cite{MR781536} and \cite{MR781537}. A couple of citations with DOIs: \cite{2004:ITE:1009386.1010128, Kirschmer:2010:AEI:1958016.1958018}. Online citations: \cite{TUGInstmem, Thornburg01, CTANacmart}. \subsection{Tables} 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*} It is strongly recommended to use the package booktabs~\cite{Fear05} and follow its main principles of typography with respect to tables: \begin{enumerate} \item Never, ever use vertical rules. \item Never use double rules. \end{enumerate} It is also a good idea not to overuse horizontal rules. \subsection{Figures} Like tables, figures cannot be split across pages; the best placement for them is typically the top or the bottom of the page nearest their initial cite. To ensure this proper ``floating'' placement of figures, use the environment \textbf{figure} to enclose the figure and its caption. This sample document contains examples of \texttt{.eps} files to be displayable with \LaTeX. If you work with pdf\LaTeX, use files in the \texttt{.pdf} format. Note that most modern \TeX\ systems will convert \texttt{.eps} to \texttt{.pdf} for you on the fly. More details on each of these are found in the \textit{Author's Guide}. \begin{figure} \includegraphics{fly} \caption{A sample black and white graphic.} \end{figure} \begin{figure} \includegraphics[height=1in, width=1in]{fly} \caption{A sample black and white graphic that has been resized with the \texttt{includegraphics} command.} \end{figure} As was the case with tables, you may want a figure that spans two columns. To do this, and still to ensure proper ``floating'' placement of tables, use the environment \textbf{figure*} to enclose the figure and its caption. And don't forget to end the environment with \textbf{figure*}, not \textbf{figure}! \begin{figure*} \includegraphics{flies} \caption{A sample black and white graphic that needs to span two columns of text.} \end{figure*} \begin{figure} \includegraphics[height=1in, width=1in]{rosette} \caption{A sample black and white graphic that has been resized with the \texttt{includegraphics} command.} \end{figure} \subsection{Theorem-like Constructs} Other common constructs that may occur in your article are the forms for logical constructs like theorems, axioms, corollaries and proofs. ACM uses two types of these constructs: theorem-like and definition-like. Here is a theorem: \begin{theorem} Let $f$ be continuous on $[a,b]$. If $G$ is an antiderivative for $f$ on $[a,b]$, then \begin{displaymath} \int^b_af(t)\,dt = G(b) - G(a). \end{displaymath} \end{theorem} Here is a definition: \begin{definition} If $z$ is irrational, then by $e^z$ we mean the unique number that has logarithm $z$: \begin{displaymath} \log e^z = z. \end{displaymath} \end{definition} The pre-defined theorem-like constructs are \textbf{theorem}, \textbf{conjecture}, \textbf{proposition}, \textbf{lemma} and \textbf{corollary}. The pre-defined de\-fi\-ni\-ti\-on-like constructs are \textbf{example} and \textbf{definition}. You can add your own constructs using the \textsl{amsthm} interface~\cite{Amsthm15}. The styles used in the \verb|\theoremstyle| command are \textbf{acmplain} and \textbf{acmdefinition}. Another construct is \textbf{proof}, for example, \begin{proof} Suppose on the contrary there exists a real number $L$ such that \begin{displaymath} \lim_{x\rightarrow\infty} \frac{f(x)}{g(x)} = L. \end{displaymath} Then \begin{displaymath} l=\lim_{x\rightarrow c} f(x) = \lim_{x\rightarrow c} \left[ g{x} \cdot \frac{f(x)}{g(x)} \right ] = \lim_{x\rightarrow c} g(x) \cdot \lim_{x\rightarrow c} \frac{f(x)}{g(x)} = 0\cdot L = 0, \end{displaymath} which contradicts our assumption that $l\neq 0$. \end{proof} \section{Conclusions} This paragraph will end the body of this sample document. Remember that you might still have Acknowledgments or Appendices; brief samples of these follow. There is still the Bibliography to deal with; and we will make a disclaimer about that here: with the exception of the reference to the \LaTeX\ book, the citations in this paper are to articles which have nothing to do with the present subject and are used as examples only. \section{Introduction} Replicating human movements and behaviour in humanoid robots is a formidable challenge with many exciting applications, ranging from health care (e.g. artificial limbs \cite{alshamsi2016}) to space exploration \cite{nasa2015}. Since the manual engineering of controllers for such tasks is extremely difficult, machine learning and specifically reinforcement learning has received much attention in this area. A recent NIPS competition \cite{kidzinski2018learningtorun} focused on the creation of a simulated humanoid running robot in a continuous and high-dimensional environment. The top entries to the competition employed state-of-the-art deep reinforcement learning techniques \cite{jaskowski2018rltorunfast,kidzinski2018l2rsolutions}, which resulted in strong, but not optimal, performance. In this paper, we demonstrate that videos showing human running behaviour can be used to significantly improve the learning performance. In our approach, we use the coordinates of specific body parts (e.g. the foot) to define a potential function that is fed into potential-based reward shaping \cite{ng1999policy}. To create a strong baseline for the evaluation of our approach, we combined selected RL techniques of the top ten competition entries with further optimizations to create a running agent that displays a significantly faster learning rate than the top entry. We then add the reward shaping from video data sampled from various YouTube videos, which resulted in a running agent that reached twice the running speed as our baseline in 12 hours of training. Since potential-based reward shaping has the nice theoretical property of not changing the optimal policy \cite{ng1999policy}, data taken from sub-optimal running behaviour does not prevent the RL agent from overcoming the sub-optimalities and produce humanoid running that outperforms the data source. We demonstrate this theoretical property empirically by sampling limb positions from a slower-running agent and show how our approach generates a running robot, that after a relatively short time of training, starts to run faster than the original agent. Overall, the main contribution of our work is to demonstrate how data extracted from videos of human movements can be used to significantly speed up the reinforcement learning of humanoid robots. While our work focuses on the training of humanoid running behaviour, the proposed techniques can easily be applied to any other form of humanoid movements. \section{Background} \subsection{Reinforcement Learning} Reinforcement learning is a paradigm which allows agents to learn by reward and punishment from interactions with the environment \cite{sutton1984temporal}. The numeric feedback received from the environment is used to improve the agent's actions. The majority of work in the area of reinforcement learning applies a Markov Decision Process (MDP) as a mathematical model \cite{puterman2014markov}. An MDP is a tuple $\big(S, A, T, R)$, where $S$ is the state space, A is the action space, $T(s,a,s') = Pr(s'|s,a)$ is the probability that action a in state s will lead to state $s'$, and $R(s, a, s')$ is the immediate reward $r$ received when action $a$ taken in state $s$ results in a transition to state $s'$. The problem of solving an MDP is to find a policy (i.e., mapping from states to actions) which maximises the accumulated reward. When the environment dynamics (transition probabilities and reward function) are available, this task can be solved using policy iteration \cite{bertsekas1995dynamic}. When the environment dynamics are not available, as with most real problem domains, policy iteration cannot be used. However, the concept of an iterative approach remains the backbone of the majority of reinforcement learning algorithms. These algorithms apply so called temporal-difference updates to propagate information about values of states and/or state-action pairs, $Q(s, a)$ [20]. These updates are based on the difference of the two temporally different estimates of a particular state or state-action value. The Q-learning algorithm is such a method [21]. After each transition, $(s, a) \rightarrow (s', r)$, in the environment, it updates state-action values by the formula: \begin{equation} \label{eq:qlearn} Q(s,a) \leftarrow Q(s,a) + \alpha[r + \gamma\max Q(s',a') - Q(s,a)] \end{equation} where $\alpha$ is the rate of learning and $\gamma$ is the discount factor. It modifies the value of taking action $a$ in state $s$, when after executing this action the environment returned reward $r$, and moved to a new state $s'$. \subsection{Potential Based reward shaping} The idea of reward shaping is to provide an additional reward representative of prior knowledge to reduce the number of suboptimal actions made and so reduce the time needed to learn \cite{ng1999policy, randlov1998learning}. This concept can be represented by the following formula for the Q-learning algorithm: \begin{equation} \label{eq:shaping} Q(s,a) \leftarrow Q(s,a)+\alpha[r+F(s,s')+\gamma\max Q(s',a') - Q(s,a)] \end{equation} where $F(s,s')$ is the general form of any state-based shaping reward. Even though reward shaping has been powerful in many experiments it quickly became apparent that, when used improperly, it can change the optimal policy \cite{randlov1998learning}. To deal with such problems, potential-based reward shaping was proposed \cite{ng1999policy} as the difference of some potential function $\Phi$ defined over a source s and a destination state $s':F(s,s')=\gamma \Phi(s') - \Phi(s)$ where $\gamma$ must be the same discount factor as used in the agent's update rule (see Equation \ref{eq:qlearn}). Ng et al. \cite{ng1999policy} proved that potential-based reward shaping, defined according to Equation \ref{eq:shaping}, guarantees learning a policy which is equivalent to the one learned without reward shaping in both infinite and finite horizon MDPs. Wiewiora \cite{wiewiora2003potential} later proved that an agent learning with potential-based reward shaping and no knowledge-based Q-table initialization will behave identically to an agent without reward shaping when the latter agent's value function is initialized with the same potential function. These proofs, and all subsequent proofs regarding potential-based reward shaping including those presented in this paper, require actions to be selected by an advantage-based policy \cite{wiewiora2003potential}. Advantage-based policies select actions based on their relative differences in value and not their exact value. Common examples include greedy, $\epsilon$-greedy and Boltzmann softmax. \subsection{Deep-RL} In Deep RL, the Q value function is represented as a multi-layer neural network \cite{Goodfellow-et-al-2016}. Deep RL algorithms have been shown to perform strongly on RL tasks which have been infeasible to tackle before. Over recent years, a number of algorithms and optimizations have been proposed, and we have chosen to apply the Deep Deterministic Policy Gradient (DDPG) algorithm for our application domain \cite{lillicrap2015continuous}. DDPG has been shown to be effective in continuous action domains where classic reinforcement learning methods struggled. Specifically, in the DDPG algorithm two neural networks are used: $\mu(S)$ is a network (the {\it actor}) that returns the action vector whose components are the values of the corresponding control signals. $Q^w(s, a)$ is a second neural network (the {\it critic}, that returns the $Q$ value, i.e. the value estimate of the action of $a$ in state $s$. \begin{equation} \label{eq:policy5} \begin{aligned} \nabla_\theta J(\pi_\theta) & =\int_{S}\rho^\pi(s)\int_{A}\nabla_\theta\pi_\theta(a|s)Q^w(s,a) da ds \\ &=\mathbb{E}_{s\sim \rho^\pi,a\sim\pi_\theta}[\nabla_\theta \log \pi_\theta (a|s)Q^w(s,a)] \end{aligned} \end{equation} where $\theta$ is the parameter vector of the probabilistic policy and $\rho^\pi(s)$ is the probability of reaching state $s$ with policy $\pi$. For a more complete description of DDPG, see \cite{lillicrap2015continuous}. \subsection{Reinforcement Learning from Demonstration} Human expert demonstrations have been demonstrated to improve the learning speed and accuracy of RL agent on a wide range of tasks. Most work in this area (e.g. \cite{suay2016learning, brys2015reinforcement}) focused on the use of state-action recordings as demonstration. This is infeasible in the case of video data, where only state information is available and the demonstration actions are not explicitly provided and often can not be derived either (as is the case with running). More recently, various methods for state-only demonstrations have been proposed (e.g. \cite{peng2018deepmimic, liu2017imitation}). However, all of these methods target the imitation of demonstrations. Our work is employing potential-based reward shaping which uses the demonstrations to speed up the learning, but is also able to overcome any sub-optimalities in the demonstration rather than purely imitating them. \section{Simulation Environment} \label{sec:domain} \begin{figure} \centering \includegraphics[width=0.40\textwidth]{img/opensim3.jpg} \caption{A screenshot of the "Learning to Run" simulation environment} \label{img:environment} \end{figure} The simulation environment has been provided by the "Learning to Run" competition and is based on the OpenSim environment employing the Simbody physics engine. The environment simulates a three-dimensional race course with small obstacles, along which a humanoid robot with 6 joints (ankle, knee, and hip on two legs) and corresponding muscles is running (see Figure \ref{img:environment}). The actions of the running humanoid robot are excitation values applied to the muscles implemented in the robot model. The next state of the environment is computed by the physics engine based on the resulting muscle activations, forces, velocities and positions of the joints. The OpenSim \cite{kidzinski2018learningtorun} model environment represents the robot state using a vector of 41 features: \begin{itemize} \item position of the pelvis (rotation, x, y) \item velocity of the pelvis (rotation, x, y) \item rotation of each ankle, knee and hip (6 values) \item angular velocity of each ankle, knee and hip (6 values) \item position of the center of mass (2 values) \item velocity of the center of mass (2 values) \item positions of head, pelvis, torso, left and right toes, left and right talus (14 values) \item strength of left and right psoas (a muscle at the lower spine) \item next obstacle: x distance from the pelvis, y position of the center relative to the the ground, radius. \end{itemize} The reward of an agent is provided at each simulation step and is the distance covered in the run minus the muscle strain as computed by the simulation environment. \section{Baseline Agent} When designing the baseline agent, we combined selected techniques from the top 10 competition entries \cite{kidzinski2018l2rsolutions} with further optimizations. In this section, we summarize the most beneficial techniques used, all of which are taken from various contributions published in \cite{kidzinski2018l2rsolutions}. In all exerimental results presented in the remainder of this paper, the experiments have been repeated 5 times, and the graphs show the standard error from the mean. The RL parameter choice was $\alpha = 0.08$ and $\gamma = 0.9$, which have been determined experimentally. \subsection{State representation} The original state representation provided by the competition software contained 41 features, described in Section \ref{sec:domain}. In our state representation we added 71 features, including: \begin{itemize} \item Two-dimensional coordinates of key body positions relative to the pelvis at the center point (0,0). \item Two-dimensional velocity and acceleration vectors for key body points. \end{itemize} The new state representation allowed us to significantly speed up the learning process as seen on Figure \ref{img:centerandfeatures}. \begin{figure} \includegraphics[width=0.47\textwidth]{img/modified.jpg} \caption{This Figure shows significant learning speed increase after adding velocity and acceleration features and centering the coordinates system at the pelvis position} \label{img:centerandfeatures} \end{figure} \subsection{Additional training experience} After running a simulation episode, we trained the RL agent with additional mirrored data, which represented the agents experience during the episode and reflecting it along the $xy$ plane. This adds valuable training for the value estimator (i.e. the critic), since the task is symmetrical. Figure \ref{img:mirrored} shows the resulting performance improvement. \begin{figure} \includegraphics[width=0.47\textwidth]{img/mirrored.jpg} \caption{Speeding up learning process through adding mirrored data} \label{img:mirrored} \end{figure} \subsection{Repeating the chosen action} Each time the running agent chooses an action, this is repeated three times. Because we employed an actor-critic method, this reduced the number of computations needed to generate the next action during an episode by a factor of three. The resulting performance gain can be seen in Figure \ref{img:flipaction}. \begin{figure} \includegraphics[width=0.47\textwidth]{img/flip.jpg} \caption{Performance gains when repeating each action three times} \label{img:flipaction} \end{figure} \subsection{Reducing state resolution} In this optimization step, all the state representation data was changed from {\it double} to {\it float}. This resulted in a speed-up of the computations and a somewhat smaller state space, while also reducing the precision of the state representation. Figure \ref{img:doublefloat} shows the resulting performance increase. \begin{figure} \includegraphics[width=0.47\textwidth]{img/Speedup.jpg} \caption{Switching from double to float} \label{img:doublefloat} \end{figure} \subsection{Neural network topology} After applying all of the techniques above, we compared 5 different network architectures by arbitrarily varying the number of layers and neurons per layer. The results are presented in Figure \ref{img:architectures}. For our baseline agent we chose the best performing layer, using 5 layers with 128 neurons each. \begin{figure} \includegraphics[width=0.47\textwidth]{img/6.jpg} \caption{Various neural network topologies: LxN denotes L layers with N neurons per layer} \label{img:architectures} \end{figure} \section{Reward Shaping from Video Data} After designing our baseline, we added potential-based reward shaping from video data taken from arbitrary YouTube videos depicting running of humans and human-like characters. In this section we describe how the potential function was generated. \subsection{Potential function} The overall potential function is defined as the sum of potential functions for every body part: pelvis, two knees and two feet. Following the potential-based reward shaping approach, an additional reward is given to an agent on each simulation step corresponding to the change in potentials of the source and target state. We considered the following three different potential functions for each body part (knee and foot) in our research, all of them based on the inverse of the distance between the respective body part coordinate in the video-generated data and the humanoid robot. The three potential functions represent three different inverse distance functions: \begin{itemize} \item PF1: $\frac{1}{dx + dy}$ \item PF2: $\frac{1}{\sqrt{dx^2 + dy^2}} $ \item PF3: $\frac{1}{dx^2 + dy^2}$ \end{itemize} where $dx$ ($dy$) is the absolute difference between the x (y) coordinate of the respective body part taken from the video data and the x (y) coordinate of the body part of the humanoid robot. \subsection{Data collection} For our potential function we have used the following three sources of video data: \begin{itemize} \item A video of a cartoon character running (see Figure \ref{img:cartoon} for a screenshot) \item A video of a running character in a computer game (see Figure \ref{img:videogame} for a screenshot) \item A video of a running human (see Figure \ref{img:runninghuman} for a screenshot) \end{itemize} \begin{figure} \centering \includegraphics[width=0.3\textwidth]{img/cartoon.jpg} \caption{Screenshot from a video depicting a cartoon character running (taken from http://y2u.be/2y6aVz0Acx0)} \label{img:cartoon} \end{figure} \begin{figure} \centering \includegraphics[width=0.3\textwidth]{img/videogame.jpg} \caption{Screenshot from a video depicting a computer game character running (taken from http://y2u.be/YbYOsE7JyXs)} \label{img:videogame} \end{figure} \begin{figure} \centering \includegraphics[width=0.3\textwidth]{img/runninghuman.jpg} \caption{Screenshot from a video depicting a human running (taken from http://y2u.be/5mVgThl-yMU)} \label{img:runninghuman} \end{figure} Each of the sources was used to define a potential function. The performance of the resulting potential functions in RL are compared in Figure \ref{img:var_potential}. Note that the learning curves were not trained until final convergence, which would require much more time and based on the theoretical properties of potential-based reward shaping would ultimately reach the same performance. In each source we recorded the positions of the two knees and the two feet relative to the pelvis as a two-dimensional coordinate. The recording frequency was four positions per half step. The resulting coordinates were normalized according to the OpenSim simulation. While in our work the extraction of the coordinates was done manually, algorithms to accurately extract body part positions in images with a clear view of the body do exist (e.g. \cite{toshev2014deeppose,guler2018densepose}), and we intend to use these in future work. \subsection{Selecting the data source and the potential function} We first compared the performance of the potential functions based on three videos and the inverse distance measure PF2. The results for this experiment is shown in Figure \ref{img:differentvideo}, and demonstrates that the human video is the best data source for the reward shaping. \begin{figure} \includegraphics[width=0.47\textwidth]{img/differentvideo.jpg} \caption{Comparing the three videos as a data source for the potential function based on PF2} \label{img:differentvideo} \end{figure} After selecting the running human video as the data source, we compared the three different potential functions as depicted in Figure \ref{img:var_potential}. The results show that PF3 performs best. \begin{figure} \includegraphics[width=0.47\textwidth]{img/pot_functions.JPG} \caption{Comparing three potential functions} \label{img:var_potential} \end{figure} \section{Evaluation of Video-based Reward Shaping} Figure \ref{img:baseline_vs_shaping} shows the comparison of our chosen reward shaping approach (PF3) to the RL baseline. The results show that the reward shaping speeds up the learning significantly, reaching double the running speed at 12 hours of training. The end result after 24 hours of training still shows a significant advantage of the reward shaping approach. It is also worth noting that the demonstration video is of a running human who is using his arms, while the simulation model does not include these. \begin{figure} \includegraphics[width=0.47\textwidth]{img/rewardshaping.jpg} \caption{Performance comparison between the baseline and the reward shaping approach} \label{img:baseline_vs_shaping} \end{figure} An important advantage of potential-based reward shaping is the theoretical guarantee that the shaping will not change the optimal policy. In order to demonstrate this advantage in our context, we used a weak running robot generated by the baseline RL agent after 12 hours of training as a sub-optimal data source for the potential function. Clearly, the resulting agent is not running optimally, and the positions of the feet and knees will not be in optimal positions most of the time. We then train our RL agent with the reward shaping generated from these sub-optimal coordinates (using PF3), and compared the performance to the weak runner. The results are shown in Figure \ref{img:suboptimal}, and demonstrate that the RL agent is able to overcome the suboptimal performance of the data source. In fact, after 20 hours of training, the performance is more than double that of the suboptimal running agent. Also, note that the suboptimal shaping did not hurt the learning performance significantly. After 12 hours of training the shaped agent performs comparable to the baseline agent with 12 hours of training. \begin{figure} \includegraphics[width=0.47\textwidth]{img/sim.jpg} \caption{Performance of the reward shaping approach with suboptimal data. The dotted vertical line represents 12 hours of training (the training time of the shaping source).} \label{img:suboptimal} \end{figure} \section{Conclusions} In this paper, we presented a method to use videos of human and human-like running to shape the reward of an RL agent learning to run. Our results demonstrate that a significant improvement in learning speed can be achieved by our proposed method, as compared to a strong baseline which we designed combining selected techniques of the top ten entries to the "Learning to Run" competition at NIPS 2017. In future work, we intend to employ automated body pose extraction methods such as the one presented in \cite{guler2018densepose} and widen our investigation to other humanoid movement apart from running, e.g. jumping. \section{Introduction} The \textit{proceedings} are the records of a conference.\footnote{This is a footnote} ACM seeks to give these conference by-products a uniform, high-quality appearance. To do this, ACM has some rigid requirements for the format of the proceedings documents: there is a specified format (balanced double columns), a specified set of fonts (Arial or Helvetica and Times Roman) in certain specified sizes, a specified live area, centered on the page, specified size of margins, specified column width and gutter size. \section{The Body of The Paper} Typically, the body of a paper is organized into a hierarchical structure, with numbered or unnumbered headings for sections, subsections, sub-subsections, and even smaller sections. The command \texttt{{\char'134}section} that precedes this paragraph is part of such a hierarchy.\footnote{This is a footnote.} \LaTeX\ handles the numbering and placement of these headings for you, when you use the appropriate heading commands around the titles of the headings. If you want a sub-subsection or smaller part to be unnumbered in your output, simply append an asterisk to the command name. Examples of both numbered and unnumbered headings will appear throughout the balance of this sample document. Because the entire article is contained in the \textbf{document} environment, you can indicate the start of a new paragraph with a blank line in your input file; that is why this sentence forms a separate paragraph. \subsection{Type Changes and {\itshape Special} Characters} We have already seen several typeface changes in this sample. You can indicate italicized words or phrases in your text with the command \texttt{{\char'134}textit}; emboldening with the command \texttt{{\char'134}textbf} and typewriter-style (for instance, for computer code) with \texttt{{\char'134}texttt}. But remember, you do not have to indicate typestyle changes when such changes are part of the \textit{structural} elements of your article; for instance, the heading of this subsection will be in a sans serif\footnote{Another footnote here. Let's make this a rather long one to see how it looks.} typeface, but that is handled by the document class file. Take care with the use of\footnote{Another footnote.} the curly braces in typeface changes; they mark the beginning and end of the text that is to be in the different typeface. You can use whatever symbols, accented characters, or non-English characters you need anywhere in your document; you can find a complete list of what is available in the \textit{\LaTeX\ User's Guide} \cite{Lamport:LaTeX}. \subsection{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. \subsubsection{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). \subsubsection{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. \subsection{Citations} Citations to articles~\cite{bowman:reasoning, clark:pct, braams:babel, herlihy:methodology}, conference proceedings~\cite{clark:pct} or maybe books \cite{Lamport:LaTeX, salas:calculus} listed in the Bibliography section of your article will occur throughout the text of your article. You should use BibTeX to automatically produce this bibliography; you simply need to insert one of several citation commands with a key of the item cited in the proper location in the \texttt{.tex} file~\cite{Lamport:LaTeX}. The key is a short reference you invent to uniquely identify each work; in this sample document, the key is the first author's surname and a word from the title. This identifying key is included with each item in the \texttt{.bib} file for your article. The details of the construction of the \texttt{.bib} file are beyond the scope of this sample document, but more information can be found in the \textit{Author's Guide}, and exhaustive details in the \textit{\LaTeX\ User's Guide} by Lamport~\shortcite{Lamport:LaTeX}. This article shows only the plainest form of the citation command, using \texttt{{\char'134}cite}. Some examples. A paginated journal article \cite{Abril07}, an enumerated journal article \cite{Cohen07}, a reference to an entire issue \cite{JCohen96}, a monograph (whole book) \cite{Kosiur01}, a monograph/whole book in a series (see 2a in spec. document) \cite{Harel79}, a divisible-book such as an anthology or compilation \cite{Editor00} followed by the same example, however we only output the series if the volume number is given \cite{Editor00a} (so Editor00a's series should NOT be present since it has no vol. no.), a chapter in a divisible book \cite{Spector90}, a chapter in a divisible book in a series \cite{Douglass98}, a multi-volume work as book \cite{Knuth97}, an article in a proceedings (of a conference, symposium, workshop for example) (paginated proceedings article) \cite{Andler79}, a proceedings article with all possible elements \cite{Smith10}, an example of an enumerated proceedings article \cite{VanGundy07}, an informally published work \cite{Harel78}, a doctoral dissertation \cite{Clarkson85}, a master's thesis: \cite{anisi03}, an online document / world wide web resource \cite{Thornburg01, Ablamowicz07, Poker06}, a video game (Case 1) \cite{Obama08} and (Case 2) \cite{Novak03} and \cite{Lee05} and (Case 3) a patent \cite{JoeScientist001}, work accepted for publication \cite{rous08}, 'YYYYb'-test for prolific author \cite{SaeediMEJ10} and \cite{SaeediJETC10}. Other cites might contain 'duplicate' DOI and URLs (some SIAM articles) \cite{Kirschmer:2010:AEI:1958016.1958018}. Boris / Barbara Beeton: multi-volume works as books \cite{MR781536} and \cite{MR781537}. A couple of citations with DOIs: \cite{2004:ITE:1009386.1010128, Kirschmer:2010:AEI:1958016.1958018}. Online citations: \cite{TUGInstmem, Thornburg01, CTANacmart}. \subsection{Tables} 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*} It is strongly recommended to use the package booktabs~\cite{Fear05} and follow its main principles of typography with respect to tables: \begin{enumerate} \item Never, ever use vertical rules. \item Never use double rules. \end{enumerate} It is also a good idea not to overuse horizontal rules. \subsection{Figures} Like tables, figures cannot be split across pages; the best placement for them is typically the top or the bottom of the page nearest their initial cite. To ensure this proper ``floating'' placement of figures, use the environment \textbf{figure} to enclose the figure and its caption. This sample document contains examples of \texttt{.eps} files to be displayable with \LaTeX. If you work with pdf\LaTeX, use files in the \texttt{.pdf} format. Note that most modern \TeX\ systems will convert \texttt{.eps} to \texttt{.pdf} for you on the fly. More details on each of these are found in the \textit{Author's Guide}. \begin{figure} \includegraphics{fly} \caption{A sample black and white graphic.} \end{figure} \begin{figure} \includegraphics[height=1in, width=1in]{fly} \caption{A sample black and white graphic that has been resized with the \texttt{includegraphics} command.} \end{figure} As was the case with tables, you may want a figure that spans two columns. To do this, and still to ensure proper ``floating'' placement of tables, use the environment \textbf{figure*} to enclose the figure and its caption. And don't forget to end the environment with \textbf{figure*}, not \textbf{figure}! \begin{figure*} \includegraphics{flies} \caption{A sample black and white graphic that needs to span two columns of text.} \end{figure*} \begin{figure} \includegraphics[height=1in, width=1in]{rosette} \caption{A sample black and white graphic that has been resized with the \texttt{includegraphics} command.} \end{figure} \subsection{Theorem-like Constructs} Other common constructs that may occur in your article are the forms for logical constructs like theorems, axioms, corollaries and proofs. ACM uses two types of these constructs: theorem-like and definition-like. Here is a theorem: \begin{theorem} Let $f$ be continuous on $[a,b]$. If $G$ is an antiderivative for $f$ on $[a,b]$, then \begin{displaymath} \int^b_af(t)\,dt = G(b) - G(a). \end{displaymath} \end{theorem} Here is a definition: \begin{definition} If $z$ is irrational, then by $e^z$ we mean the unique number that has logarithm $z$: \begin{displaymath} \log e^z = z. \end{displaymath} \end{definition} The pre-defined theorem-like constructs are \textbf{theorem}, \textbf{conjecture}, \textbf{proposition}, \textbf{lemma} and \textbf{corollary}. The pre-defined de\-fi\-ni\-ti\-on-like constructs are \textbf{example} and \textbf{definition}. You can add your own constructs using the \textsl{amsthm} interface~\cite{Amsthm15}. The styles used in the \verb|\theoremstyle| command are \textbf{acmplain} and \textbf{acmdefinition}. Another construct is \textbf{proof}, for example, \begin{proof} Suppose on the contrary there exists a real number $L$ such that \begin{displaymath} \lim_{x\rightarrow\infty} \frac{f(x)}{g(x)} = L. \end{displaymath} Then \begin{displaymath} l=\lim_{x\rightarrow c} f(x) = \lim_{x\rightarrow c} \left[ g{x} \cdot \frac{f(x)}{g(x)} \right ] = \lim_{x\rightarrow c} g(x) \cdot \lim_{x\rightarrow c} \frac{f(x)}{g(x)} = 0\cdot L = 0, \end{displaymath} which contradicts our assumption that $l\neq 0$. \end{proof} \section{Conclusions} This paragraph will end the body of this sample document. Remember that you might still have Acknowledgments or Appendices; brief samples of these follow. There is still the Bibliography to deal with; and we will make a disclaimer about that here: with the exception of the reference to the \LaTeX\ book, the citations in this paper are to articles which have nothing to do with the present subject and are used as examples only.
{'timestamp': '2020-12-17T02:13:30', 'yymm': '2012', 'arxiv_id': '2012.08824', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08824'}
arxiv
\section{Introduction} Emotion recognition in conversation (ERC) is an emerging task in natural language processing (NLP) that aims to identify the emotion of each utterance in a conversation. It can be regarded as an extension of traditional emotion detection from text, or an arising problem in dialogue systems that helps generate emotion-aware dialogues \cite{zhou2017emotional}. Empirical evidence shows that the conversational context of an utterance plays an indispensable role in this task \cite{poria2019emotion}. Moreover, the emotion also tends to stay unchanged within a short context of the conversation. It is thus very critical to effectively model the alternate utterances by different parties. To solve this problem, many recent works focus on deep neural networks with hierarchical structures to model the conversational data \cite{majumder2019dialoguernn, ghosal2019dialoguegcn,jiao2019higru,zhong2019knowledge}. In these works, each utterance is firstly encoded separately into an utterance representation, which is then modeled sequentially and hierarchically. Although the structures seem to comply with the organization of utterances, they ignore the direct dependencies between words in different utterances. In addition, they are not conducive to the application of pre-trained language models such as BERT \cite{devlin2018bert} and XLNet \cite{yang2019xlnet}, which have achieved superior performance in many dialogue system tasks other than ERC \cite{madotto2018mem2seq,bao2020plato,henderson2019convert}. There are two main challenges to directly apply these pre-trained language models to ERC. First, conversations in ERC are usually multi-party and there can be intra- and inter-speaker dependencies \cite{ghosal2019dialoguegcn}. Existing pre-trained language models are not readily feasible to encode these dependencies. Second, almost all language models are constrained by the input length. When the input sequence exceeds the limit, it has to be truncated, which may lead to loss of information in distant historical utterances \cite{majumder2019dialoguernn,ghosal2019dialoguegcn}. To cope with the above challenges, we introduce an all-in-one XLNet model, namely DialogXL, for emotion recognition in multi-turn multi-party conversation. DialogXL intends to apply a strong pre-trained language model to ERC without constructing a complicated, hierarchical model in processing the conversational data. Specifically, it first replaces XLNet's \emph{segment recurrence} by a more flexible and memory-saving \emph{utterance recurrence} to utilize historical utterances. Utterance recurrence stores the hidden states of historical utterances in a memory bank and reuses them while identifying a query utterance. Next, the \emph{self-attention} in XLNet's Transformer layers is substituted for \emph{dialog-aware self-attention}, which consists of four different types of attention, namely local self-attention, global self-attention, speaker self-attention, and listener self-attention. Dialog-aware self-attention allows DialogXL to model the inter- and intra-speaker dependencies under different reception fields in the historical context. We conduct extensive experiments on four ERC benchmarks and the results show that the proposed model, DialogXL, outperforms all the baselines on the datasets. Furthermore, several studies are conducted to verify the modules of DialogXL, and an error analysis is used to delve into the reasons behind the errors. To conclude, our contributions are as follows: \begin{itemize} \item DialogXL is the first effort of pre-trained language models designed for emotion recognition in conversation (ERC). \item We propose a memory-saving utterance recurrence to replace XLNet's segment recurrence. The new approach allows DialogXL to cache up to 1000 historical words of a conversation, which is more powerful than the vanilla XLNet model. \item Unlike the original self-attention that merely computes attention weights between words, our dialog-aware self-attention computes them by different reception fields and party roles, allowing us to capture useful intra- and inter-speaker dependencies. \end{itemize} \section{Related Work} \subsection{Emotion Recognition in Conversation} Emotion recognition in conversation (ERC) has emerged as an important problem in recent years and has attracted numerous interests from the NLP community. The availability of large conversational datasets \cite{busso2008iemocap, schuller2012avec, li2017dailydialog, chen2018emotionlines, poria2019meld} account partly for this phenomenon, and the increasing interests in dialogue systems may also explain it. Recent works on ERC generally resort to deep learning models. For example, CMN \cite{hazarika2018conversational} and ICON \cite{hazarika2018icon} both utilize gated recurrent unit (GRU) and memory networks. \citeauthor{majumder2019dialoguernn} \shortcite{majumder2019dialoguernn} propose a recurrent-based model to model the party state, global state and emotional dynamics. \citeauthor{jiao2019higru} \shortcite{jiao2019higru} propose a hierarchical GRU structure that trains utterance-level and conversation-level encoders jointly. \citeauthor{ghosal2019dialoguegcn} \shortcite{ghosal2019dialoguegcn} propose a graph neural network based model to encode speaker dependencies and temporal information. \citeauthor{zhong2019knowledge} \shortcite{zhong2019knowledge} incorporate external knowledge bases to support the identification. \citeauthor{hazarika2019emotion} \shortcite{hazarika2019emotion} introduce transfer learning from utterance generation to ERC. The modalities of data used in the above works are not the same. Specifically, \cite{hazarika2018icon,hazarika2018conversational,majumder2019dialoguernn} utilize textual, audio and video modalities, while the latest research \cite{jiao2019higru,ghosal2019dialoguegcn,zhong2019knowledge,hazarika2019emotion} tends to use only the textual modality. \subsection{Pre-trained Language Models} The effectiveness of large pre-trained language models \cite{devlin2018bert, yang2019xlnet, liu2019roberta, conneau2020unsupervised} has been well exhibited in many NLP tasks such as machine reading comprehension, text classification, machine translation. Among the language models, BERT \cite{devlin2018bert} utilizes bi-directional Transformer encoders as well as pre-training schemes of masked language modeling and next sentence prediction. XLNet \cite{yang2019xlnet} is another powerful pre-trained language model, which excels at processing long documents with the segment recurrence mechanism. In addition, it combines the strengths of both auto-encoding and auto-regressive language modeling. There have been some recent works that apply pre-trained language models to dialog-related tasks \cite{bao2020plato,ham2020end, henderson2019convert}, but they have yet to be applied to emotion recognition in conversation. \begin{figure*}[t] \centering \includegraphics[width=1\textwidth]{model_overview.pdf} \caption{The architecture of our DialogXL.} \label{fig:model_overview} \end{figure*} \section{Methodology} There are two challenges to overcome in order to apply pre-trained language models to emotion recognition in conversation (ERC). The first challenge is how to encode a long historical context with hundreds of words. The second is how to model the intra- and inter-speaker dependencies of different parties. Instead of building a hierarchical network as previous work, we propose DialogXL\footnote{The implementation is available at https://github.com/shen-wzh3/DialogXL.} to address these two challenges on the basis of XLNet with two improvements. The overview architecture of DialogXL is shown in Figure \ref{fig:model_overview}. It consists of an embedding layer, 12 Transformer layers, and a feed-forward neural network. The model identifies the emotion for each utterance in turn when a conversation comes in. Compared with XLNet, DialogXL has a more effective memory bank equipped during the training and testing phases, storing hidden states of historical utterances for future reuses. The memory bank is updated by a new \emph{utterance recurrence} mechanism. And the hidden states at each Transformer layer are derived by \emph{dialog-aware self-attention}.\footnote{XLNet's permutation language modeling and two-stream self-attention, which are designed for language modeling tasks, are not included in DialogXL.} \subsection{Problem Definition} In ERC, a conversation is defined as a list of utterances $\{u_1, u_2, ..., u_N\}$, where $N$ is the number of utterances. Each utterance $u_i$ consists of $n_i$ tokens, namely $u_i = \{w_{i1}, w_{i2},...,w_{in_i}\}$. A discrete value $y_i\in \mathcal{S}$ is used to denote the emotion label of $u_i$, where $\mathcal{S}$ is the set of emotion labels. The speaker is denoted by a function $p(\cdot)$. For example, $p(u_i)\in \mathcal{P}$ denotes the speaker of $u_i$ and $\mathcal{P}$ is the collection of all speaker roles in an ERC dataset. The objective of this task is to output the emotion label $y_t$ for a given query utterance $u_t$ based on its historical context $\{u_1, u_2, ..., u_{t-1}\}$ and the corresponding speaker information. \subsection{Model Input} At each time step $t$, the query utterance $u_t$ is prepended with the special token ``\texttt{[CLS]}'': \begin{equation} x_t = \{\text{[CLS]}, w_{t1}, w_{t2}, ..., w_{tn_t}\}. \end{equation} The utterance is then passed to the embedding layer. In DialogXL, this layer consists of only word embedding. The output of the embedding layer is treated as input hidden states to the first Transformer layer: \begin{equation} \mathbf{h}_t^0 = \text{Embedding}(x_t) \end{equation} \subsection{Utterance Recurrence} XLNet \cite{yang2019xlnet} and Transformer-XL \cite{dai2019transformer} address the limitation of input size by a mechanism named \emph{segment recurrence}, which caches previous hidden states in a memory bank and revisits them in future computations. However, this mechanism is ineffective when directly applied to conversational emotion recognition for two reasons. First, the ``segment'' in XLNet refers to a fixed-length sequence rather than a linguistic unit such as a sentence. The conversation in ERC is defined in terms of utterances, which are typically full sentences or paragraphs. Therefore, it is essential to keep the utterances complete rather than segmented into pieces. Second, segment recurrence constrains segments in the same training batch to have the same length, which results in too many paddings stored in memory. By contrast, the proposed \emph{utterance recurrence} stores the historical context in memory without paddings, allowing the memory to store a longer historical context. \begin{figure}[t] \centering \includegraphics[width=1\columnwidth]{utterance_recurrence} \caption{Illustration of the memory update strategies by utterance recurrence and segment recurrence. The batch size is 4, with each row corresponding to a conversation.} \label{fig:utterance_recurrence} \end{figure} \begin{figure*}[t] \centering \includegraphics[width=0.9\textwidth]{multi_perspective_attention} \caption{Demonstration of dialog-aware self-attention: (a) global self-attention, (b) local self-attention, (c) speaker self-attention, and (d) listener self-attention. The utterance to be identified is $u_t$, while the hidden states of $u_{t-3}$, $u_{t-2}$, and $u_{t-1}$ are cached in memory. The speaker identities are: $p(u_t)=p(u_{t-2}) $ and $p(u_{t-1})=p(u_{t-3})$. The window size of local self-attention is 2. The upper part of each subgraph is the attention mask for $u_t$ and other utterances, with masked attention weights colored grey. The lower part of each subgraph is the attention flows between two consecutive Transformer layers, where solid blue lines represent self-attention within $u_t$ and dashed orange lines represent attention between $u_t$ and the memory $\mathbf{m}$.} \label{fig:multi_perspective_attention} \end{figure*} The memory, denoted by $\mathbf{m}$, works like a stack. Every time a new set of hidden states are generated for a query utterance, they are concatenated with the current memory. To prevent from introducing noises into the memory, only the hidden states of the utterance tokens are stored, with the hidden states of the ``\texttt{[CLS]}'' and padding positions ignored. Formally, for the $t$-th utterance, at each Transformer layer $l$ the new memory $\mathbf{m}^{l'}$ is updated as: \begin{equation} \mathbf{m}^{l'} = \mathbf{m}^{l} \parallel \mathbf{h}_{t,1:1+n_t}^{l} \end{equation} where $\parallel$ denotes the concatenation operation. This update strategy is useful especially during the batching operation. As illustrated in Figure \ref{fig:utterance_recurrence}, updating memory with only the hidden states of utterance tokens makes the memory more compact, for the noises introduced by padding are mostly eliminated and more space is freed to cache a longer context. \subsection{Dialog-Aware Self-Attention} Utterances occur alternately by different parties in a conversation, and the vanilla self-attention in XLNet cannot be directly applied to the multi-party setting. To this end, we replace the self-attention by \emph{dialog-aware self-attention}, which enables our model to encode conversation contexts in a multi-turn multi-party setting. The new self-attention consists of four types of self-attention: \emph{global self-attention} and \emph{local self-attention} for different sizes of receptive fields, and \emph{speaker self-attention} and \emph{listener self-attention} for intra- and inter-speaker dependencies. We implement the dialog-aware self-attention by skillfully changing the masking strategies of self-attention, without the need to add any extra embeddings or parameters, as illustrated in Figure \ref{fig:multi_perspective_attention}. Dialog-aware self-attention is multi-headed. For each attention head of the $l$-th Transformer layer, the attention output $\mathbf{o}^l_t$ is computed as follows: \begin{equation}\label{eq:attn_begin} \widetilde{\mathbf{h}}_t^{l-1} = \mathbf{m}^{l-1} || \mathbf{h}_t^{l-1} \end{equation} \begin{equation} \mathbf{q}^l_t,\ \mathbf{k}^l_t,\ \mathbf{v}^l_t = \mathbf{h}_t^{l-1}\mathbf{W}^{l\top}_q,\ \widetilde{\mathbf{h}}_t^{l-1}\mathbf{W}^{l\top}_k,\ \widetilde{\mathbf{h}}_t^{l-1}\mathbf{W}^{l\top}_v \end{equation} \begin{equation} \mathbf{a}_t^l = \text{RelPosAttn}(\mathbf{q}^l_t, \mathbf{k}^l_t) \end{equation} \begin{equation}\label{eq:mask} \widetilde{\mathbf{a}}_t^l = \mathbf{a}_t^l- \mathbf{s} \end{equation} \begin{equation}\label{eq:attn_end} \mathbf{o}_t^l = \text{softmax}(\widetilde{\mathbf{a}}_t^l) \mathbf{v}^l_t \end{equation} where $\mathbf{W}^{l}_q$, $\mathbf{W}^{l}_k$, and $\mathbf{W}^{l}_v$ are trainable parameters for each attention head, and $\text{RelPosAttn}(\cdot)$ are the relative position attention adopted from Transformer-XL and XLNet. The attention mask $\mathbf{s}$ in Equation (\ref{eq:mask}) is a matrix with the same shape as the attention weights $\mathbf{a}_t^l$. The value of $\mathbf{s}_{ij}$ is set to $+\infty$ only when the attention between the $i$-th vector in $\mathbf{q}^l_t$ and $j$-th vector in $\mathbf{k}^l_t$ is masked, and set to 0 otherwise. For the sake of convenience, we denote Equation (\ref{eq:attn_begin}) to Equation (\ref{eq:attn_end}) by a function $f(\cdot)$: \begin{equation} \mathbf{o}_t^l = f(\mathbf{m}^{l-1},\mathbf{h}_t^{l-1},\mathbf{s}) \end{equation} \subsubsection{Global Self-Attention} Global self-attention takes all the historical context and the query utterance as the reception field. It is the same as the vanilla self-attention, in which the query utterance pays attention to the whole context. This setting allows our model to attend to previously distant utterances which may also be useful \cite{majumder2019dialoguernn}. Thus, no masking is made for global self-attention: \begin{equation} \mathbf{s}^{global}_{ij}=0 \end{equation} \subsubsection{Local Self-Attention} Local self-attention only has a reception field of $\omega$ latest historical utterances, where $\omega$ is a hyperparameter. The motivation for this attention is that intuitively speaker's emotion is mostly influenced by the recent utterances. In local self-attention, we mask the attentions between the query utterance and the historical utterances outside the reception field: \begin{equation} \mathbf{s}^{local}_{ij} = \left\{ \begin{array}{rl} +\infty, & j\notin \text{Idx}(\{u_{t-\omega},u_{t-\omega+1},...,u_{t-1},u_t\})\\ 0, & \text{Otherwise}\\ \end{array} \right. \end{equation} where $\text{Idx}(\mathcal{U})$ is a function that maps the utterance tokens in $\mathcal{U}$ to the corresponding positions in the key matrix $\mathbf{k}^l_t$ . \subsubsection{Speaker Self-Attention} Speaker self-attention considers only the historical context spoken by the present speaker. It intends to model the intra-speaker dependency \cite{ghosal2019dialoguegcn} by identifying emotional clues in the speaker's historical utterances. In speaker self-attention, we mask the attentions between the query utterance and the utterances spoken by other speakers: \begin{equation} \mathbf{s}^{speaker}_{ij} = \left\{ \begin{array}{rcl} +\infty, &j\in \text{Idx}(\{u\ |\ p(u)\neq p(u_t)\})\\ 0, &\text{Otherwise}\\ \end{array} \right. \end{equation} \subsubsection{Listener Self-Attention} Listener self-attention considers only the historical utterances spoken by other speakers. It intends to model the inter-speaker dependency \cite{ghosal2019dialoguegcn}, meaning that the present speaker's emotion may be influence by other speakers' words. In listener self-attention, we mask the attentions between the query utterance and the utterances made by the present speaker: \begin{equation} \mathbf{s}^{listener}_{ij} = \left\{ \begin{array}{rl} +\infty, &j\in \text{Idx}(\{u\ |\ p(u)=p(u_t)\})\\ 0, &\text{Otherwise}\\ \end{array} \right. \end{equation} The outputs of the four types of self-attention are concatenated and passed through a normalization layer followed by a feed-forward network to generate the output for this Transformer layer: \begin{equation} \widetilde{\mathbf{o}}^l_t = \parallel_{k=1}^{K}f_k(\mathbf{m}^{l-1},\mathbf{h}^{l-1}_t,\mathbf{s}^{c_k} ) \end{equation} \begin{equation} \mathbf{h}^l_t = \text{FeedForward}(\text{LayerNorm}(\widetilde{\mathbf{o}}^l_t)) \end{equation} where $K$ is the number of self-attention heads, and $c_k \in\{global,\ local,\ speaker,\ listener\}$ is the corresponding type of dialog-aware attention for the $k$-th attention head. \subsection{Model Training} We take the hidden state of ``\texttt{[CLS]}'' at the last layer as the final encoding of the query utterance and the historical context, and pass it through a feed-forward neural network to get the predicted emotion: \begin{equation} \mathbf{h}_t = \mathbf{h}^L_{t,0} \end{equation} \begin{equation} \mathbf{z}_t = \text{ReLU}(\mathbf{W}_h\mathbf{h}_t+\mathbf{b}_h) \end{equation} \begin{equation} P_t = \text{softmax}(\mathbf{W}_z\mathbf{z}_t+\mathbf{b}_z) \end{equation} \begin{equation} \widehat{y}_t = \text{argmax}_{k\in\mathcal{S}}(P_t[k]) \end{equation} For the training of our model, we use the standard cross-entropy loss as the loss function: \begin{equation} \mathcal{L}(\theta) = -\sum_{i=1}^{M}\sum_{t=1}^{N}P_t[y_{i,t}] \end{equation} where $M$ is the number of conversations in the training set, and $\theta$ is the collection of trainable parameters in DialogXL. \section{Experimental Settings} In this section, we present the experimental settings such as implementation details, datasets, metrics, and baselines. \subsection{Implementation Details} We initialize the proposed DialogXL by pre-trained XLNet-Base \cite{yang2019xlnet} and employ AdamW optimizer \cite{loshchilov2018fixing} during training. Hyperparameter tuning for each dataset is conducted with hold-out validation on the validation set. The tunable hyperparameters include learning rate, number of heads for the four types of attentions in dialog-aware self-attention\footnote{The sum of the four types of attention heads is always 12.}, the max length of memory\footnote{When implementing utterance recurrence in practice, the length of memory is set not to exceed a threshold due to the limit of computational resource. Once the size of memory exceeds the threshold, the earliest hidden states will be dropped. }, and the dropout rate. The results of BERT, XLNet, and DialogXL reported in our experiments are all based on the average score of 5 random runs on the test set. \subsection{Datasets} We evaluate DialogXL on four multi-turn multi-party ERC datasets. The statistics of them are shown in Table \ref{tab:statistic}. \begin{table}[t] \centering \resizebox{0.475\textwidth}{!}{ \begin{tabular}{l|c|c|c|c|c|c} \hline \multirow{2}*{Dataset} & \multicolumn{3}{|c|}{\# Conversations} &\multicolumn{3}{|c}{\# Uterrances}\\ &Train&Val&Test&Train&Val&Test\\ \hline \hline IEMOCAP&\multicolumn{2}{c|}{120}&31&\multicolumn{2}{c|}{5810}&1623\\ MELD&1038&114&280&9989&1109&2610\\ DailyDialog&11118&1000&1000&87170&8069&7740\\ EmoryNLP&713&99&85&9934&1344&1328\\ \hline \end{tabular} } \caption{The statistics of four datasets.} \label{tab:statistic} \end{table} \noindent\textbf{IEMOCAP} \cite{busso2008iemocap}: A multimodal conversational dataset for emotion recognition, with two parties included for each conversation. The emotion labels include \texttt{neutral}, \texttt{happiness}, \texttt{sadness}, \texttt{anger}, \texttt{frustrated}, and \texttt{excited}. Since this dataset has no validation set, we follow \cite{zhong2019knowledge} to use the last 20 dialogues in the training set for validation. \noindent\textbf{MELD} \cite{poria2019meld}: A multimodal dataset for emotion recognition collected from the TV show \texttt{Friends}. The emotion labels include \texttt{neutral}, \texttt{happiness}, \texttt{surprise}, \texttt{sadness}, \texttt{anger}, \texttt{disgust}, and \texttt{fear}. \noindent\textbf{DailyDialog} \cite{li2017dailydialog}: Human-written daily communications, with emotion labels including \texttt{neutral}, \texttt{happiness}, \texttt{surprise}, \texttt{sadness}, \texttt{anger}, \texttt{disgust}, and \texttt{fear}. Since it has no speaker information, we consider the utterance turns as the speaker turns by default. \noindent\textbf{EmoryNLP} \cite{zahiri2017emotion}: TV show scripts collected from \texttt{Friends}, but varies from MELD in the choice of scenes and emotion labels. The emotion labels of this dataset include \texttt{neutral}, \texttt{sad}, \texttt{mad}, \texttt{scared}, \texttt{powerful}, \texttt{peaceful}, and \texttt{joyful}. Following recent works \cite{ghosal2019dialoguegcn,zhong2019knowledge,hazarika2019emotion}, we utilize only the textual data of the above datasets for our experiments. The evaluation metrics are chosen as micro-F1 for DailyDialog\footnote{The category of neutral with significantly more samples than others are not taken into account as before.} and weighted-F1 for the other datasets. \subsection{Baseline Methods} We compare DialogXL with the following baselines: \noindent\textbf{Previous methods:} CMN\cite{hazarika2018conversational}, DialogueRNN \cite{majumder2019dialoguernn}, HiGRU\cite{jiao2019higru}, DialogueGCN\cite{ghosal2019dialoguegcn}, TL-ERC\cite{hazarika2019emotion}, and KET \cite{zhong2019knowledge}. \noindent\textbf{BERT} \cite{devlin2018bert}: The BERT baseline for ERC, initialized with the pre-trained parameters of BERT-base. We concatenate historical utterances and the query utterance in order and then feed them into BERT for classification. The hyperparameters are tuned the same as DialogXL. \noindent\textbf{XLNet} \cite{yang2019xlnet}: The XLNet baseline with the original segment recurrence and vanilla self-attention, initialized with the pre-trained parameters of XLNet-base. The hyperparameters are tuned the same as DialogXL. \section{Results and Analysis} \subsection{Overall Results} The overall results of our DialogXL and the baselines are reported in Table \ref{tab:overall}. We can clearly note that DialogXL reaches a new state of the art on all of the four datasets. Besides, we can make another two observations as follows, which help to understand the ERC task and the pros and cons of DialogXL. First, in general, there are considerable improvements for the pre-trained language models over the others on MELD, DailyDialog, and EmoryNLP. However, the improvements of DialogXL over BERT and XLNet are not significant on these datasets. After delving into the datasets, we found that the dialogues in these datasets are relatively short (mostly 5 to 9 utterances). So the current language models, BERT and XLNet, can already encode the entire historical context and the query utterance in most cases. On these short dialogues, however, the advantages of DialogXL are not shown up completely. Second, while inferior performance of BERT and XLNet is observed to the other baselines on IEMOCAP, the improvements of DialogXL over BERT and XLNet are significant. After examining the dataset, we realized the dialogues in IEMOCAP are much longer (around 70 utterances per dialog) than the other datasets. In this case, BERT and XLNet cannot encode too much historical context effectively, while such baselines as DialogueRNN and DialogueGCN can reach distant utterances and also encode other key features such as speaker information. Moreover, our DialogXL can both encode the historical context effectively by the utterance recurrence and capture the speaker information by the dialog-aware self-attention, allowing it to achieve superior performance to all the baselines. \begin{table}[t] \centering \resizebox{0.475\textwidth}{!}{ \begin{tabular}{l|cccc} \hline Model & IEMOCAP &MELD &DailyDialog &EmoryNLP\\ \hline CMN& 56.13 &- &- &-\\ DialogueRNN&62.75&57.03&- &-\\ HiGRU&59.79* & 56.92* &52.01* &31.88*\\ DialogueGCN&64.18&58.10&- &-\\ TL-ERC&59.30 &57.46* &52.46* &30.57*\\ KET&59.56 &58.18&53.37 &33.95*\\ BERT&60.98 &61.50&54.09 &34.17\\ XLNet&61.33 &61.65&53.62 &34.13\\ \hline DialogXL &\textbf{65.94}&\textbf{62.41}&\textbf{54.93}&\textbf{34.73}\\ \hline \end{tabular} } \caption{Overall performance on the four datasets. The scores marked by ``*'' is based on our re-implementation, because of the differences in evaluation metrics and data statistics between the corresponding work and ours.} \label{tab:overall} \end{table} \subsection{Effect of the Enhanced Memory} One of the contributions of DialogXL lies in the enhanced memory with utterance recurrence. Here, we study how the utterance recurrence and the maximum memory length contribute to the final results. We change the maximum memory length from 100 to 1000 with an interval of 100 and plot the test scores on IEMOCAP, which has sufficient utterances in each conversation. The memory waste rate of segment recurrence in XLNet is also plotted in terms of the percentage of paddings in memory. Since the proposed utterance recurrence has 0 memory waste in theory, its memory waste rate is not plotted. Three models are studied for this experiment: XLNet with the original segment recurrence, XLNet with utterance recurrence, and DialogXL. The results are shown in Figure \ref{fig:memory}. We can note that segment recurrence always leads to a memory waste rate of over 60\% for each different memory length. The rate drops with the memory length increases, along with the growth of the three models. When the memory length exceeds 700, their performance generally stops improving any more, which indicates that increasing the maximum memory length only contributes to the test results within a certain range. \begin{figure}[t] \centering \includegraphics[width=1\columnwidth]{memory} \caption{The results of vanilla XLNet, XLNet with utterance recurrence, and our DialogXL by different maximum memory lengths on IEMOCAP. The memory waste rate of segment recurrence in XLNet is provided for reference.} \label{fig:memory} \end{figure} \subsection{Ablation Study} In this ablation study, we analyze the impact of dialog-aware self-attention by removing each type of dialog-aware self-attention from DialogXL. The results on two representative datasets, IEMOCAP and MELD, are presented in Table \ref{tab:ablation}. We can observe that the performance of DialogXL drops on both IEMOCAP and MELD when any type of the self-attention is removed, suggesting that all these self-attentions contribute to the improvement of DialogXL. Nevertheless, their contributions can be distinguished. When speaker self-attention or listener self-attention is removed, considerable drops are observed. But when they are both removed, the drops are more obvious. This implies the importance of the inter-/intra-speaker dependency \cite{ghosal2019dialoguegcn}. Moreover, when local self-attention is removed, the F1 score drops the most on IEMOCAP, which contains long utterances (around 70) for each conversation. This indicates that the historical context near a query utterance is more important for this dataset. The drop on MELD is not as obvious as on IEMOCAP, because MELD has much shorter conversations (5 to 9 utterances per conversation). Finally, the removal of global self-attention leads to the least performance degradation. The reason could be twofold. First, global utterances are not as important as local utterances. Second, the speaker self-attention and listener self-attention already capture some useful information from distant utterances. \begin{table}[t] \centering \resizebox{0.475\textwidth}{!}{ \begin{tabular}{l|l|l} \hline \multirow{2}*{Method} & \multicolumn{2}{|c}{F1 score}\\ \cline{2-3} &IEMOCAP & MELD\\ \hline DialogXL & \textbf{65.94}& \textbf{62.41}\\ - speaker self-attention&62.30 ($\downarrow$3.64)& 61.92 ($\downarrow$0.49)\\ - listener self-attention& 62.87 ($\downarrow$3.07)& 62.03 ($\downarrow$0.38)\\ - speaker\&listener self-attention& 61.71 ($\downarrow$4.23)& 61.70 ($\downarrow$\textbf{0.71})\\ - local self-attention& 61.66 ($\downarrow$\textbf{4.28})& 61.72 ($\downarrow$0.69)\\ - global self-attention& 63.34 ($\downarrow$2.60)& 62.15 ($\downarrow$0.26)\\ \hline \end{tabular} } \caption{Results of ablation study on IEMOCAP and MELD.} \label{tab:ablation} \end{table} \begin{figure*}[t] \centering \includegraphics[width=1.9\columnwidth]{visualization} \caption{Results of error analysis, where two query utterances are provided, along with the visualization of attention weights between the current utterance at the \text{[CLS]} token and the most attended historical utterance (selected according to the highest average attention weight among all the attention heads of the last layer). The darker colors mean larger attention weights.} \label{fig:visualization} \end{figure*} \subsection{Speaker Role Embedding} Our speaker self-attention and listener self-attention model the speaker dependencies \cite{ghosal2019dialoguegcn} by directly letting the model know which part of the utterances should be attended to. Another way to let a pre-trained language model understand the speaker dependencies in dialog is speaker role embedding \cite{bao2020plato,ham2020end}, which maps each participant to a trainable embedding vector. Here, we make a simple comparison between the two approaches of embedding different parties on IEMOCAP and DailyDialog. To this end, we replace the speaker self-attention and listener self-attention of DialogXL with the speaker role embeddings, and refer to the resulting model as DialogXL-emb. The results of comparison are shown in Table \ref{tab:speker_role}. We can observe that our explicit speaker\&listencer self-attention is more effective than the speaker role embedding approach. As a result, the proposed attention mechanism can be potentially applied to other dialog tasks as well. \begin{table}[h] \centering \resizebox{0.43\textwidth}{!}{ \begin{tabular}{p{2.5cm}|p{2cm}<{\centering}|p{2cm}<{\centering}} \hline \multirow{2}*{Method} & \multicolumn{2}{c}{F1 score}\\ \cline{2-3} &IEMOCAP & DailyDialog\\ \hline DialogXL & \textbf{65.94}& \textbf{54.93}\\ DialogXL-emb&63.31 & 54.06 \\ \hline \end{tabular} } \caption{Results of comparison between direct speaker role embedding and our speaker\&listener self-attention approach on the IEMOCAP and DailyDialog datasets.} \label{tab:speker_role} \end{table} \subsection{Error Study} Although our DialogXL has a novel framework and achieves a new state of the art, we still want to figure out its possible shortcomings to motivate the future research. Therefore, we carry out an error study on IEMOCAP. In short, we found that DialogXL's powerful capability of directly capturing word-level features in the historical context can be a double-edge sword. As illustrated in Figure \ref{fig:visualization}, the word-level attention mechanism based on semantic relevance can help make a good prediction (Case \#1), but it may also lead to a mistake by focusing too much on the semantic relevance between the query utterance and historical utterances (Case \#2). As a result, it seems to be necessary to combine with other mechanisms rather than merely relying on the popular attention to carry out the emotion recognition in dialogues. Besides, we also observe from our bad cases that some of them are mentioned in previous works, such as emotional shifts (i.e., the emotion labels of two consecutive utterances from a same speaker are different) \cite{hazarika2018conversational, majumder2019dialoguernn}. Roughly, our model commits mistakes for 45\% of these cases, which calls for further investigations. \section{Conclusion} In this paper, we proposed an all-in-one XLNet model, namely DialogXL, for emotion recognition in conversation (ERC). To model the multi-turn multi-party conversational data, DialogXL contributes two improvements on the basis of XLNet and Transformer-XL. First, an enhanced memory was introduced to replace XLNet's vanilla memory to store historical contexts more effectively. Second, a dialog-aware self-attention mechanism was proposed to deal with the multi-turn multi-party data structures. Extensive experiments were conducted on four ERC benchmarks and the results show that the proposed model outperforms all the baselines on the datasets. The effectiveness of the two improvements is also confirmed by extensive analyses. Furthermore, we have the following three findings. First, the original segment recurrence mechanism stores more than 60\% paddings in memory, making it ineffective to encode the historical contexts for ERC. Second, the traditional speaker role embedding strategy is not as effective as our speaker\&listener self-attention, which could also be applied to other dialog tasks. Finally, an error analysis reveals that merely relying on the attention mechanism may mislead the model. \section{Acknowledgments} The paper was supported by the Fundamental Research Funds for the Central Universities (No.19lgpy220) and the Program for Guangdong Introducing Innovative and Entrepreneurial Teams (No.2017ZT07X355). This work was also supported by MindSpore.
{'timestamp': '2020-12-17T02:06:59', 'yymm': '2012', 'arxiv_id': '2012.08695', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08695'}
arxiv
\section{Introduction} \subsection{Background and Motivations} Recent years have witnessed the rapid development of large-scale distributed machine learning, which well reconciles the massive computation tasks and the limited computation power of a single worker's machine. Many workers (e.g., using servers, laptops, or even smartphones) can locally conduct model training based on assigned training data, and they feed back the computation results to the platform to complete a larger machine learning task. However, the performance of large-scale distributed machine learning systems can be significantly affected by bottlenecks like straggling workers which finish computation much slower than other workers \cite{dean2013tail}. A promising solution to effectively alleviate straggler bottlenecks is to use coding techniques to create proper computation redundancy \cite{lee2017speeding}. The key idea of coded machine learning is to properly encode the data to be used for the workers' computation subtasks, such that the platform only needs the computation results from a subset $k$ workers among a total of $n$ workers who are assigned the subtasks, in order to complete the overall computation task. Hence, the fastest subset of workers will determine the overall runtime of the distributed machine learning. The minimum number of workers that the platform needs to wait for (i.e., $k$) is called \emph{recovery threshold}, which depends on the code design and subtask assignment. \begin{figure}[tbp] \centering \subfigure[Encoding and assignment]{ \begin{minipage}[t]{0.42\linewidth} \centering \includegraphics[width=1.2 in]{cc7} \label{fig0} \end{minipage}} \subfigure[Computing and decoding]{ \begin{minipage}[t]{0.54\linewidth} \centering \includegraphics[width=1.8 in]{cc8} \label{fig1} \end{minipage}} \caption{Illustration of coded machine learning using $(n=3, k=2)$-MDS codes, which can recover the final computation result from only two (out of three) workers' computation results.} \label{cc} \vspace{-6mm} \end{figure} Fig.~\ref{cc} shows an illustrative example of coded machine learning, where we consider a system with one platform and $n=3$ workers. The platform wants to compute a matrix-vector multiplication $\mathbf{y}=\mathbf{A} \mathbf{x}$ using $(n=3, k=2)$-MDS codes. \begin{itemize} \item \emph{Encoding and assignment:} First, the platform splits matrix $\mathbf{A}\in \mathbb{R}^{r \times s}$ equally into two matrices $\mathbf{A}_1 \in \mathbb{R}^{\frac{r}{2} \times s}$ and $\mathbf{A}_2\in \mathbb{R}^{\frac{r}{2} \times s}$. Then, the platform assigns matrix $\mathbf{A}_1$ to worker 1, $\mathbf{A}_2$ to worker 2, and $\mathbf{A}_1+\mathbf{A}_2$ to worker 3. The platform also broadcasts the input vector $\mathbf{x}$ to the three workers. \item \emph{Computing and decoding:} The three workers will compute subtasks $\mathbf{y}_{1}=\mathbf{A}_{1} \mathbf{x}$, $\mathbf{y}_{2}=\mathbf{A}_{2} \mathbf{x}$, and $\mathbf{y}_{3}=(\mathbf{A}_{1}+\mathbf{A}_{2}) \mathbf{x}$ in parallel, respectively, and return the results to the platform as soon as each worker finishes his own computation. The platform is able to obtain the intended outcome $\mathbf{A} \mathbf{x}$ as long as he receives any $k=2$ workers' results. For example, if worker 1 is the straggling worker which finishes the computation subtask the last, the platform can simply obtain the intended outcome from workers 2 and 3, i.e., $\mathbf{y}=\left[\mathbf{y}_{3}-\mathbf{y}_{2} ; \mathbf{y}_{2}\right]=\left[\mathbf{A}_{1} \mathbf{x}; \mathbf{A}_{2} \mathbf{x}\right]=\mathbf{A} \mathbf{x}$. \end{itemize} However, given significant runtime saving using codes, it may not be realistic that workers are willing to participate in coded machine learning without proper incentives, as workers are selfish and incur costs during the computation \cite{duan2012incentive}. For example, a worker needs to postpone his own background task for running the platform's assigned task, which translates to time costs locally. There are a few challenges in incentivizing workers' participation. First, it is challenging for the platform to incentivize only the desirable workers to participate in coded machine learning, as the platform may not know workers' computation costs and computation time. Appropriate incentives should be sufficient to cover the costs of desirable workers and be based on workers' computation time performance. The computation costs can be workers' private valuation information, which may not be easily accessed by the platform due to workers' privacy concerns. The worker's computation time depends on many factors such as computation power as well as the unpredictable and unreliable computation infrastructure, hence it may not be even accurately known by the worker himself, not to mention the platform \cite{yang2019timely}. The joint consideration of private information and stochastic information is a key feature of our model, which differs from many incentive mechanism design problems where there is only private and accurate information (to the workers) (e.g., \cite{ningwiopt,ma2018incentivizing}). This will lead to the first key question of this paper: \begin{question} How to incentivize heterogeneous workers with private cost information and stochastic computation time to participate in coded machine learning? \end{question} Second, it is under-explored of the impact of workers' private information on the platform's incentive mechanism design and cost. In the presence of workers' private information, the platform may obtain more information through market research. Different levels of information asymmetry require the platform to design different optimal incentive mechanisms and thus make the platform obtain different costs. It is under-explored how much cost savings the platform can obtain if he has more information about workers. This motivates us to ask the second key question in this paper: \begin{question} What is the impact of platform's incomplete information about workers on the platform's incentive mechanism and cost, compared with complete information? \end{question} Third, the platform needs to optimize the load assignment and recovery threshold, which will affect the determination of incentives as well as the performance of coded machine learning. If the recovery threshold is too small, the load of each worker becomes so large that the overall runtime will eventually increase. If the recovery threshold is too large, the redundancy may not be sufficient to mitigate the effect of straggling workers. This leads to the third key question of this paper: \begin{question} How should the platform design the load assignment and recovery threshold for the incentivized workers? \end{question} \subsection{Contributions} We summarize our key novelty and contributions below. \begin{itemize} \item \emph{Incentive mechanisms for coded machine learning:} To the best of our knowledge, this is the first analytical work to study economic incentives in coded machine learning. The incentive issue determines whether coded machine learning can be implemented with enough workers' participation. \item \emph{Easy-to-implement incentive mechanisms for heterogeneous workers:} We perform the analysis considering workers' multi-dimensional heterogeneity in computation costs and performances under incomplete information and stochastic information. As a result, searching the target incentivized workers among $M$-many types of workers would require large-scale computation. We manage to summarize workers’ multi-dimensional heterogeneity into a one-dimensional metric to guide the platform's worker selection under incomplete information. Such a metric reduces the computation complexity from $\mathcal{O}(2^M)$ to $\mathcal{O}(M)$. We only need to set the recovery threshold linearly proportional to the total participator number when using MDS codes, which is easy to implement. \item \emph{Impact of incomplete information for mechanism design:} We show that the platform may give smaller rewards to the workers with efficient computation performances, compared with workers with poor performances under complete information. However, the platform gives larger rewards to the workers with efficient computation performances under incomplete information. These reward-performance relationships are independent of the workers' distribution in each type. We also show that the platform's increased cost due to incomplete information disappears when worker number is sufficiently large, but it does not monotonically decrease in worker number. \end{itemize} \vspace{-1.5mm} \subsection{Related Work} \vspace{-0.5mm} \label{literature} Most literature about coded machine learning focused on designing coding schemes to mitigate stragglers and improve efficiency in distributed computation, e.g., MDS codes \cite{lee2017speeding}, short-dot codes \cite{dutta2016short}, polynomial codes \cite{yu2017polynomial}, and s-diagonal codes \cite{wang2019computation}. These studies usually focused on the matrix computation tasks such as matrix-vector multiplication (e.g., \cite{reisizadeh2017latency}), matrix-matrix multiplication (e.g., \cite{lee2017high}), and large-sparsity matrix computation (e.g., \cite{suh2017matrix}). Moreover, a few studies further considered the secure coded computation problem (e.g., \cite{bitar2017minimizing}) and the computation performance heterogeneity of workers (e.g., \cite{reisizadeh2019coded}). However, existing studies make an optimistic assumption that workers are willing to participate in coded machine learning, which may not be realistic without proper incentives to the workers. To the best of our knowledge, this paper is the first attempt that analytically studies the platform's incentive mechanism design in coded machine learning. The rest of the paper is organized as follows. The system model is described in Section \ref{model}. We study the platform's incentive mechanisms under complete information and incomplete information in Sections \ref{complete} and \ref{incomple}, respectively. We perform simulations in Section \ref{simulation} and conclude in Section \ref{conclusion}. \section{System Model and Preliminaries } \label{model} We consider a distributed coded machine learning system involving a platform and $N$ workers. In the following, we will first introduce the platform's task coding and load assignment as well as workers' heterogeneity, and then specify the information scenarios, and finally formulate the Stackelberg game between workers and the platform. \subsection{Platform Modeling: Task Coding and Load Assignment } \label{2a} In this subsection, we introduce how the platform encodes the original task and assigns coded subtasks to workers. This paper focuses on matrix-vector multiplication tasks in the widely adopted problems such as gradient descent-based algorithms, logistic regression, and reinforcement learning (e.g. \cite{reisizadeh2019coded,reisizadeh2017latency})\footnote{Note that our analysis and insights can be easily applied to matrix-matrix multiplications (which can be decomposed to several matrix-vector multiplications) and other machine learning tasks as long as we can specify the relationship between workers' computation loads and computation time.}. Given a data matrix $\mathbf{A} \in \mathbb{R}^{r \times s}$, the platform wants to compute the task $\mathbf{y}=\mathbf{A} \mathbf{x}$ for an input vector $\mathbf{x} \in \mathbb{R}^{s}$. Regarding the task coding, we use linear combinations of the $r$ rows of the matrix $\mathbf{A}$ to generate the computation redundancy, such that the platform can recover the result $\mathbf{Ax}$ as soon as receiving any $r$ inner products from the workers. We take $(n, k)$-MDS codes as an example. If the task is distributed across $n$ workers, for any $ k \in \{1,...,n\}$, the platform first divides matrix $\mathbf{A}$ into $k$ equal-sized submatrices in $\mathbb{R}^{\frac{r}{k} \times s}$. Then, by applying an $(n, k)$-MDS code, the platform obtains $n$ encoded submatrices with unchanged size ${\frac{r}{k} \times s}$, one for each worker. Upon receiving any $k$ workers' results, the platform can decode the result of the original task. The \emph {computation load} of a worker's subtask is defined as the number of inner products of assigned coded rows of $\mathbf{A}$ with $\mathbf{x}$. If worker $i$ is assigned a matrix-vector multiplication with matrix size $\ell_{i}\times s$, his computation load is $\ell_{i}$. In the example of $(n, k)$-MDS codes, each worker has the same computation load $\ell={r}/{k}$. Given the computation task, the platform needs to assign appropriate subtasks for heterogeneous workers. \subsection{Worker Modeling: Heterogeneous Costs and Performances} We consider a population of $N$ workers in the coded machine learning system, with heterogeneous computation performances and costs as modeled below. \subsubsection{Computation Performances} We consider a 2-parameter shifted exponential distribution for the computation time of each worker, which is widely used in literature (e.g., \cite{reisizadeh2019coded,reisizadeh2017latency}) because of the good approximation to the experiment statistics. After being assigned $\ell_i$ rows of the matrix-vector multiplication, worker $i\in \{1,...N\}$ will finish the computation subtask in time $T_i$, which is a random variable with the following cumulative distribution function (CDF): \begin{equation} \label{dist} \begin{split} \operatorname{Pr}\left(T_{i} \leq t\right)=&1-e^{-{\mu_i}\left(\frac{t}{\ell_i}-a_i\right)}, \forall t \ge a_i\ell_i, \end{split} \end{equation} where parameter $\mu_i > 0$ is worker $i$'s average computation speed and parameter $a_i>0$ tells worker $i$'s start-up time to begin the computation. Equation \eqref{dist} shows that a worker with a larger $\mu_i$, a smaller $a_i$, or a smaller $\ell_{i}$ is more likely to finish his computation earlier. We consider that each worker's computation time distribution in \eqref{dist} (including the form as well as parameters $\mu_i$ and $a_i$) is known by the platform and other workers in this paper. However, its realized value is unknown to both the platform and the worker himself ahead of time, due to computing resources' unpredictable noise nature\footnote{The joint consideration of heterogeneous stochastic information and the private information (i.e., computation costs to be introduced below) is a key feature of our model. It differs from many incentive mechanism design papers for networking problems, where the workers have no information uncertainty regarding their own costs or performances (e.g., \cite{ningwiopt,ma2018incentivizing}).}. A worker will return the computation results to the platform as soon as he finishes his computation. Thus, each worker's realized computation performance is known to the platform after computation. \subsubsection{Computation Costs} The computation may lead to many costs, such as time cost, energy consumption, and the potential negative impact to other applications. We focus on the time cost in this paper, as the commodity servers usually charge workers on time (e.g. Amazon EC2 \cite{ec2}). We consider each worker $i$'s computation cost as $c_i$ per unit time of computation. \subsubsection{Worker Types} Given workers' multi-dimensional heterogeneity in computation performances and costs, we introduce \emph{worker type} to classify the large number of workers. Workers are distinguished by the cost, average computation speed, and the start-up computation time. We call a worker with $(c_m, \mu_m,a_m)$ as a type-$m$ worker. All $N$ workers belong to a set $\mathcal{M}=\{1,2,...,M\}$ of $M$ types. Each type $m\in \mathcal{M}$ has $N_m$ workers, with $\sum_{m=1}^{M}N_m=N$. We will see later in Section \ref{s1} that workers' three-dimensional heterogeneity greatly increases the complexity and difficulty of platform's incentive mechanism design. \vspace{-2mm} \subsection{Information Scenarios} \vspace{-1mm} To study the impact of incomplete information, we will perform the analysis in different information scenarios. As for workers' computation time, the platform only knows each worker's computation time distribution (i.e., $\mu$ and $a$). Regarding workers' computation costs, we will consider two information cases in the following: \vspace{-1mm} \begin{enumerate} \item \emph{Complete information (benchmark)}: The platform knows each worker's computation cost $c$ (and thus his type). This may not be easy for the platform to achieve, but it provides the platform's minimum cost in all information cases for comparison. \item \emph{Incomplete information}: The platform knows the total number of workers $N$ and the specific number of each worker type $\{N_m\}_{m\in\mathcal{M}}$, but does not know each worker's computation cost $c$ (and thus his type). \end{enumerate} \vspace{-1mm} Workers always have incomplete information about each other's costs but know the computation time distributions. \vspace{-2mm} \subsection{Two-Stage Stackelberg Game Formulation} \vspace{-1mm} In this subsection, we specify the strategies, payoffs, as well as costs of the platform and workers. \subsubsection{Strategies of Platform and Workers } As shown in Fig.~\ref{fig16}, we model the decision making of workers and the platform before the computation as a two-stage Stackelberg game. \begin{itemize} \item In Stage I, the platform announces the set of targeted worker types $\mathcal{S}\subseteq \mathcal{M}$, the computation loads in each computation round $\boldsymbol{\ell}\triangleq \{\ell_{m}\}_{m\in \mathcal{S}}$, and the rewards in each round $\{p_m^j\}_{m\in \mathcal{M},j\in \{1,...,k\}}$, where $p_m^j$ is the reward for a type-$m$ worker being the $j$-th to finish the computation. Thus, $p_m\triangleq\sum_{j=1}^{k}Pr_m^jp_m^j$ is the expected reward for a type-$m$ worker in each round, where $Pr_m^j$ is the probability of a type-$m$ worker being the $j$-th to finish the computation\footnote{The platform and workers know the participating worker types (i.e., targeted types in $\mathcal{S}$), the worker number of each type $N_m$, and workers' computation time distributions in \eqref{dist} under both complete and incomplete information, so both the platform and workers can derive $Pr_m^j$.}. Equivalently, the platform actually determines the expected rewards for workers $\boldsymbol{p }\triangleq \{p_m\}_{m\in \mathcal{M}}$. \item In Stage II, after knowing the platform's decisions, each worker decides whether to participate and what type to report (which may not be his true type), as the platform will give rewards based on workers' realized performances and their reported types after the computation. \end{itemize} The coded machine learning applies to multiple computation rounds (e.g. in gradient descent problem). In each round of computation, once the platform receives a decodable subset of computation results (i.e., $r$ inner products), the platform will inform other workers to stop the computation without any waste \cite{aktas2017effective}. After each round's computation, the platform rewards workers as announced in Stage I \begin{figure}[tbp] \centering \includegraphics[width=1\linewidth]{game6} \vspace{-5mm} \caption{Workflow of coded machine learning with incentives: the platform and workers reach an agreement by playing a Stackelberg game before computation, workers perform each round's computation, and the platform rewards workers after each round's computation.} \label{fig16} \vspace{-5mm} \end{figure} Note that the number of participating workers $n=N^{(\mathcal{S})}\triangleq\sum_{m \in \mathcal{S}}N_m$ is controlled by the incentive mechanism, and the recovery threshold $k$ depends on the load assignment as illustrated in Section \ref{2a}. \subsubsection{Workers' Payoff} Due to the randomness of the computation time, each worker can only maximize his expected payoff. Each worker's expected payoff in each round is the difference between his expected reward and expected computation cost. If a type-$m$ worker optimally reports/misreports himself as type $\tilde{m}$, his expected reward in each round is $p_{\tilde{m}}$. In each round, all workers' expected spent time is the expected overall runtime denoted by $\mathbb{E}[T]$. Note that even if a worker finishes earlier in a particular round, he needs to wait some random time for the rest of workers to finish and cannot turn to any other job, resulting in the same time occupation for all the workers. Thus, a type-$m$ worker's expected computation cost is $c_m\mathbb{E}[T ]$. In summary, if a type-$m$ worker participates and reports himself as type $\tilde{m}$, his expected payoff in each round is: \begin{equation} \label{uhet} \begin{split} &\mathbb{E}[U (c_m,\mu_m,a_m,{\tilde{m} })]=p_{\tilde{m}}-c_m\mathbb{E}[T ].\\ \end{split} \end{equation} Workers can manipulate his type reporting to achieve the maximum payoff. Each worker will participate in the computation once he expects a non-negative payoff in \eqref{uhet}. \subsubsection{Platform's Cost} The platform's expected cost objective in each round involves the overall runtime and total payment to targeted workers. If the platform considers workers' incentive compatibility in designing the incentives (as guaranteed in Section \ref{incomple}), all workers will truthfully report their types and the platform's expected cost in each round is \begin{equation} \label{whet} \begin{split} &\mathbb{E}[W (\boldsymbol{p },\mathcal{S},\boldsymbol{\ell })] =\gamma_1\mathbb{E}[T ]+\gamma_2\sum_{m\in \mathcal{S}}N_mp_m,\\ \end{split} \end{equation} where term $\mathbb{E}[T ]$ is the expected overall runtime and term $\sum_{m\in \mathcal{S}}N_mp_m$ is the expected total payment to targeted worker types in set $\mathcal{S}$. Terms $\gamma_1$ and $\gamma_2$ indicate the platform's valuations on expected overall runtime and expected payment, respectively. \begin{table}[tbp] \caption{Key Notations} \vspace{-4.5mm} \begin{center} \begin{tabular}{|c|c|} \hline $N$ & Number of workers \\ \hline $M$ & Number of worker types \\ \hline $r$ & Number of rows of matrix $\mathbf{A}$ or simply total workload \\ \hline $\mu_m$ & Average computation speed of type-$m$ workers \\ \hline $a_m$ & Start-up time of type-$m$ workers\\ \hline $c_m$ & Unit cost of type-$m$ workers\\ \hline $p_m$& Expected reward for a type-$m$ worker\\ \hline $\ell_m$ & Computation load in term of rows for a type-$m$ worker\\ \hline $\mathcal{S}$ & Set of worker types that platform targets at\\ \hline $N^{(\mathcal{S})}$ & Number of participating workers \\ \hline $T_i$& Worker $i$'s random computation time\\ \hline $\mathbb{E}[T]$ & Expected overall runtime\\ \hline \end{tabular \label{tablit} \vspace{-5mm} \end{center} \end{table} \begin{table}[tbp] \caption{Information Scenarios} \vspace{-4.5mm} \begin{center} \begin{tabular}{|c|c|c|} \hline \textbf{ Scenarios}&\textbf{Worker heterogeneity} & \textbf{Platform's knowledge} \\ \hline Complete-Hetero & \tabincell{c}{Computation costs \\ and performances } & \tabincell{c}{Costs and computation\\ time distributions} \\ \hline Incomplete-Hetero & \tabincell{c}{Computation costs\\ and performances} & \tabincell{c}{ Computation \\time distributions}\\ \hline \tabincell{c}{Incomplete-\\HeteCostOnly} & Computation costs& \tabincell{c}{ Computation \\time distribution} \\ \hline \end{tabular \label{sce} \vspace{-6mm} \end{center} \end{table} For ease of reading, we list the key notations in Table \ref{tablit} and all information scenarios that we will study in Table \ref{sce}. In the following, we will study the platform's incentive mechanism design under complete information (i.e., ``Complete-Hetero'' scenario) in Section \ref{complete} and that under incomplete information (i.e., ``Incomplete-Hetero'' scenario) in Section \ref{hetero}. Moreover, we will consider a special case with workers' heterogeneity only in costs (i.e., ``Incomplete-HeteCostOnly'' scenario) in Section \ref{homo} to further explore the optimal load assignment and recovery threshold in coded machine learning with incentives. \section{Incentive Mechanism Design under Complete Information} \label{complete} In this section, we study the platform's optimal incentive mechanism under the assumption that the platform knows each worker's type (i.e., ``Complete-Hetero'' scenario). Although complete information may not be practical for the platform to achieve, it serves as a benchmark for later comparison with incomplete information. \subsection{Computation Load Assignment and Overall Runtime} We first present the load assignment scheme and compute the corresponding overall runtime. With workers' heterogeneous computation performances, assigning equal loads to all workers (e.g., in the MDS coding scheme) is clearly not optimal. It is challenging to compute the optimal load assignment in this case, because the expected overall runtime objective is difficult to derive under nonuniform load assignment due to uncertain order of finish workers and workers' heterogeneous computation time distributions. To simplify the analysis, we apply asymptotic analysis as the number of workers goes to infinity, similar to \cite{reisizadeh2019coded} which focuses on minimizing the expected overall runtime. The asymptotically optimal load assignment and the corresponding expected overall runtime are given in Lemma \ref{lm1}: \begin{lemma} \label{lm1} When worker number goes to infinity, the following computation loads minimize the expected overall runtime: \begin{equation} \label{4} \begin{aligned} \ell_{m} &=\frac{r}{ \lambda_{m}\sum_{m\in \mathcal{S}} N_m\frac{\mu_{m}}{1+\mu_{m} \lambda_{m}}},\forall m\in \mathcal{S}, \end{aligned} \end{equation} where $\lambda_{m}$ is the unique positive solution to $e^{\mu_{m} (\lambda_{m}-a_{m})}=\mu_{m} \lambda_{m}+1$. The expected overall runtime under scheme \eqref{4} is \begin{equation} \label{time1} \mathbb{E}[T]=\frac{r}{\sum_{m\in \mathcal{S}} N_m\frac{\mu_{m}}{1+\mu_{m} \lambda_{m}}}. \end{equation} \end{lemma} Proof of Lemma \ref{lm1} is given in Appendix I of the technical report \cite{appen1}. Term $\lambda_{m}$ is introduced for representing the closed form of the minimum point. The $1/\lambda_{m}$ indicates the computation performance of type-$m$ workers, as $\frac{\partial\lambda_{m}}{\partial\mu_{m}}\le 0$ and $\frac{\partial\lambda_{m}}{\partial a_{m}}\ge 0$. We assign a larger computation load to a worker with better computation performance. The assignment scheme \eqref{4} can be viewed as an approximation of the finite $N$ case with approximation error $o(1)$ and is applicable to both ''Complete-Hetero'' and ''Incomplete-Hetero'' scenarios. Next, we use backward induction to study workers' decisions in Stage II and the platform's strategies in Stage I. \subsection{Workers' Participation Decisions in Stage II} Based on the load assignment in \eqref{4}, the rewards, and the targeted worker type set $\mathcal{S}$ announced to workers by the platform, each worker decides whether to participate in the computation. Note that here the platform knows each worker's type under complete information, so workers cannot misreport their types. According to \eqref{uhet} and \eqref{time1}, a type-$m$ worker's expected payoff when truthfully reporting (i.e., $\tilde{m}=m$) and handling the assigned load $\ell_m$ in \eqref{4} is: \begin{equation} \label{7} \begin{split} \mathbb{E}[U (c_m,\mu_m,a_m,m)]=p_m-{c}_m\frac{r}{\sum_{m\in \mathcal{S}} N_m\frac{\mu_{m}}{1+\mu_{m} \lambda_{m}}}. \end{split} \end{equation} Each worker locally decides to participate as long as he obtains a non-negative expected payoff in \eqref{7}. \subsection{Platform's Worker Selection and Rewards in Stage I} \label{s1} Considering workers' decisions, the platform determines the targeted worker type set and the rewards for workers in Stage I, by balancing workers' computation performances and costs. \subsubsection{Problem Formulation} According to \eqref{whet} and \eqref{time1}, the platform's expected cost objective is \begin{equation} \label{8} \begin{split} \mathbb{E}[W (\boldsymbol{p },\mathcal{S})]=\gamma_1\frac{r}{\sum_{m\in \mathcal{S}} N_m\frac{\mu_{m}}{1+\mu_{m} \lambda_{m}}}+\gamma_2\sum_{m \in \mathcal{S}}N_mp_m.\\ \end{split} \end{equation} Under complete information, the platform only needs to ensure that targeted workers obtain non-negative payoff \eqref{7}, i.e., satisfy Individual Rationality (IR) constraints as below: \begin{defn}[Individual Rationality] The incentive mechanism is individually rational if each targeted type-$m\in \mathcal{S}$ worker receives a non-negative payoff by accepting the expected reward $ {p_m }$ intended for his type, i.e., \begin{equation} \label{9} \mathbb{E}[U (c_m,\mu_m,a_m,m)]\ge 0, \forall m \in \mathcal{S}. \end{equation} \end{defn} The optimization problem of the platform in the ``Complete-Hetero'' scenario is formally given below. \begin{problem}[Complete-Hetero] \label{c} \begin{equation*} \begin{split} \min \quad&\mathbb{E}[W (\boldsymbol{p },\mathcal{S})]\\ s.t.\quad &\mathbb{E}[U (c_m,\mu_m,a_m,m)]\ge 0, \forall m \in \mathcal{S}\\ var. \quad & {\boldsymbol{p }\in [0,\infty)^M,\mathcal{S}\subseteq\mathcal{M}}\\ \end{split} \end{equation*} \end{problem} To minimize the cost objective, the platform sets each targeted worker's expected reward just enough to cover his expected cost, i.e., $\mathbb{E}[U (c_m,\mu_m,a_m,m)]= 0, \forall m \in \mathcal{S}$. By substituting the derived $p_m$ into \eqref{8}, we can simplify Problem \ref{c} to only choose the optimal worker types to target as follows. \begin{problem}[Worker Selection under Complete Information] \label{aa} \begin{equation*} \begin{split} \min_{\mathcal{S}\subseteq \mathcal{M}}\left(\gamma_1+\gamma_2\sum_{m\in \mathcal{S}}N_m{c}_m\right)\frac{r}{\sum_{m\in \mathcal{S}} N_m\frac{\mu_{m}}{1+\mu_{m} \lambda_{m}}}.\\ \end{split} \end{equation*} \end{problem} Problem \ref{aa} is a combinatorial optimization problem and should be solved by balancing workers' computation performances and costs. It is challenging to directly find the optimal subset of workers given three-dimensional heterogeneity (i.e., $\mu_m$, $a_m$, and $c_m$), which in general requires combinatorial search over all $\sum_{n=1}^{M}C_M^n=2^M-1$ possible subsets of worker types. The complexity is $\mathcal{O}(2^M)$, which is infeasible for a large number of worker types. Alternatively, we will explore to summarize the multi-dimensional heterogeneity as a single metric to guide the platform's worker selection in linear complexity. \subsubsection{Optimal Solution} We will use two steps to summarize the three-dimensional heterogeneity (i.e., $\mu_m$, $a_m$, and $c_m$) into a one-dimensional metric. We first summarize the two-dimensional heterogeneity of workers' performances (i.e., $\mu_m$ and $a_m$) as \begin{equation} \phi_m\triangleq\frac{\mu_{m}}{1+\mu_{m} \lambda_{m}}. \end{equation} The $\phi_m$ can represent type-$m$ workers' computation performance as it increases in average speed $\mu_m$ and decreases in start-up time $a_m$ (as $\lambda_{m}$ decreases in $\mu_m$ and increases in $a_m$). We further summarize the cost $c_m$ and the performance $\phi_m$ as \begin{equation} \Omega_m \triangleq \frac{c_m}{\phi_m}. \end{equation} The $\Omega_m$ is type-$m$ workers' \emph{cost-performance ratio}. Without loss of generality, we assume increasing cost-performance ratios among all the $M$ worker types: $\Omega_1\le ...\le \Omega_M$. The following Theorem \ref{thmc} shows how the one-dimensional metric $\Omega$ guides the platform's selection in the presence of workers' three-dimensional information. \begin{theorem} \label{thmc} In the ``Complete-Hetero'' scenario, there exists a threshold type $n^{ComHet}$, \begin{equation} \label{12} n^{ComHet}\hspace{-1mm} = \hspace{-1mm} \max\left\{n|n\in \mathcal{M},\frac{c_n}{\phi_n}\le \frac{\gamma_1+\gamma_2\sum_{m=1}^{n}N_mc_m}{\gamma_2\sum_{m=1}^{n}N_m\frac{\mu_{m}}{1+\mu_{m} \lambda_{m}}}\right\}, \end{equation} such that it is optimal for the platform to induce the participation of worker types in the following targeted set $\mathcal{S}^{ComHet}$: \begin{equation} \begin{split} \mathcal{S}^{ComHet} =\{n|n\in \mathcal{M},n\leq n^{ComHet}\}.\\ \end{split} \end{equation} The optimal expected reward for a type-$m$ worker is \begin{equation} \begin{cases} &\hspace{-3mm}p_m^{ComHet}={c}_m\frac{r}{\sum_{m\in \mathcal{S}^{ComHet} } N_m\frac{\mu_{m}}{1+\mu_{m} \lambda_{m}}}, \; \forall m \in \mathcal{S}^{ComHet} ,\\ &\hspace{-3mm}p_m^{ComHet}=0, \;\forall m \notin \mathcal{S}^{ComHet} . \end{cases} \end{equation} \end{theorem} \begin{figure}[tbp] \centering \includegraphics[width=0.5\linewidth]{thresholdomega} \vspace{-2.5mm} \caption{Illustration of $\mathcal{S}^{ComHet}$ in ``Complete-Hetero'' scenario.} \label{figb} \vspace{-5mm} \end{figure} Proof of Theorem \ref{thmc} is given in Appendix II of the technical report \cite{appen1}. As illustrated in Fig.~\ref{figb}, Theorem \ref{thmc} shows that with workers multi-dimensional heterogeneity in computation performances and costs, the platform will incentivize the worker types with a small cost-performance ratio under complete information. In other words, the platform has a trade-off between workers' computation performances and computation costs. The platform can tolerate a larger cost $c_m$ when the computation performance is better (i.e., faster average computation speed $\mu_m$ or less start-up time $a_m$). For the worker types that the platform chooses to incentivize (i.e., types in $\mathcal{S}^{ComHet} $), the platform precisely makes the expected rewards just enough to compensate for each worker's expected computation cost under complete information. For the worker types out of targeted set $\mathcal{S}^{ComHet} $, the platform will not incentivize them by setting a zero expected reward. We will see in next section that it is impossible for the platform to make all participating workers obtain a zero expected payoff under incomplete information, unless he only targets one type. Moreover, we have the following remark about the complexity of this easy-to-implement approach. \begin{remark} The platform can compute $\mathcal{S}^{ComHet}$ with a linear complexity $\mathcal{O}(M)$, which is much more efficient than $\mathcal{O}(2^M)$. \end{remark} The complete information scenario servers as a benchmark to help understand the more realistic case of incomplete information scenario, which we will study in next section. \section{Incentive Mechanism Design under Incomplete Information} \label{incomple} In this section, we study the optimal incentive mechanism in the more realistic incomplete information scenario. Moreover, we will look at a special case where workers have homogeneous computation time distribution (e.g., under the same equipment or configuration) but still different costs in Section \ref{homo}, to further study the optimal load assignment and recovery threshold under incentives. \subsection{Workers' Heterogeneity in Both Performances and Costs} \label{hetero} In this subsection, we focus on the general ''Incomplete-Hetero'' scenario where workers' heterogeneity lies in both computation performances and computation costs, i.e., workers have different $\mu_{i}$, $a_i$, and $c_i$. The platform does not know each worker's marginal cost, but he knows what types there are, the number of each worker type, and each worker's computation time distribution. \subsubsection{Workers' Participation Decisions in Stage II} Based on the load assignment in \eqref{4}, the rewards, and the targeted worker type set $\mathcal{S}$ announced to workers by the platform, each worker decides whether to participate and (if yes) which type to report\footnote{When a worker decides to participate, he can only choose to report a type that is within the targeted worker type set announced by the platform.}. According to \eqref{uhet} and \eqref{time1}, if a type-$m$ worker participates and reports his type as $\tilde{m}$, his expected payoff in this case is\footnote{Note that misreport will not affect the expected overall runtime. After task coding, the number of subtasks for workers is fixed, and the platform knows workers' $\mu$ and $a$ which cannot be misreported. Thus, under incomplete information, even if some workers with types not in $\mathcal{S}$ want to participate through misreporting their cost types, the number of workers who can perform the computation and these workers' computation performances will not change. }: \begin{equation} \label{18} \begin{split} \mathbb{E}[U (c_m,\mu_m,a_m,\tilde{m})]\hspace{-1mm}=p_{\tilde{m}}-{c}_m\frac{r}{\sum_{m\in \mathcal{S}} N_m\frac{\mu_{m}}{1+\mu_{m} \lambda_{m}}}. \end{split} \end{equation} If a worker does not participate, his expected payoff is 0. Each worker will participate as long as he can obtain a non-negative payoff, and he will report the type which maximizes his expected payoff to the platform. Thus, a type-$m \in \mathcal{M}$ worker's optimal reported type (if he participates) is \begin{equation} \label{17} \tilde{m}^*=\arg\max_{\tilde{m}}\mathbb{E}[U (c_m,\mu_m,a_m,\tilde{m})], \end{equation} and a type-$m \in \mathcal{M}$ worker's optimal participation decision is \begin{equation} \label{18a} \begin{cases} &\mathrm{Participate, \hspace{7.5mm}if }\;\mathbb{E}[U (c_m,\mu_m,a_m,\tilde{m}^*)]\ge 0,\\ &\mathrm{Not \; participate,\; if }\;\mathbb{E}[U (c_m,\mu_m,a_m,\tilde{m}^*)]< 0.\\ \end{cases} \end{equation} \subsubsection{Platform's Strategies in Stage I} Taking workers' decisions into consideration, the platform determines the optimal targeted worker type set and the optimal rewards for workers. Since the platform does not know each worker's type, the platform needs to ensure a non-negative payoff for each targeted worker type and make sure that all workers do not misreport their cost types\footnote{Revelation principle demonstrates that if a social choice function can be implemented by an arbitrary mechanism, then the same function can be implemented by an incentive-compatible-direct-mechanism (i.e. in which workers truthfully report types) with the same equilibrium outcome. Thus, requiring IC will simplify the mechanism design without affecting the optimality.}. In other words, except for the IR constraints, the platform has to make decisions under the Incentive Compatibility (IC) constraints: \begin{defn}[Incentive Compatibility] Then incentive mechanism is incentive compatible if each type-$m\in \mathcal{M}$ worker maximizes his own payoff by truthfully reporting his type, i.e., \begin{equation} \label{IC} \mathbb{E}[U (c_m,\mu_m,a_m,m)] \ge \mathbb{E}[U (c_m,\mu_m,a_m,{\tilde{m} })], \forall m, \tilde{m} \in \hspace{-0.6mm} \mathcal{M}. \end{equation} \end{defn} Formally, the platform's optimization problem in ``Incomplete-Hetero'' scenario is: \begin{problem}[Incomplete-Hetero] \label{d} \begin{equation*} \begin{split} \min \quad&\mathbb{E}[W (\boldsymbol{p },\mathcal{S})]\\ s.t. \quad & \rm{IR}\; \rm{Constaints\; in \; } \eqref{9},\; \rm{IC}\; \rm{Constaints\; in \; }\eqref{IC}\\ var. \quad& {\boldsymbol{p }\in [0,\infty)^M,\mathcal{S}\subseteq\mathcal{M}} \\ \end{split} \end{equation*} \end{problem} Compared with Problem \ref{c}, the incomplete information further increases the complexity and difficulty of solving Problem \ref{d} through the additional $M(M-1)$ IC constraints. We present the platform's optimal strategies and the corresponding proof sketch as follows: \begin{theorem} \label{thmd} In the ``Incomplete-Hetero'' scenario, there exists a threshold type $n^{IncHet}$, \begin{equation} \label{23} n^{IncHet}=\arg\min_{n\in \mathcal{M}}\frac{\gamma_1+\gamma_2\frac{c_n}{\phi_n}\sum_{m=1}^nN_m\phi_m}{\sum_{m=1}^n N_m\phi_m}, \end{equation} such that it is optimal for the platform to induce the participation of worker types in the following targeted set $\mathcal{S}^{IncHet} $: \begin{equation} \begin{split} \mathcal{S}^{IncHet} =\{n|n\in \mathcal{M},n\leq n^{IncHet}\}. \end{split} \end{equation} The platform's optimal expected reward for a type-$m\in \mathcal{M}$ worker is \begin{equation} \label{24} p_m^{IncHet}=\phi_m\frac{rc_{n^{IncHet}}}{\phi_{n^{IncHet}}\sum_{m\in \mathcal{S}^{IncHet} } N_m\frac{\mu_{m}}{1+\mu_{m} \lambda_{m}}}, \forall m\in \mathcal{M}. \end{equation} \end{theorem} Proof of Theorem \ref{thmd} is given in Appendix III of the technical report \cite{appen1}. Theorem \ref{thmd} shows that the platform is able to derive the optimal set of workers under incomplete information in linear complexity, by summarizing the three-dimensional type information into a one-dimensional metric (i.e., cost-performance ratio $\Omega$). Although the platform uses the same metric $\Omega$ to select workers in scenarios ``Incomplete-Hetero'' and ``Complete-Hetero'', the numbers of targeted types (i.e., $n^{ComHet}$ in \eqref{12} and $n^{IncHet}$ in \eqref{23}) are different. One may wonder whether the platform always targets fewer worker types under incomplete information. Our simulation results in Section \ref{simulation} show that it is not always true. In the two information scenarios, different payment rules will have different influences on the platform's expected cost, resulting in different worker selection rules in \eqref{12} and \eqref{23}. Different from the ``Complete-Hetero'' scenario where all participating workers obtain a zero payoff, in the ``Incomplete-Hetero'' scenario, all worker types in set $\mathcal{S}^{IncHet}$ except the boundary type obtain positive expected payoffs which are the \emph{information rent} in economics. In the ``Complete-Hetero'' scenario, the platform may give smaller expected rewards to the workers with efficient computation performances, compared with workers with poor performances, as the platform knows workers' costs. However, in ``Incomplete-Hetero'' scenario, the platform sets a larger expected reward for a type with better computation performance $\phi$ as shown in \eqref{24}. Such a reward-performance relationship is independent of the workers' distribution in each type. Moreover, the rewards in Theorem \ref{thmd} ensure that worker types in the desirable set $\mathcal{S}^{IncHet}$ will participate, and types not in $\mathcal{S}^{IncHet}$ will not participate as the expected reward cannot compensate for their expected costs. Furthermore, we have the following insight about the optimal number of targeted types in the two scenarios: \begin{corollary} \label{pro} The number of targeted types increases in the platform's valuation on expected overall runtime $\gamma_1$ and decreases in the platform's valuation on payment $\gamma_2$. \end{corollary} Proof of Corollary \ref{pro} is given in Appendix IV of the technical report \cite{appen1}. If the platform attaches more attention on the computation time (larger $\gamma_1$), he is likely to include more worker types to reduce the overall runtime; if the platform pays more attention on the payment to workers (larger $\gamma_2$), he will incentivize fewer worker types to save money. Note that the recovery threshold $k$ is a random variable in these two scenarios. Workers' different loads and random computation time lead to the randomness of the number of workers who finish the computation before the platform receives $r$ rows (i.e., the value of $k$ in $\sum_{j=1}^{k}\ell^j=r$, where $\ell^j$ is the load of the $j$-th worker who finishes the computation). Next, we will consider a special case where workers have the same computation time distribution but different costs to further study the optimal load assignment and recovery threshold in coded machine learning with incentives. \subsection{Workers' Heterogeneity in Costs Only} \label{homo} In this subsection, we focus on the ``Incomplete-HeteCostOnly'' scenario where workers have heterogeneous computation costs $c$ and the same computation performances (i.e., computation time distribution). The platform has incomplete information about workers' costs but knows the workers' computation time distribution and worker type distribution. Each worker $i$'s computation time (i.e., $T_i$) in this case follows \eqref{dist} with $\mu_{i}=\mu$, $a_i=a$, and $\ell_{i}=\ell, \forall i \in \{1,...,N\}$. In this case, we consider the $(n, k)$-MDS code as introduced before, which is a widely used code for workers with homogeneous computation time distribution in literature (e.g., \cite{lee2017speeding,reisizadeh2017latency}).\footnote{Our mechanisms can also be extended to other codes similarly. MDS codes can make the expected overall runtime ${\Theta}(\log n)$ times faster than uncoded matrix multiplication (e.g., \cite{lee2017speeding}).} Then, the load assignment and the corresponding expected overall runtime are given as follows: \begin{lemma} \label{lm2} Under the $(n, k)$-MDS codes, each worker has the same computation load \begin{equation} \label{14} \ell=\frac{r}{k}. \end{equation} The expected overall runtime under \eqref{14} is \begin{equation} \label{time} \begin{split} \mathbb{E}[T ]=\frac{r}{k}\hspace{-0.5mm}\left(a\hspace{-0.5mm}+\hspace{-0.5mm}\frac{H_{n}\hspace{-0.5mm}-\hspace{-0.5mm}H_{n-k}}{\mu}\right) \simeq\frac{r}{k}\hspace{-0.5mm}\left(a\hspace{-0.5mm}+\hspace{-0.5mm}\frac{1}{\mu}\log\frac{n}{n\hspace{-0.5mm}-\hspace{-0.5mm}k}\right), \end{split} \end{equation} where $H_{n} \triangleq \sum_{i=1}^{n} \frac{1}{i} $, and $H_{n} \simeq \log n$ when $n$ is large. \end{lemma} Proof of Lemma \ref{lm2} is given in Appendix V of the technical report \cite{appen1}. The analysis of workers' participation decisions and the platform's strategies is similar to that in Section \ref{hetero}. Then, the platform's optimal targeted worker type set, optimal rewards, and optimal recovery threshold in the ``Incomplete-HeteCostOnly'' scenario are given in Proposition \ref{thmb}: \begin{proposition} \label{thmb} Given $ {c_1} \le ...\le {c_{M}} $ in the ``Incomplete-HeteCostOnly'' scenario, there exists a threshold type $n^{IncHco}$, \begin{equation} \label{19} n^{IncHco} =\arg\min_{{n\in \mathcal{M}}} \frac{\gamma_1+\gamma_2{c_n}\sum_{m=1 }^n N_m}{\sum_{m=1 }^n N_m}, \end{equation} such that it is optimal for the platform to induce the participation of worker types in the following targeted set $\mathcal{S}^{IncHco} $: \begin{equation} \begin{split} \mathcal{S}^{IncHco} =\{n|n\in \mathcal{M},n\leq n^{IncHco}\}. \end{split} \end{equation} The optimal expected reward for a type-$m\in \mathcal{M}$ worker is \begin{equation} p_m^{IncHco}={c}_{n^{IncHco} }\frac{r}{k^*}\left(a+\frac{1}{\mu}\log\frac{1}{1-\alpha}\right),\forall m\in \mathcal{M}, \end{equation} and the platform's optimal recovery threshold is \begin{equation} k^*=\alpha N^{(\mathcal{S}^{IncHco} )}, \end{equation} where $\alpha\triangleq \left[1+\frac{1}{W_{-1}\left(-e^{-a\mu-1}\right)}\right] \in [0,1]$, $W_{-1}(\cdot)$ is the lower branch of Lambert W function\footnote{$x=-W_{-1}\left(-\frac{1}{t}\right)$ is the unique solution to $\frac{e^{x}}{x}=t, t \geq e$ and $x \geq 1$.}, and $N^{(\mathcal{S}^{IncHco})}\triangleq\sum_{m \in \mathcal{S}^{IncHco}}N_m$. \end{proposition} \begin{figure}[tbp] \centering \includegraphics[width=0.5\linewidth]{thresholdc} \vspace{-2.5mm} \caption{Illustration of $\mathcal{S}^{IncHco}$ in ``Incomplete-HeteCostOnly'' scenario.} \label{figa} \vspace{-2.5mm} \end{figure} Proof of Proposition \ref{thmb} is given in Appendix VI of the technical report \cite{appen1}. As illustrated in Fig.~\ref{figa}, Proposition \ref{thmb} shows that in the ``Incomplete-HeteCostOnly'' scenario, the platform prefers the worker types with small marginal costs, as workers have the same computation performance in this case. The platform gives all workers the same expected reward, which ensures that worker types in the desirable set $\mathcal{S}^{IncHco}$ will participate, and types not in $\mathcal{S}^{IncHco}$ will not participate. More importantly, Proposition \ref{thmb} presents that the MDS codes' optimal recovery threshold $k^*$ is linearly proportional to the total participator number $N^{(\mathcal{S}^{IncHco} )}$, which provides an easy-to-implement guideline for data encoding. According to \eqref{14}, the optimal load assignment is $\ell_{m}^*=r/k^*, \forall m\in \mathcal{S}$. Next, we will compare the platform's strategies and costs in different scenarios through numerical analysis in Section \ref{simulation}. \section{Simulation Results} \label{simulation} In Section \ref{vs}, we will evaluate the performance of our proposed incentive mechanisms. In Section \ref{more}, we will further consider a \emph{strongly incomplete information scenario} where the platform further lacks the information about workers' distributions in different types (i.e., $N_m$ of type $m$). We will show that our incentive mechanism for incomplete information scenario is asymptotically optimal under strongly incomplete information. \begin{table}[tbp] \caption{Workers' Parameter Settings in Simulation} \vspace{-4.5mm} \begin{center} \begin{tabular}{|c|c|} \hline $(c_1,\mu_1,a_1)=(1,50,0.012)$ & $(c_2,\mu_2,a_2)=(7,100,0.024)$ \\ \hline $(c_3,\mu_3,a_3)=(8,200,0.033)$ & $(c_4,\mu_4,a_4)=(3,10,0.031)$ \\ \hline $(c_5,\mu_5,a_5)=(16,400,0.040)$ & $(c_6,\mu_6,a_6)=(5,20,0.081)$ \\ \hline $(c_7,\mu_7,a_7)=(21,800,0.044)$ & $(c_8,\mu_8,a_8)=(9,40,0.123)$ \\ \hline $(c_9,\mu_9,a_9)=(12,80,0.153)$ & $(c_{10},\mu_{10},a_{10})=(20,160,0.172)$ \\ \hline \end{tabular \label{3tab} \vspace{-6mm} \end{center} \end{table} When workers have three-dimensional heterogeneity in computation performances and costs, we consider $M= 10$ types of workers with parameter settings in Table \ref{3tab}, similar to that in \cite{reisizadeh2019coded}. The parameters satisfy increasing cost-performance ratio relationship: $\Omega_1\le ...\le \Omega_M$. There are $r=1000$ inner products to be finished by workers. Each type has $N_m=N/M,\forall m\in \mathcal{M}$ workers. We consider both $\gamma_1=2000$ and $\gamma_2=1$ to reflect the platform's different evaluation scenarios on time cost and payment. \subsection{Complete versus Incomplete Information} \label{vs} Fig.~\ref{fig10} shows the number of platform's targeted worker types characterized in Theorems \ref{thmc} and \ref{thmd} versus the total worker number $N$, under both complete and incomplete information. Both curves are decreasing in $N$. This is because the worker types of small cost-performance ratios have more workers when $N$ increases. The platform can rely less on the inefficient or costly types. By comparing the results in two information scenarios in Fig.~\ref{fig10}, we realize that the platform does not always target at a smaller group of workers under incomplete information. For example, the platform includes $4$ worker types under incomplete information versus $3$ worker types under complete information at around $N=1400$. The platform under incomplete information afraid of large overall runtime wants to include one more type despite the mildly increased cost. \begin{figure}[tbp] \centering \includegraphics[width=2.2 in]{type} \vspace{-3mm} \caption{Number of worker types targeted by the platform (under both complete and incomplete information) versus the total worker number $N$.} \label{fig10} \vspace{-3.5mm} \end{figure} \begin{figure}[tbp] \centering \includegraphics[width=2.2 in]{cost} \vspace{-3mm} \caption{Platform's increased cost due to the lack of information versus the total worker number $N$.} \label{fig8} \vspace{-1mm} \end{figure} \begin{figure}[tbp] \centering \vspace{-2mm} \includegraphics[width=2.2 in]{payoff} \vspace{-3mm} \caption{Different worker types' payoffs under incomplete information versus the total worker number $N$.} \label{fig13} \vspace{-5mm} \end{figure} \begin{figure}[tbp] \centering \includegraphics[width=2.2 in]{diffstro} \vspace{-3mm} \caption{Platform's increased cost due to strongly incomplete information compared with incomplete information versus the total worker number $N$.} \label{fig15} \vspace{-5mm} \end{figure} Fig.~\ref{fig8} compares the platform's cost objectives under complete and incomplete information, by measuring increased cost due to incomplete information versus the worker number $N$. When the number of workers becomes very large (larger than $3400$ in Fig.~\ref{fig8}), the platform obtains the same cost in these two scenarios. This is because the platform only chooses the type with smallest cost-performance ratio in both complete and incomplete information scenarios (Fig.~\ref{fig10}). However, the platform's cost gap does not monotonically decrease in $N$. The platform may sometimes target more worker types under incomplete information (see Fig.~\ref{fig10} when $N$ equals $1400$), which increases cost difference compared to the complete information scenario. Fig.~\ref{fig13} further shows that different types of workers' payoffs under incomplete information versus the worker number $N$. Only the targeted worker types can have positive payoffs, and such payoffs are overall decreasing in $N$ due to mutual competition and the platform's smaller set of targeted types. \subsection{Extension of Incomplete Information} \label{more} In Section \ref{incomple}, we have studied the mechanism design under incomplete information without knowing each worker's computation time and cost. Here we further evaluate the performance of the proposed mechanism in Theorem \ref{thmd} under strongly incomplete information, where the platform only knows the total number of workers and the distribution of each worker's type. Each worker has an equal probability of 10\% of belonging to each worker type. In this strongly incomplete information scenario, as the number of workers $N$ becomes large, according to the law of large numbers, the empirical number of each type of workers approaches to the expected value computed based on the distribution. As shown in Fig.~\ref{fig15}, when $N$ is larger than $400$, the increased cost due to strongly incomplete information reaches zero\footnote{The fluctuations are due to the random realization of the number of each type workers.}. Thus, our incentive mechanism in Theorem \ref{thmd} performs optimally under this strongly incomplete information scenario as $N$ goes to infinity. \section{Conclusion} \label{conclusion} This paper studied the important incentive issues in coded machine learning. We captured the trade-off between the platform's time cost and payment in his payoff function. We proposed the optimal incentive mechanisms for the workers in both complete information and incomplete information scenarios, under workers' multi-dimensional heterogeneity in computation performances and costs. In the presence of the high complexity of the worker selection problem, we managed to summarize workers' multi-dimensional heterogeneity into a one-dimensional metric and solved the problem in a linear complexity. We also demonstrated that the optimal recovery threshold is linearly proportional to the total participator number when using MDS codes. We showed that compared with the complete information scenario, the effect of incomplete information on the platform's cost will disappear when the total worker number is sufficiently large. We will further study the optimal incentive mechanisms of competing platforms in future work. \bibliographystyle{IEEEtran}
{'timestamp': '2020-12-17T02:08:14', 'yymm': '2012', 'arxiv_id': '2012.08715', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08715'}
arxiv
\section{Introduction} Graph Neural Networks (GNNs) extends Convolutional Neural Networks (CNNs) to graph-based data. A common problem solved by GNNs is node classification. Given a partially labelled graph structure and the data defined on each node, the goal of node classification is to accurately classify the unlabelled nodes. For example, Fig.~\ref{figure:citeseer} shows the graph representation of a node classification dataset before and after the node classification, where the colors represent labels of the nodes. On the left, we have a partially labelled graph. On the right, the graph is fully labelled from node classification. The graph structure represents a citation network, where each node represents a paper, and each undirected edge between two nodes represents a citation between the two papers. \begin{figure}[hbp!]% \centering \includegraphics[width=\linewidth]{images/compare_cite.png} \caption{Visualization \cite{GEPHI} of Citeseer \cite{node_dataset} Dataset.} \label{figure:citeseer} \end{figure} While GNNs are commonly used for learning irregular data residing on non-Euclidean domain, it is challenging to evaluate how much the underlying graph structure helps with the model's performance. Node classification problems can be solved using either a GNN or a CNN\footnote{In this case, the CNN is similar to a Multilayer Perceptron (MLP) because the sliding window of convolution layers has size 1.}. One benefit of using a GNN is that it uses the given graph structure to classify nodes, while a CNN does not. However, we do not know whether using the graph structure and a GNN will provide any advantages over using a CNN and no graph structure a priori. The graph structure could provide little to no information about the labels. This motivates our question: How can we evaluate the effectiveness of the graph structure for GNNs? To answer this question, we need to address two aspects. First, we need to define what makes a graph structure effective. We say a graph structure is relatively effective if it contains a relatively large amount of information about the label distribution. This information added by the graph structure is reflected in test accuracies. For instance, Fig.~\ref{figure:compare} shows the test accuracies of a GNN model on a citation network dataset using three different graph structures. We say the underlying graph structure of CORA-ML is more effective than the random graph, because while the edges in CORA-ML represent citations, the edges in the random graph are randomly drawn and convey no useful information. Similarly, the test accuracy of the model trained with the underlying graph structure (orange solid line) is around 20 percent higher than the model trained with the identity matrix (grey dashed line), whereas the test accuracy of the model trained with the random graph (purple dotted line) has almost no improvement from the model trained with the identity matrix. \begin{figure}[h!] \centering \includegraphics[width=7cm]{images/tagcnComp.png} \caption{Comparison of Test Accuracy of CORA-ML Dataset \cite{node_dataset} of a 2-layer TAGCN\cite{TAGCN} with 1) given dataset's graph, 2) identity matrix, 3) random Erd\H{o}s-R\`enyi graph \cite{SPM}.} \label{figure:compare} \end{figure} The second question we need to address is, how do we quantitatively evaluate the effectiveness of graph structure? In this paper, we propose an information theoretic parameter called edge entropy to measure the quality of label information contained in the graph structure. We show edge entropy is a good indicator of the effectivenss of GNN over CNN using experiment results from both synthetic and real datasets. \section{Related Work} Node classification has been used in many different settings, but very little has been done on evaluating the effectiveness of graph structure in the node classification datasets. Much of the existing work on evaluating GNN models focuses on developing benchmarks and upper bounding the modeling capacity for graph classification tasks. Dwivedi, Joshi, Laurent, Bengio and Bresson \cite{dwivedi2020benchmarkgnns} introduced a standardized benchmarking framework for running a variety of GNN experiments. Xu, Hu, Leskovec and Jegelka \cite{powerful} showed that a Graph CNN is only as powerful as the Weisfeiler-Lehman graph isomorphism test for graph classification tasks. Another related but different problem is graph comparison. Metrics such as the clustering coefficient \cite{SmallWorld}, the betweenness centrality \cite{centrality}, and graph spectral distance \cite{spectral} were proposed to discern the topological properties of different graph structures. This problem is different than ours, because these metrics do not consider the nodes' labels. Our challenge is to evaluate the effectiveness of the given graph structure based on both the connectivity and the label distribution. \section{Problem Statement} We are interested in evaluating the effectiveness of GNN over CNN by examining the effectiveness of the graph structure in node classification datasets. In this paper, we focus on a variant of GNN called Graph Convolution Neural Networks (Graph CNNs), where the convolution layer is explicitly defined using the adjacency matrix. \subsection{Node Classification} A node classification dataset $D$ contains the following: \begin{itemize} \item the graph structure, i.e., the adjacency matrix $A$ \item the data defined on each node $X$ \item the labels for all nodes $y$\textbf{} \end{itemize} The goal of node classification is to accurately classify unlabelled nodes based on $A,X$, and part of $y$. \subsection{Filter-based Graph CNN} We focus on filter-based graph CNN models such as TAGCN\cite{TAGCN} and GCN\cite{GCN}. Filter-based graph CNN models represent convolution as a filtering operation with a polynomial of the graph shift $S$, where $S$ can be either the adjacency matrix $A$ or the graph Laplacian $L$ \cite{Overview}. Formally, an adjacency matrix based graph convolution layer learns a graph filter \cite{TAGCN}: \begin{equation} P(A)(X) = \sum_{k=0}^{d-1} A^{k} X W_{k} \label{eq:conv} \end{equation} where $P(A)$ is a polynomial of $A$, $X$ is the input graph signal, $d$ is the degree of the graph polynomial, and $\{W_{k}\}_{k=0}^{d-1}$ are learnable weights. \subsection{Effectiveness of Graph Structures} For a node classification problem, a graph structure is less effective if the graph structure contains little information about the label distribution. This lack of information can be seen in the test accuracies of the graph CNN model. For a less effective graph structure, the model trained with the given adjacency matrix will yield little improvement in test accuracy compared with the model trained with the identity matrix, i.e., trained with the features only. For example, suppose we have two node classification datasets $D_{1}$ and $D_{2}$. We train a graph CNN model on both datasets using the given adjacency matrix. We also train the model for both datasets using the identity matrix instead of the adjacency matrix. We define the improvement on $D_i$ as the difference in test accuracy when using the given adjacency matrix versus using the identity matrix. If the improvement on $D_1$ is greater than the improvement on $D_2$, then the graph structure in $D_1$ provides more information, i.e., is more effective, than the graph structure in $D_2$. Likewise, if the improvement on $D_2$ is greater, then the graph structure in $D_2$ is more effective than the graph structure in $D_1$. \section{Proposed Method} To evaluate the effectiveness of the graph structure in a node classification task, we propose a parameter to evaluate the quality of label information contained in the graph structure. We will first motivate our definition with some simple examples, then we will define the parameter. \subsection{Motivating Examples} \label{sec:examples} A naive attempt at evaluating the effectiveness of a graph structure is related to node clustering. Consider the graph in Fig. \ref{figure:graphs}(a). There is a blue cluster and a red cluster. Here, blue nodes always connect with blue nodes and red nodes always connect with red nodes. In this case, the edges reveal a lot of label information. For instance, suppose we want to classify an unlabelled node. If we know it has a blue neighbor, then we can confidently classify this node as blue, because the blue cluster and the red cluster are disjoint. On the other hand, consider the graph in Fig. \ref{figure:graphs}(b). Here, the blue and red clusters are mixed. It is equally likely for a blue node to connect with either another blue node or a red node. In this case, the edges do not contain useful label information. For instance, knowing that an unlabelled node has a blue neighbor does not make that node more likely to be blue or red. \begin{figure}[h!] \centering \includegraphics[width=8cm]{images/graphs2.png} \caption{Simple graphs.} \label{figure:graphs} \end{figure} A simple parameter inspired by this observation is intra-class ratio, which measures the percentage of edges that connect nodes of the same class. One might hypothesize that a graph with high intra-class ratio is easier to classify with the underlying graph structure, because the clusters are more separated. However, a counter-example for this hypothesis is shown in Fig. \ref{figure:graphs}(c). In this bipartite graph, blue nodes always connect with red nodes and red nodes always connect with blue nodes. In this case, the intra-class ratio is zero, but the graph is very helpful for node classification. For instance, if an unlabelled node has a blue neighbor, then we know it must be a red node. Another parameter to consider is the clustering coefficient, which measures how likely nodes would form cliques in the graph. One might assume that a higher clustering coefficient indicates that accounting for the graphs will be more helpful for node classification, because the clusters are more obvious. However, Fig.~\ref{figure:graphs}(d) shows a counter-example for this observation. In this 4-clique graph, the clustering coefficient is 1, but the graph structure does not reveal label information. This is because we have a mixed cluster of both blue and red nodes. In this case, the clustering coefficient provides little help with evaluating the effectiveness of graph structure for node classification, because it ignores the labels of nodes. To account for both the connections between different classes and the labels of nodes, we propose a more comprehensive parameter called edge entropy. \subsection{Edge Entropy} We propose edge entropy as a parameter to evaluate the impact of accounting for the graph structures in node classification. Edge entropy measures the quality of label information encoded in the graph. A high edge entropy (closer to 1) indicates that accounting for the graph structure is very helpful for node classification. A low edge entropy (closer to 0) indicates that accounting for the graph structure is not very useful for node classification. Formally, given a graph $\mathcal{G}$ with~$M$ classes of nodes, we define the \textbf{per-class edge entropy} of any class $l$ as a function $H: \{1, \hdots, M\} \to [0,1]$ such that \begin{equation}\label{edgeEntropy} H(l) := -\sum_{m \in \{1, \hdots, M\}} p_{lm}(n)\log_{M}(p_{lm}(n)) \end{equation} where the first order interclass connectivity probability $p_{lm}$ is defined as \begin{equation}\label{connProb} p_{lm} := \frac{|\{\text{edge } w: \text{start}(w) \in \mathcal{V}_{l} \land \text{end}(w) \in \mathcal{V}_{m} \}|}{|\{\text{edge } w: \text{start}(w) \in \mathcal{V}_{l}\}|} \end{equation} where an edge is a member of $\mathcal{E}$ and not a self loop, $\mathcal{V}_{l}$ is the set of nodes that belong to the $l$-th class. Specifically, $p_{lm}(n)$ is the probability that a node~$v$ belongs to class~$l$ given that $v$ is a direct neighbor of a node of class~$l$. For a dataset, we define its \textbf{edge entropy} as: \begin{equation}\label{edgeEntropyFull} \widehat{H} := \sum_{m \in \{1, \hdots, M\}} H(m)w_{m} \end{equation} where $w_{m}$ is the percentage of samples from class $m$. That is, the ratio between the number of class $m$ nodes and the number of total nodes. For instance, we can analyze the edge entropies of the graphs in our motivating examples. The two graphs in Fig. \ref{figure:graphs}(a) and Fig. \ref{figure:graphs}(c) have $\widehat{H}=0$. The graph in Fig. \ref{figure:graphs}(b) and Fig. \ref{figure:graphs}(d) have $\widehat{H}=1$, because the edges are random. This shows that edge entropy is a good indicator of the effectiveness of graph structures for simple graph structures. \section{Experimental Evaluation} In this section, we show the correlation between edge entropy and accuracy gains of GNNs from accounting the underlying graph structures using both synthetic and real datasets. We also compare edge entropy with other parameters such as the clustering coefficient and the intra-class ratio. We will start by explaining the datasets and experimental setup, then we will discuss the results from graph CNN experiments. \subsection{Synthetic Datasets} We generate synthetic datasets with specific edge entropies. To accomplish this, we use the following approach. Let $N$ be the number of nodes. Let $M$ be the number of classes. Let $r_i$, $i = 1,\hdots,M$ be the number of nodes with class $i$ where $\sum_{i=1}^{M}r_{i}=N$. Let $\rho$ be a sparsity factor, $0\leq \rho \leq 1$. In order to have a specific edge entropy, the generated connected graph has to have a specific number of edges between nodes of each class. We create a $M \times M$ matrix $T$ with the desired edge entropy where $T_{i,j}$ is the number of edges that connect a class $i$ node to a class $j$ node. We normalize each row of $T$ to produce a probability matrix $P$. $P$ is the matrix of $p_{lm}$ defined for each pair of classes in \eqref{connProb}. Using the values in $P$ as $p_{lm}$ in \eqref{edgeEntropy} and \eqref{edgeEntropyFull} yields the desired edge entropy $\widehat{H}$. For example, to get an edge entropy of approximately $\widehat{H} = 0.24$ with $M = 2$ classes with $N = 100$ nodes: $r_1 = 50$ class 1 nodes and $r_2 = 50$ class 2 nodes, a possible $T$ and $P$ are $T = \begin{bmatrix} 48 & 2 \\ 2 & 48 \end{bmatrix}$, $P = \begin{bmatrix} 0.96 & 0.04 \\ 0.04 & 0.96 \end{bmatrix}$\footnote{From \eqref{edgeEntropy} and \eqref{edgeEntropyFull}, ${H(0) = H(1) = -(0.96 \log_2{0.96} + 0.04\log_2{0.04})}$ $ = 0.24$ and $\widehat{H}=0.24 \times 0.5+0.24 \times 0.5=0.24$}. To create the graph, we start with $N$ isolated nodes. Each node has a self loop and random features. A label is assigned to each node, based on the distribution of nodes by class, $r_i$, $i = 1,\hdots,M$. We then consider every pair of nodes $v_i$, $v_j$, $i,j = 1,\hdots,N$. For each pair of nodes, we create a directed edge from $v_i$ to $v_j$ with probability $\rho P_{l,m}$ where $l$ is the class of $v_i$ and $m$ is the class of $v_j$. \subsection{Other Datasets} We used a variety of popular node classfication datasets : \begin{itemize} \item Citation network datasets including CORA-ML, CITESEER and PUBMED \cite{node_dataset}. Nodes are scientific papers and edges represent citations between papers. Data defined on each node is a bag of words vector. Labels represent the field of study. \item Social network datasets such as REDDIT \cite{reddit}. Nodes represent users' posts and an edge is drawn between two posts if the same user commented on both of the posts. There is no data defined on each node. Labels represent which subreddit a post belongs to. \item Large synthetic datasets such as SBM-PATTERN and SBM-CLUSTER. Each dataset consists of 10,000 randomly generated graphs using Stochastic Block Models. They were introduced as a benchmark dataset for evaluating GNNs in \cite{dwivedi2020benchmarkgnns}. \end{itemize} \subsection{Experimental Setup} For each dataset, we trained a GNN model using both the underlying graph structure and the identity matrix. We then compare the difference between the test accuracy when we train with the underlying graph structure and the test accuracy when we train with the identity matrix. We call this difference in accuracy the \textbf{improvement} on the dataset from accounting for the graph structure. \subsubsection{Synthetic Datasets} We generate the graphs using the following parameters: $N=3000, M=3, r_{1}=r_{2}=r_{3}=1/3$. For comparison purposes, we choose two sparsity factor $\rho_{1}=0.1, \rho_{2}=0.5$. The synthetic graph generated with $p_{1}$ is sparse, and a graph generated with $p_{2}$ is dense. We also fix two connection probability matrices such that one wo;; have low edge entropy ($\widehat{H}_{\text{low}}\approx 0.52$), and the other one will have high edge entropy ($\widehat{H}_{\text{high}}\approx 0.97$). Specifically, \[P_{\text{low}} = \begin{bmatrix} 0.8 & 0.05 & 0.15\\ 0.05 & 0.9 & 0.05 \\ 0.27 & 0.03 & 0.7 \end{bmatrix}, \, P_{\text{high}} = \begin{bmatrix} 0.4 & 0.26 & 0.34\\ 0.2 & 0.5 & 0.3 \\ 0.33 & 0.31 & 0.37 \end{bmatrix} \] Dataset dense\_low is generated with $\rho_{2}, P_{\text{low}}$. Dataset sparse\_low is generated with $\rho_{1}, P_{\text{low}}$. Dataset dense\_high is generated with $\rho_{2}, P_{\text{high}}$. Dataset sparse\_high is generated with $\rho_{1}, P_{\text{high}}$. For each dataset, we run 100 Monte Carlos trials by training a randomly initialized 2-layer TAGCN with 2nd order filters for 200 epochs, and testing with cross validation. We vary our percentage of training data from 10\% to 90\% with a 10\% increment each step. \subsubsection{Other Datasets} For citation network datasets, we trained a 2-layer TAGCN with polynomial order 3 and 16 hidden units using cross validation. We used an Adam optimizer with a learning rate of 0.01 and a learning rate decay factor of 5e-4. For the Reddit dataset, we trained a 2-layer Graph Attention Network (GAT) \cite{Velickovic2018}, because we need the sampling function to handle the large size of the dataset. We used 8 heads in the first layer and 1 head in the second layer, a dropout rate of 0.6 for both layers, 200 epochs, and an Adam optimizer with a learning rate of 5e-3 and a learning rate decay factor of 5e-4. For comparison purposes we also trained the same model on citation network datasets. For the SBM datasets, we trained a 1-layer GCN with 146 hidden units and 1000 learning epochs. We used an Adam optimizer with a learning rate of 1e-3 and a learning rate reduce factor of 0.5. \begin{figure}[h!] \centering \subfloat[The upper blue line represents the test accuracy on dataset sparse\_low. The lower orange line represents the test accuracy on dataset sparse\_high.]{% \includegraphics[clip,width=0.7\columnwidth]{images/syna.png}% } \subfloat[The upper blue line represents the test accuracy on dataset dense\_low. The lower orange line represents the test accuracy on dataset dense\_high]{% \includegraphics[clip,width=0.7\columnwidth]{images/synb.png}% } \caption{Test accuracy of TAGCN on synthetic datasets. The red dashed line shows the improvement from accounting the graph structure is around 20\% with 30\% training samples for both sparsity factors. The shaded regions represent standard deviation of the Monte Carlos trial outcomes. This shows that edge entropy is a good indicator of the effectiveness of the graph structure in synthetic datasets.} \label{figure:syn_acc} \end{figure} \begin{table}[h!] \centering \caption{Accuracy Improvements with 2-Layer TAGCN for Synthetic Datasets with 30 Percent Training Data} \begin{tabular}{|c|c|c|c|c|c|c|c|} \hline Dataset & Clustering & Intra & $\widehat{H}$ & Improvement\\ \hline dense\_low & \textbf{0.45} & \textbf{0.8} & \textbf{0.521} & \textbf{51.3} \\ \hline sparse\_low & 0.121 & \textbf{0.8} & \textbf{0.521} & 36.2 \\ \hline dense\_high & 0.31 & 0.42 & 0.974 & 32 \\ \hline sparse\_high & 0.077 & 0.42 & 0.974 & 19.2 \\ \hline \end{tabular} \label{table:synth} \end{table} \begin{table}[!htbp] \centering \caption{Accuracy Improvements with 2-layer TAGCN for Classifying Citation Networks} \begin{tabular}{|c|c|c|c|c|c|c|c|} \hline Dataset & Clustering & Intra & $\widehat{H}$ & Improvement\\ \hline CORA-ML & 0.242 & \textbf{0.81} & $\textbf{0.390}$ & $\textbf{63.9}$\\ \hline CiteSeer & 0.144 & 0.74 & 0.533 & 54.9 \\ \hline Pubmed & 0.066 & 0.80 & 0.564 & 51 \\ \hline \end{tabular} \label{table:citations} \end{table} \begin{table}[!htbp] \centering \caption{Accuracy Improvements with 2-Layer GAT for Social Networks and Citation Networks} \begin{tabular}{|c|c|c|c|c|c|c|c|} \hline Dataset & Clustering & Intra & $\widehat{H}$ & Improvement\\ \hline Reddit & \textbf{0.32} & 0.756 & $\textbf{0.322}$ & $\textbf{45.1}$ \\ \hline CORA-ML & 0.242 & \textbf{0.81} & 0.390 & 23 \\ \hline CiteSeer & 0.144 & 0.74 & 0.533 & 13.5 \\ \hline PubMed & 0.066 & 0.80 & 0.564 & 7.4 \\ \hline \end{tabular} \label{table:gat} \end{table} \begin{table}[!htbp] \centering \caption{Accuracy Improvements with 1-Layer GCN for SBM Datasets} \begin{tabular}{|c|c|c|c|c|c|c|} \hline Dataset & Clustering &Intra & $\widehat{H}$ & Improvement \\ \hline SBM\_PATTERN & \textbf{0.427} & \textbf{0.589} & \textbf{0.811} & \textbf{34.78} \\ \hline SBM\_CLUSTER & 0.317 &0.33 & 0.954 & 27.68 \\ \hline \end{tabular} \label{table:sbm} \end{table} \subsection{Discussions} The results with both synthetic and real datasets show edge entropy is a good indicator of the effectiveness of accounting the graph structure in node classification. For example, Fig.~\ref{figure:syn_acc} shows that the synthetic dataset with low edge entropy always have higher improvement than the synthetic dataset with high edge entropy for both sparsity factors, $\rho_1 = 0.1, \rho_2 = 0.5$. Datasets dense\_low (Table~\ref{table:synth}), CORA-ML (Table~\ref{table:citations}), Reddit (Table~\ref{table:gat}) and SBM\_PATTERN (Table~\ref{table:sbm}) also have the lowest edge entropy and the highest improvement in their tables. This shows that a lower edge entropy corresponds to a higher improvement in test accuracy, and a higher edge entropy corresponds to a lower improvement in test accuracy. Other parameters such as the clustering coefficient and the intra-class ratio are not consistent with the impact of accounting for graph structures in certain cases. For instance, the clustering coefficient for dataset sparse\_low in Table \ref{table:synth} is 0.121. This is lower than the clustering coefficient for dense\_high (0.31) and does not reflect the better improvement of sparse\_low (51.3\%) over dense\_high (32\%). Another example is the intra-class ratio for Reddit in Table \ref{table:gat}. The intra-class ratio for Reddit is 0.756, which is higher than the intra-class ratio of CORA-ML (0.242). This is inconsistent with Reddit's higher improvement (45.1\%) from accounting the graph structure than CORA-ML (23\%). The underlying reason is that the clustering coefficient ignores node labels and the intra-class ratio neglects connections between different classes, as we discussed in the motivating examples. Another interesting observation is that while the clustering coefficient is inconsistent with the improvements on synthetic datasets, a high clustering coefficient indicates a higher improvement for the real datasets studied in this paper. A possible explanation is that these problems are similar to node clustering. This might help explain why a method as simple as label propagation \cite{labelprop} can achieve state-of-the-art accuracy on some popular node classification datasets. \section{Conclusion} Evaluating the effectiveness of GNN over CNN on node classification datasets is an important issue, because it shows advantages of using a graph structure. In this paper, we defined what makes the graph structure effective for node classification, and we proposed edge entropy as a parameter to quantitatively evaluate the effectiveness of graph structures. We showed edge entropy is a good indicator of the effectiveness of the graph with experiment results from both synthetic and real datasets. Alternative parameters such as the clustering coefficient and the intra-class ratio are inconsistent with the accuracy gains from accounting the graph structure in some cases. In future works, we will extend the definition of edge entropy to consider longer walks of lengths greater than 1, and we will improve our simulations with other graph models such as small-world graphs and preferential attachments. \section{Acknowledgments} The authors thank Xujin Chris Liu, Srinivasa Pranav, Rajshekhar Das, Chaojing Duan for helpful discussions. \bibliographystyle{IEEEtran}
{'timestamp': '2020-12-17T02:07:14', 'yymm': '2012', 'arxiv_id': '2012.08698', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08698'}
arxiv
\section{Introduction} Recommender systems can help users in fulfilling their intentions by suggesting the most relevant actions to follow. A wide variety of systems has been developed, while most of the approaches benefit from modeling of long-term user profiles whether of sequential or static nature. In many real-world applications, long-term user profiles are not available, and therefore, suggestions have to be made solely based on the observed actions during an ongoing session. Typically, session-based recommendation algorithms suggest a user the immediate next actions. The practical relevance of the problem leads to a number of proposals for algorithms mostly based on the analysis of item-level dependencies in interactional data. When making recommendations based only on the click-stream data from an ongoing session, it is reasonable to take into account characteristics usually coming with the items. Users are likely to browse alternatives when they visit a website with the intention of purchasing a specific type of product. The alternative relations among products can be recognized by similar text descriptions. It has been shown that incorporating rich features into the recommendation process helps to deal with the sparsity and the item cold start, though it is not trivial \cite{hidasi2016parallel, tanjim2020attentive}. Most of the existing session-based recommenders assume sessions to be associated with a single intention, however, it may change within an individual session multiple times. Detecting and adapting to these changes is one of the open challenges. Based on the idea of interactional context, a precondition can be devised that allows the delineation of coherent sub-sequences of semantically related actions (Fig.~\ref{fig:interactional-context}). For this purpose, we employ a technique for semantic analysis of natural language to extract high-level concepts from the item descriptions. We used it to help reduce unnecessary information that may introduce uncertainty into the intention change detection task. Within an individual session, users often browse items that complement the ones viewed earlier in the session. Hence the changes of semantics are intuitively expected to reflect patterns. \begin{figure}[h] \centering \includegraphics[width=0.6\textwidth]{assets/multi-contextual-session_deps.pdf} \caption{Given that context is a relational property, an action can be related to its close neighborhood based on an arbitrarily devised precondition of coherence. As a result, a session is split into several sub-sequences of actions, within which context is seemingly constant and among which drifts can be easily detected. There are sequential dependencies expected, both on the level of actions and the level of sub-sequences.} \label{fig:interactional-context} \Description{figure description} \end{figure} This paper is devoted to the hypothesis that boosting the score of semantically related items will improve the ranking of a recommendation list generated by a baseline method. The idea underlying our approach is to make a list of top-k recommendations and then re-rank the items in a way that items semantically related to the current intention will be moved to the top of the list while the order among them is maintained. The main contributions presented in this paper are as follows: \begin{itemize} \item we extend a simple k-NN based recommender with a semantic factor that helps deliver recommendations on the user's current intention, the proposed cSkNN method improves Mean Reciprocal Rank (MRR) in all conducted experiments, \item we compare effects of several linguistic-based generalization configurations on the recommended items ranking, \item we evaluate two versions of semantic adaptation in the course of activity and compare their results to the potential given by the generalization configuration. \end{itemize} \section{Related works} Traditional collaborative-filtering methods cannot be used as a session-based recommender because no past user behavior is available. A vital solution is the approach based on item co-occurrences in available click-stream data \cite{linden2003amazon}. Recommending items that are often clicked together has been proven to be effective in real-world applications and such nearest-neighbor-based algorithms of almost trivial nature are often used as competitive baselines. Session-based kNN method (SkNN), compared to Item-based kNN, considers an entire session when calculating the similarity, not only the last action. Several SkNN extensions providing sequential awareness are competitive with considerably more complex approaches, even those neural-network-based \cite{ludewig2018evaluation, jannach2017recurrent}. Sequential recommenders are based on Markov model to utilize sequential dependencies. For example, Markov model makes predictions of latent topics derived from song tags that are then used to post-filter the initial ranking produced by a traditional kNN algorithm \cite{hariri2012context}. The simple Markov chains methods calculate transition probabilities depending only on the previous state. Higher orders may be used to model more complex dependencies, however, it dramatically increases the computational complexity. Recurrent neural networks (RNN) are better suited to model complex dependencies and are used in many areas. Gated recurrent units (GRU) can handle longer dependencies and achieve significant improvements over traditional methods \cite{hidasi2015session}. Deep RNNs have the ability to capture sequential dependencies among a variety of entities and to involve rich features such as text descriptions or images \cite{hidasi2016parallel}, so naturally, the most of the research has been devoted to them in the past few years. Rich item representations have been utilized in Neural Attentive Session-based Recommendation model (NARM) to focus attention on items similar to session purpose \cite{li2017neural}. There are also works that use such representations to divide a session. Mixture-channel purpose routing networks (MCPRNs) model multiple intents in an individual session \cite{wang2019modeling} or semantic changes in attentive bi-GRU with song tags \cite{sachdeva2018attentive}. Attentive sequential model of latent intent (ASLI) method uses categories to model the intent \cite{tanjim2020attentive}. \section{Proposed approach} The underlying idea of proposed cSkNN is to make a list of top-k recommendations and re-rank the items according to their semantics. In this section, we elaborate on our motivation and describe our method. \subsection{Motivation} Contextual information is an additional and important modeling dimension that helps to enhance the prediction accuracy. Existing approaches mostly focus on a \textit{representational view} of the context. It is a descriptor of an environment in the form of stable information that can be delineated in advance and then simply observed before activity or during its initialization, e.g., weather, time, or a device’s sensory inputs. However, we lack the richness of such relevant contextual information in e-commerce domain so we take the position of an alternative \textit{interactional view} that differs from the former fundamentally. Instead of context being considered as a bit of information, it is treated as a relational property that is actively produced and maintained in the course of activity \cite{dourish2004we}. A session-based recommender is a kind of a protagonist of such a phenomenological position since a session can be seen as context in the sense of a property relating actions together. However, context is perpetually being altered so when context is represented with a session as a whole, it may contain misleading information that is not up-to-date after several actions. Since a system cannot monitor all factors inducing changes in context, a temporal factor is often used as an acceptably effective proxy for these hidden factors. Researchers proposed a variety of functions that decay weight of actions in time or attention mechanisms to assign significance to the most recent actions; and/or to actions related to them \cite{li2017neural, garg2019sequence, guo2018adjustable, campos2014time}. The drawbacks of using temporal information as a solitary indication of a change are that there is no indication of a preference shift direction, and also that widely-used decaying functions lack the ability of adaptation to sudden changes within an individual session. Labeling each action with a high-level concept conveys a reliable coherence precondition that is needed for the drift detection. Generalization of actions that enforces high-level similarities and repress low-level differences (i.e., noise) will indicate the exact boundaries of sub-sequences as depicted in Figure~\ref{fig:interactional-context}. Representations learned by the distributional analysis of the interactional data inherently give rise to generalizations. However, this approach is less useful if a sufficient amount of user-item interactions is not available and also introduces bias from user interactions (as such information is already available on the level of items). Therefore, we opt to exploit a concise nature of item titles in e-commerce catalogs, from which high-level concepts can be obtained via semantic analysis. Despite difficulties emerging from the akin nature of the text, dependency parsing enables a higher control over the process of semantic generalization compared to the analysis based on the distributional hypothesis or a popular bag-of-words approach. Intuitively, transitions among coherent sub-sequences follow patterns. For example, users tend to see complementary accessories (e.g., belt) along with items that exhibit the origin purchase intention (e.g., trousers), and also users might browse items that together constitute a whole outfit. A sequential pattern of concepts “trousers” → “belt” would have higher support and confidence than sequences of particular items that correspond to those concepts. Since all such patterns on the item-level are aggregated to a single generalized pattern on the concept-level. This helps to tackle the sparsity and possibly the cold start problem. As SkNN methods are already competitive with the more sophisticated approaches, we devote more effort to their development. We evaluate a version with a simple extension (S-SkNN) that makes the method aware of sequential dependencies \cite{ludewig2018evaluation}. The S-SkNN method is used for predicting both items and semantics used to post-filter a set of recommended items. \subsection{Semantic clusters as a coherence precondition} We make a division of items regarded as having particular shared characteristics expressed by natural language into mutually exclusive \textit{semantic clusters}. These will satisfy the coherence precondition that allows splitting a session into several coherent sub-sequences among which is easy to detect interest drifts. Inferring intentions from items is more difficult than inferring them from categories \cite{tanjim2020attentive} because they ease interaction sparsity issues and also carry explicit information about item meaning for a user. In e-commerce, human-made categories have a role of such semantic clusters, however, they are mostly widely defined and contain hundreds or thousands of items (e.g., \textit{summer dress}). The larger clusters the more items of a higher variability they contain, hence it implies a sort of hierarchical organization in which a variety of items are aggregated into a single cluster. This allows bound actions to their neighbors into semantic windows as depicted in Figure~\ref{fig:configurations}. Since the length of windows is directly affected by the size of clusters, we need to strike a balance between their size and the level of abstraction that allows both to detect drifts of interest and effective semantic filtering of recommendations. The size of semantic clusters has to be relatively smaller than the usual category size, however, not too small, because it would reduce the effectiveness of sparsity reduction and make the semantics prediction harder. Besides the size also the constitution of clusters is important because by merely enlarging clusters we can cause items that do not satisfy the convenient coherence condition to merge into a single cluster. Generalization based on natural language processing can help to overcome this issue. Dependency parsing is the task of recognizing a syntactic structure in a sentence, hence it allows a controlled extraction of words that carry a semantically essential part of item characteristics. The main goal of the product title is to attract the attention of potentially interested users, and therefore, titles are written rather concisely and mostly contain words describing the main characteristics of the product along with several adjuncts. Although we can exploit such nature, it also often leads to syntactically or grammatically incorrect constructions that considerably complicate the semantic analysis. We identified several issues and inconveniences, such as multiword and multi-language expressions or inflections of words, however, in our experiments we put the only reasonable effort in resolving the most critical ones. We believe that more effort would improve the end results, so we will discuss some of the identified issues briefly in Section \ref{sec:discussion}. \begin{table}[h] \caption{Definitions of generalization configurations and example inputs for item title {\itshape ``Red striped dress with silver zip on back''}} \label{tab:confs} \begin{tabular}{cll} \toprule Conf.&Extraction rule&Example\\ \midrule \#1 & root + first degree nmod & dress zip\\ \#2 & root + second degree nmod & dress zip back\\ \#3 & root amods + root + first degree nmod & red stripes dress zip\\ \#4 & all words & red stripes dress silver zip back \\ \bottomrule \end{tabular} \end{table} \begin{figure}[h] \centering \includegraphics[width=0.5\textwidth]{assets/dependency_tree.pdf} \caption{Visualisation of a dependency tree with for example input title “Red striped dress with silver zip on back”} \label{fig:configurations} \Description{figure description} \end{figure} The idea is to extract salient words rather linguistically than statistically as via TF-IDF method. Dependency parsing help to keep only highly distinctive descriptors and to reduce low-level noise, e.g., infrequent colors, causing the items to be merged in an undesirable way. The key part of parsing is the nominal phrase root extraction since it has a function to express a high-level concept which is in collocation with modifiers that add descriptive information to it \cite{de2014universal}. We focus on nominal dependents (\textit{nmod}) because they function as a non-core argument that brings about a relatively dense packaging of referential information, e.g., \textit{dress with zip on back}, which results in an extreme reliance on implicit meaning providing a utility for our task. Another important function is an adjectival modifier (\textit{amod}) which modifies the meaning of a nominal, e.g., \textit{striped dress}. Usually, it describes qualities of items such as material, color, or other distinctive appearance or functions. Table \ref{tab:confs} describes four different rules of the generalization process from the standpoint of dependency parsing which control what words are extracted and used to create high-level concepts for items. We call them configurations in this paper from now on. We need to create semantic clusters to use their \textit{IDs} during recommendation using a k-NN method. After words are normalized, we use \textit{word2vec} model trained on all item titles to create semantic relations among similar concepts which is useful in the process of generalization during the clustering process. Each item is then represented by an average of vectors of extracted words concatenated with an item category vector. This allows to distinguish among likewise named concepts, e.g., t-shirt in women and in men category, and the nature of the category tree also allowed to capture relations based on the parts of an outfit, e.g., upper or lower body. We used a density-based clustering method DBSCAN to group items together with their surroundings given by an $\epsilon$ parameter. The radius given by $\epsilon$ directly influences the number of clusters and their sizes, therefore, it is another factor that strongly influences the generalization process alongside the word extraction rules. We used different $\epsilon$ values according to the distributions of nearest neighbors' distances for each configuration. As the result, we have 29 different mappings and for each of them, we have a function $cmap:I \rightarrow C$, where $I$ is a set of all items and $C$ is a set of all semantic clusters for a particular semantic cluster configuration. \subsection{Recommendation methodology} To make recommendations, we use S-SkNN approach with an extension providing sequential awareness: given the current session $s$, its neighbors $N_s$ and a pairwise similarity function, the recommendation score for an item $i \in I$ is defined as: $$score_{S-SkNN}(i,s) = \sum_{n \in N_s} sim(s,n) \cdot w_n(s) \cdot 1_n(i)$$ where the similarity function is a dot product of binary-encoded sessions, the indicator function $1_n(i)$ returns $1$ if session $n$ contains item $i$ and $0$ otherwise. If an item $s_x$ is the most recent item of the current session and it also appears in the neighbor session $n$, then the weight is defined as $w_n(s)=x/|s|$, where the index $x$ indicates the position of $s_x$ within the session. Hence, the weight increase depends on the position of an item that appears in both sessions, while the more recent position in the current session gains a higher weight. More information can be found in \cite{ludewig2018evaluation}. To re-rank recommendations and favor semantically related items, we extend the scoring function by the semantic factor: $$score_{cSkNN}(i,s) =score_{S-SkNN}(i,s) + c_s(i)$$ where $c_s(i)$ returns $1$ if an item $i$ is relevant to semantics given by $s$ and $0$ otherwise. Since the S-SkNN score is normalized into a range of $<0,1>$, the $c_s(i)$ factor assures the semantically relevant items to appear at the beginning of the recommendation list. We evaluate two different implementations of the semantic factor functions which differ in the complexity of generating a semantic cluster candidate. \subsection{Semantic candidates by the last action \label{sec:last-semantics}} Based on the assumption that semantics does not change along with several actions, we evaluate a version of a model that favors items semantically related to the last known action. As a downside, the semantic factor function suggests wrong semantics at each beginning of a coherent sub-sequence. On the other hand, it is able to adapt immediately and there is some assurance that it will be correct for several following actions while it depends on the quality of semantic clusters. In our interaction data, the average length of semantically coherent sub-sequences is roughly from $1.5$ to $3.8$, depending on the clusters' configuration. In this version, $c_s(i)$ returns $1$ if $cmap(i)$ equals to $cmap(s_{|s|})$, where $s_{|s|}$ is the last known action in the session $s$. \subsection{Prediction of semantic candidates \label{sec:predicted-semantics}} Semantics is derived not only from the last known action but rather from the entire session. During the training phase, another S-SkNN instance is trained on the train sessions mapped on semantic clusters from a particular $C$ configuration using the $cmap(i)$ function. The instance can be then used for the prediction of the next immediate semantic cluster. To make an effect with semantic filtering, we have to rely on the top-1 prediction according to semantic-level dependencies, which is used to improve the score of semantically related items in the items’ recommendation list. Therefore, $c_s(i)$ returns $1$ if $cmap(i)$ equals to a semantic cluster given by top-1 prediction using $score_{S-SkNN}(c, s')$, where $c \in C$ and $s'$ is the current session mapped onto the configuration $C$. \section{Experiments} \subsection{Dataset} We conducted our experiments on a fashion e-commerce dataset that contains approx. 572k actions in 100k sessions in a period of 14 days. The number of users is unknown since sessions are anonymous, therefore, only short-term dependencies within an individual session can be analyzed. The dataset is very sparse, the density calculated by session-item interactions is 0.011\%. The dataset contains approx. 155k products organized into 366 categories of shallow hierarchical structure with the top-level categories dividing items by the gender and age diversity dimensions, i.e., women, men, girls, and boys. The lower 3 levels divide items by the parts of the outfit, e.g., shirts, shoes, or accessories. Although our semantic analysis is based on all of the items, only 39k of them are used in the interaction data. As the texts are in the Czech language, we used UDPipe tool with Czech model \cite{udpipe:2017} for dependency parsing. \subsection{Evaluation protocol} We use an evaluation scheme in which the task is to predict the immediate next item given the first $n$ actions of a session. For each session, we iteratively increment $n$ and make predictions. This simulates user activity. Each time a prediction is made, we measure two popular top-k metrics in recommender systems, namely: hit rate (HR@k) and Mean Reciprocal Rank (MRR@k) for a set of \textit{k} values. HR measures the proportion of cases having the true item amongst the top-k items, which is a suitable metric for certain scenarios where absolute order of recommendations does not matter. MRR is important in cases where the order of recommendations matters, which is our case since the main purpose of our task is to re-rank items and to prefer items by the semantics of the current user intent. Both the reciprocal rank and hit rate are set to zero if the rank is above \textit{k}. The dataset is divided into random train and test subsets on the level of sessions in a ratio of 80:20, each configuration is evaluated on the same train-test sample. For the comparison, the following types of recommenders are reported: \begin{itemize} \item {\bfseries baseline}: a vanilla S-SkNN model without the semantic factor with a random sampling of 1000 neighboring sessions to speed up the prediction. Therefore, we cached the scores outputs given by $score_{S-SkNN}(i,s)$ and used them in the evaluation of all semantic configurations and methodology versions. \item {\bfseries last semantics}: a cSkNN model using the last seen semantics as described in Section \ref{sec:last-semantics}. \item {\bfseries predicted semantics}: a cSkNN model using the semantics predicted by the entire session as described in Section~\ref{sec:predicted-semantics}. Different S-SkNN instance is trained for each semantic clusters configuration separately. Only 25\% of the most recent actions in the train set is used to train the semantics prediction since more of the data did not lead to significant improvement because generalization produces a large number of identical sequences. \item {\bfseries potential}: to show the maximum theoretical improvement, we employ a version of the $c_s(i)$ function whereby it uses the true next immediate semantic cluster via a leak from the future. \end{itemize} For all schemes with the semantic factor, we re-rank top-50 recommendations generated by the baseline model. \subsection{Results} The evaluation showed that semantic post-filtering increases the performance even though the semantic prediction accuracy is relatively low. One of the most important takeaways is that the generalization via NLP has a higher potential for improving recommendations compared to the popular bag-of-words approach which is manifested by configuration \#4. Table~\ref{tab:conf-all-k} shows that MRR is improved in higher rates compared to HR, i.e., the method does not find more of the relevant items but ranks them better. Figure~\ref{fig:conf-effects} shows noticeable differences between configurations which convey high-level concepts given by only \textit{nmods} (\#1, \#2) and the other configurations that use also \textit{amods} (\#3, \#4). Configurations \#1 and \#2 provide consistently higher MRR@1 uplift than \#3 and \#4. We believe it is because the former omit low-level features (qualities such as colors etc.) that can be derived from the item-level dependencies but cause undesirable merging on the level of semantics. Just as is the case of \#3, if conceptually unrelated items are merged because of their identical appearance quality aspects, clusters must be large enough to create coherent sub-sequences in the browsing behavior. Although large clusters are easier to predict since their quantity declines with the growing size, the trade-off is unfavorable in this setup because the larger clusters the lower potential for the performance uplift. Configurations \#3 and \#4 display MRR growth (Fig.~\ref{fig:conf-effects}a,b) stopping at the point where clusters become too large and their potential consequently starts to decrease significantly (Fig.~\ref{fig:conf-effects}c). The last semantics scheme improves performance in all cases. It benefits from the length of intrasession coherence, however, results show a strong negative correlation between the coherence and the performance uplift for \#1 and \#2; and weak positive correlation for \#3 and \#4. This means that conceptual coherence is inherently given by user behavior and increasing it artificially by employing larger semantic clusters is not inevitably beneficial as can be also seen in Table~\ref{tab:conf-results-overall}. \begin{figure}[t] \centering \includegraphics[width=\linewidth]{assets/eps_plot.pdf} \caption{Comparison of generalization effects produced by the combination of different NLP parsing configurations and $\epsilon$ parameter of DBSCAN clustering. Line charts show different values given by the growth of $\epsilon$ for each generalization configuration. Configurations using high-level concepts (\#1 and \#2) have stronger linear correlation of $\epsilon$ with metric uplift in all semantic recommendation schemes.} \label{fig:conf-effects} \Description{} \end{figure} On the other hand, we noticed many cases of concepts alternating in sequences, e.g, $[a,a,b,a,b,a]$, what incapacitates advantages of the last semantics scheme, therefore, improving coherence by also incorporating information about interactions among the concepts prior to the clustering process could help. In this scheme, the $c_s(i)$ function accuracy calculated as HR@1 is only $\sim$35\% for the best clustering configurations. Despite flaws that arise from dynamics, this scheme ensures providing the correct semantic cluster within the coherent window regardless of the cluster's size or popularity which is not the case in the predicted semantics scheme. Also, the predicted semantics scheme improves performance though in smaller rates. The \mbox{top-1} cluster prediction accuracy is roughly the same as in the last semantics scheme with small fluctuations around $\pm$1-2\%. Nevertheless metrics uplift is in most cases lower, because large clusters that provide lower utility are often predicted since the SkNN models tend to suffer from the popularity bias. Moreover, it might have trouble predicting the same cluster several times in case of a longer coherent semantic window. Therefore, this scheme is less suitable for the next-item prediction but it could be useful in different use case scenarios as discussed in Section~\ref{sec:discussion}. In our settings, the semantic post-filtering has the potential to double the performance (Fig.~\ref{fig:conf-effects}c). However, the best performing mappings utilized only up to $\sim$20\% of the potential as shown in Table~\ref{tab:conf-results-overall}. Hence, there is still the opportunity for improvement of the semantic factor function $c_s(i)$. \begin{table}[t] \caption{The results for the best mapping in each configuration and its characteristics in the means of average cluster size and average length of coherent sub-sequences. The table shows achieved performance uplifts and compares them to the maximum theoretical potential given by the dedicated scheme. Also the rate of the potential utilization is shown. Note that at k=1, MRR and HR are equal.} \label{tab:conf-results-overall} \begin{tabular}{lccclcc} \toprule \multicolumn{1}{l}{} & Conf. & \thead{Avg. \\ coherence} & \thead{Avg. \\ cluster size} & \thead{MRR@1 \\ HR@1} & \thead{Potential \\ MRR@1} & \thead{Utilized \\ potential} \\ \midrule baseline && 1.15 & 1 & 3.20\% & - & - \\ \hline last & \#1 & 1.77 & 18 & 4.09\% (+27.93\%) & 7.38\% & 21.37\% \\ & \#2 & 1.78 & 19 & \textbf{4.13\% (+29.12\%)} & 7.28\% & 22.82\% \\ & \#3 & 1.63 & 14 & 3.79\% (+18.48\%) & 7.95\% & 12.45\% \\ & \#4 & 2.07 & 19 & 3.81\% (+19.05\%) & 6.40\% & 19.04\% \\ \hline predicted & \#1 & 1.78 & 21 & \textbf{3.81\% (+18.98\%)} & 7.35\% & 14.62\% \\ & \#2 & 1.78 & 19 & 3.76\% (+17.62\%) & 7.28\% & 13.81\% \\ & \#3 & 3.54 & 135 & 3.64\% (+13.93\%) & 4.27\% & 41.53\% \\ & \#4 & 3.62 & 319 & 3.66\% (+14.46\%) & 4.08\% & 52.66\% \\ \bottomrule \end{tabular} \end{table} \begin{table}[t] \caption{The results for the best mapping in each configuration. The table shows achieved relative performance uplifts compared to the baseline. The best results are highlighted for each metric and scheme. Note that at k=1, MRR and HR are equal.} \label{tab:conf-all-k} \begin{tabular}{lcrrrrr} \toprule & Conf. & MRR@1 & MRR@10 & MRR@20 & HR@10 & HR@20 \\ \midrule baseline & & 3.20\% & 5.53\% & 5.62\% & 10.84\% & 12.16\% \\ \hline last & \#1 & +27.93\% & +16.56\% & +15.86\% & +4.27\% & +1.14\% \\ & \#2 & \textbf{+29.12\%} & \textbf{+17.19\%} & \textbf{+16.47\%} & \textbf{+4.39\%} & +1.57\% \\ & \#3 & +18.48\% & +9.30\% & +8.92\% & +3.59\% & \textbf{+1.63\%} \\ & \#4 & +19.05\% & +10.28\% & +9.85\% & +3.69\% & \textbf{+1.63\%} \\ \hline predicted & \#1 & \textbf{+18.98\%} & \textbf{+11.29\%} & \textbf{+10.71\%} & +3.56\% & +0.84\% \\ & \#2 & +17.62\% & +10.31\% & +9.79\% & +3.18\% & +1.48\% \\ & \#3 & +13.93\% & +8.86\% & +8.50\% & +3.32\% & \textbf{+1.57\%} \\ & \#4 & +14.46\% & +9.36\% & +8.94\% & \textbf{ +3.59\%} & +1.54\% \\ \bottomrule \end{tabular} \end{table} \section{Discussion and conclusions \label{sec:discussion}} In this paper, we presented a proof-of-concept method that allows better adaptation of the next-item recommendations to the user interest via the semantics derived from product titles. The main contribution is the finding that the item generalization based on semantic analysis appears to provide a high potential for improving the recommendations. We extended a popular session-based k-NN recommendation model to prototype our idea, though it is not limited to any kind of model. We employed the dependency parsing technique to identify head-dependent relations in a noun phrase describing an item and to extract only the most salient words that convey high-level concepts. The results of our experiments conducted on a fashion e-commerce dataset showed that omitting adjunct words describing low-level quality aspects of items, such as colors, leads to better items ranking in recommendation list when using text features to improve model performance. The experiments showed that NLP based semantic analysis has significant potential in improving recommendations, from which the large part is not utilized yet. In the future, we plan to design the interest change detection as a binary task that can use behavioral data or other events, such as category view or add to cart, to switch between the last and the predicted semantics schemes. Furthermore, we plan implementation for the neural-network-based method, for which a latent representation can also be envisioned that would allow us to handle headwords and modifiers in a more flexible way. We believe that the quality of semantic clusters and their positive effects on the performance can be improved even further. We identified several complications emerging from the nature of the text that had a bad influence on dependency parsing. The crucial part is to identify the root headword correctly, which is problematic when the root is a multiword expression, such as \textit{skinny jeans}. Also, the correct root headword may be misleading in some cases, e.g., \textit{pair of socks} would be inconveniently matched with \textit{pair of gloves} because of the common root \textit{pair}. Sometimes redundant words are used, e.g., \textit{woman dress} in a woman category is no different from products that do not contain the word \textit{woman}. The semantic analysis must be able to deal with copywriters' different styles, e.g., \textit{red dress} and \textit{dress in red color} have a different constitution but essentially the same meaning. We did not put effort into resolving these so a more comprehensive semantic analysis might provide a higher improvement. Although we evaluated the proposed method on the next-item prediction task, it can be also used in different scenarios, e.g., as a shopping cart page recommendation strategy. After a user adds an item to the cart, top-n next-concept prediction can be used to split recommended items into \textit{n} recommendation lists for each concept separately, while we can rely upon that the sequential dependencies from the preceding browsing behavior would be also considered. \begin{acks} This work was partially supported by the Slovak Research and Development Agency under the contract No. APVV-15-0508 and the Scientific Grant Agency of the Slovak Republic, grant No. VG 1/0667/18. The authors would like to thank for financial contribution from the STU Grant scheme for Support of Young Researchers. \end{acks} \bibliographystyle{ACM-Reference-Format}
{'timestamp': '2020-12-17T02:12:22', 'yymm': '2012', 'arxiv_id': '2012.08793', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08793'}
arxiv
\section{Proof of~\Cref{thm:lower-bound-intro} In this section, we prove the following theorem: \begin{theorem}[Tolerant testing of DTs $\Rightarrow$ Proper learning of DTs] \label{thm:lower-bound} Let $c > 0$ be an absolute constant and $\mathcal{A}$ be an algorithm with the following guarantee. Given query access to $f: \bn \to \bits$ and parameters $s \in \N $ and $\eps \in (0,1)$, the algorithm $\mathcal{A}$: \begin{itemize} \item[$\circ$] Accepts w.h.p.~if $f$ is $\eps$-close to a size-$s$ decision tree; \item[$\circ$] Rejects w.h.p.~if $f$ is $(c\eps)$-far from all size-$s$ decision trees. \end{itemize} Then there is an algorithm $\mathcal{B}$ with the following guarantee. Given parameters $s' \in \N$ and $\eps' \in (0,1)$, and query access to a function $g : \bn\to\bits$ that is computed by a size-$s'$ decision tree, $\mathcal{B}$ makes $\poly(s', n, 1/\eps')$ calls to $\mathcal{A}$, each with parameters $s \leq s'$ and $\eps \ge \poly(1/s',\eps')$, and produces a decision tree which is $\eps'$-close to $g$ with high probability. Furthermore, the auxiliary computation that $g$ does takes time $\poly(n, s', 1/\eps')$. \end{theorem} \Cref{thm:lower-bound-intro} follows as a special case of \Cref{thm:lower-bound}. We prove~\Cref{thm:lower-bound} in two steps: \begin{enumerate} \item A tolerant tester implies an algorithm for estimating the distance of any function to the class of size-$s$ decision trees. This is well known~\cite{PRR06} and applies to any function class, not just decision trees. \item An algorithm for estimating distance to decision trees implies a proper learner for decision trees. Here, we take advantage of the structure of decision trees. \end{enumerate} For a function $g : \bn\to\bits$ and $s\in \N$, we write $\opt_s(g)$ to denote the distance of $g$ to the closest size-$s$ decision tree. \begin{lemma}[Tolerant testing $\Rightarrow$ distance estimation~\cite{PRR06}] \label{lem:distance-estimator} Let $c$ and $\mathcal{A}$ be as in \Cref{thm:lower-bound}. There exists an estimator $\mathcal{E}$ with the following guarantee. Given query access to $g: \bn \to \bits$ and parameters $s' \in \N$ and $\gamma \in (0,1)$, the estimator $\mathcal{E}$ makes $c/\gamma$ calls to $\mathcal{A}$ and returns an $\boldeta$ that with high probability satisfies \[ \boldeta \leq \opt_s(g) \leq c \cdot \boldeta + \gamma. \] Furthermore, the auxiliary computation of $g$ takes time $O(c/\gamma)$. \end{lemma} \Crefname{enumi}{Step}{Steps} \begin{proof} The algorithm $\mathcal{E}$ runs $\mathcal{A}$ with $\eps = \frac{\gamma}{c}, \frac{2\gamma}{c}, \frac{3\gamma}{c},\ldots, 1$, and sets $\boldeta$ to be the largest $\eps$ for which $\mathcal{A}(g, s, \eps)$ rejects. Since $\mathcal{A}(g, s, \boldeta)$ rejected, \[ \boldeta < \opt_s(g)\] with high probability. Furthermore, since $\mathcal{A}(g, s, \boldeta + \frac{\gamma}{c})$ accepted, \begin{align*} \opt_s(g) &< c \cdot \big(\boldeta + \lfrac{\gamma}{c}\big) \\ &= c \cdot \boldeta + \gamma \end{align*} with high probability. Finally, we note that $\mathcal{E}$ indeed makes $c/\gamma$ calls to $\mathcal{A}$, and aside from those calls, it only needs to make a single pass over the output of those calls and return the largest $\eps$ that led to a rejection, which takes time $O(c/\gamma)$. \end{proof} We are now ready to state our algorithm, $\textsc{BuildDT}$ (\Cref{fig:BuildDT}), for properly learning size-$s'$ decision trees. $\textsc{BuildDT}$ will additionally take in a depth parameter $d$ that will facilitate our analysis of it (looking ahead, $d$ will be chosen to be $O(\log(s'/\eps'))$ in our proof of~\Cref{thm:lower-bound}). \begin{figure}[h] \captionsetup{width=.9\linewidth} \begin{tcolorbox}[colback = white,arc=1mm, boxrule=0.25mm] \vspace{3pt} $\textsc{BuildDT}(f,s,d,\gamma)$: \begin{enumerate}[align=left] \item[\textbf{Input:}] Query access to $f: \bn \to \bits$, parameters $s,d\in \N$ and $\gamma \in (0,1)$. \item[\textbf{Output:}] A size-$s$ depth-$d$ decision tree $T$. \end{enumerate} \begin{enumerate} \item \label{alg-base-case} If $s = 1$ or $d = 0$, return $\sign(\E[f])$. \item For each $i \in [n]$ and integers $s_0, s_1 \geq 1$ satisfying $s_0 + s_1 = s$: \begin{enumerate} \item \label{subroutine} Use $\mathcal{E}$ from~\Cref{lem:distance-estimator} to obtain estimates $\boldeta(x_i=0,s_0)$ and $\boldeta(x_i=1,s_1)$ that satisfy: \begin{align*} \boldeta(x_i=0,s_0) \leq \opt_{s_0}(f_{x_i = 0}) \leq c \cdot \boldeta(x_i=0,s_0) + \gamma; \\ \boldeta(x_i=1,s_1) \leq \opt_{s_1}(f_{x_i = 1}) \leq c \cdot \boldeta(x_i=1,s_1) + \gamma. \end{align*} \item Store $\mathrm{error}(i, s_1, s_2) \leftarrow \frac{1}{2} \big(\boldeta(x_i=0,s_0) + \boldeta(x_i=1,s_1)\big)$. \end{enumerate} \item \label{minerror} Let $(i^\star, s_0^\star, s_1^\star)$ be the tuple that minimizes $\mathrm{error}(i, s_0, s_1)$. Output the tree with $x_{i^\star}$ as its root, $\textsc{BuildDT}(f_{x_{i^\star} = 0}, s_0^\star, d-1,\gamma)$ as its left subtree, and $\textsc{BuildDT}(f_{x_{i^\star} = 1}, s_1^\star, d-1,\gamma)$ as its right subtree. \end{enumerate} \end{tcolorbox} \caption{$\textsc{BuildDT}$ computes a size-$s$ depth-$d$ decision tree that approximates a target function $f: \bn \to \bits$.} \label{fig:BuildDT} \end{figure} \begin{lemma}[Error of $\textsc{BuildDT}$] \label{lemma:build-dt-error} For all functions $f: \bn \to \bits$ and parameters $s,d \in \N$ and $\gamma\in (0,1)$, the algorithm $\textsc{BuildDT}(f,s,d,\gamma)$ outputs a decision tree $T$ satisfying \begin{align} \label{eq:buildDT-accuracy} \dist(T, f) \leq c^d \cdot \opt_s(f) + \gamma \cdot \frac{c^d - 1}{c-1} + \frac{s}{2^{d+2}}. \end{align} \end{lemma} \begin{proof} We proceed by induction on $s$ and $d$. If $s = 1$, then in \Cref{alg-base-case}, \textsc{BuildDT}\ outputs the best decision tree of size $1$. Therefore, $\dist(T,f) \leq \opt_s(f)$, satisfying \Cref{eq:buildDT-accuracy}. If $d = 0$ and $s \geq 2$, then $\frac{s}{2^{d+2}} \geq \frac{2}{4} = \frac1{2}$. Furthermore, in \Cref{alg-base-case}, \textsc{BuildDT}\ always outputs a tree with error at most $\frac{1}{2}$. Therefore, \[ \dist(T, f) \leq \frac{s}{2^{d+2}} \leq c^d \cdot \opt_s(f) + \gamma \cdot \frac{c^d - 1}{c-1} + \frac{s}{2^{d+2}}.\] Finally, we consider the case where $d \geq 1$ and $s \geq 2$. Let $T_{\opt}$ be the size-$s$ decision tree that is $\opt_s(f)$ close to $f$. Let $x_{i_{\opt}}$ the root of $T_{\opt}$, and $s_{0, \opt}$, $s_{1, \opt}$ the sizes of the left and right subtrees of $T_{\opt}$ respectively. Since the estimates computed in \Cref{subroutine} are underestimates of or equal to the true error (i.e.~$\mathrm{error}(i_{\opt}, s_{0, \opt}, s_{1, \opt}) \leq \opt_s(f)$), and since $i^\star, s_0^\star, s_1^\star$ are chosen in~\Cref{minerror} to minimize the estimated error, we have \[ \mathrm{error}(i^\star, s_0^\star, s_1^\star) \leq \mathrm{error}(i_{\opt}, s_{0, \opt}, s_{1, \opt}) \leq \opt_s(f). \] Finally, we bound $\dist(T, f)$. Let $T_0$ and $T_1$ be the left and right subtrees of $T$. Then, \begin{align*} \dist(T, f) &= \lfrac{1}{2} \big(\dist(T_0, f_{x_{i^\star} = 0}) + \dist(T_1, f_{x_{i^\star} = 1}) \big) \\ &\leq \lfrac{1}{2} \ds \Big(c^{d-1} \cdot \opt_{s_0^\star}(f_{x_{i^\star} = 0}) + \gamma \cdot \frac{c^{d-1} - 1}{c-1} + \frac{s_0^\star}{2^{d+1}} \\ & \ \ \ \ + c^{d-1} \cdot \opt_{s_1^\star}(f_{x_{i^\star} = 1}) + \gamma \cdot \frac{c^{d-1} - 1}{c-1} + \frac{s_1^\star}{2^{d+1}} \Big) \tag{Inductive hypothesis} \\ &= c^{d-1} \cdot \lfrac{1}{2}\, \ds \big(\opt_{s_0^\star}(f_{x_{i^\star} = 0}) + \opt_{s_1^\star}(f_{x_{i^\star} = 1})\big) + \gamma \cdot \frac{c^{d-1} - 1}{c-1} + \frac{s_0^\star + s_1^\star}{2^{d+2}} \\ &\leq c^{d-1} \cdot \lfrac{1}{2} \ds \big((c \cdot \boldeta(x_{i^\star}=0,s_0^\star) + \gamma) + (c \cdot \boldeta(x_{i^\star} = 1, s_1^\star) + \gamma)\big) + \gamma \cdot \frac{c^{d-1} - 1}{c-1} + \frac{s}{2^{d+2}}\\ &= c^{d} \cdot \lfrac{1}{2} \ds \,\big(\boldeta(x_{i^\star} = 0, s_0^\star) + \boldeta(x_{i^\star} = 1, s_1^\star)\big) + c^{d-1} \cdot \gamma + \gamma \cdot \frac{c^{d-1} - 1}{c-1} + \frac{s}{2^{d+2}} \\ &= c^{d} \cdot \mathrm{error}(i^\star, s_0^\star, s_1^\star) + \gamma \cdot \frac{c^{d-1}(c-1) + c^{d-1} - 1}{c-1} + \frac{s}{2^{d+2}} \\ &\leq c^d\cdot \opt_s(f) + \gamma \cdot \Big(\frac{c^d - 1}{c-1}\Big) + \frac{s}{2^{d+2}}. \end{align*} The desired result holds by induction. \end{proof} For readability, \Cref{lemma:build-dt-error} assumes that $\textsc{BuildDT}$ is able to compute $\mathrm{round}(\E[f])$ in \Cref{alg-base-case}. To make $\textsc{BuildDT}$ efficient, we would only estimate $\E[f]$ by querying $f$ on uniform random inputs $\bx \in \bn$. If those estimates are computed to accuracy $\eps'$, then each leaf of our tree can have up to $\eps'$ additional error. This is not an issue since it increases the total error of $T$, which is simply the average of the error at each leaf, by only $\eps'$. Finally, we prove \Cref{thm:lower-bound}: \begin{proof}[Proof of \Cref{thm:lower-bound}] Our goal is to properly learn a size-$s'$ decision tree $g: \bn \to \bits$ to accuracy $\eps'$. To do so, we run $\textsc{BuildDT}(g, s',d,\gamma)$, with $d$ set to \begin{align*} d = \log(s'/\eps') - 1, \end{align*} and $\gamma$ set to \[ \gamma = \frac{\eps'}{2 \cdot \max(2, c)^d} = \frac{\eps'}{2} \cdot (2^{-d})^{\max(1, \log c)} = \frac{\eps'}{2} \cdot \left(\frac{\eps'}{s'}\right)^{\max(1, \log c)}. \] By \Cref{lemma:build-dt-error}, for $T$ the tree $\textsc{BuildDT}$ outputs, \begin{align*} \dist(T,g) &\leq c^d \cdot \opt_{s'}(g) + \gamma \cdot \frac{c^d - 1}{c-1} + \frac{s'}{2^{d+2}} \\ &\leq 0 + \frac{\eps'}{2 \cdot \max(2, c)^d} \cdot \max(2, c)^d + \frac{s'}{2^{\log(s'/\eps') + 1}} \\ & \leq \frac{\eps'}{2} + \frac{\eps'}{2} = \eps'. \end{align*} Hence, $\textsc{BuildDT}$ produces the desired output. We next argue that it is efficient. During the recursion, $\textsc{BuildDT}$ is called at most $s'$ times in total. Each such call makes $O(ns')$ calls to $\mathcal{E}$. By \Cref{lem:distance-estimator}, those calls to $\mathcal{E}$ each make $c/\eps$ calls to $\mathcal{A}$. Hence, the total number of calls to $\mathcal{A}$ is \begin{align*} O\left(\frac{n(s')^2}{\gamma}\right) = O\left(\frac{n (s')^2}{\eps'} \cdot \left(\frac{s'}{\eps'}\right)^{\max(1 ,\log c)}\right) = \poly(n,s',1/\eps'). \end{align*} The total auxiliary computation of $\textsc{BuildDT}$ is bounded by the same quantity. Finally, each call to $\mathcal{A}$ is made with parameters $s$ and $\eps$ where $s \leq s'$ and $\eps = \frac{\eps'}{2} \cdot \left(\frac{\eps'}{s'}\right)^{\max(1, \log c)} \ge \poly(1/s',\eps')$. \end{proof} \Crefname{enumi}{Item}{Item} \subsection{Algorithmic component of~\Cref{thm:reconstruct}} \label{sec:algorithmic} \subsubsection{Query-efficient simultaneous score estimation} \label{sec:score-estimator} We begin by designing a query-efficient subroutine that simultaneously estimates the scores of all~$n$ variables of a function $f$. The fact that we are able to do so with $O(\log n)$ queries, as opposed to $\Omega(n)$ as would be required by a naive approach, will be a key component in the query efficiency of our reconstructor. \begin{theorem}[Score estimator] \label{thm:score-estimator} There is an algorithm which, given query access to a function $f: \bits^n \to \bits$, noise rate $p \in (0,1)$, accuracy parameter $\tau \in (0,1)$, and confidence parameter $\delta \in (0,1)$, for \[ q = O\left(\frac{\log n + \log(1/\delta)}{\tau^2} \right) \] makes $O(q)$ queries, runs in $O(q n)$ time, and returns estimates $\boldeta_1, \ldots, \boldeta_n$ such that, with probability at least $1 - \delta$, satisfies \[ \big| \boldeta_i - \mathrm{Score}_i(f, p) \big | < \tau \quad \text{for all $i \in [n]$}. \] \end{theorem} We prove~\Cref{thm:score-estimator} by first giving a $2$-query algorithm, $\textsc{UnbiasedEstimator}$ (\Cref{fig:UnbiasedEstimator}), that runs in $O(n)$ time and outputs unbiased estimates of all $n$ scores. The algorithm of \Cref{thm:score-estimator} takes the mean of multiple runs of that unbiased estimator, with its guarantees following from a simple concentration bound. \begin{figure}[h] \captionsetup{width=.9\linewidth} \begin{tcolorbox}[colback = white,arc=1mm, boxrule=0.25mm] \vspace{3pt} $\textsc{UnbiasedEstimator}(f,p)$: \begin{enumerate}[align=left] \item[\textbf{Input:}] Query access to a function $f: \bits^n \to \bits$ and a noise rate $p \in (0,1)$. \item[\textbf{Output:}] Unbiased estimates of $\mathrm{Score}_i(f, p)$ for all $i \in [n]$. \end{enumerate} \begin{enumerate} \item Choose $\bx \in \bits^n$ uniformly at random and generate a $p$-noisy copy $\by$ of $\bx$. \item For each $i \in [n]$, return the estimate \begin{align*} \boldeta_i = \Ind\big[f(\bx) \neq f(\by)\big] \cdot \left (1 - \frac{1}{1 - \frac{p}{2}} \cdot \Ind[\bx_i = \by_i]\right). \end{align*} \end{enumerate} \end{tcolorbox} \caption{$\textsc{UnbiasedEstimator}$ computes unbiased estimates of the scores of all variables of a function $f$.} \label{fig:UnbiasedEstimator} \end{figure} \begin{lemma}[Analysis of $\textsc{UnbiasedEstimator}$] \label{lemma:unbiased-estimates} For any $f: \bits^n \to \bits$ and $p \in (0,1)$, let $\boldeta_1, \ldots, \boldeta_n$ be the outputs of $\textsc{UnbiasedEstimator}(f, p)$. Then \begin{align*} \Ex_{\bx, \by}[\boldeta_i] = \mathrm{Score}_i(f, p) \quad \text{for all $i\in [n]$.} \end{align*} \end{lemma} \begin{proof} We first note that $\Pr[f(\bx) \neq f(\by)]$ is $\NS_p(f)$ by definition. Therefore, it is enough for us to prove that \begin{align} \label{eq:unbiased-estimator} \Ex_{\bb \in \bits}\big[\NS_{p}(f_{x_i = \bb})\big] = \frac{1}{1 - \frac{p}{2}} \cdot \Prx_{\bx, \by}\left[f(\bx) \neq f(\by) \text{ and } \bx_i = \by_i\right]. \end{align} Given the above equation, the desired result holds by linearity of expectation and the definition of score. Consider the distribution over $(\bx, \by)$ conditioned on the event that $b = \bx_i = \by_i$. That distribution is equivalent to if we picked $\bx$ randomly from the domain of $f_{x_i = b}$ and selected $\by$ by rerandomizing each coordinate in that domain with probability $p$. Therefore, \begin{align*} \NS_{p}(f_{x_i = b}) &= \Prx_{\bx, \by}[f(\bx) \neq f(\by) \,|\, b= \bx_i = \by_i] \\ &= \frac{1}{\Prx_{\bx, \by}[b= \bx_i = \by_i]}] \cdot \Prx_{\bx, \by}[f(\bx) \neq f(\by) \text{ and } b= \bx_i = \by_i]. \end{align*} We now prove \Cref{eq:unbiased-estimator}: \begin{align*} \Ex_{\bb \in \bits}\big[\NS_{p}(f_{x_i = \bb})\big] &= \Ex_{\bb \in \bits}\left[\frac{1}{\ds\Prx_{\bx, \by}[\bb= \bx_i = \by_i]}] \cdot \Prx_{\bx, \by}[f(\bx) \neq f(\by) \text{ and } \bb= \bx_i = \by_i]\right] \\ &=\frac{1}{\frac{1}{2} \cdot \ds\Prx_{\bx, \by}[ \bx_i = \by_i]}\Ex_{\bb \in\bits}\left[\Prx_{\bx, \by}[f(\bx) \neq f(\by) \text{ and } \bb= \bx_i = \by_i]\right] \\ &=\frac{1}{\frac{1}{2} \cdot (1 - \frac{p}{2})} \cdot \lfrac{1}{2} \cdot \ds\Prx_{\bx, \by}\left[f(\bx) \neq f(\by) \text{ and } \bx_i = \by_i\right] \\ &= \frac{1}{1 - \frac{p}{2}} \cdot \Prx_{\bx, \by}\left[f(\bx) \neq f(\by) \text{ and } \bx_i = \by_i\right]. \end{align*} \Cref{lemma:unbiased-estimates} then holds by linearity of expectation. \end{proof} We now prove \Cref{thm:score-estimator}. \begin{proof}[Proof of \Cref{thm:score-estimator}] The algorithm runs $\textsc{UnbiasedEstimator}(f, p)$ $q$ times and then outputs the means of each returned estimates. Each estimate from $\textsc{UnbiasedEstimator}$ is bounded between $-1$ and $1$. By Hoeffding's inequality, for any $i \in [n]$, \begin{align*} \Pr\big[\big| \boldeta_i - \mathrm{Score}_i(f, p) \big | \geq \tau\big] \leq -\exp_e\left(-\frac{q \cdot \tau^2}{2}\right). \end{align*} For $q$ as in \Cref{thm:score-estimator}, the above probability is at most $\delta/n$. By union bound, all estimates are accurate within $\pm\tau$ with probability at least $1 - \delta$. Finally, this algorithm uses only $2q = O(q)$ queries. Each run of $\textsc{UnbiasedEstimator}$ estimator takes $O(n)$ time to construct the query and compute all the estimates, so the entire algorithm takes $O(q n)$ time. \end{proof} \subsubsection{Proof of \Cref{thm:reconstruct}} \label{sec:proof-of-reconstruct} We prove \Cref{thm:reconstruct} by providing an algorithm, $\textsc{Reconstructor}$ (\Cref{fig:BuildStrand}), which assumes query access to a function $f : \bn\to\bits$ and provides fast query access to a tree $T$ meeting the criteria of \Cref{thm:reconstruct}. We build off a simple observation that also underlies \cite{BGLT-NeurIPS2}: to determine the output of a decision tree $T$ on a particular input~$z$, it suffices to build the root-to-leaf path corresponding to~$z$, which can be exponentially faster than building the entire tree. Our algorithm is different from~\cite{BGLT-NeurIPS2}'s; as mentioned in the introduction their algorithm is tailored to monotone functions, and is known to fail for non-monotone ones. We on the other hand leverage the specific structure of $T$ established in~\Cref{sec:structural} together with the query-efficient score estimator from~\Cref{sec:score-estimator} in our design and analysis of $\textsc{Reconstructor}$. $\textsc{Reconstructor}$ maintains a partial tree $T^\circ$ containing all the root-to-leaf paths in $T$ corresponding to queries received so far. In the pseudocode for $\textsc{Reconstructor}$, we use the notation $T^\circ_{\mathrm{internal}}(\alpha) \in [n] \cup \{\varnothing\}$ to indicate the variable queried in $[n]$ at internal node $\alpha$ of the partial tree $T^\circ$, or $\varnothing$ if that node has not yet been built. Similarly, $T^\circ_{\mathrm{leaf}}(\alpha) \in \{-1,1,\varnothing\}$ indicates the value at leaf $\alpha$ in $T^\circ$, or $\varnothing$ if that value has not yet been decided. \Crefname{enumi}{Step}{Steps} \begin{figure}[h] \captionsetup{width=.9\linewidth} \begin{tcolorbox}[colback = white,arc=1mm, boxrule=0.25mm] \vspace{3pt} $\textsc{Reconstructor}(f, s, \eps, \delta)$: \begin{enumerate}[align=left] \item[\textbf{Input:}] Query access to a function $f: \bits^n \to \bits$, size parameter $s$, error parameter $\eps$, and failure probability $\delta$. \item[\textbf{Output:}] Query access to a decision tree $T$ that satisfies $\dist(f, T) \leq O(\opt_s) + \eps$ with probability at least~$1-\delta$. \end{enumerate} \begin{enumerate} \item Set parameters $d, p$, and $\tau$ as in~\Cref{lem:BGLT-approx}. \item Initialize $T^\circ$ to be the empty partial tree. \item Upon receiving an input $z \in \bits^n$: \begin{enumerate} \item Initialize $\alpha$ to be the root of $T^\circ$. \item Repeat $d$ times. \begin{enumerate} \item \label{step:score-estimate} If $T^\circ_{\mathrm{internal}}(\alpha)$ is $\varnothing$ use the estimator from \Cref{thm:score-estimator} to compute estimates of $\mathrm{Score}_i(f_{\alpha}, p)$ with additive accuracy $\pm \frac{\tau}{2}$ and failure probability $O(\frac{\delta}{2^d})$ for all $i \in [n]$ and set $T^\circ_{\mathrm{internal}}(\alpha)$ to the variable with highest estimated score. \item For $i = {T^\circ_{\mathrm{internal}}(\alpha)}$, If $\overline{z}_{i}$ is $1$, set $\alpha$ to its right child. Otherwise, set $\alpha$ to its left child. \end{enumerate} \item \label{step:leaf-estimate} If $T^\circ_{\mathrm{leaf}}(\alpha)$ is $\varnothing$, use random samples to estimate $\E[f_{\ell}]$ to additive accuracy $\pm \frac{\eps}{4}$ with failure probability $O(\frac{\delta}{2^d})$ and set $T^\circ_{\mathrm{leaf}}(\alpha)$ to whichever of $\bits$ that estimate is closer to. \item Output $T^\circ_{\mathrm{leaf}}(\alpha)$. \end{enumerate} \end{enumerate} \end{tcolorbox} \caption{$\textsc{Reconstructor}$ gives efficient query access to a decision tree is close to $f$ with high probability.} \label{fig:BuildStrand} \end{figure} \Cref{thm:reconstruct} follows from the following two lemmas, showing the correctness and efficiency of $\textsc{Reconstructor}$ respectively. \begin{lemma}[Correctness of $\textsc{Reconstructor}$] \label{lemma:reconstructor-correctness} For any $f: \bits^n \to \bits$, $s \in \N$, $\eps \in (0, \frac{1}{2})$, $\delta \in (0,1)$, and sequence of inputs $z^{(1)}, \ldots, z^{(m)}\in \bn$, the outputs of $\textsc{Reconstructor}$ are consistent with some decision tree $T$ where \begin{itemize} \item[$\circ$] $T$ has size $s^{O((\log s)^2/\eps^3)}$, \item[$\circ$] $\dist(T,f) \le O(\opt_s) + \eps$ with probability at least $1-\delta$. \end{itemize} \end{lemma} \begin{proof} The outputs of $\textsc{Reconstructor}$ are always consistent with $T^\circ$ and the depth of $T^\circ$ is always capped at $d$. Let $T$ be the tree that $T^\circ$ would be if every $x \in \bits^n$ were given as an input to $\textsc{Reconstructor}$. Then, $T$ has size at most $2^d = s^{O((\log s)^2/\eps^3)}$, and every output is consistent with $T$. If all score estimates in \Cref{step:score-estimate} are accurate to $\pm \frac{\tau}{2}$ and expectation estimates is \Cref{step:leaf-estimate} are accurate to $\pm \frac{\eps}{4}$, then $T$ meets the criteria of \Cref{lem:BGLT-approx} and therefore $\dist(T, f) \leq O(\opt_s) +\eps$. The number of time scores are estimated in \Cref{step:score-estimate} is at most the number of internal nodes of~$T$, which is $2^d - 1$. Similarly, the number of expectation estimates in \Cref{step:score-estimate} is at most the number of leaves of $T$, which is $2^d$. By union bound over the possible failures, we see that the failure probability is at most $\delta$. \end{proof} \begin{lemma}[Efficiency of $\textsc{Reconstructor}$]\label{lem:reconstruct-efficiency} For any $f: \bits^n \to \bits$, $s \in \N$, $\eps \in (0, \frac{1}{2})$, $\delta \in (0,1)$, particular input $z \in \bits^n$, and \begin{align*} q = O\left(\frac{(\log s)^9\cdot (\log n) \cdot \log(1/\delta)}{\eps^9} \right), \end{align*} upon receiving $z$ as input, $\textsc{Reconstructor}(f,s,\eps,\delta)$ uses $O(q)$ queries and $O(qn)$ time to return an output. \end{lemma} \begin{proof} On each input, the estimator from \Cref{thm:score-estimator} is used up to $d$ times. Each uses \begin{align*} q_{\mathrm{inner}} \coloneqq O\left(\frac{\log n + \log(2^d/\delta)}{\tau^2} \right) = O\left(\frac{\log n + d + \log(1/\delta)}{\tau^2} \right) \end{align*} queries and $O(q_\mathrm{inner}n)$ time. By Hoeffding's inequality, it is sufficient to take \begin{align*} q_{\mathrm{leaf}} \coloneqq O\left(\frac{\log(2^d/\delta)}{\eps^2} \right) = O\left(\frac{d + \log(1/\delta)}{\eps^2} \right) \end{align*} random samples in \Cref{step:leaf-estimate}. Therefore, the total number of queries used is \begin{align*} q &= q_{\mathrm{inner}} + q_{\mathrm{leaf}} \\ &= O\left(\frac{\log n + d + \log(1/\delta)}{\tau^2} \right) + O\left(\frac{d + \log(1/\delta)}{\eps^2} \right) \\ &= O\left(\frac{\log n + ((\log s)^3/\eps^3) + \log(1/\delta)}{\eps^6 /( \log s)^6} + \frac{((\log s)^3/\eps^2) + \log(1/\delta)}{\eps^2} \right)\\ &= O\left(\frac{(\log s)^9\cdot (\log n) \cdot \log(1/\delta)}{\eps^9} \right). \end{align*} The time to prepare all queries is $O(q n)$, and all other computation is asymptotically faster. \end{proof} \begin{remark}[Local reconstruction] \label{remark: local reconstruction} We remark that our reconstruction algorithm can be made local in the sense of \cite{SS10}. They define a reconstruction algorithm, $\mathcal{A}$, to be local, if the output of $\mathcal{A}$ on some input $z$ is a \emph{deterministic} and easy to compute function of $z$ and some small random string $\rho$. This allows queries to the reconstructor to be answered in parallel, as long as the random string $\rho$ is shared. To make our reconstructor local, we note that the only place randomness is used is in generating samples consistent with some restriction $\alpha$. We can set $\rho$ to be $n$ bits per sample the constructor might wish to generate. Since the total number of samples the reconstructor needs per input is $\poly(\log s, 1/\eps, \log(1/\delta))\cdot \log n$, we have \begin{align*} |\rho| = \poly(\log s, 1/\eps, \log(1/\delta))\cdot n\log n \end{align*} On a particular input, the local reconstructor starts with $T^\circ$ being the empty tree. Whenever it wishes to produce a random sample consistent with $\alpha$, it sets the $\bx \in \bits^n$ to be next $n$ bits of $\rho$ and then uses $\bx_{\alpha}$ for the sample. It's easy to see that this algorithm will keep $T^\circ$ consistent between different runs because it will always compute the same variable as having the highest score given some restriction. Furthermore, the analysis goes through without issue. The only difference between this analysis and one where fresh random bits are used to for each sample is that the queries of different paths may be correlated. In our proof of \Cref{lemma:reconstructor-correctness}, we use a union bound to ensure all estimates obtained through sampling are accurate, and that union bound holds regardless of whether those estimates are independent. \end{remark} \subsection{Proof of~\Cref{cor:main}} \label{sec:proof-of-tester} In this section we derive \Cref{cor:main} as a simple consequence of~\Cref{thm:reconstruct}. The connection between reconstruction and tolerant testing has been noted in other works (see e.g.~\cite{CGR13, B08}); we provide a proof here for completeness. \begin{theorem}[\Cref{cor:main} restated] There is an algorithm which, given query access to $f : \bn \to\bits$ and parameters $s\in\N$ and $\eps, \delta \in (0,1)$, runs in $\poly(\log s,1/\eps)\cdot n\log n\cdot \log(1/\delta)$ time, makes $\poly(\log s,1/\eps) \cdot \log n \cdot \log(1/\delta)$ queries to $f$, and \begin{itemize} \item[$\circ$] Accepts w.p.~at least $1 - \delta$ if $f$ is $\eps$-close to a size-$s$ decision tree; \item[$\circ$] Rejects w.p.~at least $1 - \delta$ if $f$ is $\Omega(\eps)$-far from size-$s^{O((\log s)^2/\eps^3)}$ decision trees \end{itemize} \end{theorem} \begin{proof} The algorithm chooses $m$ uniform random inputs, $\bx^{(1)}, \ldots, \bx^{(m)} \sim \bits^n$ where $m = O(\log(1/\delta)/\eps^2)$. Let $\bb^{(1)}, \ldots, \bb^{(m)} \in \bits$ be the output of $\textsc{Reconstructor}(f, s, \eps, \delta)$. The tester rejects if $\E_{\bi \in [m]}[f(\bx^{(\bi)}) \neq \bb^{(\bi)}] > \Omega(\eps)$ and accepts otherwise. First, we consider the case where $f$ is $\eps$-close to a size-$s$ decision tree (i.e.~$\opt_s \le \eps$). By \Cref{lemma:reconstructor-correctness}, with probability at least $1 - \delta$ the outputs of $\textsc{Reconstructor}$ are consistent with a tree, $T$, satisfying $\dist(T, f) \leq O(\eps)$. By Hoeffding's inequality, \[ \Prx_{\bx^{(1)}, \ldots, \bx^{(m)}}\left[\Ex_{\bi \in [m]}\big[f(\bx^{(\bi)}) \neq \bb^{(\bi)}\big] > \Omega(\eps)\right] \leq \exp(-2 m \eps^2) \le \delta.\] By a union bound, the tester rejects with probability at most $\delta + \delta = 2\delta$. We next consider the case where $f$ is $\Omega(\eps)$-far from size-$s^{O((\log s)^2/\eps^3)}$ decision trees. By \Cref{lemma:reconstructor-correctness} it is guaranteed to be consistent. A similar argument to the first case shows that the probability of acceptance is at most $\delta + \exp(-2 m \eps^2) = 2\delta$. Finally, the efficiency of this tester is a consequence of \Cref{lem:reconstruct-efficiency} and our choice of $m = O(\log(1/\delta)/\eps^2).$ \end{proof} \Crefname{enumi}{Item}{Item} \section{placeholder} blah blah blah \section{Proof of \Cref{cor:reconstruct-degree} We first restate~\Cref{thm:reconstruct} with decision tree {\sl depth} instead of {\sl size} as the complexity measure: \begin{theorem}[\Cref{thm:reconstruct} in terms of decision tree depth] \label{thm:reconstruct-depth} There is a randomized algorithm which, given query access to $f : \bn\to\bits$ and parameters $d\in \N$ and $\eps\in (0,1)$, provides query access to a fixed decision tree $T$ where \begin{itemize} \item[$\circ$] $T$ has depth $O(d^3/\eps^2)$, \item[$\circ$] $\dist(T,f) \le O(\opt_d) + \eps$ w.h.p., where $\opt_d$ denotes the distance of $f$ to the closest depth-$d$ decision tree. \end{itemize} Every query to $T$ is answered in $\poly(d,1/\eps)\cdot n\log n$ time and with $\poly(d,1/\eps)\cdot \log n$ queries to~$f$. \end{theorem} To see that our proof of~\Cref{thm:reconstruct} also establishes~\Cref{thm:reconstruct-depth}, we use the fact that every depth-$d$ decision tree has size $\le 2^d$, and recall that the tree $T$ that the algorithm of~\Cref{thm:reconstruct} provides query access to is a complete tree and hence has depth logarithmic in its size. Decision tree depth and Fourier degree of boolean functions are known to be polynomially related: \begin{fact}[Decision tree depth vs.~Fourier degree~\cite{Mid04,Tal13}] \label{fact:depth-vs-degree} For $g : \bn\to\bits$ let $\deg(g)$ denote $g$'s Fourier degree and $D(g)$ denote the depth of the shallowest decision tree that computes~$g$. Then $\deg(g) \le D(g)$ and $D(g) \le \deg(g)^3$. \end{fact} We first observe \Cref{thm:reconstruct-depth} and~\Cref{fact:depth-vs-degree} already gives a quantitatively weaker version of~\Cref{cor:reconstruct-degree} where $g$ has degree $O(d^{\,9}/\eps^2)$. To see this $f : \bn\to\bits$ be $\opt_d$-close to a degree-$d$ function $h : \bn\to\bits$. By~\Cref{fact:depth-vs-degree}, $D(h) \le \deg(h)^3$, and so the algorithm of~\Cref{thm:reconstruct-depth} provides query access to a decision tree $T : \bn\to\bits$ that is $(O(\opt_d) + \eps)$-close to $f$ and where the depth of $T$ is $O(D(h)^3/\eps^2) = O(\deg(h)^9/\eps^2)$. Applying~\Cref{fact:depth-vs-degree} again, we conclude that $\deg(T) \le D(T) \le O(\deg(h)^9/\eps^2)$. To obtain the sharper bound of $O(\deg(h)^7/\eps^2)$, we observe that the proof of~\Cref{lemma:BGLT} in fact bounds the depth of $T$ by $O(D(h)^2\, \Inf(h)/\eps^2)$. Influence and degree of boolean functions are related via the following basic fact (see e.g.~\cite[Theorem 37]{ODbook}): \begin{fact} For all $h : \bn\to\bits$, we have $\Inf(h) \le \deg(h)$. \end{fact} Therefore, we can bound the degree of $T$ by $O(D(h)^2\,\Inf(h)/\eps^2) \le O(\deg(h)^7/\eps^2)$. Guarantees for the other measures listed in~\Cref{table:other-measures} follow from similar calculations and known quantitative relationships between these measures and decision tree complexity; the current best bounds are summarized in Table 1 of~\cite{ABDKRT20}. \section{Introduction} \violet{We study the problem of {\sl reconstructing} decision trees: given queries to a function $f$ that is close to a size-$s$ decision tree, provide fast query access to a decision tree, ideally one of size not much larger than $s$, that is close to~$f$. This can be viewed as an ``on the fly" variant of the problem of properly and agnostically learning decision trees, where the goal there is to output the entire decision tree hypothesis. More broadly, reconstruction algorithms, introduced by Ailon, Chazelle, Comandur, and Liu~\cite{ACCL08}, can be viewed as sublinear algorithms that restore structure---in our case, that of a decision tree---in a function that has been lost due to noise.} Decision trees have long been a popular and effective model in machine learning, and relatedly, they are among the most intensively studied concept classes in learning theory. The literature on learning decision trees is vast, spanning three decades and studying the problem in a variety of models and from a variety of perspectives~\cite{EH89,Riv87,Blu92,Han93,Bsh93,BFJKMR94,HJLT96,MR02,JS06,OS07,KS06,KST09,HKY18,CM19,BDM20,BLT-ITCS,BLT-ICML,BGLT-NeurIPS1,BLT21icalp,BLQT21}. \violet{In contrast, the problem of reconstructing decision trees has thus far been surprisingly understudied.} \subsection{Our contributions} \violet{We give the first reconstruction algorithm for decision trees. Our algorithm achieves a {\sl polylogarithmic} dependence on $s$ in its query and time complexities, exponentially smaller than the information-theoretic minimum required to learn.} \begin{theorem}[Main result] \label{thm:reconstruct} There is a randomized algorithm which, given queries to $f : \bn\to\bits$ and parameters $s\in \N$ and $\eps\in (0,1)$, provides query access to a fixed decision tree~$T$ where \begin{itemize} \item[$\circ$] $T$ has size $s^{O((\log s)^2/\eps^3)}$ \item[$\circ$] $\dist(T,f) \le O(\opt_s) + \eps$ w.h.p., where $\opt_s$ denotes the distance of $f$ to the closest size-$s$ decision tree; \item[$\circ$] Every query to $T$ is answered with $\poly((\log s)/\eps)\cdot \log n$ queries to~$f$ and in $\poly((\log s)/\eps)\cdot n\log n$ time. \end{itemize} \end{theorem} \violet{Notably, in the standard setting where $s = \poly(n)$, the query and time complexities of our algorithm are $\polylog(n)$ and $\tilde{O}(n)$ respectively. Previously, the only known approach was to simply properly and agnostically learn $f$; the current fastest such algorithm has query and time complexities $n^{O(\log\log n)}$~\cite{BLQT21}.} Our reconstruction algorithm is furthermore {\sl local} in the sense of Saks and Seshadhri~\cite{SS10}, allowing queries to be answered in parallel assuming a shared random string. In particular, once $f, s, \eps$ and the random string are fixed, all queries are answered consistently with a single decision tree. \subsubsection{\violet{Implications of~\Cref{thm:reconstruct} and further results}} By a standard reduction,~\Cref{thm:reconstruct} gives a {\sl tolerant tester} for decision trees: \begin{corollary}[Tolerant testing of decision trees] \label{cor:main} There is a randomized algorithm which, given queries to $f : \bn \to\bits$ and parameters $s\in\N$ and $\eps \in (0,1)$, \begin{itemize} \item[$\circ$] Makes $\poly((\log s)/\eps) \cdot \log n$ queries to $f$, runs in $\poly((\log s)/\eps)\cdot n\log n$ time, and \item[$\circ$] Accepts w.h.p.~if $f$ is $\eps$-close to a size-$s$ decision tree; \item[$\circ$] Rejects w.h.p.~if $f$ is $\Omega(\eps)$-far from size-$s^{O((\log s)^2/\eps^3)}$ decision trees \end{itemize} \end{corollary} This adds to a long line of work on testing decision trees~\cite{KR00,DLMORSW07,CGM11,BBM12,Bsh20}. \violet{We give an overview of prior testers in~\Cref{sec:prior}, mentioning for now that they all have (at least) an exponentially larger dependence on $s$ in their query and time complexities.} \paragraph{A new connection between tolerant testing and learning.} It would be preferable if our tester can be improved to reject all $f$'s that are far from size-$s$ decision trees---or more strongly, if our reconstructor can be improved to provide query access to a size-$s$ decision tree. We show that such a tester, even one that is considerably less efficient than ours, would yield the first polynomial-time algorithm for properly learning decision trees: \begin{theorem}[Tolerant testing $\Longrightarrow$ Proper learning] \label{thm:lower-bound-intro} Suppose there is an algorithm which, given query access to $f : \bn \to \bits$ and parameters $s\in \N$ and $\eps \in (0,1)$, \begin{itemize} \item[$\circ$] Makes $\poly(s,n,1/\eps)$ queries to $f$, runs in $\poly(s,n,1/\eps)$ time, and \item[$\circ$] Accepts w.h.p.~if $f$ is $\eps$-close to a size-$s$ decision tree; \item[$\circ$] Rejects w.h.p.~if $f$ is $\Omega(\eps)$-far from size-$s$ decision trees. \end{itemize} Then there is a $\poly(s,n,1/\eps)$-time membership query algorithm for properly learning size-$s$ decision trees with respect to the uniform distribution. \end{theorem} This would represent a breakthrough on a central open problem in learning theory. Recent work of Blanc, Lange, Qiao, and Tan~\cite{BLQT21} gives a $\poly(n)\cdot s^{O(\log\log s)}$ time algorithm, improving on the prior state of the art of $n^{O(\log s)}$~\cite{EH89}. Neither~\cite{EH89}'s nor~\cite{BLQT21}'s algorithm goes through testing. It is well known and easy to see that proper learning algorithms yield comparably efficient testers~\cite{GGR98}. \Cref{thm:lower-bound-intro} provides an example of a converse; \violet{we find the existence of such a converse surprising, and are not aware of any previous examples.} \paragraph{Reconstructors and testers for other properties.} Decision tree complexity is quantitatively related to numerous other complexity measures of boolean functions: Fourier degree, approximate degree, randomized and quantum query complexities, certificate complexity, block sensitivity, sensitivity, etc. Our results therefore immediately yield new reconstructors and tolerant testers for these properties. For example, we have the following: \begin{corollary}[Reconstruction of low Fourier degree functions] \label{cor:reconstruct-degree} There is a randomized algorithm which, given queries to $f : \bn\to\bits$ and parameters $d\in \N$ and $\eps\in (0,1)$, provides query access to a fixed function $g : \bn\to\bits$ where \begin{itemize} \item[$\circ$] $g$ has Fourier degree $O(d^7/\eps^2)$, \item[$\circ$] $\dist(f,g) \le O(\opt_d) + \eps$ w.h.p., where $\opt_d$ denotes the distance of $f$ to closest $h : \bn\to\bits$ of Fourier degree $d$. \item[$\circ$] Every query to $g$ is answered in $\poly(d,1/\eps)\cdot n\log n$ time and with $\poly(d,1/\eps)\cdot \log n$ queries to~$f$. \end{itemize} \end{corollary} This in turn yields a tolerant tester for Fourier degree. As in the case for decision trees, all prior testers for low Fourier degree~\cite{DLMORSW07,CGM11,CGM11-soda,BBM12,BH13,Bsh20} have an exponential dependence on $d$ in their query and time complexities. \Cref{table:other-measures} lists examples of measures for which we obtain new reconstruction algorithms, each of which in turn give new tolerant testers \vspace{5pt} \begin{table}[h!] \begin{adjustwidth}{-1in}{-1in} \renewcommand{\arraystretch}{1.8} \centering \begin{tabular}{|c|c|c|} \hline \multirow{3}{*}{\sl Complexity measure} & {\sl Assumption} & {\sl Guarantee} \\ [-.5em] &~~Query access to $f$ that is~~&~~Query access to $g$ that is~~\\ [-.9em] &~~$\opt_d$-close to $h$ where:~~&~~$O(\opt_d+\eps)$-close to $f$ where:~~\\ [.2em] \hline \hline Fourier degree & $\deg(h) \le d$ &~~$\deg(g) \le O(d^7/\eps^2)$~~ \\ [.2em] \hline Approximate degree &~~$\wt{\deg}(h) \le d$~~&~~$\wt{\deg}(g) \le O(d^{9}/\eps^2)$~~ \\ [.2em] \hline ~~Randomized query complexity~~&~~$\mathrm{R}(h) \le d$~~&~~$\mathrm{R}(g) \le O(d^7/\eps^2)$~~ \\ [.2em] \hline ~~Quantum query complexity~~&~~$\mathrm{Q}(h) \le d$~~&~~$\mathrm{Q}(g) \le {O(d^{10}/\eps^2)}$~~ \\ [.2em] \hline ~~Certificate complexity~~&~~$\mathrm{C}(h) \le d$~~&~~$\mathrm{C}(g) \le O(d^5/\eps^2)$~~ \\ [.2em] \hline ~~Block sensitivity~~&~~$\mathrm{bs}(h) \le d$~~&~~$\mathrm{bs}(g) \le O(d^8/\eps^2)$~~ \\ [.2em] \hline ~~Sensitivity~~&~~$\mathrm{s}(h) \le d$~~&~~$\mathrm{s}(g) \le O(d^{13}/\eps^{2})$~~ \\ [.2em] \hline \end{tabular} \end{adjustwidth} \captionsetup{width=.9\linewidth} \caption{Performance guarantees of our reconstruction algorithms for various complexity measures. In each row, $\opt_d$ denotes the distance from $f$ to the closest function $h$ such that the complexity measure of that row for $h$ is bounded by $d$. In all cases, every query to $g$ is answered in $\poly(d,1/\eps)\cdot n\log n$ time with $\poly(d,1/\eps)\cdot \log n$ queries to $f$. } \label{table:other-measures} \vspace{-5pt} \end{table} \subsection{Background and comparison with prior work} \label{sec:prior} \violet{As already mentioned,~\Cref{thm:reconstruct} gives the first reconstruction algorithm for decision trees. The problem of testing decision trees, on the other hand, has been intensively studied. } \violet{\pparagraph{Testing decision trees.}} Recent work of Bshouty~\cite{Bsh20} gives an algorithm, running in $\poly(s^s,1/\eps)\cdot n$ time and using $O((s\log s)/\eps)$ queries, that distinguishes between size-$s$ decision trees from functions that are $\eps$-far from size-$s$ decision trees. Prior to~\cite{Bsh20}, Chakraborty, Garc{\'\i}a-Soriano, and Matsliah~\cite{CGM11} gave an $O((s\log s)/\eps^2)$-query algorithm, and before that Diakonikolas, Lee, Matulef, Onak, Rubinfeld, Servedio, and Wan~\cite{DLMORSW07} gave an $\tilde{O}(s^4/\eps^2)$-query algorithm. Like \cite{Bsh20}'s algorithm, the algorithms of~\cite{CGM11,DLMORSW07} also run in $\poly(s^s,1/\eps)\cdot n$ time.\footnote{\violet{All these testers enjoy a weak form of tolerance: they are in fact able to distinguish between functions that are $O(\poly(\eps/s))$-close to size-$s$ decision trees from those that are $\eps$-far from size-$s$ decision trees. (Briefly, this is because their queries, while correlated, are each uniformly distributed.)}} Compared to these algorithms, our algorithm in~\Cref{cor:main} solves an incomparable problem with efficiency parameters that compare rather favorably with theirs. Notably, our time and query complexities both depend {\sl polylogarithmically} on $s$ instead of exponentially and super-linearly respectively Turning to the parameterized setting, Kearns and Ron~\cite{KR00} gave a tester with time and query complexities $\poly(n^n, (\log s)^n)$ that distinguishes size-$s$ decision trees over $[0,1]^n$ from functions that are $(\frac1{2}-n^{-\Theta(n)})$-far from size-$\poly(2^n,s)$ decision trees. The parameters of this result are such that one should think of the dimension `$n$' as being a constant rather than an asymptotic parameter. \paragraph{Property reconstruction.} Property reconstruction was introduced by Ailon, Chazelle, Comandur, and Liu~\cite{ACCL08}. (See also the work of Austin and Tao~\cite{AT10}, who termed such algorithms~``repair algorithms".) Reconstruction has since been studied for a number of properties, including monotone functions~\cite{ACCL08,SS10,BGJJRW12}, hypergraph properties~\cite{AT10}, convexity~\cite{CS06}, expanders~\cite{KPS13}, Lipschitz functions~\cite{JR13}, graph connectivity and diameter~\cite{CGR13}, and error correcting codes~\cite{CFM14}. Property reconstruction falls within the {\sl local computation algorithms} framework of Rubinfeld, Tamir, Vardi, and Xie~\cite{RTVX11}. The paper of Blanc, Gupta, Lange, and Tan~\cite{BGLT-NeurIPS2} designs a decision tree learning algorithm that is amenable to {\sl learnability estimation}~\cite{KV18,BH18}: given a training set $S$ of {\sl unlabeled} examples, the performance of this algorithm $\mathcal{A}$ trained on $S$---that is, the generalization error of the hypothesis that $\mathcal{A}$ would construct if we were to label all of $S$ and train $\mathcal{A}$ on it---can be accurately estimated by labeling only a small number of the examples in $S$. Their techniques can be used to derive a reconstruction algorithm that achieves guarantees similar to those in~\Cref{thm:reconstruct}, but only for {\sl monotone} functions~$f$. This limitation is inherent: as noted in~\cite{BGLT-NeurIPS2}, their algorithm is fails for non-monotone functions. \subsubsection{The work of Bhsouty and Haddad-Zaknoon} \label{sec:Bshouty} Subsequent to the posting of our work to the ArXiv, Bshouty and Haddad-Zaknoon~\cite{BHZ21} have given a tester that is closely related, but incomparable, to~\Cref{cor:main}. Their tester: \begin{itemize} \item[$\circ$] Makes $\poly(s,1/\eps)$ queries to $f$, runs in $\poly(n,1/\eps)$ time, and \item[$\circ$] Accepts w.h.p.~if $f$ is exactly a size-$s$ decision tree; \item[$\circ$] Rejects w.h.p.~if $f$ is $\eps$-far from size-$(s/\eps)^{O(\log(s/\eps))}$ decision trees \end{itemize} Comparing~\cite{BHZ21}'s tester to ours, their query complexity is independent of~$n$ (whereas ours has a $\log n$ dependence), and the size of decision trees in their reject condition is only $(s/\eps)^{O(\log(s/\eps))}$ (whereas we require $s^{O((\log s)^2/\eps^3)}$). On the other hand, our tester is tolerant and has query complexity that achieves a polylogarithmic instead of polynomial dependence on $s$. Furthermore,~\cite{BHZ21} does not give a reconstruction algorithm, \violet{while that is the main contribution of our work.} \subsection{Future directions} \label{sec:future} We list a few concrete avenues for future work suggested by our results: \begin{itemize \item[$\circ$] {\sl Tighter connections between testing and learning:} Our tester rejects functions that are $\Omega(\eps)$-far from $\mathrm{quasipoly}(s)$ decision trees, and~\Cref{thm:lower-bound-intro} shows that a tester that rejects functions that are $\Omega(\eps)$-far from size-$s$ decision trees would yield a comparably efficient algorithm for properly learning decision trees. A concrete avenue for future work is to narrow this gap between $\mathrm{quasipoly}(s)$ and $s$, with the ultimate goal of getting them to match. There are also other ways in which \Cref{thm:lower-bound-intro} could be strengthened: Do {\sl non-tolerant} testers for decision trees yield proper learning algorithms? Do tolerant testers yield proper learning algorithms with {\sl agnostic} guarantees? \item[$\circ$] {\sl Improved reconstruction algorithms and testers for other properties:} The reconstruction algorithms that we obtain for the properties listed in~\Cref{table:other-measures} follow by combining~\Cref{thm:reconstruct} with known relationships between these measures and decision tree complexity. It would be interesting to obtain improved parameters by designing reconstruction algorithms that are tailored to each of these properties, without going through decision trees. The same questions can be asked of property testers, and about properties that are not known to be quantitatively related to decision tree size. Can we achieve similar exponential improvements in the time and query complexities of non-parameterized testers by relaxing to the parameterized setting? \Cref{thm:lower-bound-intro} could be viewed as suggesting that for certain properties, efficient algorithms may only be possible in the parameterized setting. \end{itemize} Finally, we mention that there remains a large gap in the known bounds on the query complexity of non-tolerant testing of decision trees in the non-parameterized setting: the current best upper bound is~$\tilde{O}(s)$~\cite{Bsh20,CGM11} whereas the current best lower bound is $\Omega(\log s)$~\cite{DLMORSW07,BBM12}. It would be interesting to explore whether our techniques could be useful in closing this exponential gap. \paragraph{Notation.} All probabilities and expectations are with respect to the uniform distribution unless otherwise stated; we use boldface (e.g.~$\bx$) to denote random variables. For two functions $f,g : \bn\to\bits$, we write $\dist(f,g)$ to denote the quantity $\Pr[f(\bx)\ne g(\bx)]$. We say that $f$ and $g$ are {\sl $\eps$-close} if $\Pr[f(\bx)\ne g(\bx)] \le \eps$, and {\sl $\eps$-far} otherwise. For a function $f : \bn\to\bits$, a decision tree $T$ over the same variables as $f$, and a node $v$ in $T$, we write $f_v$ to denote the subfunction of $f$ obtained by restricting $f$ according to the root-to-$v$ path in $T$. We write $|v|$ to denote the depth of $v$ within $T$, and so the probability that a uniform random $\bx\sim \bn$ reaches $v$ is $2^{-|v|}$. \section{Proofs of~\Cref{thm:reconstruct} and~\Cref{cor:main}} Our proof of~\Cref{thm:reconstruct} has two main components: \begin{itemize} \item[$\circ$] A structural lemma about functions $f$ that are $\opt_s$-close to a size-$s$ decision tree $T^\star$. While we have no information about the structure of this tree $T^\star$ that $f$ is $\opt_s$-close to, we will show that $f$ is $O(\opt_s + \eps)$-close to a tree $T^\diamond$ of size $S = S(s,\eps)$ with a very specific structure. \item[$\circ$] An algorithmic component that leverages this specific structure of $T^\diamond$ to show that for any input $x \in\bn$, the value of $T^\diamond(x)$ can be computed with only $\log S \cdot \log n$ queries to $f$. \end{itemize} \Cref{sec:structural} will be devoted to the structural lemma and~\Cref{sec:algorithmic} to the algorithmic component. We prove~\Cref{thm:reconstruct} in~\Cref{sec:proof-of-reconstruct}, and we derive~\Cref{cor:main} as a simple consequence of~\Cref{thm:reconstruct} in~\Cref{sec:proof-of-tester}. \subsection{Structural component of~\Cref{thm:reconstruct}} \label{sec:structural} \begin{definition}[Noise sensitivity] The {\sl noise sensitivity of $f : \bn\to\bits$ at noise rate $p$} is the quantity \[ \NS_p(f) \coloneqq \Pr[f(\bx) \ne f(\by)],\] where $\bx\sim \bn$ is uniform random and $\by\sim_p\bx$ is a {\sl $p$-noisy copy of $\bx$}, obtained from $\bx$ by independently rerandomizing each coordinate with probability $p$. \end{definition} We assign each coordinate $i\in [n]$ of a function $f$ a {\sl score}, which measures the expected decrease in the noise sensitivity of $f$ if $x_i$ is queried: \begin{definition}[Score of a variable] \label{def:score} Given a function $f:\bn \to \bits$, noise rate $p \in (0,1)$, and coordinate $i \in [n]$, the {\sl score} of $x_i$ is defined as \[ \mathrm{Score}_i(f, p) = \NS_{p}(f) - \Ex_{\bb\in\bits}\big[\NS_{p}(f_{x_i = \bb})\big]. \] \end{definition} (Our notion of score is equivalent, up to scaling factors depending on $p$, to the notion of ``noisy influence" as in defined in O'Donnell's monograph~\cite{ODbook}. We use our definition of score as it simplifies our presentation.) We are now ready to define the tree $T^\diamond$ described at the beginning of this section and state our structural lemma. \begin{definition} \label{def:top-down-tree} For a function $f : \bn\to\bits$, parameters $d\in \N$ and $p \in (0,1)$, we write $T^{d,p}_f$ to denote the complete decision tree of depth $d$ defined as follows: \begin{itemize} \item[$\circ$] At every internal node $v$, query $x_i$ where $i\in [n]$ maximizes $\mathrm{Score}_i(f_v,p)$.\footnote{Ties are arbitrarily broken; our results hold regardless of how ties are broken.} \item[$\circ$] Label every leaf $\ell$ with $\sign(\E[f_\ell])$. \end{itemize} \end{definition} \begin{lemma}[Structural lemma] \label{lemma:BGLT} Let $f : \bn\to\bits$ be $\opt_s$-close to a size-$s$ decision tree. Then for $d = O((\log s)^3/\eps^3)$ and $p = \eps/(\log s)$, we have $\dist(f,T^{d,p}_f) \le O(\opt_s)+\eps$. \end{lemma} \section{Proof of~\Cref{lemma:BGLT}} \label{appendix} \paragraph{Noise-sensitivity-based potential function.} First, we introduce the potential function that will facilitate our proof of~\Cref{lemma:BGLT}. Every decision tree $T$ naturally induces a distribution over its leaves where each leaf $\ell$ receives weight $2^{-|\ell|}$. We write $\bell\sim T$ to denote a draw of a leaf of $T$ according to this distribution. \begin{definition}[Noise sensitivity of $f$ with respect to a tree $T$] \label{def:NS-wrt-T} Let $f :\bn\to\bits$ be a function, $p\in (0,1)$, and $T$ be a decision tree. The {\sl noise sensitivity of $f$ at noise rate $p$ with respect to $T$} is the quantity \[ \NS_p(f,T) \coloneqq \Ex_{\bell\sim T} \big[ \NS_p(f_{\bell})\big].\] \end{definition} Note that if $T$ is the empty tree, then $\NS_p(f,T)$ is simply $\NS_p(f)$, the noise sensitivity of $f$ at noise rate $p$. The following proposition is a bound on $\NS_p(f)$ that takes into account its distance from a small decision tree: \begin{proposition}[Noise sensitivity of $f$] \label{prop:NS-of-f} Let $f : \bn\to\bits$ be $\opt_s$-close to a size-$s$ decision tree $T$. For all $p\in (0,1)$, we have $\NS_p(f) \le p\log s + 2\,\opt_s.$ \end{proposition} \begin{proof} Let $\bx\sim\bn$ be uniform random, $\by\sim_p \bx$ be a $p$-noisy copy of $\bx$, and $\bx^{\oplus i}$ denote $\bx$ with its $i$-th coordinate flipped. We first observe that \begin{align*} \NS_p(f) &= \Pr[f(\bx)\ne f(\by)] \\ &\le \Pr[f(\bx)\ne T(\bx)] + \Pr[T(\bx) \ne T(\by)] + \Pr[T(\by) \ne f(\by)] \\ &= \NS_p(T) + 2\,\opt_s. \end{align*} To bound $\NS_p(T)$, we use the inequality $\NS_p(T) \le p\cdot \Inf(T)$ where $\Inf(T) \coloneqq \sum_{i=1}^n \Pr[f(\bx) \ne f(\bx^{\oplus i})]$ is the total influence of $T$~\cite[Exercise 2.42]{ODbook}, along with the bound $\Inf(T) \le \log s$ (see e.g.~\cite{OS07}). \end{proof} We prove~\Cref{lemma:BGLT} by quantifying the difference between $\NS_p(f,T^{j+1,p}_f)$ and $\NS_p(f,T^{j,p}_f)$: we show that for every $j\in\N$, either $\dist(f,T^{j,p}_f)\le O(\opt_s + \eps)$ or it must be the case that $\NS_p(f,T^{j+1,p}_f)$ is significantly smaller than $\NS_p(f,T^{j,p}_f)$. Since $\NS_p(f,T) \ge 0$ for all trees~$T$, the second case can only happen so many times before we fall into the first case. We will need the following result from~\cite{OSSS05}: \begin{theorem}[Theorem 3.2 of~\cite{OSSS05}] \label{thm:OSSS-non-buggy} Let $T : \bn \to \bits$ be a decision tree. For all functions $g : \bn\to \R$, writing $\bx,\bx'\sim\bn$ to denote uniform random and independent inputs and $\bx^{\sim i}$ to denote $\bx$ with its $i$-th coordinate rerandomized, \[ \mathrm{CoVr}(T,g) \le \sum_{i=1}^n \lambda_i(T) \cdot \Ex_{\bx} \big[|g(\bx)-g(\bx^{\sim i})|\big],\] where \begin{align*} \mathrm{CoVr}(T,f) &\coloneqq \Ex_{\bx,\bx'}\big[|T(\bx)-g(\bx')|\big] - \Ex_{\bx}\big[|T(\bx)-g(\bx)|\big], \\ \lambda_i(T) &\coloneqq \Pr[\,\text{$T$ queries $\bx_i$}\,]. \end{align*} \end{theorem} By applying~\Cref{thm:OSSS-non-buggy} to a suitably smoothened version of $f$, we are able to derive a lower bound on the score of the highest-scoring variable of $f$. \begin{definition}[$p$-smoothed version of $f$] For $f : \bn\to\bits$ and $p\in (0,1)$, the {\sl $p$-smoothed version of $f$} is the function $\tilde{f}^{(p)} : \bn\to [-1,1]$, \[ \tilde{f}^{(p)}(x) = \Ex_{\by\sim_p x}[f(\by)] = \sum_{S\sse [n]} (1-p)^{|S|} \wh{f}(S)\prod_{i\in S}x_i,\] where the $\wh{f}(S)$ is the $S$-th Fourier coefficients of $f$. When $p$ is clear from context, we write $\tilde{f}$. \end{definition} \begin{lemma}[Score of the highest-scoring variable] \label{lem:noisy-OSSS-truncated-agnostic-fixed} Let $f : \bits^n \to \bits$ be a function, $p\in (0,1)$, and $\tilde{f} = \tilde{f}^{(p)}$ be its $p$-smoothed version. For all size-$s$ decision trees $T : \bn\to \bits$, \[ \max_{i\in [n]}\big\{\sqrt{\mathrm{Score}_i(f,p)}\big\} \ge \frac{\sqrt{p}}{\log s} \cdot \Big(\lfrac1{2}\Var(\tilde{f}) - \E\big[|T(\bx)-\tilde{f}(\bx)|\big]\Big).\] \end{lemma} \begin{proof} Applying~\Cref{thm:OSSS-non-buggy} with `$g$' being the $p$-smoothed version $\tilde{f}$ of $f$, we have \begin{equation} \label{eq:OSSS-non-buggy-for-us} \mathrm{CoVr}(T,\tilde{f}) \le \sum_{i=1}^n \lambda_i(T) \cdot \E[|\tilde{f}(\bx)-\tilde{f}(\bx^{\sim i})|].\end{equation} We first lowerbound the LHS of~\Cref{eq:OSSS-non-buggy-for-us}. For $\bx,\bx'\sim \bn$ uniform and independent, \begin{align} \mathrm{CoVr}(T,\tilde{f}) &= \E\big[|T(\bx)-\tilde{f}(\bx')|\big] - \E\big[|T(\bx)-\tilde{f}(\bx)|\big] \tag*{(Definition of $\mathrm{CoVr}$)} \nonumber \\ &\ge \E\big[|\tilde{f}(\bx)-\tilde{f}(\bx')|\big] - 2\E\big[|T(\bx)-\tilde{f}(\bx)|\big] \tag*{(Triangle inequality)}\nonumber \\ &\ge \lfrac1{2}\E\big[(\tilde{f}(\bx)-\tilde{f}(\bx'))^2\big] - 2\E\big[|T(\bx)-\tilde{f}(\bx)|\big] \tag*{($\tilde{f}$ is $[-1,1]$-valued)}\nonumber \\ &\ge \Var(\tilde{f}) - 2\E\big[|T(\bx)-\tilde{f}(\bx)|\big]. \label{eq:cov-lb-fixed} \end{align} For a function $g : \bn\to\R$, its {\sl $i$-th discrete derivative} is the function \[ (D_ig)(x) \coloneqq \lfrac1{2}\big(g(x^{i=1})-g(x^{i=-1})\big) = \ds\sum_{S\ni i} \wh{g}(S)\prod_{j \in S \setminus \{i\}} x_j,\] where $x^{i=b}$ denotes $x$ with its $i$-th coordinate set to $b$. With this definition in hand, we now analyze the expectation on the RHS of~\Cref{eq:OSSS-non-buggy-for-us}. By Jensen's inequality, \[ \E[|\tilde{f}(\bx)-\tilde{f}(\bx^{\sim i})|]^2 \le \Ex_{\bx}\big[ (\tilde{f}(\bx)-\tilde{f}(\bx^{\sim i}))^2\big] = \lfrac1{2}\ds\Ex_{\bx}\big[ (\tilde{f}(\bx^{i=1})-\tilde{f}(\bx^{i=-1}))^2\big] = 2\Ex_{\bx}\big[D_i\wt{f}(\bx)^2\big]. \] Applying Plancherel's identity twice, \[ \Ex_{\bx}\big[ D_i\tilde{f}(\bx)^2\big] = \sum_{S \ni i} (1-p)^{2|S|}\wh{f}(S)^2 \le \sum_{S\ni i} (1-p)^{|S|}\wh{f}(S)^2 = \Ex_{\bx,\by}\big[ D_if(\bx)D_if(\by)\big] \] where $\by\sim_p\bx$ is a $p$-noisy copy of $\bx$. It follows from a straightforward calculation~\cite[Lemma 3.2]{BGLT-NeurIPS1} that \[ \Ex_{\bx,\by}\big[ D_if(\bx)D_if(\by)\big] = \frac{2\cdot \mathrm{Score}_i(f,p)}{p}.\] Therefore, combining the three equations above we have shown that \begin{equation} \label{eq:score-non-negative} \Ex_{\bx}\big[ |\tilde{f}(\bx)-\tilde{f}(\bx^{\sim i})|\big] \le \sqrt{\frac{4\cdot \mathrm{Score}_i(f,p)}{p}}. \end{equation} Plugging this inequality into the RHS of~\Cref{eq:OSSS-non-buggy-for-us}, \begin{align} \sum_{i=1}^n \lambda_i(T) \cdot \ds\Ex_{\bx}\big[|\tilde{f}(\bx)-\tilde{f}(\bx^{\sim i})|\big] &\le \sum_{i=1}^n \lambda_i(T) \cdot \sqrt{\frac{4\cdot \mathrm{Score}_i(f,p)}{p}} \nonumber \\ &\le \ds \max_{i\in [n]} \big\{ \sqrt{\mathrm{Score}_i(f,p)}\big\} \cdot \frac{2}{\sqrt{p}} \cdot \sum_{i=1}^n \lambda_i(T) \nonumber \\ &\le \max_{i\in [n]} \big\{ \sqrt{\mathrm{Score}_i(f,p)}\big\} \cdot \frac{2\log s}{\sqrt{p}}, \label{eq:RHS-ub-fixed} \end{align} where the final inequality holds because \[ \sum_{i=1}^n \lambda_i(T) = \sum_{i=1}^n \Pr[\,\text{$T$ queries $\bx_i$}\,] = \Ex_{\bell\sim T}\big[|\bell|\big] \le \log s. \] The lemma follows by combining~\Cref{eq:OSSS-non-buggy-for-us,eq:cov-lb-fixed,eq:RHS-ub-fixed}. \end{proof} \subsubsection{Proof of~\Cref{lemma:BGLT}} Let $T^\star$ be the size-$s$ decision tree that $f$ is $\opt_s$-close to. Fix $j\in \N$ and consider the tree $T^{j,p}_f$. We have that: \begin{align*} \NS_p(f, T^{j+1,p}_f) &\le \NS_p(f, T^{j,p}_f) - \Ex_{\bell\sim T^{j,p}_f}\Big[\max_{i\in [n]}\big\{\mathrm{Score}_i(f_{\bell}, p)\big\}\Big] \tag*{(\Cref{def:score})} \\ &\le \NS_p(f, T^{j,p}_f) - \bigg(\Ex_{\bell\sim T^{j,p}_f}\Big[\max_{i\in [n]}\big\{\sqrt{\mathrm{Score}_i(f_{\bell}, p)}\big\}\Big]\bigg)^2. \tag*{(Jensen's inequality)} \end{align*} Recall that we write $\bell\sim T$ to denote a draw of a leaf of $T$ where each leaf $\ell$ receives weight $2^{-|\ell|}$. We consider two cases:\medskip \noindent {\bf{Case 1:}} $\Ex_{\bell \sim T^{j,p}_f}[\Var(\wt{f_{\bell}})] \ge 2\,(\Ex_{\bell,\bx}\big[|{T}^\star(\bx)-\wt{f_{\bell}}(\bx)|\big] + \eps)$.\medskip In this case we apply~\Cref{lem:noisy-OSSS-truncated-agnostic-fixed} to each leaf $\ell$ of $T^{j,p}_f$ to get that \begin{align*} \Ex_{\bell\sim T^{j,p}_f}\Big[\max_{i\in [n]}\big\{\sqrt{\mathrm{Score}_i(f_{\bell}, p)}\big\}\Big] &\ge \frac{\sqrt{p}}{\log s} \cdot \Ex_{\bell\sim T^{j,p}_f}\Big[\lfrac1{2}\Var(\tilde{f_{\bell}}) - \E\big[|T^\star(\bx)-\tilde{f_{\bell}}(\bx)|\big]\Big] \\ &\ge \frac{\eps\sqrt{p}}{\log s}, \end{align*} and hence \begin{align*} \NS_p(f,T^{j+1,p}_f) &\le \NS_p(f,T^{j,p}_f) - \frac{\eps^2 p}{(\log s)^2}. \\ &= \NS_p(f,T^{j,p}_f)-\frac{\eps^3}{(\log s)^3}. \tag*{(Our choice of $p = \eps/(\log s)$)} \end{align*} \medskip \noindent {\bf{Case 2:} $\Ex_{\bell \sim T^{j,p}_f}[\Var(\wt{f_{\bell}})] < 2\,(\Ex_{\bell,\bx}\big[|{T}^\star (\bx)-\wt{f_{\bell}}(\bx)|\big] + \eps$).}\medskip In this case we claim that $\dist(f,T^{j,p}_f) \le O(\opt_s + \eps)$. We will need a couple of simple propositions: \begin{proposition} \label{prop:NS-of-leaves} $\Ex_{\bell,\bx}[(\wt{f_{\bell}}(\bx)-f_\ell(\bx))^2] \le 4\,\NS_p(f)$. \end{proposition} \begin{proof} Since $f_\ell$ and $\wt{f_\ell}$ are $[-1,1]$-valued, we have that \begin{align*} \Ex_{\bell,\bx}\big[(\wt{f_{\bell}}(\bx)-f_{\bell}(\bx))^2\big] &\le 2 \Ex_{\bell,\bx}\big[|\wt{f_{\bell}}(\bx)-f_{\bell}(\bx)|\big] \\ &= 2 \Ex_{\bell} \Bigg[ \mathop{\Ex_{\bx}}_{\by\sim_p\bx} \big[ | f_{\bell}(\by) - f_{\bell}(\bx) | \big]\Bigg] \\ &= 2 \Ex_{\bell} \Bigg[ \,2\mathop{\Prx_{\bx}}_{\by\sim_p\bx} \big[ f_{\bell}(\by) \ne f_{\bell}(\bx)\big] \,\Bigg] \\ &= 4 \E_{\bell} \big[ \NS_p(f_{\bell})\big] \\ &= 4\,\NS_p(f,T^{j, p}_f) \le 4\,\NS_p(f), \end{align*} where the final inequality is a consequence of the fact that score is a nonnegative quantity (\Cref{eq:score-non-negative}). \end{proof} \begin{proposition} \label{prop:rounding-error} For any function $g : \bn\to\bits$ and constant $c\in \R$, \[ \E\big[(g(\bx) - \sign(\E[g]))^2\big] \le 2\E[(g(\bx)-c)^2]. \] \end{proposition} \begin{proof} Let $a \coloneqq \Pr[g(\bx) = 1]$ and assume without loss of generality that $a \geq \frac1{2}$. On one hand, we have that $\E\big[(g(\bx) - \sign(\E[g])^2\big] = \E\big[(g(\bx) - 1)^2\big] = 4(1-a)$. On the other hand, since \[ \E[(g(\bx)-c)^2] = a(1-c)^2+(1-a)(1+c)^2 \] this quantity is minimized for $c = 2a-1$ and attains value $4a(1-a)$ at this minimum. Therefore indeed \[ \min_{c\in \R} \big\{ \E[(g(\bx)-c)^2]\big\} = 4a(1-a) \ge 2(1-a) = \lfrac{1}{2}\E\big[(g(\bx) - \sign(\E[g]))^2\big] \] and the proposition follows. \end{proof} With~\Cref{prop:NS-of-leaves,prop:rounding-error} in hand, we now bound $\dist(f,T^{j,p}_f)$: \begin{align*} \dist(f,T^{j,p}_f) &= \Ex_{\bell\sim T^{j,p}_f}\big[ \dist(f_{\bell},\sign(\E[f_{\bell}]))\big] \\ &= \lfrac1{4} \ds \Ex_{\bell,\bx}\big[ (f_{\bell}(\bx) - \sign(\E[f_{\bell}]))^2 \big] \\ &\le \lfrac1{2} \ds \Ex_{\bell,\bx} \big[ (f_{\bell}(\bx) - \E[\wt{f_{\bell}}])^2\big] \tag*{(\Cref{prop:rounding-error})} \\ &\le \Ex_{\bell,\bx}\big[ (f_{\bell}(\bx)-\wt{f_{\bell}}(\bx))^2 \big] + \Ex_{\bell,\bx}\big[ (\wt{f_{\bell}}(\bx) - \E[\wt{f_{\bell}}])^2 \big] \tag*{(``almost-triangle" inequality)} \\ &\le 4\,\NS_p(f) + \Ex_{\bell}[\Var(\wt{f_{\bell}})]. \tag*{(\Cref{prop:NS-of-leaves})} \end{align*} By the assumption that we are in Case 2, \begin{align*} \Ex_{\bell}[\Var(\wt{f_{\bell}})] &< 2\Ex_{\bell,\bx}\big[|{T}^\star (\bx)-\wt{f_{\bell}}(\bx)|\big] + 2\,\eps \\ &\le 2\Big(\Ex_{\bell,\bx}\big[|{T}^\star(\bx) - f_{\bell}(\bx)|\big] + \Ex_{\bell,\bx}\big[ |f_{\bell}(\bx) - \wt{f_{\bell}}(\bx)| \big] \Big) + 2\,\eps \tag*{(Triangle inequality)} \\ &\le O\big(\Ex_{\bell}[\dist(f_{\bell},{T}^\star)] +\NS_p(f) \big) + 2\,\eps \tag*{(\Cref{prop:NS-of-leaves})} \\ &\le O \big(\opt_s + \eps + \NS_p(f)\big) \tag*{($\dist(f,{T}^\star)= \opt_s$)} \\ &\le O(\opt_s + p\log s + \eps) \tag*{(\Cref{prop:NS-of-f})} \\ &= O(\opt_s + \eps). \tag*{(Our choice of $p = \eps/\log s$)} \end{align*} Summarizing what we have shown through Cases 1 and 2, for all $j\in \N$, we either have \[ \NS_p(f,T^{j+1,p}_f) \le \NS_p(f,T^{j,p}_f)-\frac{\eps^3}{(\log s)^3} \] or it must be the case that $\dist(f,T^{j,p}_f) \le O(\opt_s + \eps)$. Since $\NS_p(f,T) \in [0,1]$ for all decision trees~$T$, we must fall into the latter case for some $j \le O((\log s)^3/\eps^3)$. Finally, since $\dist(f, T^{j+1,p}_f) \le \dist(f, T^{j,p}_f)$ for all $j\in \N$, we conclude that $\dist(f,T^{d,p}_f) \le O(\opt_s + \eps)$ for our choice of $d = O((\log s)^3/\eps^3)$, and~\Cref{lemma:BGLT} follows. \violet{ \begin{remark} \label{rem:differences} A similar structural lemma \violet{was claimed in~\cite{BGLT-NeurIPS1}}. Their proof, however, relies crucially on a sophisticated result (the ``two function OSSS inequality for semi-metrics" from~\cite{OSSS05}) that was subsequently shown to be false~\cite{Qia21,OD21}. Our proof of~\Cref{lemma:BGLT} does not use this erroneous result. There are also important differences between our setting and that of~\cite{BGLT-NeurIPS1}'s. \cite{BGLT-NeurIPS1} analyzes a tree, call it~$\Upsilon$, that is analogous to our $T^{d,p}_f$. Unlike $T^{d,p}_f$, their tree $\Upsilon$ is not necessarily complete: it is iteratively constructed in a top-down manner, where in each iteration the size of the tree grows by one. In each iteration, the leaf $\ell$ in the current tree with the highest ``value" is replaced with a query the variable of $f_\ell$ with the highest score, where the ``value" of a leaf is defined to be the score of the highest-scoring variable of $f_\ell$ normalized by $\ell$'s depth in the current tree.~\cite{BGLT-NeurIPS1}'s definition of score differs from ours: for their intended application, it was important that the score of a variable can be efficiently estimated to high accuracy from random labeled examples $(\bx,f(\bx))$ where $\bx \sim \bn$ is uniform random;~\Cref{def:score} does not lend itself to such an estimation procedure. \end{remark} } \begin{remark} \label{remark:BGLT-approx} \Cref{lemma:BGLT} concerns the tree $T^{d,p}_f$ as defined in~\Cref{def:top-down-tree}, where each internal node~$v$ of $T^{d, p}_f$ is a query the variable $x_i$ that maximizes $\mathrm{Score}_i(f_v,p)$. For the algorithmic component of~\Cref{thm:reconstruct}, we will need a robust version of~\Cref{lemma:BGLT}. An inspection of its proof shows that the same statement holds for any tree where each internal node $v$ is a query to a variable of {\sl approximately} maximal score, within $\tau \coloneqq O(\eps^3/(\log s)^3)$ of $\max_{j\in [n]} \mathrm{Score}_j(f_v,p)$. Indeed, the only change to the proof will be that for all $j\in \N$, we either have that \[ \NS_p(f,T^{j+1,p}_f) \le \NS_p(f,T^{j,p}_f)-\frac{\eps^3}{(\log s)^3} + \tau \] or it must be the case that $\dist(f,T^{j,p}_f) \le O(\opt_s + \eps)$. Therefore, as long as $\tau \le O(\eps^3/(\log s)^3)$ the conclusion is unaffected. Similarly, instead of labeling every leaf $\ell$ with $\sign(\E[f_\ell])$, the same conclusion holds if we only require this for leaves $\ell$ such that $|\E[f_\ell]| > \eps$. \begin{lemma}[Robust version of~\Cref{lemma:BGLT}] \label{lem:BGLT-approx} Let $f : \bn\to\bits$ be $\opt_s$-close to a size-$s$ decision tree. For $d = O((\log s)^3/\eps^3)$, $p = \eps/(\log s)$, and $\tau = O(\eps^3/(\log s)^3)$, let~$T$ be any complete decision tree of depth $d$ satisfying: \begin{itemize} \item[$\circ$] At every internal node $v$, the variable $x_i$ that is queried at this node satisfies: \[ \mathrm{Score}_{i}(f_v,p) \geq \max_{j \in [n]}\ \{\mathrm{Score}_j(f_v,p)\} - \tau.\] \item[$\circ$] Every leaf $\ell$ such that $|\E[f_\ell]|> \eps$ is labeled $\sign(\E[f_\ell])$. \end{itemize} Then $\dist(f,T) \le O(\opt_s +\eps)$. \end{lemma} \end{remark} \section*{Acknowledgements} We thank the anonymous reviewers for their thoughtful comments and feedback. Guy and Li-Yang are supported by NSF CAREER Award 1942123. Jane is supported by NSF Award CCF-2006664.
{'timestamp': '2022-05-24T02:24:19', 'yymm': '2012', 'arxiv_id': '2012.08735', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08735'}
arxiv
\section{Introduction} Many important real-world problems involve optimizing a submodular function. Such problems include maximum coverage, maximum cut \cite{MaxcutSDP}, maximum influence \cite{MaxSpreadInfluence}, sensor placement problem \cite{NearSensorPlacement,SubInfoGather}, as well as many problems in the machine learning domain \cite{FeatureSelection,DataSubsetSelection,DocSum,DocSumBudget,EfficientMinDecompSubmodular}. Much work has been done in the area of submodular optimization under static constraints. A particularly well-studied class of algorithms in this line of research is greedy algorithms, which have been shown to be efficient in exploiting submodularity \cite{LocationBankOptFloat,MaxSubmodularMatroid,GreedyMaxBoundCurvPartMatroid,GreedNonmod}. Important recent results on the use of evolutionary algorithms for submodular optimization are summarized in~\cite{DBLP:books/sp/ZhouYQ19}. Real-world problems are seldom solved once, but rather many times over some period of time, during which they change. Such changes demand adapting the solutions that would otherwise become poor or infeasible. The dynamic nature of these problems presents many interesting optimization challenges, which have long been embraced by many researchers. A lot of research in the evolutionary computation literature has addressed these types of problems from an applied perspective. Theoretical investigations have been carried out for evolutionary algorithms on some example functions and classical combinatorial optimization problems such as shortest paths, but in general the theoretical understand on complex dynamic problems is rather limited~\cite{DBLP:journals/corr/abs-1806-08547}. In this paper, we follow the approach of carrying out theoretical runtime analysis of evolutionary algorithms with respect to their runtime and approximation behavior. This well established area of research has significantly increased the theoretical understanding of evolutionary computation methods~\cite{DBLP:books/daglib/0025643,BookDoeNeu}. Many recent studies on submodular and near-submodular optimization have investigated Pareto optimization approaches based on evolutionary computation. \citet{POMC} derive an approximation guarantee for the POMC algorithm for maximizing monotone function under a monotone constraint. They show that POMC achieves an $(\alpha_f/2)(1-1/e^{\alpha_f})$-approximation within at most cubic expected run time. The recent study of \citet{MaxMonoApproxSubmodMulti} extends the results to a variant of the GSEMO algorithm (which inspired POMC) to the problem of maximizing general submodular functions, but under a cardinality constraint. It results reveal that non-monotonicity in objective functions worsens approximation guarantees. In our work, we extend existing results for POMC \cite{ParetoSubsetDynCon} to partition matroid constraints with dynamic thresholds. We show that the proven adaptation efficiency facilitated by maintaining dominating populations can be extended for multiple constraints with appropriately defined dominance relations. In particular, we prove that POMC can achieve new approximation guarantees quickly whether the constraints thresholds are tightened or relaxed. Additionally, we study POMC experimentally on the dynamic max cut problem and compare its results against the results of greedy algorithms for underlying static problems. Our study evaluates the efficiency in change adaptation, thus assuming immaculate change detection. Our results show that POMC is competitive to GREEDY during unfavorable changes, and outperforming GREEDY otherwise. In the next section, we formulate the problem and introduce the Pareto optimization approach that is subject to our investigations. Then we analyze the algorithm in terms of runtime and approximation behaviour when dealing with dynamic changes. Finally, we present the results of our experimental investigations and finish with some conclusions. \section{Problem Formulation and Algorithm} In this study, we consider optimization problems where the objective functions are either submodular or monotone. We use the following definition of submodularity \cite{Submod1978}. \begin{definition}\label{submodular_def} Given a finite set $V$, a function $f:2^V\to\mathbb{R}^+$ is submodular if it satisfies for all $X\subseteq Y\subseteq V$ and $v\in V\setminus Y$, \[f(Y\cup\{v\})-f(Y)\leq f(X\cup\{v\})-f(X).\] \end{definition} As in many relevant works, we are interested in the submodularity ratio which quantifies how close a function is to being modular. In particular, we use a simplified version of the definition in \cite{spectral}. \begin{definition}\label{submodratio_def} For a monotone function $f:2^V\to\mathbb{R}^+$, its submodularity ratio with respect to two parameters $i$, $j\geq1$ is \[\gamma_{i,j}=\min_{|X|<i,|L|\leq j,X\cap L=\emptyset}\frac{\sum_{v\in L}[f(X\cup\{v\})-f(X)]}{f(X\cup L)-f(X)},\] for $i>0$ and $\gamma_{0,j}=\gamma_{1,j}$. \end{definition} It can be seen that $\gamma_{i,j}$ is non-negative, non-increasing with increasing $i$ and $j$, and $f$ is submodular iff $\gamma_{i,j}\geq1$ for all $(i,j)$. This ratio also indicates the intensity of the function's diminishing return effect. Additionally, non-monotonicity is also known to affect worst-case performance of algorithms \cite{GreedyMaxBoundCurvPartMatroid,MaxMonoApproxSubmodMulti}. As such, we also use the objective function's monotonicity approximation term defined similarly to \cite{NearSensorPlacement}, but only for subsets of a certain size. \begin{definition}\label{mono_approx} For a function $f:2^V\to\mathbb{R}^+$, its monotonicity approximation term with respect to a parameter $j$ is \[\epsilon_j=\max_{X,v:|X|<j}\{f(X\setminus\{v\})-f(X)\},\] for $j>0$ and $\epsilon_0=0$. \end{definition} It is the case that $\epsilon_j$ is non-negative, non-decreasing with increasing $j$, and $f$ is monotone iff $\epsilon_{n+1}=0$. We find that adding the size parameter can provide extra insight into the analysis results. Consider the static optimization problem with partition matroid constraints. \begin{definition}\label{def_static} Given a set function $f:2^V\to\mathbb{R}^+$, a partitioning $B=\{B_i\}_{i=1}^k$ of $V$, and a set of integer thresholds $D=\{d_i\}_{i=1}^k$, the problem is \begin{align*} \underset{X\subseteq V}{\text{maximize }}f(X), \text{ s.t. }|X\cap B_i|\leq d_i,\quad\forall i=1,\dots,k. \end{align*} \end{definition} We define notations $d=\sum_{i=1}^kd_i$, $\bar{d}=\min_i\{d_i\}$, and $OPT\subseteq V$ the feasible optimal solution. A solution $X\subseteq V$ is feasible iff it satisfies all constraints. It can be shown that $\bar{d}\leq d/k$, $|OPT|\leq d$, and any solution $X$ where $|X|\leq\bar{d}$ is feasible. Each instance is then uniquely defined by the triplet $(f,B,D)$. Without loss of generality, we assume $1\leq d_i\leq |B_i|$ for all $i$. We study the dynamic version of the problem in Definition \ref{def_static}. This dynamic problem demands adapting the solutions to changing constraints whenever such changes occur. \begin{definition}\label{def_dynamic} Given the problem in Definition \ref{def_static}, a dynamic problem instance is defined by a sequence of changes where the current $D$ in each change is replaced by $D^*=\{d^*_i\}_{i=1}^k$ such that $d^*_i\in[1,|B_i|]$ for $i=1,\dots,k$. The problem is to generate a solution $X$ that maximizes $f(X)$ for each newly given $D^*$ such that \[|X\cap B_i|\leq d^*_i,\quad\forall i=1,\dots,k.\] \end{definition} Such problems involve changing constraint thresholds over time. Using the oracle model, we assume time progresses whenever a solution is evaluated. We define notations $d^*=\sum_{i=1}^kd^*_i$, $\bar{d}^*=\min_i\{d^*_i\}$, and the new optimal solution $OPT^*$. Similarly, we assume $1\leq d^*_i\leq |B^*_i|$ for all $i$. Lastly, while restarting from scratch for each new thresholds is a viable tactic for any static problems solver, we focus on the capability of the algorithm to adapt to such changes. \subsection{POMC algorithm} The POMC algorithm \cite{POMC} is a Pareto Optimization approach for constrained optimization. It is also known as GSEMO algorithm in the evolutionary computation literature~\cite{SEMO,GSEMO,GSEMO2015}. As with many other evolutionary algorithms, the binary representation of a set solutions is used. For this algorithm, we reformulate the problem as a bi-objective optimization problem given as \[\text{maximize }(f_1(X),f_2(X)),\] where \[f_1(X)=\begin{cases*} f(X),&if $X$ is feasible\\ -\infty,&otherwise \end{cases*},\text{ }f_2(x)=-|X|.\] POMC optimizes two objectives simultaneously, using the dominance relation between solutions, which is common in Pareto optimization approaches. Recall that solution $X_1$ dominates $X_2$ ($X_1\succeq X_2$) iff $f_1(X_1)\geq f_1(X_2)$ and $f_2(X_1)\geq f_2(X_2)$. The dominance relation is strict ($X_1\succ X_2$) iff $X_1\succeq X_2$ and $f_i(X_1)>f_i(X_2)$ for at least one $i \in \{1,2\}$. Intuitively, dominance relation formalizes the notion of ``better'' solution in multi-objective contexts. Solutions that don't dominate any other present a trade-off between objectives to be optimized. The second objective in POMC is typically formulated to promote solutions that are ``further'' from being infeasible. The intuition is that for those solutions, there is more room for feasible modification, thus having more potential of becoming very good solutions. For the problem of interest, one way of measuring ``distance to infeasibility'' for some solution $X$ is counting the number of elements in $V\setminus X$ that can be added to $X$ before it is infeasible. The value then would be $d-|X|$, which is the same as $f_2(X)$ in practice. Another way is counting the minimum number of elements in $V\setminus X$ that need to be added to $X$ before it is infeasible. The value would then be $\min_i\{d_i-|B_i\cap X|\}$. The former approach is chosen for simplicity and viability under weaker assumptions about the considered problem. On the other hand, the first objective aims to present the canonical evolutionary pressure based on objective values. Additionally, $f_1$ also discourages all infeasible solutions, which is different from the formulation in \cite{POMC} that allows some degree of infeasibility. This is because for $k>1$, there can be some infeasible solution $Y$ where $|Y|\leq d$. If $f_1(Y)$ is very high, it can dominate many good feasible solutions, and may prevent acceptance of global optimal solutions into the population. Furthermore, restricting to only feasible solutions decreases the maximum population size, which can improve convergence performance. As a consequence, the population size of POMC for our formulation is at most $d+1$. Our formulation of the two objective functions is identical to the ones in \cite{GSEMO2015} when $k=1$. \begin{algorithm}[t] \begin{algorithmic}[1] \STATEx \textbf{Input:} a problem instance: $(f,B,D)$ \STATEx \textbf{Parameter:} the number of iterations $T\geq0$ \STATEx \textbf{Output:} a feasible solution $x\in\{0,1\}^n$ \STATE $x\gets0^n$, $P\gets\{x\}$ \WHILE{$t<T$} \IF{Change is detected} \STATE $P\gets P\setminus\{x\in P|\exists y\in P,y\neq x\wedge y\succeq x\}$ \ENDIF \STATE Randomly sample a solution $y$ from $P$ \STATE $y'\gets y$ after flipping each bit with probability $1/n$ \IF{$\nexists x\in P,x\succ y'$} \STATE $P\gets(P\setminus\{x\in P|y'\succeq x\})\cup\{y'\}$ \ENDIF \ENDWHILE \STATE \textbf{return} $\argmax_{x\in P}f_1(x)$ \end{algorithmic} \caption{POMC algorithm for dynamic problems} \label{alg:gsemo} \end{algorithm} POMC (see Algorithm~\ref{alg:gsemo}) starts with initial population consisting of the search point $0^n$ which represents the empty set. In each iteration, a new solution is generated by random parent selection and bit flip mutation. Then the elitist survivor selection mechanism removes dominated solutions from the population, effectively maintaining a set of trade-off solutions for the given objectives. The algorithm terminates when the number of iteration reaches some predetermined limit. We choose empty set as the initial solution, similar to \cite{POMC} and different from \cite{GSEMO2015}, to simplify the analysis and stabilize theoretical performance. Note that POMC calls the oracle once per iteration to evaluate a new solution, so its run time is identical to the number of iterations. We assume that changes are made known to the algorithm as they occur, and that feasibility can be checked efficiently. The reason for this is that infeasibility induced by changes in multiple thresholds has nontrivial impact on the algorithm's behaviour. For single constraint problems, this impact is limited to increases in population size \cite{ParetoSubsetDynCon}, since a solution's degree of feasibility entirely correlates with its second objective value. However, this is no longer the case for multiple constraints, as the second objective aggregates all constraints. While it reduces the population size as the result, it also allows for possibilities where solutions of small size (high in second objective) become infeasible after a change and thus dominate other feasible solutions of greater cardinality without updating evaluations. This can be circumvented by assuming that the changes' directions are the same every time, i.e., $(d^*_i-d_i)(d^*_j-d_j)\geq0$ for every $(i,j)$ pair. Instead of imposing assumptions on the problems, we only assume scenarios where POMC successfully detects and responds to changes. This allows us to focus our analysis entirely on the algorithm's adaptation efficiency under arbitrary constraint threshold change scenarios. \section{Runtime Analysis} For the runtime analysis of POMC for static problems, we refer to the results by~\citet{Do2020}. In short, its worst-case approximation ratios on static problems are comparable to those of the classical GREEDY algorithm, assuming submodularity and weak monotonicity in the objective function \cite{GreedyMaxBoundCurvPartMatroid}. On the other hand, a direct comparison in other cases is not straightforward as the bounds involve different sets of parameters. The strength of POMC in dynamic constraints handling lies in the fact that it stores a good solution for each cardinality level up to $\bar{d}$. In this way, when $\bar{d}$ changes, the population will contain good solutions for re-optimization. We use the concept of greedy addition $v^*_X$ to a solution $X$. \[v^*_X=\argmax_{v\in V\setminus X}f_1(X\cup\{v\}).\] It can be shown that for any $X$ where $|X|<\bar{d}$, the corresponding greedy addition $v^*_X$ w.r.t. $(f,B,D)$ is the same as the one w.r.t. $(f,B,D^*)$ if $\bar{d}^*\geq\bar{d}$, since $X\cup\{v\}$ is still feasible for all $v\in V\setminus X$. Thus, we can derive the following result from Lemma 2 in \cite{MaxMonoApproxSubmodMulti}, and Lemma 1 in \cite{Do2020}. \begin{lemma}\label{greed_prog_submodular_dyn} Let $f$ be a submodular function, $\bar{d}^*\geq\bar{d}$, and $\epsilon_d$ be defined in Definition \ref{mono_approx}, for all $X\subseteq V$ such that $|X|=j<\bar{d}$, we have both \begin{align*} &f(X\cup\{v^*_X\})-f(X)\geq\frac{1}{d}\left[f(OPT)-f(X)-j\epsilon_{d+j+1}\right],\\ &f(X\cup\{v^*_X\})-f(X)\geq\frac{1}{d^*}\left[f(OPT^*)-f(X)-j\epsilon_{d^*+j+1}\right]. \end{align*} \end{lemma} \begin{proof} The first part is from Lemma 1 in \cite{Do2020}, while the second follows since if $|X|<\bar{d}\leq\bar{d}^*$, then the element contributing the greedy marginal gain to $f_1(X)$ is unchanged. \end{proof} The result carries over due to satisfied assumption $|X|<\bar{d}^*$. Using these inequalities, we can construct a proof, following a similar strategy as the one for Theorem 5 in \cite{ParetoSubsetDynCon} which leads to the following theorem. \begin{theorem}\label{gsemo_submodular_dyn} For the problem of maximizing a submodular function under partition matroid constraints, assuming $\bar{d}^*\geq\bar{d}$, POMC generates a population $P$ in expected run time $\mathcal{O}(d^2n/k)$ such that \begin{align}\label{eq:gsemo_submodular_dyn} \begin{split} &\forall m\in[0,\bar{d}],\exists X\in P,|X|\leq m\\&\wedge f(X)\geq\left[1-\left(1-\frac{1}{d}\right)^{m}\right][f(OPT)-(m-1)\epsilon_{d+m}]\\&\wedge f(X)\geq\left[1-\left(1-\frac{1}{d^*}\right)^{m}\right][f(OPT^*)-(m-1)\epsilon_{d^*+m}]. \end{split} \end{align} \end{theorem} \begin{proof} Let $S(X,j)$ be the expression \begin{align*} &|X|\leq j\\&\wedge f(X)\geq\left[1-\left(1-\frac{1}{d}\right)^{j}\right][f(OPT)-(j-1)\epsilon_{d+j}]\\&\wedge f(X)\geq\left[1-\left(1-\frac{1}{d^*}\right)^{j}\right][f(OPT^*)-(j-1)\epsilon_{d^*+j}], \end{align*} and $Q(i)$ be the expression $\forall j\in[0,i],\exists X\in P_t,S(X,j)$. We have that $Q(0)$ holds. For each $h\in[0,\bar{d}-1]$, assume $Q(h)$ holds and $Q(h+1)$ does not hold at some iteration $t$. Let $X\in P_t$ be the solution such that $S(X,h)$ holds, $S(Y,h)$ and $Q(h)$ holds at iteration $t+1$ for any solution $Y\in P_{t+1}$ such that $Y\succeq X$. This means once $Q(h)$ holds, it must hold in all subsequent iterations of POMC. Let $X^*=X\cup\{v^*_X\}$, Lemma \ref{greed_prog_submodular_dyn} implies \begin{align*} f(X^*)&\geq\left[1-\left(1-\frac{1}{d}\right)^{h+1}\right][f(OPT)-h\epsilon_{d+h+1}],\\ \text{and}&\\ f(X^*)&\geq\frac{1}{d^*}f(OPT^*)-\frac{h}{d^*}\epsilon_{d^*+h+1}\\&+\left(1-\frac{1}{d^*}\right)\left[1-\left(1-\frac{1}{d^*}\right)^h\right]\\&[f(OPT^*)-(h-1)\epsilon_{d^*+h}]\\& \geq\left[1-\left(1-\frac{1}{d^*}\right)^{h+1}\right][f(OPT^*)-h\epsilon_{d^*+h+1}]. \end{align*} The second inequality uses $0\leq\epsilon_{d^*+h}\leq\epsilon_{d^*+h+1}$. This means that $S(X^*,h+1)$ holds. Therefore, if $X^*$ is generated, then $Q(h+1)$ holds, regardless of whether $X^*$ is dominated afterwards. According to the bit flip procedure, $X^*$ is generated with probability at least $1/(en(d+1))$ which implies \[\Pr[Q(h+1)|Q(h)]\geq\frac{1}{en(d+1)},\text{ and }\Pr[\neg Q(h)|Q(h)]=0.\] Using the additive drift theorem \cite{DriftAnalysis}, the expected number of iterations until $Q(\bar{d})$ holds is at most $e\bar{d}n(d+1)=\mathcal{O}(d^2n/k)$. This completes the proof. \end{proof} The statement \eqref{eq:gsemo_submodular_dyn} implies the following results. \begin{align*} &\forall m\in[0,\bar{d}],\exists X\in P,|X|\leq m\\&\wedge f(X)\geq\left(1-e^{m/d}\right)\left[f(OPT)-(m-1)\epsilon_{d+m}\right]\\&\wedge f(X)\geq\left(1-e^{m/d^*}\right)\left[f(OPT^*)-(m-1)\epsilon_{d^*+m}\right]. \end{align*} We did not put this more elegant form directly in Theorem \ref{gsemo_submodular_dyn} since it cannot be used in the subsequent proof; only Expression \eqref{eq:gsemo_submodular_dyn} is applicable. Note that the result also holds for $\bar{d}^*\leq\bar{d}$ if we change the quantifier to $\forall m\in[0,\bar{d}^*]$. It implies that when a change such that $\bar{d}^*\leq\bar{d}$ occurs after cubic run time, POMC is likely to instantly satisfy the new approximation ratio bound, which would have taken it extra cubic run time to achieve if restarted. Therefore, it adapts well in such cases, assuming sufficient run time is allowed between changes. On the other hand, if $\bar{d}^*>\bar{d}$, the magnitude of the increase affects the difficulty with which the ratio can be maintained. The result also states a ratio bound w.r.t. the new optimum corresponding to the new constraint thresholds. As we will show using this statement, by keeping the current population (while discarding infeasible solutions), POMC can adapt to the new optimum quicker than it can with the restart strategy. \begin{theorem}\label{gsemo_submodular_dyn2} Assuming POMC achieves a population satisfying \eqref{eq:gsemo_submodular_dyn}, after the change where $\bar{d}^*>\bar{d}$, POMC generates in expected time $\mathcal{O}((\bar{d}^*-\bar{d})d^*n)$ a solution $X$ such that \[f(X)\geq\left(1-e^{\bar{d}^*/d^*}\right)\left[f(OPT^*)-(\bar{d}^*-1)\epsilon_{d^*+\bar{d}^*}\right].\] \end{theorem} \begin{proof} Let $S(X,i)$ be the expression \begin{align*} &|X|\leq j\\&\wedge f(X)\geq\left[1-\left(1-\frac{1}{d^*}\right)^{j}\right][f(OPT^*)-(j-1)\epsilon_{d^*+j}]. \end{align*} Assuming \eqref{eq:gsemo_submodular_dyn} holds for some iteration $t$, let $\bar{X}\in P_t$ be a solution such that $S(\bar{X},i)$ holds for some $i\in[\bar{d},\bar{d}^*)$, and $v^*_{\bar{X}}=\argmax_{v\in V\setminus\bar{X}}\{f_1(\bar{X}\cup\{v\})-f_1(\bar{X})\}$ w.r.t. $(f,B,D^*)$ for any $\bar{X}\subset V$, and $\bar{X}'=\bar{X}\cup\{v^*_{\bar{X}}\}$, Lemma \ref{greed_prog_submodular_dyn} implies \begin{align*} f(\bar{X}')&\geq\left[1-\left(1-\frac{1}{d^*}\right)^{i+1}\right][f(OPT^*)-i\epsilon_{d^*+i+1}]. \end{align*} Hence, $S(\bar{X}',i+1)$ holds. It is shown that such a solution is generated by POMC with probability at least $1/(en(d^*+1))$. Also, for any solution $X$ satisfying $S(X,i)$, another solution $Y\succeq X$ must also satisfy $S(Y,i)$. Therefore, the Additive Drift Theorem implies that given $S(X,\bar{d})$ holds for some $X$ in the population, POMC generates a solution $Y$ satisfying $S(Y,\bar{d}^*)$ in expected time at most $(\bar{d}^*-\bar{d})en(d^*+1)=\mathcal{O}((\bar{d}^*-\bar{d})d^*n)$. Such a solution satisfies the inequality in the theorem. \end{proof} The degree with which $\bar{d}$ increases only contributes linearly to the run time bound, which shows efficient adaptation to the new search space. For the monotone objective functions cases, without loss of generality, we assume that $f$ is normalized ($f(\emptyset)=0$). We make use of the following inequalities, derived from Lemma 1 in \cite{PPOSS}, and Lemma 2 in \cite{Do2020}, using the same insight as before. \begin{lemma}\label{greed_prog_monotone_dyn} Let $f$ be a monotone function, $\bar{d}^*\geq\bar{d}$, and $\gamma_{i,j}$ be defined in Definition \ref{submodratio_def}, for all $X\subseteq V$ such that $|X|=j<\bar{d}$, we have both \begin{align*} &f(X\cup\{v^*_X\})-f(X)\geq\frac{\gamma_{j+1,d}}{d}[f(OPT)-f(X)],\\ &f(X\cup\{v^*_X\})-f(X)\geq\frac{\gamma_{j+1,d^*}}{d^*}[f(OPT^*)-f(X)]. \end{align*} \end{lemma} \begin{proof} The first part is from Lemma 2 in \cite{Do2020}, while the second follows since if $|X|<\bar{d}\leq\bar{d}^*$, then the element contributing the greedy marginal gain to $f_1(X)$ is unchanged. \end{proof} This leads to the following result which show POMC's capability in adapting to changes where $\bar{d}^*<\bar{d}$. \begin{theorem}\label{gsemo_monotone_dyn} For the problem of maximizing a monotone function under partition matroid constraints, assuming $\bar{d}^*\geq\bar{d}$, POMC generates a population $P$ in expected run time $\mathcal{O}(d^2n/k)$ such that \begin{align}\label{eq:gsemo_monotone_dyn} \begin{split} &\forall m\in[0,\bar{d}],\exists X\in P,|X|\leq m\\&\wedge f(X)\geq\left[1-\left(1-\frac{\gamma_{m,d}}{d}\right)^{m}\right]f(OPT)\\&\wedge f(X)\geq\left[1-\left(1-\frac{\gamma_{m,d^*}}{d^*}\right)^{m}\right]f(OPT^*). \end{split} \end{align} \end{theorem} \begin{proof} Let $S(X,j)$ be the expression \begin{align*} |X|\leq j&\wedge f(X)\geq\left[1-\left(1-\frac{\gamma_{j,d}}{d}\right)^{j}\right]f(OPT)\\&\wedge f(X)\geq\left[1-\left(1-\frac{\gamma_{j,d^*}}{d^*}\right)^{j}\right]f(OPT^*), \end{align*} and $Q(i)$ be the expression $\forall j\in[0,i],\exists X\in P_t,S(X,j)$. We have that $Q(0)$ holds. Similar to the proof for Theorem \ref{gsemo_submodular_dyn}, we get, using Lemma \ref{greed_prog_monotone_dyn}, that the expected number of iterations of POMC until $Q(\bar{d})$ holds is at most $\mathcal{O}(d^2n/k)$. \ignore{ For each $h\in[0,\bar{d}-1]$, assume $Q(h)$ holds and $Q(h+1)$ does not hold at some iteration $t$, let $X\in P_t$ be the solution such that $S(X,h)$ holds, $S(Y,h)$ and $Q(h)$ holds at iteration $t+1$ for any solution $Y\in P_{t+1}$ such that $Y\succeq X$. This means once $Q(h)$ holds, it must hold in all subsequent iterations of POMC. Let $X^*=X\cup\{v^*_X\}$, Lemma \ref{greed_prog_monotone_dyn} implies \begin{align*} f(X^*)&\geq\left[1-\left(1-\frac{\gamma_{h,d}}{d}\right)^{h+1}\right]f(OPT),\\ \text{and}&\\ f(X^*)&\geq\frac{\gamma_{h,d^*}}{d^*}f(OPT^*)\\&+\left(1-\frac{\gamma_{h+1,d^*}}{d^*}\right)\left[1-\left(1-\frac{\gamma_{h,d^*}}{d^*}\right)^h\right]f(OPT^*)\\& \geq\left[1-\left(1-\frac{\gamma_{h+1,d^*}}{d^*}\right)^{h+1}\right]f(OPT^*). \end{align*} The second inequality uses $\gamma_{h,d^*}\geq\gamma_{h+1,d^*}$. This means $S(X^*,h+1)$ holds. Therefore, if $X^*$ is generated, then $Q(h+1)$ holds, regardless of whether $X^*$ is dominated afterwards. According to the bit flip procedure, $X^*$ is generated with probability at least $1/en(d+1)$, so \[\Pr[Q(h+1)|Q(h)]\geq\frac{1}{en(d+1)},\quad\text{and}\quad\Pr[\neg Q(h)|Q(h)]=0.\] The Additive Drift Theorem implies that assuming $Q(0)$, the expected number of iterations before $Q(\bar{d})$ holds is at most $e\bar{d}n(d+1)=\mathcal{O}(d^2n/k)$. This proves the theorem.} \end{proof} Similar to Expression~\eqref{eq:gsemo_submodular_dyn}, Expression~\eqref{eq:gsemo_monotone_dyn} gives a more elegant form. \begin{align*} &\forall m\in[0,\bar{d}],\exists X\in P,|X|\leq m\\&\wedge f(X)\geq\left(1-e^{-\gamma_{m,d}m/d}\right)f(OPT)\\&\wedge f(X)\geq\left(1-e^{-\gamma_{m,d^*}m/d^*}\right)f(OPT^*). \end{align*} Just like Theorem \ref{gsemo_submodular_dyn}, this result holds for $\bar{d}^*\leq\bar{d}$ when the quantifier is $\forall m\in[0,\bar{d}^*]$. It is implied that if such a population is made, the new approximation ratio bound is immediately satisfied when the thresholds decrease. Once again, we can derive the result on POMC's adapting performance to $\bar{d}^*\geq\bar{d}$ by using Theorem \ref{gsemo_monotone_dyn}. \begin{theorem}\label{gsemo_monotone_dyn2} Assuming POMC achieves a population satisfying \eqref{eq:gsemo_monotone_dyn}, after the change where $\bar{d}^*>\bar{d}$, POMC generates in expected time $\mathcal{O}((\bar{d}^*-\bar{d})d^*n)$ a solution $X$ such that \[f(X)\geq\left(1-e^{-\gamma_{\bar{d}^*,d^*}\bar{d}^*/d^*}\right)f(OPT^*).\] \end{theorem} \begin{proof} Let $S(X,i)$ be a expression \[|X|\leq j\wedge f(X)\geq\left[1-\left(1-\frac{\gamma_{\bar{d}^*,d^*}}{d^*}\right)^{j}\right]f(OPT^*).\] Assuming \eqref{eq:gsemo_monotone_dyn} holds for some iteration $t$, let $\bar{X}\in P_t$ be a solution such that $S(\bar{X},i)$ holds for some $i\in[\bar{d},\bar{d}^*)$, and $v^*_{\bar{X}}=\argmax_{v\in V\setminus\bar{X}}\{f_1(\bar{X}\cup\{v\})-f_1(\bar{X})\}$ w.r.t. $(f,B,D^*)$ for any $\bar{X}\subset V$, and $\bar{X}'=\bar{X}\cup\{v^*_{\bar{X}}\}$, Lemma \ref{greed_prog_monotone_dyn} implies \begin{align*} f(\bar{X}')&\geq\left[1-\left(1-\frac{\gamma_{i+1,d^*}}{d^*}\right)^{i+1}\right]f(OPT^*). \end{align*} So $S(\bar{X}',i+1)$ holds. Following the same reasoning in the proof for Theorem \ref{gsemo_submodular_dyn2}, we get that POMC, given a solution $X$ in the population satisfying $S(X,\bar{d})$, generates another solution $Y$ satisfying $S(Y,\bar{d}^*)$ in expected run time at most $\mathcal{O}((\bar{d}^*-\bar{d})d^*n)$. \end{proof} Theorem \ref{gsemo_submodular_dyn2} and Theorem \ref{gsemo_monotone_dyn2} state that there is at least one solution in the population that satisfies the respective approximation ratio bounds in each case, after POMC is run for at least some expected number of iterations. However, the proofs for Theorem \ref{gsemo_submodular_dyn} and Theorem \ref{gsemo_monotone_dyn} also imply that the same process generates, for each cardinality level from $0$ to $\bar{d}^*$, a solution that also satisfies the respective approximation bound ratio, adjusted to the appropriate cardinality term. These results imply that instead of restarting, maintaining the non-dominated population provides a better starting point to recover relative approximation quality in any case. This suggests that the inherent diversity in Pareto-optimal fronts is suitable as preparation for changes in constraint thresholds. \section{Experimental Investigations} We compare the POMC algorithm against GREEDY \cite{GreedyMaxBoundCurvPartMatroid} with the restart approach, on undirected max cut problems with random graphs. Given a graph $G=(V,E,c)$ where $c$ is a non-negative edge weight function, the goal is to find, while subjected to changing partition matroid constraints, \[X^*=\argmax_X\left\lbrace\sum_{a\in X,b\in V\setminus X}c(a,b)\right\rbrace.\] Weighted graphs are generated for the experiments based on two parameters: number of vertices ($n$) and edge density. Here, we consider $n=200$, and 5 density values: 0.01, 0.02, 0.05, 0.1, 0.2. For each $n$-$density$ pair, a different weighted graph is randomly generated with the following procedure: \begin{enumerate} \item Randomly sample $E$ from $V\times V$ without replacement, until $|E|=\lfloor density\times n^2\rfloor$. \item Assign to $c(a,b)$ a uniformly random value in $[0,1]$ for each $(a,b)\in E$. \item Assign $c(a,b)=0$ for all $(a,b)\notin E$. \end{enumerate} To limit the variable dimensions so that the results are easier to interpret, we only use one randomly chosen graph for each $n$-density pair. We also consider different numbers of partitions $k$: 1, 2, 5, 10. For $k>1$, each element is assigned to a partition randomly. Also, the sizes of the partitions are equal, as with the corresponding constraint thresholds. \begin{figure}[t!] \centering \includegraphics[width=.8\linewidth]{b.eps} \caption{Threshold level over time for dynamic problems} \label{fig:thres_changes} \end{figure} The dynamic component is the thresholds $d_i$. We use the approach outlined in \cite{DynKnapsack} to generate threshold changes in the form of a sequence of $m$ values $\{b_i\}_{i=1}^m$. In particular, these values range in $[0,1]$ and are applied to each instance: $d_i=\max\{b_j|B_i|,1\}$ at the $j^{th}$ change, rounded to the nearest integer. The generating formulas are as follow: \[b_1=\mathcal{U}(0,1),\quad b_{i+1}=\max\{\min\{b_i+\mathcal{N}(0,0.05^2),1\},0\}.\] The values $b_i$ used in the experiments are displayed in Figure \ref{fig:thres_changes} where the number of changes is $m=200$. For each change, the output of GREEDY is obtained by running without restriction on evaluations. These values are used as baselines to compare against POMC's outputs . POMC is run with three different settings for the number of evaluations between changes: $5000$, $10000$, $20000$. Smaller numbers imply a higher change frequency leading to a higher difficulty in adapting to changes. Furthermore, POMC is run 30 times for each setting, and means and standard deviations of results are shown in POMC$_{5000}$, POMC$_{10000}$, POMC$_{20000}$, corresponding to different change frequency settings. \ignore{ \begin{figure*}[ht!] \centering \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_100_01_1.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_100_01_2.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_100_01_5.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_100_01_10.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_100_05_1.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_100_05_2.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_100_05_5.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_100_05_10.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_100_2_1.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_100_2_2.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_100_2_5.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_100_2_10.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_200_01_1.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_200_01_2.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_200_01_5.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_200_01_10.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_200_05_1.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_200_05_2.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_200_05_5.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_200_05_10.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_200_2_1.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_200_2_2.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_200_2_5.eps} \end{subfigure} \begin{subfigure}{0.246\textwidth} \centering \includegraphics[width=\textwidth]{t_200_2_10.eps} \end{subfigure} \caption{POMC's mean outputs against GREEDY's over time in 6 graph settings. Standard deviations in POMC's are minimal. \frank{Figure doesn't really show differences. Better to do a table with statistical results?} }. \label{fig:timeplot} \end{figure*} } \begin{table*}[t!] \begin{small} \renewcommand{\arraystretch}{.76} \caption{Experimental results for dynamic max cut with $n=200$. Outputs are shown in batches of 50 threshold changes. L--W--T are numbers of losses, wins, ties POMC has over GREEDY, determined by U-tests on data in each change.} \label{table:experimentsd} \begin{center} \begin{tabular}{lll@{\hspace{6pt}}c@{\hspace{6pt}}c@{\hspace{6pt}}c@{\hspace{6pt}}c@{\hspace{6pt}}c@{\hspace{6pt}}c@{\hspace{6pt}}c@{\hspace{6pt}}c@{\hspace{6pt}}c@{\hspace{6pt}}c@{\hspace{6pt}}c} \toprule \multirow{2}{*}{$k$}&\multirow{2}{*}{density}&\multirow{2}{*}{Changes}&\multicolumn{2}{c}{GREEDY}&\multicolumn{3}{c}{POMC$_{5000}$}&\multicolumn{3}{c}{POMC$_{10000}$}&\multicolumn{3}{c}{POMC$_{20000}$}\\\cmidrule(l{2pt}r{2pt}){4-5}\cmidrule(l{2pt}r{2pt}){6-8}\cmidrule(l{2pt}r{2pt}){9-11}\cmidrule(l{2pt}r{2pt}){12-14}&&&mean&std&mean&std&L--W--T&mean&std&L--W--T&mean&std&L--W--T\\\cmidrule(l{2pt}r{2pt}){1-14} \multirow{12}{*}{1}&\multirow{4}{*}{0.01}&1--50&82.93&27.5&81.26&27.01&26--17--7&82.85&27.49&17--25--8&83.68&27.81&7--31--12\\& &51--100&57.17&24.63&56.11&23.79&39--2--9&56.88&24.26&26--7--17&57.29&24.57&13--16--21\\& &101--150&100.7&5.001&100.9&5.535&12--32--6&101.7&5.255&5--43--2&102.3&5.11&1--48--1\\& &151--200&103.1&1.436e-14&105.1&0.2395&0--50--0&105.1&0.2814&0--50--0&105.2&0.2764&0--50--0\\\cmidrule(l{2pt}r{2pt}){2-14} &\multirow{4}{*}{0.05}&1--50&289.3&106.2&283.7&103.4&30--12--8&288.3&105.3&20--20--10&290.5&106.3&7--29--14\\& &51--100&186.4&87.89&183.5&85.18&43--0--7&185.3&86.25&33--1--16&186.2&86.92&19--10--21\\& &101--150&359.4&23.64&358.2&24.7&23--23--4&361.9&25.16&9--39--2&363.5&24.95&2--47--1\\& &151--200&373.2&2.297e-13&379.5&1.618&0--50--0&380.6&1.817&0--50--0&379.5&1.344&0--50--0\\\cmidrule(l{2pt}r{2pt}){2-14} &\multirow{4}{*}{0.2}&1--50&890.3&345.2&877.6&336.8&31--13--6&886.8&341&23--21--6&892&343.8&12--28--10\\& &51--100&551.7&274.3&545.1&266.1&41--2--7&548.7&268.9&34--5--11&550.6&270.5&28--9--13\\& &101--150&1121&79.61&1116&81.18&33--16--1&1123&81.52&18--25--7&1126&81.89&8--41--1\\& &151--200&1167&4.594e-13&1179&1.773&0--50--0&1180&1.592&0--50--0&1181&1.734&0--50--0\\\cmidrule(l{2pt}r{2pt}){1-14} \multirow{12}{*}{2}&\multirow{4}{*}{0.01}&1--50&83&26.99&81.06&26.38&29--14--7&82.77&26.93&20--20--10&83.65&27.27&7--30--13\\& &51--100&56.89&24.54&55.62&23.61&42--0--8&56.45&24.08&32--3--15&56.91&24.39&17--13--20\\& &101--150&100.7&4.921&100.5&5.562&18--27--5&101.5&5.351&5--39--6&102.2&5.136&1--48--1\\& &151--200&103.1&1.436e-14&105.2&0.2744&0--50--0&105.1&0.3222&0--50--0&105.2&0.3047&0--50--0\\\cmidrule(l{2pt}r{2pt}){2-14} &\multirow{4}{*}{0.05}&1--50&289.4&104.8&283.2&101.9&37--9--4&288&103.9&26--18--6&290.7&105.1&13--30--7\\& &51--100&185.5&87.7&181.9&84.58&44--0--6&184&85.82&36--1--13&185.1&86.55&25--9--16\\& &101--150&359.6&23.24&357.8&24.65&27--21--2&361.4&24.79&12--35--3&363.3&24.71&2--44--4\\& &151--200&373.2&2.297e-13&379.5&1.547&0--50--0&380.2&1.603&0--50--0&379.6&1.72&0--50--0\\\cmidrule(l{2pt}r{2pt}){2-14} &\multirow{4}{*}{0.2}&1--50&890.5&341.2&876.4&332.2&33--8--9&886.5&337&24--19--7&891.8&339.6&15--26--9\\& &51--100&548.6&274&540.8&265&42--1--7&544.9&268.2&40--5--5&547.2&270.1&28--7--15\\& &101--150&1121&78.79&1115&80.14&32--15--3&1122&80.65&19--25--6&1126&80.84&6--41--3\\& &151--200&1167&4.594e-13&1178&2.186&0--50--0&1180&1.777&0--50--0&1181&1.365&0--50--0\\\cmidrule(l{2pt}r{2pt}){1-14} \multirow{12}{*}{5}&\multirow{4}{*}{0.01}&1--50&82.89&26.89&80.18&26.47&35--10--5&82.03&26.82&28--17--5&83.19&27.09&21--22--7\\& &51--100&57.45&23.4&55.25&22.07&46--0--4&56.51&22.63&44--0--6&57.13&22.94&35--2--13\\& &101--150&100.3&5.205&98.99&6.439&31--15--4&100.4&6.181&17--26--7&101.3&5.851&7--38--5\\& &151--200&103.1&1.436e-14&105.1&0.299&0--50--0&105.2&0.3053&0--50--0&105.3&0.2958&0--50--0\\\cmidrule(l{2pt}r{2pt}){2-14} &\multirow{4}{*}{0.05}&1--50&288.1&104.2&276&99.2&45--2--3&282&101&40--7--3&286.2&102.6&35--10--5\\& &51--100&185.9&83.57&179.9&79.17&44--3--3&183&80.87&41--5--4&184.9&81.91&31--13--6\\& &101--150&357.1&25.23&347.7&27.29&41--2--7&353.3&26.81&35--13--2&357.4&26.77&23--20--7\\& &151--200&373.1&0.1956&376&4.098&4--38--8&377.8&3.594&2--44--4&379.5&2.772&0--48--2\\\cmidrule(l{2pt}r{2pt}){2-14} &\multirow{4}{*}{0.2}&1--50&891.6&337.8&868.9&324.9&42--2--6&881.1&329.8&40--7--3&888.7&333.4&27--10--13\\& &51--100&556.6&262.2&546.6&251.8&45--0--5&552.3&256&38--1--11&555.2&258.4&26--5--19\\& &101--150&1117&82.61&1101&84.57&37--10--3&1110&83.79&33--14--3&1117&83.62&25--20--5\\& &151--200&1167&4.594e-13&1175&4.725&0--48--2&1178&4.139&0--50--0&1180&2.777&0--50--0\\\cmidrule(l{2pt}r{2pt}){1-14} \multirow{12}{*}{10}&\multirow{4}{*}{0.01}&1--50&80.91&27.29&77.03&26.71&41--3--6&79.3&27.08&32--10--8&80.69&27.32&20--17--13\\& &51--100&54.9&21.54&51.59&19.49&50--0--0&53.23&20.3&47--0--3&54.17&20.78&38--1--11\\& &101--150&99.72&5.231&97.23&7.459&33--11--6&99.15&6.985&20--24--6&100.3&6.261&12--34--4\\& &151--200&103.1&0.09412&105&0.3504&0--50--0&105.1&0.3296&0--50--0&105.2&0.2794&0--50--0\\\cmidrule(l{2pt}r{2pt}){2-14} &\multirow{4}{*}{0.05}&1--50&282.7&105.5&268.5&99.61&50--0--0&275.1&101.5&43--2--5&279.9&103.2&32--9--9\\& &51--100&179.9&77.93&172.3&72.08&49--0--1&176.4&74.58&43--2--5&178.9&76.24&27--10--13\\& &101--150&356.2&23.7&344.8&28.83&44--1--5&351.2&27.92&37--11--2&355.8&26.49&21--21--8\\& &151--200&372.6&0.7456&374.1&4.464&7--36--7&376.3&3.334&2--45--3&377.5&2.62&1--49--0\\\cmidrule(l{2pt}r{2pt}){2-14} &\multirow{4}{*}{0.2}&1--50&877.9&340.8&850.1&324.3&45--4--1&865.3&330.6&36--8--6&873.5&334.4&24--17--9\\& &51--100&544.6&247&532&233.3&41--4--5&539.2&238.8&30--12--8&543.5&242.3&17--21--12\\& &101--150&1116&77.15&1093&82.69&45--2--3&1106&81.16&36--10--4&1115&79.89&22--21--7\\& &151--200&1166&1.281&1167&9.098&8--32--10&1173&6.941&2--44--4&1176&5.929&1--48--1\\\cmidrule(l{2pt}r{2pt}){1-14} \end{tabular} \end{center} \end{small \end{table*} We show the aggregated results in Table \ref{table:experimentsd} where a U-test \cite{Corder09} with 95\% confidence interval is used to determine statistical significance in each change. The results show that outputs from both algorithms are very closely matched most of the time, with the greatest differences observed in low graph densities. Furthermore, we expect that GREEDY fairs better against POMC when the search space is small (low threshold levels). While this is observable, the opposite phenomenon when the threshold level is high can be seen more easily. We see that during consecutive periods of high constraint thresholds, POMC's outputs initially fall behind GREEDY's, only to overtake them at later changes. This suggests that POMC rarely compromises its best solutions during those periods as the consequence of the symmetric submodular objective function. It also implies that restarting POMC from scratch upon a change would have resulted in significantly poorer results. On the other hand, POMC's best solutions follow GREEDY's closely during low constraint thresholds periods. This indicates that by maintaining feasible solutions upon changes, POMC keeps up with GREEDY in best objectives well within quadratic run time. Comparing outputs from POMC with different interval settings, we see that those from runs with higher number of evaluations between changes are always better. However, the differences are minimal during the low constraint thresholds periods. This aligns with our theoretical results in the sense that the expected number of evaluations needed to guarantee good approximations depends on the constraint thresholds. As such, additional evaluations won't yield significant improvements within such small feasible spaces. Comparing between different $k$ values, POMC seems to be at a disadvantage against GREEDY's best at increased $k$. This is expected since more partitions leads to more restrictive feasible search spaces, given everything else is unchanged, and small feasible spaces amplify the benefit of each greedy step. Nevertheless, POMC does not seem to fall behind GREEDY significantly for any long period, even when given few resources. \section{Conclusions} In this study, we have considered combinatorial problems with dynamic constraint thresholds, particularly the important classes of problems where the objective functions are submodular or monotone. We have contributed to the theoretical run time analysis of a Pareto optimization approach on such problems. Our results indicate POMC's capability of maintaining populations to efficiently adapt to changes and preserve good approximations. In our experiments, we have shown that POMC is able to maintain at least the greedy level of quality and often even obtains better solutions. \section{Acknowledgements} This work has been supported by the Australian Research Council through grants DP160102401 and DP190103894.
{'timestamp': '2020-12-17T02:09:09', 'yymm': '2012', 'arxiv_id': '2012.08738', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08738'}
arxiv
\section{Introduction} In recent years, there are more and more big data based deep learning tasks, such as ImageNet classification, natural language processing, and face recognition. The datasets often include tens of millions of images, texts, voices or other data, and the related neural networks (NNs) also contain multiple millions of parameters. For such complex tasks, how to improve the training efficiency has attracted mounting attention. It is natural to use multiple Graphics Processing Unit (GPU) as the parallel computing power, which can feed a very large batch size of data into the network at each training iteration. Unfortunately, this large batch size training deteriorates the model performance in respect of accuracy, convergence time, and more. This generalization difficulty has been reported previously \cite{lecun2012efficient,diamos2016persistent,keskar2017on,goyal2017accurate,jastrzebski2018three}, and widely known as a ‘generalization gap’ \cite{keskar2017on}. We reimplement this problem using AlexNet on Cifar10 dataset (Figure \ref{fig_1}). Many efforts have been devoted to understanding the ‘generalization gap’ \cite{breuel2015the,keuper2016distributed,neyshabur2017exploring,li2017batch,dai2018towards}. Keskar et al. \yrcite{keskar2017on} and Jastrzebski et al. \yrcite{jastrzebski2018finding} found that large batch size training is more likely to converge to sharp minima compared to small batch size training. In this vein, Wen et al. \yrcite{wen2018smoothout:} and Haruki et al. \yrcite{haruki2019gradient} proposed noise injecting methods to eliminate sharp minima. Jastrzebski et al. \yrcite{jastrzebski2018three} reported that higher values of the ratio of learning rate (LR) to batch size can lead to flatter minima. Hoffer et al. \yrcite{hoffer2017train} put forward a new hypothesis, ‘random walk on a random landscape’, and experimentally demonstrated that the ‘generalization gap’ can be primarily attributed to the reduced number of parameter updates. This hypothesis suggests that longer training time helps to achieve better generalization. LR scheduling is a class of methods that could alleviate the ‘generalization gap’. Goyal et al. \yrcite{goyal2017accurate} tested a ‘learning rate warm-up’ scheme, in which a small ‘safe’ LR was initialized and linearly scaled to a target ‘base’ LR. Using this method, they successfully compress the training time of ImageNet to less than 1 hour. MegDet, an object detector, obtained the state of the art performance using a combined policy: warmup LR and Cross-GPU batch normalization \cite{peng2017megdet:}. You et al. \yrcite{you2019large-batch} proposed an improved approach of warm-up, linear-epoch gradual-warmup (LEGW), which gains better generalization. Smith \& Topin \yrcite{smith2017super-convergence:} described a phenomenon named ‘super-convergence’ with periodic LR modulation. Li et al. \yrcite{li2019towards} demonstrated that NN models with small LR first generalize to low-noise and hard-to-fit patterns, and Jastrzebski et al. \yrcite{jastrzebski2018three} explained the ratio of LR to batch size is a key determinant of statistical gradient descent (SGD) dynamics. Batch size scheduling is regarded as the counterpart of LR scheduling. The largest useful batch size can be predicted by the gradient noise scale \cite{mccandlish2018an}. Increasing batch size helps find flatter minima \cite{devarakonda2017adabatch:,smith2018don't}. Mikami \& Suganuma \yrcite{Mikami2018imageNet} have trained ImageNet in 224 seconds using a predetermined batch size scheduling. The discovery of the unbalance distribution of both parameters and gradients across layers in a network is an important breakthrough for large batch size training. The generalization is markedly enhanced in case of setting a layer-wise LR, which is determined by some form of statistical values of the inlayer parameters and gradients. You et al. \yrcite{you2017large} firstly built an algorithm, ‘Layer-wise Adaptive Rate Scaling (LARS)’, to extend ImageNet training batch size to 32 K. In their sequential work, they showed that using LARS, the ImageNet can be even trained in a few minutes \cite{you2017scaling,you2018imagenet}. Two relatives of LARS, ‘PercentDelta’ and ‘LAMB’, have achieved better generalization \cite{abuelhaija2017proportionate,you2019reducing}. Using ‘LAMB’ optimizer, You et al. \yrcite{you2019reducing} have reduced the pre-training time of BERT to 76 minutes. In parallel with the above-mentioned approach, new methods such as adding noise to gradients \cite{wen2019interplay}, applying second-order information \cite{martens2015optimizing,yao2018large,adya2018nonlinear}, using local SGD instead of large batch size \cite{lin2018don't}, and batch augmentation \cite{hoffer2017train} have also attracted a lot of interest. \begin{figure}[ht] \vskip \fighead{} \begin{center} \centerline{\includegraphics[width=\figwidth]{fig_001.eps}} \vskip \figtocaption{} \caption{Impact of batch size on AlexNet accuracy using Cifar10 dataset} \label{fig_1} \end{center} \vskip \figrear{} \end{figure} In this study, we explore the evolution of the basic geometry properties of NNs with varying batch sizes. Such geometrical properties include parameter, gradient, and loss. Our main work include: \begin{itemize} \item First, we make a theoretical and experimental analysis on the geometry limit of large batch size training. \item Based on the work above, the authors propose a guidance to improve ‘generalization gap’. \item Then we design a parameter update algorithm based on the approximated loss curve curvature. \item In the last part, we provide theoretical backbones for the major part of the existing research results of ‘generalization gap’, and investigate the geometry picture of large batch size training. \end{itemize} \section{Theoretical and Experimental Analysis} Figure \ref{fig_1} raises a highly concerned problem that large batch size deteriorates the training performance. To avoid subjective bias and search for an in-depth insight, we focus on inspecting of some fundamental network properties, including gradient, parameter update step length and loss update step length with varying batch sizes. If there’s no special specifications, all the experiments in this paper are carried out on Pytorch, using AlexNet and Cifar10 dataset, with SGD as the default optimizer. \subsection{Gradient} We probe the impact of batch size on gradient by combining theory and experiments. The curvature of loss determines the parameter update amplitude in terms of LR, and in a update step, the related parameter will inch closer to a nearby minima of the loss curve, with a update step length given by the product of gradient and LR. We find that curvature across layers in a network varies remarkably (Figure \ref{fig_2}), and thus it is reasonable to treat gradient in a manner of layer independent. Theoretically, the gradient of each parameter is the average value of the samples in a whole batch size, and we suppose here that the distribution of gradient on a layer is Gaussian especially in the initial training epochs: \vskip -15pt \begin{equation} \label{eqn_1} g^k_i\sim N(\mu,\sigma) \end{equation} \vskip \eqnlowerspace where \(g_i^k\) is the \(i\)th gradient corresponding to the \(k\)th sample in a given layer; \(\mu\) and \(\sigma\) denote the mean and standard deviation of the distribution, respectively. \(\mu=0\) is another assumption considering the parameters evenly distributed near the minima. \(\sigma\) is treated as a constant, which relates to both the average curvature of the layer and the structure of the network. The mean gradient over a batch of sample is \vskip \eqnupspace \begin{equation} \label{eqn_2} g_i=\frac{1}{n}\sum_{k=0}^n g^k_i\sim N(0,\frac{\sigma}{\sqrt{n}}) \end{equation} \vskip \eqnlowerspace where \(n\) is the batch size. The probability density function is \vskip \eqnupspace \begin{equation} \label{eqn_3} f(g_i)=\frac{\sqrt{n}}{\sigma \sqrt{2\pi}}e^{-\frac{1}{2}(\frac{g_i}{\sigma \sqrt{n}})^2} \end{equation} \vskip \eqnlowerspace The expectation of the absolute value of \(g_i\) on all gradients in a layer is \vskip \eqnupspace \begin{equation} \label{eqn_4} E(\left|g_i \right|)=\int_{-\infty}^\infty f(g_i)\left|g_i \right|d g_i=\frac{2\sigma}{\sqrt{\pi}}\frac{1}{\sqrt{n}} \end{equation} \vskip \eqnlowerspace This function predicts that the mean gradient will decrease when batch size increases. To verify this prediction, in the first update step, we compute \(E(\left|g_i \right|)\) of the first fully connected layer of AlexNet on Cifar10 dataset from batch size 32 to 60000, and Figure \ref{fig_3} shows the expected result. The consistence between theoretical and experimental results indicates that gradients falling to zero with large batch size is immutable, and it is doomed very large batch size training will result in a poor model performance, if there is no adaption on the network architecture. \begin{figure}[ht] \vskip \fighead{} \begin{center} \centerline{\includegraphics[width=\figwidth]{fig_002.eps}} \vskip \figtocaption{} \caption{Curvature variations across the layers of AlexNet. The average curvature radius of Bias is artificially enlarged by10 times.} \label{fig_2} \end{center} \vskip \figrear{} \end{figure} \begin{figure}[ht] \vskip \fighead{} \begin{center} \centerline{\includegraphics[width=\figwidth]{fig_003.eps}} \vskip \figtocaption{} \caption{Impact of batch size on the average gradient. The average gradient is the L1 norm of the gradients divided by the number of the parameters in the first fully connected layer of AlexNet.} \label{fig_3} \end{center} \vskip \figrear{} \end{figure} \subsection{Parameter} The gradient vanishing effect of large batch size will definitely lower the parameter update step length. The common parameter update rule is \vskip -15pt \begin{equation} \label{eqn_5} \Delta w_i=lr(n) g_i \end{equation} \vskip \eqnlowerspace where \(\Delta w_i\) and \(lr(n)\) are the parameter update step length and the LR with respect to batch size \(n\) , respectively. Combining eqn. \ref{eqn_4}, the average parameter update step length across a specific layer is \vskip \eqnupspace \begin{equation} \label{eqn_6} E(\left| \Delta w_i \right|)=lr(n) E(\left| g_i \right|)=\frac{2\sigma}{\sqrt{\pi}}\frac{lr(n)}{\sqrt{n}} \end{equation} \vskip \eqnlowerspace To validate this finding, we compute the first epoch value of the ‘Normalized parameter stride’, \( E(\left| \Delta w_i \right|) \verb|/| lr(n) \), with varying batch sizes. As shown in Figure \ref{fig_4}, we observe a significant shrink of this value with large batch size. \begin{figure}[ht] \vskip \fighead{} \begin{center} \centerline{\includegraphics[width=\figwidth]{fig_004.eps}} \vskip \figtocaption{} \caption{Impact of batch size on the normalized parameter update step length in the first epoch.} \label{fig_4} \end{center} \vskip \figrear{} \end{figure} The parameter searching space accumulated from each update step is a key point for network optimization. It is obvious that the probability to find a better minima is bigger with larger searching space. We record the ‘Parameter update stride’, \( E(\left| \Delta w_i \right|) \), of each epoch during multiple AlexNet training tasks (Cifar10 dataset). As shown in Figure \ref{fig_5}, the area under a single result curve represents the total parameter searching space for a specific batch size. For small batch sizes, the parameter searching space is big enough to obtain an optimal minima for each parameter, while for large batch sizes, it is more likely a small-area minima will be found and thus less likely a good-performance model will be trained. \begin{figure}[ht] \vskip \fighead{} \begin{center} \centerline{\includegraphics[width=\figwidth]{fig_005.eps}} \vskip \figtocaption{} \caption{Parameter update stride from batch-size 32 to batch-size 49152. The area below a curve represents the parameter searching space.} \label{fig_5} \end{center} \vskip \figrear{} \end{figure} \subsection{Loss} The vanishing of both gradient and parameter update step length will definitely affect the loss update process. We commit a brief theoretical derivation to study the rule change. Referring the geometry relations of \( \Delta L \) and \( \Delta w_i \) in Figure \ref{fig_6}, the loss decrement induced by a single parameter update step is \vskip -15pt \begin{equation} \label{eqn_7} \Delta L_i=\Delta w_i g_i=lr(n) (g_i)^2 \end{equation} \vskip \eqnlowerspace \begin{figure}[ht] \vskip \fighead{} \begin{center} \centerline{\includegraphics[width=7cm]{fig_006.pdf}} \vskip -0.1in \caption{A conceptual sketch of minima, gradient, parameter update step length, and loss update step length.} \label{fig_6} \end{center} \vskip \figrear{} \end{figure} Then the average loss update step length across the batch of samples is \vskip \eqnupspace \begin{equation} \label{eqn_8} E(\Delta L_i )=lr(n)E((g_i)^2 )=\sigma^2 \frac{lr(n)}{n} \end{equation} \vskip \eqnlowerspace This equation gives the theoretical results of the average loss decrement in a single update step. To check the impact of large batch size training on loss changing, we compute the ‘First epoch loss stride’, \( E(\Delta L_i ) / lr(n) \), in the first epoch of training process, and the results shown in Figure \ref{fig_7} are consistent with our theoretical predictions. \begin{figure}[ht] \vskip \fighead{} \begin{center} \centerline{\includegraphics[width=\figwidth]{fig_007.eps}} \vskip \figtocaption{} \caption{Impact of batch size on the normalized first epoch loss update length} \label{fig_7} \end{center} \vskip \figrear{} \end{figure} In addition to this experiment, we also compare the whole training process with varying batch sizes in Figure \ref{fig_8}. Besides the loss curves changing as expected, we observe a phenomenon that for both small and large batch sizes, the fluctuation amplitude of the loss curves are big, while for medium batch size, the amplitude are relatively small. We preliminary judge that there are two factors that can lead to network instability: the small parameter update step length in large batch-size training and the big randomness in small batch-size training. \begin{figure}[ht] \vskip \fighead{} \begin{center} \centerline{\includegraphics[width=\figwidth]{fig_008.eps}} \vskip \figtocaption{} \caption{Loss curves from batch-size 32 to batch-size 49152} \label{fig_8} \end{center} \vskip \figrear{} \end{figure} \section{Methods to Enlarge the Gradient} In Section 2, we demonstrate the disadvantages of large batch size training originate from gradient vanishing effect. Thus, on the other hand, it also provides a clue to improve the performance of NN training. We have tried a lot of methods to enlarge the gradient, including discarding small-loss samples, real time tuning of batch size in a training process, discarding small value gradients, setting larger dropout ratio, and selecting sharper loss function. Two methods will be described in the following. \subsection{Discarding Small-loss Samples} We conjecture that the input samples with higher losses will produce larger gradients, and we design an experiment to compute the average gradients of the second fully connected layer of AlexNet. In the first step, a set of tests are finished, with each one discards p\% of small-loss samples. The loss defined here is computed using a single input sample in a batch size, and the discarding ratio, p\%, changes equally from 10\% to 90\%. Figure \ref{fig_9} shows the average gradients with varying discarding ratios, which illustrates discarding small-loss samples will enlarge the gradient. The next step is to test the actual model training. We compare the baseline to our model for both batch-size 2000 and 8000. The training parameters in our model are the same as the baseline except discarding 30\% small-loss samples in the first 100 epochs. The result shows an observable improvements for both batch-size 2000 and 8000. A point to note here is that for batch size larger than 8000, the effect of discarding small-loss samples is not significant, which needs further research. \begin{figure}[ht] \vskip \fighead{} \begin{center} \centerline{\includegraphics[width=\figwidth]{fig_009.eps}} \vskip \figtocaption{} \caption{Impact of loss discarding ration on average gradient. The small-loss samples are discarded in each experiment. The tests are carried out in AlexNet on Cifar10 dataset with batch-size 8192 and update-step 1.} \label{fig_9} \end{center} \vskip \figrear{} \end{figure} \begin{figure}[ht] \vskip \fighead{} \begin{center} \centerline{\includegraphics[width=\figwidth]{fig_010.eps}} \vskip \figtocaption{} \caption{Training accuracy of baseline and the model with 30\% lower loss discarded. The vertical lines indicate the standard deviation. The baseline model is AlexNet on Cifar10 dataset using SGD optimizer.} \label{fig_10} \end{center} \vskip \figrear{} \end{figure} \subsection{Real Time Tuning of Batch Size in a Training Process} As shown in Figure \ref{fig_3}, a smaller batch size produces larger gradients, so it is worth trying to introduce a different batch size in some steps of a training process. Mikami \& Suganuma \yrcite{Mikami2018imageNet} already used this method to achieve better generalization. In this part, we show some simple comparative experiments as a preliminary exploration. We use the same training parameters as baseline except in the first epoch, the batch-size and LR are tuned down to 512 and 0.005, respectively, which will be reset to 8192 and 0.05 from the second epoch. We have recorded a group of test results for both baseline model and our model (Figure \ref{fig_11}, \ref{fig_12}, \ref{fig_13}, \ref{fig_14}). For the baseline model, the small update step makes the training process more stumble. The big fluctuation in the first 80 epochs of both loss and accuracy curves hinder the subsequent training and results in models with big performance dispersion. The intrinsic reason is related to the small parameter update step length. While for our model, the training performance is clearly improved, as shown in Figure \ref{fig_13} and \ref{fig_14}. By decreasing the batch size in the first epoch, the update step length is amplified, which enables searching a broader space for a better loss curve minima. \begin{figure}[ht] \vskip \fighead{} \begin{center} \centerline{\includegraphics[width=\figwidth]{fig_011.eps}} \vskip \figtocaption{} \caption{Multiple loss curves of baseline model. The baseline model is AlexNet on Cifar10 dataset with batch-size 8192 and use SGD as optimizer.} \label{fig_11} \end{center} \vskip \figrear{} \end{figure} \begin{figure}[ht] \vskip \fighead{} \begin{center} \centerline{\includegraphics[width=\figwidth]{fig_012.eps}} \vskip \figtocaption{} \caption{Multiple accuracy curves of baseline model} \label{fig_12} \end{center} \vskip \figrear{} \end{figure} \begin{figure}[ht] \vskip \fighead{} \begin{center} \centerline{\includegraphics[width=\figwidth]{fig_013.eps}} \vskip \figtocaption{} \caption{Multiple loss curves with first-epoch batch size reduced} \label{fig_13} \end{center} \vskip \figrear{} \end{figure} \begin{figure}[ht] \vskip \fighead{} \begin{center} \centerline{\includegraphics[width=\figwidth]{fig_014.eps}} \vskip \figtocaption{} \caption{Multiple accuracy curves with first-epoch batch size reduced} \label{fig_14} \end{center} \vskip \figrear{} \end{figure} \section{Parameter Update Rules Based on Curvature of Loss Curve} Besides the gradient vanishing effect, the non-uniform distribution of loss curve curvature across layers in a network is another important factor affecting the performance of large batch size training. As shown in Figure \ref{fig_2}, the curvature heterogeneity is significant, and needs pay more attention to. From a geometric point of view, the LR of a specific parameter should be consistent with the loss curve curvature where the parameter located. In case of small batch size, due to the large parameter searching space (Figure \ref{fig_5}), it is applicable to set a global LR, while for large batch size, the decreasing parameter update step length (Figure \ref{fig_4}) makes the training highly sensitive to LR, and thereby, a customized LR setting method is necessary. \subsection{Curvature-based LR Setting Method and its Approximation} The best way to update parameters is to set a specific LR for each parameter based on its curvature. The radius of curvature of parameter \( w_i \) is \vskip \eqnupspace \begin{equation} \label{eqn_9} R_i = \left| \frac{(1+(\frac{d L}{d w_i})^2)^{\frac{3}{2}}}{\frac{d^2 L}{d w_i^2}} \right| \end{equation} \vskip \eqnlowerspace where \( R_i \) is the radius of curvature, \( dL/dw_i) \) is the first order gradient and \( dL/dw_i=g_i \), and \( d^2 L/d w_i^2 \) is the second order gradient. Here the LR for \( w_i \) is \vskip -15pt \begin{equation} \label{eqn_10} \eta_i=\gamma R_i \end{equation} \vskip \eqnlowerspace where \(\eta_i \) is the LR, and \( \gamma \) is a global hyper parameter. Then follow the rule below to update the parameter, \vskip \eqnupspace \begin{equation} \label{eqn_11} \Delta w_i=\eta_i\frac{d L}{d w_i} \end{equation} \vskip \eqnlowerspace The above steps are the backbone of curvature-based parameter update rule. Though it is a vanilla method, the huge computation work needed to obtain curvature radius in a big NN limits its applications. The main difficulty results from the lack of high efficiency methods to compute second order gradient in almost all deep learning platforms. In this section we develop a method to approximate the curvature radius. Referring to Figure \ref{fig_15}, Morse theory states that in the vicinity of a local critical point of a smooth curve, the geometry is equivalent to a second-order curve, such that \vskip -15pt \begin{equation} \label{eqn_12} L=a_i(w_i-b_i)^2+c_i \end{equation} \vskip \eqnlowerspace where \( a_i \), \( b_i \), and \( c_i \) are the characteristic coefficients of the specific parabola. \begin{figure}[ht] \vskip \fighead{} \begin{center} \centerline{\includegraphics[width=6.5cm]{fig_015.pdf}} \vskip -0.1in \caption{A conceptual sketch of minima. The local geometry equivalents to a parabola.} \label{fig_15} \end{center} \vskip \figrear{} \end{figure} From this equation we derive the first order gradient: \vskip \eqnupspace \begin{equation} \label{eqn_13} \frac{d L}{d w_i}=2a_i(w_i-b_i) \end{equation} \vskip \eqnlowerspace and second order gradient: \vskip \eqnupspace \begin{equation} \label{eqn_14} \frac{d^2 L}{d w_i^2}=2a_i \end{equation} \vskip \eqnlowerspace Substituting eqn. \ref{eqn_13} into eqn. \ref{eqn_14}, we get \vskip \eqnupspace \begin{equation} \label{eqn_15} \frac{d^2 L}{d w_i^2}=\frac{\frac{d L}{d w_i}}{(w_i-b_i)} \end{equation} \vskip \eqnlowerspace Using this gradient expression, the curvature radius of parameter \( w_i \) becomes \vskip \eqnupspace \begin{equation} \label{eqn_16} R_i = \left| \frac{(w_i-b_i)(1+(\frac{d L}{d w_i})^2)^{\frac{3}{2}}}{\frac{d L}{d w_i}} \right| \end{equation} \vskip \eqnlowerspace where \( w_i \) and \( d L/d w_i \) are detectable quantities, and \( b_i \) is an undetectable coefficients. We propose a simplification here that \( b_i \) can be set to 0, which is reasonable in statistical meanings, especially when weight decay method is used. The \( (d L/d w_i )^2 \) item is also eliminated considering that its value is far less than 1. Then we get \vskip \eqnupspace \begin{equation} \label{eqn_17} R_i\approx \left| \frac{w_i}{\frac{d L}{d w_i}} \right| \end{equation} \vskip \eqnlowerspace This equation is a rough estimate of curvature radius, and it will totally fail in either below cases: \vskip -15pt \begin{equation} \label{eqn_18} w_i\rightarrow 0 \end{equation} \vskip \eqnlowerspace and \vskip \eqnupspace \begin{equation} \label{eqn_19} \frac{d L}{d w_i}\rightarrow 0 \end{equation} \vskip \eqnlowerspace Though the majority of \( R_i \) are not accurate enough for parameter updating, we estimate some kinds of statistics in a certain group of \( R_i \) are still usable, for example some forms of layer-wise average curvature radius can be used to set the LR. \subsection{Parameter Optimization Rule Based on the Median of Curvature Radius} We propose a simple statistical approximation of eqn. \ref{eqn_17} to compute the median value of a group of \( R_i \) \vskip \eqnupspace \begin{equation} \label{eqn_20} R_m\approx \left| \frac{w_m}{\frac{d L}{d w_m}} \right| \end{equation} \vskip \eqnlowerspace where \( w_m \), \( d L/d w_m \) and \( R_m \) are the median values of parameter, gradient and curvature radius in a group (a layer in a NN for example), respectively. Now the LR can be set as \vskip -15pt \begin{equation} \label{eqn_21} \eta_g = \gamma R_m \end{equation} \vskip \eqnlowerspace where \( g \) is the group index. If weight decay is considered, instead of eqn. \ref{eqn_20}, we use \vskip \eqnupspace \begin{equation} \label{eqn_22} R_m\approx \left| \frac{w_m}{\frac{d L}{d w_m}+\beta w_m} \right| \end{equation} \vskip \eqnlowerspace where \( \beta \) is the weight decay coefficient. Following the above parameter optimization rule, we have trained ResNet18 on Cifar10 dataset for a series of batch sizes, and find it works well for batch size less than 8192. Figure \ref{fig_16} illustrates the comparation of our method to LARS, and the discrepancy is negligibly small. We also notice that the training performance falls faster than LARS for large batch size. The reason is the decreasing average gradient (Figure \ref{fig_3}) degrades the validation of \( R_m \) (eqn. \ref{eqn_18}, \ref{eqn_19}, \ref{eqn_20}). Thus, this method can be regarded as a verification of curvature-based parameter update principle, and we do not recommend extending it to large batch size training. \begin{figure}[ht] \vskip \fighead{} \begin{center} \centerline{\includegraphics[width=\figwidth]{fig_016.eps}} \vskip \figtocaption{} \caption{Training accuracy of median-curvature and LARS with batch-size 1024} \label{fig_16} \end{center} \vskip \figrear{} \end{figure} \subsection{Interpretation of Layer-wise Parameter Update Algorithms} In order to solve large batch size training problem, researchers have proposed one specific class of algorithms, the common point of which is setting a layer-wise LR \cite{you2017large,you2017scaling,abuelhaija2017proportionate,you2018imagenet,you2019reducing}. These algorithms are based on the experimental results, without convincing theoretical foundations. Three typical methods are the so-called LARS \cite{you2017large}, PercentDelt \cite{abuelhaija2017proportionate} and LAMB \cite{you2019reducing}. The definition of the former two algorithms are LARS, \vskip \eqnupspace \begin{equation} \label{ean_23} \eta_g=\gamma \frac{\|w_i\|_2}{\|\frac{d L}{d w_i}\|_2} \end{equation} \vskip \eqnlowerspace and PercentDelta, \vskip \eqnupspace \begin{equation} \label{eqn_24} \eta_g=\gamma \frac{size(w_i)}{\| \frac{d L}{d w_i}/w_i \|_1} \end{equation} \vskip \eqnlowerspace where \( size(w_i) \) is the number of parameters in \( g \)th layer. These two algorithms are conjectural solutions to the curvature heterogeneity problem (Figure \ref{fig_2}). Comparing both eqn. \ref{ean_23} and \ref{eqn_24} to eqn. \ref{eqn_17}, it is clear that the main part of LARS and PercentDelta are two transformers of curvature radius (eqn. \ref{eqn_17}). By calculating the norms of the numerator and denominator, two specific statistical mean curvatures are obtained, which can avoid the minimum and maximum problems in the original curvature formula (eqn. \ref{eqn_20}). What the researchers usually ignore is that the algorithms have the same failure conditions, eqn. \ref{eqn_18} and \ref{eqn_19}, which need to be dealt with by careful parameter initialization. \section{Discussion} \subsection{Where Does Parameter Stay in the Loss Curve?} In this section, we will discuss the geometry meanings of gradient vanishing induced by large batch size training, and will provide a novel insight into how large batch size training degrades the model performance. Referring to Figure \ref{fig_15}, the distance of \( w_i \) from its nearest minima, \( b_i \), is \vskip -15pt \begin{equation} \label{eqn_25} d_i=w_i-b_i \end{equation} \vskip \eqnlowerspace Considering eqn. \ref{eqn_13}, we get \vskip \eqnupspace \begin{equation} \label{eqn_26} d_i=\frac{1}{2a_i} \frac{d L}{d w_i} = \frac{1}{2a_i} g_i \end{equation} \vskip \eqnlowerspace For simplification, we suppose \( a_i \) to be a constant, such that \( a_i=a \). Then, we get \vskip \eqnupspace \begin{equation} \label{eqn_27} d_i\sim N(0,\frac{\sigma}{2a\sqrt{n}}) \end{equation} \vskip \eqnlowerspace The expectation of the absolute value of \( d_i \) on all parameters in a layer is \vskip \eqnupspace \begin{equation} \label{eqn_28} E(\left| d_i \right|)=\frac{\sigma}{a\sqrt{\pi}}\frac{1}{\sqrt{n}} \end{equation} \vskip \eqnlowerspace If batch size, \( n \), inflates to an infinity value, this equation predicts that the average distance between a parameter and its nearest minima, \( \left| d_i \right| \), will move to 0. In other words, all the parameters, \( w_i \), in the network will center on a local minimum point of the loss curve, a consequence that makes the parameters optimizing stop and the network training stuck. Making things worse, it happens at the beginning of the training, and the random initialized loss curve strays far from the perfect model that we expect. One more thing to note is that the vanishing of \( \left| d_i \right| \) also illustrates adopting Morse theory in Subsection 4.1 is valid. \subsection{How Does Current Methods Work?} In Introduction section, the main research on ‘generalization gap’ are discussed, and in this section, we try to give a simpler understanding to the main part of these work. Method 1: LR scheduling \cite{goyal2017accurate,smith2017super-convergence:,peng2017megdet:,you2019large-batch}. This class of methods alleviates the uneven distribution of curvature in different layers (Figure \ref{fig_1}). Taking warm-up training for example, the parameters in a sharp minima (small curvature radius) are given the priority to update, and will find a flatter minima. After warm-up, the curvatures in different layers incline to converge, which is very helpful for the follow-up training. Method 2: Batch size scheduling \cite{devarakonda2017adabatch:,smith2018don't,Mikami2018imageNet}. Following the conclusion of Subsection 3.2, Figure \ref{fig_4}, and eqn. \ref{eqn_6}, the nature of batch size scheduling is to adjust the parameter update step length, which is an effective way to jump out of sharp minima or noise. Method 3: Training longer \cite{hoffer2017train}. According to Figure \ref{fig_5} and eqn. \ref{eqn_6}, increasing the iteration steps will enlarge the parameter searching space, which results in a higher probability of finding a better minima. Method 4: eliminating sharp minima \cite{keskar2017on,jastrzebski2018finding,wen2018smoothout:,haruki2019gradient}. Parameter update step length and curvature of minima are the ‘two faces of the same coin’. For large batch size training, with the vanishing of parameter update step length, big curvature of minima (sharp minima) will play a greater role. Hence, it is evident that eliminating sharp minima will improve the generalization. \section{Conclusion} In this work, we have derived the theoretical limits of large batch size training, and predict that ‘generalization gap’ will be worsen with larger batch size. We reveal that the vanishing of gradient and parameter update step length are the key reasons to result in generalization difficulty. We propose a curvature-based optimizer, a second order LR rule to better fit the curvature variations across layers in a network. We also show that one approximation of this optimizer, median curvature, is almost as good as LARS in small batch size training. According to our theoretical findings, we suggest a new guidance to reduce ‘generalization gap’ by increasing the gradients in a network. Two algorithms, discarding small-loss samples and scheduling batch size, are provided for example. Our results demonstrate that the generalization is effectively enhanced. The recent research work on ‘generalization gap’ mentioned in Introduction section have made great experiment advances, but unified theories to rule all the discrete explanations are still inadequate. Our work offers simple theories to support the major parts of current researches. The widely-known LARS and PercentDelta optimizers are proved to be approximations of our curvature-based algorithm. Many other methods are well explained based on the relation between parameter update step length and batch size. For larger batch size, we find theoretically that the parameters are more likely to center on the bottom of minima, which makes parameter update step length reduced, and finally makes the training to stuck by small minima or noise at a higher probability.
{'timestamp': '2020-12-17T02:12:29', 'yymm': '2012', 'arxiv_id': '2012.08795', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08795'}
arxiv
\section{Introduction} The phenomenon of information diffusion, dubbed as information cascade, is ubiquitous in our daily lives, \textit{e.g.}, the spread of breaking news or virus. Information diffusion prediction is an important and challenging task, which aims at forecasting the future properties or behaviors of an information cascade, such as the eventual size~\cite{deepcas-macro,cascn-macro,macro-coupledGnn} or the next infected user~\cite{NDM,DCE-micro,infVAE-micro}. Current studies of information diffusion prediction have been successfully adopted for many real-world scenarios including epidemiology~\cite{wallinga2004different}, viral marketing~\cite{leskovec2007dynamics}, media advertising~\cite{li2013popularity} and the spread of news and memes~\cite{leskovec2009meme,vosoughi2018spread}. During the last decade, deep learning techniques have shown their effectiveness in computer vision~\cite{krizhevsky2017imagenet} and natural language processing areas~\cite{devlin2018bert}. Recently, methods~\cite{deepcas-macro,CYAN-RNN,TopoLSTM,SNIDSA} based on recurrent neural networks (RNNs) also achieved promising results in information cascade modeling by treating influenced users as sequential data ranked by their infection timestamps. In RNNs, the entire information diffusion history is encoded into a real-valued vector as the hidden state. However, representing all previously infected users by a single vector could fail to encode all necessary information for future predictions due to the mode collapse~\cite{che2016mode} problem. As illustrated in Fig.\ref{fig_intro}, an information item is spreading through two communities and the cascade sequence has infected $5$ users ($4$ from community A and $1$ from community B). An information cascade model need to encode these users. Learned representations of conventional methods can encode the most important factor (community A) for future predictions, but fail to remember others (community B). \begin{figure}[htb] \centering \includegraphics[scale=0.4]{pic/intro.pdf} \caption{An illustration of mode collapse problem in information cascade modeling. } \label{fig_intro} \end{figure} To address this problem, we propose to employ the idea of disentangled representation learning, which aims to extract multiple latent factors representing different aspects of the data, for modeling the diffusion history of an information cascade. Though disentangled representation learning was originally proposed in controllable image generation~\cite{chen2016infogan}, it has been successfully adopted for other areas such as text generation~\cite{stylicSPG-disentangled} as well. To the best of our knowledge, we are the first to use disentangled representation learning for information diffusion prediction. To be more specific, we propose a novel Sequential Information Diffusion model with Disentangled Attention (SIDDA) by applying a sequential attention module and a disentangled attention module on RNNs. The former module can help better aggregate the history information and the latter one will disentangle the hidden state vector into multiple representations. We further employ Gumbel-Softmax~\cite{gumbel} technique to encourage bigger differences between the disentangled representations. Consequently, we are able to learn multiple hidden state vectors characterizing different latent factors for future predictions at each step of cascade modeling. Different hidden state vectors can complement each other and provide more comprehensive information to predict the next infected users. We conduct experiments on three public real-world datasets and employ the task of next infected user prediction for evaluation. Experimental results show that the proposed model SIDDA significantly outperforms state-of-the-art baseline methods by up to $14\%$ in terms of $hits@50$ metric. Our contributions are as follows: \begin{itemize} \item To the best of our knowledge, we are the first work to adopt the idea of disentangled representation learning for information cascade modeling. \item We propose SIDDA, a novel method which can learn disentangled representations encoding different factors for information diffusion prediction. \item Experiments on three real-world datasets demonstrate that our proposed method outperforms state-of-the-art baselines significantly. \end{itemize} \section{Related Work} \subsection{Information Diffusion Prediction} There are two kinds of tasks associated with information diffusion prediction: (1) Studying the growth of cascades and (2) Predicting the next activated node in the cascade. In some recent works~\cite{cascn-macro,NDM,FOREST,zhou2020survey}, these tasks are classified as macroscopic and microscopic predictions. \subsubsection{Macroscopic Information Diffusion Prediction} Macroscopic information diffusion prediction, also known as popularity prediction, aims at predicting cascade sizes in the future~\cite{zhao2015seismic}. Previously, related works are based on feature-based approaches~\cite{cancascadebepredicted} and generative approaches~\cite{generative-hawkes}. In recent years, with the success of deep learning, methods based on Recurrent Neural Networks (RNNs) are proposed, \textit{e.g.}, DeepCas~\cite{deepcas-macro} and Deephawkes~\cite{deephawkes-macro}. Some researchers also introduce Graph Neural Networks (GNNs) to model the underlying social graph and diffusion paths, \textit{e.g.}, CoupledGNN~\cite{macro-coupledGnn} and HDGNN~\cite{heterogeneous4-HDGNN-macro}. \subsubsection{Microscopic Information Diffusion Prediction} Our work focuses on microscopic information diffusion prediction, which aims to forecast the next activated node given previously infected users in an information cascade. With the development of deep learning, various kinds of neural networks have been adopted for microscopic information diffusion prediction. Generally, RNN, GNN and attention mechanism are widely used, and give promising results. Topo-LSTM~\cite{TopoLSTM} proposes a novel LSTM to model tree-structured cascades. CYAN-RNN~\cite{CYAN-RNN} and Deep-Diffuse~\cite{deepdiffuse} take timestamps into consideration with the help of temporal point processes. DyHGCN~\cite{heterogeneous2-DyHGCN} proposes a heterogeneous graph convolutional network to model the social graph and dynamic diffusion graph jointly. HDD~\cite{heterogeneous1} exploits meta-path in the diffusion graph and learns heterogeneous network representations using GNN. There are also some models fully based on attention mechanisms, \textit{e.g.}, DAN~\cite{DAN}, Hi-DAN~\cite{Hi-DAN} and NDM~\cite{NDM}. Besides, some works target on both macroscopic and microscopic information diffusion predictions. FOREST~\cite{FOREST} makes use of reinforcement learning to incorporate the ability of macroscopic prediction. DMT-LIC~\cite{dmt-lic-related} is a multi-task learning framework with a shared-representation layer and two different task layers for predictions. However, existing methods represent previously infected users by a single vector and could encounter the mode collapse problem, which would fail to encode all necessary information for future predictions. \subsection{Disentangled Representation Learning} Disentangled representation learning which aims to learn representations of different latent factors hidden in the observed data~\cite{representationlearning,chen2016infogan}, has been successfully used in various fields. In the field of recommendation systems, a few works are proposed to learn disentangled item representations~\cite{ma2019learningcosinedot}. \cite{ma2020disentangled} performs self-supervision in the latent space, getting disentangled intentions from item sequences for product recommendations. In the field of natural language processing, SPG~\cite{stylicSPG-disentangled} proposes an unsupervised way to generate stylistic poetry by maximizing the mutual information between representations and generated text. GNUD~\cite{GNUD-disentangled} explores user interest disentanglement in news recommendation by making use of DisenGCN~\cite{madisentangledgnn-DisenGCN}. Besides, disentangled representation learning is also successfully used in the modeling of graph-structured data~\cite{multi-aspect,madisentangledgnn-DisenGCN, disentangledGNN-IPGDN}. As far as we know, we are the first to adopt the idea of disentangled representation learning for information diffusion prediction. \section{Method} In this section, we will formalize the problem of information diffusion prediction and introduce the notations. Then we will propose an RNN-based information diffusion prediction model and a novel attention mechanism to learn disentangled representations. Finally, we will predict the next infected node using the disentangled representations. \subsection{Problem Definition} Given a node (or user) set $V$ and a cascade set $C$, we have $V=\{v_1,v_2,...,v_N\}$ and $C=\{c_1,c_2,...,c_M\}$. Here $N$ is the size of the node set, and $M$ is the number of cascades. Each cascade $c_i \in C$ spreading among users is a sequence of nodes $\{v^i_1,v^i_2,...,v^i_{\left | c_i \right |}\}$, ordered by their activation timestamps. Following the same setting in previous works~\cite{NDM, TopoLSTM, SNIDSA, FOREST}, we only keep the order of nodes and ignore the exact timestamps. A detailed modeling of timestamp information will be left for future work. Information diffusion prediction can be formulated as: given the cascade sequence of previously activated nodes $\{v^i_1,v^i_2,...,v^i_t\}$ in cascade $c_i$ for $t=1,2,...,\left | c_i \right |-1$, predicting the next activated node $v^i_{t+1}$. In other words, our goal is to build a model that is able to learn the conditional probability function $p(v^i_{t+1}|\{v^i_1,v^i_2,...,v^i_t\})$ for each cascade $c_i$ where $1\leq i \leq M$. We will focus on the modeling of a single cascade and omit the superscript for simplification in the rest of the paper. \subsection{Model Architecture} The framework of our method is shown in Fig.\ref{model_overall}. Firstly, we encode every node into node embedding by an embedding-lookup layer. Then we employ a Gated Recurrent Unit (GRU) as the basis to model the node sequence. Given the infected node sequence, the GRU model can output a hidden state representing the sequential history at each time step. Then a sequential attention module and a disentangled attention module are applied to better aggregate the history information and disentangle the hidden state vector into multiple representations. Finally, disentangled representations will be used for predicting the next infected node. \begin{figure}[H] \centering \includegraphics[scale=0.4]{pic/overall.pdf} \caption{An illustration of our proposed model SIDDA. The model will derive $K$ disentangled representations $\mathbf{y_t^{(k)}}(1 \leq k \leq K)$ at time $t$, with the help of a disentangled attention module.} \label{model_overall} \end{figure} \subsubsection{Gated Recurrent Unit} Recurrent neural networks(RNNs) have shown great potentials in modeling sequence data. Previous works~\cite{TopoLSTM,SNIDSA,FOREST,CYAN-RNN,deepdiffuse,lstm-cnn-hin-kbs} used RNNs as their basis to model information diffusion cascades. Firstly, we represent each node as a vector $\mathbf{x}\in \mathbb{R}^D$. By feeding the activated node embedding $\mathbf{x_t}$ into an RNN at every timestamp, we can have a hidden state $\mathbf{h_t}$ capturing the history information of all previously activated nodes as the output. Gated Recurrent Unit (GRU) can alleviate the vanishing gradient problem compared with a standard RNN. It can be considered as a variation of the LSTM but is computationally cheaper. Therefore, we select GRU as our model basis. \begin{equation} \mathbf{h_t} = GRU(\mathbf{h_{t-1}}, \mathbf{x_t}) \label{gru} \end{equation} \subsubsection{Sequential Attention Module} Note that every hidden state $\mathbf{h_t}$ in GRU contains information about the input node sequence with a focus around position $t$. To aggregate the sequential history information of all positions automatically, we propose to employ attention mechanism, which was originally proposed in neural machine translation~\cite{attentionpaper}, and learn to assign different attention weights to previous hidden states $\mathbf{h_i}$ $(i\leq t)$. Formally, the sequential attention weight $\alpha_{it}$ of the $i$-th hidden state is computed by: \begin{gather} \alpha_{it} = \frac{exp(\frac{1}{\sqrt{D}} e_{it} )}{\sum_{j=1}^{t}exp(\frac{1}{\sqrt{D}}e_{jt})} \\ e_{it} = d(\mathbf{h_i},\mathbf{h_t})\notag \end{gather} where $\frac{1}{\sqrt{D}}$ is a scaling coefficient and $h_i\in \mathbb{R}^D$ is the $i$-th hidden state. $d(\cdot,\cdot)$ is a distance function, and we use dot product in this work. \subsubsection{Disentangled Attention Module} Inspired by the recent advances in disentangled representation learning~\cite{madisentangledgnn-DisenGCN,ma2020disentangled}, we propose our disentangled attention module to learn multiple representations characterizing different latent factors for future predictions at each step of cascade modeling. We assume that there are $K$ main latent factors that affect the diffusion of an information item. Take Twitter as an example, an information item may spread through $K$ different communities or users are infected by tweets from $K$ topics. We want to disentangle these diverse latent factors from the hidden state $\mathbf{h_t}$ to get the disentangled representations. \begin{figure}[H] \centering \includegraphics[scale=0.4]{pic/pki.pdf} \caption{An illustration of the disentangled attention module.} \label{model_pki} \end{figure} To be more specific, we set $K$ prototype embeddings $\mathbf{p_k}$ $(1\leq k\leq K)$ to represent the $K$ potential factors. We expect these prototype embeddings can capture diverse properties after training. Then for each hidden state $h_i$, we will compute its similarity with $K$ prototypes by the distance between $\mathbf{h_i}$ and $\mathbf{P}$. The equations are as follows: \begin{equation} \begin{gathered} \beta_{ik} = \frac{exp(\frac{1}{\sqrt{D}}d(\mathbf{h_{i}},\mathbf{p_k}))}{\sum_{{k}'=1}^{K}exp(\frac{1}{\sqrt{D}}d(\mathbf{h_{i}},\mathbf{p_{{k}'}}))} \\ d(\mathbf{h_i},\mathbf{p_k}) = \frac{\mathbf{h_i}\cdot \mathbf{p_k}}{\|{\mathbf{h_i}}\| \|{\mathbf{p_k}}\|} \label{pki} \end{gathered} \end{equation} where $k=1,2,...,K$ and $i=1,2,...,t$. $\{\mathbf{p_k}\in \mathbb{R}^D:1\leq k\leq K\}$ are prototype embeddings of $K$ latent factors. $d(\cdot,\cdot)$ is the distance function, and we select cosine-similarity instead of dot product here because the latter is more vulnerable when it comes to mode collapse~\cite{ma2019learningcosinedot}. Then we apply a Softmax function to compute the attention score $\beta_{ik}$ for further usage. It is worth noting that by using Softmax, all of the $\beta_{ik}$ $(1\leq k\leq K)$ tend to have a similar result. The hidden state $h_i$ will be disentangled to $K$ latent factors equally, which would harm the performance of disentanglement. We further employ Gumbel-Softmax to alleviate this drawback and enhance the disentanglement effect. Finally, we can combine the sequence attention and disentanglement attention together, using $\alpha_{ij}$ and $\beta_{ik}$ to draw the weighted sum result $y_i^{(k)}$ to represent the hidden state under the $k$-th factor: \begin{equation} \mathbf{y_t^{(k)}} = LayerNorm(\sum_{i=1}^{t}\alpha_{it}\cdot \beta_{ik}\cdot \mathbf{h_i}) \label{pkipi} \end{equation} where $k=1,2,...,K$. When $K=1$, our method degenerates into a GRU model with an attention mechanism. We name our model as Sequential Information Diffusion model with Disentangled Attention (SIDDA). We further apply Gumbel-Softmax trick~\cite{gumbel} to encourage the disentanglement. \subsection{Optimization Objective} We can get $K$ disentangled representations at each timestamp $t$ using Eq. (\ref{pkipi}). Different hidden state vectors can complement each other and provide more comprehensive information to predict the next infected users. Therefore, we compute the similarity, \textit{i.e.}, dot product, between these $K$ disentangled representations $\mathbf{y_t^{(k)}}$ and node embeddings $\mathbf{X}$ to predict the next activated node. Hence, the loss function can be defined as follows: \begin{equation} \begin{aligned} L(\mathbf{\theta},t) &= -\log p_{\mathbb{\theta}}(\mathbf{x_{t+1}}|\mathbf{y_t}) \\ &= -\log \frac{\max_{k\in \{1,2,...,K\}}exp(\frac{1}{\sqrt{D}} \mathbf{x_{t+1}}\cdot \mathbf{y_t^{(k)}} )} {\sum_{{v}' \in V}\max_{k\in \{1,2,...,K\}}exp(\frac{1}{\sqrt{D}} \mathbf{x_{{v}'}}\cdot \mathbf{y_t^{(k)}})} \label{loss} \end{aligned} \end{equation} It is noteworthy that in Eq. (\ref{loss}), the Softmax function is applied to all of the $K$ disentangled factors. The model is forced to preserve different information in $\mathbf{y_t^{(k)}}(1\leq k \leq K)$. Therefore, we do not need to use regularization terms to restrict the distribution of $\mathbf{y_t^{(k)}}$ in our model. \section{Experiments} In this section, we will introduce the datasets used in our experiments, and the state-of-the-art baselines which will be compared with our proposed method. We further introduce the evaluation metrics used to evaluate the performance of the baselines and our method. We will design comparative experiments and ablation experiments to show the superiority of our method. \subsection{Datasets} \textbf{Twitter}~\cite{twitterdata} dataset collects tweets published in October 2010, containing URLs in the message body. Each URL is considered to be a unique marker of information, spreading among users. \textbf{Douban}~\cite{doubandata} is a Chinese social networking service network where users can share content about books. In our experiment, we consider each book as an information item, and a user is activated if the user reads the book. \textbf{Memetracker}~\cite{memetrackerdata} contains millions of online mainstream social media activity, tracking the most frequent phrases, \textit{i.e.}, memes. Memes were information items being shared among websites. \begin{table}[htbp] \centering \caption{Statistics of datasets.} \begin{tabular}{ccccc} \toprule Dataset&\# Cascades&\# Nodes&\# Links &Average Length \\ \midrule Twitter&3,442&12,627&309,631&32.60\\ Douban&10,602&23,123&348,280&27.14\\ Memetracker&12,661&4,709&-&16.24\\ \bottomrule \end{tabular} \label{dataset \end{table} We follow the experiment setting in~\cite{FOREST}, randomly selecting 80\% of cascades for training, 10\% for validation, and 10\% for test. The statistics of datasets are listed in Table \ref{dataset}. Twitter and Douban datasets have an underlying social graph, which will be used by some of the baseline models. \subsection{Baselines and Experimental Settings} We compared our method with several state-of-the-art baselines. \textbf{DeepDiffuse}~\cite{deepdiffuse} is an LSTM based model with an attention mechanism, utilizing node sequence and their corresponding activated time. We replace timestamps with integer activated steps in the cascade. \textbf{Topo-LSTM}~\cite{TopoLSTM} is a topological recurrent network, which can model diffusion topology as dynamic directed acyclic graphs (DAGs). In our experiment, the cascade structure is extracted from the underlying social graph. \textbf{NDM}~\cite{NDM} employs convolutional network and attention mechanism for cascade modeling. It makes relax assumptions on the datasets and doesn't need a diffusion graph. \textbf{SNIDSA}~\cite{SNIDSA} is a novel sequential neural network with structure attention. It utilizes both the sequential nature of a cascade and structural characteristics of the underlying social graph with the help of a gating mechanism. \textbf{FOREST}~\cite{FOREST} is a novel GRU-based information diffusion model. It extracts underlying social graph information and uses reinforcement learning to incorporate macroscopic prediction ability into itself. \subsection{Evaluation Metrics and Experiment Setting} As pointed out by~\cite{TopoLSTM}, there can be an arbitrary number of potential candidates, information diffusion prediction can be seen as a retrieval task. We use two popular information retrieval evaluation method $\textbf{hits}@N$ and $\textbf{map}@N$. The same evaluation metrics are also used~\cite{FOREST,CYAN-RNN,deepdiffuse, Hi-DAN}. We set $N=10,50,100$ for evaluation. Since SNIDSA and TopoLSTM need an underlying social graph in the dataset, we exclude them for Memetracker. We implement our method in PyTorch. We use Adam optimizer for mini-batch gradient descent and use dynamic learning rate. The dropout rate is set to $1e-4$. The temperature parameter of Gumbel-Softmax $\tau=1.0$. \begin{figure}[htbp] \centering \begin{minipage}[t]{0.49\textwidth} \includegraphics[width=\textwidth]{pic/1.pdf} \vspace*{-12mm} \caption{$hits@N$ of Twitter} \label{overall1} \end{minipage} \begin{minipage}[t]{0.49\textwidth} \includegraphics[width=\textwidth]{pic/2.pdf} \vspace*{-12mm} \caption{$map@N$ of Twitter} \label{overall2} \end{minipage} \begin{minipage}[t]{0.49\textwidth} \includegraphics[width=\textwidth]{pic/3.pdf} \vspace*{-12mm} \caption{$hits@N$ of Douban} \label{overall3} \end{minipage} \begin{minipage}[t]{0.49\textwidth} \includegraphics[width=\textwidth]{pic/4.pdf} \vspace*{-12mm} \caption{$map@N$ of Douban} \label{overall4} \end{minipage} \begin{minipage}[t]{0.49\textwidth} \includegraphics[width=\textwidth]{pic/5.pdf} \vspace*{-12mm} \caption{$hits@N$ of Memetracker} \label{overall5} \end{minipage} \begin{minipage}[t]{0.49\textwidth} \includegraphics[width=\textwidth]{pic/6.pdf} \vspace*{-12mm} \caption{$map@N$ of Memetracker} \label{overall6} \end{minipage} \caption{The overall results, scores are the higher the better.} \label{overall_result} \end{figure} \subsection{Experimental Results} We design the comparative experiments, ablation experiments, and analyze the parameter sensitivity in this section. \subsubsection{Overall Evaluation} Fig. \ref{overall_result} shows the performance of different methods on three datasets. We select the results when $K=4$ for our method. For the analysis of parameters, please refer to Section \ref{Parameteranalysissec}. We find that: SIDDA outperforms all the state-of-the-art baseline methods consistently and significantly on $hits@N$ and $map@N$. The results show that our method can predict the next activated user successfully. \subsubsection{Ablation Study} \label{albationstudysec} \label{Parameteranalysissec} \paragraph{\textbf{The effect of the number of disentangled factors.}} We study how the number of disentangled factors $K$ can affect the performance of our method. As shown in Fig.\ref{figdifferentk}, our method has the worst performance when $K=1$. Because when $K=1$, our model is a GRU model with an attention mechanism, the latent information is not disentangled thoroughly. The performance on Douban and Memetracker dataset increases with $K$ getting larger, and start to decrease when $K>4$. While performance on the Twitter dataset is much better when $K>4$, showing an increasing trend. This is because Twitter has more diverse topics and may have more factors to disentangle. \begin{figure}[htbp] \centering \includegraphics[width=\textwidth]{pic/diffk.pdf} \caption{Performance with different numbers of disentangled factors $K$.} \label{figdifferentk} \end{figure} \paragraph{\textbf{The effect of the number of model dimension.}} We also study how the dimension of node representations $D$ can affect the performance. We evaluate our method when $K=4$ and $D\in\{16,32,64,128\}$. As illustrated in Fig. \ref{figdifferentd}, on Twitter and Memetracker the performance doesn't converge until $D=128$, possibly because they have larger training sets. Douban dataset converges when $D=64$ and shows a decreasing trend when $D$ gets larger. \begin{figure}[htbp] \centering \includegraphics[width=\textwidth]{pic/diffd.pdf} \caption{Performance with different dimensions of node representations $D$.} \label{figdifferentd} \end{figure} \section{Conclusion} In this paper, we propose a novel diffusion prediction model, SIDDA, which can extract latent factors by learning multiple hidden states at each timestamp. Specifically, we propose sequential attention to capture sequential relations of information cascades. Then we adopt a disentangled attention to learn multiple hidden states representing different latent factors. Additionally, we employ Gumbel-Softmax to further enhance the disentangled effect. The experiments on three real-world datasets show the superiority of our method when compared with state-of-the-art diffusion prediction models. \section{Introduction} The phenomenon of information diffusion, dubbed as information cascade, is ubiquitous in our daily lives, \textit{e.g.}, the spread of breaking news or virus. Information diffusion prediction is an important and challenging task, which aims at forecasting the future properties or behaviors of an information cascade, such as the eventual size~\cite{deepcas-macro,cascn-macro,macro-coupledGnn} or the next infected user~\cite{NDM,DCE-micro,infVAE-micro}. Current studies of information diffusion prediction have been successfully adopted for many real-world scenarios including epidemiology~\cite{wallinga2004different}, viral marketing~\cite{leskovec2007dynamics}, media advertising~\cite{li2013popularity} and the spread of news and memes~\cite{leskovec2009meme,vosoughi2018spread}. During the last decade, deep learning techniques have shown their effectiveness in computer vision~\cite{krizhevsky2017imagenet} and natural language processing areas~\cite{devlin2018bert}. Recently, methods~\cite{deepcas-macro,CYAN-RNN,TopoLSTM,SNIDSA} based on recurrent neural networks (RNNs) also achieved promising results in information cascade modeling by treating influenced users as sequential data ranked by their infection timestamps. In RNNs, the entire information diffusion history is encoded into a real-valued vector as the hidden state. However, representing all previously infected users by a single vector could fail to encode all necessary information for future predictions due to the mode collapse~\cite{che2016mode} problem. As illustrated in Fig.\ref{fig_intro}, an information item is spreading through two communities and the cascade sequence has infected $5$ users ($4$ from community A and $1$ from community B). An information cascade model need to encode these users. Learned representations of conventional methods can encode the most important factor (community A) for future predictions, but fail to remember others (community B). \begin{figure}[htb] \centering \includegraphics[scale=0.4]{pic/intro.pdf} \caption{An illustration of mode collapse problem in information cascade modeling. } \label{fig_intro} \end{figure} To address this problem, we propose to employ the idea of disentangled representation learning, which aims to extract multiple latent factors representing different aspects of the data, for modeling the diffusion history of an information cascade. Though disentangled representation learning was originally proposed in controllable image generation~\cite{chen2016infogan}, it has been successfully adopted for other areas such as text generation~\cite{stylicSPG-disentangled} as well. To the best of our knowledge, we are the first to use disentangled representation learning for information diffusion prediction. To be more specific, we propose a novel Sequential Information Diffusion model with Disentangled Attention (SIDDA) by applying a sequential attention module and a disentangled attention module on RNNs. The former module can help better aggregate the history information and the latter one will disentangle the hidden state vector into multiple representations. We further employ Gumbel-Softmax~\cite{gumbel} technique to encourage bigger differences between the disentangled representations. Consequently, we are able to learn multiple hidden state vectors characterizing different latent factors for future predictions at each step of cascade modeling. Different hidden state vectors can complement each other and provide more comprehensive information to predict the next infected users. We conduct experiments on three public real-world datasets and employ the task of next infected user prediction for evaluation. Experimental results show that the proposed model SIDDA significantly outperforms state-of-the-art baseline methods by up to $14\%$ in terms of $hits@50$ metric. Our contributions are as follows: \begin{itemize} \item To the best of our knowledge, we are the first work to adopt the idea of disentangled representation learning for information cascade modeling. \item We propose SIDDA, a novel method which can learn disentangled representations encoding different factors for information diffusion prediction. \item Experiments on three real-world datasets demonstrate that our proposed method outperforms state-of-the-art baselines significantly. \end{itemize} \section{Related Work} \subsection{Information Diffusion Prediction} There are two kinds of tasks associated with information diffusion prediction: (1) Studying the growth of cascades and (2) Predicting the next activated node in the cascade. In some recent works~\cite{cascn-macro,NDM,FOREST,zhou2020survey}, these tasks are classified as macroscopic and microscopic predictions. \subsubsection{Macroscopic Information Diffusion Prediction} Macroscopic information diffusion prediction, also known as popularity prediction, aims at predicting cascade sizes in the future~\cite{zhao2015seismic}. Previously, related works are based on feature-based approaches~\cite{cancascadebepredicted} and generative approaches~\cite{generative-hawkes}. In recent years, with the success of deep learning, methods based on Recurrent Neural Networks (RNNs) are proposed, \textit{e.g.}, DeepCas~\cite{deepcas-macro} and Deephawkes~\cite{deephawkes-macro}. Some researchers also introduce Graph Neural Networks (GNNs) to model the underlying social graph and diffusion paths, \textit{e.g.}, CoupledGNN~\cite{macro-coupledGnn} and HDGNN~\cite{heterogeneous4-HDGNN-macro}. \subsubsection{Microscopic Information Diffusion Prediction} Our work focuses on microscopic information diffusion prediction, which aims to forecast the next activated node given previously infected users in an information cascade. With the development of deep learning, various kinds of neural networks have been adopted for microscopic information diffusion prediction. Generally, RNN, GNN and attention mechanism are widely used, and give promising results. Topo-LSTM~\cite{TopoLSTM} proposes a novel LSTM to model tree-structured cascades. CYAN-RNN~\cite{CYAN-RNN} and Deep-Diffuse~\cite{deepdiffuse} take timestamps into consideration with the help of temporal point processes. DyHGCN~\cite{heterogeneous2-DyHGCN} proposes a heterogeneous graph convolutional network to model the social graph and dynamic diffusion graph jointly. HDD~\cite{heterogeneous1} exploits meta-path in the diffusion graph and learns heterogeneous network representations using GNN. There are also some models fully based on attention mechanisms, \textit{e.g.}, DAN~\cite{DAN}, Hi-DAN~\cite{Hi-DAN} and NDM~\cite{NDM}. Besides, some works target on both macroscopic and microscopic information diffusion predictions. FOREST~\cite{FOREST} makes use of reinforcement learning to incorporate the ability of macroscopic prediction. DMT-LIC~\cite{dmt-lic-related} is a multi-task learning framework with a shared-representation layer and two different task layers for predictions. However, existing methods represent previously infected users by a single vector and could encounter the mode collapse problem, which would fail to encode all necessary information for future predictions. \subsection{Disentangled Representation Learning} Disentangled representation learning which aims to learn representations of different latent factors hidden in the observed data~\cite{representationlearning,chen2016infogan}, has been successfully used in various fields. In the field of recommendation systems, a few works are proposed to learn disentangled item representations~\cite{ma2019learningcosinedot}. \cite{ma2020disentangled} performs self-supervision in the latent space, getting disentangled intentions from item sequences for product recommendations. In the field of natural language processing, SPG~\cite{stylicSPG-disentangled} proposes an unsupervised way to generate stylistic poetry by maximizing the mutual information between representations and generated text. GNUD~\cite{GNUD-disentangled} explores user interest disentanglement in news recommendation by making use of DisenGCN~\cite{madisentangledgnn-DisenGCN}. Besides, disentangled representation learning is also successfully used in the modeling of graph-structured data~\cite{multi-aspect,madisentangledgnn-DisenGCN, disentangledGNN-IPGDN}. As far as we know, we are the first to adopt the idea of disentangled representation learning for information diffusion prediction. \section{Method} In this section, we will formalize the problem of information diffusion prediction and introduce the notations. Then we will propose an RNN-based information diffusion prediction model and a novel attention mechanism to learn disentangled representations. Finally, we will predict the next infected node using the disentangled representations. \subsection{Problem Definition} Given a node (or user) set $V$ and a cascade set $C$, we have $V=\{v_1,v_2,...,v_N\}$ and $C=\{c_1,c_2,...,c_M\}$. Here $N$ is the size of the node set, and $M$ is the number of cascades. Each cascade $c_i \in C$ spreading among users is a sequence of nodes $\{v^i_1,v^i_2,...,v^i_{\left | c_i \right |}\}$, ordered by their activation timestamps. Following the same setting in previous works~\cite{NDM, TopoLSTM, SNIDSA, FOREST}, we only keep the order of nodes and ignore the exact timestamps. A detailed modeling of timestamp information will be left for future work. Information diffusion prediction can be formulated as: given the cascade sequence of previously activated nodes $\{v^i_1,v^i_2,...,v^i_t\}$ in cascade $c_i$ for $t=1,2,...,\left | c_i \right |-1$, predicting the next activated node $v^i_{t+1}$. In other words, our goal is to build a model that is able to learn the conditional probability function $p(v^i_{t+1}|\{v^i_1,v^i_2,...,v^i_t\})$ for each cascade $c_i$ where $1\leq i \leq M$. We will focus on the modeling of a single cascade and omit the superscript for simplification in the rest of the paper. \subsection{Model Architecture} The framework of our method is shown in Fig.\ref{model_overall}. Firstly, we encode every node into node embedding by an embedding-lookup layer. Then we employ a Gated Recurrent Unit (GRU) as the basis to model the node sequence. Given the infected node sequence, the GRU model can output a hidden state representing the sequential history at each time step. Then a sequential attention module and a disentangled attention module are applied to better aggregate the history information and disentangle the hidden state vector into multiple representations. Finally, disentangled representations will be used for predicting the next infected node. \begin{figure}[H] \centering \includegraphics[scale=0.4]{pic/overall.pdf} \caption{An illustration of our proposed model SIDDA. The model will derive $K$ disentangled representations $\mathbf{y_t^{(k)}}(1 \leq k \leq K)$ at time $t$, with the help of a disentangled attention module.} \label{model_overall} \end{figure} \subsubsection{Gated Recurrent Unit} Recurrent neural networks(RNNs) have shown great potentials in modeling sequence data. Previous works~\cite{TopoLSTM,SNIDSA,FOREST,CYAN-RNN,deepdiffuse,lstm-cnn-hin-kbs} used RNNs as their basis to model information diffusion cascades. Firstly, we represent each node as a vector $\mathbf{x}\in \mathbb{R}^D$. By feeding the activated node embedding $\mathbf{x_t}$ into an RNN at every timestamp, we can have a hidden state $\mathbf{h_t}$ capturing the history information of all previously activated nodes as the output. Gated Recurrent Unit (GRU) can alleviate the vanishing gradient problem compared with a standard RNN. It can be considered as a variation of the LSTM but is computationally cheaper. Therefore, we select GRU as our model basis. \begin{equation} \mathbf{h_t} = GRU(\mathbf{h_{t-1}}, \mathbf{x_t}) \label{gru} \end{equation} \subsubsection{Sequential Attention Module} Note that every hidden state $\mathbf{h_t}$ in GRU contains information about the input node sequence with a focus around position $t$. To aggregate the sequential history information of all positions automatically, we propose to employ attention mechanism, which was originally proposed in neural machine translation~\cite{attentionpaper}, and learn to assign different attention weights to previous hidden states $\mathbf{h_i}$ $(i\leq t)$. Formally, the sequential attention weight $\alpha_{it}$ of the $i$-th hidden state is computed by: \begin{gather} \alpha_{it} = \frac{exp(\frac{1}{\sqrt{D}} e_{it} )}{\sum_{j=1}^{t}exp(\frac{1}{\sqrt{D}}e_{jt})} \\ e_{it} = d(\mathbf{h_i},\mathbf{h_t})\notag \end{gather} where $\frac{1}{\sqrt{D}}$ is a scaling coefficient and $h_i\in \mathbb{R}^D$ is the $i$-th hidden state. $d(\cdot,\cdot)$ is a distance function, and we use dot product in this work. \subsubsection{Disentangled Attention Module} Inspired by the recent advances in disentangled representation learning~\cite{madisentangledgnn-DisenGCN,ma2020disentangled}, we propose our disentangled attention module to learn multiple representations characterizing different latent factors for future predictions at each step of cascade modeling. We assume that there are $K$ main latent factors that affect the diffusion of an information item. Take Twitter as an example, an information item may spread through $K$ different communities or users are infected by tweets from $K$ topics. We want to disentangle these diverse latent factors from the hidden state $\mathbf{h_t}$ to get the disentangled representations. \begin{figure}[H] \centering \includegraphics[scale=0.4]{pic/pki.pdf} \caption{An illustration of the disentangled attention module.} \label{model_pki} \end{figure} To be more specific, we set $K$ prototype embeddings $\mathbf{p_k}$ $(1\leq k\leq K)$ to represent the $K$ potential factors. We expect these prototype embeddings can capture diverse properties after training. Then for each hidden state $h_i$, we will compute its similarity with $K$ prototypes by the distance between $\mathbf{h_i}$ and $\mathbf{P}$. The equations are as follows: \begin{equation} \begin{gathered} \beta_{ik} = \frac{exp(\frac{1}{\sqrt{D}}d(\mathbf{h_{i}},\mathbf{p_k}))}{\sum_{{k}'=1}^{K}exp(\frac{1}{\sqrt{D}}d(\mathbf{h_{i}},\mathbf{p_{{k}'}}))} \\ d(\mathbf{h_i},\mathbf{p_k}) = \frac{\mathbf{h_i}\cdot \mathbf{p_k}}{\|{\mathbf{h_i}}\| \|{\mathbf{p_k}}\|} \label{pki} \end{gathered} \end{equation} where $k=1,2,...,K$ and $i=1,2,...,t$. $\{\mathbf{p_k}\in \mathbb{R}^D:1\leq k\leq K\}$ are prototype embeddings of $K$ latent factors. $d(\cdot,\cdot)$ is the distance function, and we select cosine-similarity instead of dot product here because the latter is more vulnerable when it comes to mode collapse~\cite{ma2019learningcosinedot}. Then we apply a Softmax function to compute the attention score $\beta_{ik}$ for further usage. It is worth noting that by using Softmax, all of the $\beta_{ik}$ $(1\leq k\leq K)$ tend to have a similar result. The hidden state $h_i$ will be disentangled to $K$ latent factors equally, which would harm the performance of disentanglement. We further employ Gumbel-Softmax to alleviate this drawback and enhance the disentanglement effect. Finally, we can combine the sequence attention and disentanglement attention together, using $\alpha_{ij}$ and $\beta_{ik}$ to draw the weighted sum result $y_i^{(k)}$ to represent the hidden state under the $k$-th factor: \begin{equation} \mathbf{y_t^{(k)}} = LayerNorm(\sum_{i=1}^{t}\alpha_{it}\cdot \beta_{ik}\cdot \mathbf{h_i}) \label{pkipi} \end{equation} where $k=1,2,...,K$. When $K=1$, our method degenerates into a GRU model with an attention mechanism. We name our model as Sequential Information Diffusion model with Disentangled Attention (SIDDA). We further apply Gumbel-Softmax trick~\cite{gumbel} to encourage the disentanglement. \subsection{Optimization Objective} We can get $K$ disentangled representations at each timestamp $t$ using Eq. (\ref{pkipi}). Different hidden state vectors can complement each other and provide more comprehensive information to predict the next infected users. Therefore, we compute the similarity, \textit{i.e.}, dot product, between these $K$ disentangled representations $\mathbf{y_t^{(k)}}$ and node embeddings $\mathbf{X}$ to predict the next activated node. Hence, the loss function can be defined as follows: \begin{equation} \begin{aligned} L(\mathbf{\theta},t) &= -\log p_{\mathbb{\theta}}(\mathbf{x_{t+1}}|\mathbf{y_t}) \\ &= -\log \frac{\max_{k\in \{1,2,...,K\}}exp(\frac{1}{\sqrt{D}} \mathbf{x_{t+1}}\cdot \mathbf{y_t^{(k)}} )} {\sum_{{v}' \in V}\max_{k\in \{1,2,...,K\}}exp(\frac{1}{\sqrt{D}} \mathbf{x_{{v}'}}\cdot \mathbf{y_t^{(k)}})} \label{loss} \end{aligned} \end{equation} It is noteworthy that in Eq. (\ref{loss}), the Softmax function is applied to all of the $K$ disentangled factors. The model is forced to preserve different information in $\mathbf{y_t^{(k)}}(1\leq k \leq K)$. Therefore, we do not need to use regularization terms to restrict the distribution of $\mathbf{y_t^{(k)}}$ in our model. \section{Experiments} In this section, we will introduce the datasets used in our experiments, and the state-of-the-art baselines which will be compared with our proposed method. We further introduce the evaluation metrics used to evaluate the performance of the baselines and our method. We will design comparative experiments and ablation experiments to show the superiority of our method. \subsection{Datasets} \textbf{Twitter}~\cite{twitterdata} dataset collects tweets published in October 2010, containing URLs in the message body. Each URL is considered to be a unique marker of information, spreading among users. \textbf{Douban}~\cite{doubandata} is a Chinese social networking service network where users can share content about books. In our experiment, we consider each book as an information item, and a user is activated if the user reads the book. \textbf{Memetracker}~\cite{memetrackerdata} contains millions of online mainstream social media activity, tracking the most frequent phrases, \textit{i.e.}, memes. Memes were information items being shared among websites. \begin{table}[htbp] \centering \caption{Statistics of datasets.} \begin{tabular}{ccccc} \toprule Dataset&\# Cascades&\# Nodes&\# Links &Average Length \\ \midrule Twitter&3,442&12,627&309,631&32.60\\ Douban&10,602&23,123&348,280&27.14\\ Memetracker&12,661&4,709&-&16.24\\ \bottomrule \end{tabular} \label{dataset \end{table} We follow the experiment setting in~\cite{FOREST}, randomly selecting 80\% of cascades for training, 10\% for validation, and 10\% for test. The statistics of datasets are listed in Table \ref{dataset}. Twitter and Douban datasets have an underlying social graph, which will be used by some of the baseline models. \subsection{Baselines and Experimental Settings} We compared our method with several state-of-the-art baselines. \textbf{DeepDiffuse}~\cite{deepdiffuse} is an LSTM based model with an attention mechanism, utilizing node sequence and their corresponding activated time. We replace timestamps with integer activated steps in the cascade. \textbf{Topo-LSTM}~\cite{TopoLSTM} is a topological recurrent network, which can model diffusion topology as dynamic directed acyclic graphs (DAGs). In our experiment, the cascade structure is extracted from the underlying social graph. \textbf{NDM}~\cite{NDM} employs convolutional network and attention mechanism for cascade modeling. It makes relax assumptions on the datasets and doesn't need a diffusion graph. \textbf{SNIDSA}~\cite{SNIDSA} is a novel sequential neural network with structure attention. It utilizes both the sequential nature of a cascade and structural characteristics of the underlying social graph with the help of a gating mechanism. \textbf{FOREST}~\cite{FOREST} is a novel GRU-based information diffusion model. It extracts underlying social graph information and uses reinforcement learning to incorporate macroscopic prediction ability into itself. \subsection{Evaluation Metrics and Experiment Setting} As pointed out by~\cite{TopoLSTM}, there can be an arbitrary number of potential candidates, information diffusion prediction can be seen as a retrieval task. We use two popular information retrieval evaluation method $\textbf{hits}@N$ and $\textbf{map}@N$. The same evaluation metrics are also used~\cite{FOREST,CYAN-RNN,deepdiffuse, Hi-DAN}. We set $N=10,50,100$ for evaluation. Since SNIDSA and TopoLSTM need an underlying social graph in the dataset, we exclude them for Memetracker. We implement our method in PyTorch. We use Adam optimizer for mini-batch gradient descent and use dynamic learning rate. The dropout rate is set to $1e-4$. The temperature parameter of Gumbel-Softmax $\tau=1.0$. \begin{figure}[htbp] \centering \begin{minipage}[t]{0.49\textwidth} \includegraphics[width=\textwidth]{pic/1.pdf} \vspace*{-12mm} \caption{$hits@N$ of Twitter} \label{overall1} \end{minipage} \begin{minipage}[t]{0.49\textwidth} \includegraphics[width=\textwidth]{pic/2.pdf} \vspace*{-12mm} \caption{$map@N$ of Twitter} \label{overall2} \end{minipage} \begin{minipage}[t]{0.49\textwidth} \includegraphics[width=\textwidth]{pic/3.pdf} \vspace*{-12mm} \caption{$hits@N$ of Douban} \label{overall3} \end{minipage} \begin{minipage}[t]{0.49\textwidth} \includegraphics[width=\textwidth]{pic/4.pdf} \vspace*{-12mm} \caption{$map@N$ of Douban} \label{overall4} \end{minipage} \begin{minipage}[t]{0.49\textwidth} \includegraphics[width=\textwidth]{pic/5.pdf} \vspace*{-12mm} \caption{$hits@N$ of Memetracker} \label{overall5} \end{minipage} \begin{minipage}[t]{0.49\textwidth} \includegraphics[width=\textwidth]{pic/6.pdf} \vspace*{-12mm} \caption{$map@N$ of Memetracker} \label{overall6} \end{minipage} \caption{The overall results, scores are the higher the better.} \label{overall_result} \end{figure} \subsection{Experimental Results} We design the comparative experiments, ablation experiments, and analyze the parameter sensitivity in this section. \subsubsection{Overall Evaluation} Fig. \ref{overall_result} shows the performance of different methods on three datasets. We select the results when $K=4$ for our method. For the analysis of parameters, please refer to Section \ref{Parameteranalysissec}. We find that: SIDDA outperforms all the state-of-the-art baseline methods consistently and significantly on $hits@N$ and $map@N$. The results show that our method can predict the next activated user successfully. \subsubsection{Ablation Study} \label{albationstudysec} \label{Parameteranalysissec} \paragraph{\textbf{The effect of the number of disentangled factors.}} We study how the number of disentangled factors $K$ can affect the performance of our method. As shown in Fig.\ref{figdifferentk}, our method has the worst performance when $K=1$. Because when $K=1$, our model is a GRU model with an attention mechanism, the latent information is not disentangled thoroughly. The performance on Douban and Memetracker dataset increases with $K$ getting larger, and start to decrease when $K>4$. While performance on the Twitter dataset is much better when $K>4$, showing an increasing trend. This is because Twitter has more diverse topics and may have more factors to disentangle. \begin{figure}[htbp] \centering \includegraphics[width=\textwidth]{pic/diffk.pdf} \caption{Performance with different numbers of disentangled factors $K$.} \label{figdifferentk} \end{figure} \paragraph{\textbf{The effect of the number of model dimension.}} We also study how the dimension of node representations $D$ can affect the performance. We evaluate our method when $K=4$ and $D\in\{16,32,64,128\}$. As illustrated in Fig. \ref{figdifferentd}, on Twitter and Memetracker the performance doesn't converge until $D=128$, possibly because they have larger training sets. Douban dataset converges when $D=64$ and shows a decreasing trend when $D$ gets larger. \begin{figure}[htbp] \centering \includegraphics[width=\textwidth]{pic/diffd.pdf} \caption{Performance with different dimensions of node representations $D$.} \label{figdifferentd} \end{figure} \section{Conclusion} In this paper, we propose a novel diffusion prediction model, SIDDA, which can extract latent factors by learning multiple hidden states at each timestamp. Specifically, we propose sequential attention to capture sequential relations of information cascades. Then we adopt a disentangled attention to learn multiple hidden states representing different latent factors. Additionally, we employ Gumbel-Softmax to further enhance the disentangled effect. The experiments on three real-world datasets show the superiority of our method when compared with state-of-the-art diffusion prediction models.
{'timestamp': '2020-12-17T02:13:45', 'yymm': '2012', 'arxiv_id': '2012.08828', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08828'}
arxiv
\section{\uppercase{Introduction}} \label{sec:introduction} \begin{figure*}[t!] \begin{subfigure}{\linewidth} \centering \includegraphics[width=\linewidth]{img/tsne.pdf} \caption{t-SNE visualizations. Upper-Center: Original latent space. Bottom-Left: Latent space according to our approach. Bottom-Right: Latent space according to standard approach\protect\footnotemark. Both bottom spaces represent the classes of the generated images given a latent code. Therefore, they should be as similar as possible to the original latent space.} \label{fig:tsne_cifar} \end{subfigure}\\[2ex] \begin{subfigure}{\linewidth} \centering \includegraphics[width=\linewidth]{img/tsne_images.pdf} \caption{Random sets of generated samples trained on CIFAR10. The solid frames contain real images and the dashed the generated.} \label{fig:tsne_cifar2} \end{subfigure} \caption{Given a latent space, our approach exploits the structure using its features to condition the generative model. In this way, our system eventually can produce samples on demand. The code color is consistent within the whole figure.} \label{fig:teaser} \end{figure*} \noindent Generative Adversarial Networks (GANs) \cite{goodfellow2014generative} are one of the most prominent unsupervised generative models. Their framework involves training a generator and discriminator model in an adversarial game, such that the generator learns to produce samples from the data distribution. Training GANs is challenging because they require to deal with a minimax loss that needs to find a Nash equilibrium of a non-convex function in a high-dimensional parameter space. This scenario may lead to a lack of control during the training phase, exhibiting non-desired side effects such as instability, mode collapse, among others. As a result, many techniques have been proposed to improve the stability training of GANs \cite{salimans2016improved,gulrajani2017improved,miyato2018spectral,durall2019stabilizing}. \let\thefootnote\relax\footnotetext{Accepted in VISAPP 2021} Conditioning has risen as one of the key technique in this vein \cite{mirza2014conditional,chen2016infogan,isola2017image,choi2018stargan}, whereby the whole model has granted access to labelled data. In principle, providing supervised information to the discriminator encourages it to behave more stable at training since it is easier to learn a conditional model for each class than for a joint distribution. However, conditioning comes with a price, the necessity for annotated data. The scarcity of labelled data is a major challenge in many deep learning applications which usually suffer from high data acquisition costs. Representation learning techniques enable models to discover underlying semantics-rich features in data and disentangle hidden factors of variation. These powerful representations can be independent of the downstream task, leaving the need of labels in the background. In fact, there are fully unsupervised representation learning methods \cite{misra2016shuffle,gidaris2018unsupervised,rao2019continual,milbich2020unsupervised} that automatically extract expressive feature representations from data without any manually labelled annotation. Due to this intrinsic capability, representation learning based on deep neural networks have been becoming a widely used technique to empower other tasks \cite{caron2018deep,oord2018representation,chen2020simple}. Motivated by the aforementioned challenges, our goal is to show that it is possible to recover the benefits of conditioning by exploiting the advantages that representation learning can offer (see Fig. \ref{fig:teaser}). In particular, we introduce a model that is conditioned on the latent space structure. As a result, our proposed method can generate samples on demand, without access to labeled data at the GAN level. To ensure the correct behaviour, a customized loss is added to the model. Our contributions are as follows. \begin{itemize} \item We propose a novel generative adversarial network conditioned on features from a latent space representation. \item We introduce a simple yet effective new loss function which incorporates the structure of the latent space. \item Our experimental results show a neat control on the generated samples. We test the approach on MNIST, CIFAR10 and CelebA datasets. \end{itemize} \footnotetext{Standard approach refers to replace the encoded labels with latent code.} \section{\uppercase{Related Work}} \subsection{Conditional Generative Adversarial Networks} Generative image modelling has recently advanced dramatically. State-of-the-art methods are GAN-based models \cite{brock2018large,karras2019style,karras2020analyzing} which are capable of generating high-resolution, diverse samples from complex datasets. However, GANs are extremely sensitive to nearly every aspect of its set-up, from loss function to model architecture. Due to optimization issues and hyper-parameter sensitivity, GANs suffer from tedious instabilities during training. Conditional GANs have witnessed outstanding progress, rising as one of the key technique to improve stability training and to remove mode collapse phenomena. As a consequence, they have become one of the most widely used approaches for generative modelling of complex datasets such as ImageNet. CGAN \cite{mirza2014conditional} was the first work to introduce conditions on GANs, shortly followed by a flurry of works ever since. There have been many different forms of conditional image generation, including class-based \cite{mirza2014conditional,odena2017conditional,brock2018large} , image-based \cite{isola2017image,huang2018multimodal,mao2019mode} , mask- and bounding box-based \cite{hinz2019generating,park2019semantic,durall2020local}, as well as text-based \cite{reed2016generative,xu2018attngan,hong2018inferring}. This intensive research has led to impressive development of a huge variety of techniques, paving the road towards the challenging task of generating more complex scenes. \subsection{Unsupervised Representation Learning} In recent years, many unsupervised representation learning methods have been introduced \cite{misra2016shuffle,gidaris2018unsupervised,rao2019continual,milbich2020unsupervised}. The main idea of these methods is to explore easily accessible information, such as temporal or spatial neighbourhood, to design a surrogate supervisory signal to empower the feature learning. Although many traditional approaches such as random projection \cite{li2006very}, manifold learning \cite{hinton2003stochastic} and auto-encoder \cite{vincent2010stacked} have significantly improved feature representations, many of them often suffer either from being computationally too costly to scale up to large or high-dimensional datasets, or from failing to capture complex class structures mostly due to its underlying data assumption. On the other hand, a number of recent unsupervised representation learning approaches rely on new self-supervised techniques. These approaches formulate the problem as an annotation free pretext task; they have achieved remarkable results \cite{doersch2015unsupervised,oord2018representation,chen2020simple} and even on GAN-based models as well \cite{chen2019self}. Self-supervision generally involves learning from tasks designed to resemble supervised learning in some way, where labels can be created automatically from the data itself without manual intervention. \begin{figure*}[t!] \centering \includegraphics[width=0.9\linewidth]{img/main.pdf} \caption{Overview of the processing pipeline of our approach. It contains two main blocks, a feature extraction model and a generative model, more specifically a GAN. This structure allows the generator to incorporate a condition based on the latent space, so that eventually the system can produce images on demand using the latent representation. } \label{fig:main} \end{figure*} \section{\uppercase{Method}} In this section we describe our approach in detail. First, we present our representation learning set-up together with its sampling algorithm. Then, we introduce a new loss function capable of exploiting the structural properties from the latent space. Finally, we have a look at the adversarial framework for training a model in an end-to-end fashion. Fig. \ref{fig:main} gives an overview of the main pipeline and its components. \subsection{Representation Learning} The goal of representation learning or feature learning is to find an appropriate representation of data in order to perform a machine learning task.\\ \noindent \textbf{Generating Latent Space.} The latent space must contain all the important information needed to represent reliably the original data points in a simplified and compressed space. Similar to \cite{aspiras2019active}, in our work we also try to exploit the latent space. In particular, we rely on existing topologies that can capture a high level of abstraction. Hence, we mainly focus on integrating these data descriptors and on evaluating their usability and impact. For this reason, We count on several set-ups where we can sample informative features of different qualities, i.e. level of clustering in the latent spaces. Our feature extractor block $E$ is a convolutional-based model for classification tasks. Inspired by \cite{caron2018deep}, to extract the features we do not use the classifier output logits, but the feature maps from an intermediate convolutional layer. We refer to these hidden spaces as latent space.\\ \noindent \textbf{Sampling from Latent Space.} Assuming that the feature extractor is able to produce a structured latent space, e.g. semi-clustered features, we can start sampling observations that will be fed to our GAN afterwards. The procedure to create sampling batches is described in Algorithm \ref{alg:sampling}. \begin{algorithm} \caption{Creating batches for training the GAN.} \label{alg:sampling} \begin{algorithmic}[1] \STATE Sample a batch of images $\mathrm{\mathbf{x}}$ \STATE Extract features from it $\mathbf{f} = E(\mathbf{x})$ \STATE Compute distance between all features $\mathbf{D} = ||\mathbf{f}||_{1}$ \FOR {$x_i$ in $\mathrm{\mathbf{x}}$} \STATE Select $x_i$ and sort the rest according to their distance $d(x_i)$ \STATE Select nearest neighbour from $x_i$, i.e. $d_\mathrm{min}(x_i)$ \STATE Select the farthest neighbour from $x_i$, i.e. $d_\mathrm{max}(x_i)$ \ENDFOR \end{algorithmic} \end{algorithm} \subsection{Loss Function} \noindent \textbf{Minimax Loss.} A GAN architecture is comprised of two parts, a discriminator $D$ and a generator $G$. While the discriminator trains directly on real and generated images, the generator trains via the discriminator model. They should therefore use loss functions that reflect the distance between the distribution of the data generated $p_{\mathrm{z}}$ and the distribution of the real data $p_{\mathrm{data}}$. Minimax loss is by default the candidate to carry on with this task and it is defined as \begin{align} \begin{split} \min_{G} \max_{D} \mathcal{L}(D,G) =\, \mathbb{E}_{\mathrm{\mathbf{x}} \sim p_{\mathrm{data}}} \left[ \log \left(D(x)\right) \right] + \cr \mathbb{E}_{z \sim p_{z}}[\log(1-D(G(z)))]. \end{split} \label{formula:main} \end{align} \vspace{1px} \noindent \textbf{Triple Coupled Loss.} In the vanilla minimax loss the discriminator expects batches of individual images. This means that there is a unique mapping between input image and output, where each input is evaluated and then classified as real or fake. Despite being a functional loss term, if we hold to that closed formulation, we cannot leverage alternatives such as conditional features or combinatorial inputs i.e. input is not any longer only a single image but a few of them. We introduce a loss function coined triple coupled loss that incorporates combinatorial inputs acting as a semi-conditional mechanism. The approach lies on the idea of exploiting similitudes and differences between images. In fact, similar approaches have been already successfully implemented in other works \cite{chongxuan2017triple,sanchez2018triple,ho2020learning}. In our implementation, the new discriminator takes couples of images as input and classify them as true or false. Unlike minimax case, now we have two degrees of freedom (two inputs) to take advantage of. Therefore, we produce different scenarios to further enhance the capabilities of our discriminator, so that it can also be conditioned in an indirect manner by the latent representation space. We can distinguish three different coupled case scenarios and their corresponding losses \begin{align} \begin{split} x_{\mathrm{adv}} = [x_{\mathrm{real}\_\mathrm{correct}},x_{\mathrm{fake}}] \,\longrightarrow\, \mathcal{L}_{\mathrm{adv}}\\ \mathcal{L}_{\mathrm{adv}} = \mathbb{E}_{\mathrm{\mathbf{x}} \sim ( p_{\mathrm{data}} \,\cup\, p_{\mathrm{z}} ) } \left[ \log \left(1-D(x_{\mathrm{adv}})\right) \right] \end{split} \end{align} \begin{align} \begin{split} x_{\mathrm{same}} = [x_{\mathrm{real}\_\mathrm{correct}},x_{\mathrm{real}\_\mathrm{correct}}] \,\longrightarrow\, \mathcal{L}_{\mathrm{same}}\\ \mathcal{L}_{\mathrm{same}} = \mathbb{E}_{\mathrm{\mathbf{x}} \sim p_{\mathrm{data}}} \left[ \log \left(D(x_{\mathrm{same}})\right) \right] \end{split} \end{align} \begin{align} \begin{split} x_{\mathrm{diff}} = [x_{\mathrm{real}\_\mathrm{correct}},x_{\mathrm{real}\_\mathrm{wrong}}] \,\longrightarrow\, \mathcal{L}_{\mathrm{diff}}\\ \mathcal{L}_{\mathrm{diff}} = \mathbb{E}_{\mathrm{\mathbf{x}} \sim p_{\mathrm{data}}} \left[ \log \left(1-D(x_{\mathrm{diff}})\right) \right]. \end{split} \end{align} \vspace{1px} We first have $x_{\mathrm{adv}}$ case which is the combination of one generated image ($x_{\mathrm{fake}}$) and one real that belongs to the target class ($x_{\mathrm{real}\_\mathrm{correct}}$). Then, we have $x_{\mathrm{same}}$ with two different "real correct" samples. Finally, the last case is $x_{\mathrm{diff}}$ which combines one "real correct" and one "real wrong". The latter term is a real image from a different class, i.e. not target class ($x_{\mathrm{real}\_\mathrm{wrong}}$). In order to incorporate the triple coupled loss, we need to reformulated the Formula \ref{formula:main} adding the aforementioned three case scenarios. As a result, the new objective loss is rewritten as follows \begin{align} \begin{split} \min_{G} \max_{D} \mathcal{L}(D,G) =\,& \lambda_{\mathrm{a}} \mathcal{L}_{\mathrm{adv}} \,+\, \lambda_{\mathrm{s}} \mathcal{L}_{\mathrm{same}} \,+\, \lambda_{\mathrm{d}} \mathcal{L}_{\mathrm{diff}} \end{split} \end{align} \noindent where $\lambda$s are the weighting coefficients. \subsection{Training on Conditioned Latent Feature Spaces} Our approach is divided into two distinguishable elements, the feature extractor $E$ and the generative model. With the integration of these two components into an embedded system, our model can produce samples on demand without label information.\\ \noindent \textbf{Dynamics of Training.} Given an input batch $\mathrm{\mathbf{x}}$, the feature extractor produces the latent code $\mathrm{\mathbf{f}}$. Then, we generate a vector of random noise $\mathrm{\mathbf{z}}$ (e.g. Gaussian) and we attach to it the $\mathrm{\mathbf{f}}$, creating in this way the input for our generator $\mathrm{\mathbf{n}}$ (see Fig. \ref{fig:main}). The expected behaviour from our generator should be similar to CGAN, where the generator needs to learn a twofold task. On the one hand, it has to learn to generate realistic images by approximating the real data distribution as much as possible. On the other hand, these synthetic images need to be conditioned consistently on $\mathrm{\mathbf{f}}$, so that later can be controlled. For example, when two similar\footnote[2]{Similarity is measured by $l_1$ distance as described in Algorithm \ref{alg:sampling}.} latent codes are fed into the model, this should produce two similar output images belonging to the same class. \begin{figure*}[t!] \centering \includegraphics[width=\linewidth]{img/scale.pdf} \caption{Random generated samples of 32x32, 64x64 and 128x128 resolutions.} \label{fig:scale} \end{figure*} The discriminator, however, has a remarkable difference with CGAN when it comes to training. While CGAN employs latent codes to condition directly the outcome results, our method uses a semi-conditional mechanism through the coupled inputs. As it is explained in the upper section, the discriminator employs the triplet coupled loss which enforces to respect the latent space structure and binding in this way the output with the conditional information. Algorithm \ref{alg:training} describes the training scheme. \begin{algorithm} \caption{Training GAN model.} \label{alg:training} \begin{algorithmic}[1] \STATE Require: $n_{\mathrm{iter}}$, the number of iterations. $n$, the number of iterations of the generator per discriminator iteration. $\lambda$'s, the weighting coefficients. $\theta_{\mathrm{gen}}$, generator's parameters. $\theta_{\mathrm{disc}}$, discriminator's parameters. \FOR {$i < n_{\mathrm{iter}}$} \STATE Sample batch using Algorithm 1 \STATE \# Train generator $G$ \STATE $\mathcal{L}_{\mathrm{gen}} = \mathcal{L}_{\mathrm{adv}}$ \STATE $\theta_{\mathrm{gen}} \leftarrow \theta_{\mathrm{gen}} + \nabla \mathcal{L}_{\mathrm{gen}}$ \IF {$mod(i,n) = 0$} \STATE \# Train discriminator $D$ \STATE $\mathcal{L}_{\mathrm{disc}} = \lambda_{\mathrm{a}} \mathcal{L}_{\mathrm{adv}} \,+\, \lambda_{\mathrm{s}} \mathcal{L}_{\mathrm{same}} \,+\, \lambda_{\mathrm{d}} \mathcal{L}_{\mathrm{diff}}$ \STATE $\theta_{\mathrm{disc}} \leftarrow \theta_{\mathrm{disc}} + \nabla \mathcal{L}_{\mathrm{disc}}$ \ENDIF \ENDFOR \end{algorithmic} \end{algorithm} \section{\uppercase{Experiments}} In this section, we show results for a series of experiments evaluating the effectiveness of our approach. We first give a detailed introduction of the experimental set-up. Then, we analyse the response of our model under different scenarios and we investigate the role that plays the structure of the latent space and its robustness. Finally, we check the impact of our customized loss function though an ablation study. \subsection{Experimental Set-up} We conduct a set of experiments on MNIST \cite{lecun1998gradient}, CIFAR10 and CelebA \cite{liu2015faceattributes} datasets. For each one, we use an individual classifier to ensure certain structural properties on our latent space. Next, we extract feature from one intermediate layer, and feed them into our generative model.\\ \noindent \textbf{MNIST.} The experiments carried on MNIST are fully\textbf{ unsupervised} since we do not require any label information. We choose to deploy an untrained AlexNet model \cite{krizhevsky2012imagenet} as feature extractor. As shown in \cite{caron2018deep}, AlexNet offers an out-of-the-box clustered space at certain intermediate layer without any need of training. Hence, we extract there the features and no extra processing step is involved.\\ \noindent \textbf{CIFAR10.} Despite the fact that CIFAR10 is fairly close to MNIST in terms of amount of samples and classes (10 in both cases), it is indeed a much more complex dataset. As a result, in this case we need to train a feature extractor to achieve a structured latent space. Inspired by the unsupervised representation learning method \cite{gidaris2018unsupervised}, we build a classifier which reaches similar accuracy.\\ \noindent \textbf{CelebA.} Different from the previous datasets, CelebA contains only "one class" of images. In particular, this datatset is an extensive collection of faces. However, each sample can potentially contain up to 20 different attributes. So, in our experiments we build different scenarios by splitting the dataset into different classes according to their attributes, e.g. \textit{man} and \textit{woman}. Moreover, we also test our approach on different resolutions, since the size of the images of CelebA is larger. Similarly to CIFAR10 case, we need to train again a feature extractor. \begin{figure*}[t!] \begin{subfigure}{0.49\linewidth} \centering \includegraphics[width=\linewidth]{img/cifar_evol.pdf} \caption{CIFAR10.} \label{fig:cifar_curve} \end{subfigure} \begin{subfigure}{0.49\linewidth} \centering \includegraphics[width=\linewidth]{img/celeba64_evol.pdf} \caption{CelebA.} \label{fig:cifar_curve} \end{subfigure} \caption{FID and accuracy learning curves on CIFAR10 and CelebA.} \label{fig:celeba_evol} \end{figure*} \begin{table}[t!] \centering \caption{Validation results in MNIST, CIFAR10 and CelebA.} \begin{tabular}{cccc} \hline \textbf{MNIST} & IS & FID & Accuracy \\ \hline baseline & 9.63 & - & - \\ ours & 9.78 & - & 72\% \\ \hline \textbf{CIFAR10} & IS & FID & Accuracy \\ \hline baseline & 7.2 & 28.76 & - \\ ours & 7.0 & 29.71 & 68\% \\ \hline \textbf{CelebA} & IS & FID & Accuracy \\ \hline baseline & 2.3 & 18.56 & - \\ ours (32) & 2.5 & 11.10 & 90\% \\ ours (64) & 2.7 & 13.69 & 94\% \\ ours (128) & 2.65 & 37.59 & 94\% \\ \hline \end{tabular} \label{table:metric} \end{table} \subsection{Evaluation Results} We compare the baseline model based on Spectral Normalization for Generative Adversarial Networks (SNGAN) \cite{miyato2018spectral} to our approach that incorporates the latent code and the coupled input on top of it. The rest of the topology remains unchanged.\footnote[3]{In CelebA, we add one and two layers into the model to be able to produce samples with resolution of 64x64 and 128x128, respectively.} We do not use CGAN architecture since our framework is not conditioned on labels. Therefore, we take an unsupervised model as a baseline. In particular, we choose SNGAN because it is a simple yet stable model that allows to control the changes applied on the system. Besides, it generates appealing results having a competitive metric scores. To evaluate generated samples, we report standard qualitative scores on the Frechet Inception Distance (FID) and the Inception Score (IS) metrics. Furthermore, we provide the accuracy scores that eventually quantize the success of the system. We compute this score using a classifier trained on the real data that guarantees that the metric correctly assesses the percentage of generated samples that coincide with the class of the latent code. For instance, if the latent code belongs to a \textit{cat}, the generator should produce a \textit{cat}. Table \ref{table:metric} compares scores for each metric. We observe how our model performs fairly similar to the baseline independently of the scenario. Only when we ask for a 128x128 output resolution, the FID score increases substantially. We hypothesize that this break happens due to a model architecture issue since the baseline is initially designed for 32x32 images (see Fig. \ref{fig:scale}). Fig. \ref{fig:celeba_evol} plots FID and accuracy training curves on CIFAR10 and CelebA datasets, and confirms that our approach exhibits a strong correlation between the both metrics. A better FID score (low value) means always a higher accuracy score. It is important to notice that baseline models do not have accuracy score since they cannot choose the class of the output. On the other hand, regarding our approach, the accuracy for both MNIST and CIFAR is around 70\%, and more than 90\% for CelebA. This gap is directly related with the quality of the latent space. In other words, the more clustered the latent space is, the higher accuracy our model can have. In this case, CelebA is evaluated in a scenario with only two classes \textit{man} and \textit{women}, as a consequence the latent spaces is simpler. As a rule of thumb, an increase of classes will often lead to a more tangled latent space making the problem harder. The main reason for that are those samples located on the borders. We refer to this phenomenon as border effect and it is shown in Fig. \ref{fig:tsne_celeba2}. As it is expected, we observe how the samples that lie between the two blobs have usually a higher failure rate (colored in red). \begin{figure*}[t!] \centering \includegraphics[width=\linewidth]{img/tsne_celeba2.pdf} \caption{Visualization of border effect on CelebA for the classes \textit{man} and \textit{woman}. Upper-left: t-SNE of extracted features regarding to their classes. Upper-right: t-SNE of extracted features regarding to their capacity of conditioning the output i.e. accuracy. Bottom: Random samples from different latent codes, where the solid frame belong to the real images and the dashed frames the generated. The code color is consistent within the whole figure.} \label{fig:tsne_celeba2} \end{figure*} \subsection{Impact of the Latent Space Structure} The structure of latent space plays an important role and has a direct effect in the accuracy performance. This is mainly due to the nature of the triple coupled loss. This term relies on having at least a semi-clustered feature space to sample from. Hence, those latent spaces with almost no structure will build many false couples in training time and resulting in bad performance. Notice that the generator model does not use label information directly, but through the extracted features. \begin{table*}[t!] \centering \caption{Statistics of the latent space's structure for different scenarios. } \begin{tabular}{cccccc} \hline \textbf{MNIST} & Classes & Accuracy & $\;1^{\mathrm{st}}$ neighbour & $\;2^{\mathrm{nd}}$ neighbour& $\;5^{\mathrm{th}}$ neighbour\\ \hline baseline & 10 & - & 10\% & 10\% & 10\%\\ ours & 10 & 72\% & 89\% & 84\% & 78\%\\ \hline \textbf{CIFAR10} & Classes & Accuracy & $\;1^{\mathrm{st}}$ neighbour & $\;2^{\mathrm{nd}}$ neighbour& $\;5^{\mathrm{th}}$ neighbour\\ \hline baseline & 10 & - & 10\% & 10\% & 10\%\\ ours & 10 & 68\% & 70\% & 68\% & 65\% \\ \hline \textbf{CelebA} & Classes & Accuracy & $\;1^{\mathrm{st}}$ neighbour & $\;2^{\mathrm{nd}}$ neighbour& $\;5^{\mathrm{th}}$ neighbour\\ \hline baseline & 2 & - & 50\% & 50\% & 50\%\\ ours (32) & 2 & 90\% & 88\% & 88\% & 86\%\\ ours (64) & 2 & 94\% & 95\% & 94\% & 93\%\\ \hline baseline & 5 & - & 20\% & 20\% & 20\%\\ ours (32) & 5 & 80\% & 90\% & 89\% & 87\%\\ ours (64) & 5 & 78\% & 96\% & 95\% & 92\%\\ \hline \end{tabular} \label{table:statistic} \end{table*} \begin{figure*}[t!] \begin{subfigure}{0.49\linewidth} \centering \includegraphics[width=\linewidth]{img/mnist_normal.pdf} \caption{Semi-clustered latent space.} \label{fig:mnist_normal} \end{subfigure} \begin{subfigure}{0.49\linewidth} \centering \includegraphics[width=\linewidth]{img/mnist_cluster.pdf} \caption{Full-clustered latent space.} \label{fig:mnist_cluster} \end{subfigure} \caption{t-SNE visualizations from two different latent spaces on MNIST. First row displays the classes and second row the accuracy from our approach.} \label{fig:mnist} \end{figure*} We run the evaluations on MNIST, CIFAR10 and CelebA datasets as in the previous section. However, in CelebA's case there are now two different set-ups. One based on gender (\textit{man} and \textit{woman}), and a second one based on hair (\textit{blond}, \textit{black}, \textit{brown}, \textit{gray} and \textit{bold}). In order to study the impact of the latent space structure, we need to determine how clustered our space is. Therefore, we compute a set of statistics (see Table \ref{table:statistic}) that are useful to estimate the initial conditions of the latent structure, and consequently find out the boundaries that our system might not overcome. For example, our model on CIFAR10 reports 70\% on $\;1^{\mathrm{st}}$ neighbour. This value indicates that if we take one random sample from our latent space, 70\% of the time its nearest neighbour will belong to the same class. Empirically, we observe the causal effect that the structure of latent space has on the accuracy results. The more clustered, i.e. higher neighbours scores, the better the accuracy. In other words, neighbourhood information helps to understand the upper-bounds fixed by the latent space. Fig. \ref{fig:mnist} compares two identical set-ups with different latent spaces. On the one hand, we have the semi-clustered space produced by an untrained AlexNet. This scenario achieves good accuracy scores despite the border effect. On the other hand, we have an extreme case with a fully-clustered space. As expected, all the scores are dramatically improved at the cost of having a perfect space. \subsection{Robustness of the Latent Space} In this section, we analyse how our approach behaves when we introduce noisy labels, and we compare it to CGAN performance. This analysis allows us to quantify how robust our system is. We start the experiments having a set-up free of noise.\footnote[4]{Notice that for this experiment we take a feature extractor and we train it from scratch each time that we change the percentage of noise.} Then, we gradually increase the amount of noise by introducing noisy labels. Fig. \ref{fig:cgan} shows the accuracy curves evolution for both cases. We observe how CGAN has almost a perfect lineal relationship between noise and accuracy. Every time that noise increases, the accuracy decreases in a similar proportion. This demonstrate the necessity of CGAN of labels to produce the desired output and the incapacity to deal with noise. Therefore, its robustness against noise very is limited. On the other hand, our approach shows a more robust behaviour. In this case, there is not lineal relationship, and the system is able to maintain the accuracy score independently of the level of noise. Only a notable decrease happens when the percentage of noisy labels surpasses the barrier of 90\%. \begin{figure}[t] \centering \includegraphics[width=\linewidth]{img/CGAN.pdf} \caption{Robustness evaluation on MNIST using accuracy curves.} \label{fig:cgan} \end{figure} \begin{figure*} \begin{subfigure}{0.49\linewidth} \centering \includegraphics[width=\linewidth]{img/training.pdf} \caption{Losses evolution.} \label{fig:cifar_loss} \end{subfigure} \begin{subfigure}{0.49\linewidth} \centering \includegraphics[width=\linewidth]{img/cifar_fid.pdf} \caption{FID evolution.} \label{fig:cifar_comp} \end{subfigure} \caption{Comparison between the baseline and our approach on CIFAR10.} \label{fig:cifar} \end{figure*} \begin{table*} \centering \caption{Quantitative results of the ablation study on CIFAR10.} \begin{tabular}{ccccccc} \hline & $\mathcal{L}_{\mathrm{minimax}}$ & $\mathcal{L}_{\mathrm{adv}}$ & $\mathcal{L}_{\mathrm{same}}$ & $\mathcal{L}_{\mathrm{diff}}$ & Convergence & Accuracy\\ \hline baseline & \checkmark & & & & \checkmark & 8\% \\ prototype A & & \checkmark & & & & - \\ prototype B & & \checkmark & \checkmark & & \checkmark & 58\%\\ prototype C & & \checkmark & & \checkmark & & -\\ ours & & \checkmark & \checkmark & \checkmark & \checkmark &68\%\\ \hline \end{tabular} \label{table:ablation} \end{table*} \subsection{Analysis of Triple Coupled Loss} The triple coupled loss is designed to exploit the structure of the latent space, so that the generative model learns how to produce samples on demand, i.e. based on the extracted features. Fig. \ref{fig:cifar} shows the itemized losses and FID learning curves for minimax loss (baseline) and for triple coupled loss (ours). We can confirm a similar behaviour between our model and the baseline, having as a side-effect an increase of convergence training time. In exchange for this delay, the proposed system has control over the outputs through the extracted features. \section{\uppercase{Ablation Study}} In this section, we quantitatively evaluate the impact of removing or replacing parts of the triple coupled loss. We do not only illustrate the benefits of the proposed loss compared to minimax loss, but also present a detailed evaluation of our approach. Table \ref{table:ablation} presents how the loss function behaves when we modify its components. First, we check whether the sub-optimal loss leads the system to convergence, i.e. it is able to generate realistic images. And second, for those functions that have the capacity of generating, we check their accuracy score. Notice that ideally we would achieve 100$\%$ which means producing the desired output all the time. Based on the empirical results from the previous table, we can see the importance of each term in the loss function. In particular, we observe how $\mathcal{L}_{\mathrm{same}}$ is essential to achieve convergence, and how the combination of all three terms brings the best result. \section{\uppercase{Conclusions}} Motivated by the desire to condition GANs without using label information, in this work, we propose an unsupervised framework that exploits the latent space structure to produce samples on demand. In order to be able to incorporate the features from the given space, we introduce a new loss function. Our experimental results show the effectiveness of the approach on different scenarios and its robustness against noisy labels. We believe the line of this work opens new avenues for feature research, trying to combined different unsupervised set-ups with GANs. We hope this approach can pave the way towards high quality, fully unsupervised, generative models. \bibliographystyle{apalike} {\small
{'timestamp': '2020-12-17T02:12:46', 'yymm': '2012', 'arxiv_id': '2012.08803', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08803'}
arxiv
\section{Introduction} The problem of recovering an unknown low-rank tensor from a small fraction of its entries is known as the tensor completion problem, and comes up in a wide range of applications, e.g., image processing \cite{imbiriba2018low, ng2017adaptive, zhang2021low}, computer vision \cite{liu2013, zhang2019corrected}, and machine learning \cite{romera2013multilinear, signoretto2014learning}. The goal of low-rank tensor completion is to recover a tensor with the lowest rank based on observable entries of a given tensor. Given a third-order tensor $\mathcal{M}\in\mathbb{C}^{n_1\times n_2\times n_3}$, the low rank tensor completion problem can be expressed as follows: \begin{equation} \label{n1} \begin{split} \min_{\mathcal{Z}}& ~ \operatorname{rank}(\mathcal{Z})\\ \text{s.t.}&~ \mathcal{P}_{\Omega}(\mathcal{Z})=\mathcal{P}_{\Omega}(\mathcal{M}), \end{split} \end{equation} where $\textup{rank}(\mathcal{Z})$ denotes the rank of the tensor $\mathcal{Z}$, $\Omega$ is a subset of $\{1,\ldots, n_1\}\times\{1,\dots,n_2\}\times\{1,\dots,n_3\}$, and $\mathcal{P}_\Omega$ is the projection operator such that the entries in $\Omega$ are given while the remaining entries are missing, i.e., \begin{align*}\label{p1} (\mathcal{P}_\Omega(\mathcal{Z}))_{ijk}= \left\{ \begin{array}{ll} \mathcal{Z}_{ijk}, & \mbox{if}\ (i,j,k)\in\Omega, \\ 0, &\mbox{otherwise}. \end{array} \right. \end{align*} In particular, if $n_{3}=1$, the tensor completion problem in (\ref{n1}) reduces to the well-known matrix completion problem, which has received a considerable amount of attention in the past decades, see, e.g., \cite{candes2010matrix,candes2009exact,candes2010the,gross2010,recht2010guaranteed} and references therein. In the matrix completion problem, a given incoherent $n\times n$ matrix could be recovered with high probability if the uniformly random sample size is of order $O(r n \log (n)),$ where $r$ is the rank of the given matrix. This bound has been shown to be optimal, see \cite{candes2010the} for detailed discussions. The main aim of this paper is to study the incoherence conditions of low-rank tensors based on the transformed tensor singular value decomposition (SVD) and provide a lower bound on the number of random sample entries required for exact tensor recovery. Different kinds of tensor ranks setting in model \eqref{n1} lead to different convex relaxation models and different sample sizes required to exactly recover the original tensor. When the rank in the model \eqref{n1} is chosen as the Tucker rank \cite{Tucker66}, Liu et al. \cite{liu2013} proposed to use the sum of the nuclear norms (SNN) of unfolding matrices of a tensor to recover a low Tucker rank tensor. Within the SNN framework, Tomioka et al. \cite{tomioka2011statistical} proved that a given $d$-order tensor $\mathcal{X}\in\mathbb{R}^{n\times\cdots\times n}$ with Tucker rank $(r,\ldots,r)$ can be exactly recovered with high probability if the Gaussian measurements size is of order $O(rn^{d-1})$. Afterwards, Mu et al. \cite{mu2014square} showed that $O(rn^{d-1})$ Gaussian measurements are necessary for a reliable recovery by the SNN method. In fact, the degree of freedoms of a tensor $\mathcal{X}\in \mathbb{R}^{n \times\cdots\times n}$ with Tucker rank $(r_{1},\ldots,r_{d})$ is $\prod_{i=1}^dr_i+\sum_{i=1}^{d}(r_{i}n -r_{i}^{2})$, which is much smaller than $O(rn^{d-1})$. Recently, Yuan et al. \cite{yuan2016tensor,yuan2017incoherent} showed that an $n\times n\times n$ tensor with Tucker rank $(r,r,r)$ can be exactly recovered with high probability by $O((r^{\frac{1}{2}}n^{\frac{3}{2}}+r^2n)\log^2(n))$ entries, which have a great improvement compared with the number of sampled sizes required in \cite{mu2014square} when $n$ is relatively large. Later, based on a gradient descent algorithm designed on some product smooth manifolds, Xia et al. \cite{Xia2019On} showed that an $n\times n\times n$ tensor with multi-linear rank $(r,r,r)$ can be reconstructed with high probability by $O(r^{\frac{7}{2}}n^{\frac{3}{2}}\log^{\frac{3}{2}}(n)+r^7n\log^6 (n))$ entries. When the rank in the model \eqref{n1} is chosen as the CANDECOMP/PARAFAC (CP) rank \cite{Kolda2009}, Mu et.al \cite{mu2014square} introduced a square deal method which only uses an individual nuclear norm of a balanced matrix instead of using a combination of all $d$ nuclear norms of unfolding matrices of the tensor. Moreover, they showed that $O(r^{\lfloor\frac{d}{2}\rfloor}n^{\lceil \frac{d}{2}\rceil })$ samples are sufficient to recover a CP rank $r$ tensor with high probability. Besides, some tensor estimation and recovery problems for the observations with Gaussian measurements were proposed and studied in the literature \cite{ahmed2020tensor, cai2020provable, luo2021low, rauhut2017low, tong2021scaling}. For example, Ahmed et al. \cite{ahmed2020tensor} proposed and studied the tensor regression problem by using low-rank and sparse Tucker decomposition, where a tensor variant of projected gradient descent was proposed and the sample complexity of this algorithm for a $d$-order tensor $n_1\times \cdots\times n_d$ with Tucker rank $(r_1,\ldots, r_d)$ is $O(\bar{r}^d+\bar{s}\bar{r}d\log^2(3\bar{n}d))$ under the restricted isometry property for sub-Gaussian linear maps. Here $\bar{r}=\max\{r_1,\ldots,r_d\}$ and $\bar{n}=\max\{n_1,\ldots, n_d\}$ and $\bar{s}=\max\{s_1,\ldots, s_d\}$, where $s_i$ is the upper bound of the number of nonzero entries of each column of the $i$-th factor matrix in the Tucker decomposition. Moreover, Cai et al. \cite{cai2020provable} showed that the Riemannian gradient algorithm can reconstruct a $d$-order tensor of size $n\times \cdots \times n$ and Tucker rank $(r, \ldots, r)$ with high probability from only $O(nr^2 + r^{d+1})$ measurements under the tensor restricted isometry property for Gaussian measurements, where one step of iterative hard thresholding was used for the initialization. The tubal rank of a third-order tensor was first proposed by Kilmer et al. \cite{kilmer,Kilmer2011}, which is based on tensor-tensor product (t-product). Within the associated algebraic framework of t-product, the tensor SVD was proposed and studied similarly to matrix SVD \cite{Kilmer2011}. For tensor tubal rank minimization, Zhang et al. \cite{Zhang2017} proved that the tensor tubal nuclear norm (TNN) can be used as a convex relaxation of the tensor tubal rank. Then they showed that an $n\times n\times n$ tensor with tubal rank $r$ can be exactly recovered by $O(rn^{2}\log(n^2))$ uniformly sampled entries. However, the TNN is not the convex envelope of the tubal rank of a tensor, which may lead to more sample entries needed to exactly recover the original tensor. In Table \ref{table1}, we summarize existing results and our contribution for the $n\times n\times n$ tensor completion problem. It is interesting that there are other factors that affect sample sizes requirement such as sampling methods and incoherence conditions. For detailed discussions, the interested readers are referred to \cite{barak2016noisy,jain2014provable,krishnamurthy2013low,montanari2018spectral}. \begin{table}[h!] \small \caption{Sampling sizes and sampling methods for third-order tensor completion.} \label{table1} \begin{center} \begin{tabular}{|c|c|c|c|} \hline Rank & Sampling & Incoherent and Other & Requirement \\ Assumption& Method &Conditions&Sampling Sizes\\\hline CP rank $r$ \cite{mu2014square}& Gaussian& N/A &$O(rn^{2})$ \\\hline \multirow{2}{*}{CP rank $r$ \cite{jain2014provable}}&Uniformly & Incoherent condition of & \multirow{2}{*}{$O(n^{\frac{3}{2}}r^{5}\log^4(n))$}\\ & Random&symmetric tensor & \\\hline Tucker rank \cite{yuan2017incoherent}&Uniformly& Matrix incoherent condition & \multirow{2}{*}{$O(rn^{\frac{3}{2}}+r^2n)\log^2(n)$} \\ $(r,r,r)$& Random &on model-$n$ unfolding & \\\hline Tucker rank \cite{huang2014provable}& \multirow{2}{*}{Random} & Matrix incoherent condition & \multirow{2}{*}{$O(rn^{2}\log^2(n))$}\\ $(r,r,r)$& &on model-$n$ unfolding & \\\hline Tucker rank \cite{mu2014square}& \multirow{2}{*}{Gaussian} & \multirow{2}{*}{N/A} & \multirow{2}{*}{$O(rn^{2})$} \\ $(r,r,r)$ & & & \\\hline Tucker rank \cite{Xia2019On}&Uniformly& Matrix incoherent condition & \multirow{2}{*}{$O(r^{\frac{7}{2}}n^{\frac{3}{2}}\log^{\frac{3}{2}}(n)+r^7n\log^6 (n))$} \\ $(r,r,r)$& Random &on model-$n$ unfolding & \\\hline \multirow{2}{*}{Tubal rank $r$ \cite{Zhang2017}}& Uniformly & \multirow{2}{*}{Tensor incoherent condition} & \multirow{2}{*}{$O(rn^{2}\log(n^2))$} \\ & Random & & \\\hline multi-rank $(r_{1},\ldots,r_{n})$ & Uniformly & \multirow{2}{*}{Tensor incoherent condition} & \multirow{2}{*}{$O(\sum_{i=1}^{n} r_{i}n\log(n^2))$} \\ (in this paper)& Random & & \\ \hline \end{tabular} \end{center} \end{table} In this paper, we mainly study the $n_1 \times n_2 \times n_3$ third-order tensor completion problem based on transformed tensor SVD and transformed tensor nuclear norm (TTNN) \cite{song2019robust}. We show that such low-rank tensors can be exactly recovered with high probability when the number of randomly observed entries is of order $O( \sum_{i=1}^{n_3}r_i \max \{ n_1, n_2 \} \log ( \max \{ n_1, n_2 \} n_3))$, where $r_i$ is the $i$-th element of the transformed multi-rank of a tensor. The rest of this paper is organized as follows. In Section \ref{Sect2}, the transformed tensor SVD related to an arbitrary unitary transformation is reviewed. In Section \ref{mainresults}, we provide the bound on the number of sample entries for tensor completion via any unitary transformation. In Section \ref{Sect4}, several synthetic data and imaging data sets are performed to demonstrate that our theoretical result is valid and the performance of the proposed method is better than the existing methods in terms of sample sizes requirement. Some concluding remarks are given in Section \ref{Sect5}. Finally, the proofs of auxiliary lemmas supporting our main theorem are provided in the appendix. \section{Transformed Tensor Singular Value Decomposition}\label{Sect2} First, some notations used throughout this paper are introduced. $\mathbb{N}_{\geq 0}^{n}$ denotes the nonnegative $n$-dimensional integers space. We use ${\bf \Phi}$ to denote an arbitrary unitary matrix, i.e., ${\bf \Phi} {\bf \Phi}^H = {\bf \Phi}^H {\bf \Phi} = I$, where ${\bf \Phi}^H$ is the conjugate transpose of ${\bf \Phi}$ and $I$ is the identity matrix whose dimension should be clear from the context. Tensors are represented by capital Euler script letters, e.g., $\mathcal{A}$. A tube of a third-order tensor is defined by fixing the first two indices and varying the third \cite{Kilmer2011}. Let $\mathcal{A}\in\mathbb{C}^{n_1\times n_2\times n_3}$ be a third-order tensor. $\mathcal{A}_{ijk}$ denotes the $(i,j,k)$-th entry of $\mathcal{A}$. We use $\hat{\mathcal{A}}_{{\bf \Phi}}$ to denote a third-order tensor obtained as follows: \begin{equation*} \textrm{vec}\left(\hat{\mathcal{A}}_{{\bf \Phi}}(i,j,:)\right)={{\bf \Phi}} \left(\textrm{vec}(\mathcal{A}(i,j,:))\right), \end{equation*} where $\textrm{vec}(\cdot)$ is the vectorization operator from $\mathbb{C}^{1\times1\times n_3}$ to $\mathbb{C}^{n_3}$ and $\mathcal{A}(i,j,:)$ denotes the $(i,j)$-th tube of $\mathcal{A}$. For simplicity, we denote $\hat{\mathcal{A}}_{{\bf \Phi}}={\bf \Phi}[\mathcal{A}]$. In the same fashion, one can also compute $\mathcal{A}$ from $\hat{\mathcal{A}}_{{\bf \Phi}}$, i.e., ${\cal A} = {\bf\Phi}^H[\hat{\mathcal{A}}_{{\bf \Phi}}]$. A block diagonal matrix can be derived by the frontal slices of ${\cal A}$ using the ``blockdiag'' operator: $$ \textrm{blockdiag}(\mathcal{\mathcal{A}}):= \left( \begin{array}{cccc} \mathcal{A}^{(1)} & & & \\ & \mathcal{A}^{(2)}& & \\ & & \ddots & \\ & & &\mathcal{A}^{(n_{3})}\\ \end{array} \right), $$ where $\mathcal{A}^{(i)}$ is the $i$-th frontal slice of ${\cal A},~i=1,\ldots,n_{3}$. Conversely, the block diagonal matrix $\textrm{blockdiag}(\mathcal{\mathcal{A}})$ can be converted into a tensor via the following ``fold'' operator: $$ \textrm{fold}(\textrm{blockdiag}(\mathcal{\mathcal{A}})) := \mathcal{\mathcal{A}}. $$ After introducing the tensor notation and terminology, we give the basic definitions about the tensor product, the conjugate transpose of a tensor, the identity tensor and the unitary tensor with respect to the unitary transformation matrix ${\bf \Phi}$, respectively. \begin{definition}\cite[Definition 1]{song2019robust} \label{def1} The ${\bf \Phi}$-product of $\mathcal{A} \in \mathbb{C}^{n_1 \times n_2 \times n_3}$ and $\mathcal{B} \in \mathbb{C}^{n_2 \times n_4 \times n_3}$ is a tensor $\mathcal{C} \in \mathbb{C}^{n_1 \times n_4 \times n_3}$, which is given by \begin{equation*} \mathcal{C} =\mathcal{A} \diamond_{\bf \Phi} \mathcal{B}={\bf \Phi}^{H}\left[ \emph{fold} \left( \emph{blockdiag}(\mathcal{\hat{A}}_{\bf \Phi}) \cdot \emph{blockdiag}(\mathcal{\hat{B}}_{\bf \Phi})\right) \right]. \end{equation*} \end{definition} \begin{remark} Kernfeld et al. \cite{kernfel} defined the tensor product between two tensors by using frontal slices products in the transformed domain based on an arbitrary invertible linear transformation. In this paper, we mainly focus on the tensor product based on unitary transformations. Moreover, the relation between ${\bf \Phi}$-product and tensor product by using fast Fourier transform (FFT) \cite{Kilmer2011} is shown in \cite{song2019robust}. \end{remark} \begin{definition}\cite[Definition 2]{song2019robust} \label{def2.5} For any $\mathcal{A}\in \mathbb{C}^{n_{1}\times n_{2}\times n_{3}}$, its conjugate transpose with respect to ${\bf \Phi}$, denoted by $\mathcal{A}^{H}\in \mathbb{C}^{n_{2}\times n_{1}\times n_{3}}$, is defined as \begin{equation*} \mathcal{A}^{H} = {\bf \Phi}^{H} \left [ \emph{fold} \left (\emph{blockdiag}(\mathcal{\hat{A}}_{\bf \Phi})^{H}\right )\right]. \end{equation*} \end{definition} \begin{definition} \cite[Proposition 4.1]{kernfel}\label{idd} The identity tensor $\mathcal{I}_{\bf \Phi} \in \mathbb{C}^{n \times n \times n_3}$ (with respect to ${\bf \Phi}$) is defined to be a tensor such that ${\cal I}_{\bf \Phi} = {\bf \Phi}^H [ {\cal T}]$, where each frontal slice of ${\cal T} \in \mathbb{R}^{n \times n \times n_3}$ is the $n \times n$ identity matrix. \end{definition} \begin{definition} \cite[Definition 5.1]{kernfel} A tensor $\mathcal{Q} \in \mathbb{C}^{n \times n \times n_3}$ is unitary with respect to ${\bf \Phi}$-product if it satisfies \begin{equation*} \mathcal{Q}^{H} \diamond_{{\bf \Phi}} \mathcal{Q} = \mathcal{Q} \diamond_{\bf \Phi} \mathcal{Q}^{H} =\mathcal{I}_{\bf \Phi}. \label{eq7} \end{equation*} \end{definition} In addition, $\mathcal{A}$ is a diagonal tensor if and only if each frontal slice $\mathcal{A}^{(i)}$ of $\mathcal{A}$ is a diagonal matrix. By above definitions, the transformed tensor SVD with respect to ${\bf \Phi}$ can be given as follows. \begin{theorem} \cite[Theorem 5.1]{kernfel}\label{them1} Suppose that $\mathcal{A}\in \mathbb{C}^{n_{1}\times n_{2}\times n_{3}}$. Then $\mathcal{A}$ can be factorized as \begin{equation} \label{equ12} \mathcal{A}= \mathcal{U} \diamond_{\bf \Phi} \mathcal{S} \diamond_{\bf \Phi} \mathcal{V}^{H}, \end{equation} where $\mathcal{U}\in \mathbb{C}^{n_{1}\times n_{1}\times n_{3}},$ $\mathcal{V}\in \mathbb{C}^{n_{2}\times n_{2}\times n_{3}}$ are unitary tensors with respect to ${\bf \Phi}$-product, and $\mathcal{S}\in \mathbb{C}^{n_{1}\times n_{2}\times n_{3}}$ is a diagonal tensor. \end{theorem} Based on the transformed tensor SVD given in Theorem \ref{them1}, the transformed multi-rank and tubal rank of a tensor can be defined as follows. \begin{definition}\cite[Definition 6]{song2019robust} (i) The transformed multi-rank of $\mathcal{A} \in \mathbb{C}^{n_1 \times n_2 \times n_3}$, denoted by $\operatorname{rank}_{t}(\mathcal{A})$, is a vector $\textup{\bf r} \in \mathbb{N}_{\geq 0}^{n_3}$ with its $i$-th entry being the rank of the $i$-th frontal slice of $\hat{\mathcal{A}}_{\bf \Phi}$, i.e., \begin{equation*} \operatorname{rank}_{t}(\mathcal{A}_{\bf \Phi})=\textup{\bf r}~~ \textup{with}~~r_i = \operatorname{rank}(\hat{\mathcal{A}}_{\bf \Phi}^{(i)}),~~i=1,\ldots,n_{3}. \end{equation*} (ii) The transformed tubal rank of $\mathcal{A} \in \mathbb{C}^{n_1 \times n_2 \times n_3}$, denoted by $\operatorname{rank}_{tt}(\mathcal{A})$, is defined as the number of nonzero singular tubes of $\mathcal{S}$, where $\mathcal{S}$ comes from the transformed tensor SVD of $\mathcal{A}$, i.e., \begin{equation} \operatorname{rank}_{tt}(\mathcal{A}) = \#\{i: \mathcal{S}(i, i, :) \neq \vct{0}\} = \max_{i} r_i. \label{eq9} \end{equation} \end{definition} \begin{remark} For computational improvement, we will use the skinny transformed tensor SVD throughout this paper unless otherwise stated, which is defined as follows: The skinny transformed tensor SVD of $\mathcal{A}\in \mathbb{C}^{n_{1}\times n_{2}\times n_{3}}$ with $\emph{rank}_{tt}(\mathcal{A})=r$ is given as $\mathcal{A}= \mathcal{U} \diamond_{\bf \Phi} \mathcal{S} \diamond_{\bf \Phi} \mathcal{V}^{H},$ where $\mathcal{U}\in \mathbb{C}^{n_{1}\times r\times n_{3}}$ and $\mathcal{V}\in \mathbb{C}^{n_{2}\times r\times n_{3}}$ satisfying $\mathcal{U}^H\diamond_{\bf \Phi}\mathcal{U}=\mathcal{I}_{\bf \Phi}, \mathcal{V}^H\diamond_{\bf \Phi}\mathcal{V}=\mathcal{I}_{\bf \Phi}$, and $\mathcal{S}\in \mathbb{C}^{r\times r\times n_{3}}$ is a diagonal tensor. Here $\mathcal{I}_{\bf \Phi}\in\mathbb{C}^{r\times r\times n_3}$ is the identity tensor. \end{remark} The inner product of two tensors $\mathcal{A},\mathcal{B}\in\mathbb{C}^{n_1\times n_2\times n_3}$ related to the unitary transformation ${\bf \Phi}$ is defined as \begin{equation} \label{tprod} \langle\mathcal{A}, \mathcal{B} \rangle = \sum_{i=1}^{n_{3}}\langle \mathcal{A}^{(i)}, \mathcal{B}^{(i)} \rangle =\langle \overline{\mathcal{A}}_{\bf \Phi}, \overline{\mathcal{B}}_{\bf \Phi} \rangle, \end{equation} where $\langle \mathcal{A}^{(i)}, \mathcal{B}^{(i)} \rangle$ is the usual inner product of two matrices and $\overline{\mathcal{A}}_{\bf \Phi}=\textrm{blockdiag}(\mathcal{A}_{\bf \Phi})$. The following fact will be used throughout the paper: For any tensor $\mathcal{A}\in \mathbb{C}^{n_{1}\times n_{2}\times n_3}$ and $\mathcal{B}\in \mathbb{C}^{n_{2}\times n_{4}\times n_3},$ one can get that $\mathcal{A}\diamond_{\bf \Phi}\mathcal{B}=\mathcal{C}\Leftrightarrow \overline{\mathcal{A}}_{\bf \Phi}\cdot\overline{\mathcal{B}}_{\bf \Phi}=\overline{\mathcal{C}}_{\bf \Phi}.$ The tensor spectral norm of an arbitrary tensor $\mathcal{A}\in \mathbb{C}^{n_1 \times n_2 \times n_3}$ related to ${\bf \Phi}$, denoted by $\|\mathcal{A}\|$, can be defined as $\|\mathcal{A}\| = \|\overline{\mathcal{A}}_{\bf \Phi}\|$ \cite{song2019robust}, i.e., the spectral norm of its block diagonal matrix $\overline{\mathcal{A}}_{\bf \Phi}$ in the transformed domain. Suppose that ${\tt L}$ is a tensor operator, its operator norm is defined as $\|{\tt L}\|_{\textup{op}} = \sup_{\|\mathcal{A}\|_F \leq 1} \|{\tt L}(\mathcal{A})\|_F,$ where the tensor Frobenius norm of $\mathcal{A}$ is defined as $\|\mathcal{A}\|_{F} = \sqrt{\sum_{i,j,k}|\mathcal{A}_{ijk}|^2}$. Specifically, if the operator norm can be represented as a tensor $\mathcal{L}$ via ${\bf \Phi}$-product with $\mathcal{A}$, we have $\| {\tt L}\|_{\textup{op}} = \|\mathcal {L}\|$. The tensor infinity norm and the tensor $l_{\infty,2}$ and are defined as \[ \begin{split} &\|\mathcal{A}\|_{\infty} = \max_{i,j,k}|\mathcal{A}_{ijk}| ~ \textup{and} ~ \|\mathcal{A}\|_{\infty,2}=\max\left\{\max_{i}\sqrt{\sum_{b,k}|\mathcal{A}_{ibk}|^2},\max_{j}\sqrt{\sum_{a,k}|\mathcal{A}_{ajk}|^2} \right\}. \end{split} \] Moreover, the weighted tensor $l_{\infty,w}$ norm with respect to a weighted vector $w=(\alpha_1,\ldots,\alpha_{n_3})^H\in\mathbb{R}^{n_3}$ is defined as \begin{equation}\label{norm1} \|\mathcal{A}\|_{\infty, w}=\max\left\{\max_{i}\sqrt{\sum_{b,k}\alpha^2_{k}|\mathcal{A}_{ibk}|^2},\max_{j}\sqrt{\sum_{a,k} \alpha^2_{k}|\mathcal{A}_{ajk}|^2} \right\}, \end{equation} where $\sum_{k=1}^{n_3}\alpha^2_{k}=1$. The aim of this paper is to recover a low transformed multi-rank tensor, which motivates us to introduce the following definition of TTNN. \begin{definition}\cite[Definition 7]{song2019robust} The transformed tensor nuclear norm of $\mathcal{A} \in \mathbb{C}^{n_1 \times n_2 \times n_3}$, denoted by $\|\mathcal{A}\|_{\textup{TTNN}}$, is the sum of nuclear norms of all frontal slices of $\hat{\mathcal{A}}_{\bf \Phi}$, i.e., $\|\mathcal{A}\|_{\textup{TTNN}} = \sum_{i=1}^{n_3} \|{\hat{\mathcal{A}}}^{(i)}_{\bf \Phi}\|_{\ast}$. \label{def9} \end{definition} Recently, Song et al. \cite{song2019robust} showed that the TTNN of a tensor is the convex envelope of the sum of the entries of the transformed multi-rank of a tensor, which is stated in the following. \begin{lemma}\cite[Lemma 1]{song2019robust}\label{lemm1} For any tensor $\mathcal{A} \in \mathbb{C}^{n_1 \times n_2 \times n_3}$, let $\operatorname{rank}_{sum}(\mathcal{A})=\sum_{i=1}^{n_3} \operatorname{rank}(\hat{\mathcal{A}}^{(i)}_{\bf \Phi})$. Then $\|\mathcal{A}\|_{\textup{TTNN}}$ is the convex envelope of $\operatorname{rank}_{sum}(\mathcal{A})$ on the set $\{ \mathcal{A} \ | \ \| \mathcal{A}\| \leq 1\}$. \end{lemma} Lemma \ref{lemm1} shows that the TTNN is the tightest convex relaxation of the sum of the entries of the transformed multi-rank of the tensor over a unit ball of the tensor spectral norm. That is why the TTNN is effective in studying the tensor recovery theory with transformed multi-rank minimization. Next we introduce two kinds of tensor basis which will be exploited to derive our main result. \begin{definition} \label{defn} (i) The column basis, denoted as $\tc{e}_{ik}$, is a tensor of size $n_1 \times 1 \times n_3$ with the $(i,1,k)$-th element equaling to $1$ and the others equaling to 0. (ii) Denote $\tub{e}_{k}$ as a tensor of size $1 \times 1 \times n_3$ with the $(1,1,k)$-th element equaling to $1$ and the remaining elements equaling to 0, $({\bf \Phi}[\tub{e}_{k}])_{j}$ as the $(1,1,j)$-th element of ${\bf \Phi}[\tub{e}_{k}]$, $j=1,\ldots,n_{3}$. (iii) The transformed tube basis, denoted as $\ddot{\textbf{e}}_k$, is a tensor of size $1 \times 1 \times n_3$ with the $(1,1,j)$-th element of $\ddot{\textbf{e}}_k$ equaling to $(({\bf \Phi}[\tub{e}_{k}])_{j})^{-1},$ if $({\bf \Phi}[\tub{e}_{k}])_{j}\neq0,$ and $0$, otherwise, $j=1,\ldots, n_3$. \end{definition} \begin{remark} The transformed tube basis $\ddot{\textbf{e}}_k$ is determined by the unitary transformation matrix and the original tube $\tub{e}_{k}$, whose detailed formulation can be obtained for a given unitary transformation ${\bf \Phi}$. \end{remark} \section{Main Results} \label{mainresults} In this section, we consider the third-order tensor completion problem, which aims to recover a low transformed multi-rank tensor under some limited observations. Mathematically, the problem can be described as follows: \begin{equation*} \label{nj1} \begin{split} \min_{\mathcal{Z}}& ~ \sum_{i=1}^{n_3}\operatorname{rank}(\hat{\mathcal{Z}}_{\bf \Phi}^{(i)}) \\ \text{s.t.}&~ \mathcal{P}_{\Omega}(\mathcal{Z})=\mathcal{P}_{\Omega}(\mathcal{M}), \end{split} \end{equation*} where $\operatorname{rank}(\hat{\mathcal{Z}}_{\bf \Phi}^{(i)})$ is the rank of $\hat{\mathcal{Z}}_{\bf \Phi}^{(i)}$, i.e., the $i$-th element of the transformed multi-rank of $\mathcal{Z}, i=1,\ldots, n_3$, $\Omega$ and $\mathcal{P}_{\Omega}(\mathcal{Z})$ are defined in model \eqref{n1}. Note that the rank minimization problem is NP-hard and the TTNN is the convex envelope of the sum of the entries of the transformed multi-rank of a tensor \cite[Lemma 1]{song2019robust}. Therefore, we propose to utilize the TTNN as a convex relaxation of the sum of the entries of the transformed multi-rank of a tensor. More precisely speaking, the convex relaxation model is given by \begin{equation}\label{ObjFT} \begin{split} \min_{\mathcal{Z}} & \ \|\mathcal{Z}\|_{\textup{TTNN}} \\ \textup{s.t.} & \ \mathcal{P}_\Omega(\mathcal{Z}) = \mathcal{P}_\Omega(\mathcal{M}). \end{split} \end{equation} In the following, we need to introduce the tensor incoherence conditions between the underlying tensor $\mathcal{Z}$ and the column basis given in Definition \ref{defn}. \begin{definition} Let $\mathcal{Z} \in \mathbb{C}^{n_{1}\times n_{2}\times n_{3}}$ with $\operatorname{rank}_{t}(\mathcal{Z})= \textup{\bf r}$, where $\textup{\bf r}=(r_1,\ldots, r_{n_3})$. Assume its skinny transformed tensor SVD is $\mathcal{Z} = \mathcal{U} \diamond_{\bf \Phi} \mathcal{S} \diamond_{\bf \Phi} \mathcal{V}^{H}$. Then $\mathcal{Z}$ is said to satisfy the tensor incoherence conditions, if there exists a parameter $\mu\geq 1$, such that \begin{align} \max_{i=1, \ldots, n_1}\max_{k=1, \ldots, n_3} \|\mathcal{U}^{H} \diamond_{\bf \Phi} \tc{e}_{ik}\|_F \leq \sqrt{\frac{\mu \sum_{i=1}^{n_3} {r_{i}} }{n_1n_{3}}}, \label{eq16}\\ \max_{j=1, \ldots, n_2} \max_{k=1, \ldots, n_3}\|\mathcal{V}^{H} \diamond_{\bf \Phi} \tc{e}_{jk}\|_F\leq \sqrt{\frac{\mu \sum_{i=1}^{n_3}{r_{i}}}{n_2n_{3}}}, \label{eq17} \end{align}\label{def13} where $\tc{e}_{ik}\in\mathbb{R}^{n_1\times 1\times n_3}$ and $\tc{e}_{jk}\in\mathbb{R}^{n_2\times 1\times n_3}$ are the column basis. \end{definition} Denote by $T$ the linear space of tensors \begin{equation} T = \big\{\mathcal{U}\diamond_{\bf \Phi}\mathcal{Y}^{H} + \mathcal{W}\diamond_{\bf \Phi} \mathcal{V}^{H} ~|~ \mathcal{Y} \in \mathbb{C}^{n_2 \times r \times n_3},~\mathcal{W} \in \mathbb{C}^{n_1 \times r \times n_3} \big\}, \label{e1} \end{equation} and by $T^{\perp}$ its orthogonal complement, where $\mathcal{U}\in \mathbb{C}^{n_{1}\times r\times n_{3}}$ and $\mathcal{V}\in \mathbb{C}^{n_{2}\times r\times n_{3}}$ are column unitary tensors, respectively, i.e., $\mathcal{U}^H\diamond_{\bf \Phi}\mathcal{U}=\mathcal{I}_{\bf \Phi}, \mathcal{V}^H\diamond_{\bf \Phi}\mathcal{V}=\mathcal{I}_{\bf \Phi}$. In the light of \cite[Proposition B.1]{zhang2019corrected}, for any $\mathcal{Z}\in\mathbb{C}^{n_1\times n_2\times n_3}$, the orthogonal projections onto $T$ and its complementary are given as follows: \[ \begin{split} &\mathcal{P}_{T}(\mathcal{Z}) = \mathcal{U}\diamond_{\bf \Phi} \mathcal{U}^{H}\diamond_{\bf \Phi} \mathcal{Z} +\mathcal{Z}\diamond_{\bf \Phi} \mathcal{V}\diamond_{\bf \Phi} \mathcal{V}^{H} - \mathcal{U}\diamond_{\bf \Phi} \mathcal{U}^{H}\diamond_{\bf \Phi} \mathcal{Z}\diamond_{\bf \Phi} \mathcal{V}\diamond_{\bf \Phi} \mathcal{V}^{H}, \\ &\mathcal{P}_{T^{\perp}}(\mathcal{Z}) = (\mathcal{I}_{\bf \Phi} - \mathcal{U}\diamond_{\bf \Phi} \mathcal{U}^{H})\diamond_{\bf \Phi} \mathcal{Z}\diamond_{\bf \Phi} (\mathcal{I}_{\bf \Phi} - \mathcal{V}\diamond_{\bf \Phi} \mathcal{V}^{H}). \end{split} \] Denote $n_{(1)}=\max\{n_{1},n_{2}\},n_{(2)}=\min\{n_{1},n_{2}\}.$ We can improve the low bound on the number of sampling sizes for tensor completion by using transformed multi-rank instead of using tubal rank, which is stated in the following theorem. \begin{theorem}\label{Theorem1} Suppose that $\mathcal{Z} \in \mathbb{C}^{n_1 \times n_2 \times n_3}$ with $\operatorname{rank}_{t}(\mathcal{Z})= \textup{\bf r}$ and its skinny transformed tensor SVD is $\mathcal{Z} = \mathcal{U} \diamond_{\bf \Phi} \mathcal{S} \diamond_{\bf \Phi} \mathcal{V}^{H}$, where $\textup{\bf r}=(r_1,\ldots, r_{n_3})$, $\mathcal{U}\in \mathbb{C}^{n_{1}\times r\times n_{3}},$ $\mathcal{S}\in \mathbb{C}^{r\times r\times n_{3}}$ and $\mathcal{V}\in \mathbb{C}^{n_{2}\times r\times n_{3}}$ with $\operatorname{rank}_{tt}(\mathcal{Z})=r$. Suppose that $\mathcal{Z}$ satisfies the tensor incoherence conditions \eqref{eq16}-\eqref{eq17} and the observation set $\Omega$ with $|\Omega|=m$ is uniformly distributed among all sets of cardinality, then there exist universal constants $c_0, c_1, c_2 > 0$ such that if \begin{align}\label{new1} m\geq c_0 \mu\sum_{i=1}^{n_{3}}{r_{i}}n_{(1)}\log(n_{(1)}n_3), \end{align} $\mathcal{Z}$ is the unique minimizer to $\eqref{ObjFT}$ with probability at least $1- c_1(n_{(1)}n_3)^{-c_2} $. \end{theorem} Next we compare the number of sample sizes requirement for exact recovery in \cite{Zhang2017}. Note that the tensor incoherence conditions in \cite{Zhang2017} are given by \begin{align*} &\max_{i=1, \dots, n_1} \|\mathcal{U}^{H} \diamond_{\bf \Phi} \tc{e}_{i1}\|_F \leq \sqrt{\frac{\mu_{old} r}{n_1}},\\ & \max_{j=1, \dots, n_2} \|\mathcal{V}^{H} \diamond_{\bf \Phi} \tc{e}_{j1}\|_F\leq \sqrt{\frac{\mu_{old} r}{n_2}}, \end{align*} where $r$ is the tubal rank of the underlying tensor, $\mu_{old}>0$ is a parameter, ${\bf \Phi}$ is FFT, $\tc{e}_{i1}$ and $\tc{e}_{j1}$ are defined in Definition \ref{defn}. When the number of samples is larger than or equal to $\widetilde{c}rn_{(1)}n_3\log(n_{(1)}n_3)$, the underlying tensor can be recovered exactly \cite{Zhang2017}, where $\widetilde{c}>0$ is a given constant. Neglecting the constants, we know that the bound of sample sizes requirement in Theorem \ref{Theorem1} is smaller than that of \cite{Zhang2017} since $\sum_{i=1}^{n_3}r_i$ is smaller than $rn_3$ in general. Especially, when the the vector of the transformed multi-rank ${\bf r}$ is sparse, the number of sample sizes requirement given in \eqref{new1} is much smaller than that in \cite{Zhang2017} for exact recovery. Moreover, the exact recovery theory in Theorem \ref{Theorem1} not only holds for FFT but also for any unitary transformation, which is very meaningful in practical applications. Based on Theorem \ref{Theorem1}, for a given data tensor, we can choose a suitable unitary transformation such that the sum of elements of the transformed multi-rank of the underlying tensor is small \cite{song2019robust, zhang2021low}, which can guarantee to derive better results than that by using FFT directly. To facilitate our proof of the main theorem, we will consider the independent and identically distributed \textit{(i.i.d.) Bernoulli-Rademacher model}. More precisely, we assume $\Omega = \{(i, j, k) \ | \ \delta_{ijk} = 1\}$, where $\delta_{ijk}$ are i.i.d. Bernoulli variables taking value one with probability $\rho = \frac{m}{n_1n_2n_3}$ and zero with probability $1-\rho$. Such a Bernoulli sampling is denoted by $\Omega \sim \textup{Ber}(\rho)$ for short. As a proxy for uniform sampling, the probability of failure under Bernoulli sampling closely approximates the probability of failure under uniform sampling. Recall the definitions of tensor Frobenius norm and the tensor incoherence conditions given in (\ref{eq16})-(\ref{eq17}), we can get the following result easily. \begin{proposition} \label{pro1} Let $\mathcal{Z} \in \mathbb{C}^{n_1 \times n_2 \times n_3}$ be an arbitrary tensor with $\operatorname{rank}_{t}(\mathcal{Z})= \textup{\bf r}$, and $T$ be given as (\ref{e1}). Suppose that the tensor incoherence conditions (\ref{eq16})-(\ref{eq17}) are satisfied, then $$\|\mathcal{P}_{T}( \tc{e}_{ik}\diamond_{\bf \Phi} \ddot{\textbf{e}}_k \diamond_{\bf \Phi} \tc{e}_{jk}^H)\|^{2}_{\textrm{F}}\leq \frac{2\mu\sum_{i=1}^{n_3} {r_{i}}}{n_{(2)}n_{3}}.$$ \end{proposition} Proposition \ref{pro1} plays an important role in the proofs of Lemmas \ref{le1}, \ref{lemma2} and \ref{le3}, which can be found in the Appendix. \begin{lemma} \label{le1} Suppose that $\Omega \sim \textup{Ber}(\rho),$ where $\Omega$ with $|\Omega|=m$ is a set of indices sampled independently and uniformly without replacement, $\rho=\frac{m}{n_{1}n_{2}n_{3}}$ and $T$ is given as (\ref{e1}). Then with high probability, \begin{align} \label{11} \|\rho^{-1}\mathcal{P}_{T}\mathcal{P}_{\Omega}\mathcal{P}_{T}-\mathcal{P}_{T}\|_\textup{op}\leq \epsilon, \end{align} provided that $m\geq C_0\epsilon^{-2} \mu \sum_{i=1}^{n_3}{r_{i}}n_{(1)} \log(n_{(1)}n_3) $ for some numerical constant $C_0 > 0$. \end{lemma} \begin{lemma}\label{lemma2} Suppose that $\mathcal{Z} \in \mathbb{C}^{n_1 \times n_2 \times n_3}$ is a tensor with $\operatorname{rank}_{t}(\mathcal{Z})= \textup{\bf r}$, $\Omega, \rho$ and $m$ are defined in Lemma \ref{le1}. Then for all $c>1$ and $C_{0}>0$, \begin{equation*} \|(\rho^{-1}\mathcal{P}_{\Omega}-\mathcal{I})\mathcal{Z}\| \leq c\left(\frac{\log (n_{(1)}n_{3})}{\rho}\|\mathcal{Z}\|_{\infty}+\sqrt{\frac{\log (n_{(1)}n_{3})}{\rho}}\|\mathcal{Z}\|_{\infty,w}\right) \label{eq25} \end{equation*} holds with high probability provided that $m\geq C_0 \epsilon^{-2} \mu \sum_{i=1}^{n_3}{r_{i}}n_{(1)}\log(n_{(1)}n_3),$ where $\mathcal{I}$ denotes the identity operator. \end{lemma} \begin{lemma}\label{le3} Suppose that $\mathcal{Z} \in \mathbb{C}^{n_1 \times n_2 \times n_3}$ is a tensor with $\operatorname{rank}_{t}(\mathcal{Z})= \textup{\bf r}$, $\Omega, \rho$ and $m$ are defined in Lemma \ref{le1}. Then for some sufficiently large $C_{0}$, \begin{equation} \|(\rho^{-1}\mathcal{P}_{T}\mathcal{P}_{\Omega}-\mathcal{P}_{T})\mathcal{Z}\|_{\infty,w}\leq\frac{1}{2}\sqrt{\frac{n_{(1)}n_{3}}{\mu\sum_{i=1}^{n_{3}}r_{i}}}\|\mathcal{Z}\|_{\infty} +\frac{1}{2}\|\mathcal{Z}\|_{\infty,w} \end{equation} holds with high probability provided that $m\geq C_0 \epsilon^{-2} \mu \sum_{i=1}^{n_3}{r_{i}}n_{(1)}\log(n_{(1)}n_3).$ \end{lemma} The proofs of the three lemmas are left to the appendix. Lemma \ref{lemma2} establishes an upper bound of the tensor spectral norm of $(\rho^{-1}\mathcal{P}_{\Omega}-\mathcal{I})\mathcal{Z}$ in terms of $\|\mathcal{Z}\|_{\infty}$ and $\|\mathcal{Z}\|_{\infty,w},$ which is tighter than the existing result given by $\|\mathcal{Z}\|_{\infty}$ and $\|\mathcal{Z}\|_{\infty,2}$. The weights in $\|\mathcal{Z}\|_{\infty,w}$ are determined by the unitary transformation, which guarantee the upper bound of $\|(\rho^{-1}\mathcal{P}_{\Omega}-\mathcal{I})\mathcal{Z}\|$ to be smaller. Lemma \ref{le3} shows that the $l_{{\infty,w}}$ norm of $(\rho^{-1}\mathcal{P}_{T}\mathcal{P}_{\Omega}-\mathcal{P}_{T})\mathcal{Z}$ can be dominated by $\|\mathcal{Z}\|_{\infty,w}$ and $\|\mathcal{Z}\|_{\infty}$. Moreover, Lemmas C1 and C2 in \cite{Zhang2017} can be seen as special cases of Lemmas \ref{lemma2} and \ref{le3}, respectively, if the transformation is chosen as FFT. \begin{lemma}\cite[Lemma 4.1]{Zhang2017}\label{4.7} Suppose that $\|\rho^{-1}{\cal P}_T{\cal P}_{\Omega}{\cal P}_T - {\cal P}_T\|_\textup{op}\leq \frac{1}{2}.$ Then for any $\mathcal{Z}\in\mathbb{C}^{n_1\times n_2\times n_3 }$ such that $\mathcal{P}_{\Omega}(\mathcal{Z})=0,$ the following inequality \begin{equation*} \frac{1}{2}\|\mathcal{P}_{T^{\bot}}(\mathcal{Z})\|_{\emph{TTNN}}>\frac{1}{4n_{(1)}n_{3}}\|\mathcal{P}_{T}(\mathcal{Z})\|_{F} \end{equation*} holds with high probability. \end{lemma} With the tools in hand we can list the proof of Theorem \ref{Theorem1} in detail. \vspace{2mm} \noindent {\bf Proof of Theorem \ref{Theorem1}}. The high level road map of the proof is a standard one just as shown in \cite{candes2011robust}: by convex analysis, to show $\mathcal{Z}$ is the unique optimal solution to the problem $\eqref{ObjFT}$, it is sufficient to find a dual certificate $\mathcal{Y}$ satisfying several subgradient type conditions. In our case, we need to find a tensor $\mathcal{Y}=\mathcal{P}_{\Omega}(\mathcal{Y})$ such that \begin{align} & \|\mathcal{P}_{T}(\mathcal{Y})-\mathcal{U}\diamond_{\bf \Phi}\mathcal{V}^{H}\|_{F}\leq \frac{1}{4n_{(1)}n_{3}^{2}}, \label{cd1}\\ & \|\mathcal{P}_{T^{\bot}}(\mathcal{Y})\|\leq\frac{1}{2}.\label{cd2} \end{align} It follows from \eqref{cd2} that we need to estimate the tensor spectral norm $\|\mathcal{P}_{T^{\bot}}(\mathcal{Y})\|$. Similar to matrix cases \cite{candes2011robust}, we can use the tensor infinite norm to establish the upper bound of $\|\mathcal{P}_{T^{\bot}}(\mathcal{Y})\|$. However, if $\|\mathcal{Y}\|_{\infty}$ is applied, then it will ultimately link to $\|\mathcal{U}\diamond_{\bf \Phi}\mathcal{V}^H\|_{\infty}$ and lead to the joint incoherence condition. In order to avoid applying the joint incoherence condition, $\|\mathcal{Y}\|_{\infty,2}$ is used in \cite{chen2015incoherence} and \cite{Zhang2017} to compute the upper bound of $\|\mathcal{Y}\|$ for the matrix and tensor cases, respectively. It follows from \cite{chen2015incoherence} and \cite{Zhang2017} that a lower upper bound can be derived by using $\|\mathcal{Y}\|_{\infty,2}$. However, the upper bound derived by $\|\mathcal{Y}\|_{\infty,2}$ can be relaxed further for an arbitrary unitary transformation. Here, we derive a new upper bound of $\|\mathcal{P}_{T^{\bot}}(\mathcal{Y})\|$ by using the $l_{\infty,w}$ norm $\|\mathcal{Y}\|_{\infty,w}$ as defined in \eqref{norm1}. Note that $\|\mathcal{Y}\|_{\infty,w}$ is not larger than $\|\mathcal{Y}\|_{\infty,2}$ for any tensor $\mathcal{Y},$ which leads to a tighter upper bound of $\|\mathcal{Y}\|$. We now return to the proof Theorem \ref{Theorem1} in detail. We apply the Golfing Scheme method introduced by Gross \cite{gross2010} and modified by Cand\`{e}s et al. \cite{candes2011robust} to construct a dual tensor $\mathcal{Y}$ supported by $\Omega^c$ iteratively. Similar to the proof of \cite[Theorem 3.1]{Zhang2017}, we consider the set $\Omega^c\sim \textup{Ber}(1-\rho)$ as a union of sets of support $\Omega_j$, i.e., $\Omega^c = \bigcup_{j=1}^p \Omega_j$, where $\Omega_j \sim \textup{Ber}(q),$ which implies $q \geq C_0\rho/\log(n_{(1)}n_3)$. Hence we have $ \rho = (1 - q)^{p},$ where $p = \lfloor 5\log(n_{(1)}n_3) + 1\rfloor$. Denote \begin{equation}\label{s1} \mathcal{Y}= \sum_{j=1}^p \frac{1}{q}\mathcal{P}_{\Omega_j}(\mathcal{Z}_{j-1}), ~\text{with}~\mathcal{Z}_{j} = \Big(\mathcal{P}_{T} - \frac{1}{q}\mathcal{P}_{T} \mathcal{P}_{\Omega_j}\mathcal{P}_{T}\Big)\mathcal{Z}_{j-1},~ \mathcal{Z}_0 = \mathcal{P}_{T}(\mathcal{U} \diamond_{\bf \Phi} \mathcal{V}^{H} ). \end{equation} In the following we will show that $\mathcal{Y}$ defined in \eqref{s1} satisfies the conditions \eqref{cd1} and \eqref{cd2}. For \eqref{cd1}. Set $\mathcal{D}_{k}:=\mathcal{U}\diamond_{\bf \Phi}\mathcal{V}^{H}-\mathcal{P}_{T}(\mathcal{Z}_{k})$ for $k=0,\ldots,p$. By the definition of $\mathcal{Z}_{k}$, we have $\mathcal{D}_{0}=\mathcal{U}\diamond_{\bf \Phi}\mathcal{V}^{H}$ and \begin{equation}\label{eqn1} \mathcal{D}_{k}=(\mathcal{P}_{T}-\mathcal{P}_{T}\mathcal{P}_{\Omega}\mathcal{P}_{T})\mathcal{D}_{k-1}, \ k=1,\ldots, p. \end{equation} Note that $\Omega_{k}$ is independent of $\mathcal{D}_{k-1}$ and $q\geq c_{0}\mu\sum r_{i}\log(n_{(1)}n_{3})/(n_{(1)}n_{3}).$ For each $k,$ replacing $\Omega$ by $\Omega_{k},$ then by Lemma \ref{le1}, we have \begin{equation*} \|\mathcal{D}_{k}\|_{{F}}\leq \|\mathcal{P}_{T}-\mathcal{P}_{T}\mathcal{P}_{\Omega_{k}}\mathcal{P}_{T}\|\|\mathcal{D}_{k-1}\|_{{F}}\leq \frac{1}{2}\|\mathcal{D}_{k-1}\|_{F}. \end{equation*} As a consequence, one can obtain that \begin{align*} \|\mathcal{P}_{T}(\mathcal{Y})-\mathcal{U}\diamond_{\bf \Phi} \mathcal{V}^{H}\|_{{F}}=\|\mathcal{D}_{p}\|_{{F}}\leq \left(\frac{1}{2}\right) ^{p}\|\mathcal{U}\diamond_{\bf \Phi} \mathcal{V}^{H}\|_{{F}}\leq\frac{1}{4(n_{(1)}n_{3})^{2}}\sqrt{r} \leq \frac{1}{4n_{(1)}n_{3}^2}. \end{align*} For \eqref{cd2}. Note that $\mathcal{Y}=\sum_{k=1}^{p}\mathcal{P}_{\Omega_{k}}\mathcal{P}_{T}(\mathcal{D}_{k-1}),$ thus \begin{align}\label{17py} \|\mathcal{P}_{T^{\bot}}(\mathcal{Y})\|\leq \sum_{k=1}^{p}\|\mathcal{P}_{T^{\bot}}(\mathcal{P}_{\Omega_{k}}\mathcal{P}_{T}-\mathcal{P}_{T})(\mathcal{D}_{k-1})\| \leq \sum_{k=1}^{p}\|(\mathcal{P}_{\Omega_{k}}-\mathcal{I})\mathcal{P}_{T}(\mathcal{D}_{k-1})\|. \end{align} Applying Lemma \ref{lemma2} with $\Omega$ replaced by $\Omega_{k}$ to each summand of (\ref{17py}) yields \begin{align} \|\mathcal{P}_{T^{\bot}}(\mathcal{Y})\|&\leq c \sum_{k=1}^{p}\Biggl(\frac{\log (n_{(1)}n_{3})}{q}\|\mathcal{D}_{k-1}\|_{\infty}+\sqrt{\frac{\log (n_{(1)}n_{3})}{q}}\|\mathcal{D}_{k-1}\|_{\infty,w}\Biggl)\nonumber\\ &\leq \frac{c}{\sqrt{c_{0}}} \sum_{k=1}^{p}\Biggl(\frac{ n_{(1)}n_{3}}{\mu\sum r_{i}}\|\mathcal{D}_{k-1}\|_{\infty}+\sqrt{\frac{ n_{(1)}n_{3}}{\mu\sum r_{i}}}\|\mathcal{D}_{k-1}\|_{\infty,w}\Biggl).\label{eq4} \end{align} Using \eqref{eqn1}, and applying Lemma \ref{le1} with $\Omega$ replaced by $\Omega_{k},$ we can get \begin{align*} \|\mathcal{D}_{k-1}\|_{\infty}=\|(\mathcal{P}_{T^{\bot}}(\mathcal{P}_{\Omega_{k-1}}\mathcal{P}_{T}-\mathcal{P}_{T})\cdots \mathcal{P}_{T^{\bot}}(\mathcal{P}_{\Omega_{1}}\mathcal{P}_{T}-\mathcal{P}_{T}))\mathcal{D}_{0}\|_{\infty}\leq \frac{1}{2^{k}}\|\mathcal{U}\diamond_{\bf \Phi} \mathcal{V}^{H}\|_{\infty}. \end{align*} It follows from Lemma \ref{le3} that \begin{align*} \|\mathcal{D}_{k-1}\|_{\infty,w}=\|(\mathcal{P}_{T}-\mathcal{P}_{T}\mathcal{P}_{\Omega_{k-1}}\mathcal{P}_{T})\mathcal{D}_{k-2}\|_{\infty,w} \leq\frac{1}{2}\sqrt{\frac{n_{(1)}n_{3}}{\mu\sum r_{i}}}\|\mathcal{D}_{k-2}\|_{\infty}+\frac{1}{2}\|D_{k-2}\|_{\infty,w} \end{align*} holds with high probability. Moreover, it follows from \eqref{eqn1} that \begin{align*} \|\mathcal{D}_{k-1}\|_{\infty,w}\leq\frac{ k}{2^{k-1}}\sqrt{\frac{n_{(1)}n_{3}}{\mu\sum r_{i}}}\|\mathcal{U}\diamond_{\bf \Phi} \mathcal{V}^{H}\|_{\infty}+\frac{1}{2^{k-1}}\|\mathcal{U}\diamond_{\bf \Phi} \mathcal{V}^{H}\|_{\infty,w}. \end{align*} Taking them back to \eqref{eq4} yields \begin{align} &~\|\mathcal{P}_{T^{\bot}}(\mathcal{Y})\|\nonumber\\ \leq &~\frac{c}{\sqrt{c_{0}}}\frac{n_{(1)}n_{3}}{\mu\sum r_{i}}\|\mathcal{U}\diamond_{\bf \Phi} \mathcal{V}^{H}\|_{\infty}\sum_{k=1}^{p}(k+1)\left(\frac{1}{2}\right)^{k-1} \\ &~~ +\frac{c}{\sqrt{c_{0}}}\sqrt{\frac{n_{(1)}n_{3}}{\mu\sum r_{i}}}\|\mathcal{U}\diamond_{\bf \Phi} \mathcal{V}^{H}\|_{\infty,w}\sum_{k=1}^{p}\left(\frac{1}{2}\right)^{k-1}\nonumber\\ \leq &~\frac{6c}{\sqrt{c_{0}}}\frac{n_{(1)}n_{3}}{\mu\sum r_{i}}\|\mathcal{U}\diamond_{\bf \Phi} \mathcal{V}^{H}\|_{\infty}+ \frac{2c}{\sqrt{c_{0}}}\sqrt{\frac{n_{(1)}n_{3}}{\mu\sum r_{i}}}\|\mathcal{U}\diamond_{\bf \Phi}\mathcal{V}^{H}\|_{\infty,w}.\label{e7} \end{align} By the incoherence conditions given in \eqref{eq16}-\eqref{eq17}, we can get \begin{align} &\|\mathcal{U}\diamond_{\bf \Phi} \mathcal{V}^{H}\|_{\infty}\leq \max_{i,j,k}\|\mathcal{U}\diamond_{\bf \Phi}\tc{e}_{ik}\|_{F}\|\mathcal{V}^{H}\diamond_{\bf \Phi}\tc{e}_{ik}\|_{{F}}\leq \frac{\mu\sum r_{i}}{n_{(1)}n_{3}},\label{e10}\\ &\|\mathcal{U}\diamond_{\bf \Phi} \mathcal{V}^{H}\|_{\infty,w}\leq \max\left\{\max_{i,k}\| \mathcal{U}\diamond_{\bf \Phi} \mathcal{V}^{H}\diamond_{\bf \Phi}\tc{e}_{ik}\|_{{F}},\max_{j,k}\| \tc{e}_{jk}^{H}\diamond_{\bf \Phi}\mathcal{U}\diamond_{\bf \Phi} \mathcal{V}^{H}\|_{{F}}\right\}\leq \sqrt{\frac{\mu\sum r_{i}}{n_{(1)}n_{3}}}.\label{e11} \end{align} Plugging \eqref{e10} and \eqref{e11} into \eqref{e7}, we obtain that \begin{align*} \|\mathcal{P}_{T^{\bot}}(\mathcal{Y})\|\leq\frac{6c}{\sqrt{c_{0}}}+\frac{2c}{\sqrt{c_{0}}}\leq \frac{1}{2} \end{align*} provided $c_{0}$ is sufficiently large. Moreover, for any tensor $\mathcal{W}\in \{\mathcal{W} \in \mathbb{C}^{n_{1}\times n_{1}\times n_{3}}|\mathcal{P}_{\Omega}(\mathcal{W})=0\},$ denote the skinny transformed tensor SVD of $\mathcal{P}_{T^\bot}(\mathcal{W})$ by $$ \mathcal{P}_{T^\bot}(\mathcal{W}) = \mathcal{U}_\perp \diamond_{\bf \Phi}\mathcal{S}_\perp \diamond_{\bf \Phi} \mathcal{V}^{H}_\perp. $$ Since $\mathcal{\overline{U}}_{\bf \Phi}^{H}\cdot(\mathcal{\overline{U}}_{\perp})_{\bf \Phi}=\mathbf{0}$ and $\mathcal{\overline{V}}_{\bf \Phi}^{H}\cdot(\mathcal{\overline{V}}_{\perp})_{\bf \Phi}=\mathbf{0},$ we have $$ \|\mathcal{U} \diamond_{\bf \Phi} \mathcal{V}^{H} + \mathcal{U}_\perp \diamond_{\bf \Phi} \mathcal{V}^{H}_\perp\| = \|\mathcal{\overline{U}}_{\bf \Phi}\cdot \mathcal{\overline{V}}_{\bf \Phi}^{H} + (\mathcal{\overline{U}}_\perp)_{\bf \Phi}\cdot ((\mathcal{\overline{V}}_\perp)_{\bf \Phi})^{H}\|=1. $$ Thus, we get that \begin{align} \|\mathcal{Z} + \mathcal{W}\|_{\textup{TTNN}} \geq & ~ \langle \mathcal{U} \diamond_{\bf \Phi} \mathcal{V}^{H} + \mathcal{U}_\perp \diamond_{\bf \Phi} \mathcal{V}^{H}, \mathcal{Z} + \mathcal{W}\rangle \nonumber \\ = &~ \langle\mathcal{U} \diamond_{\bf \Phi} \mathcal{V}^{H},\mathcal{Z}\rangle + \langle\mathcal{U}_\perp \diamond_{\bf \Phi} \mathcal{V}^{H}_\perp, \mathcal{P}_{T^{\bot}}(\mathcal{W})\rangle + \langle\mathcal{U} \diamond_{\bf \Phi} \mathcal{V}^{H}, \mathcal{W}\rangle \nonumber\\ = &~ \|\mathcal{Z}\|_{\textup{TTNN}} + \|\mathcal{P}_{T^{\bot}}(\mathcal{W})\|_{\textup{TTNN}} +\langle \mathcal{U} \diamond_{\bf \Phi} \mathcal{V}^{H}, \mathcal{W}\rangle \nonumber \\ \geq &~ \|\mathcal{Z}\|_{\textup{TTNN}}+\mathcal{P}_{T^{\bot}}(\mathcal{W})\|_{\textup{TTNN}} -|\langle\mathcal{Y}-\mathcal{U}\diamond_{\bf \Phi} \mathcal{V}^{H}, \mathcal{W}\rangle - \langle\mathcal{Y}, \mathcal{W}\rangle| \nonumber\\ \geq & ~ \|\mathcal{Z}\|_{\textup{TTNN}}+ \|\mathcal{P}_{T^{\bot}}(\mathcal{W})\|_{\textup{TTNN}}- \|\mathcal{P}_{T^{\bot}}(\mathcal{Y})\| \|\mathcal{P}_{T^{\bot}}(\mathcal{W})\|_{\textup{TTNN}} \nonumber\\ &~-\|\mathcal{P}_{T}(\mathcal{Y}) - \mathcal{U} \diamond_{\bf \Phi} \mathcal{V}^{H}\|_{{F}} \|\mathcal{P}_{T}(\mathcal{W})\|_{{F}} \nonumber\\ \geq &~ \|\mathcal{Z}\|_{\textup{TTNN}}+ \frac{1}{2}\|\mathcal{P}_{T^{\bot}}(\mathcal{W})\|_{\textup{TTNN}} - \frac{1}{4n_{(1)}n_3} \|\mathcal{P}_T(\mathcal{W})\|_{{F}}. \label{eq21} \end{align} Thus, it follows from Lemma \ref{4.7} that $ \|\mathcal{Z} + \mathcal{W}\|_{\textup{TTNN}}>\|\mathcal{Z}\|_{\textup{TTNN}}$ holds for any $\mathcal{W}$ with $\mathcal{P}_{\Omega}(\mathcal{W}) = 0.$ As a consequence, $\mathcal{Z}$ is the unique minimizer to $\eqref{ObjFT}.$ This completes the proof. \qed In the next section, we demonstrate that the theoretical results can be obtained under valid incoherence conditions and the tensor completion performance of the proposed method is better than that of other testing methods. \section{Experimental Results}\label{Sect4} In this section, numerical examples are presented to demonstrate the effectiveness of the proposed model. All numerical experiments are obtained from a desktop computer running on 64-bit Windows Operating System having 8 cores with Intel(R) Core(TM) i7-6700 CPU at 3.40GHz and 20 GB memory. Firstly, we employ an alternating direction method of multipliers (ADMM) \cite{fazel2013hankel, Glowinski1976Approximations} to solve problem (\ref{ObjFT}). Let $\mathcal{Z}=\mathcal{Y}$. Then problem (\ref{ObjFT}) can be rewritten as \begin{equation}\label{ObjLg} \begin{split} \min_{\mathcal{Z}} & \ \|\mathcal{Z}\|_{\textup{TTNN}} \\ \textup{s.t.} & \ \mathcal{Z}=\mathcal{Y}, \ \mathcal{P}_\Omega(\mathcal{Y}) = \mathcal{P}_\Omega(\mathcal{M}). \end{split} \end{equation} The augmented Lagrangian function associated with (\ref{ObjLg}) is defined as $$ L(\mathcal{Z},\mathcal{Y},\mathcal{X}):=\|\mathcal{Z}\|_{\textup{TTNN}} -\langle \mathcal{X},\mathcal{Z}-\mathcal{Y}\rangle+\frac{\beta}{2}\|\mathcal{Z}-\mathcal{Y}\|_F^2, $$ where $\mathcal{X}\in \mathbb{C}^{n_{1}\times n_{2}\times n_3}$ is the Lagrangian multiplier and $\beta>0$ is the penalty parameter. The ADMM iteration system is given as follows: \begin{eqnarray}\label{u1211} &&\mathcal{Z}^{k+1}=\arg\min_{\mathcal{Z}}\Big\{L(\mathcal{Z},\mathcal{Y}^k,\mathcal{X}^k)\Big\},\\\label{w1} &&\mathcal{Y}^{k+1}=\arg\min_{\mathcal{Y}}\Big\{L(\mathcal{Z}^{k+1},\mathcal{Y},\mathcal{X}^k): \mathcal{P}_\Omega(\mathcal{Y}) = \mathcal{P}_\Omega(\mathcal{M})\Big\},\\ \label{u1} &&\mathcal{X}^{k+1}=\mathcal{X}^k-\gamma\beta\left(\mathcal{Z}^{k+1}-\mathcal{Y}^{k+1}\right), \end{eqnarray} where $\gamma\in(0,\frac{1+\sqrt{5}}{2})$ is the dual steplength. It follows from \cite[Theorem 3]{song2019robust} that the optimal solution with respect to $\mathcal{Z}$ in (\ref{u1211}) is given by \begin{equation}\label{XS} \mathcal{Z}^{k+1}=\mathcal{U} \diamond_{\bf \Phi} \mathcal{S}_{\beta} \diamond_{\bf \Phi} \mathcal{V}^{H}, \end{equation} where $\mathcal{Y}^k+\frac{1}{\beta}\mathcal{X}^k=\mathcal{U} \diamond_{\bf \Phi} \mathcal{S} \diamond_{\bf \Phi} \mathcal{V}^{H}$, $\mathcal{S}_{\beta}=\mathbf{\Phi}^{H}[\hat{\mathcal{S}}_{\beta}]$, and $\hat{\mathcal{S}}_{\beta}=\max\{\hat{\mathcal{S}}_{\bf \Phi}-\frac{1}{\beta},0\}$. The optimal solution with respect to $\mathcal{Y}$ in (\ref{w1}) is given by \begin{equation}\label{YS} \mathcal{Y}^{k+1}=\mathcal{P}_{\overline{\Omega}}\left(\mathcal{Z}^{k+1}-\frac{1}{\beta}\mathcal{X}^k\right)+\mathcal{P}_\Omega(\mathcal{M}), \end{equation} where $\overline{\Omega}$ denotes the complementary set of $\Omega$ on $\{1,\ldots,n_1\}\times\{1,\ldots,n_2\}\times\{1,\ldots,n_3\}$. The detailed description of ADMM for solving (\ref{ObjLg}) is given in Algorithm \ref{alg1}. \begin{algorithm}[h] \caption{Alternating direction method of multipliers for solving (\ref{ObjLg})} \label{alg1} \textbf{Step 0.} Let $\tau\in(0,(1+\sqrt{5})/2), \beta>0$ be given constants. Given $\mathcal{Y}^0, \mathcal{X}^0$. For $k=0,1,2,\ldots,$ perform the following steps: \\ \textbf{Step 1.} Compute $\mathcal{Z}^{k+1}$ by (\ref{XS}). \\ \textbf{Step 2.} Compute $\mathcal{Y}^{k+1}$ via (\ref{YS}). \\ \textbf{Step 3.} Compute $\mathcal{X}^{k+1}$ by (\ref{u1}). \end{algorithm} The convergence of a two-block ADMM for solving convex optimization problems has been established in \cite[Theorem B.1]{fazel2013hankel} and the convergence of Algorithm \ref{alg1} can be derived from this theorem easily. We omit the details here for the sake of brevity. The Karush-Kuhn-Tucker (KKT) conditions associated with problem (\ref{ObjLg}) are given as follows: \begin{equation}\label{KKT} \left\{\begin{array}{lll} 0\in\partial \|\mathcal{Z}\|_{\textup{TTNN}}-\mathcal{X}, \\ \mathcal{Z} =\mathcal{Y}, \ \mathcal{P}_\Omega(\mathcal{Y}) = \mathcal{P}_\Omega(\mathcal{M}), \end{array}\right. \end{equation} where $\partial \|\mathcal{Z}\|_{\textup{TTNN}}$ denotes the subdifferential of TTNN at $\mathcal{Z}$. Based on the KKT conditions in (\ref{KKT}), we adopt the following relative residual to measure the accuracy of a computed solution in the numerical experiments: $$ \eta:=\max\{\eta_x,\eta_y\}, $$ where $$ \eta_x=\frac{\|\mathcal{Z}-\mbox{Prox}_{\|\cdot\|_{\textup{TTNN}}}(\mathcal{X}+\mathcal{Z})\|_F}{1+\|\mathcal{Z}\|_F+\|\mathcal{X}\|_F}, \ \ \eta_y=\frac{\|\mathcal{Z}-\mathcal{Y}\|_F}{1+\|\mathcal{Z}\|_F+\|\mathcal{Y}\|_F}. $$ Here $\mbox{Prox}_f(y):=\arg\min_x\{f(x)+\frac{1}{2}\|x-y\|^2\}$. In the practical implementation, Algorithm \ref{alg1} will be terminated if $\eta\leq 10^{-3}$ or the maximum number of iterations exceeds $600$. We set $\gamma=1.618$ for the convergence of ADMM \cite{fazel2013hankel} in all experiments. Since the penalty parameter $\beta$ is not too sensitive to the recovered results, we set $\beta=0.05$ in the following experiments. The relative error (Rel) is defined by $$ \mbox{Rel}:=\frac{\|\mathcal{Z}_{est}-\mathcal{Z}\|_F}{\|\mathcal{Z}\|_F}, $$ where $\mathcal{Z}_{est}$ is the estimated tensor and $\mathcal{Z}$ is the ground-truth tensor. To evaluate the performance of the proposed method for real-world tensors, the peak signal-to-noise ratio (PSNR) is used to measure the quality of the estimated tensor, which is defined as follows: $$ \mbox{PSNR}:=10\log_{10} \frac{n_1n_2n_3({\mathcal{Z}}_{\max}-{\mathcal{Z}}_{\min})^2}{\|\mathcal{Z}_{est}-{\mathcal{Z}}\|_F^2}, $$ where ${\mathcal{Z}}_{\max}$ and ${\mathcal{Z}}_{\min}$ denote the maximum and minimum entries of $\mathcal{Z}$, respectively. The structural similarity (SSIM) index \cite{wang2004image} is used to measure the quality of the recovered images: $$ \mbox{SSIM}:=\frac{(2\mu_x\mu_y+c_1)(2\sigma_{xy}+c_2)}{(\mu_x^2+\mu_y^2+c_1)(\sigma_x^2+\sigma_y^2+c_2)}, $$ where $\mu_x, \sigma_x$ are the mean intensities and standard deviation of the original image, respectively, $\mu_y, \sigma_y$ denote the mean intensities and standard deviation of the recovered images, respectively, $\sigma_{xy}$ denotes the covariance of the original and recovered images, and $c_1,c_2>0$ are constants. For the real-world tensor data, the SSIM is used to denote the average SSIM values of all images. \subsection{Transformations of tensor SVD}\label{trans3} In this subsection, we use three kinds of transformations in the ${\bf \Phi}$-product and transformed tensor SVD. The first two transformations are FFT (t-SVD (FFT)) and discrete cosine transform (t-SVD (DCT)). The third one is based on given data to construct a unitary transform matrix \cite{qiu2021nonlocal, song2019robust, zhang2021low}. Note that we unfold $\mathcal{Z}$ into a matrix $Z$ along the third-dimension (called t-SVD (data)) and take the SVD of the unfolding matrix $Z=U {\Sigma}{V}^H$. Suppose that $\text{rank}(Z)=r$. It is interesting to observe that $U^H$ is the optimal transformation to obtain a low rank approximation of $Z$: $$ \min_{\mathbf{\Phi},B}\ \|\mathbf{\Phi} Z-B\|_F^2 \quad \mbox{s.t.} \quad \text{rank}(B)=r, \ \mathbf{\Phi}^H\mathbf{\Phi} = \mathbf{\Phi}\mathbf{\Phi}^H=I. $$ It has been demonstrated that the chosen unitary transformation $U^H$ is very effective for the tensor completion problems in the literature, e.g., \cite{qiu2021nonlocal, song2019robust, zhang2021low}. In practice, the estimator of $\mathcal{Z}$ obtained by t-SVD (DCT) can be used to generate $\mathbf{\Phi}$ for tensor completion. Now we give the computational cost of TTNN based on the three transformations for any $n_1 \times n_2 \times n_3$ tensor, which is the main cost of Algorithm \ref{alg1}. Suppose that $n_2 \leq n_1$. The computational cost of TTNN is given as follows: \begin{itemize} \item The application of FFT or DCT to a tube ($n_3$-vector) is of $O(n_3 \log(n_3))$ operations. There are $n_1n_2$ tubes in an $n_1 \times n_2 \times n_3$ tensor. In the transformed tensor SVD based on FFT or DCT, we need to compute $n_3$ $n_1$-by-$n_2$ SVDs in the transformed domain and then the cost is $O(n_1n_2^2n_3)$ for these matrices. Hence, the total cost of TTNN based on FFT or DCT is of $O(n_1n_2n_3 \log(n_3)+n_1n_2^2n_3)$ operations. \item The application of a unitary transformation ($n_3$-by-$n_3$) to an $n_3$-vector is of $O(n_3^2)$ operations. And there are still $n_3$ $n_1$-by-$n_2$ SVDs to be calculated in the transformed domain. Therefore, the total cost of computing the TTNN based on the given data is of $O(n_1n_2n_3^2+n_1n_2^2n_3)$ operations. \end{itemize} \subsection{Recovery Results} In this subsection, we show the recovery results to demonstrate the performance of our analysis for synthetic data and real imaging data sets. \subsubsection{Synthetic Data} For the synthetic data, the random tensors are generated as follows: $\mathcal{Z}=\mathcal{A} \diamond_{\bf \Phi} \mathcal{B}\in\mathbb{C}^{n_1\times n_2\times n_3}$ with different transformed multi-rank $\mathbf{r}$, where $\hat{\mathcal{A}}_{{\bf\Phi}}^{(i)}$ and $\hat{\mathcal{B}}_{{\bf\Phi}}^{(i)}$ are generated by MATLAB commands $\mbox{randn}(n_1,r_i)$ and $\mbox{randn}(n_2,r_i)$, and $r_i$ is the $i$-th element of the transformed multi-rank $\mathbf{r}$. Here ${\bf \Phi}$ denotes FFT, DCT, and an orthogonal matrix generated by the SVD of the unfolding matrix of ${\cal Z}$ along the third-dimension, see Section \ref{trans3}. In Figures \ref{fixsum200} and \ref{fixsum300}, we show the actual number of sample sizes for exact recovery and the theoretical bounds of sample sizes requirements in Theorem \ref{Theorem1}: \begin{equation} \label{con1} m \ge \ {\rm constant}_1 \ \sum_{i=1}^{n}r_i n \log(n^2) \end{equation} and the results in \cite{Zhang2017}: \begin{equation} \label{con2} m \ge \ {\rm constant}_2 \ r n^2 \log(n^2) \end{equation} for the $n\times n\times n$ tensor with the fixed sum of the transformed multi-rank and fixed transformed tubal rank by using t-SVD (FFT), t-SVD (DCT), and t-SVD (data). In the randomly generated tensor, we set (i) $\max_{1 \le i \le n} r_i =10$ (the transformed tubal rank is 10) and $\sum_{i=1}^nr_i=200$; and (ii) $\max_{1 \le i \le n} r_i =20$ (the transformed tubal rank is 20) and $\sum_{i=1}^nr_i=300$. \begin{figure}[!t] \centering \subfigure[t-SVD (FFT)]{ \begin{minipage}[b]{0.99\textwidth} \centerline{\scriptsize } \vspace{1.5pt} \includegraphics[width=5.5in,height=1.8in]{Fig1.png} \end{minipage} } \caption{\small The number of samples of exact recovery, the sample sizes required by the right hand sides of (\ref{con1}) and (\ref{con2}) for different values of $n$ with $\sum_{i=1}^{n}r_i=200$.} \label{fixsum200} \vspace{2mm} \centering \subfigure{ \begin{minipage}[b]{0.99\textwidth} \centerline{\scriptsize } \vspace{1.5pt} \includegraphics[width=5.5in,height=1.8in]{Fig2.png} \end{minipage} } \caption{\small The number of samples of exact recovery, the sample sizes required by the right hand sides of (\ref{con1}) and (\ref{con2}) for different values of $n$ with $\sum_{i=1}^{n}r_i=300$.}\label{fixsum300} \end{figure} In Figures \ref{fixsum200} and \ref{fixsum300}, we test different values of $n$ (from 60 to 200 with the increment size being 20). The exact recovery means that five trials are tested and all of the relative errors are less than or equal to $10^{-2}$ in the experiments. We test constant$_1$, constant$_2$ = 0.5 or 1 in the right hand sides of (\ref{con1}) and (\ref{con2}) respectively to check how the theoretical bounds of sample sizes match with the actual number of samples for different values of $n$. It can be seen from Figures \ref{fixsum200} and \ref{fixsum300} that the curve $\sum_{i=1}^{n}r_in\log(n^2)$ based on the proposed bound with constant$_1=1$ is close to the curve for the number of samples required by using t-SVD (FFT), and the curves $0.5 \sum_{i=1}^{n}r_i n\log(n^2)$ based on the proposed bound with constant$_1=0.5$ is close to the curves for the number of samples required by using t-SVD (DCT) and t-SVD (data). Note that the corresponding slope of these lines in Figures \ref{fixsum200} and \ref{fixsum300} is equal to 1 derived by the $n$ term. In contrast, the curves constant$_2 r n^2 \log(n^2)$ based on the results in \cite{Zhang2017} do not fit the curves for the number of samples required by using t-SVD (FFT), t-SVD (DCT) and t-SVD (data), see the curves with constant$_2 = 0.5, 1$ in Figures \ref{fixsum200} and \ref{fixsum300}. The main reason is that the corresponding slope of the lines in Figures \ref{fixsum200} and \ref{fixsum300} is equal to 2 derived by the $n^2$ term. According to Figures \ref{fixsum200} and \ref{fixsum300}, we find that the theoretical bounds of sample sizes requirements in Theorem \ref{Theorem1} match with the actual number of sample sizes for recovery. \subsubsection{Hyperspectral Images}\label{HPDS} \begin{figure}[!t] \centering \subfigure{ \begin{minipage}[b]{0.99\textwidth} \centerline{\scriptsize } \vspace{1.5pt} \includegraphics[width=5.5in,height=2.8in]{Fig3} \end{minipage} } \caption{\small The distribution of transformed multi-ranks of the hyperspectral data sets with different truncations in each band. First row: Samson data set. Second row: Japser Ridge data set. (a) $\varpi=70\%$. (b) $\varpi=80\%$. (c) $\varpi=90\%$. (d) $\varpi=95\%$.}\label{rankhyp} \end{figure} In this subsection, two hyperspectral data sets (Samson ($95\times95\times156$) and Japser Ridge ($100\times100\times198$) \cite{zhu2014spectral}) are used to demonstrate the required number of samples for tensor recovery by the proposed bound. For Samson data, $n_1$ and $n_2$ are equal to 95 and $n_3$ is equal to 156. For Japser Ridge data, $n_1$ and $n_2$ are equal to 100 and $n_3$ is equal to 198. Here we compare our method with the low-rank tensor completion method using the sum of nuclear norms of unfolding matrices of a tensor (LRTC)\footnote{\footnotesize http://www.cs.rochester.edu/$\sim$jliu/} \cite{huang2014provable, liu2013}, tensor factorization method (TF)\footnote{\footnotesize https://homes.cs.washington.edu/$\sim$sewoong/papers.html} \cite{jain2014provable}, Square Deal \cite{mu2014square}, gradient descent algorithm on Grassmannians (GoG) \cite{Xia2019On}. These testing hyperspectral data is normalized on $[0, 1]$. Their theoretical estimation of samples required are presented in Table \ref{table1}. We remark that these hyperspectral images are not exactly low multi-rank tensors, the multi-rank ($\sum_{i=1}^{n_3} r_i$) is not available. A truncated tensor is used to compute the transformed multi-rank and tubal rank by using the threshold $\varpi$. Here for a given tensor $\mathcal{Z}$ with transformed tensor SVD in (\ref{equ12}) of Theorem \ref{them1} and $\varpi$, we determine the smallest value $k$ such that $$ \frac{ \sum_{i=1}^{k} \varrho_i } { \sum_{i=1}^{n_{(2)} n_3} \varrho_i } \ge \varpi, $$ where $\{ \varrho_i \}$ is the sorted value in ascending order of the numbers $\{ (\hat{{\cal S}}_{\bf \Phi})_{jj\ell} \}_{1 \le j \le n_{(2)},1 \le \ell \le n_3}$ appearing in the diagonal tensor ${\cal S}$ in (\ref{equ12}). The ratio is used to determine the significant numbers are kept in the truncated tensor based on the threshold $\varpi$. Now we can define the transformed multi-rank $\mathbf{r}(\varpi)$ of the truncated tensor as follows: $$ \mathbf{r}(\varpi):=(r_1(\varpi),\ldots, r_{n_{3}}(\varpi)), \ \mbox{with}\ r_{\ell}(\varpi):=\# \{ (\hat{{\cal S}}_{\bf \Phi})_{jj\ell} \geq \varrho_k, 1 \le j \le n_{(2)} \}, \ \ell=1,\ldots, n_{3}, $$ Accordingly, the transformed tubal rank of the truncated tensor is defined as $r(\varpi):=\max\{r_1(\varpi),\ldots, r_{n_{3}}(\varpi)\}$. The distributions of the transformed multi-ranks of the two hyperspectral data sets with different $\varpi$ are shown in Figure \ref{rankhyp}. It can be seen that the $\sum_{i=1}^{n_3} r_i(\varpi)$ obtained by t-SVD (data) is much smaller than that obtained by t-SVD (FFT) and t-SVD (DCT) for different truncations $\varpi=70\%, 80\%, 90\%, 95\%$, which implies that the t-SVD (data) needs lower number of samples for successful recovery than t-SVD (FFT) and t-SVD (DCT). The distributions of the transformed multi-ranks of the truncated tensor obtained by t-SVD (FFT) are symmetric due to symmetry of FFT. \begin{table}[!t] \scriptsize \begin{center} \setlength{\abovecaptionskip}{-1pt} \setlength{\belowcaptionskip}{-1pt} \caption{\small The PSNR, SSIM values, and CPU time (in seconds) of different methods for the hyperspectral images.}\label{tab4} \medskip \mbox{\hspace{-0.5cm}}\begin{tabular}{|c| c| c c c c c c c | } \hline & &\multicolumn{7}{c|}{Samson} \\ \cline{3-9} & const$_1$ & 20 & 30 & 40 & 50 & 60 & 70 & 80 \\ \cline{2-9} & sampling & \multirow{2}{*}{0.013} & \multirow{2}{*}{0.019} & \multirow{2}{*}{0.026} & \multirow{2}{*}{0.032} & \multirow{2}{*}{0.039} & \multirow{2}{*}{0.045} & \multirow{2}{*}{0.052} \\ & rate & & & & & & & \\ \hline \hline \multirow{3}{*}{LRTC} & PSNR & 13.08 & 16.00 & 18.34 & 19.82 & 20.99 & 22.12 & 22.98 \\ & SSIM & 0.3254 & 0.5720 & 0.6223 & 0.6643 & 0.6964 & 0.7287 & 0.7548 \\ & CPU & 26.44 & 29.81 & 29.50 & 27.13 & 25.50 & 26.35 & 28.66 \\ \hline \multirow{3}{*}{TF} & PSNR & 4.05 & 7.45 & 20.26 & 29.78 & 32.86 & 35.54 & 36.39 \\ & SSIM & 0.3990 & 0.4852 & 0.7798 & 0.8627 & 0.8856 & 0.9334 & 0.9440 \\ & CPU & 207.55 & 207.20 & 206.90 & 206.80 & 216.99 & 210.21 & 207.86 \\ \hline \multirow{3}{*}{Square Deal} & PSNR & 16.35 & 18.55 & 20.38 & 22.15 & 23.77 & 25.57 & 26.77 \\ & SSIM & 0.4502 & 0.5727 & 0.6696 & 0.7269 & 0.7916 & 0.8310 & 0.8667 \\ & CPU & 37.46 & 34.93 & 33.05 & 30.96 & 29.48 & 29.63 & 34.05 \\ \hline \multirow{3}{*}{GoG} & PSNR & 16.72 & 26.02 & 27.13 & 30.01 & 30.45 & 30.87 & 31.43 \\ & SSIM & 0.4851 & 0.6978 & 0.7560 & 0.8372 & 0.8366 & 0.8398 & 0.8665 \\ & CPU & 1.05e4 & 1.40e4 & 3.41e4 & 3.87e4 & 4.61e4 & 3.46e4 & 4.15e4 \\ \hline \multirow{3}{*}{t-SVD (FFT)} & PSNR & 22.09 & 23.88 & 25.21 & 26.27 & 27.09 & 27.68 & 28.52 \\ & SSIM & 0.5743 & 0.6498 & 0.6996 & 0.7442 & 0.7689 & 0.7912 & 0.8107 \\ & CPU & 30.24 & 26.30 & 25.11 & 24.07 & 22.45 & 23.62 & 26.58 \\ \hline \multirow{3}{*}{t-SVD (DCT)} & PSNR & 26.35 & 28.72 & 30.42 & 31.92 & 33.03 & 33.96 & 35.04 \\ & SSIM & 0.7355 & 0.8098 & 0.8552 & 0.8875 & 0.9096 & 0.9215 & 0.9343 \\ & CPU & 172.41 & 167.56 & 177.44 & 185.69 & 193.36 & 187.29 & 190.13 \\ \hline \multirow{3}{*}{t-SVD (data)} & PSNR&{\bf28.24}&{\bf31.37}&{\bf33.39}&{\bf35.25}&{\bf36.53} &{\bf 37.09} & {\bf 38.62} \\ & SSIM & 0.8324 & 0.8971 & 0.9311 & 0.9539 & 0.9643 & 0.9658 & 0.9746 \\ & CPU & 241.48 & 258.86 & 270.17 & 282.82 & 284.68 & 263.78 & 291.26 \\ \hline\hline & &\multicolumn{7}{c|}{Japser Ridge} \\ \cline{3-9} & const$_1$ & 20 & 30 & 40 & 50 & 60 & 70 & 80 \\ \cline{2-9} & sampling & \multirow{2}{*}{0.010} & \multirow{2}{*}{0.015} & \multirow{2}{*}{0.020} & \multirow{2}{*}{0.025} & \multirow{2}{*}{0.030} & \multirow{2}{*}{0.035} & \multirow{2}{*}{0.040} \\ & rate & & & & & & & \\ \hline \hline \multirow{3}{*}{LRTC} & PSNR & 12.48 & 14.80 & 16.78 & 18.17 & 18.97 & 19.61 & 20.15 \\ & SSIM & 0.3245 & 0.4104 & 0.4404 & 0.4611 & 0.4793 & 0.5011 & 0.5223 \\ & CPU & 39.54 & 39.98 & 42.73 & 39.81 & 36.51 & 40.21 & 42.36 \\ \hline \multirow{3}{*}{TF} & PSNR & 7.12 & 11.41 & 12.09 & 15.39 & 27.03 & 27.83 & 28.07 \\ & SSIM & 0.2076 & 0.3728 & 0.6120 & 0.6418 & 0.7246 & 0.7603 & 0.7693 \\ & CPU & 400.27 & 399.79 & 398.94 & 398.46 & 286.83 & 362.15 & 384.52 \\ \hline \multirow{3}{*}{Square Deal} & PSNR & 15.38 & 17.50 & 20.47 & 22.48 & 24.25 & 26.13 & 27.12 \\ & SSIM & 0.3890 & 0.5168 & 0.6199 & 0.7021 & 0.7596 & 0.8046 & 0.8378 \\ & CPU & 43.33 & 41.89 & 41.82 & 41.99 & 40.65 & 42.59 & 40.99 \\ \hline \multirow{3}{*}{GoG} & PSNR & 15.32 & 22.38 & 23.54 & 24.35 & 25.44 & 25.90 & 26.35 \\ & SSIM & 0.2643 & 0.5430 & 0.5624 & 0.5835 & 0.6550 & 0.6808 & 0.7193 \\ & CPU & 3.49e4 & 4.13e4 & 5.33e4 & 5.50e4 & 5.58e4 & 5.39e4 & 5.41e4 \\ \hline \multirow{3}{*}{t-SVD (FFT)} & PSNR & 21.04 & 22.95 & 24.09 & 25.17 & 26.06 & 26.74 & 27.25 \\ & SSIM & 0.4877 & 0.5802 & 0.6353 & 0.6891 & 0.7270 & 0.7578 & 0.7756 \\ & CPU & 50.54 & 42.01 & 37.62 & 35.38 & 34.36 & 42.69 & 35.99 \\ \hline \multirow{3}{*}{t-SVD (DCT)} & PSNR & 21.93 & 23.40 & 24.48 & 25.49 & 26.36 & 27.06 & 27.65 \\ & SSIM & 0.5206 & 0.5945 & 0.6481 & 0.7015 & 0.7378 & 0.7647 & 0.7892 \\ & CPU & 200.90 & 171.96 & 164.15 & 169.65 & 172.05 & 184.23 & 193.06 \\ \hline \multirow{3}{*}{t-SVD (data)} & PSNR &{\bf23.54}&{\bf25.63}&{\bf27.47}&{\bf28.74}&{\bf30.09}&{\bf 30.78} &{\bf 31.33} \\ & SSIM & 0.6004 & 0.7041 & 0.7816 & 0.8323 & 0.8675 & 0.8777 & 0.8962 \\ & CPU & 235.74 & 217.07 & 217.13 & 230.64 & 235.28 & 225.95 & 231.87 \\ \hline \end{tabular} \end{center} \end{table} \begin{figure}[htbp] \centering \subfigure[15th band]{ \begin{minipage}[b]{0.2\textwidth} \centerline{\scriptsize } \vspace{1pt} \includegraphics[width=1.2in,height=0.76in]{Ori1560.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{Ob1560.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{LRTC1560.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{TF1560.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{SD1560.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{GoG1560.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{FFT1560.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{DCT1560.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{U1560.png} \end{minipage} } \subfigure[60th band]{ \begin{minipage}[b]{0.2\textwidth} \centerline{\scriptsize } \vspace{1pt} \includegraphics[width=1.2in,height=0.76in]{Ori6060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{Ob6060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{LRTC6060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{TF6060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{SD6060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{GoG6060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{FFT6060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{DCT6060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{U6060.png} \end{minipage} } \subfigure[90th band]{ \begin{minipage}[b]{0.2\textwidth} \centerline{\scriptsize } \vspace{1pt} \includegraphics[width=1.2in,height=0.76in]{Ori9060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{Ob9060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{LRTC9060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{TF9060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{SD9060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{GoG9060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{FFT9060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{DCT9060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{U9060.png} \end{minipage} } \subfigure[130th band]{ \begin{minipage}[b]{0.2\textwidth} \centerline{\scriptsize } \vspace{1pt} \includegraphics[width=1.2in,height=0.76in]{Ori13060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{Ob13060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{LRTC13060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{TF13060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{SD13060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{GoG13060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{FFT13060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{DCT13060.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{U13060.png} \end{minipage} } \caption{\small Recovery results by different methods for the Samson data with const$_1=60$. First row: Original images. Second row: Observed images. Third row: Recovered images by LRTC. Fourth row: Recovered images by TF. Fifth row: Recovered images by Square Deal. Sixth row: Recovered images by GoG. Seventh row: Recovered images by t-SVD (FFT). Eighth row: Recovered images by t-SVD (DCT). Ninth row: Recovered images by t-SVD (data).}\label{HPVisc} \end{figure} \begin{figure}[!t] \centering \subfigure{ \begin{minipage}[b]{0.99\textwidth} \centerline{\scriptsize } \vspace{1.5pt} \includegraphics[width=5.5in,height=2.8in]{Fig5.png} \end{minipage} } \caption{\small The distribution of transformed multi-ranks of the video data sets with different truncations in each frame. First row: Carphone data set. Second row: Announcer data set. (a) $\varpi=70\%$. (b) $\varpi=80\%$. (c) $\varpi=90\%$. (d) $\varpi=95\%$.}\label{rankAK} \end{figure} In Table \ref{tab4}, we present the number of samples (const$_1 n_{(1)} \log (n_{(1)} n_3 )$) for several values of const$_1$ and their corresponding PSNR and SSIM values of the recovered tensors by different methods, where const$_1$ varies from 20 to 80 with step-size $10$. Here we can regard const$_1$ as $c_0\mu\sum_{i=1}^{n_3}r_i(\varpi)$ in (\ref{new1}) of Theorem \ref{Theorem1}. For $\varpi = 70\%$, the values $\sum_{i=1}^{n_3}r_i(\varpi)$ of Samson hyperspectral image are $346$, $129$, $40$ for t-SVD (FFT), t-SVD (DCT), and t-SVD (data), respectively. Thus, the chosen const$_1$ is proportional to $\sum_{i=1}^{n_3}r_i(\varpi)$ for the testing tensor of hyperspectral image with approximately low transformed multi-rank. We can see from the table that for different values of const$_1$, the PSNR and SSIM values obtained by t-SVD (data) and t-SVD (DCT) are higher than those obtained by LRTC, TF, Square Deal, GoG, and t-SVD (FFT). Moreover, when const$_1 =60$, the recovery performance of the t-SVD (FFT), t-SVD (DCT), and t-SVD (data) is good enough in terms of PSNR and SSIM values, which implies the number of sizes is enough for successful recovery by Theorem \ref{Theorem1}. When const$_1$ is larger, e.g., const$_1 =70,80$, the improvements of PSNR values of the t-SVD (FFT), t-SVD (DCT), and t-SVD (data) are smaller than those of other small const$_1$. For Samson data, the performance of GoG is better than that of t-SVD (FFT) for const$_1 \ge 30$. But the computational time required by GoG is significantly more than that required by the other methods. For Japser Ridge data, the PSNR and SSIM values obtained by all three t-SVD methods are almost higher than those obtained by LRTC, TF, Square Deal, and GoG. Moreover, the computational time required by the t-SVD methods are quite efficient compared with the other methods. Figure \ref{HPVisc} shows the visual comparisons of different bands obtained by LRTC, TF, Square Deal, GoG, and three t-SVD methods for the Samson data, where const$_1=60$. We can see that the t-SVD (data) and t-SVD (DCT) outperform LRTC, TF, Square Deal, and t-SVD (FFT) in terms of visual quality. Moreover, the images recovered by t-SVD (data) keep more details than those recovered by LRTC, TF, Square Deal, t-SVD (FFT), and t-SVD (DCT). \subsubsection{Video Data} In this subsection, we test two video data sets (length $\times$ width $\times$ frames) to show the performance of the proposed method, where the testing videos include Carphone ($144\times176\times180$) and Announcer ($144\times176\times200$)\footnote{\footnotesize https://media.xiph.org/video/derf/}, and we just use the first channels of all frames in the original data. Moreover, the first $180$ and $200$ frames for the two videos are chosen to improve the computational time. The intensity range of the video images is scaled into $[0,1]$ in the experiments. \begin{table}[!t] \tiny \begin{center} \setlength{\abovecaptionskip}{-1pt} \setlength{\belowcaptionskip}{-1pt} \caption{\small The PSNR, SSIM values, and CPU time (in seconds) of different methods for the video data sets.}\label{tab5} \medskip \mbox{\hspace{-1.3cm}}\begin{tabular}{|c|c| c| c c c c c c c c c c c | } \hline & & const$_1$ & 20 & 30 & 40 & 50 & 60 & 70 & 80 & 90 & 100 & 110 & 120 \\ \cline{3-14} & & sampling & \multirow{2}{*}{0.008} & \multirow{2}{*}{0.012} & \multirow{2}{*}{0.016} & \multirow{2}{*}{0.020} & \multirow{2}{*}{0.024} & \multirow{2}{*}{0.028} & \multirow{2}{*}{0.032} & \multirow{2}{*}{0.036} & \multirow{2}{*}{0.040} & \multirow{2}{*}{0.044} & \multirow{2}{*}{0.048} \\ & & rate & & & & & & & & & & & \\ \hline \hline \multirow{21}{*}{Carphone}& \multirow{3}{*}{LRTC} & PSNR & 10.81 & 11.65 & 12.49 & 13.19 & 13.97 & 14.75 & 15.40 & 16.01 & 16.53 & 17.05 & 17.52 \\ & & SSIM & 0.3498 & 0.3571 & 0.3687 & 0.3870 & 0.4085 & 0.4319 & 0.4496 & 0.4701 & 0.4862 & 0.5038 & 0.5206 \\ & & CPU & 90.78 & 85.06 & 85.92 & 85.12 & 89.76 & 92.28 & 91.70 & 90.47 & 92.91 & 92.06 & 95.21 \\ \cline{2-14} & \multirow{3}{*}{TF} & PSNR & 4.96 & 4.64 & 13.41 & 12.98 & 20.82 & 22.57 & 22.66 & 22.74 & 22.75 & 22.85 & 23.04 \\ & & SSIM & 0.2855 & 0.4507 & 0.5081 & 0.5499 & 0.5837 & 0.6461 & 0.6531 & 0.6607 & 0.6622 & 0.6705 & 0.6746 \\ & & CPU & 780.55 & 779.63 & 771.43 & 782.11 & 762.25 & 770.57 & 771.03 & 765.42 & 760.32 & 782.45 & 795.41 \\ \cline{2-14} & \multirow{3}{*}{Square Deal} & PSNR & 10.04 & 12.99 & 13.55 & 15.00 & 16.98 & 17.15 & 18.10 & 19.15 & 20.42 & 20.47 & 21.17 \\ & & SSIM & 0.1796 & 0.2675 & 0.3304 & 0.3988 & 0.4497 & 0.4930 & 0.5348 & 0.5719 & 0.6113 & 0.6178 & 0.6396 \\ & & CPU & 76.98 & 80.23 & 76.06 & 77.03 & 76.76 & 76.36 & 74.78 & 80.00 & 78.59 & 77.21 & 79.75 \\ \cline{2-14} & \multirow{3}{*}{GoG} & PSNR & 18.59 & 20.18 & 20.77 & 20.46 & 21.22 & 21.35 & 21.48 & 22.11 & 22.47 & 22.86 & 23.15 \\ & & SSIM & 0.4010 & 0.4653 & 0.5229 & 0.5023 & 0.5449 & 0.5483 & 0.5547 & 0.5768 & 0.5874 & 0.5936 & 0.6058 \\ & & CPU & 1.09e5 & 2.27e5 & 1.30e5 & 1.40e5 & 2.47e5 & 6.27e5 & 3.76e5 & 6.71e5 & 6.32e5 & 6.52e5 & 6.48e5 \\ \cline{2-14} & \multirow{3}{*}{t-SVD (FFT)} & PSNR & 9.79 & 11.55 & 15.06 & 18.53 & 22.04 & 22.59 & 23.07 & 23.38 & 23.72 & 24.01 & 24.24 \\ & & SSIM & 0.1814 & 0.2463 & 0.3759 & 0.4899 & 0.6121 & 0.6367 & 0.6566 & 0.6690 & 0.6816 & 0.6934 & 0.7017 \\ & & CPU & 53.78 & 58.69 & 77.43 & 88.78 & 107.26 & 103.15 & 98.25 & 93.03 & 88.88 & 90.36 & 92.81 \\ \cline{2-14} & \multirow{3}{*}{t-SVD (DCT)} & PSNR & 20.24 & 21.18 & 21.93 & 22.42 & 22.91 & 23.24 & 23.60 & 23.87 & 24.15 & 24.44 & 24.65 \\ & & SSIM & 0.5230 & 0.5720 & 0.6044 & 0.6286 & 0.6506 & 0.6642 & 0.6772 & 0.6890 & 0.6484 & 0.7106 & 0.7185 \\ & & CPU & 323.11 & 291.24 & 271.55 & 251.17 & 237.77 & 226.54 & 214.85 & 205.35 & 198.58 & 200.15 & 197.32 \\ \cline{2-14} & \multirow{3}{*}{t-SVD (data)} & PSNR &{\bf20.39}&{\bf21.43}&{\bf22.30}&{\bf22.87}&{\bf23.45}&{\bf23.75}&{\bf24.23}&{\bf24.56}&{\bf24.85}&{\bf 24.94}&{\bf 25.17} \\ & & SSIM & 0.5294 & 0.5841 & 0.6236 & 0.6499 & 0.6747 & 0.6877 & 0.7063 & 0.7200 & 0.7298 & 0.7329 & 0.7426 \\ & & CPU & 366.20 & 337.21 & 314.40 & 293.42 & 278.06 & 261.55 & 253.14 & 242.91 & 235.86 & 261.02 & 248.59 \\ \hline & & const$_1$ & 20 & 30 & 40 & 50 & 60 & 70 & 80 & 90 & 100 & 110 & 120 \\ \cline{3-14} & & sampling & \multirow{2}{*}{0.007} & \multirow{2}{*}{0.011} & \multirow{2}{*}{0.015} & \multirow{2}{*}{0.018} & \multirow{2}{*}{0.022} & \multirow{2}{*}{0.025} & \multirow{2}{*}{0.029} & \multirow{2}{*}{0.033} & \multirow{2}{*}{0.036} & \multirow{2}{*}{0.040} & \multirow{2}{*}{0.044} \\ & & rate & & & & & & & & & & & \\ \hline \hline \multirow{21}{*}{Announcer}& \multirow{3}{*}{LRTC} & PSNR & 12.72 & 14.03 & 15.28 & 16.42 & 17.76 & 18.83 & 19.88 & 20.74 & 21.46 & 22.06 & 22.58 \\ & & SSIM & 0.4727 & 0.4900 & 0.5087 & 0.5336 & 0.5601 & 0.5869 & 0.6120 & 0.6341 & 0.6520 & 0.6710 & 0.6871 \\ & & CPU & 100.75 & 96.25 & 100.67 & 103.05 & 104.02 & 105.00 & 104.68 & 103.02 & 100.29 & 101.23 &100.96 \\ \cline{2-14} & \multirow{3}{*}{TF} & PSNR & 4.39 & 9.99 & 11.36 & 15.48 & 24.12 & 25.65 & 26.22 & 26.28 & 27.99 & 28.29 & 28.34 \\ & & SSIM & 0.4229 & 0.6176 & 0.6599 & 0.6743 & 0.7076 & 0.7363 & 0.7534 & 0.7544 & 0.8169 & 0.8265 & 0.8300 \\ & & CPU & 887.20 & 862.11 & 872.41 & 874.64 & 869.01 & 864.04 & 822.11 & 835.96 & 858.93 & 862.62 & 839.15 \\ \cline{2-14} & \multirow{3}{*}{Square Deal} & PSNR & 11.50 & 14.61 & 16.71 & 19.36 & 20.86 & 23.34 & 24.15 & 24.27 & 26.76 & 28.24 & 28.87 \\ & & SSIM & 0.1692 & 0.2702 & 0.3780 & 0.5004 & 0.6207 & 0.6950 & 0.7488 & 0.7928 & 0.8394 & 0.8743 & 0.8918 \\ & & CPU & 86.39 & 87.33 & 80.39 & 78.26 & 77.23 & 77.46 & 80.36 & 80.28 & 81.06 & 80.25 & 80.38 \\ \cline{2-14} & \multirow{3}{*}{GoG} & PSNR & 21.85 & 23.59 & 23.72 & 24.80 & 24.96 & 25.42 & 26.20 & 26.87 & 27.14 & 27.43 & 27.79 \\ & & SSIM & 0.5113 & 0.5854 & 0.6144 & 0.6691 & 0.6775 & 0.6976 & 0.7183 & 0.7566 & 0.7977 & 0.8236 & 0.8395 \\ & & CPU & 1.94e5 & 2.31e5 & 2.60e5 & 3.54e5 & 6.09e5 & 6.36e5 & 5.49e5 & 5.98e5 & 5.90e5 & 5.89e5 & 6.01e5 \\ \cline{2-14} & \multirow{3}{*}{t-SVD (FFT)} & PSNR & 11.01 & 16.64 & 27.03 & 27.98 & 28.63 & 29.11 & 29.46 & 29.83 & 30.12 & 30.35 & 30.62 \\ & & SSIM & 0.2606 & 0.5339 & 0.8125 & 0.8380 & 0.8564 & 0.8686 & 0.8776 & 0.8865 & 0.8922 & 0.8987 & 0.9022 \\ & & CPU & 61.87 & 97.82 & 153.63 & 144.82 & 132.18 & 125.67 & 118.75 & 106.63 & 103.44 & 113.25 & 108.63 \\ \cline{2-14} & \multirow{3}{*}{t-SVD (DCT)} & PSNR & 26.06 & 27.12 & 27.92 & 28.58 & 29.16 & 29.58 & 29.95 & 30.32 & 30.69 & 30.93 & 31.17 \\ & & SSIM & 0.7645 & 0.8078 & 0.8353 & 0.8875 & 0.8703 & 0.8798 & 0.8893 & 0.8985 & 0.9046 & 0.9099 & 0.9140 \\ & & CPU & 537.80 & 466.05 & 432.45 & 407.57 & 377.23 & 350.59 & 329.40 & 298.93 & 287.79 & 298.46 & 284.32 \\ \cline{2-14} & \multirow{3}{*}{t-SVD (data)} & PSNR &{\bf26.08}&{\bf27.25}&{\bf28.12}&{\bf28.76}&{\bf29.41}&{\bf29.88}&{\bf30.24}&{\bf30.71}&{\bf31.14}&{\bf 31.29}&{\bf 31.58} \\ & & SSIM & 0.7649 & 0.8113 & 0.8399 & 0.8581 & 0.8741 & 0.8838 & 0.8941 & 0.9037 & 0.9106 & 0.9150 & 0.9198 \\ & & CPU & 608.38 & 531.39 & 472.35 & 460.30 & 425.59 & 395.42 & 353.94 & 341.43 & 330.40 & 365.25 & 341.29 \\ \hline \end{tabular} \end{center} \end{table} Similar to Section \ref{HPDS}, the video data sets are not exactly low-rank. First, we show the distributions of the transformed multi-ranks with different transformations and truncations $\varpi$ in Figure \ref{rankAK}. It can be observed that the $\sum_{i=1}^{n_3} r_i(\varpi)$ obtained by t-SVD (data) is much smaller than that obtained by t-SVD (FFT) and t-SVD (DCT) for different $\varpi$. Therefore, the number of samples required by t-SVD (data) would be smaller than that required by t-SVD (FFT) and t-SVD (DCT) for the same performance. The distributions of transformed multi-ranks obtained by t-SVD (FFT) are symmetric for different $\varpi$ since the FFT has symmetric property. \begin{figure}[htbp] \centering \subfigure[20th frame]{ \begin{minipage}[b]{0.2\textwidth} \centerline{\scriptsize } \vspace{1pt} \includegraphics[width=1.2in,height=0.76in]{AKOri20.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKObs80-20.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKLRTC80-20.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKTF80-20.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKSD80-20.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKGoG80-20.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKFFT80-20.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKDCT80-20.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKU80-20.png} \end{minipage} } \subfigure[80th frame]{ \begin{minipage}[b]{0.2\textwidth} \centerline{\scriptsize } \vspace{1pt} \includegraphics[width=1.2in,height=0.76in]{AKOri80.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKObs80-80.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKLRTC80-80.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKTF80-80.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKSD80-80.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKGoG80-80.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKFFT80-80.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKDCT80-80.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKU80-80.png} \end{minipage} } \subfigure[120th frame]{ \begin{minipage}[b]{0.2\textwidth} \centerline{\scriptsize } \vspace{1pt} \includegraphics[width=1.2in,height=0.76in]{AKOri120.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKObs80-120.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKLRTC80-120.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKTF80-120.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKSD80-120.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKGoG80-120.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKFFT80-120.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKDCT80-120.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKU80-120.png} \end{minipage} } \subfigure[180th frame]{ \begin{minipage}[b]{0.2\textwidth} \centerline{\scriptsize } \vspace{1pt} \includegraphics[width=1.2in,height=0.76in]{AKOri180.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKObs80-180.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKLRTC80-180.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKTF80-180.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKSD80-180.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKGoG80-180.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKFFT80-180.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKDCT80-180.png} \centerline{\scriptsize }\\ \vfill \vspace{-23pt} \includegraphics[width=1.2in,height=0.76in]{AKU80-180.png} \end{minipage} } \caption{\small Recovery results by different methods for the Announcer data with const$_1=80$. First row: Original images. Second row: Observed images. Third row: Recovered images by LRTC. Fourth row: Recovered images by TF. Fifth row: Recovered images by Square Deal. Sixth row: Recovered images by GoG. Seventh row: Recovered images by t-SVD (FFT). Eighth row: Recovered images by t-SVD (DCT). Ninth row: Recovered images by t-SVD (data).}\label{VideoVisc} \end{figure} We use const$_1 n_{(1)}\log(n_{(1)}n_3)$ number of samples based on Theorem \ref{Theorem1}. The range const$_1$ is from 20 to 120 with increment step-size being 10. For example, when $\varpi=70\%$, the $\sum_{i=1}^{n_3}r_i(\varpi)$ of Announcer obtained by t-SVD (FFT), t-SVD (DCT), t-SVD (data) are $1886$, $1649$, $1502$, respectively. When const$_1$ is equal to 100, the required sample size would be enough for successful recovery by Theorem \ref{Theorem1}. When const$_1 >100$, e.g., const$_1= 110,120$, the improvements of PSNR values by the three t-SVD methods are very small. In Table \ref{tab5}, we show the PSNR, SSIM values, and CPU time (in seconds) of different methods for the testing video data sets with different const$_1$. It can be seen that the performance of t-SVD (data) is better than that of LRTC, TF, Square Deal, GoG, t-SVD (FFT), and t-SVD (DCT) in terms of PSNR and SSIM values. The PSNR and SSIM values obtained by t-SVD (DCT) are higher than those obtained by t-SVD (FFT). Hence, the number of samples required by t-SVD (DCT) and t-SVD (data) is smaller than that required by LRTC, TF, Square Deal, GoG, and t-SVD (FFT) for the same recovery performance, which demonstrates the conclusion of Theorem \ref{Theorem1}. Moreover, the CPU time (in seconds) required by GoG is much more than that required by other methods. Figure \ref{VideoVisc} shows the visual quality of the 20th, 80th, 120th, 180th frames of the recovered images by LRTC, TF, Square Deal, GoG, and three t-SVD methods, where const$_1 = 80$. It can be seen that the three t-SVD methods outperform LRTC, TF, Square Deal, and GoG for different frames in terms of visual quality, where the recovered images by the t-SVD methods are more clear. \section{Concluding Remarks}\label{Sect5} In this paper, we have established the sample size requirement for exact recovery in the tensor completion problem by using transformed tensor SVD. We have shown that for any $\mathcal{Z}\in\mathbb{C}^{n_1\times n_2\times n_3}$ with transformed multi-rank $(r_1,r_2,\ldots, r_{n_3})$, one can recover the tensor exactly with high probability under some incoherence conditions if the sample size of observations is of the order $O(\sum_{i=1}^{n_3}r_i\max \{n_1, n_2 \} \log ( \max \{ n_1, n_2 \} n_3))$ under uniformly sampled entries. The sample size requirement of our theory for exact recovery is smaller than that of existing methods for tensor completion. Moreover, several numerical experiments on both synthetic data and real-world data sets are presented to show the superior performance of our methods in comparison with other state-of-the-art methods. In further work, it would be of great interest to extend the transformed tensor SVD and tensor completion results to higher-order tensors (cf. \cite{martin2013order}). It would be also of great interest to extend the result of the unitary transformation to any invertible linear transformation for tensor completion (cf. \cite{kernfel}). \section*{Acknowledgments} The authors are grateful to Dr. Cun Mu at Walmart Labs and Dr. Dong Xia at The Hong Kong University of Science and Technology for sharing the codes of the Square Deal \cite{mu2014square} and GoG methods \cite{Xia2019On}, respectively. The authors are also grateful to the anonymous referees for their constructive suggestions and comments to improve the presentation of the paper. \section*{Appendix A.} \label{Attechment} We first list the following lemma, which is the main tool to prove our conclusions. \begin{lemma}(\cite[Theorem 4]{Recht2011})\label{lem5} Let $X_{1},\ldots,X_{L}\in \mathbb{R}^{n\times n}$ be independent zero mean random matrices of dimension $d_{1}\times d_{2}$. Suppose $\rho_{k}^2=\max\left\{\|\mathbb{E} [X_{k}X_{k}^{T}]\|,\|\mathbb{E} [X_{k}^{T}X_{k}]\|\right\}$ and $\|X_{k}\|\leq B$ almost surely for all $k=1,\ldots,L.$ Then for any $\tau>0,$ \begin{equation*} \mathbb{P}\left[\Biggl\|\sum_{k=1}^{L}X_{k}\Biggl\|>\tau\right]\leq(d_{1}+d_{2})\exp\left(\frac{-\tau^2/2}{\sum_{k=1}^{L}\rho_{k}^2+B\tau/3}\right). \end{equation*} Moreover, if $ \max\left\{\big\|\sum_{k=1}^{L}X_{k}X_{k}^{T}\big\|,\big\|\sum_{k=1}^{L}X_{k}^{T}X_{k}\big\|\right\}\leq \sigma^2, $ then for any $c>1,$ we have \begin{align*} \left\|\sum_{k=1}^{L}X_{k}\right\|\leq \sqrt{4c\sigma^2\log(d_{1}+d_{2})}+cB\log(d_{1}+d_{2}) \end{align*} holds with probability at least $1-(d_{1}+d_{2})^{-(c-1)}.$ \end{lemma} \vspace{2mm} \noindent \subsection*{Proof of Lemma \ref{le1}} Let $\mathcal{E}_{ijk}$ be a unit tensor whose $(i,j,k)$-th entry is 1 and others are 0. Then for an arbitrary tensor $ \mathcal{Z}\in \mathbb{C}^{n_1 \times n_2 \times n_3}$, we have $\mathcal{Z} = \sum_{i,j,k} \<\mathcal{E}_{ijk}, \mathcal{Z}\>\mathcal{E}_{ijk}.$ Recall Definition \ref{defn}, $\mathcal{E}_{ijk}$ can be expressed as $\mathcal{E}_{ijk}= \tc{e}_{ik}\diamond_{\bf \Phi} \ddot{\bm{e}}_k \diamond_{\bf \Phi} \tc{e}_{jk}^H,$ then ${\cal P}_T(\mathcal{Z})$ can also be decomposed as \begin{align*} {\cal P}_T(\mathcal{Z}) = \sum_{i,j,k} \<{\cal P}_T(\mathcal{Z}), \tc{e}_{ik} \diamond_{\bf \Phi} \ddot{\bm{e}}_k \diamond_{\bf \Phi} \tc{e}^{H}_{jk}\> \tc{e}_{ik} \diamond_{\bf \Phi} \ddot{\bm{e}}_k \diamond_{\bf \Phi} \tc{e}^{H}_{jk}, \end{align*} where $T$ is defined as \eqref{e1}. Similarly, \begin{align} \rho^{-1}{\cal P}_T{\cal P}_{\Omega}{\cal P}_T(\mathcal{Z}) = \sum_{i,j,k} \rho^{-1}\delta_{ijk}\<\mathcal{Z}, {\cal P}_T(\tc{e}_{ik} \diamond_{\bf \Phi} \ddot{\bm{e}}_k \diamond_{\bf \Phi} \tc{e}^{H}_{jk})\>{\cal P}_T(\tc{e}_{ik} \diamond_{\bf \Phi} \ddot{\bm{e}}_k \diamond_{\bf \Phi} \tc{e}^{H}_{jk}). \nonumber \end{align} Define the operator $\mathcal{T}^{ijk}$ as: \begin{align*} \mathcal{T}^{ijk}(\mathcal{Z})=\rho^{-1}\delta_{ijk}\<\mathcal{Z}, {\cal P}_T(\tc{e}_{ik} \diamond_{\bf \Phi} \ddot{\bm{e}}_k \diamond_{\bf \Phi} \tc{e}^{H}_{jk})\>{\cal P}_T(\tc{e}_{ik} \diamond_{\bf \Phi} \ddot{\bm{e}}_k \diamond_{\bf \Phi} \tc{e}^{H}_{jk}). \end{align*} Then by the definition of tensor operator norm, we can get \begin{align*} \|\mathcal{T}^{ijk}\|_{\textup{op}} =\frac{1}{\rho}\|{\cal P}_T(\tc{e}_{ik} \diamond_{\bf \Phi} \ddot{\bm{e}}_k \diamond_{\bf \Phi} \tc{e}^{H}_{jk})\|^2_F, ~\text{and}~\|{\cal P}_T\|_{\textup{op}} \leq 1. \end{align*} Note the fact that for any two positive semidefinite matrices ${A},{B}\in\mathbb{C}^{n\times n}$, we have $\|{A} - {B}\| \leq \max\{\|{A}\|, \|{B}\|\}.$ Therefore, by the inequality given in Proposition \ref{pro1}, we have \begin{equation} \Big\|\mathcal{T}^{ijk} - \frac{1}{n_1n_2n_3}{\cal P}_T\Big\|_{\textup{op}} \leq \max\left\{\frac{1}{\rho}\|{\cal P}_T(\tc{e}_{ik} \diamond_{\bf \Phi} \ddot{\bm{e}}_k \diamond_{\bf \Phi} \tc{e}^{H}_{jk})\|^2_F, \frac{1}{n_1n_2n_3}\right\} \leq \frac{2\mu \sum{r_{i}}}{n_{(2)}n_{3}\rho}. \nonumber \end{equation} In addition, one has \begin{align} &~\Big\|\mathbb{E}\Big(\mathcal{T}^{ijk}- \frac{1}{n_1 n_2 n_3}{\cal P}_T\Big)^2\Big\|_\textup{op}\nonumber\\ \leq &~\left\|\mathbb{E}\left(\frac{1}{\rho}\|{\cal P}_T(\tc{e}_{ik} \diamond_{\bf \Phi} \ddot{\bm{e}}_k \diamond_{\bf \Phi} \tc{e}^{H}_{jk})\|^2_F\mathcal{T}^{ijk}\right) - \frac{2}{n_1 n_2 n_3}{\cal P}_T\mathbb{E}(\mathcal{T}^{ijk}) + \frac{1}{n^2_1n^2_2n^2_3}{\cal P}_T\right\| \nonumber\\ =& ~ \left\|\frac{1}{\rho}\|{\cal P}_T(\tc{e}_{ik} \diamond_{\bf \Phi} \ddot{\bm{e}}_k \diamond_{\bf \Phi} \tc{e}^{H}_{jk})\|^2_F\frac{1}{n_1n_2n_3}{\cal P}_T - \frac{1}{n^2_1 n^2_2 n^2_3}{\cal P}_T\right\| \leq \frac{2\mu \sum{r_{i}}}{n_{(1)}n^2_{(2)}n^2_3\rho}. \nonumber \end{align} Setting $\tau = \sqrt{\frac{14 \mu \beta \sum{r_{i}} \log(n_{(1)}n_3)}{3n_{(2)}n_{3}\rho}} \leq \frac{1}{2}$ with any $\beta>1$ and using Lemma~\ref{lem5}, we have \begin{align} &\mathbb{P}[\|\rho^{-1}{\cal P}_T{\cal P}_{\Omega}{\cal P}_T - {\cal P}_T\|_\textup{op} > \tau] = \mathbb{P}\left[\left\|\sum_{i,j,k} \left(\mathcal{T}^{ijk} - \frac{1}{n_1n_2n_3}{\cal P}_T\right)\right\|_{\textup{op}}> \tau \right] \nonumber\\ \leq~ & 2n_{(1)}n_3\exp\Bigg(\frac{\frac{-7 \mu \beta\sum{r_{i}} \log(n_{(1)}n_3)}{3n_{(2)}n_{3}\rho}}{\frac{2\mu \sum{r_{i}}}{n_{(2)}n_{3}\rho} + \frac{2\mu \sum{r_{i}}}{6n_{(2)}n_{3}\rho}}\Bigg) = 2n_{(1)}n_3\exp({-\beta \log n_{(1)}n_{3}})= 2(n_{(1)}n_3)^{1-\beta}, \nonumber \end{align} which implies that \begin{align} \mathbb{P}\left[\|\rho^{-1}{\cal P}_T{\cal P}_{\Omega}{\cal P}_T - {\cal P}_T\|_\textup{op} \leq \epsilon\right] \geq 1 - 2(n_{(1)} n_3)^{1-\beta}.\nonumber \end{align} This completes the proof. \vspace{2mm} \noindent \section*{Appendix B. Proof of Lemma \ref{lemma2}} Denote $$ \rho^{-1}\mathcal{P}_{\Omega}(\mathcal{Z})-\mathcal{Z}= \sum_{i,j,k}\mathcal{G}^{ijk}=\sum_{i,j,k}\Big(\frac{1}{\rho}\delta_{ijk}-1\Big)\mathcal{Z}_{ijk}\tc{e}_{ik} \diamond_{\bf \Phi} \ddot{\bm{e}}_k \diamond_{\bf \Phi} \tc{e}^{H}_{jk}. $$ Then by the independence of $\delta_{ijk}$, we have $\mathbb{E}[\mathcal{G}^{ijk}]=\bf{0}$ and $\|\mathcal{G}^{ijk}\|\leq \frac{1}{\rho}\|\mathcal{Z}\|_{\infty}.$ Moreover, \begin{align*} \left\|\mathbb{E}\left[\sum_{i,j,k}(\mathcal{G}^{ijk})^H\diamond_{\bf \Phi}\mathcal{G}^{ijk}\right]\right\| & =\left\|\sum_{i,j,k}|\mathcal{Z}_{ijk}|^2\tc{e}_{jk}\diamond_{\bf \Phi}\tc{e}_{jk}^H\mathbb{E}\left(\frac{1}{\rho}\delta_{ijk}-1\right)^2\right\| \\ & =\left\|\frac{1-\rho}{\rho}\sum_{i,j,k}|\mathcal{Z}_{ijk}|^2\tc{e}_{ik}\diamond_{\bf \Phi}\tc{e}_{ik}^H\right\|. \end{align*} Recall the definition of tensor basis, we can get that ${\bf \Phi}[\tc{e}_{jk}\diamond_{\bf \Phi}\tc{e}_{jk}^H]$ is a tensor except the $(j,j,t)$-th tube entries equaling to $({\bf \Phi}[\tub{e}_{k}])_{t}^2=\alpha^2_{t}, t=1,\ldots,n_3 $ with $\sum_{t=1}^{n_{3}}\alpha_{t}^2=1,$ and 0 otherwise. Hence, we get that \begin{align*} \left\|\mathbb{E}\left[\sum_{i,j,k}(\mathcal{G}^{ijk})^H\diamond_{\bf \Phi}\mathcal{G}^{ijk}\right]\right\| &=\frac{1-\rho}{\rho}\left\|\sum_{i,j,k}|\mathcal{Z}_{ijk}|^2\tc{e}_{jk}\diamond_{\bf \Phi}\tc{e}_{jk}^H\right\| \\ & =\frac{1-\rho}{\rho}\max_{j}\left\|\sum_{i,j,k}|\mathcal{Z}_{ijk}|^2\tc{e}_{jk}\diamond_{\bf \Phi}\tc{e}_{jk}^H\right\|\\ &=\frac{1-\rho}{\rho}\max_{j}\left\|\sum_{i,k}|\mathcal{Z}_{ijk}|^2(\overline{\tc{e}}_{jk})_{\bf \Phi}\cdot(\overline{\tc{e}}_{jk})_{\bf \Phi}^H\right\| \leq \frac{1}{\rho}\|\mathcal{Z}\|^2_{\infty,w}. \end{align*} Moreover, $\left\|\mathbb{E}\left[\sum_{i,j,k}\mathcal{G}^{ijk}\diamond_{\bf \Phi}(\mathcal{G}^{ijk})^H\right]\right\|$ can be also bounded similarly. Then by Lemma \ref{lem5}, we can get that \begin{align*} \|\rho^{-1}\mathcal{P}_{\Omega}(\mathcal{Z})-\mathcal{Z}\|_\textup{op}\leq c\left(\frac{\log(n_{(1)}n_{3})}{\rho}\|\mathcal{Z}\|_{\infty}+\sqrt{\frac{\log (n_{(1)}n_{3})}{\rho}}\|\mathcal{Z}\|_{\infty,w}\right) \end{align*} holds with high probability provided that $m\geq C_0 \epsilon^{-2} \mu \sum{r_{i}}n_{(1)}\log(n_{(1)}n_3).$ \vspace{2mm} \noindent \section*{Appendix C. Proof of Lemma \ref{le3}} Denote the weighted $b$-th lateral slice of $(\rho^{-1}\mathcal{P}_{T}\mathcal{P}_{\Omega}-\mathcal{P}_{T})\mathcal{Z}$ as \begin{align*} \sum_{i,j,k}\mathcal{F}^{ijk}:&=(\rho^{-1}\mathcal{P}_{T}\mathcal{P}_{\Omega}-\mathcal{P}_{T})\mathcal{Z}\diamond_{\bf \Phi}\tc{e}_{bk} \\ &=\sum_{i,j,k}\Big(\frac{1}{\rho}\delta_{ijk}-1\Big)\mathcal{Z}_{ijk}\mathcal{P}_{T}(\tc{e}_{ik} \diamond_{\bf \Phi} \ddot{\bm{e}}_k \diamond_{\bf \Phi} \tc{e}^{H}_{jk})\diamond_{\bf \Phi}\tc{e}_{bk}, \end{align*} where $\mathcal{F}^{ijk}\in \mathbb{C}^{n_1 \times 1 \times n_3}$ are zero-mean independent lateral slices. By the incoherence conditions given in Proposition \ref{pro1}, we have \begin{align*} \|\mathcal{F}^{ijk}\|_{{F}}=\left\|\left(\frac{1}{\rho}\delta_{ijk}-1\right)\mathcal{Z}_{ijk}\mathcal{P}_{T}(\tc{e}_{ik} \diamond_{\bf \Phi} \ddot{\bm{e}}_k \diamond_{\bf \Phi} \tc{e}^{H}_{jk})\diamond_{\bf \Phi}\tc{e}_{bk}\right\|_{{F}} \leq \frac{1}{\rho}\sqrt{\frac{2\mu \sum_{i=1}^{n_{3}}r_{i}}{n_{1}n_3}}\|\mathcal{Z}\|_{\infty}. \end{align*} Furthermore, \begin{align*} \left\|\mathbb{E}\left[\sum_{i,j,k}(\mathcal{F}^{ijk})^H\diamond_{\bf\Phi}\mathcal{F}^{ijk}\right]\right\|_{{F}} =\frac{1-\rho}{\rho}\sum_{i,j,k}|\mathcal{Z}_{ijk}|^2\|\mathcal{P}_{T}(\tc{e}_{ik} \diamond_{\bf \Phi} \ddot{\bm{e}}_k \diamond_{\bf \Phi} \tc{e}^{H}_{jk})\diamond_{\bf\Phi}\tc{e}_{bk}\|^2_{{F}}. \end{align*} Then by the definition of $\mathcal{P}_{T}$, we can get \begin{align*} &~\|\mathcal{P}_{T}(\tc{e}_{ik} \diamond_{\bf \Phi} \ddot{\bm{e}}_k \diamond_{\bf \Phi} \tc{e}^{H}_{jk})\diamond_{\bf \Phi}\tc{e}_{bk}\|^2_{F}\\ =&~\|\mathcal{U}\diamond_{\bf \Phi}\mathcal{U}^H\diamond_{\bf\Phi}\tc{e}_{ik} \diamond_{\bf \Phi} \ddot{\bm{e}}_k \diamond_{\bf \Phi} \tc{e}^{H}_{jk}\diamond_{\bf \Phi}\tc{e}_{bk} \\ &~~~~+(\mathcal{I}_{\bf \Phi}-\mathcal{U}\diamond_{\bf\Phi}\mathcal{U}^H)\diamond_{\bf\Phi}\tc{e}_{ik} \diamond_{\bf \Phi} \ddot{\bm{e}}_k \diamond_{\bf \Phi} \tc{e}^{H}_{jk}\diamond_{\bf\Phi}\mathcal{V}\diamond_{\bf\Phi} \mathcal{V}^H\diamond_{\bf \Phi}\tc{e}_{bk}\|^2_{{F}}\\ \leq&~\frac{\mu \sum_{i=1}^{n_{3}}r_{i}}{n_{1}n_3}\|\ddot{\bm{e}}_k\diamond_{\bf \Phi}\tc{e}_{jk}\diamond_{\bf \Phi}\tc{e}_{bk}\|^2_{{F}} +\|\tc{e}_{jk}^H\diamond_{\bf\Phi}\mathcal{V}\diamond_{\bf\Phi} \mathcal{V}^H\diamond_{\bf \Phi}\tc{e}_{bk}\|^2_{{F}}. \end{align*} Therefore, we obtain \begin{align*} ~& \left\|\mathbb{E}\left[\sum_{i,j,k}(\mathcal{F}^{ijk})^H\diamond_{\bf\Phi}\mathcal{F}^{ijk}\right]\right\|_{F} \\ \leq ~& \frac{1}{\rho}\sum_{i,j,k}|\mathcal{Z}_{ijk}|^2\|\mathcal{P}_{T}(\tc{e}_{ik} \diamond_{\bf \Phi} \ddot{\bm{e}}_k \diamond_{\bf \Phi} \tc{e}^{H}_{jk})\diamond_{\bf\Phi}\tc{e}_{bk}\|^2_{{F}}\\ \leq ~& \frac{1}{\rho}\sum_{i,j,k}|\mathcal{Z}_{ijk}|^2\frac{\mu \sum_{i=1}^{n_{3}}r_{i}}{n_{1}n_3}\|\ddot{\bm{e}}_k\diamond_{\bf \Phi}\tc{e}_{jk}\diamond_{\bf \Phi}\tc{e}_{bk}\|^2_{{F}} +\frac{1}{\rho}\sum_{i,j,k}|\mathcal{Z}_{ijk}|^2\|\tc{e}_{jk}^H\diamond_{\bf\Phi}\mathcal{V}\diamond_{\bf\Phi} \mathcal{V}^H\diamond_{\bf \Phi}\tc{e}_{bk}\|^2_{{F}}\\ \leq ~& \frac{\mu \sum_{i=1}^{n_{3}}r_{i}}{\rho n_{1}n_3}\|\mathcal{Z}\|^2_{\infty,w}+\frac{1}{\rho}\sum_{i,k}|\mathcal{Z}_{ijk}|^2\|\tc{e}_{jk}^H\diamond_{\bf\Phi}\mathcal{V}\diamond_{\bf\Phi} \mathcal{V}^H\diamond_{\bf \Phi}\tc{e}_{jk}\|^2_{{F}}\\ \leq ~& \frac{2\mu \sum_{i=1}^{n_{3}}r_{i}}{\rho n_{(2)}n_3}\|\mathcal{Z}\|_{\infty,w}^2, \end{align*} where the third inequality can be derived by $\tc{e}_{jk}^H\diamond_{\bf\Phi}\tc{e}_{bk}=\bf{0}$ if $j\neq b.$ By the same argument, $\left\|\mathbb{E}[\sum_{ijk}\mathcal{F}^{ijk}\diamond_{\bf\Phi}(\mathcal{F}^{ijk})^H]\right\|_{F}$ can be bounded by the same quantity. Therefore, by Lemma \ref{lem5}, we get that \begin{align*} \|(\rho^{-1}\mathcal{P}_{T}\mathcal{P}_{\Omega}-\mathcal{P}_{T})\mathcal{Z}\diamond_{\bf \Phi}\tc{e}_{bk}\|_{{F}}\leq \frac{1}{2}\|\mathcal{Z}\|_{\infty,w}+\frac{1}{2}\sqrt{\frac{n_{(1)}n_{3}}{\mu \sum_{i=1}^{n_{3}}r_{i}}}\|\mathcal{Z}\|_{\infty} \end{align*} holds with high probability. We can also get the same results with respect to $\tc{e}^H_{ak}\diamond_{\bf \Phi}(\rho^{-1}\mathcal{P}_{T}\mathcal{P}_{\Omega}-\mathcal{P}_{T})\mathcal{Z}.$ Then Lemma \ref{le3} follows from using a union bound over all the tensor columns and rows, and the desired results hold with high probability. \bibliographystyle{abbrv}
{'timestamp': '2022-01-25T02:33:42', 'yymm': '2012', 'arxiv_id': '2012.08784', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08784'}
arxiv
\section{} \begin{abstract} Online experimentation, also known as A/B testing, is the gold standard for measuring product impacts and making business decisions in the tech industry. The validity and utility of experiments, however, hinge on unbiasedness and sufficient power. In two-sided online marketplaces, both requirements are called into question. The Bernoulli randomized experiments are biased because treatment units interfere with control units through market competition and violates the “stable unit treatment value assumption”(SUTVA). The experimental power on at least one side of the market is often insufficient because of disparate sample sizes on the two sides. Despite the important of online marketplaces to the online economy and the crucial role experimentation plays in product improvement, there lacks an effective and practical solution to the bias and low power problems in marketplace experimentation. Our paper fills this gap by proposing an experimental design that is unbiased in any marketplace where buyers have a defined budget, which could be finite or infinite. We then provide generalizable system architecture for deploying this design to online marketplaces. Finally, we confirm our findings with empirical performance from experiments run in two real-world online marketplaces. \end{abstract} \keywords{A/B testing, controlled experiment, interference, online marketplaces} \section{Introduction} Online experimentation (also known as A/B testing) has become the gold standard for measuring product impact and making business decisions in the tech industry. Companies such as Google, Facebook, Amazon, Microsoft and LinkedIn have all embraced this paradigm and built in-house platforms to enable large-scale online experimentation \citep{10.1145/1835804.1835810, letham2019, Deng2016, Kohavi2012, 10.1145/2783258.2788602}, commercial platforms have also emerged to provide online experimentation as a service to the broader audience\cite{10.1145/3097983.3097992}. Because of the crucial role online experimentation plays in decision making and the scale at which it impacts the business, it is of utmost importance to ensure the unbiasedness and power of experiments. When an experiment is biased, the impact estimate is systematically incorrect and the quality of business decisions is compromised. This is especially detrimental if the bias is systematic. When the experiments do not have enough power, even large impacts are not statistically significant and are incorrectly neglected as "neutral", and when impacts do get detected, the throughput of experiments, therefore speed of innovation, is limited. These considerations are precisely why the majority of online experimentation literature is devoted to either designing unbiased experiments under an interference structure \citep{10.1145/3097983.3098192, DesignandAnalysisofExperimentsinNetworksReducingBiasfromInterference}, or to increasing the power of an unbiased experiment \citep{10.1145/2433396.2433413}. The optimal strategy for designing unbiased and powerful experiments is highly dependent on the underlying interference structure. The most studied example of interference in the tech industry is that of the online social network \citep{10.1145/3097983.3098192, DesignandAnalysisofExperimentsinNetworksReducingBiasfromInterference}, where each unit is the same type of entity (for example, a member of a social network). Each unit can connect with other units and interact with her connections. Another important interference structure in online platforms, yet received little coverage, is that of online marketplaces. Unlike in a social network, the marketplace population consists of at least two types of units, sellers who offer goods, services or attention and buyers who purchase them with some currency. Marketplaces are an important part of the online economy, and usually are the products responsible for revenue generation in a tech companies. Therefore, it is important for both tech companies and the health of the online economy that we are able to experiment in online marketplaces unbiasedly and with high power. Some examples of online marketplaces are ads marketplace, where advertisers purchase the attention of platform members in the form of ads impressions \citep{GoogleAds, FacebookAds}; hiring marketplace, where employers purchase the attention of job seekers in the form of job postings; and education platforms, where buyers purchase courses from educators that offer them. The interference and network structure in online marketplaces present experimentation challenges to both unbiasedness and power. Bernoulli randomized experiments on either the seller-side or buyer-side violate the ``stable unit treatment value assumption”(SUTVA) \citep{doi:10.1198/016214504000001880, Johari2020ExperimentalDI} and are biased. To illustrate why SUTVA is violated, we use seller-side Bernoulli randomized experiments as an example. When a treatment increases the competitiveness of sellers, unless all buyers still have enough budget reserve to purchase more, the increased attractiveness of treatment sellers translates to relatively less attractiveness of control sellers, and the control sales decreases as treatment sales increases. Such interference in marketplaces violates the SUTVA assumption, which states a unit's potential outcome should depend only on the treatment it receives and not on treatments other units receive. Analogous argument explains why buyer-side Bernoulli randomized experiments also violate SUTVA and are biased. In the marketing sphere, this bias is termed the ``cannibalization bias", to highlight the fact that treatment sales is higher than control sales not because total sales grows, but because treatment sales ``cannibalizes" on control sales. Making a decision based on Bernoulli randomized experiments when cannibalization is present results in systematic overestimation of treatment effects. In any real-world marketplace, there are always limits to buyers' budgets and sellers' inventory, therefore both seller-side and buyer-side Bernoulli randomized experiments are subject to the cannibalization bias. Beyond the cannibalization bias, marketplace experimentation is also plagued with insufficient experimental power. This happens because the two sides of the market usually consist of different types of entities, and are drastically disparate in numbers. For example, in an Ads marketplace, where buyers are enterprise advertisers or agencies, and sellers are consumer users, the number of buyers \citep{googleAdvertiser} can be three orders of magnitude smaller than the number of sellers \citep{googleStats}. Similarly, in a physical goods marketplace, where buyers are consumers and sellers are more likely to be small businesses, the number of buyers is 60 times larger than the number of sellers \citep{amazonStats}. This disparity in sample size naturally leads to disparity in experimental power, and the insufficient power will be further exacerbated if the side with smaller sample size also has longer tails in metric distributions. This power disparity, or relative insufficiency on one side of the marketplace is undesirable because the marketplace business is only sustainable if both sides continues to be optimized, and one side of the marketplace having significantly lower experimental power means the speed of innovation and optimization is throttled on this side. Solutions to marketplace experimentation in existing literature roughly follow two approaches: the analysis approach which first models the interference structure and cannibalization bias, and then apply model-based adjustments to the biased Bernoulli randomized experiments \citep{Johari2020ExperimentalDI, 10.1145/2600057.2602837}; the design approach, which explore alternative designs that are unbiased under weak and verifiable assumptions on the marketplace \citep{doi:10.1080/01621459.2018.1527225, ebayMarket, DBLP:conf/aistats/BasseSL16}. The analysis approach typically requires first simplifying the marketplace to a parametric model, when the modeling assumptions themselves are often untestable. In fact, if the model could accurately capture the marketplace, experimentation is not necessary and treatment effects can be measured through simulations. Some design approaches \citep{doi:10.1080/01621459.2018.1527225, ebayMarket} are successful in achieving low bias under reasonable assumption, but the low bias comes at the cost of even lower power. Our paper contributes to the marketplace experimentation literature by proposing the budget-split design which overcomes both the bias and power challenges. The unbiasedness of the budget-split design requires one easy-to-validate assumption only, which is the buyers have a continuous budget (the budget can be finite or infinite). It is up to 30 times more powerful than alternative designs when deployed in the real-world marketplaces. The implementation and deployment of this design does not require an overhaul of the existing online marketplace infrastructure or the experimentation platform. Rather, only incremental changes to modules of the infrastructure. We note that our design shares some similarities with the budget allocation design in \cite{DBLP:conf/aistats/BasseSL16}. Although both designs split the ``budgets'' in some ways, they are fundamentally different: in \cite{DBLP:conf/aistats/BasseSL16}, an indirect, artificial “budget” (quota) is given to each buyer while the budget-split design considers the direct, natural budget that the buyers define. We also notice a recent blogpost in \cite{stitchFixBlog} that outlines an inventory-split counterpart of the budget-split design. Our formal analysis of the budget-split design can be directly applied to the inventory-split settings with little modification. The impact of the budget-split design is significant. It has enabled marketplace experimentation free of cannibalization bias; boosted experimental power to detect treatment effects that previously would have been dominated by noise. As a result, marketplace innovation and optimizations are carried out with much higher confidence and velocity. In this paper, we use the ads marketplace as a running example to present the budget-split design. The methodology, system architecture and empirical results can be readily extend to any marketplace where the buyer has a well-defined budget, such as the hiring marketplace. The rest of the paper is organized as follows. In Section 2, the causal inference problem in marketplaces is formally defined using the potential outcome framework. Section 3 introduces the budget-split design contrasts it with alternative designs such as cluster-based randomization and alternating-day design. Section 4 highlights the key considerations in system architecture and deployment of the budget-split design to online marketplaces. The empirical results on unbiasedness and power of the budget-split design are reported in Section 5. Finally, Section 6 concludes the paper with discussions and future research. \section{Experimentation in online ads marketplace} \label{sec:oam} Experiments in an online ads marketplace (OAM) falls into the family of bipartite experiments where experimentation takes place in a bipartite graph, linking two types of entities -- the buyers and the sellers\citep{pouget2019variance, doudchenko2020causal}. \textit{Sellers} are consumer members who visit the website, offer their attention and create requests for ads impressions, while \textit{buyers} are advertisers that fulfill these requests with ads impressions. Each member visit can result in multiple ads requests to ``sell'' (i.e., the webpage can have multiple slots to show ads impressions during one visit). Each advertiser can create multiple \textit{campaigns} that serve difference purposes, have different budgets, and target different member segments. Without loss of generality, we set our experimental units on the two sides as members and campaigns. Our framework can be applied to units at other granularity levels though. For example, it is common to set member sessions as the seller side units (finer) and advertisers as the buyer side units (coarser). Suppose the marketplace contains $N$ members and $M$ campaigns, denoted by $i\in [N]=\{1,2,\ldots, N\}$ and $\cC_j, j\in [M]=\{ 1,2,\ldots, M\}$, respectively. For the $j$-th campaign $\cC_j$, let $B_j \geq 0$ be its budget and the member set $I_j \subset [N]$ be its target population. Let $\bm{B}=\{B_1,B_2,\ldots,B_M \}$ denote the budgets of all campaigns. We note that targeting is at the member level. Thus if a member is targeted by a campaign, all requests created by this member are targeted. In addition, the campaigns can have different strategy and behavior, such as the bidding strategy and the pacing strategy. We do not model these details and instead simply represent these nuisances with parameter $\bThe_j$. With these notations, we write the entire OAM as $\mathcal{M} = \{ (\cC_j, I_j, B_j, \bThe_j)^M_{j=1}\}$. Figure~\ref{fig:illustration} gives an illustration of an OAM. There are two types of experiments in an OAM classified by the side of the market where the new feature is to be launched. When this feature acts on the seller-side, for example changing the placement of ads from top of the page to right rail of the page, a \textit{member-level experiment} (ME) or a seller-side experiment needs to be performed to test its effect where the randomization units are members. Similarly, when the feature acts on the buyer-side, such as adjusting the bid price of a campaign, we need to conduct a \textit{campaign-level experiment} (CE) or a buyer-side experiment where the randomization units are campaigns. In this paper, we use ME to introduce the ideas. The budget-split design we propose also applies to CE. To simplify the demonstration, we defer the discussion of CE to Section~\ref{sec:bs_campaign_level} and focus on ME for now. In an ME, let $W_i\in\{0,1\}$ be the treatment received by member $i$, $\bW = (W_1,\ldots, W_N)$ the treatment assignment vector of all members. Classical designs, such as the completely randomized design, can be directly applied to the seller side: \begin{defn}[Member-level completely randomized design] A member-level completely randomized design is a probability distribution $\eta$ on $\{0,1\}^N$ such that for some $1\leq N_1\leq N$, $\eta(\bW) = 1$ if $\sum^N_{i=1} W_i = N_1$ and $\eta(\bW) = 0$ otherwise. \end{defn} Unfortunately, as we show in Section~\ref{sec:cannibalization_bias} and Section~\ref{sec:6.2}, applying this design in OAM without modification and ignoring the buyer side can severely bias the treatment estimation. Similar bias is entailed when applying classical designs on the buyer side and ignoring the seller side. \def\mystrut{\vrule height 0.8cm depth 0.8cm width 0pt} \def\mystrutt{\vrule height 0.4cm depth 0.4cm width 0pt} \def\mystruttt{\vrule height 0.2cm depth 0.2cm width 0pt} \begin{figure}[!h] \begin{center} \resizebox{0.55\textwidth}{!}{ \begin{tikzpicture} \node[rectangle split, rectangle split parts=4, draw, minimum width=3cm, font=\large, rectangle split part fill={gray!40,white, white,white}, rectangle split part align={center}] (t1) { {$\mathbf{Adv_1}$} \nodepart{two} \mystrut $campaign_{11}$ \nodepart{three} \mystrutt $campaign_{12}$ \nodepart{four} \mystrutt $campaign_{13}$ }; \begin{scope}[xshift=7cm, yshift=0.5cm] \node[rectangle split, rectangle split parts=5, draw, minimum width=2cm,font=\small, rectangle split part fill={blue!15,white, white, white}, rectangle split part align={center}] (t2) { {$\mathbf{Member_1}$} \nodepart{two} $request_{11}$ \nodepart{three} $request_{12}$ \nodepart{four} $request_{13}$ \nodepart{five} $request_{14}$ }; \end{scope} \begin{scope}[xshift=0cm, yshift=-5.5cm] \node[rectangle split, rectangle split parts=3, draw, minimum width=3cm,font=\large, rectangle split part fill={gray!40,white, white,white}, rectangle split part align={center}] (t3) { {$\mathbf{Adv_2}$} \nodepart{two} \mystrutt $campaign_{21}$ \nodepart{three} \mystrut $campaign_{22}$ }; \end{scope} \begin{scope}[xshift=7cm, yshift=-3cm] \node[rectangle split, rectangle split parts=3, draw, minimum width=2cm,font=\small, rectangle split part fill={blue!15,white, white, white}, rectangle split part align={center}] (t4) { $\mathbf{Member_2}$ \nodepart{two} $request_{21}$ \nodepart{three} $request_{22}$ }; \end{scope} \begin{scope}[xshift=0cm, yshift=-9cm] \node[rectangle split, rectangle split parts=3, minimum width=4cm,font=\Large, rectangle split part align={center}] (t5) { \textbf{$\cdots$}}; \end{scope} \begin{scope}[xshift=7cm, yshift=-6cm] \node[rectangle split, rectangle split parts=3, draw, minimum width=2cm,font=\small, rectangle split part fill={blue!15,white, white, white}, rectangle split part align={center}] (t6) { $\mathbf{Member_3}$ \nodepart{two} $request_{31}$ \nodepart{three} $request_{32}$}; \end{scope} \begin{scope}[xshift=7cm, yshift=-9cm] \node[rectangle split, rectangle split parts=3, minimum width=2cm,font=\Large, rectangle split part align={center}] (t7) { \textbf{$\cdots$}}; \end{scope} \draw[->] (t1.two east) to [out=0, in=180](t2.text west); \draw[->] (t1.two east) to [out=0, in=180](t4.text west); \draw[->] (t1.two east) to [out=0, in=180](t6.text west); \draw[->] (t1.three east) to [out=0, in=180](t2.text west); \draw[->] (t1.four east) to [out=0, in=180](t2.text west); \draw[->] (t1.four east) to [out=0, in=180](t4.text west); \draw[->] (t3.two east) to [out=0, in=180](t4.text west); \draw[->] (t3.three east) to [out=0, in=180](t4.text west); \draw[->] (t3.three east) to [out=0, in=180](t6.text west); \draw[->] (t3.three east) to [out=0, in=180](t7.text west); \end{tikzpicture}} \vspace{-0.3cm} \end{center} \caption{An illustration of the online ads marketplace. The size of each campaign block represents its budget.} \label{fig:illustration} \end{figure} \subsection{Potential outcomes and causal estimands} \label{sec:po} We adopt the potential outcomes framework \citep{rubin1974estimating} for causal inference. For each $i\in[N]$ and $j\in[M]$, let $Y_{ij}(\bW;\bB)$ be the scalar potential outcome of member $i$ and campaign $\cC_j$ given the treatment assignment vector and the budgets. Note that the potential outcomes are specified for each $(member, campaign)$ pair, which is the finest level in our design. A similar setup is also considered in \cite{basse2016randomization}. This general setup allows outcomes measured at coarser levels to be written as aggregations. For example, for situations in \cite{doudchenko2020causal} and \cite{pouget2019variance} where the potential outcomes are specified in terms of only one side of the market, they can be defined by summing over indexes in $Y_{ij}(\bW;\bB)$ of the other side. Let $\bW_{-i}$ be the $(N-1)$ vector by removing the $i$-th element from $\bW$, we also consider an alternative parametrization of the potential outcomes as suggested by \cite{chin2018central}: $Y_{ij}(\bW;\bB)= Y_{ij}(W_i, \bW_{-i}; \bB)$. We focus on two metrics of special interests in an OAM: the value delivered to an advertiser and the revenue received by the marketplace operator. Specifically, let $Y_{ij}(\bW;\bB) \geq 0$ be the value delivered to campaign $\cC_j$ (in fact, to the underlying advertiser) by the ads requests created by member $i$. If $i\not\in I_j$, member $i$ is not in the target population of $\cC_j$ and $Y_{ij}(\bW;\bB)=0$ by definition. If $i\in I_j$, $\cC_j$ competes for the ads slots from member $i$'s visits with all other campaigns $\cC_{j^\prime}$ such that $i\in I_{j^\prime}$ by participating in an auction, such as the firce price auction or the generalized second price auction \citep{edelman2007internet}. Note that the potential outcomes depend on the campaign budgets. In an OAM, $\cC_j$'s own budget $B_j$ is used by the system to guide its pacing and bidding strategy \citep{agarwal2014budget}, affecting its own bid underlying each $Y_{ij}$. At the same time, the resulting $Y_{ij}$ also depends on bids from other campaigns, which are themselves determined by their own budgets and actual spending. Unlike in \citep{basse2016randomization}, we directly focus on the outcomes of the auction, ignoring the underlying bids as well as the auction mechanism for generality. Aside from the value delivered to the advertisers, another crucial metric is the corresponding revenue received by the marketplace operator, denoted as $Y^*_{ij}(\bW;\bB)$. It is worth noting that $Y^*_{ij}(\bW;\bB)$ may or may not equal $Y_{ij}(\bW;\bB)$. Due to the complex optimization procedure under the hood, $Y_{ij}$ depends on $\bm{B}$ in a ``not exact" manner, meaning that it is possible for $\sum_{i\in I_j}Y_{ij}(\bW;\bB) > B_j$, a phenomenon referred to as ``over-delivery". On the other hand, the platform cannot charge a campaign more than its budget. Therefore, we have for each $j$, \begin{equation} \begin{aligned} 0 \leq Y^*_{ij}(\bW;\bB) & \leq Y_{ij}(\bW;\bB) \\ \sum\limits_{i\in I_j} Y^*_{ij}(\bW;\bB) &\leq B_j. \end{aligned} \end{equation} In this work, we conduct inference conditioning on the potential outcomes and take treatment assignment as the only source of randomness. This randomization based inference strategy has the advantage of not entailing any modeling assumptions on $Y_{ij}(\bW;\bB)$. Due to the complex and evolving ecosystem in an OAM, modeling these potential outcomes can be extremely challenging. We would like to estimate the treatment effect in terms of the total delivered value and the total received revenue conditioning on the budgets: \begin{equation} \begin{aligned} \tau(\bB) & =\sum\limits_{j\in[M]} \sum\limits_{i\in I_j} [Y_{ij}(\bm{1};\bB) -Y_{ij}(\bm{0};\bB)] = \sum\limits_{j\in[M]} \tau_j(\bB) \\ \tau^*(\bB) & = \sum\limits_{j\in[M]} \sum\limits_{i\in I_j} [Y^*_{ij}(\bm{1};\bB) -Y^*_{ij}(\bm{0};\bB)] = \sum\limits_{j\in[M]} \tau^*_j(\bB), \end{aligned} \end{equation} where $\bm{1} = (1,1,\ldots,1)_N$ and $\bm{0} = (0,0,\ldots,0)_N$ denote the all treatment and all control treatment assignment. The validity of vanilla A/B testing hinges critically on the stable unit treatment value assumption (SUTVA) \citep{imbens2015causal}, which states that (i) there is only a single form of each treatment variant and (ii) a unit's potential outcome is unaffected by the treatment assignment of other units. The no interference assumption, however, is usually violated in marketplace experiments due to the limited campaign budgets. One special scenario where SUTVA at can be justified is in an imaginary world without budget constraints, so that the campaigns are free to bid on any of their targeted members based on their own evaluation of that member's value. This is essentially the SUTVA for bids assumption made by \cite{basse2016randomization}. Formally, we have \begin{assmp}[No interference under unlimited budget] If $B_j = \infty$ for each $j\in[M]$, we have $Y_{ij}(\bW; \bm{\infty}) = Y_{ij}(W_i; \bm{\infty})$. \label{assmp:sutva} \end{assmp} In this case, the following simple plug-in estimator is unbiased: \begin{equation} \begin{aligned} \hat\tau_j(\bm{\infty}) &= \sum\limits_{i\in I_j} \frac{W_i\cdot Y_{ij}(\bW; \bm{\infty})}{N_1/N} - \sum\limits_{i\in I_j} \frac{(1-W_i)\cdot Y_{ij}(\bW; \bm{\infty})}{N_0/N}, \end{aligned} \label{eq:naive} \end{equation} where $N_1 = \sum^{N}_{i=1}w_i$, $N_0 = N - N_1$. Moreover, since there is no budget constraint, $Y_{ij}^*(\bW) = Y_{ij}(\bW) = Y_{ij}(W_i)$ and the corresponding plug-in estimator $\hat\tau_j^*(\bm{\infty})$ for $\tau_j^*(\bm{\infty})$ is also unbiased. \subsection{Finite budget and the cannibalization bias} \label{sec:cannibalization_bias} In reality, it is very unlikely that ads campaigns have unlimited budgets. As a result, Assumption \ref{assmp:sutva} no longer holds and the potential outcomes are affected. With a finite budget, each campaign now needs to take a more ``global" view over all its target members when planning its bid such that the total budget is split to different members wisely. For example, if the treatment has an edge over the control, a wise campaign should take this advantage and allocate more budget to members in the treatment group, resulting in interference between the potential outcomes. Due to this interference, the naive estimator for $\tau_j(\bB)$ and $\tau^*_j(\bB)$ as in (\ref{eq:naive}) is no longer unbiased. To further illustrate this, we consider two examples. The first example illustrate that the naive estimator $\hat\tau_j^*(\bB)$ of $\tau_j^*(\bB)$ is biased in a very common scenario that can happen in a real OAM due to the strict budget constraints. The second example considers a more fundamental case, where even $\hat\tau_j(\bB)$ is biased. From now on, we assume that $0 < B_j < \infty$ for campaign $j\in [M]$. \begin{exam}[Full budget utilization] Imagine an OAM that has a single buyer with a \$100 budget, willing to purchase the sellers attention at \$20 per impression; and many sellers each with a different propensity to pay attention to the buyers ads. Naturally, to better serve both the buyer's and sellers' interest, the marketplace improves the algorithm for matching the buyer with sellers who are most interested paying attention to the buyers ads. If the buyer already manages to spend the \$100 budget under sub par seller ranking ($\sum _{i\in[N]}Y_{i1}^*(\bm{0}; 100) = 100$), then improving seller ranking cannot further increase the buyer spending because there simply is no untapped budget (by definition, $\sum _{i\in[N]}Y_{i1}^*(\bm{1}; 100) \leq 100$ and $\tau^*_1(100) \leq 0$). On the other hand, had we run a member-level completely randomized experiment, with sellers in treatment being ranked by a better algorithm, we would have observed a positive treatment effect of the improved algorithm from the plug-in estimator. \end{exam} \begin{exam}[Universally beneficial treatment with diminishing returns] For some campaign $j$ with $I_j = [N]$, suppose that {\small\begin{equation} \begin{aligned} & \hspace{0.3cm} Y_{ij}(0,|\bW_{-i}| = N - 1;\bB) \\ &< \cdots \\ & < Y_{ij}(0,|\bW_{-i}| = 1;\bB) \\ &< Y_{ij}(0,\bm{0};\bB) < Y_{ij}(1, \bm{1};\bB) \\ & < Y_{ij}(1, |\bW_{-i}| = N-2;\bB) \\ & < \cdots \\ & <Y_{ij}(1, |\bW_{-i}| = 0;\bB), \end{aligned} \label{eq:dimreturn} \end{equation}} for any $i\in [N]$, where for $0\leq K < N$, $Y_{ij}(W_i, |\bW_{-i}| = K;\bB) = \{Y_{ij}(W_i, \bW_{-i}; \bB): \sum_{i\in I_j}\bW_{-i} = K \}$. Intuitively, in this scenario, the treatment increases the value of each member. However, members in the treatment group are more valuable when the size of the treatment group is smaller; members in the control group are less valuable when the size of the treatment group is larger. (Consider an analogy to a job market in a county. If a job applicant is the only college graduate, he/she would probably be paid very high; with more and more applicants holding a college degree, the value of such a degree diminishes while those only holding a high school degree can find it harder to even get a job.) In this case, \begin{equation} \begin{aligned} & \hspace{0.55cm}\E[\hat\tau_j(\bB)] - \tau_j(\bB) \\ & = \left\{ \E\left[ \sum\limits_{i =1}^N \frac{W_i\cdot Y_{ij}(1, |\bW_{-1}| = N_{1} - 1;\bB)}{N_1/N}\right] - \sum\limits_{i=1}^NY_{ij}(1,\bm{1}; \bB)\right\} \\ & + \left\{ \sum\limits_{i=1}^NY_{ij}(0,\bm{0}; \bB) - \E\left[ \sum\limits_{i=1}^N \frac{(1-W_i)\cdot Y_{ij}(0, |\bW_{-1}| = |N_{1}| - 1;\bB)}{N_0/N}\right] \right\}. \end{aligned} \label{eq:canni} \end{equation} By (\ref{eq:dimreturn}), the two terms on the RHS are all positive. Thus $\hat\tau_j(\bB)$ has a positive bias. \end{exam} Note that in (\ref{eq:canni}), $\sum_{i=1}^NY_{ij}(1,\bm{1}; \bB)$ is overestimated while $\sum_{i=1}^NY_{ij}(0,\bm{0}; \bB)$ is underestimated. We thus refer to the bias of this naive estimator as the \textit{cannibalization bias} as the new version of the product appears to be having an edge over the old one in an experiment, not only because it drives extra values of members in treatment, but also because it ``cannibalises" the members' values in control. \subsection{Switchback design} \label{sec:alternating} One popular strategy to get rid of this cannibalization bias is to treat the entire OAM at different times as the experimental units and adopt the switchback design \citep{bojinov2020design}. Let $t=1,2,\ldots, T$ be $T$ ordered time points. The switchback design assigns random treatment to each $\mathcal{M}_t$. Thus for each fixed $t$, all units (members or campaigns depending on whether the experiment is ME or CE) are assigned to the control or the treatment simultaneously. Since only one treatment is active at any time, there is no cannibalization bias due to cross treatment group intervention. In practice, applying a switchback design to an OAM can be challenging. Firstly, although the design prevents any cross treatment interventions at any time point, it allows interventions across time points, often referred to as a carryover effect \citep{bojinov2020design}. In an OAM, the level of the carryover effect depends on the features being tested as well as other factors in the ecosystem. In general, it is hard to understand these carryover effects and analysis the switchback experiment properly. Secondly, a switchback experiment can be highly inefficient when it takes sometime for the effect of the feature to become measurable. For example, some features target at improving the performance of a campaign over a week. In this case, the time gap between different assignments has to be at least a week and the overall experimental period can stretch over weeks or even months. Thirdly, there is a conflict between the validity and the efficiency of a switchback experiment. On the one hand, a switchback experiment needs to run long enough to collect enough samples; on the other hand, it implicitly assumes that the OAM does not change much during the experimentation period, which is likely to be unrealistic when this period is long. \section{Budget-split design} In this section, we introduce a novel design that removes the cannibalization bias in both the member-level experiment and the campaign-level experiment in an OAM while bypassing the challenges in the switchback design. Our key motivation is that the cannibalization bias comes from interactions between units in different treatment groups. If these interactions are blocked, the cannibalization bias will not exist. Similar to the idea in \cite{ha2020counterfactual}, our goal is to simulate the two ``counterfactuals'' of the ads marketplace---one under the control and another under the treatment---with a design, such that a causal relationship can be established by directly comparing these two simulated marketplaces. The success of our strategy depends on two factors: (i) how similar the two simulated marketplaces are before the treatment, and (ii) how similar these simulated marketplaces are to the original marketplace before the treatment. As we shall see, our design automatically ensures (i), that is, the two marketplaces have exactly the same campaigns, very similar members, and the same underlying mechanism (i.e., auction mechanism, bidding strategy, etc.) We state (ii) formally in Assumption~\ref{assmp:average} and validate this assumption with real examples in Section~\ref{sec:6.2}. Without loss of generality, we assume $I_j=[N]$ for all $\cC_j, j\in[M]$ in this section. Recall that the original OAM is $\mathcal{M} = \{ (\cC_j, I_j, B_j, \bThe_j)^M_{j=1}\}$. We create two independent marketplaces $\mathcal{M}^{(0)}$ and $\mathcal{M}^{(1)}$ out of $\mathcal{M}$ with the following steps: \begin{enumerate} \item perform a random split of the members into two buckets of size $N^{(0)}$ and $N^{(1)} = N - N^{(0)}$. Let $d_i \in \{0, 1\}$ be the bucket indicator of member $i$ and $\bd = (d_1,d_2,\ldots, d_N)$; \item split the budget of each campaign $j$ accordingly: \begin{equation} \begin{aligned} B_j^{(0)} = \frac{N^{(0)}}{N}\cdot B_j &, \quad B_j^{(1)} = \frac{N^{(1)}}{N}\cdot B_j; \end{aligned} \end{equation} \item create a campaign $\cC_{j_0}$ with a budget $B_j^{(0)}$ and a target population $I_{j_0} = \{i: d_i = 0\}$. Let this campaign inherit all features (summarized by $\bThe_j$) from campaign $\cC_j$. Similarly, create a campaign $\cC_{j_1}$; \item replace $\mathcal{M}$ with two independent marketplaces: \begin{equation} \begin{aligned} \mathcal{M}^{(0)} & = \{ (\cC_{j_0}, I_{j_0}, B^{(0)}_j, \bThe_j)^M_{j_0=1}\}\\ \mathcal{M}^{(1)} & = \{ (\cC_{j_1}, I_{j_1}, B^{(1)}_j, \bThe_j)^M_{j_1=1}\}. \end{aligned} \end{equation} \end{enumerate} Recall that the treatment effect of interests is \begin{equation} \begin{aligned} \tau_j(\bB) = \sum\limits^{N}_{i=1} [Y_{ij}(\bm{1};\bB) - Y_{ij}(\bm{0};\bB)]. \end{aligned} \end{equation} Intuitively, under the budget split setup, we use one of the $\mathcal{M}^{(l)}$'s to estimate $\sum^{N}_{i=1}Y_{ij}(\bm{1};\bB)$, and use another to estimate $\sum^{N}_{i=1}Y_{ij}(\bm{0};\bB)$. To this end, let $\tilde W_l\in\{0,1\}$ be the treatment indicator of OAM $\mathcal{M}^{l}$, where $\tilde W_1 \sim \text{Bernoulli}(p)$ and $\tilde W_0 = 1-\tilde W_1$. If $\tilde W_l = 1$, we apply the treatment to members in bucket $l$; if $\tilde W_l = 0$, these members will receive the control. Let $\bB^{(l)} = \{ B_1^{(l)}, B_2^{(l)}, \ldots, B_M^{(l)} \}$ and $\bW^{(l)} = \{W_i: i\in I_{j_l} \}$ for $l=0,1$. Similar to the definition of $Y_{ij}(\bW;\bB)$, we define the potential outcomes associated with campaign $\cC_{j_l}$ as $Y_{ij}^{(l)}(\bW^{(l)}; \bB^{(l)}\mid \bm{d})$ for $l=0, 1$ and $i\in I_{j_l}$. Note that these potential outcomes also depend on $\bd$. (When defining these potential outcomes, we are actually making a no interference assumption, which is formally stated in Assumption~\ref{assmp:bucket}.) Given a split $\bd$, we consider the following estimator: \begin{equation} \begin{aligned} \hat\tau_j^{BS}(\bB) & = \sum\limits_{l=0,1} \tilde{W}_l\sum\limits_{i=1}^N\frac{\mathbbm{1}(d_i = l)Y_{ij}^{(l)}(\bm{1}_{N^{(l)}}; \bB^{(l)} \mid \bd)}{N^{(l)}/N} \\ & - \sum\limits_{l=0,1} (1-\tilde{W}_l) \sum\limits_{i = 1}^N \frac{\mathbbm{1}(d_i = l)Y_{ij}^{(l)}(\bm{0}_{N^{(l)}}; \bB^{(l)} \mid \bd)}{N^{(l)}/N}. \end{aligned} \label{eq:bs} \end{equation} To study the properties of $\hat\tau_j^{BS}(\bB)$, we first introduce the following definition: \begin{defn}[proportionally restricted campaign] For $j\in[M]$, we define a \textit{proportionally restricted version} of $\mathcal{C}_j$ as $\mathcal{C}_j(K)$, for $1\leq K\leq N$, such that $\mathcal{C}_j(K)$ is only allowed to target at $K$ members completely at random with a budget of $\cB_j(K) = KB_j/N$. Moreover, suppose that all campaigns are proportionally restricted in a coupled manner, that is, they are restricted to the same members. Then for each $i\in [N]$, we can define the potential outcomes associated with $\cC(K)$ as $\cY_{ij}(\bW;\cB(K) \mid \bm{d})$, where $\cB(K)=\{\cB_1(K), \ldots, \cB_M(K) \}$, $\bm{d} = (d_1, d_2,\ldots, d_N)$, $d_i$ the indicator of whether member $i$ is in the restricted target population. For convenience, we define $\cY_{ij}(\bW;\cB(K) \mid \bm{d}) = 0$ if $d_i = 0$. \end{defn} In practice, this definition is relevant to the throttling procedure that can be applied before the auctions take place \citep{basse2016randomization}. For example, due to resource constraint, the system could not afford to allow each campaign to bid for all its targeting members. We next state two assumptions on the potential outcomes of proportionally restricted campaigns. Assumption~\ref{assmp:bucket} limits the interference to members within the restricted target population. Assumption~\ref{assmp:average} ensures that the restricted campaigns are on average ``similar enough" to the unrestricted ones such that they can be used to perform inference about the original campaigns. \begin{assmp}[Limited interference] For each $i\in[N]$, $j\in[M]$ and $\bW$, we assume $\cY_{ij}(\bW;\cB(K) \mid \bm{d}) = \cY_{ij}(\bW_{\bm{d} = 1};\cB(K) \mid \bm{d})$, where $\bW_{\bm{d} = 1}$ represents the elements in $\bW$ with $\bm{d} = 1$. \label{assmp:bucket} \end{assmp} \begin{assmp}[Stable system] For each $j$ and $1\leq K\leq N$, we assume \begin{equation} \begin{aligned} \frac{1}{N}\sum\limits^{N}_{i=1}Y_{ij}(\bm{1};\bB) & = \E_{\bm{d}}\left[ \frac{1}{K}\sum\limits_{i=1}^N d_i \cY_{ij}(\bm{1}_K;\cB(K) \mid \bm{d}) \right] \\ \frac{1}{N}\sum\limits^{N}_{i=1}Y_{ij}(\bm{0};\bB) & = \E_{\bm{d}}\left[ \frac{1}{K}\sum\limits_{i=1}^N d_i \cY_{ij}(\bm{0}_K;\cB(K) \mid \bm{d}) \right]. \end{aligned} \end{equation} \label{assmp:average} \end{assmp} Assumption~\ref{assmp:average} characterizes a degree of stability of the system. It requires that a proportionally restricted campaign behaves in a similar manner to its original campaign so that the two created OAMs are similar to the original one. In practice, this assumption is more likely to hold when (i) $K$ is large and (ii) $N$ is large. When $K$ is close to $N$, the $\cC_j(K)$ is essentially $\cC_j$. When $K$ decreases, the ecosystem underlying $\cC_j(K)$ becomes less similar to that of $\cC_j$ and the reliability of this assumption decreases accordingly. In the extreme case when $K$ is close to $1$, $\cC_j(K)$ essentially loses all its flexibility in participating in auctions. As a result, the potential outcomes of $\cC_j(K)$ can be totally distorted from those of $\cC_j$. In reality, there is usually some burn-in threshold $K_0$ such that the system (i.e., the bidding strategies of the campaigns) stabilizes with $K_0$ members. In this case, if $N$ is very large such that $K > K_0$, $\cC_j(K)$ would behave very similarly to $\cC_j$. Fortunately, in OAM, $N$ is usually at least at the scale of millions, in which case $K > K_0$ can be easily satisfied with $K = O(N)$. We note that $K_0$ depends on the level of homogeneity of members. $K_0$ of a market where the members are very similar to each other is generally smaller than $K_0$ in a more heterogeneous market. \begin{thm}\label{thm1} Under Assumption~\ref{assmp:bucket} and Assumption~\ref{assmp:average}, if in addition $N^{(0)} = N^{(1)} = N/2$, $p = 0.5$, the budget split estimator in (\ref{eq:bs}) is unbiased: for each $j\in[M]$, \begin{equation} \begin{aligned} \E_{\tilde W_1, \bd}[\hat\tau_j^{BS}(\bB) ] = \tau_j(\bB). \end{aligned} \end{equation} \end{thm} The proof is standard and can be found in Appendix B. \subsection{Campaign-level experiments} \label{sec:bs_campaign_level} So far, we have been focusing on ME. Since the budget split framework creates two complete OAM with both the buyer side and the seller side, it can also be used for CE. A CE is involved when the features to be tested act on the buyer-side. Examples of such features include UI changes at the campaign management portal and adjustments to the underlying campaign bidding strategy. Similar to the setup in Section~\ref{sec:oam}, let $W^c_j \in \{0, 1\}$ be the treatment received by campaign $\cC_j$, $j\in[M]$ and let $Y^c_{ij}(\bW^c; \bB)$ be the corresponding potential outcomes. Again, we consider the treatment effect in terms of the total delivered value: \begin{equation} \begin{aligned} \tau^c(\bB) & =\sum\limits_{j\in[M]} \sum\limits_{i\in I_j} [Y^c_{ij}(\bm{1}^c;\bB) -Y^c_{ij}(\bm{0}^c;\bB)] = \sum\limits_{j\in[M]} \tau^c_j(\bB). \end{aligned} \end{equation} Under the budget split framework, the setup for CE is essentially the same as for ME. In this case, $\tau^c_j(\bB)$ is estimated directly by comparing the two campaigns $\cC_{j_0}$ and $\cC_{j_1}$ with an estimator similar to (\ref{eq:bs}). Although the same budget-split framework is used for both ME and CE, the resulting experiments have very different nature. In ME, the budget split design essentially performs a completely randomized experiment at the 50-50 split, where the treatment assignments coincide with the budget allocations. Here we adopt the budget split design to remove the cannibalization bias. In CE, the budget split design has a more direct motivation. Namely, we create two (approximately) identical replicates for each experimental units before the experiment and solve the ``fundamental problem of causal inference" \citep{holland1986statistics} by making the two potential outcomes of each unit directly observable. Instead of estimated or imputed, the potential outcomes are \textit{observed} under the budget split design. Therefore, the causal estimands are also observed directly. For CE, both the switchback design (SB) and the budget split design (BS) aim at creating ``counterfactuals" of any experimental unit (campaign) and making the potential outcomes observable under both treatments. In SB, campaign $\cC_j$ at different time points serve as its ``counterfactuals". In the BS, the ``counterfactuals" are represented by the two half-sized campaigns $\cC_{j_0}$ and $\cC_{j_1}$ that are active simultaneously. When making causal comparisons, SB keeps the size of the campaigns unchanged while BS controls for the time factor. \section{System Architecture} \label{sec:sys} Having presented the budget-split design and highlighted its advantages over member-level experiments, campaign-level experiments and switchback experiments, we now give guidelines for the system architecture changes for deploying this design onto the online ads marketplace. Note that the modules in the ads marketplace are also ubiquitous in other types of marketplaces such as hiring marketplaces and physical goods marketplaces. To set the context, we introduce the important components in the infrastructure of an online ads marketplace: \begin{enumerate} \item At the core of an online ads marketplace, is an \textbf{ad server} that receives incoming ads requests and responds with ads impressions in real time. Within the ads server, a pacing/bidding module controls the spending speed of each campaign, and eventually when to stop serving impressions. The pacing/bidding module makes serving decisions based on auction signals such as bid price, targeting and auction participation rate. \item The \textbf{tracker service} supports the ad server by keeping track of ads events such as impressions, clicks and tallying the campaign-level cumulative spending, along with other performance metrics, such as the click-through rate. Combined with the core ad server, it forms a feedback loop for ads serving, enabling the pacing/bidding module to be built as a feedback controller. \item Finally, the marketplace interfaces with advertisers through the \textbf{campaign management system}, where advertiers create and manage their ads campaigns, as well as get billed and reported on campaign performance. \end{enumerate} \begin{figure}[h] \centering \includegraphics[width=0.75\linewidth]{arch1.png} \caption{System architecture for the budget-split design.} \label{fig:arch} \end{figure} To implement the budget-split design, the components marked as blue in figure \ref{fig:arch} are modified, in the following ways: \begin{enumerate} \item In the request receiving and responding tier of the ad server, all requests from a member is randomized into either treatment or control depending on the member ID. This is the member-level randomization as described in Section 3. \item In the tracker service, treatment assignment in step 1 together with ads campaign ID are recorded in the tracking information of the request. \item In the pacing/bidding module of the ad server, all the originally campaign-level controller inputs are now replaced with their campaign-treatment-level counterparts. As an example, budget is now set at campaign-treatment-level as described in Section 3 rather than at campaign-level. Furthermore, feedback signals are provided at per-treatment level. Consequently, the pacing/bidding controller outputs auction signals at the campaign-treatment-level. Then, the real time auctions, along with any other serving decisions such as whether an ad should stop or resume serving, are carried out using the campaign-treatment-level signals in lieu of campaign-level ones. \end{enumerate} With these changes in place, the feedback data and control paths for each treatment become entirely independent of other treatments, for each campaign and across all campaigns. Effectively every treatment now owns a standalone marketplace. This is exactly an implementation of the budget-split design as defined in Section 3. \section{Empirical Results} The budget-split experimentation has since been deployed to two online marketplaces. Similar to what was proven in Section 3, it was shown to be much more powerful than alternative designs such as campaign-level experiments or switchback experiments; and not susceptible to cannibalization bias as campaign-level and member-level experiments are. \subsection{Power Gain} In the two marketplaces where budget-split was deployed, we compared the power curves of budget-split experiments versus campaign-level and switchback experiments. Switchback experiments were analyzed with paired permutation tests to boost the power; all other designs are analyzed with two-sample t-tests. \begin{figure}[h] \centering \includegraphics[width=0.6\linewidth]{power_ads.png} \caption{Power curves for marketplace 1} \label{fig1} \end{figure} \begin{figure}[h] \centering \includegraphics[width=0.6\linewidth]{power_jobs.png} \caption{Power curves for marketplace 2} \label{fig2} \end{figure} As shown in Figure \ref{fig1} and Figure \ref{fig2}, for the effect size that budget-split has 80\% power to detect, campaign-level experiments have power 5.2\% (Marketplace 1) and 12\% (Marketplace 2), while switchback experiments have only 5.1\% (Marketplace 1) and 5.2\% (Marketplace 2) power to detect the effect. Even though switchback experiments are expected to be unbiased when no carry-over effect exists in the marketplace, they practically have such low power that detecting treatment effects becomes challenging. It is worth noting that 5\% power is actually the lowest power possible for a 5\% level test. Campaign-level experiments are not only biased, but also just barely more powerful than switchback experiments. In practice, budget-split experiments have enabled detection of negative product impacts on the order of millions of dollars (in terms of annual revenue) that previously went undetected in a campaign-level experiment because of insufficient power. \subsection{Robustness against Cannibalization Bias}\label{sec:6.2} As discussed in Section 3, the budget-split design effectively removes interference between treatment units and control units through splitting the campaign budgets, and is not susceptible to the cannibalization bias even in place of market competition. In comparison, switchback experiments are unbiased when no carry-over effect is present; cluster-based randomization is unbiased when there is no interference among clusters, which often is not practically feasible\cite{10.1145/3097983.3098192}; member-level and campaign-level experiments are biased because they do not account for the interference from market competition at all. In this section, we compare the impacts measured in budget-split design versus in member-level experiments to showcase the amount of cannibalization bias. It is worth noting that budget-split design was not compared against campaign-level experiments, switchback experiments or cluster-based experiments because these designs are too insufficiently powered for comparison. \begin{figure}[h] \centering \includegraphics[width=0.6\linewidth]{Cannibalization_bias.png} \caption{Measurement of Cannibalization Bias} \label{fig3} \end{figure} The presence of cannibalization bias in marketplace experiment when interference are not accounted for is confirmed in Figure \ref{fig3}. The exact amount of bias depends on the nature of the treatment, but not accounting for interference typically results in one to two times overestimation of the treatment effect. We have not yet encountered a treatment where cannibalization bias changes the sign of the treatment effect, but this is not impossible if, for example, the treatment positively impacts budget-constraint campaigns and negatively impacts non budget-constraint campaigns. \section{Discussions} In this paper, we presented the budget-split design as the solution to cannibalization bias and insufficient power in marketplace experimentation. Rather than relying on modeling assumptions that are often impossible to validate, the budget-split design only requires one side of the marketplace having a defined and splittable budget, and no additional assumptions. We formulated the marketplace experimentation problem under the potential outcome framework, defined the estimand, derived an unbiased estimator for the estimand under budget-split design. We showed the bias and variance reduction nature of budget-split design relative to alternative designs with empirical results. This work, however, is only the start of experimentation in online marketplaces. Future work is need to accurately compute the variance estimators under the budget-split design; extend the budget-split design to marketplaces where the budget is discrete; and increase throughput of budget-split experiments by enabling multiple simultaneous orthogonal budget-split experiments in the marketplace. \section*{Acknowledgements} We would like to thank Weitao Duan, Shan Ba, Xingyao Ye and Giorgio Martini for their careful review and feedback; Wei Wei, Qing Duan, Di Luo for implementing the budget-split platform; Shahriar Shariat, Vangelis Dimopoulos, Giorgio Martini and Junyu Yang for contributing to experimental and metric designs and analyses; and everyone who utilized and helped improve the platform. We would also like to thank Ya Xu, Parvez Ahammad, Le Li and Jerry Shen for their continued support. The authors declare no conflict of interest.
{'timestamp': '2020-12-17T02:08:32', 'yymm': '2012', 'arxiv_id': '2012.08724', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08724'}
arxiv
\section{Introduction} In the IR traditional setting, a user expresses his information needs with the help of a query. Yet, it is sometimes difficult to match the query with the documents, for instance because of the query vocabulary may differ from the documents. Especially when the query is short, the performance of the system is usually poor, as it is difficult to detect the precise focus of the information need, and the relative importance of the query terms. Query expansion aims at tackling these problems by transforming the short query into a larger text (or set of words) that make it easier to match documents from the collection. The main difficulty of query expansion is obviously to add only relevant terms to the initial query. Several techniques have been proposed in the literature, based on linguistic resources (e.g. synonym lists) or based on the documents themselves (e.g. pseudo-relevance feedback). In this paper, we explore the use of recent text generation models to expand queries. We experimentally demonstrate that the recent advances in neural generation can dramatically improve ad-hoc retrieval, even when dealing with specialized domains. More precisely, through different experiments, we show that: \begin{enumerate} \item texts artificially generated from the query can be used for query expansion; \item this approach does not only provide new terms to the query, but also a better estimate of their relative weights; \item in addition, it also provides a better estimate of the importance (i.e. weight) of original query words; \item this approach can also be used on specialized domains. \end{enumerate} The paper is structured as follows. After a presentation of the related work, Section~\ref{sec:approach} details the different components of our approach. Several experiments are then detailed in Section~\ref{sec:expes}. Last, some concluding remarks are given in Section~\ref{sec:concl}. \section{Related work} Query expansion is a well-established technique to try to improve the performance of an IR system. Adding new terms to the query is expected to specifically improve recall, yet, since the query is, hopefully, better formulated, it may also improve the top rank results and be beneficial to precision. One might classify the existing automatic approaches based on the origins of resource used to expand the query. \paragraph{External resources.} One obvious way to expand a query is to add semantically related terms to it (synonyms or sharing other semantic relations like hyponyms, quasi-synonyms, meronyms...). Existing lexical resources can be used to add, for each query term, a list of semantically related terms; yet, one has to deal with different problems: existence of lexical resources for the collection language, or for the specific domain of the collection, choice of the appropriateness of certain relations, need of sense disambiguation for polysemous words... WordNet~\cite{miller-ijl-90} is among the best-known resources for English (general language) and have been used with mitigated results at first \cite{Voorhees94}, but later shown to be effective \cite[inter alia]{Claveau-COLING2016}. \paragraph{Collection-based resources.} Distributional thesauri have also been exploited to enrich queries. Since they can be built from the document collection (or from a large corpus with similar characteristics), they are suited to the domain, the vocabulary... Traditional techniques to build these thesauri have obtained good results for query expansion \cite{Claveau-COLING2016}. Neural approaches, that is, word embedding approaches are now widely used to build such semantic resources. In the recent years, static embeddings (word2vec \cite{Mikolov13}, Glove \cite{pennington2014glove} or FastText \cite{bojanowski2016enriching} to name a few) were also used in IR, in particular to enrich the query. Indeed, these trainable dense representations make it easy to find new words that are semantically close to query words. Even more recently, dynamic word representations obtained with transformer-based architectures, such as BERT \cite{devlin2019bert} or GPT \cite{Radford2019}, have been proposed. They build a representation for each word according to its context, and this ability have been exploited to obtain competitive results in IR tasks \cite[inter alia]{Dai_2019,Khattab2020}. Bert has been also used for query expansion in the framework of a neural IR system based on reranking \cite{Padaki2020} \paragraph{Pseudo-relevance feedback} A last category of studies considers only a small set of document to help to expand or reformulate the query. To be automatic, they replace the user feedback by the hypothesis that the best ranked documents retrieved with the original query are relevant and may contain useful semantic information \cite{Ruthven03}. It is interesting to note that in this case, not only semantically relevant terms are extracted, but also distributional/statistical information on them and on the original query terms. In this category, Rocchio, developed in the 60's for vector space model was among the first one popularized \cite{Manning_IR2008}. One of the current best known approach is RM3, which was developed in the framework of language model based IR systems \cite{Abdul-RM3}. It is often reported to yield the best results in ad-hoc retrieval tasks, even compared with recent neural models \cite{NeuralHype}. Neural approaches have also been proposed to integrate pseudo-relevance feedback information \cite{Li-NPRF-EMNLP2018}, yet, as it is reported by the authors, the results are still lower than traditional models with query expansion. ~\newline In this paper, we propose to use constrained text generation to expand queries. In this approach, the original query is used as a seed for a generative model which will output texts that are, hopefully, related to the query. While text generation with language model is not new, the performance of neural models based on transformers \cite{Vaswani_NIPS2017} makes this task realistic. In this paper, we use the Generative Pre-Trained Transformers (GPT). They are built from stacked transformers (precisely, decoders) trained on a large corpus by auto-regression, i.e. unsupervisedly trained to predict the next token given the previous ones. The second version, GPT-2 \cite{Radford2019}, contains 1.5 billion parameters for its largest pre-trained model, trained on more than 8M documents from Reddit (i.e. mostly English and general language such as discussion on press articles). A newer version, GPT-3, has been released in July 2020; it is much more larger (175 billion parameters) and outperforms GPT-2 on any tested task. Yet, the experiments reported below were done before this release, thus with GPT-2. \section{Generated query expansion} \label{sec:approach} \subsection{Overview of our approach} As it was previously explained, our approach is very simple as it relies on existing tools and techniques. From a query, multiple texts are generated by a GPT-2 model using the query as the seed. Note that the generation process is not deterministic, and thus, even with the same seed, the texts are different. In the experiments reported below, 100 texts per query are generated (unless specified otherwise). These texts are concatenated and considered as the new query. In our experiments, this new, very large, query is then fed to a simple BM25+ IR system, but it could obviously be used in any other IR system. An example of a text generated from a query is presented in Fig.~\ref{fig:example_701}. As one can see, the generated text, while completely invented (note the barrel prices), is relevant for the query. It contains many terms, absent from the original query, that are more or less closely related to the information need, such as orthographic variants (United States vs. U.S.), meronyms-metonyms (barrel vs. oil), hypernyms (energy vs. oil) and more generally any paradigmatic (consumer, producer vs. industry) or syntagmatic (production for oil) relations. It is worth noting that such texts also give a valuable information about the relative frequency of each terms (contrary to thesauri or embeddings). \begin{figure} \noindent\fbox{% \parbox{\textwidth}{% U.S. oil production has been declining steadily for decades and it is not expected to reverse. In fact, some argue that it may even get worse. The long-term trend is for oil production to decline at a rate of about 1 percent per year. With production of about 8 million barrels per day now, there is no way the United States can replace its current output. The U.S. oil boom was a result of an energy revolution in the 1970s that led to increased oil production, and a significant change in the global oil market. The U.S. now produces about 2.3 million barrels of oil per day, the highest it has been in over 30 years. The United States is now the world's largest oil producer and the fourth largest oil exporter. What happened? When oil prices peaked in the 1970s, the United States was the world's largest oil producer. But over the next several decades, the United States' oil production began to decline. The decline was most pronounced in the 1980s, when the United States began to fall behind other oil producing countries. The oil price decline in the 1970s was not entirely voluntary. The United States was producing less oil and exporting more oil than it was consuming. The Federal Reserve controlled the amount of dollars in the Federal Reserve's reserves, so the United States was not exporting as much oil as it was producing. The decline in U.S. oil production was a result of the declining price of oil. The price of oil had declined from \$8 per barrel in 1973 to \$2.50 per barrel in 1977. In 1979, the price of oil reached a high of \$15.75 per barrel. By 1983, the price of oil had fallen to \$4.65 per barrel. By 1986, the price of oil had fallen to \$1.86 per barrel. By the end of the 1980s, the price of oil had fallen to \$1.24 per barrel. The decline in oil prices was a direct result of the energy revolution in the 1970s. The United States was the world's largest oil producer, but the United States was also the world's largest consumer of oil. When oil prices fell, so did the cost of producing oil. % }} \caption{Example of a document generated with the pre-trained GPT-2 large model from the text seed "U.S. oil industry history" (query 701 from .GOV collection)} \label{fig:example_701} \end{figure} \subsection{Pre-trained models, fine-tuning and parameters} \label{sec:fine_tuning} GPT-2 comes with several pre-trained models, having different size in terms of parameters (from 124M to 1.5B). As it was previously said, their training data was news-oriented general language. The largest model was used for two of the tested collections (see below). While these all-purpose models are fine for IR collections whose documents are also general language, it may not be appropriate for domain-specific IR collections. In the experiment reported in the next section, we use the \textsc{ohsumed} collection, made of medical documents. For this collection, we have fine-tuned the GPT-2 355M model on the documents of the collection in order to adapt the language model to the specific medical syntax and vocabulary. The fine-tuning was stopped after 250,000 samples were processed (this number of sample process indirectly controls the under/over-fitting to the specialized corpus) was set to and other parameters (batch size, optimizer, learning rate...) let to their defaults. Although a larger set of medical documents could be used (from Pubmed for instance), this small fine-tuned model is expected to be more suited to generate useful documents to enrich the query. Concerning the generation of documents, for reproducibity purposes, here are the main GPT-2 parameters used (please refer to GPT-2 documentation\footnote{\url{https://github.com/openai/gpt-2}}): length=512, temperature=0.5, top\_p=0.95, top\_k = 40. \subsection{IR Systems} In the experiments reported in the next section, we use two IR models. The first one is BM25+ \cite{Lv2011}, a variant of BM25 \cite{RWB98}. The parameters $k_1$, $k_3$, $b$ and $\delta$ were kept at their default value (resp. 1.2, 1000, 0.75, 1). It is implemented as a custom modification of the \textsc{gensim} toolkit \cite{Rehurek_GENSIM}. The second IR model is Language modeling with Dirichlet smoothing \cite{Zhai2001} as implemented in Indri \cite{MetzlerCroft2004,StrohmanMetzlerTurtleCroft2005}. The smoothing parameter $\mu$ is set to 2\,500. Both models are regarded as yielding state-of-the-art performance for bag-of-words representation \cite{NeuralHype}. Their RSV function can be written: $$RSV(q,d) =\sum_{t \in q} w_q(t) \cdot w_d(t) $$ with $w_q(t)$ the weight of term $t$ in query $q$ and $w_d(t)$ the weight in document $d$, as illustrated in Tab.~\ref{tab:weight} (from \cite{Lv2011}). \begin{table} \begin{center} \begin{tabular}{l|cc} IR model & weighting\\ \hline BM25+ $w_d(t)$ & $\left( \frac{(k1+1)c(t,d)}{k1(1-b+b\cdot dl(d)/avdl)+c(t,d)}+\delta \right) \cdot \log \frac{N+1}{df(t)}$\\ BM25+ $w_q(t)$ & $\frac{(k3+1)c(t,q)}{k3+c(t,q)}$ \\ & with $k1, k_3, b$ and $\delta$ fixed parameters \\ & \\ LM $w_d(t)$ & $\log \left( \frac{\mu}{dl(d)+\mu} + \frac{c(t,d)}{(dl(d)+\mu)p(t|C)} \right)$\\ LM $w_q(t)$ & $c(t,q)$ \\ & $\mu>0$ a smoothing parameter\\ &\\ \end{tabular} \end{center} \caption{\label{tab:weight}IR models (weighting functions of terms in the query and the document) for BM25+ \protect\cite{RWB98,Lv2011} and Language modeling with Dirichlet smoothing LM \protect\cite{Zhai2001}} \end{table} For RM3 expansion, we also rely on the Indri implementation; the results reported in the next section corresponds to the best performing parameters tested for each collection (number of documents considered for pseudo relevance feedback and number of terms kept). \section{Experiments} \label{sec:expes} \subsection{Experimental settings} Three IR collections are used in our experiments: Tipster, GOV2 and \textsc{ohsumed}. Some basic statistics are given in Tab.~\ref{tab:collection}. \begin{table}[tb] \begin{center} \begin{tabular}{l|ccc} & Tipster & GOV2 &\textsc{ohsumed} \\ \hline nb of documents & 170,000 & 25M & 350,000 \\ nb of queries & 50 & 150 & 106 \\ avg size of queries & 6.74 & 3.15 & 7.24\\ language & En & En & En \\ avg nb of relevant doc per query & 849 & 179 & 21 \\ \end{tabular} \end{center} \caption{\label{tab:collection}Statistics on the IR collections used} \end{table} Tipster was used in TREC-2. The documents are articles from newspaper, patents and specialized press (computer related) in English. The queries are composed of several parts, including the query itself and a narrative detailing the relevance criteria; in the experiments reported below, only the actual query part is used. GOV2 is a large collection of Web pages crawled from the .gov domain and used in several TREC tracks. In the experiments reported below, 150 queries from TREC 2004-2006 ad-hoc retrieval tasks are used; as for Tipster, only the actual query part is used (i.e. description and narrative fields are not included in the query). \textsc{Ohsumed} \cite{Ohsumed94} contains bibliographical notices from Medline and queries from the TREC-9 filtering task. Its interest for our experiments is that it deals with a specialized domain, hence it contains a specific vocabulary. Performance are assessed with standard scores: Precision at different thresholds (P@x), R-precision (R-prec), \textit{Mean Average Precision} (MAP). When needed, a paired t-test with $p=0.05$ is performed to assess the statistical significance of the difference between systems. \subsection{General language} Tables~\ref{tab:res-tipster} and \ref{tab:res-gov2} respectively present the results for the general-language collections Tipster and GOV2. For comparison purposes, we indicate the results of BM25+ without expansion, Indri's Language Model (LM) with and without RM3 expansion. The best performing setting for RM3 on Tipster is 100 terms from the top 20 documents, and 100 terms for the top 10 documents GOV2. The statistical significance is computed by comparing with the LM+RM3 baseline. \begin{table}[tb] \begin{center} \begin{tabular}{l|ccccccc} & MAP & R-Prec & P@5 & P@10 & P@20 & P@100 \\ \hline BM25+ & 25.06 & 32.16 & 95.60 & 92.60 & 89.70 & 73.64 \\ LM & 24.48 & 31.48 & 92.40 & 89.00 & 85.40 & 70.70 \\ LM + RM3 & 31.01 & 36.38 & 94.40 & 93.20 & 90.60 & 81.22 \\ \hline BM25+ and expansion & \textbf{35.22}$^*$ & \textbf{39.87}$^*$ & \textbf{99.60}$^*$ & \textbf{98.40}$^*$ & \textbf{98.20}$^*$ & \textbf{87.84}$^*$ \\ \end{tabular} \end{center} \caption{\label{tab:res-tipster}Performance (\%) on Tipster with query expansion; best results in bold, statistical significance over LM+RM3 noted with $*$} \end{table} \begin{table}[tb] \begin{center} \begin{tabular}{l|ccccccc} & MAP & R-Prec & P@5 & P@10 & P@20 & P@100 \\ \hline BM25+ & 25.66 & 31.25 & 52.92 & 49.97 & 46.52 & 34.63 \\ LM & 27.96 & 33.01 & 56.08 & 55.20 & 51.59 & 37.32 \\ LM with RM3 & 30.22 & 34.20 & 55.00 & 56.08 & 53.67 & \textbf{45.86} \\ \hline BM25+ and expansion & \textbf{34.54}$^*$ & \textbf{37.76} & \textbf{67.91}$^*$ & \textbf{63.88}$^*$ & \textbf{57.94} & 44.30 \\ \end{tabular} \end{center} \caption{\label{tab:res-gov2}Performance (\%) on GOV2 with query expansion; best results in bold, statistical significance over LM+RM3 noted with $*$} \end{table} On both collections, and on every performance measure, expanding the queries with the generated texts brings important gains compared with the system without expansion. Also, our approach outperforms RM3 expansion in almost every situation, and with a large margin on MAP, R-prec and precision on the top-ranked documents (P@5, P@10). \subsection{Specialized language} The same setting is used on the \textsc{ohsumed} collection. For these medical-oriented IR dataset, we report two versions of our approach: one is using the pre-trained model as before, and one relies on a model fine-tuned on the documents of the collection. The best performing setting for RM3 is 80 terms for the top 10 documents. The results are reported in Tab.~\ref{tab:res-ohsumed}. \begin{table}[tb] \begin{center} \begin{tabular}{l|ccccccc} & MAP & R-Prec & P@5 & P@10 & P@20 & P@100 \\ \hline BM25+ & 18.27 & 19.94 & 31.88 & 26.04 & 20.50 & 9.48 \\ LM & 17.61 & 20.35 & 29.31 & 24.06 & 19.21 & 9.28 \\ LM + RM3 & 20.80 & 22.54 & 30.89 & 26.83 & 22.18 & 10.51 \\ \hline BM25+ and expansion (no fine-tuning) & 21.60 & 23.75 & 33.47$^*$ & 27.62 & 22.92 & 11.16\\ BM25+ and expansion (fine-tuning) & \textbf{23.07}$^*$ & \textbf{24.65}$^*$ & \textbf{34.65}$^*$ & \textbf{29.41}$^*$ & \textbf{24.31} & \textbf{11.42} \\ \end{tabular} \end{center} \caption{\label{tab:res-ohsumed}Performance (\%) on \textsc{ohsumed} with query expansion; best results in bold, statistical significance over LM+RM3 noted with $*$} \end{table} Here again, the GPT-based expansion significantly improves the results of the IR system and outperforms RM3 expansion. Yet, the gains are lower than for the two previous collections. This difference can be explained by the following factors: \begin{enumerate} \item the queries are longer more complex and more specific (as can be seen in Tab.~\ref{tab:collection}, few documents are relevant); \item the generation model is not sufficiently suited to the documents. \end{enumerate} Concerning this latter reason, we can indeed see the interest of fine-tuning the generation model, but better results may be obtained by using a larger set of medical documents, or adopting different fine-tuning parameters (in particular the number of epoch/samples processed, see Sect.~\ref{sec:fine_tuning}). Unfortunately, defining a priori the best parameters for our IR task is not possible and the cost of the fine-tuning process makes it impossible to test a wide range of possible values. \subsection{Query expansion and weight information} One of the interest of having complete texts that are generated is that we can collect information on the relative importance of words, to the contrary of expanding queries with a thesaurus. To observe the impact of the number of occurrences in the generated texts, we evaluate the effect of keeping the $k$ most frequent terms of the generated texts and either weighting them by their frequency (as done usually by BM25) or by giving a fixed weight ($1/k$). The results for different values of $k$ are presented in Fig.~\ref{fig:exp_size}. \begin{figure} \centering \includegraphics[width=0.75\textwidth]{MAP_vs_expansion_size.png} \caption{MAP (\%) according to size of the expansion, terms with fixed weight or weight depending on their frequency in the generated documents; Tipster collection} \label{fig:exp_size} \end{figure} On can observe that adding terms to the query with a fixed weight slightly improves the MAP, but most of the gain is indeed brought by a proper weighting based on the frequency of the term in the generated documents. In the next experiment, we examine how the generated texts can help to re-weight the initial query terms; there is no query expansion, since only the initial query terms are kept, but their frequency in the generated texts are used in the BM25+ $w_q$. The results reported in Tab.~\ref{tab:res-reweighting} show that there is indeed a small improvement of the MAP, that is more noticeable at high DCV. \begin{table}[tb] \begin{center} \begin{tabular}{l|ccccccc} & MAP & R-Prec & P@5 & P@10 & P@20 & P@100 \\ \hline BM25+ & 25.06 & 32.16 & 95.60 & 92.60 & 89.70 & 73.64 \\ \hline BM25+ with re-weighting & 27.12 & 33.22 & 96.80 & 94.20 & 92.70 & 77.12 \\ \end{tabular} \end{center} \caption{\label{tab:res-reweighting}Performance (\%) on Tipster with re-weighting query words} \end{table} These two experiments demonstrate the usefulness of dealing with full texts and not only word-to-word similarity. \subsection{Number of generated documents} Since text generation can be costly, it is interesting to see how many generated texts are necessary. In Fig.~\ref{fig:exp_nb_doc}, the MAP obtained for up to 100 documents is presented. One can observe that a plateau is rapidly reached (at around 20 documents per query). Of course, the size of the generated documents (can be set as a parameter of the generation process) is also to be considered. \begin{figure} \centering \includegraphics[width=0.7\textwidth]{MAP_vs_nb_doc.png} \caption{MAP (\%) according to the number of generated documents (average over 5 runs); Tipster collection} \label{fig:exp_nb_doc} \end{figure} \section{Conclusive remarks and foreseen work} \label{sec:concl} Neural approaches are increasingly used in IR, with mitigated results, especially when compared with "traditional" bag-of-word approaches \cite{NeuralHype,NeuralHype2}. Here, the neural part is successfully used outside of a "traditional" IR system (but note that it could be used with any IR systems, since it simply enriches the query). The expansion approach presented in this paper is simple and easy to implement (thanks to the availability of the GPT models and code) while offering impressive gains. Lot of parameters could be further optimized, especially on the GPT model side (to influence the "creativity" of the text generation), and the fine-tuning capabilities should also be explored more thoroughly (influence of bigger specialized corpus if available, precise mix between pre-trained and fine-tuning, etc.). The recent availability of GPT-3\footnote{\url{https://github.com/openai/gpt-3}} makes it possible to even get greater gains thanks to the alleged high quality of its outputs. This whole approach also offers many research avenues: in this work, we have used text generation as a way to perform data augmentation on the query side, but it could also be used to augment the representation of the documents (even if in practice, the cost is still prohibitive on large collection). All machine-learning (neural or not) approaches based on pseudo-relevance feedback to train their model could instead use similar text generation with the advantage that they would not be limited by the number of potential relevant documents in the shortlist. And of course, similar data-augmentation strategy could be used for other tasks than document retrieval. More fundamentally, the recent improvements of text generation also question the relevance of the document retrieval task. Indeed, it is possible to envision systems that will be able to generate one unique document answering the user's information need, similarly to question-answering. If the generative model is trained on the document collection, the generated document will serve as a summary (which is one of the popular applications of GPT-x models) of the relevant documents. Yet, the current limitations of the models tested in this paper make them far from being suited for this ultimate task: the generated documents do deal with the subject of the query, and thus use a relevant vocabulary, but do not provide accurate, factual information (as seen in the Example in Fig.~\ref{fig:example_701} about the price of oil barrels). \bibliographystyle{splncs04}
{'timestamp': '2020-12-17T02:11:54', 'yymm': '2012', 'arxiv_id': '2012.08787', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08787'}
arxiv
\section{Introduction} \label{sec:intro} The present work proposes a novel smoothed particle hydrodynamics (SPH) formulation for general thermo-capillary phase change problems involving solid, liquid and gaseous phases. A special focus lies on the mesoscale melt pool modeling in metal powder bed fusion additive manufacturing (PBFAM) processes, e.g. selective laser melting (SLM) or electron beam melting (EBM), requiring some additional model constituents that are specific for this application. Since the governing physics are similar, also the melt pool dynamics in laser beam welding (LBW) or electron beam welding (EBW) processes~\cite{Chang2015,Geiger2009,Ki2002a,Ki2002b,Rai2008,Semak1999} lie in the scope of application of the proposed model. Basically, two main modeling approaches for surface tension effects can be distinguished in the context of SPH: formulations considering the microscale origin of surface tension in form of discrete, phase-dependent inter-particle potentials~\cite{Nugent2000, Tartakovsky2005, Tartakovsky2016} as well as macroscale surface tension models relying on the continuum surface force (CSF) method proposed by Brackbill and Kothe~\cite{Brackbill1996} and widely used also in combination with other spatial discretization schemes such as finite differences, finite volumes or finite elements. The CSF approaches can be further subdivided into formulations that directly discretize the surface tension stress tensor and subsequently determine its divergence as contribution to the discrete momentum equation~\cite{Lafaurie1994, Hu2006} and formulations that rely on the divergence of the continuous surface tension stress tensor resulting in the well-known curvature-proportional surface tension forces in interface normal direction and tangential interface forces proportional to surface tension gradients. The present work will focus on the second category for which the first SPH discretization has been proposed by Morris~\cite{Morris2000}. Subsequently, this formulation has been extended by density-weighted color field gradients~\cite{Adami2010} as well as different interface reconstruction and smoothing techniques~\cite{Andersson2010, Zhang2010, Zhang2015a, Zhang2015b}. There are only very few approaches to incoorporate wetting effects into this type of SPH formulation as e.g. proposed by Breinlinger et al.~\cite{Breinlinger2013} or by Das and Das~\cite{Das2010}. One of the first SPH formulations for thermo-capillary flow, i.e. surface tension effects coupled with a thermal field, has been proposed by Tong and Browne~\cite{Tong2014} and extented by Hopp-Hirschler et al.~\cite{Hopp-Hirschler2018}. {Recently, also several SPH formulations for thermo-capillary phase change problems in the context of PBFAM melt pool modeling have been proposed~\cite{Russell2018,Wessels2018,trautmann2018numerical,Weirather2019,shah2020simulations,furstenau2020generating,dao2021simulations}}. To the best of the authors' knowledge non of the aforementioned thermo-capillary SPH formulations has incorporated wetting effects so far, which are expected, however, to play an important role on the length scales relevant for metal PBFAM. In metal PBFAM, a focused laser beam, typically within an inert gas atmosphere, melts pre-defined contours into thin layers of pre-applied metal powder to create the cross-section of a final solid part in a repeated layer-wise buildup procedure. Under typical processing conditions the peak temperatures on the melt pool surface exceed the boiling temperature of the liquid metal. The density jump and accompanied recoil pressure in the phase transition from liquid metal to metal vapor results in a considerable distortion and highly dynamic topology changes of the liquid-gas interface at the melt pool surface giving rise to defects such as spatter, i.e. ejection of melt drops, or pores, i.e. gas bubble inclusions~\cite{Meier2017}. Pioneering modeling approaches in this field are e.g. given by the thermo-hydrodynamics finite element model proposed by Khairallah et al.~\cite{Khairallah2014, Khairallah2016, Khairallah2020}, who considered temperature-dependent surface tension and evaporation-induced recoil pressure forces, based on a phenomenological recoil pressure model~\cite{Anisimov1995}, as primary driving forces of the process. Comparable models based on finite difference, finite volume, finite element, Lattice Boltzmann or meshfree discretizations are e.g. given by~\cite{Geiger2009,Russell2018, Weirather2019, Lee2015, Leitz2018, Qiu2015, Panwisawas2017, Wessels2018, Otto2012, Yan2018, egorov2020, Gurtler2013,Yu2016,Yuan2015}. A more refined model has been proposed by~\cite{Tan2013, Tan2014, Kouraytem2019}, where the gas / vapor phase is explicitly resolved. Typically, the aforementioned models do not account for wetting effects at the triple line solid-liquid-gas. On the contrary, the works~\cite{Korner2011, Korner2013, Markl2015} specifically focus on the interplay between wetting effects and different power particle configurations, without considering however evaporation-induced recoil pressure. The present work proposes a weakly compressible SPH formulation for thermo-capillary phase change problems involving solid, liquid and gaseous phases. Specifically, evaporation-induced recoil pressure, temperature-dependent surface tension and wetting forces are considered as liquid-gas interface fluxes in the Navier Stokes equation. In the thermal problem, a Gaussian laser beam heat source as well as evaporation-induced heat losses are considered as liquid-gas interface fluxes, while convection boundary conditions are obsolete due to the explicit modeling of the atmospheric gas phase. All mechanical and thermal interface fluxes are modeled in a diffuse sense in analogy to the CSF approach. The following original contributions of the present work can be identified: The first SPH formulation for thermo-capillary problems is proposed that also considers wetting effects. A novel interface stabilization scheme based on viscous interface forces is proposed, which is shown to allow for a stable and smooth liquid-gas interface by effectively damping spurious interface flows well-known for the CSF approach. Moreover, different SPH discretizations for the tangential projection of the temperature gradient, as required for the discrete Marangoni forces, are reviewed. Based on a thorough analysis it is shown that standard \textit{two-sided} gradient approximations are sufficient for this purpose as long as zero-order consistency is satisfied, e.g. by anti-symmetric gradient construction. In the context of metal AM melt pool modeling, the present approach is - to the best of the authors' knowledge - the first model that i) considers the full range of relevant interface forces consisting of evaporation-induced recoil pressure, temperature-dependent surface tension and wetting forces, and ii) resolves the atmospheric gas phase and, thus, can consistently account for defects such as gas inclusions. The remainder of this work is organized as follows: Section~\ref{sec:goveq} presents the governing equations, i.e. continuity equation, momentum equation, energy equation and equation of state, in space-continuous form. Discretization in space, based on SPH, and in time, based on an explicit velocity-Verlet scheme, is presented in Sections~\ref{sec:nummeth_sph} and~\ref{sec:nummeth_sph_timint}. In Section~\ref{sec:numex_tantempgrad} different SPH approximations for the tangential temperature gradient are thoroughly analyzed and compared. {Finally, in Section~\ref{sec:numex}, the accuracy of the individual model and method components is verified by means of selected benchmark examples with analytical/numerical reference solutions. Eventually, the suitability of the proposed melt pool model for typical metal AM application scenarios is verified by means of point and line melting examples with and without resolved powder particles. Here, a special focus lies on the robustness of the computational model, i.e. the ability to represent challenging and practically relevant scenarios of dynamically changing interface topologies (e.g. generation of melt spatter or gas inclusions) without inducing spurious interface flows or instabilities of the discretization scheme.} \section{Governing Equations} \label{sec:goveq} Throughout this work two-phase flow problems of a liquid phase $\Omega^{l}$ and a gas phase $\Omega^{g}$ are considered that interact with a solid phase $\Omega^{s}$ and allow for reversible phase transition between liquid and solid phase. The overall problem domain splits according to $\Omega = \Omega^{l} \cup \Omega^{g} \cup \Omega^{s}$ and the two-phase fluid domain is given by $\Omega^{f} = \Omega^{l} \cup \Omega^{g}$. In the context of metal AM melt pool modeling the solid, liquid and gas phase correspond to the solid metal, the molten metal and the atmospheric gas in the build chamber of an AM device. \subsection{Fluid phases} \label{subsec:goveq_fluid} The liquid and gas phase are governed by the \textit{weakly compressible}, instationary and anisothermal Navier-Stokes equations in the domain~$\Omega^{f}=\Omega^{l} \cup \Omega^{g}$. The problem shall be described by the continuity equation \begin{equation} \label{eq:fluid_conti} \dv{\rho}{t} = -\rho \div \vectorbold{u} \qin \Omega^{f}, \end{equation} the Navier-Stokes momentum equation \begin{equation} \label{eq:fluid_momentum} \dv{\vectorbold{u}}{t} = \frac{1}{\rho} \left(-\grad{p} + \vectorbold{f}_{\nu} + \tilde{\vectorbold{f}}^{{lg}}_{s} + \tilde{\vectorbold{f}}^{{slg}}_{w} + \tilde{\vectorbold{f}}^{{lg}}_{v} \right) + \vectorbold{g} \qin \Omega^{f}, \end{equation} as well as the energy equation: \begin{equation} \label{eq:fluid_energy} c _p\dv{T}{t} = \frac{1}{\rho} \left(-\div \vectorbold{q} + \tilde{s}^{lg}_v + \tilde{s}^{lg}_l \right) \qin \Omega. \end{equation} Following a weakly compressible approach, density~$\rho$ and pressure~$p$ are linked via the equation of state \begin{equation} \label{eq:fluid_eos} p\qty(\rho) = c^{2} \qty(\rho - \rho_{0}) = p_{0} \qty(\frac{\rho}{\rho_{0}} - 1) \qin \Omega^{f}, \end{equation} which closes the system of equations for the six unknowns velocity $\vectorbold{u}$ (three components), density~$\rho$, pressure~$p$ and temperature~$T$. The individual contributions to these equations will be discussed in the following. \subsubsection{Momentum equation} \label{subsec:goveq_fluid_momentum} In equation~\eqref{eq:fluid_momentum}, contributions from viscous forces~$\vectorbold{f}_{\nu}$, surface tension forces~$\tilde{\vectorbold{f}}^{{lg}}_{s}$, wetting forces~$\tilde{\vectorbold{f}}^{{slg}}_{w}$ and evaporation-induced recoil pressure forces $\tilde{\vectorbold{f}}^{{lg}}_{v}$, each per unit volume, as well as body forces~$\vectorbold{g}$ per unit mass, can be identified. For incompressible Newtonian fluids the viscous forces read \begin{equation} \vectorbold{f}_{\nu} = \eta \laplacian{\vectorbold{u}}, \end{equation} with dynamic viscosity~$\eta$. Following the continuum surface force (CSF) approach by Brackbill and Kothe~\cite{Brackbill1996} we consider surface tension and wetting effects in the momentum equation~\eqref{eq:fluid_momentum} as volumetric forces distributed across an interfacial volume of finite width instead of additional boundary conditions at the liquid-gas interface area and the triple line solid-liquid-gas. In the following, these interface forces are marked by a tilde symbol and by a superscript indicating the relevant interface, e.g. $\tilde{\vectorbold{f}}^{{lg}}$ for forces on the 2D liquid-gas interface or $\tilde{\vectorbold{f}}^{{slg}}$ for forces on the 1D solid-liquid-gas interface (triple line). Specifically, the distributed surface tension forces consist of the following two contributions in interface normal and tangential direction \begin{equation} \label{eq:fluid_surfacetension} \tilde{\vectorbold{f}}^{{lg}}_{s} = -\alpha \kappa \vectorbold{n}^{lg} \delta^{lg} + \left(\vectorbold{I} - \vectorbold{n}^{lg} \otimes \vectorbold{n}^{lg} \right) \grad{\alpha} \delta^{lg}, \end{equation} with the surface tension coefficient $\alpha$, the interface curvature $\kappa:=\div \vectorbold{n}^{lg}$, the liquid-gas interface normal $\vectorbold{n}^{lg}:= \grad{c^{lg}}/||\grad{c^{lg}}||$, the phase-specific color field $c^{lg}$ between the liquid and gas phase, to be defined in Section~\ref{subsec:nummeth_sph_colorfield}, as well as the surface delta function $\delta^{lg}:=||\grad{c^{lg}}||$ between liquid and gas phase. The surface delta function is employed to distribute interface surface forces across interface domains of finite thickness. It is non-zero only on these interface domains and its integral over the interface thickness direction is normalized to one (see also Section~\ref{subsec:nummeth_sph_colorfield}). Throughout this work a purely temperature-dependent surface tension coefficient, i.e. $\grad{\alpha}= \alpha'(T) \grad{T}$ with $\alpha'(T)=d \alpha(T) / d T$, is considered. Specifically, a linear temperature-dependence of the surface tension is considered in the examples in Section~\ref{sec:numex} according to \begin{equation} \label{eq:fluid_surfacetension_tempdepend} \alpha(T) = \alpha_0 - \alpha'_0 (T-T_{\alpha_0}), \end{equation} where $\alpha_0$ is the surface tension at reference temperature $T_{\alpha_0}$. Moreover, the wetting forces~{\cite{Breinlinger2013}} are given by \begin{equation} \label{eq:fluid_wetting} \tilde{\vectorbold{f}}^{{slg}}_{w} = \alpha \left( \cos \theta - \cos \theta_0 \right) \vectorbold{t}^{sf} \delta^{lg} \delta^{sf} , \end{equation} with the equilibrium wetting angle $\theta_0$ and the current wetting angle $\theta$ defined via $\cos \theta := \vectorbold{n}^{lg} \cdot \vectorbold{n}^{sf}$. Here, the solid-fluid interface normal vector between the domains $\Omega^{s}$ and $\Omega^{f}$ is defined as $\vectorbold{n}^{sf}:= \grad{c^{sf}}/||\grad{c^{sf}}||$ on the basis of a phase-specific color field $c^{sf}$ between the solid and fluid phase to be defined in Section~\ref{subsec:nummeth_sph_colorfield}. Similar to the liquid-gas interface, also the surface delta function of the solid-fluid interface follows the relation $\delta^{sf}:=||\grad{c^{sf}}||$. Moreover, the tangent vector $\vectorbold{t}^{sf}$ is defined as the projection of the liquid-gas interface normal vector $\vectorbold{n}^{lg}$ onto the solid-fluid interface surface, {defined by its normal vector $\vectorbold{n}^{sf}$~\cite{Breinlinger2013}:} \begin{equation} \label{eq:fluid_wetting2} \vectorbold{t}^{sf} = \frac{\vectorbold{n}^{lg} - (\vectorbold{n}^{lg} \cdot \vectorbold{n}^{sf}) \vectorbold{n}^{sf}}{|| \vectorbold{n}^{lg} - (\vectorbold{n}^{lg} \cdot \vectorbold{n}^{sf}) \vectorbold{n}^{sf} ||}. \end{equation} Besides these standard capillary force contributions, the high peak temperatures at the melt pool surface at typical metal AM process conditions give rise to considerable evaporation effects. As common in the modeling of these processes, a phenomenological model for the evaporation-induced recoil pressure forces acting on the melt pool surface according to the work by Anisimov~\cite{Anisimov1995} is employed: \begin{equation} \label{eq:fluid_recoil} \tilde{\vectorbold{f}}^{{lg}}_{v} = -p_v(T) \vectorbold{n}^{lg} \delta^{lg} \quad \text{with} \quad p_v(T) = C_P \exp \left[ - C_T \left( \frac{1}{T} - \frac{1}{T_v} \right)\right], \end{equation} where the constants $C_P = 0.54 p_a$ and $C_T=\bar{h}_v/R$ contain the atmospheric pressure $p_a$, the molar latent heat of evaporation $\bar{h}_v$ and the molar gas constant $R$. Moreover, $T_v$ is the boiling temperature. \begin{rmk} The working principle of the employed phenomenological evaporation model relies on local peak temperatures in the melt pool that exceed the boiling temperature of the liquid metal. In scenarios with very high laser powers the resulting peak temperatures might lead to negative surface tension coefficients if~\eqref{eq:fluid_surfacetension_tempdepend} is applied without further correction. Thereto, in this work a regularized version of~\eqref{eq:fluid_surfacetension_tempdepend} is applied which keeps the surface tension coefficient $\alpha(T)$ constant if it has already decreased to $10 \%$ of its reference value $\alpha_0$ and the temperature is further increasing. \end{rmk} \subsubsection{Energy equation} \label{subsec:goveq_fluid_energy} The energy equation~\eqref{eq:fluid_energy} contains the mass-specific heat capacity $c_p$, the heat flux $\vectorbold{q}:= -k \grad{T}$ according to Fourier's law with thermal conductivity $k$ as well as heat fluxes stemming from the laser beam heat source $\tilde{s}^{lg}_l$ and from evaporation-induced heat losses $\tilde{s}^{lg}_v$, each per unit volume. The former is given by \begin{equation} \label{eq:fluid_heatsource} \tilde{s}^{lg}_l = \chi_l <\! -\vectorbold{n}^{lg} \! \cdot \! \vectorbold{e}_{l} \! > \, s^{lg}_l(\vectorbold{x}) \, \delta^{lg} \quad \text{with} \quad s^{lg}_l(\vectorbold{x})=s^{lg}_{l0} \, \exp \! \left[- 2 \left( \frac{||\vectorbold{x}-\vectorbold{x}_0||}{r_w} \right)^2 \right], \end{equation} where the Macauley bracket $<...>$ returns the value of its argument if the argument is positive and zero otherwise. The irradiance $s^{lg}_l(\vectorbold{x})$ describes the incident laser power per unit area at position $\vectorbold{x}$ as a function of the laser beam center position $\vectorbold{x}_0$ and has the form of a Gauss distribution, from which $s^{lg}_{l0}$ is the peak value and $r_{w}=2 \sigma$ represents two times the standard deviation $\sigma$. The corresponding diameter $d_w=2 r_{w}$ is a frequently used measure for the effective laser beam diameter. In addition, $\vectorbold{e}_{l}$ is the unit vector representing the laser beam direction and $\chi_l$ the laser energy absorptivity. Eventually, following the same phenomenological model as for the recoil pressure~\eqref{eq:fluid_recoil}, the evaporation-induced heat loss reads \begin{equation} \label{eq:fluid_evaporation} \tilde{s}^{lg}_v = s^{lg}_v \, \delta^{lg} \quad \text{with} \quad s^{lg}_v = - \dot{m}^{lg}_v [h_v+ h(T)], \quad \dot{m}^{lg}_v = 0.82 \, c_s \, p_v(T) \, \sqrt{\frac{C_M}{T}}, \quad h(T)=\int \limits_{T_{h,0}}^T c_p \, \, d\bar{T}, \end{equation} where the enthalpy rate per unit area $s^{lg}_v$ results from the vapor mass flow per unit area $\dot{{m}}^{lg}_v$ at the melt pool surface and the sum of the specific enthalpy $h(T)$ and the latent heat of evaporation $h_v$, both per unit mass. Moreover, $T_{h,0}$ is a reference temperature of the specific enthalpy and the constant $C_M=M/(2\pi R)$ contains the molar mass $M$ and the molar gas constant $R$. Finally, $p_v(T)$ is the recoil pressure defined in~\eqref{eq:fluid_recoil} and $c_s$ the so-called sticking constant which takes on a value close to one, i.e. $c_s \approx 1$ for metals~\cite{Khairallah2016, Weirather2019}. \begin{rmk} According to equation~\eqref{eq:fluid_heatsource} the laser beam heat source is applied at the liquid-gas interface, which is characterized by $\delta^{lg} \neq 0$. In the proposed model, the laser heat source also acts on solid surfaces, i.e. at solid-gas interfaces characterized by $\delta^{sg} \neq 0$. Here, the surface delta function $\delta^{sg}$ of the solid-gas interface is defined in analogy to the surface delta function $\delta^{lg}$ of the liquid-gas interface. \end{rmk} \subsubsection{Equation of state} \label{subsec:goveq_fluid_eos} In the equation of state~\eqref{eq:fluid_eos} the reference density~$\rho_{0}$, which equals the initial density throughout this work, the reference pressure~$p_{0} = \rho_{0} c^{2}$ and the artificial speed of sound~$c$ can be indentified. Note that the commonly applied weakly compressible approach only represents deviations from the reference pressure, i.e., $p\qty(\rho_{0}) = 0$, and not the total pressure. In order to limit density fluctuations to an acceptable level, while still avoiding too severe time step restrictions, Morris et al.~\cite{Morris1997} discussed strategies on how to determine an appropriate value of the artificial speed of sound. \subsection{Solid phase} \label{subsec:goveq_solid} Since the focus of this work lies on melt pool thermo-hydrodynamics, the assumption of a rigid and immobile solid phase (substrate and powder grains in the context of PBFAM processes), which is typical for mesoscale PBFAM models, is made. Thus, only the energy equation~\eqref{eq:fluid_energy} is solved for the solid phase. \subsection{Phase transition} \label{subsec:goveq_phase_transition} As presented in Section~\ref{sec:nummeth_sph}, the spatial discretization will be based on smoothed particle hydrodynamics (SPH). Due the Lagrangian nature of this scheme, each (material) particle directly carries its phase information. Based on this information, the corresponding field equations with phase-specific parameter values are evaluated for each particle. Material particles undergo the phase transition \textit{solid} $\leftrightarrow$ \textit{liquid} when passing the melt temperature $T_m$. Since the vapor phase is not modeled explicitly, the phase transition \textit{liquid} $\leftrightarrow$ \textit{vapor} is only considered implicitly in terms of evaporation-induced recoil pressure forces~\eqref{eq:fluid_recoil} and heat losses~\eqref{eq:fluid_evaporation}. While the latent heat of evaporation is already contained~\eqref{eq:fluid_evaporation}, the latent heat of melting could be considered in a straightforward manner as well by employing e.g. an apparent capacity scheme relying on an increased heat capacity $c_p$ within a finite temperature interval~\cite{proell2020phase}. However, for simplicity temperature-independent parameter values are considered in the present work (except for the surface tension coefficient). \subsection{Initial and boundary conditions} In general, the system of partial differential equations~\eqref{eq:fluid_conti}-\eqref{eq:fluid_energy} is subject to the following initial conditions \begin{equation} \rho = \rho_0, \quad \vectorbold{u} = \vectorbold{u}_{0}, \quad T=T_0 \qin \Omega \qq{at} t = 0. \end{equation} Throughout this work, only systems that are initially in static equilibrium, i.e. $\vectorbold{u}_{0}=\vectorbold{0}$, are considered. In addition, Dirichlet and Neumann boundary conditions are required on the domain boundary $\Gamma = \partial\Omega$: \begin{equation} \vectorbold{u} = \hat{\vectorbold{u}} \qq{on} \Gamma^{\vectorbold{u}}_{D}, \quad \quad \vectorbold{t} = \hat{\vectorbold{t}} \qq{on} \Gamma^{\vectorbold{u}}_{N}, \quad \quad T = \hat{T} \qq{on} \Gamma^T_{D}, \quad \quad \vectorbold{q} = \hat{\vectorbold{q}} \qq{on} \Gamma^T_{N} \, , \end{equation} with boundary velocity~$\hat{\vectorbold{u}}$, boundary traction~$\hat{\vectorbold{t}}$, boundary temperature $T$ and boundary heat flux $\hat{\vectorbold{q}}$ on the Dirichlet and Neumann boundaries $\Gamma = \Gamma^{\vectorbold{u}}_{D} \cup \Gamma^{\vectorbold{u}}_{N}$ and $\Gamma^{\vectorbold{u}}_{D} \cap \Gamma^{\vectorbold{u}}_{N} = \emptyset$ as well as $\Gamma = \Gamma^T_{D} \cup \Gamma^T_{N}$ and $\Gamma^T_{D} \cap \Gamma^T_{N} = \emptyset$. \section{Spatial discretization via smoothed particle hydrodynamics} \label{sec:nummeth_sph} \subsection{Approximation of field quantities via smoothing kernel} \label{subsec:nummeth_sph_kernel} The fundamental concept of SPH is based on the approximation of a field quantity~$f$ via a smoothing operation and on the discretization of the domain~$\Omega$ with discretization points following the fluid motion and therefore being denoted as particles. Introducing a smoothing kernel~$W\qty(r,h)$ (see e.g.~\cite{Liu2010,Monaghan2005}) leads to the following sequence of approximations of an arbitrary field quantity~$f$: \begin{equation} \label{eq:sph_approximation} f\qty(\vectorbold{r}) \approx \int_{\Omega} f\qty(\vectorbold{r}') W\qty(\qty| \vectorbold{r} - \vectorbold{r}' |, h) \dd{\vectorbold{r}'} \approx \sum_{j} V_{j} f\qty(\vectorbold{r}_{j}) W\qty(\qty| \vectorbold{r} - \vectorbold{r}_{j} |, h), \end{equation} commiting a \textit{smoothing error} in the first and an \textit{integration error} in the second approximation step~\cite{Quinlan2006}. The smoothing kernel~$W\qty(r,h)$ is a monotonically decreasing, smooth function that dependents on the distance~$r$ from the kernel center and a smoothing length~$h$. The smoothing length~$h$ together with a scaling factor~$\kappa$ define the support radius of the smoothing kernel~$r_{c} = \kappa h$. The Dirac delta function property $\lim_{h \rightarrow 0}{ W\qty(r, h) } = \delta\qty(r)$ ensures an exact representation of a field quantity~$f$ in the limit $h \rightarrow 0$. Compact support, i.e., $W\qty(r, h) = 0$ for $r > r_{c}$, as well as positivity, i.e., $W\qty(r, h) \geq 0$ for $r \leq r_{c}$, are typical properties of standard smoothing kernels~$W\qty(r,h)$. In addition, the normalization property requires that $\int_{\Omega} W\qty(\qty| \vectorbold{r} - \vectorbold{r}' |, h) \dd{\vectorbold{r}'} = 1$. In the second approximation step, the domain integral is replaced by a summation over discrete volumes~$V_{j}$ located at the positions of the material discretization points (particles)~$j$. A straightforward approximation for the gradient of quantity~$f$ follows directly by differentiation of \eqref{eq:sph_approximation}: \begin{equation} \label{sph_general_gradient} \grad{f}\qty(\vectorbold{r}) \approx \int_{\Omega} f\qty(\vectorbold{r}') \grad{W \qty(\qty| \vectorbold{r} - \vectorbold{r}' |, h)} \dd{\vectorbold{r}'} \approx \sum_{j} V_{j} f\qty(\vectorbold{r}_{j}) \grad{W \qty(\qty| \vectorbold{r} - \vectorbold{r}_{j} |, h)}, \end{equation} Note that this (simple) gradient approximation shows some particular disadvantages, hence, more advanced approximations for gradients are given in the literature \cite{Monaghan2005} and will also be applied in the following. Applying these gradient approximations reduces the partial differential equations~\eqref{eq:fluid_conti} and~\eqref{eq:fluid_energy} to ordinary differential equations that are solved, i.e., evaluated and integrated in time, for all particles~$i$ in the domain~$\Omega$ (cf. Sections \ref{subsec:nummeth_sph_momentum}-\ref{sec:nummeth_sph_timint}). As a result, all fluid quantities are evaluated at and associated with particle positions, meaning each particle carries its corresponding fluid quantities. \begin{rmk} In the following, a quantity~$f$ evaluated for particle~$i$ at position~$\vectorbold{r}_{i}$ is written as~$f_{i} = f\qty(\vectorbold{r}_{i})$. In addition, the short notation $W_{ij} = W\qty(r_{ij}, h)$ denotes the smoothing kernel~$W$ evaluated for particle~$i$ at position~$\vectorbold{r}_{i}$ with neighboring particle~$j$ at position~$\vectorbold{r}_{j}$, where $r_{ij} = \qty|\vectorbold{r}_{ij}| = \qty|\vectorbold{r}_{i} - \vectorbold{r}_{j}|$ is the absolute distance between particles~$i$ and~$j$. Similarly, the derivative of the smoothing kernel~$W$ with respect to the absolute distance~$r_{ij}$ is denoted by $\pdv*{W}{r_{ij}} = \pdv*{W\qty(r_{ij}, h)}{r_{ij}}$. \end{rmk} \begin{rmk} In this work, a quintic spline smoothing kernel~$W\qty(r, h)$ is considered as defined in \cite{Morris1997} with smoothing length~$h$ and compact support with support radius~$r_{c} = \kappa h$ and scaling factor~$\kappa = 3$. \end{rmk} \subsection{Initial particle spacing} \label{subsec:nummeth_sph_spacing} Within this contribution, the domain $\Omega$ is initially filled with particles located on a regular grid with particle spacing~$\Delta{}x$, thus in $d$ dimensional space each particle initially occupies an effective volume of~$\qty(\Delta{}x)^{d}$. The mass of a particle~$i$ is then set using the reference density according to $m_{i} = \rho_{0} \qty(\Delta{}x)^{d}$ and remains constant throughout the simulation. In general, the initial particle spacing~$\Delta{}x$ can be freely chosen, however, within this work the initial particle spacing~$\Delta{}x$ is set equal to the smoothing length~$h = \flatfrac{r_{c}}{\kappa}$. \subsection{Density summation} \label{subsec:nummeth_sph_summation} The density of a particle~$i$ is determined via summation of the respective smoothing kernel contributions of all neighboring particles~$j$ within the support radius~$r_{c}$ \begin{equation} \label{eq:sph_densum} \rho_{i} = m_{i} \sum_{j} W_{ij} \, . \end{equation} This approach is typically denoted as density summation and results in an exact conservation of mass in the fluid domain, which can be shown in a straight-forward manner considering the commonly applied normalization of the smoothing kernel to unity. It shall be noted that the density field may alternatively be obtained via SPH discretization and time integration of the continuity equation~\eqref{eq:fluid_conti}, cf. Liu and Liu~\cite{Liu2010}. \subsection{Momentum equation} \label{subsec:nummeth_sph_momentum} Following the standard SPH discretization procedure the discrete version of~\eqref{eq:fluid_momentum} can be formulated as \begin{equation} \label{eq:sph_momentum} \vectorbold{a}_{i} = \frac{1}{m_{i}} \left[ \vectorbold{F}_{p,i} + \vectorbold{F}_{\nu,i} + \vectorbold{F}_{s,i} + \vectorbold{F}_{w,i} + \vectorbold{F}_{v,i} + \vectorbold{F}_{d,i} \right] + \vectorbold{b}_{i} \, , \end{equation} where $\vectorbold{a}_{i} = \dv*{\vectorbold{u}_{i}}{t}$ represents the total acceleration of particle~$i$ whereas the pressure force $\vectorbold{F}_{p,i}$, viscous force $\vectorbold{F}_{\nu,i}$, surface tension force $\vectorbold{F}_{s,i}$, wetting force $\vectorbold{F}_{w,i}$ as well as vapor-induced recoil pressure force $\vectorbold{F}_{v,i}$ acting on particle~$i$ result from summation of all particle-to-particle interaction contributions with neighboring particles~$j$. Optionally, additional viscous dissipation forces $\vectorbold{F}_{d,i}$ are applied at the interfaces solid-liquid and liquid-gas, which will motivated and further detailled in Section~\ref{subsec:nummeth_sph_dissipation}. The pressure and viscous forces in the momentum equation~\eqref{eq:sph_momentum} are discretized following a formulation proposed by Adami et al.~\cite{Adami2012, Adami2013}: \begin{equation} \label{eq:sph_momentum_pressure_and_viscous} \vectorbold{F}_{p,i} + \vectorbold{F}_{\nu,i} = \sum_{j} \qty(V_{i}^{2}+V_{j}^{2}) \qty[ - \bar{p}_{ij} \pdv{W}{r_{ij}} \vectorbold{e}_{ij} + \bar{\eta}_{ij} \frac{\vectorbold{u}_{ij}}{r_{ij}} \pdv{W}{r_{ij}} ]\, , \end{equation} with volume~$V_{i} = m_{i}/\rho_{i}$ of particle~$i$, unit vector $\vectorbold{e}_{ij} = \flatfrac{\vectorbold{r}_{i} - \vectorbold{r}_{j}}{\qty|\vectorbold{r}_{i} - \vectorbold{r}_{j}|} = \flatfrac{\vectorbold{r}_{ij}}{r_{ij}}$, relative velocity $\vectorbold{u}_{ij} = \vectorbold{u}_{i}-\vectorbold{u}_{j}$ as well as inter-particle averaged pressure and dynamic viscosity: \begin{equation} \label{eq:sph_mom_wght_press_and_visc} \bar{p}_{ij} = \frac{\rho_{j}p_{i}+\rho_{i}p_{j}}{\rho_{i} + \rho_{j}} \, , \quad \quad \bar{\eta}_{ij} = \frac{2\eta_{i}\eta_{j}}{\eta_{i}+\eta_{j}} \, . \end{equation} Also the transport velocity formulation proposed in~\cite{Adami2013}, which utilizes a constant background pressure $p_b$ to suppress the problem of tensile instability, is employed in the present work. For the sake of briefity, the definition of the modified advection velocity and the additional terms in the momentum equation stemming from the aforementioned transport velocity contribution are not further delineated and the reader is kindly referred to the original publication~\cite{Adami2013}. The accuracy and stability of this formulation has readily been demonstrated on the basis of well-known benchmark tests in the context of computational fluid dynamics~\cite{Adami2013} and fluid-structure interaction~\cite{Fuchs2020}. The remaining force contributions will be discussed in the following. \subsubsection{Discretization of phase interfaces} \label{subsec:nummeth_sph_colorfield} The interface forces to be defined in the following rely on a representation of the different phase domains and interfaces via a color field function. Here, we define the color field according to \begin{equation} \label{eq:sph_colorfield} c_i^j = \left\{\begin{array}{ll} 1 , & \text{if particles i and j belong to different phases}\\ 0, & \text{else} \end{array}\right. \end{equation} as well as the density-weighted color field gradient according to \begin{equation} \label{eq:sph_colorfieldgradient} \grad{c}_i = \frac{1}{V_{i}} \sum_{j} \qty(V_{i}^{2}+V_{j}^{2}) \bar{c}_{ij} \pdv{W}{r_{ij}} \vectorbold{e}_{ij} \quad \text{with} \quad \bar{c}_{ij} = \frac{\rho_j}{\rho_i+\rho_j} c_i^i + \frac{\rho_i}{\rho_i+\rho_j} c_j^i \end{equation} following the approach proposed by Adami et al.~\cite{Adami2010}. Note that $ c_i^i \equiv 0$ according to~\eqref{eq:sph_colorfield}. Based on the definition of the color field gradient the interface normal and the surface delta function of particle $i$ read \begin{equation} \label{eq:sph_normalanddelta} \vectorbold{n}_{i} = \frac{\grad{c}_i}{|| \grad{c}_i ||} \quad \text{and} \quad \delta_i = || \grad{c}_i ||. \end{equation} Note that this procedure leads to an \textit{outward-pointing} interface normal vector with respect to the phase of particle $i$. Moreover, it has to be emphasized that these metrics are exclusively used to define the interface between two phases. Consequently, in the calculations according to~\eqref{eq:sph_colorfield}-\eqref{eq:sph_normalanddelta} only two different phases are distinguished (and \textit{not} three independent phases which might occur at the triple line solid-liquid-gas). Specifically, the liquid-gas interface (superscript $"lg"$) is defined by only considering particles of the liquid and the gas phase (i.e. no contribution of solid particles). The solid-gas interface (superscript $"sg"$) is defined by only considering particles of the solid and the gas phase. The solid-fluid interface (superscript $"sf"$) is defined by considering all particles but only distinguishing between either particles of the solid phase or the (combined) fluid phase (sum of particles from the liquid and gas phase). \begin{rmk} In case of high density ratios between two phases the definition of $\delta_i$ according to~\eqref{eq:sph_colorfieldgradient}-\eqref{eq:sph_normalanddelta} ensures that the majority of a flux contribution (i.e. of mechanical interface forces or thermal heat fluxes) distributed over the interface via $\delta_i$ acts on the side of the interface associated with the \textit{heavier} phase. Thus, in the melt pool examples in Section~\ref{sec:numex_am}, where typical density ratios $\rho_l / \rho_g > 100$ between melt and gas phase are considered, more than $99\%$ of a flux term is carried by the melt phase. Therefore, for simplicity only the contributions to the melt phase are considered for the mechanical and thermal flux terms in~\eqref{eq:fluid_surfacetension},~\eqref{eq:fluid_wetting},~\eqref{eq:fluid_recoil},~\eqref{eq:fluid_heatsource} and~\eqref{eq:fluid_evaporation}. This approximation seems reasonable when considering typical parameter uncertainties and accuracy requirements in AM melt pool modeling. However, it is emphasized that this procedure is by no means an inherent limitation of the proposed methodology and can easily be changed. \end{rmk} \subsubsection{Surface tension forces} \label{subsec:nummeth_sph_surface tension} In the following, the surface tension forces are split into two contributions $\vectorbold{F}_{s,i}=\vectorbold{F}_{s \kappa,i}+\vectorbold{F}_{s m,i}$, with $\vectorbold{F}_{s \kappa,i}$ representing the curvature-proportional surface tension normal forces and $\vectorbold{F}_{s m,i}$ representing the tangential Marangoni forces due to surface tension gradients. The first contribution is given by \begin{equation} \label{eq:sph_surfacetension1} \vectorbold{F}_{s \kappa,i} = -V_i \alpha_i \kappa_i \vectorbold{n}_i^{lg} \delta_i^{lg}. \end{equation} As proposed by Morris~\cite{Morris2000}, the curvature $\kappa_i$ is discretized according to \begin{equation} \label{eq:sph_curvature} \kappa_i = (\div{\vectorbold{n}^{lg}})_i = -\frac{\sum_{j} N_i N_j V_{j} \vectorbold{n}^{lg}_{ij} \pdv{W}{r_{ij}} \vectorbold{e}_{ij}}{\sum_{j} N_i N_j V_{j} W_{ij}} \quad \text{with} \quad N_k = \left\{\begin{array}{ll} 1 , & \text{if} || \grad{c}^{lg}_k || > \epsilon\\ 0, & \text{else} \end{array}\right. \end{equation} with $\vectorbold{n}^{lg}_{ij}=\vectorbold{n}^{lg}_{i}-\vectorbold{n}^{lg}_{j}$. Here, $\epsilon \ll 1$ is a user-defined tolerance applied to avoid contributions from particles far away from the interface with erroneous normal vectors~\cite{Morris2000}. The discrete Marangoni forces read \begin{equation} \label{eq:sph_surfacetension2} \vectorbold{F}_{s m,i} = V_i \underbrace{\left(\vectorbold{I} - \vectorbold{n}^{lg}_i \otimes \vectorbold{n}^{lg}_i \right) (\grad{T})_i}_{\nabla_T {T}_i} \, \alpha_i' \delta^{lg}_i \end{equation} where the operator $\nabla_T$ represents the projection of the nabla operator into the interface tangential plane. Liquid-gas interfaces typically go along with considerably jumps in the mechanical and thermal constitutive parameters. It will be demonstrated in Section~\ref{sec:numex_tantempgrad} that a proper discretization of the temperature gradient $(\grad{T})_i$ is of upmost importance to represent the temperature field, and its inherent kink across the interface, with sufficient accuracy. Thereto, three different SPH gradient approximations typically applied in the literature (see also~\cite{Tong2014, Russell2018} in the context of tangential (Marangoni) surface tension forces) shall be considered in the following. The first variant is given by the standard SPH gradient approximation according to~\eqref{sph_general_gradient}: \begin{equation} \label{eq:sph_tempgrad1} (\grad{ T})_i \approx \sum_{j} V_{j} T_{j} \pdv{W}{r_{ij}} \vectorbold{e}_{ij} \,. \end{equation} The second variant is given by a symmetric gradient approximation as typically applied to gradients (e.g. of the pressure field) in the momentum equation to guarantee for conservation of momentum~\cite{Adami2012, Adami2013}: \begin{equation} \label{eq:sph_tempgrad2} (\grad{ T})_i \approx \frac{1}{V_{i}} \sum_{j} (V_{i}^2+V_{j}^2) \frac{T_{i}+T_{j}}{2} \pdv{W}{r_{ij}} \vectorbold{e}_{ij} \,. \end{equation} The third variant is given by an anti-symmetric gradient approximation as typically applied to velocity gradients in the continuity equation to guarantee for zero-order consistency~\cite{Monaghan2005}: \begin{equation} \label{eq:sph_tempgrad3} (\grad{ T})_i \approx \sum_{j} V_{j} (T_{j}- T_{i}) \pdv{W}{r_{ij}} \vectorbold{e}_{ij} \,. \end{equation} In Section~\ref{sec:numex_tantempgrad} it will be demonstrated that only the third variant~\eqref{eq:sph_tempgrad3} leads to reasonable approximations and small discretization errors for the tangential projection of the temperature gradient. Consequently, this variant is applied in all the remaining examples in Section~\ref{sec:numex}. Moreover, it will be derived why this formulation results in a good approximation quality for the tangential projection of the temperature gradient - as required in~\eqref{eq:sph_surfacetension2} - even though it is not suitable to represent the total temperature gradient. \subsubsection{Wetting forces} \label{subsec:nummeth_sph_wetting} As indicated by Breinlinger et al.~\cite{Breinlinger2013}, a direct SPH discretization of~\eqref{eq:fluid_wetting} is typically not preferable due to the erroneous representation of the liquid-gas interface normal vector $\vectorbold{n}^{lg}$ close to the triple line solid-liquid-gas, which can be traced back to a lack of liquid and gas particle support in this region. Therefore, we follow an alternative strategy proposed in~\cite{Breinlinger2013} prescribing this normal vector in the triple line region on the basis of the equilibrium wetting angle $\theta_0$ according to: \begin{equation} \label{sph:fluid_wetting1} \hat{\vectorbold{n}}^{lg}_i = \vectorbold{t}^{sf}_i \sin \theta_0 - \vectorbold{n}^{sf}_i \cos \theta_0, \end{equation} where $\vectorbold{n}^{sf}_i$ is the normal vector of the solid-fluid interface according to~\eqref{eq:sph_colorfield}-\eqref{eq:sph_normalanddelta} and $\vectorbold{t}^{sf}_i$ is given by~\eqref{eq:fluid_wetting2} evaluated for particle $i$. In order to prescribe the value $\hat{\vectorbold{n}}^{lg}_i$ for the liquid-gas interface normal vector $\vectorbold{n}^{lg}_i$ in the triple point region and to have a smooth transition from the interface region (with prescribed normal) to the interior domain (with solution-dependent normal), the following correction scheme is employed: \begin{equation} \label{sph:fluid_wetting3} \vectorbold{n}^{lg}_i = \frac{f_{\vectorbold{n},i} (\grad{c^{lg}}_i / || \grad{c^{lg}}_i ||) + (1-f_{\vectorbold{n},i}) \hat{\vectorbold{n}}^{lg}_i }{|| f_{\vectorbold{n},i} (\grad{c^{lg}}_i / || \grad{c^{lg}}_i ||) + (1-f_{\vectorbold{n},i}) \hat{\vectorbold{n}}^{lg}_i ||} \quad \text{with} \quad f_{\vectorbold{n},i} = \left\{\begin{array}{ll} 0 , & \text{if} \,\, d_{w,i} < 0\\ \frac{d_{w,i}}{d_{max}} , & \text{if} \,\, 0 \leq d_{w,i} \leq d_{max}\\ 1 , & \text{if} \,\, d_{w,i} > d_{max}. \end{array}\right. \end{equation} In the present work, $d_{max}=h$ has been chosen as the kernel smoothing length (which differs from~\cite{Breinlinger2013}, where the kernel support radius has been chosen) and the distance function $d_{w,i}$ is defined as the distance of fluid particle $i$ from the closest wall particle $j$ minus the initial particle spacing $h$ according to $d_{w,i} = \min ( (\vectorbold{r}_i-\vectorbold{r}_j) \cdot \vectorbold{n}^{sf}_i) - h$. From~\eqref{sph:fluid_wetting3} it becomes clear that for particles closer to the wall than $h$ the interface normal is prescribed as $\hat{\vectorbold{n}}^{lg}_i$, while for particles with wall distance larger than $2h$ the conventional (solution-dependent) calculation of the interface normal via the color field gradient is applied. \subsubsection{Recoil pressure forces} \label{subsec:nummeth_sph_recoil} The discrete version of the evaporation-induced recoil pressure forces occurring in~\eqref{eq:sph_momentum} is given by \begin{equation} \label{eq:sph_recoil} \vectorbold{F}_{v,i} = -V_i p_{v,i} \vectorbold{n}_i^{lg} \delta_i^{lg}, \end{equation} where $p_{v,i}$ is the recoil pressure according to~\eqref{eq:fluid_recoil} evaluated for particle $i$. \subsubsection{Viscous interface forces} \label{subsec:nummeth_sph_dissipation} Monaghan and Gingold~\cite{Monaghan1983} proposed a stabilization term, denoted as artificial viscosity, as additional contribution to the momentum equation to reduce spurious flow oscillations in the numerical solution. In this work we propose to employ this stabilization term selectively only at the solid-liquid and liquid-gas interface to avoid oscillations originating from the phase transition solid-liquid and from the high liquid-gas interface forces typical for metal AM melt pool hydrodynamics. Moreover, it will be shown that the resulting interface viscosity contributions can also be motivated from a physical point of view. In its general form the discrete version of these dissipative interface forces is given by \begin{equation} \label{eq:sph_dissipation} \vectorbold{F}_{d,i} = - m_i {\zeta_i} \sum_{j} m_j \bar{h}_{ij} \bar{c}_{ij} \frac{{\vectorbold{u}_{ij}} \cdot \vectorbold{r}_{ij}}{\bar{\rho}_{ij} (r_{ij}^2 + \epsilon h_{ij}^2 )} \pdv{W}{r_{ij}}, \end{equation} with the inter-particle averaged particle spacing $\bar{h}_{ij}=(h_i+h_j)/2$, speed of sound $\bar{c}_{ij}=(c_i+c_j)/2$ and density $\bar{\rho}_{ij}=(\rho_{i}+\rho_{j})/2$ as well as relative velocity {$\vectorbold{u}_{ij}=\vectorbold{u}_{i}-\vectorbold{u}_{j}$} and distance ${r}_{ij}=||\vectorbold{r}_{i}-\vectorbold{r}_{j}||$. The constant $\epsilon \ll 1$ is introduced to ensure a non-zero denominator. The viscosity factor is split into two contributions ${\zeta_i}={\zeta}^{lg}_i+{\zeta}^{sl}_i$. The first one, acting on (the liquid side of) the liquid-gas interface is given by: \begin{equation} \label{eq:sph_dissipation_lg} {\zeta}^{lg}_i = {\zeta}^{lg}_0 \delta^{lg}_i. \end{equation} Spurious interface flows are a well-known problem of continuum surface force (CSF) formulations~\cite{Breinlinger2013,Brackbill1996}. Due to the high magnitude of surface tension and recoil pressure forces this undesirable effect is in particular critical for metal AM melt pool problems. As demonstrated in Section~\ref{sec:numex_droplet_oscillation}, the introduction of an additional viscous term acting exactly (and only) at the origin of these spurious interface flows, i.e. selectively at the liquid-gas interface, enables to effectively reduce this numerical artifact {without introducing additional dissipation of physically relevant flow characteristics in the interior fluid domain}. Since these spurious interface flows are known to decrease with increasing discretization resolution~\cite{Brackbill1996}, we recommend to scale the viscosity factor ${\zeta}^{lg}_0$ with the smoothing length $h_i$. With this strategy the maximal viscous forces acting on interface particles is discretization-independent (as the maximal magnitude of $\delta^{lg}_i$ scales with $1/h_i$), while the overall influence of the viscous interface forces on the global system behavior decreases (as the interface thickness decreases with $h_i$). Similar to slope limiting techniques~\cite{Berger2005}, the numerical scheme could be further refined by applying this interface stabilization term only at locations with extremely high (or fast changing) velocity gradients or in case of metal AM melt pool simulations only at locations with very high temperatures (and thus very high recoil pressure forces). The viscosity factor on the solid-liquid interface is defined as: \begin{equation} \label{eq:sph_dissipation_sl} {\zeta}^{sl}_i = {\zeta}^{sl}_0 f_{{\zeta}^{sl}}(T_i) \quad \text{with} \quad f_{{\zeta}^{sl}}(T_i) = \left\{\begin{array}{ll} 0 , & \text{if} \,\, T_i > T_{max}\\ \frac{T_i-T_{max}}{T_m-T_{max}} , & \text{if} \,\, T_{max} \geq T_i \geq T_{m}\\ 1 , & \text{if} \,\, T_i < T_{m}, \end{array}\right. \end{equation} where $T_{m}$ is the melt temperature and $T_{max}$ a temperature chosen slightly above the melt temperature. Thus, the viscous force~\eqref{eq:sph_dissipation_sl} only acts on particles with temperatures close to the melting point and thus effectively damps potential instabilities arising from the jump of material parameters and state variables of a particle when undergoing the phase change solid-liquid. Due to the no-slip condition already applied to the fluid velocity field at this interface, the influence of this additional viscous force on the global system behavior is small as long as $T_{max}$ is chosen sufficiently close to $T_{m}$. As demonstrated in~\cite{Monaghan2006}, the action of the viscous force~\eqref{eq:sph_dissipation} can be associated with an equivalent physical viscous force with effective kinematic viscosity $\nu_i = 0.5 {{\zeta}_i} \bar{h}_{ij} \bar{c}_{ij} / (d+2)$, where $d=2,3$ is the spatial dimension. Thus, besides their stabilizing effect, the contributions~\eqref{eq:sph_dissipation_lg} and~\eqref{eq:sph_dissipation_sl} can also be interpreted from a physical point of view. For example,~\eqref{eq:sph_dissipation_lg} can be thought of as part of a non-conservative surface tension formulation with interface viscosity~\cite{Gounley2016}. In particular,~\eqref{eq:sph_dissipation_sl} can be interpreted as a physical model for the gradual phase transition of alloys between solidus and liquidus temperature {such that the viscosity decreases with increasing temperature during melting.} \subsection{Energy equation} \label{subsec:nummeth_sph_energy} The discrete version of the energy equation~\eqref{eq:fluid_energy} has the following general form: \begin{equation} \label{eq:sph_energy} \dv{T_i}{t} = \frac{1}{c_{p,i} \rho_i} [- (\div \vectorbold{q})_i + \tilde{s}^{lg}_{v,i} + \tilde{s}^{lg}_{l,i}] \end{equation} For the discretization of the conductive term, we follow a formulation proposed by Cleary and Monaghan~\cite{Cleary1999}, which is especially suited for problems involving a jump of the thermal conductivity $k$ across an interface: \begin{equation} \label{eq:sph_divq} (\div \vectorbold{q})_i = \sum_{j} \frac{m_{j} 4k_ik_j (T_j-T_i)}{\rho_j (k_i+k_j) r_{ij}} \pdv{W}{r_{ij}} \end{equation} The discrete versions of the laser beam source term $\tilde{s}^{lg}_{l,i}$ and the evaporation-induced heat loss term $\tilde{s}^{lg}_{v,i}$ result directly from evaluating~\eqref{eq:fluid_heatsource} and~\eqref{eq:fluid_evaporation} for the discrete particle $i$. \subsection{Equation of state} \label{subsec:nummeth_sph_eos} The discrete version of the equation of state results from evaluating~\eqref{eq:fluid_eos} for the discrete particle $i$. \subsection{Boundary conditions} \label{subsec:nummeth_sph_bdrycond} \paragraph{Rigid wall boundary conditions} Following the approach of Adami et al.~\cite{Adami2012} rigid wall boundary conditions are modeled using fixed boundary particles with quantities extrapolated from the fluid field based on a local force balance. The same approach is used to model the mechanical interaction between fluid particles and the solid phase. For more details the interested reader is referred to the aforementioned literature. \paragraph{Periodic boundary conditions} Imposing a periodic boundary condition in a specific spatial direction allows for particle interaction evaluation across the lower and upper domain border. Moreover, particles leaving the domain on one side are re-injecting on the opposite side. \section{Time integration scheme} \label{sec:nummeth_sph_timint} The momentum equation~\eqref{eq:sph_momentum} is integrated in time applying an explicit velocity-Verlet time integration scheme in kick-drift-kick form, also denoted as leapfrog scheme, as proposed by Monaghan~\cite{Monaghan2005}. In the absence of dissipative effects the velocity-Verlet scheme is of second order accuracy and reversible in time~\cite{Monaghan2005}. In a first kick-step the particle accelerations $\vectorbold{a}_{i}^{n} = \qty(\dv*{\vectorbold{u}_{i}}{t})^{n}$ determined in the previous time step~$n$ are used to compute intermediate particle velocities at~$n+1/2$ \begin{equation} \vectorbold{u}_{i}^{n+1/2} = \vectorbold{u}_{i}^{n} + \frac{\Delta{}t}{2} \, \vectorbold{a}_{i}^{n} \, , \end{equation} where~$\Delta{}t$ is the time step size, before the particle positions at~$n+1$ are updated in a drift-step \begin{equation} \vectorbold{r}_{i}^{n+1} = \vectorbold{r}_{i}^{n} + \Delta{}t\vectorbold{u}_{i}^{n+1/2} \, . \end{equation} With the particle positions~$\vectorbold{r}_{i}^{n+1}$ the densities~$\rho_{i}^{n+1}$ are determined on the basis of~\eqref{eq:sph_densum}. Based on the temperatures~${T}_{i}^{n}$ as well as the updated particle positions~$\vectorbold{r}_{i}^{n+1}$ and densities~$\rho_{i}^{n+1}$ the temperature rate $\left(d T_i / d t\right)^{n+1}$ is calculated on the basis of~\eqref{eq:sph_energy} and the temperature is updated according to: \begin{equation} {T}_{i}^{n+1} = {T}_{i}^{n} + \Delta{}t \left(\frac{d T_i}{d t}\right)^{n+1} \, . \end{equation} Using the updated particle temperatures~${T}_{i}^{n+1}$, positions~$\vectorbold{r}_{i}^{n+1}$ and densities~$\rho_{i}^{n+1}$ as well as the intermediate velocities $\vectorbold{u}_{i}^{n+1/2}$ the accelerations~$\vectorbold{a}_{i}^{n+1}$ are calculated from~\eqref{eq:sph_momentum}. In a final kick-step the particle velocities at time step~$n+1$ are determined via \begin{equation} \vectorbold{u}_{i}^{n+1} = \vectorbold{u}_{i}^{n+1/2} + \frac{\Delta{}t}{2} \, \vectorbold{a}_{i}^{n+1} \, . \end{equation} To maintain stability of the time integration scheme the time step size~$\Delta{}t$ is restricted by the Courant-Friedrichs-Lewy (CFL) condition, the viscous condition, the body force condition, the surface tension condition, and the conductivity-condition refer to~\cite{Adami2010, Morris1997, Adami2013, Cleary1998} for more details, \begin{equation} \label{eq:sph_timestepcond} \Delta{}t \leq \min\qty{ 0.25\frac{h}{c+\qty|\vectorbold{u}_{max}|}, \quad 0.125\frac{h^{2}}{\nu}, \quad 0.25\sqrt{\frac{h}{\qty|\vectorbold{b}_{max}|}} , \quad 0.25\sqrt{\frac{\rho h^3}{2 \pi \alpha}} , \quad 0.125 \frac{\rho c_p h^2}{k} } \, , \end{equation} with kinematic viscosity $\nu=\eta/\rho$, maximum fluid velocity~$\vectorbold{u}_{max}$ and maximum body force~$\vectorbold{b}_{max}$.\\ \section{Comparison of different temperature gradient approximations} \label{sec:numex_tantempgrad} In this section, the approximation quality of the different temperature gradient discretizations~\eqref{eq:sph_tempgrad1}-\eqref{eq:sph_tempgrad3} will be investigated. For this purpose the temperature field in the liquid and gas phase of a liquid drop resting on a solid substrate and surrounded by a gas atmosphere will be considered at a representative time step (see Figure~\ref{fig:example1_tempandcolorfield_a}). A detailed description of the problem setup is given in Section~\ref{sec:numex_heateddrop}, where the full thermo-hydrodynamic interaction within this problem is studied. In Figure~\ref{fig:example1_tempandcolorfield_b}, the total color field $\hat{c}_i:=\sum_{j} V_{j} W_{ij}$, which considers contributions from all possible types (i.e. gas, liquid and solid phase) of neighbor particles $j$, is displayed for the considered droplet example. The fact that the color field is close to one throughout the entire domain suggests that all particles have full support and, thus, \textit{two-sided} gradient approximations such as~\eqref{eq:sph_tempgrad1}-\eqref{eq:sph_tempgrad3} might be applicable in general. \begin{figure}[htbp] \centering \subfigure [Temperature field ranging from $1700$ (blue) to $2700$ (red).] { \includegraphics[width=0.47\textwidth]{figures/example1_tempfield.png}% \label{fig:example1_tempandcolorfield_a} } \hspace{0.01\textwidth} \subfigure [Total color field ranging from $0.99$ (blue) to $1.01$ (red).] { \includegraphics[width=0.47\textwidth]{figures/example1_colorfield.png}% \label{fig:example1_tempandcolorfield_b} } \caption{Laser heating of liquid drop (large particles) on solid substrate (not displayed) surrounded by gas (small particles).} \label{fig:example1_tempandcolorfield} \end{figure} It is typically argued that \textit{one-sided} SPH gradient approximations such as the corrective smoothed particle method (CSPM) by Chen et al.~\cite{Chen2001} or the Corrected SPH (CSPH) scheme by Bonet and Lok~\cite{Bonet1999}, which allow for exact representation of first-order gradients even in boundary or interface regions with incomplete particle support, are required to accurately capture a kink in the temperature field resulting from the jump in the thermal conductivity $k$ at fluid-gas interfaces~\cite{Tong2014}. Therefore, the first-order consistent schemes \textit{CSPM} as well as \textit{CSPH} will be considered as reference solutions in this section and compared to the temperature gradient discretizations according to~\eqref{eq:sph_tempgrad1} (variant \textit{Standard}),~\eqref{eq:sph_tempgrad2} (variant \textit{Symmetric}) and~\eqref{eq:sph_tempgrad3} (variant \textit{Asymmetric}). In Figure~\ref{fig:example1_tempgrad}, the temperature gradients associated with the temperature field~\ref{fig:example1_tempandcolorfield_a} are displayed for the variants \textit{CSPM}, \textit{Standard}, \textit{Symmetric} and \textit{Asymmetric} and compared to the variant \textit{CSPH} (shaded). As expected, there is no visual difference of the two \textit{one-sided} gradient approximations (variants \textit{CSPM} and \textit{CSPH} in Figure~\ref{fig:example1_tempgrad_a}). Indeed, the results of these two formulations are identical up to machine precision. However, the non-smooth temperature field across the interface leads to deviations for the other three variants in this region (Figures~\ref{fig:example1_tempgrad_b}-~\ref{fig:example1_tempgrad_d}). While these visible deviations vanish in the interior of the drop for the variant \textit{Asymmetric}, the variants \textit{Standard} and \textit{Symmetric} show large deviations also in this domain, which seems to contradict first intuition. However, this observation can be explained by the fact that the asymmetric formulation exactly filters out constant temperature contributions (exactly vanishing gradient for constant fields), while large constant temperature contributions lead to considerable discretization errors for the variants \textit{Standard} and \textit{Symmetric} due to the lack of zero-order consistency, i.e. $\int_{\Omega} \nabla W\qty(\qty| \vectorbold{r} - \vectorbold{r}' |, h) \dd{\vectorbold{r}'} = 0$ but $\sum_{j} V_{j} \pdv{W}{r_{ij}} \vectorbold{e}_{ij}\neq 0$. The avoidance of large constant contributions is also the reason why the reference pressure is typically set to zero in SPH formulations where the pressure gradient is approximated by the momentum-conserving variant \textit{Symmetric}~\cite{Morris1997}. \begin{figure}[htbp] \centering \subfigure [Variants \textit{CSPM}~\cite{Chen2001} vs. \textit{CSPH}~\cite{Bonet1999} (shaded).] { \includegraphics[width=0.45\textwidth]{figures/example1_tempgrad_Bonet_vs_CSPM.png}% \label{fig:example1_tempgrad_a} } \hspace{0.01\textwidth} \subfigure [Variants \textit{Standard}~\eqref{eq:sph_tempgrad1} vs. \textit{CSPH}~\cite{Bonet1999} (shaded).] { \includegraphics[width=0.45\textwidth]{figures/example1_tempgrad_Bonet_vs_varg.png}% \label{fig:example1_tempgrad_b} } \subfigure [Variants \textit{Symmetric}~\eqref{eq:sph_tempgrad2} vs. \textit{CSPH}~\cite{Bonet1999} (shaded).] { \includegraphics[width=0.45\textwidth]{figures/example1_tempgrad_Bonet_vs_varb.png}% \label{fig:example1_tempgrad_c} } \hspace{0.01\textwidth} \subfigure [Variants \textit{Asymmetric}~\eqref{eq:sph_tempgrad3} vs. \textit{CSPH}~\cite{Bonet1999} (shaded).] { \includegraphics[width=0.45\textwidth]{figures/example1_tempgrad_Bonet_vs_vard.png}% \label{fig:example1_tempgrad_d} } \caption{Laser heating of liquid drop: different approximations for total temperature gradient. Displayed is half of the droplet. The total temperature gradient is visualized by bright (investigated solution) and shaded (reference solution) red arrows.} \label{fig:example1_tempgrad} \end{figure} When considering the tangential projection of the temperature gradient $\nabla_T {T}_i$ as defined in~\eqref{eq:sph_surfacetension2} and displayed in Figure~\ref{fig:example1_fig:example1_tempgradtan}, the observations made above for the variants \textit{CSPH}, \textit{CSPM}, \textit{Standard}, and \textit{Symmetric} can be confirmed. Specifically the latter two variants are not suitable to represent the tangential temperature gradient. In contrast, the variant \textit{Asymmetric} represents the tangential temperature gradient very well without visual difference to the variants \textit{CSPH} and \textit{CSPM} - except for a small deviation at the triple point, which can be expected due to the non-smooth interface line in this region. Therefore, the variant \textit{Asymmetric} according to~\eqref{eq:sph_tempgrad3} will be employed - and favored over the computationally more involved \textit{CSPH} and \textit{CSPM} schemes - in all the remaining numerical examples in this work. In the remainder of this section, a brief analytical explanation will be given on why the \textit{two-sided} gradient approximation~\eqref{eq:sph_tempgrad3} is capable of correctly representing the tangential gradient projection of a temperature field with a kink at the interface. \begin{figure}[htbp] \centering \subfigure [Variants \textit{CSPM}~\cite{Chen2001} vs. \textit{CSPH}~\cite{Bonet1999} (shaded).] { \includegraphics[width=0.45\textwidth]{figures/example1_tempgradtan_Bonet_vs_CSPM.png}% \label{fig:example1_fig:example1_tempgradtan_a} } \hspace{0.01\textwidth} \subfigure [Variants \textit{Standard}~\eqref{eq:sph_tempgrad1} vs. \textit{CSPH}~\cite{Bonet1999} (shaded).] { \includegraphics[width=0.45\textwidth]{figures/example1_tempgradtan_Bonet_vs_varg.png}% \label{fig:example1_fig:example1_tempgradtan_b} } \subfigure [Variants \textit{Symmetric}~\eqref{eq:sph_tempgrad2} vs. \textit{CSPH}~\cite{Bonet1999} (shaded).] { \includegraphics[width=0.45\textwidth]{figures/example1_tempgradtan_Bonet_vs_varb.png}% \label{fig:example1_fig:example1_tempgradtan_c} } \hspace{0.01\textwidth} \subfigure [Variants \textit{Asymmetric}~\eqref{eq:sph_tempgrad3} vs. \textit{CSPH}~\cite{Bonet1999} (shaded).] { \includegraphics[width=0.45\textwidth]{figures/example1_tempgradtan_Bonet_vs_vard.png}% \label{fig:example1_fig:example1_tempgradtan_d} } \caption{Laser heating of liquid drop: different approximations for tangential temperature gradient. Displayed is half of the droplet. The tangential gradient is visualized by bright (investigated solution) and shaded (reference solution) red arrows.} \label{fig:example1_fig:example1_tempgradtan} \end{figure} Let's assume a particle $i$ close to the liquid-gas interface with closest / orthogonal projection point $c$ onto this interface. Furthermore, a coordinate system with axes $\vectorbold{t}_1$ and $\vectorbold{t}_2$ tangential to the interface and axis $\vectorbold{n}$ normal to the interface is defined in point $c$. The position of a material particle expressed in this system shall be denoted as $\tilde{\vectorbold{x}}$, and a quantity evaluated at position $c$ shall be marked by a subscript $(...)_c$. Moreover, subscripts $(...)_n$ and $(...)_t$ represent projections of vectors in interface normal and tangential direction. The first-order Taylor series expansion of the temperature field in the neighborhood of point $c$ is given as: \begin{equation} \label{eq:examp1_tempfield} T(\tilde{\vectorbold{x}}) \approx T_c + \grad{T}_c \cdot \tilde{\vectorbold{x}} = T_c + \boldsymbol{\nabla}_t T_c \cdot \tilde{\vectorbold{x}}_t + \boldsymbol{\nabla}_n T_c \cdot \tilde{\vectorbold{x}}_n \quad \text{with} \quad \boldsymbol{\nabla}_n T_c = \left\{\begin{array}{ll} \boldsymbol{\nabla}_n T_c^+ , & \text{if} \,\, \tilde{\vectorbold{x}}_n \cdot \vectorbold{n} > 0\\ \boldsymbol{\nabla}_n T_c^-, & \text{else}. \end{array}\right. \end{equation} Note that~\eqref{eq:examp1_tempfield} accounts for a jump of the temperature gradient in normal direction as typical for liquid-gas interfaces. According to~\eqref{sph_general_gradient} the projection of the temperature gradient in the tangential directions $\vectorbold{t}_k$ reads: \begin{equation} \label{eq:examp1_gradient1} \vectorbold{t}_k \cdot \grad{T}\qty(\vectorbold{r}_i) \approx \vectorbold{t}_k \cdot \int_{\Omega_i} [T_c + \boldsymbol{\nabla}_t T_c \cdot \tilde{\vectorbold{x}}_t + \boldsymbol{\nabla}_n T_c \cdot \tilde{\vectorbold{x}}_n] \, \grad{W} \dd{\tilde{\vectorbold{x}}} \quad \text{for} \quad k=1,2. \end{equation} In the following, only the third of the three summands will be considered. For simplicity, the integral is reformulated in spherical coordinates $(r,\alpha, \beta)$ using $\tilde{\vectorbold{x}}= r \vectorbold{e}$ with $\vectorbold{e}=\sin \beta \cos \alpha \vectorbold{t}_1 + \sin \beta \sin \alpha \vectorbold{t}_2 + \cos \beta \vectorbold{n}$: \begin{equation} \label{eq:examp1_gradient2} \begin{split} & \vectorbold{t}_k \cdot \int_{\Omega_i} \boldsymbol{\nabla}_n T_c \cdot \tilde{\vectorbold{x}}_n \, \grad{W} \dd{\tilde{\vectorbold{x}}} \\ = & \boldsymbol{\nabla}_n T_c \cdot \int_{r=0}^{r_c} \int_{\beta=0}^{\pi} \int_{\alpha=0}^{2\pi} \underbrace{r \cos \beta \vectorbold{n}}_{\tilde{\vectorbold{x}}_n} \underbrace{\pdv*{W}{r} \vectorbold{e}}_{\grad{W}} \cdot \vectorbold{t}_k \underbrace{r^2 \sin \beta \dd{\alpha} \dd{\beta} \dd{r}}_{\dd{\tilde{\vectorbold{x}}}} \\ = & \boldsymbol{\nabla}_n T_c \! \cdot \! \vectorbold{n} \int_{r=0}^{r_c} r^3 \pdv*{W}{r} \int_{\beta=0}^{\pi} \cos \beta \sin^2 \beta \underbrace{\int_{\alpha=0}^{2\pi} [\cos \alpha \vectorbold{t}_1 \! \cdot \! \vectorbold{t}_k + \sin \alpha \vectorbold{t}_2 \! \cdot \! \vectorbold{t}_k] \dd{\alpha}}_{=0} \dd{\beta} \dd{r} = 0. \end{split} \end{equation} From the second to the third line in~\eqref{eq:examp1_gradient2} use have been made of the spherical symmetry of the kernel $W$, i.e. $\pdv*{W}{r}$ is independent of $\alpha$ and $\beta$. {It is emphasized that only for spherically symmetric kernels the tangential projection of the SPH discretization of a gradient contains only information of the tangential component of the space-continuous gradient, i.e. it is independent of the evolution of the underlying field in normal direction and the third summand in~\eqref{eq:examp1_gradient1} vanishes.} Thus, it can be concluded that standard (two-sided) gradient discretization approaches can be applied since the gradient jump in normal direction does not enter the SPH formulation for the tangential gradient discretization. While this derivation has been made for the \textit{standard} temperature gradient approximation~\eqref{eq:sph_tempgrad1}, the results are equally valid for the \textit{symmetric}~\eqref{eq:sph_tempgrad2} and \textit{asymmetric}~\eqref{eq:sph_tempgrad3} gradient approximation since the main difference is a constant temperature value $T_i$ added to or subtracted from the standard gradient approximation. \section{Numerical examples} \label{sec:numex} \subsection{Liquid droplet in surrounding fluid} \label{sec:numex_migratingbubble} To verify the proposed formulation for temperature-dependent surface tension, cf. Section~\ref{subsec:nummeth_sph_surface tension}, the migration of a liquid droplet as proposed by Ma and Bothe~\cite{Ma2011} is considered. While a finite volume scheme is employed in~\cite{Ma2011}, the same problem has been studied by Tong and Browne~\cite{Tong2014} using an incompressible SPH formulation. The problem consists of a circular droplet (radius $a = 1.44$) of fluid~1 (density $\rho^1=0.25$, dynamic viscosity $\mu^1 = 12.0$, thermal conductivity $k^1=1.2 \times 10^{3}$, heat capacity $c_p^{1} = 50.0$) that is initially resting at the center of a quadratic domain (side length $4a$) filled with fluid~2 ($\rho^2=2\rho^1$, $\mu^2 = 2 \mu^1$, $k^2=2 k^1$, $c_p^{2} = 2 c^{1}$). The temperature-dependent surface tension is defined via $\alpha_0=1.0 \cdot 10^{4}$, $\alpha'_0=2.0 \cdot 10^{3}$ and $T_{\alpha_0}=290$. All properties are given in the units $mm$, $mg$, $s$, and $K$. On the left and right side of the quadratic domain periodic boundary conditions are applied. At the top and bottom of the quadratic domain no-slip boundary conditions for the fluid field as well as prescribed temperatures $\hat{T}^{1}$ (bottom) and $\hat{T}^{2}$ (top) are applied via three layers of boundary particles according to~\cite{Adami2012}. The 2D domain is discretized by a total of 4096 particles (812 particles for fluid 1, 3284 particle for fluid 2) resulting in an initial particle spacing of $\Delta x = 0.09$. Initially, the particles are at rest, i.e. $\boldsymbol{u}_0^1=\boldsymbol{u}_0^2=\boldsymbol{0}$. Like in the original works, the surface tension acts with its full magnitude during the entire simulation time, i.e. no initial ramp function is used. Moreover, the initial temperature profile $T_0$ is chosen as linear interpolation between $\hat{T}^{1}$ and $\hat{T}^{2}$ leading to an initial gradient of $||\grad{T_0}||=(\hat{T}_{2}-\hat{T}_{1})/(4a)$. \subsubsection{Static equilibrium of droplet} As a first test case the pressure jump across the interface of the bubble in a static equilibrium configuration shall be investigated. Thereto the temperatures at the bottom and top wall are prescribed to $\hat{T}_{1}=\hat{T}_{2}=290$. The weakly compressible approach is realized with bulk moduli $K^{1} = 78.125 \cdot 10^{3}$ and $K_{2} = 156.25 \cdot 10^{3}$ (artificial speed of sound $c^1=c^2 \approx 562.5$). The time step size has been chosen to $\Delta t = 4.0 \cdot 10^{-5}$. The analytical solution for this problem setup is a constant temperature field at $T=290$ with the circular droplet of radius $a$ resting at the center of the quadratic domain. While the Marangoni forces vanish for this test case, due to the constant surface tension contribution of $\alpha=\alpha_0=1.0 \cdot 10^{4}$ a pressure jump of $\Delta p = \frac{\alpha_0}{a} \approx 6944$ is expected at the interface of the circular droplet. \begin{figure}[htbp] \centering \subfigure [Static equilibrium: pressure jump $\Delta p := p - p_{\infty}$ over distance $r$ from droplet center for sections horizontal (black) and diagonal (blue) through the droplet.] { \includegraphics[width=0.45\textwidth]{figures/static_droplet1.png}% \label{fig:label_subfig_1} } \hspace{0.01\textwidth} \subfigure [Thermo-capillary migration: dimensionless centroid velocity $U/U_{r}$ over dimensionless time $t/t_{r}$ for present formulation (solid) and reference solution ($+$ marks,~\cite{Ma2011}).] { \includegraphics[width=0.45\textwidth]{figures/static_droplet2.png}% \label{fig:label_subfig_2} } \caption{Different configurations of a droplet within surrounding fluid: static equilibrium and thermo-capillary migration.} \label{fig:example_hydrostatic_pressure} \end{figure} In Figure~\ref{fig:label_subfig_1} the pressure jump $\Delta p := p - p_{\infty}$, with $p_{\infty}$ representing the pressure in fluid~2 at sufficient distance from the droplet interface, is displayed over the distance $r$ from the droplet center for a horizontal (black) as well as a diagonal (45 degrees) section (blue) through the droplet center. Besides slight oscillations at the inner and outer fringe of the interface region, the numerical results show very good agreement with the analytical prediction of the maximal pressure jump at the droplet center given by $\Delta p \approx 6944$. \subsubsection{Thermo-capillary migration of droplet} As a second test case the thermo-capillary migration of the droplet will be considered. Thereto the temperatures at the bottom and top wall are prescribed to $\hat{T}_{1}=290$ and $\hat{T}_{2}=T_{1} + 4 a \qty|\nabla T| = 291.152$ such that the stationary initial temperature field is characterized by a constant gradient $||\grad{T_0}|| = 0.2$. For the simulation of this problem the bulk moduli $K^{1} = 5.0 \cdot 10^{6}$ and $K^{2} = 1.0 \cdot 10^{7}$ (artificial speed of sound $c^1=c^2 \approx 4472.1$) as well as a time step size of $\Delta t = 4.0 \cdot 10^{-5}$ have been chosen. \begin{figure}[htbp] \centering \includegraphics[width=0.7\textwidth]{figures/screenshot_t0_08_3} \caption{Thermo-capillary migration of a droplet (in vertical direction only part of the domain is shown): velocity profile within droplet indicated by arrows and temperature profile of both fluid phases colored in the temperature range from $T_{1} = 290.0$ (blue) to $T_{2} = 291.152$ (red).} \label{fig:example_migrating_droplet} \end{figure} In this test case, temperature-dependent surface tension in combination with the prescribed temperature gradient results in shear stresses (second term in~\eqref{eq:fluid_surfacetension}) and consequently a shear flow (Marangoni convection) at the droplet interface (see Figure~\ref{fig:example_migrating_droplet}). On the one hand, this shear flow induces an upwards migration of the droplet. On the other hand, the shear flow induced in the surrounding fluid~2 redistributes the initially linear temperature profile. In terms of dimensionless numbers the considered choice of parameters leads to a Reynolds number of $Re = \frac{\rho a U_{r}}{\mu} = 0.72$, a Marangoni number of $Ma = \frac{\rho c_{p} a U_{r}}{\lambda} = 0.72$ and a capillary number of $Ca = \frac{\mu U_{r}}{\sigma_{0}} = 0.0576$, where the characteristic velocity $U_{r} = \sigma_{t} \qty|\nabla T| \frac{a}{\mu} = 24$ has been employed. In Figure~\ref{fig:label_subfig_2} the dimensionless velocity $U/U_{r}$, with $U$ calculated via numerical differentiation of the droplet centroid position with respect to time, is plotted over the dimensionless time $t/t_{r}$ with $t_{r}= \frac{a}{U_{r}} = 0.06$. The resulting velocity evolution shows good agreement with the reference solution~\cite{Ma2011}. The slight fluctuations in the steady state regime can be traced back to the employed weakly compressible formulation, while the reference solution in~\cite{Ma2011} has been calculated on the basis of an incompressible formulation. \subsection{Oscillation of liquid dropled surrounded by gas atmosphere} \label{sec:numex_droplet_oscillation} This example aims to investigate the influences of the viscous interface force introduced in Section~\ref{subsec:nummeth_sph_dissipation} as well as of approximated material properties of the gas phase on the solution accuracy of surface tension-dominated problems with parameter values as typical for metal AM. For this purpose the well-known example of surface tension-driven oscillations of a liquid droplet in gas atmosphere is considered~{\cite{Nugent2000, Morris2000, Hu2006, Adami2010}}. The droplet is initially resting at the center of a quadratic gas domain with side length $400 \mu m$ and has an elliptic initial shape (larger semiaxis $a=3/2R$, smaller semiaxis $b=2/3R$, where $R=100 \mu m$ is the droplet radius in the static equilibrium configuration; see Figure~\ref{fig:example2b_tempandcolorfield_a}). The reference pressure of the weakly compressible model is set to $p_0=1.0 \cdot 10^7 N m^{-2}$ and the background pressure of the transport velocity formulation to $p_b=5p_0$ for both phases. Moreover, a time step size of $\Delta t = 10^{-6} ms$ and an initial particle spacing of $\Delta x = 5/3 \mu m$ is applied. Again, the temperature field is kept constant such that Marangoni forces vanish. The material properties of the liquid phase inside the droplet are identical to the ones used for the subsequent melt pool simulations and are given in Table~\ref{tab:material_params}. Moreover, different material properties of the gas phase will be investigated in the following. As reference parameter set the gas phase is modeled such that the density and dynamic viscosity are by a factor of $1000$ smaller as compared to the values of the liquid phase. Driven by the surface tension forces the droplet executes oscillations with period T. Figure~\ref{fig:example2b_tempandcolorfield} illustrates the droplet shapes resulting from the reference parameter set at times $t=0$, $t=T/2$ and $t=T$. \begin{figure}[htbp] \centering \subfigure [Configuration at t=0.] { \includegraphics[width=0.3\textwidth]{figures/example2b_test_bubble_elliptic_2b_step4.png}% \label{fig:example2b_tempandcolorfield_a} } \hspace{0.01\textwidth} \subfigure [Configuration at t=T/2.] { \includegraphics[width=0.3\textwidth]{figures/example2b_test_bubble_elliptic_2b_step788.png}% \label{fig:example2b_tempandcolorfield_b} } \hspace{0.01\textwidth} \subfigure [Configuration at t=T.] { \includegraphics[width=0.3\textwidth]{figures/example2b_test_bubble_elliptic_2b_step1433.png}% \label{fig:example2b_tempandcolorfield_c} } \caption{Oscillation of liquid dropled surrounded by gas atmosphere for reference parameter set at different times.} \label{fig:example2b_tempandcolorfield} \end{figure} For the case of small amplitude oscillations there is an analytical solution for the resulting oscillation period~{\cite{rayleigh1879capillary}} given by $T_a=2\pi \sqrt{R^3 \rho_0^l / (6 \alpha)}$, where $\rho_0^l$ the initial density of the liquid phase. For the given set of parameters the analytical solution for the oscillation period takes on a value of $T_a=0165ms$. For the numerical solution based on the reference parameter set as illustrated in Figure~\ref{fig:example2b_tempandcolorfield} an oscillation period of $T_{ref}=0.179ms$ can be determined. The deviation can be explained by the fact that in the present problem setup, which is considered more representative for melt pool hydrodynamics, \textit{large} amplitude oscillations occur and the damping of the oscillation amplitude resulting from the viscosity of the liquid metal is not negligible in this scenario. Specifically, after one oscillation (i.e. at $t=T$) the initial droplet length $l(t=0)=300 \mu m$ has already decreased to $l(t=T)=280 \mu m$. To increase the computational efficiency (in terms of larger critical time step sizes) and robustness of the numerical formulation the density and dynamic viscosity of the gas phase shall be increased. This procedure is considered reasonable since the focus of this work lies on the thermo-hydrodynamics in the melt phase while an exact representation of detailed flow patterns in the gas phase is not of primary interest. When decreasing the density ratio between liquid and gas phase to $100$ and the dynamic viscosity ratio to $10$ the droplet length after one oscillation is $l(t=T)=274 \mu m$, representing a relative error of $\approx 2 \%$ with respect to the reference parameter set (density and dynamic viscosity ratio of $1000$). Since an error of $\approx 2 \%$ seems reasonable for the intended melt pool simulations, this parameter set ($\rho_0^l/\rho_0^g=100$, $\eta^l/\eta^g=10$) is taken as default value for the subsequent melt pool simulations. Finally, the influence of the viscous interface forces (Section~\ref{subsec:nummeth_sph_dissipation}), which should stabilize the numerical scheme without significantly changing the physical system behavior, will be investigated. For the discretization resolutions and recoil pressure magnitudes considered in the subsequent numerical examples values of the viscosity constant in the range of ${\zeta}_0^{lg} \sim 10^{-4}$ turned out to effectively stabilize the scheme. Considering the default parameter set ($\rho_0^l/\rho_0^g=100$, $\eta^l/\eta^g=10$) and adding additional viscous interface forces with ${\zeta}_0^{lg}=2.5 \cdot 10^{-4}$ and ${\zeta}_0^{lg}=1.0 \cdot 10^{-4}$ results in relative errors of $\approx 6 \%$ and $\approx 2 \%$ in the droplet length $l(T)$ with respect to the solution resulting from the default parameter set ($\rho_0^l/\rho_0^g=100$, $\eta^l/\eta^g=10$) with ${\zeta}_0^{lg}=0$. Again, this accuracy is considered reasonable for the intended melt pool simulations. \subsection{Representative test cases for metal additive manufacturing applications} \label{sec:numex_am} The remaining test cases are designed to verify the proposed formulation with respect to specific effects, conditions and material properties as typical for metal additive manufacturing processes. As representative material properties values close to the parameters for stainless steel at the melting point ($T_m=1700K$) according to~\cite{Khairallah2014} and~\cite{Khairallah2016} are considered. Table~\ref{tab:material_params} represents the corresponding material parameters considered for the liquid metal phase, i.e. for the melt phase. While the solid phase is modeled as rigid and immobile in this work, the thermal problem in the solid phase is solved in the same manner as for the liquid metal phase employing the same thermal material parameters. \begin{table}[htbp] \centering \begin{tabular}{|p{1.5cm}|p{7.0cm}|p{3.0cm}|p{3.0cm}|} \hline Symbol & Property & Value & Units \\ \hline $\rho_0$ & Initial / reference density& $7430$ & $kg \, m^{\!-3}$ \\ \hline $\eta$ & Dynamic viscosity& $6 \cdot 10^{-3}$ & $kg \, m^{\!-1} \, s^{\!-1}$ \\ \hline $\alpha_0$ & Surface tension at reference temperature & $1.8$ & $N \, m^{\!-1}$ \\ \hline $T_{\alpha_0}$ & Reference temperature for surface tension& $1700$ & $K$ \\ \hline $\alpha'_0$ & Surface tension gradient coefficient& $1.0 \cdot 10^{-3}$ & $N \, m^{\!-1} \, K^{\!-1}$ \\ \hline $\theta_0$ & Wetting angle & $60$ & degrees \\ \hline $T_0$ & Initial temperature & $500$ & $K$ \\ \hline $\hat{T}$ & Temperature at Dirichlet boundaries & $500$ & $K$ \\ \hline $T_m$ & Melting temperature & $1700$ & $K$ \\ \hline $T_v$ & Evaporation / boiling temperature & $3000$ & $K$ \\ \hline $c_p$ & Heat capacity & $965$ & $J \, kg^{-1} \, K^{-1}$ \\ \hline $k$ & Thermal conductivity & $35.95$ & $ W\, m^{-1} \, K^{-1}$ \\ \hline $\chi_l$ & Laser absorptivity & $0.5$ & $ - $ \\ \hline $C_P$ & Pressure constant of recoil pressure model & $20$ & $ N \, m^{-2}$ \\ \hline $C_T$ & Temperature constant of recoil pressure model & $1 \cdot 10^5$ & $K$ \\ \hline $h_v$ & Latent heat of evaporation & $6 \cdot 10^6$ & $J \, kg^{-1}$ \\ \hline $T_{h,0}$ & Reference temperature for specific enthalpy & $663.731$ & $K$ \\ \hline $C_M$ & Constant for vapor mass flow & $1.0 \cdot 10^{-3}$ & $K \, s^2 \, m^{-2}$ \\ \hline \end{tabular} \caption{Representative material parameters for stainless steel taken for the liquid metal phase.} \label{tab:material_params} \end{table} Note that the enthalpy reference temperature $T_{h,0}$ has been chosen such that the specific enthalpy at the melting point yields $h(T=T_m)=1 \cdot 10^6 J \, kg^{-1}$ according to~\eqref{eq:fluid_evaporation}. In order to increase the effect of recoil pressure and to make the numerical examples more challenging with respect to the robustness of the proposed formulation, the constants $C_P$ and $C_T$ of the recoil pressure model as well as the laser powers employed in Sections~\ref{sec:numex_2Dmelt_rec} and~\ref{sec:numex_3Dmelt} have been adapted compared to typical values for SLM processes. {Thus, the following examples are intended to demonstrate the robustness of the proposed SPH formulation and its general suitability for challenging application scenarios in metal AM, but not to represent the system behavior of a specific AM experiment with given process and material parameters. In our continued research work additional modeling aspects such as temperature-dependent material parameters or laser beam absorption via ray tracing, capturing e.g. multiple reflection and shading effects, will be incorporated. While these aspects are crucial to resemble detailed characteristics of experimental measurements, they are expected to not significantly influence the general accuracy and robustness of the numerical formulation, which is in the focus of the present study.} For reasons of numerical efficiency, the gas phase is approximated by an reduced density and dynamic viscosity ratio of $\rho_0^l/\rho_0^g=100$ and $\eta^l/\eta^g=10$ as analyzed in the last section. As thermal properties $c_p=10 J \, kg^{-1} \, K^{-1}$, $k=0.026 W\, m^{-1} \, K^{-1}$ and $\chi_l=0$ are chosen for the gas phase. Unless stated otherwise, the following standard discretization and regularization strategy is applied: The reference pressure of the weakly compressible model is set to $p_0=1.0 \cdot 10^7 N m^{-2}$ and the background pressure of the transport velocity formulation to $p_b=5p_0$ for both phases. Moreover, a standard time step size of $\Delta t = 10^{-6} ms$ and an initial particle spacing of $\Delta x = 5/3 \mu m$ is typically applied. Finally, the considered computational domains are surrounded by three layers of boundary particles with prescribed temperature $\hat{T}$ as well as free-slip boundary conditions for the fluid field. \subsubsection{Laser heating of melt drop on solid substrate} \label{sec:numex_heateddrop} \begin{figure}[htbp] \centering \subfigure [Static equilibrium configuration: surface tension gradient coefficient $\alpha'_0/ \rho_0=0.0$. Analytical solution in grey.] { \includegraphics[width=0.95\textwidth]{figures/example3_static_t1_80_new.png}% \label{fig:example3_1} } \subfigure [Low Marangoni convection strength: surface tension gradient coefficient $\alpha'_0/ \rho_0=2.0 \cdot 10^{-8}$.] { \includegraphics[width=0.95\textwidth]{figures/example3_variant_a_t4_62.png}% \label{fig:example3_2} } \subfigure [Medium Marangoni convection strength: surface tension gradient coefficient $\alpha'_0/ \rho_0=5.0 \cdot 10^{-8}$.] { \includegraphics[width=0.95\textwidth]{figures/example3_variant_b_t6_00.png}% \label{fig:example3_3} } \subfigure [High Marangoni convection strength: surface tension gradient coefficient $\alpha'_0/ \rho_0=10.0 \cdot 10^{-8}$.] { \includegraphics[width=0.95\textwidth]{figures/example3_variant_c_t6_00.png}% \label{fig:example3_4} } \caption{Laser heating of melt drop: Melt drop shape, temperature and velocity field for static contact angle $\theta_0=60^o$ and different Marangoni convection strengths ($\alpha'_0/ \rho_0$ in [$(N \, m^{-1} \, K^{-1})/(kg \, m^{-3})$]). Temperature range (left) from $1700K$ (blue) to $2800K$ (red). Velocity range (right) from $0.0 m/s$ (blue) to $4.2 m/s$ (red). Gas and boundary phase not displayed.} \label{fig:example3} \end{figure} In this example, the effects already considered in Section~\ref{sec:numex_migratingbubble} shall be extended by wetting forces and a laser beam heat source. Thereto, a rectangular domain with dimensions $x \in [-100;100], \, y \in [-40;40]$ (all length dimensions given in $\mu m$) is considered. The sub-domain $x \in [-50;50], \, y \in [-40;-10]$ is initially covered with liquid melt, representing a droplet of initially rectangular shape, the remaining domain with gas. The overall domain is surrounded by three layers of boundary particles. In this example, the initial as well as the wall temperature (Dirichlet boundary conditions) have been chosen to $T_0=\hat{T}=1700K$. Note that this choice for the temperature initial and boundary conditions ensures that the melt drop remains liquid at all times and no phase change problem has to be considered in this example. The surface tension coefficient $\alpha_0$ is linearly increased from zero to $1.8 N \, m^{\!-1}$ in the time interval $t \in [0;0.05]$ (all time units in $ms$) and then kept constant throughout the rest of the simulation. Moreover, a static wetting angle of $\theta_0=60^o$ is considered. In the time interval $t \in [0;0.3]$, the laser heat source is set to zero such that the system can reach a static equilibrium configuration under the action of surface tension and wetting forces (see Figure~\ref{fig:example3_1}). In order to enable a fast transition into the equilibrium state, the dynamic viscosity of the melt phase is increased by a factor of ten compared to its standard value (only) in this first time interval $t \in [0;0.3]$. In the remaining simulation time $t \in [0.3;0.6]$, the surface tension, the dynamic viscosity as well as all the other material parameters are kept constant at their standard values according to Table~\ref{tab:material_params}. Additionally, the laser beam heat source is (instantaneously) switched on at $t=0.3$. The laser beam points into negative $y-$direction and its center is located at $x=0$. The irradiance is set to $s^{lg}_{l0} \approx 5.94 \cdot 10^{-3} W \, \mu m^{-2}$ ($s^{lg}_{l0}/\rho_0 = 8 \cdot 10^5 W \, m \, kg^{-1}$) and the characteristic radius to $r_w=40 \mu m$. The reference pressure of the weakly compressible model is set to $p_0= 1.0 \cdot 10^7 N m^{-2}$ for the melt and to $p_0=1.0 \cdot 10^6 N m^{-2}$ for the gas phase. The background pressure of the transport velocity formulation is set to $p_b=p_0$ for both phases. Moreover, a time step size of $\Delta t = 5.0 \cdot 10^{-7} ms$ and an initial particle spacing of $\Delta x = 5/12 \mu m$ is applied.\\ The analytical solution for the shape of the melt domain at the equilibrium state $t=0.3 ms$ is given by a circular segment as illustrated in Figure~\ref{fig:example3_1} in grey color. The numerical solution to this problem is characterized by a highly regular particle distribution and interface normal vector field, which represent the analytical solution with high accuracy (see also Figure~\ref{fig:example3_1}). Figures~\ref{fig:example3_2}-\ref{fig:example3_4} represent the steady state solutions resulting from the laser heating at $t \approx 0.6 ms$ for different choices of the surface tension gradient coefficient $\alpha'_0$ according to~\eqref{eq:fluid_surfacetension_tempdepend}. For simplicity, the ratio $\alpha'_0 / \rho_0$ has been prescribed in the simulations, where the four different variants $\alpha'_0 / \rho_0 = \{0.0, 2.0 \cdot 10^{-8}, 5.0 \cdot 10^{-8}, 10.0 \cdot 10^{-8}\}$ in $[(N \, m^{-1} \, K^{-1})/(kg \, m^{-3})]$ (corresponding to $\alpha'_0 = \{0.0, 1.486 \cdot 10^{-4}, 3.715 \cdot 10^{-4}, 7.43 \cdot 10^{-4}\}$ in $[N \, m^{-1} \, K^{-1}]$) have been analyzed. It can be observed that an increasing surface tension gradient coefficient (from Figure~\ref{fig:example3_2} to \ref{fig:example3_4}) leads to increased Marangoni convection characterized by higher velocity magnitudes and flatter droplet shapes. The combination of very flat droplet shapes and the static wetting angle constraint at the triple points even induces local regions with concave interface curvature for the highest surface tension gradient coefficient $\alpha'_0$ under consideration (Figure~\ref{fig:example3_4}). Besides the flatter droplet shape a higher Marangoni convection also results in a more homogeneous temperature distributions with lower peak temperature values. Both effects, i.e. flat droplets with homogeneous temperature distribution, can be considered as beneficial for typical additive manufacturing processes since problems related to non-smooth surface patterns (e.g. the balling effect due to surface tension-driven Plateau-Rayleigh instabilities~\cite{gusarov2010}) and overheating (e.g. excessive evaporation and keyhole instabilities~\cite{King2014}) are expected to be less pronounced. \subsubsection{2D laser melting with wetting and Marangoni forces} \label{sec:numex_2Dmelt_wetmar} \begin{figure}[htbp] \centering \subfigure [$\alpha'_0/ \rho_0\!=\!0.0$, $t\!=\!0.2ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle75_marangoni00_t2_00} } \subfigure [$\alpha'_0/ \rho_0\!=\!0.0$, $t\!=\!0.5ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle75_marangoni00_t5_00} } \subfigure [$\alpha'_0/ \rho_0\!=\!0.0$, $t\!=\!0.6ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle75_marangoni00_t6_00} } \subfigure [$\alpha'_0/ \rho_0\!=\!0.0$, $t\!=\!0.7ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle75_marangoni00_t7_00} } \\ \subfigure [$\alpha'_0/ \rho_0\!=\!2.0$, $t\!=\!0.2ms$.] { \includegraphics[width=0.22\textwidth]{figures/example4_wetangle75_marangoni02_t2_00} } \subfigure [$\alpha'_0/ \rho_0\!=\!2.0$, $t\!=\!0.5ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle75_marangoni02_t5_00} } \subfigure [$\alpha'_0/ \rho_0\!=\!2.0$, $t\!=\!0.6ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle75_marangoni02_t6_00} } \subfigure [$\alpha'_0/ \rho_0\!=\!2.0$, $t\!=\!0.7ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle75_marangoni02_t7_00} } \\ \subfigure [$\alpha'_0/ \rho_0\!=\!5.0$, $t\!=\!0.2ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle75_marangoni05_t2_00} } \subfigure [$\alpha'_0/ \rho_0\!=\!5.0$, $t\!=\!0.5ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle75_marangoni05_t5_00} } \subfigure [$\alpha'_0/ \rho_0\!=\!5.0$, $t\!=\!0.6ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle75_marangoni05_t6_00} } \subfigure [$\alpha'_0/ \rho_0\!=\!5.0$, $t\!=\!0.7ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle75_marangoni05_t7_00} } \\ \subfigure [$\alpha'_0/ \rho_0\!=\!10.0$, $t\!=\!0.2ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle75_marangoni10_t2_00} } \subfigure [$\alpha'_0/ \rho_0\!=\!10.0$, $t\!=\!0.5ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle75_marangoni10_t5_00} } \subfigure [$\alpha'_0/ \rho_0\!=\!10.0$, $t\!=\!0.6ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle75_marangoni10_t6_00} } \subfigure [$\alpha'_0/ \rho_0\!=\!10.0$, $t\!=\!0.7ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle75_marangoni10_t7_00} } \caption{2D laser melting with wetting and Marangoni forces: Different Marangoni convection strengths ($\alpha'_0/ \rho_0$ in $[10^{-8} (N \, m^{-1} \, K^{-1})/(kg \, m^{-3})]$) and time steps. Static wetting angle $\theta_0 = 75^o$. Temperature range from $1700K$ (blue) to $3500K$ (red). Solid phase in black. Gas and boundary particles not displayed.} \label{fig:example4_0} \end{figure} \begin{figure}[b!!!] \centering \subfigure [$\theta_0 = 30^o$, $t=0.2ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle30_marangoni05_t2_00} } \subfigure [$\theta_0 = 30^o$, $t=0.5ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle30_marangoni05_t5_00} } \subfigure [$\theta_0 = 30^o$, $t=0.6ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle30_marangoni05_t6_00} } \subfigure [$\theta_0 = 30^o$, $t=0.7ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle30_marangoni05_t7_00} } \\ \subfigure [$\theta_0 = 60^o$, $t=0.2ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle60_marangoni05_t2_00} } \subfigure [$\theta_0 = 60^o$, $t=0.5ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle60_marangoni05_t5_00} } \subfigure [$\theta_0 = 60^o$, $t=0.6ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle60_marangoni05_t6_00} } \subfigure [$\theta_0 = 60^o$, $t=0.7ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle60_marangoni05_t7_00} } \\ \subfigure [$\theta_0 = 75^o$, $t=0.2ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle75_marangoni05_t2_00} } \subfigure [$\theta_0 = 75^o$, $t=0.5ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle75_marangoni05_t5_00} } \subfigure [$\theta_0 = 75^o$, $t=0.6ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle75_marangoni05_t6_00} } \subfigure [$\theta_0 = 75^o$, $t=0.7ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle75_marangoni05_t7_00} } \\ \subfigure [$\theta_0 = 90^o$, $t=0.2ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle90_marangoni05_t2_00} } \subfigure [$\theta_0 = 90^o$, $t=0.5ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle90_marangoni05_t5_00} } \subfigure [$\theta_0 = 90^o$, $t=0.6ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle90_marangoni05_t6_00} } \subfigure [$\theta_0 = 90^o$, $t=0.7ms$.] { \includegraphics[width=0.23\textwidth]{figures/example4_wetangle90_marangoni05_t7_00} } \caption{2D laser melting with wetting and Marangoni forces: Different static wetting angles and time steps. Surface tension gradient coefficient $\alpha'_0/ \rho_0 = 5.0 \cdot 10^{-8} (N \, m^{-1} \, K^{-1})/(kg \, m^{-3})$. Temperature range (left) from $1700K$ (blue) to $3500K$ (red). Solid phase in black. Gas and boundary particles not displayed.} \label{fig:example4_1} \end{figure} \begin{figure}[htbp] \centering \subfigure [Low Marangoni convection strength: surface tension gradient coefficient $\alpha'_0/ \rho_0=2.0$.] { \includegraphics[width=1.0\textwidth]{figures/example4_detail_wetangle75_marangoni02_t5_03.png} \label{fig:example4_2a} } \\ \subfigure [Medium Marangoni convection strength: surface tension gradient coefficient $\alpha'_0/ \rho_0=5.0$.] { \includegraphics[width=1.0\textwidth]{figures/example4_detail_wetangle75_marangoni05_t5_01.png} \label{fig:example4_2b} } \\ \subfigure [High Marangoni convection strength: surface tension gradient coefficient $\alpha'_0/ \rho_0=10.0$.] { \includegraphics[width=1.0\textwidth]{figures/example4_detail_wetangle75_marangoni10_t5_00.png} \label{fig:example4_2c} } \caption{2D laser melting with wetting and Marangoni forces: Time step $t=0.5ms$. Static wetting angle $\theta_0 = 75^o$. Different Marangoni convection strengths ($\alpha'_0/ \rho_0$ in $[10^{-8} (N \, m^{-1} \, K^{-1})/(kg \, m^{-3})]$). Temperature range from $1700K$ (blue) to $3500K$ (right). Velocity range (right) from $0.0m/s$ to $0.8m/s$. Solid phase in black. Gas and boundary particles not displayed.} \label{fig:example4_2} \end{figure} In a next step, the system considered in the last example is extended by the phase change problem. Thereto, the problem setup will be changed such that a solid domain exists initially instead of a melt phase domain. Specifically, a rectangular domain with dimensions $x \in [-100;100], \, y \in [-60;60]$ (all length dimensions given in $\mu m$) is considered. The lower half of the domain, i.e. $x \in [-100;100], \, y \in [-60; 0]$ is initially covered with a solid phase, the remaining domain with gas. The overall domain is surrounded by three layers of boundary particles. The initial as well as the wall temperature (Dirichlet boundary conditions) have been chosen to $T_0=\hat{T}=500K$. In the time interval $t \in [0;0.5]$ (all time units given in $ms$), a laser heat source ($s^{lg}_{l0} \approx 7.43 \cdot 10^{9} W \, m^{-2}$, i.e. $s^{lg}_{l0}/\rho_0 = 1.0 \cdot 10^6 W \, m \, kg^{-1}$; $r_w=60 \mu m$; located at $x_0=0$; pointing in negative $y-direction$) is acting onto the surface of the melt and solid material. In the time interval $t \in [0.5;1.0]$ the laser beam is switched off to study the subsequent solidification problem. Since melting is relevant in this test case, an additional viscous force contribution at the solid-liquid interface according to~\eqref{eq:sph_dissipation_sl} with the dimensionless viscosity parameter ${\zeta}^{sl}_0=10$ as well as $T_{max}=3500K$ applied. Note that for this specific example an untypically high value of $T_{max}$ has been chosen to increase the overall viscosity within a large portion of the melt pool, which in turn yields a laminar flow and a smooth velocity profile. This parameter setting has proven beneficial to analyze and isolate the influence of the static wetting angle and of the surface tension gradient coefficient on the resulting flow patterns. All remaining material parameters are chosen according to Table~\ref{tab:material_params}. The reference pressure of the weakly compressible model is set to $p_0=1.0 \cdot 10^7 N m^{-2}$ for the melt and to $p_0=1.0 \cdot 10^6 N m^{-2}$ for the gas phase. The background pressure of the transport velocity formulation is set to $p_b=p_0$ for both phases. Moreover, a time step size of $\Delta t = 2.5 \cdot 10^{-6} ms$ and an initial particle spacing of $\Delta x = 5/6 \mu m$ is applied. In Figure~\ref{fig:example4_0}, the melting and solidification process is displayed at different time instances and for different values of the surface tension gradient coefficient $\alpha'_0$ dictating the strength of the Marangoni convection. As already observed in the last example, the Marangoni convection fosters material transport from the melt pool center (high temperatures) to the edge of the melt pool (lower temperatures) leading to a depression at the melt pool center. Moreover, Marangoni convection (from first to fourth row of Figure~\ref{fig:example4_0}) is an effective means of heat transfer and reduces temperature gradients with increasing surface tension gradient coefficient $\alpha'_0$. During the solidification process (third and fourth column of Figure~\ref{fig:example4_0}) the triple point solid-liquid-gas moves with the solidification front towards the center of the melt pool. The wetting forces, tending to enforce the static wetting angle at the current triple point position, induce an upward warping of the liquid-gas interface while the triple point moves towards the melt pool center. As expected, the resulting peak at the center of the solidified melt pool is less pronounced for the higher values of $\alpha'_0$, since the initial depression of the liquid melt pool due to the Marangoni convection (partly) compensates this warping effect.\\ Similarly, in Figure~\ref{fig:example4_1}, the melting and solidification process is displayed at different time instances and for different values of the static wetting angle $\theta_0$. When comparing the different rows in the first and second column of Figure~\ref{fig:example4_1}, only minor differences can be observed in the resulting melt pool shapes. This observation can be explained by the fact that in all considered cases the triple point lies on (or is very close to) a sharp edge of the solid domain for which no unique normal vector $\vectorbold{n}^{sf}$ can be defined. On the other hand, during the solidification of the melt pool the same warping effect of the liquid-gas interface as in Figure~\ref{fig:example4_0} can be observed. As expected the dimension of the resulting peak at the center of the solidified melt pool increases with increasing values of the static wetting angle $\theta_0$.\\ Eventually, in Figure~\ref{fig:example4_2} also the resulting velocity profiles at $t=0.5ms$ are illustrated for the three different values of the surface tension gradient coefficient $\alpha'_0$ as considered above. The resulting velocity profiles are similar to the ones already observed in Section~\ref{sec:numex_heateddrop} with increasing velocity magnitudes for increasing values of the surface tension gradient coefficient $\alpha'_0$. {While the accuracy of the wetting as well as normal and tangential surface tension force contributions has already been verified individually in Sections~\ref{sec:numex_migratingbubble} and~\ref{sec:numex_droplet_oscillation} (and Figure~\ref{fig:example3_1} of the last section), the remaining examples in this and the last section mainly demonstrate the robustness of the numerical scheme when all these interface forces occur simultaneously. Specifically, the example of this section considers melting and solidification, i.e. a dynamic change of the size/shape of the liquid domain, as additional complexity. While the observed influence of wetting and Marangoni effects on the melt pool shape and dynamics is plausible (see discussion above), a comparison with experimentally observed behavior will be considered in our ongoing research work as additional means of validation.} \subsubsection{2D laser melting with recoil pressure} \label{sec:numex_2Dmelt_rec} \begin{figure}[b!!!] \centering \subfigure [Exemplary melt pool shape from laser melting experiment; taken from~\cite{cunningham2019keyhole}.] { \includegraphics[width=0.31\textwidth]{figures/example5_expsimcomp_exp.png} \label{fig:example5_0a0} } \subfigure [Simulation with SPH model: particle distribution \textit{with} interface viscosity.] { \includegraphics[width=0.31\textwidth]{figures/example5_expsimcomp_sim1.png} \label{fig:example5_0a1} } \subfigure [Simulation with SPH model: particle distribution \textit{without} interface viscosity.] { \includegraphics[width=0.31\textwidth]{figures/example5_expsimcomp_sim2.png} \label{fig:example5_0a2} } \caption{{Melt pool shape from experiment (left). Simulation results for example "2D laser melting with recoil pressure" (\textit{variant 1}) at $t=0.072ms$: Visualization of spurious interface currents and stabilization via viscous interface forces (middle and right). Temperature range from $1700K$ (blue) to $3500K$ (red). Display of solid phase in black and gas phase in light blue.}} \label{fig:example5_0a} \end{figure} The effects studied in Section~\ref{sec:numex_2Dmelt_wetmar} will now be extended by evaporation-induced recoil pressure forces according to~\eqref{eq:fluid_recoil}. In order to study deep keyhole dynamics in the range of high recoil pressure magnitudes, a larger domain with dimensions $x \in [-200;200], \, y \in [-200;200]$ (length dimensions given in $\mu m$) is considered. The lower region with $x \in [-200;200], \, y \in [-200; 40]$ is initially covered with a solid phase, the remaining domain with gas. The overall domain is surrounded by three layers of boundary particles. The initial as well as the wall temperature (Dirichlet boundary conditions) have been chosen to $T_0=\hat{T}=500K$. A laser heat source ($s^{lg}_{l0} \approx 16.0 W \, \mu m^{-2}$; $r_w=30 \mu m$; located at $x_0=0$; pointing in negative $y-$direction) is acting onto the surface of the melt and solid material. Again, an additional viscous force contribution at the solid-liquid interface according to~\eqref{eq:sph_dissipation_sl} with the dimensionless viscosity parameter ${\zeta}^{sl}_0=5$ as well as $T_{max}=2000K$ is applied. Moreover, to reduce numerical instabilities at the liquid-gas interface due to the high recoil pressure forces acting in this example, at this interface an additional viscous force according to~\eqref{eq:sph_dissipation_lg} with ${\zeta}^{lg}_0=2.5 \cdot 10^{-4}$ is applied. To isolate the effect of surface tension-recoil pressure interaction, no wetting and Marangoni forces are considered. All remaining material parameters are chosen according to Table~\ref{tab:material_params}. The reference pressure of the weakly compressible model is set to $p_0=1.0 \cdot 10^7 N m^{-2}$ for the melt and gas phase. \begin{figure}[b!!!] \centering \begin{minipage}{0.95\textwidth} \centering \subfigure [Particle distribution \textit{with} interface viscosity.] { \includegraphics[width=0.45\textwidth]{figures/example5_0/deep5_img0050.png} \label{fig:example5_0b1} } \subfigure [Particle distribution \textit{without} interface viscosity.] { \includegraphics[width=0.45\textwidth]{figures/example5_0/deep2b_img0050.png} \label{fig:example5_0b2} } \subfigure [Velocity field \textit{with} interface viscosity.] { \includegraphics[width=0.45\textwidth]{figures/example5_0/deep5_velarrow_img0050.png} \label{fig:example5_0b3} } \subfigure [Velocity field \textit{without} interface viscosity.] { \includegraphics[width=0.45\textwidth]{figures/example5_0/deep2b_velarrow_img0050.png} \label{fig:example5_0b4} } \caption{2D laser melting with recoil pressure according to \textit{variant 2} at time $t=0.0255ms$: Visualization of spurious interface currents and stabilization via viscous interface forces. Temperature range from $1700K$ (blue) to $3500K$ (red). Velocity range from $0ms^{-1}$ (blue) to $10ms^{-1}$ (red). Display of solid phase in black and gas phase in light blue. Note that only a subdomain with $x \in [-100;100], \, y \in [-100; 100]$ is displayed.} \label{fig:example5_0b} \end{minipage} \end{figure} The background pressure of the transport velocity formulation is set to $p_b=5p_0$ for both phases. Moreover, a time step size of $\Delta t = 1.0 \cdot 10^{-6} ms$ and an initial particle spacing of $\Delta x = 5/3 \mu m$ is applied. The problem setup described by these parameters is denoted as \textit{variant 1} in the following. In order to study the influence of the evaporative mass loss~\eqref{eq:fluid_evaporation} a second variant (\textit{variant 2}) of this problem is considered where this term is neglected (while the recoil pressure is still considered). In order to end up with comparable thermal characteristics the laser irradiance has been decreased to a value of $s^{lg}_{l0} \approx 0.08 W \, \mu m^{-2}$ for \textit{variant 2}, which turned out to result in comparable peak temperatures in the melt pool center. Due to the higher interface dynamics in \textit{variant 2} the viscosity factor in~\eqref{eq:sph_dissipation_lg} is increased to ${\zeta}^{lg}_0=1.0 \cdot 10^{-3}$. Moreover, for \textit{variant 2} a smaller domain with dimensions $x \in [-200;200], \, y \in [-150; 150]$ is considered.\\ To study the influence of the viscous interface force, simulations with and without this additional stabilization term shall be compared. In Figure~\ref{fig:example5_0a} the resulting melt pool shape at $t=0.072ms$ is displayed for these two cases and problem \textit{variant 1}. Without interface stabilization term (Figure~\ref{fig:example5_0a2}) the spurious interface flows lead to a non-smooth, strongly distorted interface topology fostering nonphysical interface dynamics and eventually instability of the numerical scheme. In contrast, the additional interface stabilization term (Figure~\ref{fig:example5_0a1}) results in a smooth and physically reasonable interface topology by damping out the spurious interface flows and thus effectively stabilizing the numerical scheme. The high recoil pressure forces form a deep depression at the center of the melt pool, typically denoted as keyhole. Note that the configuration displayed in Figure~\ref{fig:example5_0a1} is no stationary configuration of the melt pool but rather characterized by high-frequency fluctuations of the liquid-gas interface especially at the bottom of the keyhole. {Qualitatively, Figure~\ref{fig:example5_0a1} shows good agreement with representative experimental results (see Figure~\ref{fig:example5_0a0}, taken from~\cite{cunningham2019keyhole}; note that the specific process parameters from experiment and simulation don't match.)}\\ In Figure~\ref{fig:example5_0b} the melt pool shape resulting from simulations with and without additional stabilization term is displayed for problem \textit{variant 2} at $t=0.0255ms$. The neglect of evaporative heat losses in problem \textit{variant 2} leads to stronger recoil pressure dynamics and, consequently, the spurious interface flows are even more pronounced. The result is a strongly distorted interface topology and velocity field as illustrated in Figures~\ref{fig:example5_0b2} and~\ref{fig:example5_0b4}. Again, the additional interface stabilization term results in a smooth and physically reasonable interface topology and velocity field as shown in Figures~\ref{fig:example5_0b1} and~\ref{fig:example5_0b3}. \begin{figure}[htbp] \centering \subfigure [time: $t=0.079ms$] { \includegraphics[width=0.23\textwidth]{figures/recoil_2d_largeandhighdomain_coarse_highbp_highrecoil_evaploss_5_img0078.png} \label{fig:example5_2_1} } \subfigure [time: $t=0.083ms$] { \includegraphics[width=0.23\textwidth]{figures/recoil_2d_largeandhighdomain_coarse_highbp_highrecoil_evaploss_5_img0082.png} \label{fig:example5_2_2} } \subfigure [time: $t=0.085ms$] { \includegraphics[width=0.23\textwidth]{figures/recoil_2d_largeandhighdomain_coarse_highbp_highrecoil_evaploss_5_img0084.png} \label{fig:example5_2_3} } \subfigure [time: $t=0.089ms$] { \includegraphics[width=0.23\textwidth]{figures/recoil_2d_largeandhighdomain_coarse_highbp_highrecoil_evaploss_5_img0088.png} \label{fig:example5_2_4} } \caption{2D laser melting with recoil pressure according to \textit{variant 1}: creation mechanism of a gas inclusion at different time steps. Temperature range from $1700K$ (blue) to $3500K$ (red). Display of solid phase in black and gas phase in light blue.} \label{fig:example5_2} \end{figure} \begin{figure}[htbp] \centering \subfigure [time: $t=0.056ms$] { \includegraphics[width=0.23\textwidth]{figures/recoil_2d_largedomain_coarse_highbp_2_img0055.png} \label{fig:example5_1_1} } \subfigure [time: $t=0.082ms$] { \includegraphics[width=0.23\textwidth]{figures/recoil_2d_largedomain_coarse_highbp_2_img0081.png} \label{fig:example5_1_2} } \subfigure [time: $t=0.109ms$] { \includegraphics[width=0.23\textwidth]{figures/recoil_2d_largedomain_coarse_highbp_2_img0108.png} \label{fig:example5_1_3} } \subfigure [time: $t=0.135ms$] { \includegraphics[width=0.23\textwidth]{figures/recoil_2d_largedomain_coarse_highbp_2_img0134.png} \label{fig:example5_1_4} } \caption{2D laser melting with recoil pressure according to \textit{variant 2}: process of melt drop ejection at different time steps. Temperature range from $1700K$ (blue) to $3500K$ (red). Display of solid phase in black and gas phase in light blue.} \label{fig:example5_1} \end{figure} Eventually, the melt pool thermo-hydrodynamics resulting from the two considered problem variants shall be studied for longer physical time spans. Figure~\ref{fig:example5_2} displays the system behavior of \textit{variant 1}. Accordingly, the interaction of surface tension and recoil pressure forces leads to oscillations of the liquid-gas interface with maximal amplitudes slightly above the bottom of the keyhole. Once, the amplitudes of these oscillations are large enough such that the opposite keyhole walls gets into touch a liquid bridge forms, which effectively encloses the gas material at the keyhole base - a gas inclusion is formed. Note that this example mainly aims at demonstrating the robustness of the proposed formulation in representing the highly dynamic surface tension-recoil pressure interaction and eventually the formation of a gas bubble. Of course, the employed phenomenological recoil pressure model does not explicitly resolve the high-velocity vapor jet that would arise from the keyhole base in the real physical system. The latter might considerably influence the described creation mechanism of a liquid bridge eventually resulting in a gas inclusion. Moreover, the present formulation does not apply any form of ray tracing for the laser heat source. Specifically, once the gas bubble has formed, the present model applies a heat source term not only on the upper interface of the arising liquid bridge but also at the bottom interface of the gas inclusion (which is visible in Figure~\ref{fig:example5_2_4} through the high peak temperatures at these locations). While an elimination of this deficiency (e.g. via ray tracing) can be considered as rather straight-forward process, the present formulation is still deemed suitable to demonstrate the robustness and general working principle of the proposed model and to study the problem-specific physical phenomena except for the subsequent motion of the closed gas bubble. Figure~\ref{fig:example5_1} displays the melt pool dynamics resulting from problem \textit{variant 2}. The high recoil pressure magnitudes in this variant result in periodic flow patterns consisting of recoil pressure-driven high-velocity waves from the center to the edges of the melt pool and surface tension-driven back flow from the edges to the center. The continued energy input by the laser beam heat sources results in increasing amplitudes of these flow oscillations until eventually melt droplets are ejected at the melt pool edges (Figures~\ref{fig:example5_2_3} and~\ref{fig:example5_2_4}). This example demonstrates that also the highly dynamic evolution of the interface topology during melt drop ejection can be captured by the proposed formulation in a robust manner. \subsubsection{3D laser melting problem with explicitly resolved powder particle geometry} \label{sec:numex_3Dmelt} \begin{figure}[htbp] \centering \subfigure [time: $0.0ms$] { \includegraphics[width=0.44\textwidth]{figures/example6_4c-restart-temperature0000.jpg} \label{fig:example6_1a} } \subfigure [time: $0.080ms$] { \includegraphics[width=0.44\textwidth]{figures/example6_4c-restart-temperature0015.jpeg} \label{fig:example6_1b} } \subfigure [time: $0.180ms$] { \includegraphics[width=0.44\textwidth]{figures/example6_4c-restart-temperature0035.jpeg} \label{fig:example6_1c} } \subfigure [time: $0.455ms$] { \includegraphics[width=0.44\textwidth]{figures/example6_4c-restart-temperature0090.jpeg} \label{fig:example6_1d} } \subfigure [time: $0.630ms$] { \includegraphics[width=0.44\textwidth]{figures/example6_4c-restart-temperature0125.jpeg} \label{fig:example6_1e} } \subfigure [time: $1.000ms$] { \includegraphics[width=0.44\textwidth]{figures/example6_4c-restart-temperature0199.jpeg} \label{fig:example6_1f} } \caption{3D point melting problem with explicitly resolved powder particle geometry: resulting melt pool shape and final topology of solidified surface (post-processed) as well as temperature field in the range from $300K$ (blue) to $3700K$ (red).} \label{fig:example6_1} \end{figure} In this last example, the problem considered in the last section shall be extended to 3D as well as more complex and realistic geometries by resolving individual particles of the metal powder in PBFAM as illustrated in Figure~\ref{fig:example6_1a}. The problem domain is confined by $x \in [-100;100], \, y \in [-100;100 ], \, z \in [-50;50]$ (length dimensions given in $\mu m$). The lower half with $x \in [-100;100], \, y \in [-100;100], \, z \in [-50;0],$ is initially covered with a solid phase, the remaining domain with gas. In addition, (spatially fixed) powder particles with diameters between $160 \mu m$ and $320 \mu m$ are randomly placed on top of the solid substrate. The overall domain is surrounded by three layers of boundary particles. The initial as well as the wall temperature (Dirichlet boundary conditions) have been chosen to $T_0=\hat{T}=500K$. A laser heat source ($s^{lg}_{l0} \approx 1.5 W \, \mu m^{-2}$; $r_w=60 \mu m$; located at $x_0=0$; pointing in negative $z-$direction) is acting onto the surface of the melt and solid material. The material parameters are chosen according to Table~\ref{tab:material_params}. The reference pressure of the weakly compressible model is set to $p_0=1.0 \cdot 10^7 N m^{-2}$ for the melt and gas phase. The background pressure of the transport velocity formulation is set to $p_b=5p_0$ for both phases. Moreover, a time step size of $\Delta t = 1.0 \cdot 10^{-6} ms$ and an initial particle spacing of $\Delta x = 5/3 \mu m$ is applied. The laser beam is switched on only for the time interval $t \in [0;0.5]$ and the cooling / solidification process is considered in the remaining time interval $t \in [0.5;1]$. Thus, in total the discrete problem consists of one million time steps and approximately one million SPH particles. Figure~\ref{fig:example6_1} illustrates the melting and solidification process at different time steps. Surface tension forces dominate volumetric forces such as gravity at the considered length scales and smoothen out the original particle contours almost immediately after melting (see Figures~\ref{fig:example6_1b} and~\ref{fig:example6_1c}). The peak temperatures at the melt pool center exceed the boiling temperature of the liquid metal with ongoing exposure time. The resulting recoil pressure forces foster an increasingly deep depression at the melt pool center as illustrated in Figures~\ref{fig:example6_1c} and~\ref{fig:example6_1d}. For the chosen set of parameters the time scales governing the surface tension forces dominate the time scales of (conductive) heat transfer. Thus, once the laser is switched off, the surface tension forces close the melt pool depression before the liquid metal solidifies again resulting in a smooth and rather plain surface topology at the former melt pool center (see Figure~\ref{fig:example6_1f}). \begin{figure}[htbp] \centering \subfigure [time: approx. $0.12ms$ \hspace{0.22\textwidth}] { \includegraphics[width=0.48\textwidth]{figures/linescan_config1.png} \label{fig:example6_2a} } \subfigure [time: approx. $0.24ms$ \hspace{0.22\textwidth}] { \includegraphics[width=0.48\textwidth]{figures/linescan_config2.png} \label{fig:example6_2b} } \subfigure [time: approx. $0.36ms$ \hspace{0.22\textwidth}] { \includegraphics[width=0.48\textwidth]{figures/linescan_config3.png} \label{fig:example6_2c} } \subfigure [time: approx. $0.48ms$ \hspace{0.22\textwidth}] { \includegraphics[width=0.48\textwidth]{figures/linescan_config4.png} \label{fig:example6_2d} } \caption{3D line melting problem with explicitly resolved powder particle geometry: resulting melt pool shape and final topology of solidified surface (post-processed) as well as temperature field in the range from $300K$ (blue) to $3700K$ (red).} \label{fig:example6_2} \end{figure} Eventually, the example is extended to line scanning by increasing the total length of the domain by a factor of four in $x-$direction, increasing the laser energy density by a factor of two and moving the laser with a constant velocity of $v_x=1m/s$ in $x-$direction. The results are displayed in Figure~\ref{fig:example6_2}. All in all, both variants of this example, i.e. point and line scanning, demonstrate the robustness and general suitability of the proposed SPH formulation for 3D thermo-capillary phase change problems with geometrically complex features as occurring in PBFAM. \section{Conclusion and Outlook} \label{sec:concl} In the present work, a weakly compressible SPH formulation for thermo-capillary phase change problems involving solid, liquid and gaseous phases has been proposed with special focus on laser melting processes such as metal additive manufacturing. Evaporation-induced recoil pressure, temperature-dependent surface tension and wetting forces have been considered as mechanical interface fluxes, while a Gaussian laser beam heat source and evaporation-induced heat losses have been considered as thermal interface fluxes.\\ Specifically, a novel interface stabilization scheme based on viscous interface forces has been proposed, which was shown to effectively damp spurious interface flows well-known for continuum surface force approaches. It was demonstrated that only by this means recoil pressure-dominated problems, which typically arise in metal AM processes in the range of high laser powers, can be represented in a stable and physically accurate manner. Moreover, different SPH discretizations for the tangential projection of the temperature gradient, as required for the discrete Marangoni forces, have been reviewed. It was demonstrated analytically and numerically that standard \textit{two-sided} gradient approximations are sufficient for this purpose as long as zero-order consistency is satisfied, e.g. by anti-symmetric gradient construction.\\ In the context of metal AM melt pool modeling, the proposed formulation has been employed to study the influence of wetting forces and Marangoni convection of different strength on the resulting melt pool dynamics and shape as well as on the topology of the final solidified metal surface. Moreover, the robustness of the proposed scheme has been demonstrated by representing highly dynamic recoil-pressure-induced fluctuations and significant topology changes of the liquid-gas interface, e.g. during the ejection of liquid droplets from the melt pool or the inclusion of gas bubbles into the melt pool. Finally, the robustness, efficiency and general suitability of the proposed SPH formulation for 3D thermo-capillary phase change problems with geometrically complex features has been indicated by means of a 3D laser melting problem with explicit resolution of individual metal powder particles. \section*{Acknowledgements} \label{sec:Acknowledgements} This work was supported by a postdoc fellowship of the German Academic Exchange Service (DAAD) and by funding of the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) within project 437616465 and project 414180263. The authors would like to thank Lennart Schulze for his contributions in the code implementation and comparison of different temperature gradient discretization strategies and Yushen Sun for his support in the visualization of 3D melt pool simulations. \bibliographystyle{elsarticle-num}
{'timestamp': '2021-04-20T02:33:37', 'yymm': '2012', 'arxiv_id': '2012.08788', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08788'}
arxiv
\section{Introduction}\label{sec:introduction}} \else \section{Introduction} \label{sec:introduction} \fi \noindent Analysing the direction of influence between participants in dyadic interactions (i.e., human communication between two people) is of increasing interest in the psychological sciences with applications in psychotherapy \cite{Tschacher2014}, critical political interactions \cite{Renoust2016}, and interpersonal conflict behavior \cite{Reeck2016}, among others. In any interpersonal communication, attitudes towards the interacting partner play a crucial role for the outcome of this interaction (e.g., liking or disliking, engagement or disengagement, trust or no trust towards the interacting partner) \cite{Ambady2000,Todorov2005,Fiske2007}. Often self-report measures or verbal cues are used for getting at attitudes towards the interacting partner. However, most interacting partners are very adapted towards socially desirable behavior and thus would not express negative attitudes in an overt manner. The concept of embodiment \cite{Tschacher2014,Gallese2005,Fuchs2009} denotes the theoretical perspective that mental processes are not isolated from bodily processes. With this view, psychology is becoming increasingly sensitized to investigate the close association between mental and bodily parameters. In this paper, we are interested in the analysis of the direction of emotional influence in dyadic interactions using non-verbal facial expressions. Facial expressions, especially basic emotion expressions, are widely described as being automatic, thus hard to overtly influence and independent of culture \cite{Ekman1976}. As such, they seem a perfect measure for a better understanding of unintentional behavioral cues about social-emotional cognitive processes. Furthermore, there is recent evidence that non-verbal emotion processing is much more relevant than verbal emotion processing \cite{Filippi2017} and that language plays a marginal role in the perception of emotion \cite{Sauter2017}. Novel developments in computer vision yielded accurate, open-source and real-time tools to easily extract bodily parameters from images and videos. In this paper, a complete concept for analyzing the direction of emotional influence in a dyadic face to face dialogues, when starting with raw video material, is presented. We exploit computer vision capabilities for quantitative verification of hypotheses on the direction of emotional influence in experimentally recorded dyadic dialogues using facial expressions only, i.e., facial muscle activation (i.e., Action Units- AUs) \cite{ekman2002facial}. Human nonverbal communication is a process of continual two-sided influence. In a dyadic interaction, such influence occurs over transient time intervals with intensity and direction that are variant over time. To approach the problem of analysing the direction of influence, we first present each person's facial emotional expressions in the form of time series. To investigate who is influencing whom and how, we perform a causal effect analysis on the obtained time series using Granger causality (GC) \cite{geweke1982measurement,GRANGER1980329}, the most widely used method for causal inference in diverse fields \cite{Peters2017,ClimateGC2013,Seth2015,Shadaydeh2019}. GC is based on the idea that causes both precede and help predict their effects. The contributions of this work can be summarized as follows. \begin{itemize} \item[1.] The use of GC for causal inference in nonverbal communication data has been addressed by several authors using different bodily parameters. However, to the best of our knowledge, no other work has used GC to identify the direction of emotional influence when it comes to facial expressions in dyadic dialogues. \item[2.] Using facial expressions in the upper and lower face regions, we were able to extract fine-grained facial features from the six basic emotions \cite{ekman1992argument} which can be present even when strong emotional expressions are not visible. \item[3.] We present a relevant interval selection approach that we use prior to causal inference to identify those transient intervals where causal inference should be applied. The validation of the relevant interval selection on synthetic data for improved causal inference has been presented in \cite{Mueller2019} along with initial results of this study on small data set. Here we show based on a larger real data set the superiority of such an approach in detecting the direction of emotional influence when compared to applying GC test on the entire time-series. \item[4.] The current work is a study of covert attitudes in interacting partners from a 2nd person perspective \cite{Schilbach2013}, meaning in a truly interactive manner. In the past studying real-time social encounters in an interactive manner was described as the “dark matter” of social (neuro-) science as it is typically explored from a 3rd person perspective \cite{Schilbach2013}. Most studies in the field of social cognition \cite{Happe2017} are conducted in a manner that interacting partners observe other interacting partners from a distance (e.g., by judging facial expressions of another person from a picture). However, our work goes a step into the the "dark matter" and is looking at interacting partners that are readily involved, thus continuously responding to the others' actions. \end{itemize} The remainder of this paper is organized as follows. Related work are summarized in Section \ref{sec:Related}. We introduce the experimental setup and used psychological hypotheses in Section \ref{sec:ExperimentalSetup}. The methodological details are presented in Section \ref{sec:methodology} followed by experimental results and discussion in Section \ref{sec:results}. Finally, Conclusions are given in Section \ref{sec:conclusion}. \section{Related Work} \label{sec:Related} The topic of finding causal structures in nonverbal communication data is addressed by Kalimeri et al. \cite{kalimeri2012modeling}. In their paper, the authors used GC for modeling the effects that dominant people might induce when it comes to nonverbal behavior i.e., speech energy and body motion, of other people. Besides audio cues, motion vectors and residual coding bit rate features from skin colored regions were extracted. In two systems, one for body movement and another one for speaking activity, with four-time series each, a small GC based causal network was used to identify the participants with high or low causal influence. Unlike our approach, the authors did not use facial expressions and did not identify relevant intervals in a previous step, but used the entire time series instead. Kaliouby and Robinson \cite{el2005real} provided the first classification system for agreement and disagreement as well as other mental states based on nonverbal cues only. They used head motion and facial AUs together with a dynamic Bayesian network for classification. Also, a survey on cues, databases, and tools related to the detection of spontaneous agreement and disagreement was conducted by Bousmalis et al. \cite{bousmalis2013towards}. Despite their ingenious methods, these approaches did not investigate causal effect relations in a social interaction situation. Postma and Postma-Nilsenova \cite{Postma2016} used the convergent cross mapping method (a causal inference method originating from dynamical systems theory) to study nonverbal interactions. They concluded that there exists bidirectional causal coupling in facial dynamics. Unlike our study, their method focuses on bidirectional causality only rather than identifying all possible directions of emotional influences. Further, their approach was applied to two time-series of single AU over the entire time-series rather than a combination of two or more AUs presenting emotions in selected intervals. Beyond this, Sheerman-Chase et al. \cite{sheerman2009feature} used visual cues to distinguish between states such as thinking, understanding, agreeing, and questioning to recognize agreement. Most intriguingly, Matsuyama et al. \cite{matsuyama2016socially} developed a socially-aware robot assistant responding to visual and vocal cues. For visual features, the robot extracted facial cues (based on OpenFace \cite{baltrusaitis2018openface}) using landmarks, head pose, gaze, and facial AUs. Conversational strategies that build, maintain, or destroy connecting relationships were classified. The researchers' approach investigates the building of a social relationship between a human and a robot; however, this study does not deal with the time-variant direction of causal effect relations. Joo et al. \cite{joo2019towards} recently presented a motion capture data set and a neural network architecture to analyze the direction of influence in a triadic interaction. Their approach focuses on predicting social signals, such as speaking status, social formation, and body gesture. The face is represented using deformable face model with five facial expression parameters. In contrast to Joo et al., we are only interested in facial expressions. This requires a more detailed and supervised representation of facial motion. Several methods, based on temporal causality analysis, have been proposed for categorizing interactions of individuals in video sequences \cite{Prabhakar2010,Prabhakar2012,Ayazoglu2013}. These methods use Granger causality, but they are based on motion analysis of different individuals and are not concerned with facial emotional influences. \section{Experimental Setup and Psychological Hypotheses} \label{sec:ExperimentalSetup} \begin{figure}[!h] \centering \includegraphics[width=0.4\textwidth]{images/ExperimentalSetupBlue.pdf} \caption{Experimental setup showing an example interaction pair (i.e, the sender and receiver) sitting face to face with camera positions towards each interacting partner's face. } \label{fig:ExperimentalSetup} \end{figure} We created an experimental setup (Figure \ref{fig:ExperimentalSetup}) in which two participants sat face to face while talking about their personal weaknesses. One participant was in the assigned role of the receiver (R), the other was in the assigned role of the sender (S). S is instructed to take on a certain attitude (i.e., respectful, objective, contemptuous) whereas R is unaware of this and acts spontaneously. In total, participants were asked to talk to each other about their personal weaknesses three times, either in circumstances of a respectful, contemptuous, or objective/neutral situation. Both partners were given specific times when to speak and when to listen. In all three experimental conditions, each participant kept their initially assigned role of acting as a S or R. The experimental conditions (i.e., respectful, contemptuous, objective) were conducted in various orders for all pairs to avoid the possible confounding effect of the order of these conditions. The objective/neutral condition consisted of the instruction that S and R should behave as neutral as possible (i.e., trying not to react readily towards the interacting partner). Instead, they should take their time to consider the world through the eyes of the other in order to understand their perspective in an uninvolved manner. As only S had the active experimental interaction attitude task (i.e., to behave either respectfully, contemptuously, or objectively), we expected S to influence R in relevant facial expressions. In order to avoid flirtatious situations, that may overwrite the instructed condition, interacting partners were always from the same gender. See materials for the experimental instructions in the supplementary materials, part A. Consistency of emotional influence was secured by the fact that after each conversation both interacting partners filled in a questionnaire in which they indicated in a self-report manner their positive affect during the interaction (i.e., on 4 items using a 7-point Likert scale). This measure revealed a clear linear function: In the respectful condition both interacting partner indicated the highest positive affect (mean value: M= 5.61 and standard deviation: SD= 0.91), followed by the objective condition (M = 5.40, SD = .98), followed by the contemptuous condition (M= 4.15, SD= 1.36). To capture nonverbal facial behavior, we positioned two frontal perspective cameras (Figure \ref{fig:ExperimentalSetup}), recording at 25 frames per second. Camera positions and lighting conditions were optimized during a test session before the study started. This ensured high video quality in terms of a plain frontal view of the faces and two-sided illumination. Motion blur rarely occurred, but could not be prevented entirely, especially in cases of faster movements like head turns. Except for the label of the experimental condition no other information (e.g., expression annotation per frame) were available for image analysis. The entire data set consisted of 34 pairs (mean age = 20.72, 24 female pairs, German-speaking participants), three conditions per pair and about four minutes of video per condition for each of the interacting partners, thus about 13 hours of video material. All participants gave written informed consent. The study was conducted in accordance with the Declaration of Helsinki and approved by the Ethics Committee of the Friedrich Schiller University of Jena. The ethical clearance number is FSV 18/04. Further, the study was pre-registered with aspredicted.org under the title ”Social Communication” $\#$13078 (See pre-registration in the supplementary materials, part B). The psychological research question was, whether and how S and R influence each other given different attitude situations. First, we expected more harmonic expressions (i.e., happiness) when both interacting partners were confronted with medium to high levels of respect (i.e., respectful and objective/neutral vs. contemptuous). Further, we expected the strongest activation of negative expressions (e.g., sadness) in the disrespectful condition (i.e., contemptuous vs. respectful and objective/neutral). Last, we expected, for all emotional facial actions, S to cause the effects and influence R . In terms of the different facial expressions, we expected the strongest GC causality from S to R for positive expressions (i.e., happiness), followed by negative expressions (e.g., sadness). \section{Methodology} \label{sec:methodology} Figure \ref{fig:workflow} shows the workflow of the proposed method. In the following subsections, we introduce the feature extraction procedure, the relevant interval selection approach, and the causal inference method. Then, we combine all these steps to elucidate our entire approach. \begin{figure}[!th] \centering \includegraphics[width=0.5\textwidth]{images/workflow_final.pdf}\caption{ The workflow of the proposed concept for analyzing the direction of emotional influence in dyadic dialogues.} \label{fig:workflow} \end{figure} \subsection{Facial Feature Extraction} \label{sec:FeatureExtraction} \noindent According to Ekman and Rosenberg \cite{ekman1997face}, facial expressions are the most important nonverbal signals when it comes to human interaction. The Facial Action Coding System (FACS) was developed by Ekman and Friesen \cite{ekman1978facial,ekman2002facial}. It specifies facial AUs, based on facial muscle activation. Examples of AUs are the \textit{inner brow raiser}, the \textit{nose wrinkler}, or the \textit{lip corner puller}. Any facial expression is a combination of facial muscles being activated, and thus, can be described by a combination of AUs. Hence, the six basic emotions (\textit{anger}, \textit{fear}, \textit{sadness}, \textit{disgust}, \textit{surprise}, and \textit{happiness}) can also be represented via AUs. Thus, when for example AU 6 (\textit{cheek raiser}), 12 (\textit{lip corner puller}), and 25 (\textit{lips part}) are activated the facial expression \textit{happiness} is visible \cite{langner2010presentation}. In general, all facial dynamic expressions are visual nonverbal communication cues transferable to time-series. Regarding our real experimental data, this approach is reasonable for positive emotions like \textit{happiness}, which is frequently visible throughout the dyadic interactions. Yet, it is not applicable for negatively associated emotions such as \textit{anger, disgust, fear,} or \textit{sadness}, as these emotions tend to be rare in dyadic interactions and thus are often only visible in subtle manners. This is emphasized in Table \ref{tab:emotionCounts}, where we compute the visibility of emotions as defined in \cite{langner2010presentation} in all recordings. \begin{table}[!h] \centering \caption{Percentage of frames where emotions were visible across all experimental conditions.} \begin{tabular}{|c|c|} \hline Emotion & Occurrence (in \%) \\ \hline Happiness & 12.9 \\ Surprise & 1.00 \\ Anger & .15 \\ Disgust & 3.07\\ Fear & .06 \\ Sadness & 1.55 \\ \hline \end{tabular} \label{tab:emotionCounts} \end{table} Wegrzyn et al. \cite{wegrzyn2017mapping} studied the relevance of facial areas for emotion classification and found differences in the importance of the eye and mouth regions. AUs can be divided into upper and lower AUs \cite{cohn2007observer}. Upper AUs belong to the upper half of the face and cover the eye region, whereas AUs in the lower face half cover the mouth region. We decided to split emotions into upper and lower emotions, according to the affiliation of AUs to upper and lower face regions. For example, instead of using \textit{sadness} as a combination of AU1, AU4, AU15 and AU17 we used \textit{sadness upper} (AU1 and AU4) and \textit{sadness lower} (AU15 and AU17). All other emotions were split according to their AUs belonging to the upper or lower facial half (Table \ref{tab:expressionAndAUs}). This procedure ensured that subtle facial expressions were also detectable. \begin{table}[!h] \centering \caption{Expressions and the corresponding AUs.} \label{tab:expressionAndAUs} \begin{tabular}{|c|c|} \hline Expression & Active AUs \\ \hline Happiness upper & 6 \\ Happiness lower & 12, 25 \\ Surprise upper & 1, 2, 5 \\ Surprise lower & 26 \\ Disgust lower & 9, 10, 25 \\ Fear upper & 1, 2, 4, 5 \\ Fear lower & 20, 25 \\ Sadness upper & 1, 4 \\ Sadness lower & 15, 17 \\ Anger upper & 4, 5, 7 \\ Anger lower & 17, 23, 24 \\ \hline \end{tabular} \end{table} In Table \ref{tab:emotionCountsUpperLower} the detection percentage of upper and lower expressions is illustrated. After splitting, the emotional expressions \textit{anger lower}, \textit{sadness lower}, \textit{sadness upper}, and \textit{surprise lower} could be detected in over 7\% of the video material on average. Figure \ref{fig:AUSActivation} illustrates participant with different facial expressions. \begin{table}[!ht] \centering \caption{Percentage of emotional expressions in the upper and lower face parts visible throughout experiment.} \label{tab:emotionCountsUpperLower} \begin{tabular}{|c|c|} \hline Emotion & Detection (in \%) \\ \hline \textit{ Anger lower } & 8.20 \\ \textit{ Anger upper } & .67 \\ \hline \textit{ Disgust lower } & 3.07 \\ \hline \textit{ Fear lower } & 5.94 \\ \textit{ Fear upper } & .97 \\ \hline \textit{ Happiness lower } & 16.24 \\ \textit{ Happiness upper } & 26.32 \\ \hline \textit{ Sadness lower } & 9.28 \\ \textit{ Sadness upper } & 7.05 \\ \hline \textit{ Surprise lower } & 26.91 \\ \textit{ Surprise upper } & 2.48 \\ \hline \end{tabular} \end{table} \begin{figure}[!th] \centering \includegraphics[width=0.4\textwidth]{images/Expressions.pdf} \caption{ Participant with different facial expressions. From left to right: \textit{happiness lower}, \textit{sadness lower}, and \textit{sadness upper}}. \label{fig:AUSActivation} \end{figure} \begin{figure}[!th] \centering \includegraphics[width=0.4\textwidth,height=3cm,keepaspectratio]{images/Face_FacePlusLandmarks.pdf}\\ (a)\\ \includegraphics[width=0.38\textwidth]{images/AUDetectionOnly.pdf}\\ \label{fig:AUDetectionOnly} (b)\\ \caption{ Detection of facial expression \textit{angry}. (a) Landmarks of the facial expression; (b) Detected AUs by OpenFace: Strong activation of AU4 (\textit{brow lowerer}), 7 (\textit{lip tightener}), 14 (\textit{dimpler}), and 17 (\textit{chin raiser})} \label{fig:AUDetection} \end{figure} We evaluated the detection accuracy by mapping AUs to emotions based on the AffectNet dataset \cite{mollahosseini2017affectnet}. We reached an accuracy of $25.8 \%$ for the six basic emotions plus contempt plus neutral. Especially happiness was detected very well, with $77\%$ accuracy, whereas fear and surprise classification seem to be more complex. For feature extraction, we used OpenFace 2.0 \cite{baltrusaitis2018openface,baltruvsaitis2015cross} which is a state-of-the-art, open-source tool for landmark detection; it estimates AUs based on landmark positions. OpenFace preserves much of the information by regressing AUs instead of only classifying them and is capable of extracting 17 different AUs (1, 2, 4, 5, 6, 7, 9, 10, 12, 14, 15, 17, 20, 23, 25, 26, 45) with an intensity scaled from 0 to 5. Figure \ref{fig:AUDetection} illustrates the detection of landmarks and AUs for an example image. Let AUI denotes the action unit I, e.g., AU15 is action unit 15. From the OpenFace detections, we compute each participant's average face across the three conditions. That is, for or each participant we compute the mean $\text{AUI}_{mean}$ and standard deviation $\text{AUI}_{std}$ of the activation of $\text{AUI}$ over all three experimental conditions. We then count $\text{AUI}$ as activated in time frame k, if $\text{AUI}_{k} \ge \text{AUI}_{mean} + 0.5 * \text{AUI}_{std}$. Then an expression is counted as activated when all its corresponding AUs are activated. For example, \textit{sadness lower} is considered to be visible in frame $k$ if $\text{AU15}_{k} \geq \text{AU15}_{mean} + .5*\text{AU15}_{std}$ and $\text{AU17}_{k} \geq \text{AU17}_{mean} + .5*\text{AU17}_{std}$ hold. Following this step, the number of activations per person and per expression was counted for each experimental condition, and normalized by the video length and maximum count of the expression. \subsection{Causal Inference with Granger Causality} \label{sec:GrangerCausality} Let $X$ and $Y$ be two stationary time series with zero mean and length $L$. It is said that a time series $X$ Granger causes a time series $Y$ if the inclusion of past observations of $X$ beside $Y$ improves the prediction of $Y$ significantly when compared to the prediction using only past values of $Y$. These two time series can be represented by the following two vector autoregressive models. \begin{equation} \label{eq:YgcX} X_t = \sum_{j=1}^M a_{j} X_{t-j} + \sum_{j=1}^M b_{j} Y_{t-j} + \varepsilon_t \end{equation} \begin{equation} \label{eq:XgcY} Y_t = \sum_{j=1}^M c_{j} X_{t-j} + \sum_{j=1}^M d_{j} Y_{t-j} + \vartheta_t \end{equation} \noindent where $\quad t = 1 \dots L$ denotes the time index, $\varepsilon_t$ and $\vartheta_t$ being two independent noise processes. The model order $M$ defines the maximum lag used to estimate causal interactions. It can be estimated using either Akaike \cite{Akaike1974} or Bayesian Criterion \cite{Schwarz1978}. The model parameters $a_j,b_j,c_j,d_j, j=1, \ldots, M $ can then be estimated using, for example, the method of Least Squares (LS) \cite{Haykin1996}. To test whether $Y$ Granger causes $X$, two vector autoregressive models are compared. The first model, in which $Y$ is included for predicting $X$, as in (\ref{eq:YgcX}). The second model is \begin{equation} \label{eq:XsimpleModel} X_{t} = \sum_{j=1}^M a'_{j} X_{t-j} + \varepsilon'_t \end{equation} where $Y$ is not included. Those models are then compared against each other via a statistical significance test, where the null hypothesis $H_0$ is tested against the alternative $H_1$, with \begin{eqnarray} H_0: b_1 = \dots = b_M = 0, \\ H_1: \exists b_k \neq 0 \quad k \in \{1 \dots M\}. \end{eqnarray} \noindent These hypotheses are equal to the variable selection problem in linear regression. Hence, an F-Test is applicable with \begin{equation} F = \frac{(|\Sigma_{\varepsilon'}| - |\Sigma_\varepsilon|)(T-2M-1)}{|\Sigma_{\varepsilon'}|~M} \end{equation} where $\Sigma_{\varepsilon'}$ is the covariance matrix of the residual $\varepsilon_t'$ of the simple model in (\ref{eq:XsimpleModel}), and $\Sigma_\varepsilon$ is the covariance matrix of the residual $\varepsilon_t$ of the enriched model in (\ref{eq:YgcX}) . $F$ follows an F-distribution, with $(M, T-2M-1)$ degrees of freedom. The null hypothesis ($Y$ does not Granger cause $X$) can be rejected at a level of significance $\alpha$, if $ F > F_{1-\alpha}(x;M,T-2M-1)$ where $F_{1-\alpha}(x; M,T-2M- 1)$ denotes the value $x$, where the $F(x; M,T- 2M-1) = 1-\alpha$. \noindent To test whether $X$ Granger causes $Y$, the above steps can be applied, but with the first model as in (\ref{eq:XgcY}), the second model being $Y_t = \sum_{j=1}^M d'_{j} Y_{t-j} + \vartheta'_t$. When testing for GC , three different cases regarding the direction of influence can occur \cite{schulze2004granger}: \begin{enumerate} \item[1.] If $c_k = 0$ for $k = 1 \dots M$ and $\exists b_k \neq 0$ for $1 \leq k \leq M$ then $Y$ Granger causes $X$. \item[2.] If $b_k = 0$ for $k = 1 \dots M$ and $\exists c_k \neq 0$ for $1 \leq k \leq M$ then $X$ Granger causes $Y$. \item[3.] If for both $\exists b_k \neq 0$ for $1 \leq k \leq M$ and $\exists c_k \neq 0$ for $1 \leq k \leq M$ then a bidirectional (feedback) relation exists. \end{enumerate} \noindent If none of the above cases holds, $X$ and $Y$ are not Granger causing each other. \subsection{Relevant Interval Selection } \label{sec:InervalSelection} \noindent Considering the experimental setup, we had to expect multiple temporal scenes, further referred to as subintervals, in which the participants influenced each other. The time spans where causality is visible might range from half a second to half a minute. This may occur several times and can be interrupted by irrelevant scenes that differ in the length of time. As outlined above, the direction of influence in a subinterval can either be bidirectional or unidirectional driven by either S or R . This implies that three unwanted effects can occur if the full-time span is analyzed. First, temporal relations are not found at all; second, bidirectional relations mask temporal unidirectional relations and; third, unidirectional relations from $X$ to $Y$ mask temporal bidirectional influences or unidirectional influences from $Y$ to $X$ and vice versa. The estimation accuracy of the causal effect intensity parameters $a_j, b_j, c_j, d_j, j=1, \dots, M$ is mainly influenced by the accuracy of estimating the correlation of the two time series $X$ and $Y$ at different time shifts. When the time series contain several intervals of irrelevant information, the transient similarity in $X$ and $Y$ may not be captured. Figure \ref{fig:corsubints} illustrates that two-time series can have highly correlated subintervals within low correlated full time span interval or low correlated subintervals embedded in high correlated full time span interval. That is to say, that similarity measures that are applied to the entire time range would fail to capture transient similarities. Our central idea is to apply GC only to time series obtained by concatenating highly coherent (e.g., in terms of Pearson correlation) subintervals of raw time series. Instead of using a brute force algorithm, we suggest using a bottom-up approach for finding the longest set of maximal, non-overlapping, correlated intervals in time-series as proposed by Atluri et al. \cite{atluri2014discovering1}. The authors applied their approach to fMRI data where they achieved good results for clustering coherent working brain regions. \begin{figure}[!h] \centering \includegraphics[width=0.45 \textwidth]{images/Subinterval_Correlation_Synthetic_Data.png} \includegraphics[width=0.45\textwidth] {images/Subinterval_Correlation_Synthetic_Data2.png} \caption{Synthetic example of two time series showing wrong reasoning of correlation due to surrounding intervals. Upper graph shows an example of highly correlated subintervals of these time series (Pearson correlation parameter, r=0.85 and r=1) within low correlated interval (r=0.23). While the lower graph shows an example of weakly correlated subinterval (r=0.5) within highly correlated interval (r= 0.85).} \label{fig:corsubints} \end{figure} Let $X$ and $Y$ be two time series of length $L$. An interval is called \textit{correlated interval} for a threshold $\beta$ when all its subintervals up to a lower interval length $L_{min}$ are correlated as well. An interval $I_{(a,b)}$ from $a$ to $b$ is called maximal, when $I_{(a,b)}$ is a \textit{correlated interval}, but $I_{(a-1, b)}$ and $I_{(a,b+1)}$ are not. And two intervals $I_{(a,b)}$ and $I_{(c,d)}$ are called non-overlapping, when $I_{(a,b)} \cap I_{(c,d)} = \emptyset$. From all intervals fulfilling these conditions the longest set (total length of intervals) is computed. In the multivariate case, e.g., when multiple AUs define an expression, we propose to compute the set of relevant intervals for each AU. Using the detection of each AU pair, the intersection over all AUs can be used as the set of selected relevant intervals. In the following, the set of selected relevant intervals between two time-series $X$ and $Y$ is called $AW_{XY}$. \begin{figure}[!h] \includegraphics[width=0.5\textwidth]{images/AU6LaminaDetectionMedianFilter.pdf}\\ {\small (a) Relevant interval selection for AU6.}\\%\label{fig:MultiAU6}\\ \par \par \includegraphics[width=0.5\textwidth]{images/AU12LaminaDetectionMedianFilter.pdf}\\ {\small (b) Relevant interval selection for AU12.}\\ \par \par \includegraphics[width=0.5\textwidth]{images/RelevantIntervalDetectionExample.pdf}\\ {\small (c) Selected intervals for a facial expression with AU6 and AU12 being activated ((a) $\cap$ (b)). }\\ \par\par \includegraphics[width=0.5\textwidth]{images/RelevantIntervalDetectionConcatExample.pdf} {\small (d) Concatenation of the intervals highlighted in (c).}\\ \caption{Process of relevant interval selection in multivariate case, exemplified by AU6 and AU12.} \label{fig:RIS} \end{figure} Figure \ref{fig:RIS} illustrates the selection process, exemplified by AU6 and AU12. First, the relevant intervals are computed for time shifts $s \in \{0,4,8,12\}$ and minimum interval length $L_{min}=75$, between S and R, for AU6 and AU12 separately. After that step, additional processing steps, such as median filtering can be applied. Figure \ref{fig:RIS} (a) shows the relevant intervals of AU6 and Figure \ref{fig:RIS} (b) shows the relevant intervals for AU12, where both sets of relevant intervals were median filtered with kernel size 51. Thereafter, the selected relevant intervals are obtained by computing the intersection between the relevant intervals of AU6 and AU12, as visualized in Figure \ref{fig:RIS} (c). Finally, the selected relevant intervals can be concatenated for further processing, as illustrated in Figure \ref{fig:RIS} (d). \subsection{Causal Inference with Relevant Interval Selection and Granger Causality} \label{ref:ModelCauseEffectRelations} \noindent There are two major challenges in the analysis of the emotional causal effect relation in dyadic dialogues. First, due to the constructed situations, strong distinct emotions, computed by using traditional AU combinations, were barely visible. Second, the time-variant and situation-dependent communication, resulted in high variety and volatility of time spans in which causal effect behavior between interacting partners is visible. To tackle these difficulties, we use a combination of the time series of the facial features described in (\ref{sec:FeatureExtraction}) and the proposed relevant interval selection approach (\ref{sec:InervalSelection}) as detailed in the following steps. \begin{itemize} \item[1.] We applied the relevant interval selection approach pairwise to the time series of the identified AUs of all of the relevant facial expression as illustrated in Figure \ref{fig:RIS}, with a minimum interval length of 75 frames and a threshold of 0.8 for Pearson correlation. Based on known average human reaction times (ca. 200 ms or 6 frames \cite{jain2015comparative}), we shifted one time series by 0, 4, 8, and 12 frames both, back and forth in time, and computed relevant intervals. The grid selected for shifting does cover quicker and slower reactions of participants. Afterwards, we computed the longest set of the list of relevant intervals obtained from the different shifts. Before computing GC, we median filtered the selected intervals with a filter length of 51 (2 seconds) and extended the intervals by 12 frames on each side. We removed frames for both, S and R, when for either S or R the OpenFace confidence value was below .89. The confidence score gives a rough orientation how reliable the AU score computed by OpenFace is. A low confidence score might occur when, for example, the face is occluded or the person moved quickly, which can lead to blurred images. \item[2.] We calculated the average GC on the set of selected intervals of the standardized time-series. The results were counted according to the possible outcomes of the GC test as described in Section \ref{sec:GrangerCausality}, as either unidirectional caused by S, unidirectional caused by R, bidirectional, or no causality. \end{itemize} \section{Experimental Results and Discussion} \label{sec:results} \subsection{Appearance of facial expressions in the different experimental conditions} In order to compare the experimental conditions (i.e., respectfully, contemptuously, and objectively) with regards to total counts of facial expressions for all participants (i.e., S and R), we applied a Wilcoxon signed-rank test. This allowed us to compare how often a specific expression was visible over the full-time span between the different experimental conditions. For testing, we used a Benjamini-Hochberg p-value correction \cite{benjamini1995controlling} with a false discovery rate of $Q = .05$ and individual p-values of 0.05. Table \ref{tab:signed-rank} summarizes the results of the Wilcoxon signed-rank test. As expected, participants showed significantly more happiness upper and lower in the respectful condition than in the contempt and objective condition. Furthermore, as expected, we found more sadness lower and upper expressions in the contempt compared to the objective condition. This is fully in line with our psychological hypotheses and demonstrates that our instructed attitude manipulations for the sender had an effective influence on both interaction partners (i.e., sender and receiver). Note, found expressions for fear lower and disgust lower occurred against expectations (i.e., those were found significantly more in the respectful compared to the objective condition). This is highly valuable information as it suggests that facial happiness and sadness expressions are the most indicative when comparing negative and positive interaction attitudes. Fear and disgust expressions seem to rather occur for attitudes between the extremes (i.e., respectful and contemptuous). \begin{table}[!h] \caption{Results of the Wilcoxon signed-rank (W) test. The table shows only all expressions that were significantly (p-value $<0.05$) different in their occurrence counts between different conditions (Insignificant results are not shown). We permuted all experimental conditions and tested all expressions.} \label{tab:signed-rank} \begin{tabular}{|l|c|c|c|c|} \hline Expression & First & Second & p-value & W test \\ & condition & condition & & statistics \\ \hline Happiness upper & respectful & contempt & .0035 & 695 \\ & respectful & objective & .0001 & 511 \\ \hline Happiness lower & respectful & contempt & .0003 & 580 \\ & respectful & objective & .0017 & 660 \\ \hline Sadness lower & contempt & objective & .0088 & 744 \\ & respectful & objective & .0005 & 606 \\ \hline Sadness upper & contempt & objective & .001 & 635 \\ \hline Fear lower & respectful & objective & .007 & 730 \\ \hline Disgust lower & respectful & objective & .018 & 783 \\ \hline \end{tabular} \end{table} \begin{table*} \centering \caption{Number of pairs for which the Granger causality (GC) test, with p-value =0.05, showed a specific direction of influence in the respectful condition. Average count is the average count of pairs across all expressions. Dominant causal direction (the higher value between Sender GC Receiver (S GC R) and Reciever GC Sender (R GC S)) is shown in bold font.} \label{tab1} \begin{tabular}{|c|c|c|c|c|c|c|c|c|} \hline \hline {\multirow{2}{*}{Expression}} & \multicolumn{4}{c|} {Full Time Span } & \multicolumn{4}{c|} {Relevant Interval Selection } \\ \cline{2-9} & S GC R & R GC S & Bidirectional& No causality & S GC R & R GC S & Bidirectional& No causality\\ \hline Happiness lower & ${\bf 4}$ & 1 & 22 & 7 & ${\bf 8}$ & 4 & 14 & 8 \\ Happiness upper & 1 & ${\bf 3}$ & 24 & 6 & ${\bf 6}$ & 4 & 18 & 6 \\ Sadness lower & 6 & 6 & 4 & 18 & ${\bf 9}$ & 3 & 8 & 14 \\ Sadness upper & ${\bf 6}$ & 0 & 7 & 19 & $ 7$ & {\bf 8} & 6 & 11 \\ \hline Average count & ${\bf 4.25}$ & 2.5 & 14.25 & 12.5 & ${\bf 7.5}$ & 4.75 & 11.5 & 9.75 \\ \hline \hline \end{tabular} \end{table*} \begin{table*} \centering \caption{Number of pairs for which the Granger causality (GC) test, with p-value =0.05, showed a specific direction of influence in the contempt condition. Average count is the average count of pairs across all expressions. Dominant causal direction (the higher value between Sender GC Receiver (S GC R) and Reciever GC Sender (R GC S)) is shown in bold font.} \label{tab2} \begin{tabular}{|c|c|c|c|c|c|c|c|c|} \hline \hline {\multirow{2}{*}{Expression}} & \multicolumn{4}{c|} {Full Time Span } & \multicolumn{4}{c|} {Relevant Interval Selection } \\ \cline{2-9} & S GC R & R GC S & Bidirectional& No causality & S GC R & R GC S & Bidirectional& No causality\\ \hline Happiness lower & ${\bf 3}$ & 2 & 17 & 12 & ${\bf 8}$ & 4 & 10 & 12 \\ Happiness upper & ${\bf 4}$ & 1 & 24 & 5 & 3 & ${\bf 7}$ & 17 & 7 \\ Sadness lower & ${\bf 5}$ & 3 & 10 & 16 & 7 & ${\bf 8}$ & 1 & 18 \\ Sadness upper & ${\bf 5}$ & 3 & 2 & 24 & 4 & ${\bf 5}$ & 6 & 19 \\ \hline \hline Average count & ${\bf 4.25}$ & 2.25 & 13.25 & 14.25 & 5.5 & ${\bf 6}$ & 8.5 & 14 \\ \hline \end{tabular} \end{table*} \begin{table*} \centering \caption{Number of pairs for which the Granger causality (GC) test, with p-value =0.05, showed a specific direction of influence in the neutral/objective condition. Average count is the average count of pairs across all expressions. Dominant causal direction (the higher value between Sender GC Receiver (S GC R) and Reciever GC Sender (R GC S)) is shown in bold font.} \label{tab3} \begin{tabular}{|c|c|c|c|c|c|c|c|c|} \hline \hline {\multirow{2}{*}{Expression}} & \multicolumn{4}{c|} {Full Time Span } & \multicolumn{4}{c|} {Relevant Interval Selection } \\ \cline{2-9} & S GC R & R GC S & Bidirectional& No causality & S GC R & R GC S & Bidirectional& No causality\\ \hline Happiness lower & 0 & ${\bf 5}$ & 23 & 4 & ${\bf 9}$ & 7 & 7 & 9 \\ Happiness upper & ${\bf 5}$ & 0 & 24 & 5 & ${\bf 9}$ & 4 & 21 & 0 \\ Sadness lower & 2 & ${\bf 3}$ & 7 & 22 & ${\bf 6}$ & 7 & 9 & 12 \\ Sadness upper & ${\bf 4}$ & 3 & 3 & 24 & ${\bf 10}$ & 5 & 2 & 17 \\ \hline \hline Average count & 2.75 & 2.75 & 14.25 & 13.75 &${\bf 8.5}$ & 5.75 & 9.75 & 9.5 \\ \hline \hline \end{tabular} \end{table*} \subsection{Direction of emotional influence } In order to study the direction of emotional influence, we compared results of GC test on the relevant interval selection approach versus results of GC test on the full-time span approach. The comparison is represented by the count of pairs for which the Granger causality (GC) test, with p-value =0.05, showed a specific direction of influence, under the three experimental conditions (Tables \ref{tab1} (i.e., respectful), \ref{tab2} (i.e., contemptuouse), and \ref{tab3} (i.e., objective)), for the expressions: happiness upper/lower and sadness upper/lower. These results clearly indicate that the use of the relevant interval selection approach prior to causal inference resulted in considerably more pairs showing unidirectional causation as well as less bidirectional or no causation. Most interestingly, S influences R particularly in the respectful and objective/neutral compared to the contemptuous condition. In the contemptuous condition the pattern of dominant influence changes (i.e., on average R and S influence each other similarly) when using relevant interval selection approach. Psychologically this indicates that the receiver in this condition is actively trying to repair the overall negative interaction quality, for example by inducing emphatic concern in the sender. These result indicate that using facial expressions only holds the potential to reveal covert attitudes and behaviors that would easily be missed and overlooked when working with verbal behavioral cues. That is most likely in situations like these (i.e., an interaction partner acting ignorant and dismissive), a receiver of such contemptuous information would simply produce less speech content. Finally we can notice that inline with prediction there is significantly higher bidirectional influence for positive emotions than in negative emotions in all experimental conditions. However, while we expected considerable reduction in emotional influence from S to R for negative expression when comparing to positive expression, our results indicate that there is only a slight reduction in the influence from S to R for negative expressions, such as sadness lower and upper when using relevant interval selection. For the full time span, the influence of S on R is even higher for negative emotions than positive ones which is against prediction. Overall these results indicate that the use of the relevant interval selection approach significantly improved the detection of the emotional influence in all experimental conditions. \section{Conclusions} \label{sec:conclusion} In this paper, we have presented a complete concept for identifying the direction of emotional influence in nonverbal dyadic communication when starting with raw video materials using facial expressions only. To this end, we presented an algorithm for the extraction of emotional facial features, capable of capturing emotional expressions even when strong distinct emotions are not visible. To improve causal inference we proposed an intelligent interval selection approach for filtering relevant information in dyadic dialogues. Subsequently, we were able to apply Granger causality to the set of selected relevant intervals and compute the direction of influence. We applied our approach to real data obtained from a psychological experimental setup. The obtained results revealed that the use of the relevant interval selection approach combined with the proposed facial features significantly improved the detection of the emotional influence for dyadic communication in various instructed interaction conditions. This work also allowed a major step forward in the 2nd person social sciences as we were able to study social emotions in a truly interactive manner. Further, the results of this study indicate that using facial expressions only holds the potential to study implicit attitudes and behaviors in emotionally laden circumstances that would easily be missed when using speech-content information. Overall, we identify our contribution as an important step towards an interdisciplinary research that combines computer vision potentials, psychological observation, and theoretical knowledge of causality methods, to gain novel insights into emotions in real-time social encounters. For further research, we suggest using a learning system capable of classifying upper and lower emotional expressions based on all AUs. Also it would be interesting to tear apart the contributions of various social information channels (i.e., speech, non-verbal speech, facial expressions) towards outcomes of the interaction experience (e.g., enjoyment, engagement, and liking of interacting partner). \section*{ACKNOWLEDGMENTS} The authors thank the Carl Zeiss Foundation for the financial support within the scope of the program line "Breakthroughs: Exploring Intelligent Systems" for "Digitization — explore the basics, use applications". D. Schneider was supported by the DFG Scientific Network "Understanding Others" - SCHN 1481/2-1. \bibliographystyle{ieeetr}
{'timestamp': '2020-12-17T02:11:37', 'yymm': '2012', 'arxiv_id': '2012.08780', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08780'}
arxiv
\section{Introduction} \label{intro} The pelvis is an important structure connecting the spine and lower limbs and plays a vital role in maintaining the stability of the body and protecting the internal organs of the abdomen. The abnormality of the pelvis, like hip dysplasia~\cite{HipDysplasia} and pelvic fractures~\cite{2018pelvicFracture}, can have a serious impact on our physical health. For example, as the most severe and life-threatening bone injuries, pelvic fractures can wound other organs at the fracture site, and the mortality rate can reach 45\%~\cite{2020openpelvic} at the most severe situation, the open pelvic fractures. Medical imaging~\cite{zhou2021review,zhou2019handbook} plays an important role in the whole process of diagnosis and treatment of patients with pelvic injuries. Compared with X-Ray images, CT preserves the actual anatomic structure including depth information, providing more details about the damaged site to surgeons, so it is often used for 3D reconstruction to make follow-up \textbf{surgery planning} and evaluation of postoperative effects. In these applications, \textbf{accurate pelvic bone segmentation} is crucial for assessing the severity of pelvic injuries and helping surgeons to make correct judgments and choose the appropriate surgical approaches. In the past, surgeons segmented pelvis manually from CT using software like Mimics\footnote{\url{https://en.wikipedia.org/wiki/Mimics}}, which is time-consuming and non-reproducible. To address these clinical needs, we here present an automatic algorithm that can accurately and quickly segment pelvic bones from CT. \begin{figure}[t] \centering \includegraphics[width=0.8\textwidth]{Fig1.pdf} \caption{Pelvic CT image examples with various conditions.} \label{fig-pic-3} \end{figure} Existing methods for pelvic bone segmentation from CT mostly use simple thresholding~\cite{gaussianThreshold_a6}, region growing~\cite{wavelet_a7}, and handcrafted models, which include deformable models~\cite{deformable_a8,activeContour_a9}, statistical shape models~\cite{shapeModel_a10,3DshapeModel_sta1}, watershed~\cite{keyframes_a11} and others~\cite{mriPelvicStruc_tra1,knowledgeOrganSpecificStrategies_tra2,femurSeg_tra3,femurXray_tra4,RFregressionVoting_rfr1,RF&HsparseShape_rfr2}. These methods focus on local gray information and have limited accuracy due to the density differences between cortical and trabecular bones. And trabecular bone is similar to that of the surrounding tissues in terms of texture and intensity. Bone fractures, if present, further lead to weak edges. Recently, deep learning-based methods~\cite{FCN_a13,unet_a12,FabianNNUnet_a4,zhao2017pyramid_dl1,atrousSeparableConvolution_dl2,3dUNet_dl3,pancreaticCyst_dl4,DenseVNet_dl5} have achieved great success in image segmentation; however, their effectiveness for CT pelvic bone segmentation is not fully known. Although there are some datasets related to pelvic bone~\cite{lee2012virtual_pelvicBoneDataset1,wu2016segmentation_pelvicBoneDataset2,hemke2020deep_pelvicBoneDataset3,chandar2016segmentation_pelvicBoneDataset4}, only a few of them are open-sourced and with small size (less than 5 images or 200 slices), far less than other organs~\cite{kits19_url3,MSD}. Although ~\cite{hemke2020deep_pelvicBoneDataset3} conducted experiments based on deep learning, the result was not very good (Dice=0.92) with the dataset only having 200 CT slices. For the robustness of the deep learning method, it is essential to have a comprehensive dataset that includes as many real scenes as possible. In this paper, we bridge this gap by curating a large-scale CT dataset and explore the use of deep learning in this task, which marks, to the best of our knowledge, \textbf{the first real attempt} in this area, with more statistical significance and reference value. To build a comprehensive dataset, we have to deal with diverse image appearance variations due to differences in imaging resolution and field-of-view (FOV), domain shift arising from different sites, the presence of contrasted vessels, coprolith and chyme, bone fractures, low dose, metal artifacts, etc. Fig. \ref{fig-pic-3} gives some examples about these various conditions. Among the above-mentioned appearance variations, the challenge of the metal artifacts is the most difficult to handle. Further, we aim at a multi-class segmentation problem that separates the pelvis into multiple bones, including \textit{lumbar spine}, \textit{sacrum}, \textit{left hip}, and \textit{right hip}, instead of simply segmenting out the whole pelvis from CT. The contributions of this paper are summarized as follows: \begin{itemize} \item A \textit{pelvic CT dataset} pooled from multiple domains and different manufacturers, including $1,184$ CT volumes (over 320K CT slices) of diverse appearance variations (including 75 CTs with metal artifacts). Their multi-bone labels are carefully annotated by experts. We open source it to benefit the whole community; \item Learning a \textit{deep multi-class segmentation network}~\cite{FabianNNUnet_a4} to obtain more effective representations for joint lumbar spine, sacrum, left hip, and right hip segmentation from multi-domain labeled images, thereby yielding desired accuracy and robustness; \item A \textit{fully automatic analysis pipeline} that achieves high accuracy, efficiency, and robustness, thereby enabling its potential use in clinical practices. \end{itemize} \section{Our Dataset} \label{sec:1} \begin{table}[t] \centering \caption{Overview of our large-scale Pelvic CT dataset. `\#' represents the number of 3D volumes. `Tr/Val/Ts' denotes training/validation/testing set. Ticks[\Checkmark] in table refer to we can access the CT images' acquisition equipment manufacturer[M] information of that sub-dataset. Due to the difficulty of labeling the CLINIC-metal, CLINIC-metal is taken off in our supervised training phase.}\label{tab0} \newsavebox{\tablebox} \begin{lrbox}{\tablebox} \begin{tabular}{lrcccc} \hline Dataset name[M] & \# & Mean spacing(mm) & Mean size & \# of Tr/Val/Ts & Source and Year \\ \hline ABDOMEN & 35 & (0.76, 0.76, 3.80) & (512, 512, 73) & 21/7/7 & Public 2015\\ \hline COLONOG[\Checkmark] & 731 & (0.75, 0.75, 0.81) & (512, 512, 323) & 440/146/145& Public 2008\\ \hline MSD\_T10 & 155 & (0.77, 0.77, 4.55) & (512, 512, 63) & 93/31/31& Public 2019\\ \hline KITS19 & 44 & (0.82, 0.82, 1.25) & (512, 512, 240) & 26/9/9& Public 2019\\ \hline CERVIX & 41 & (1.02, 1.02, 2.50) & (512, 512, 102) &24/8/9 & Public 2015 \\ \hline CLINIC[\Checkmark] & 103 & (0.85, 0.85, 0.80) & (512, 512, 345) & 61/21/21& Collected 2020\\ \hline CLINIC-metal[\Checkmark] & 75 & (0.83, 0.83, 0.80) &(512, 512, 334) & 0(61)/0/14 & Collected 2020\\ \hline\hline Our Datasets & $1,184$ &(0.78, 0.78, 1.46) &(512, 512, 273) & 665(61)/222/236 & -\\ \hline \end{tabular} \end{lrbox} \scalebox{0.8}[0.8]{\usebox{\tablebox}} \end{table} \subsection{Data Collection} To build a comprehensive pelvic CT dataset that can replicate practical appearance variations, we curate a large dataset of pelvic CT images from seven sources, two of which come from a clinic and five from existing CT datasets~\cite{COLONOGRAPHY,kits19_url3,MSD,matlas}. The overview of our large dataset is shown in Table~\ref{tab0}. These seven sub-datasets are curated separately from different sites and sources with different characteristics often encountered in the clinic. In these sources, we exclude some cases of very low quality or without pelvic region and remove the unrelated areas outside the pelvis in our current dataset. Among them, the raw data of COLONOG, CLINIC, and CLINIC-metal are stored in a DICOM format, with more information like scanner manufacturers can be accessed. More details about our dataset are given in Online Resource 1\footnote{\url{https://drive.google.com/file/d/115kLXfdSHS9eWxQmxhMmZJBRiSfI8_4_/view}\label{em1}}. We reformat all DICOM images to NIfTI to simplify data processing and de-identify images, meeting the institutional review board (IRB) policies of contributing sites. All existing sub-datasets are under Creative Commons license CC-BY-NC-SA at least and we will keep the license unchanged. For CLINIC and CLINIC-metal sub-datasets, we will open-source them under Creative Commons license CC-BY-NC-SA 4.0. \begin{figure}[t] \centering \includegraphics[width=0.9\columnwidth]{Fig2.pdf} \caption{The designed annotation pipeline based on an AID (Annotation by Iterative Deep Learning) strategy. In Step \uppercase\expandafter{\romannumeral1}, two senior experts first manually annotate 40 cases of data as the initial database. In Step \uppercase\expandafter{\romannumeral2}, we train a deep network based on the human annotated database and use it to predict new data. In Step \uppercase\expandafter{\romannumeral3}, initial annotations from the deep network are checked and modified by human annotators. Step \uppercase\expandafter{\romannumeral2} and Step \uppercase\expandafter{\romannumeral3} are repeated iteratively to refine a deep network to a more and more powerful `annotator'. This deep network `annotator' also unifies the annotation standards of different human annotators.} \label{fig-pic-10} \end{figure} \subsection{Data Annotation} Considering the scale of thousands of cases in our dataset and annotation itself is truly a subjective and time-consuming task. We introduce a strategy of Annotation by Iterative Deep Learning (AID)~\cite{AIL} to speed up our annotation process. In the AID workflow, we train a deep network with a few precisely annotated data in the beginning. Then the deep network is used to automatically annotate more data, followed by revision from human experts. The human-corrected annotations and their corresponding images are added to the training set to retrain a more powerful deep network. These steps are repeated iteratively until we finish our annotation task. In the last, only minimal modification is needed by human experts. The annotation pipeline is shown in Fig.~\ref{fig-pic-10}. In Step \uppercase\expandafter{\romannumeral1}, two senior experts are invited to pixel-wise annotate 40 cases of CLINIC sub-dataset precisely as the initial database based on the results from simple thresholding method, using ITK Snap (Philadelphia, PA) software. All annotations are performed in the transverse plane. The sagittal and coronal planes are used to assist the judgment in the transverse plane. The reason for starting from the CLINIC sub-dataset is that the cancerous bone and surrounding tissues exhibit similar appearances at the fracture site, which needs more prior knowledge guidance from doctors. In Step \uppercase\expandafter{\romannumeral2}, we train a deep network with the updated database and make predictions on new 100 data selected randomly at a time. In Step \uppercase\expandafter{\romannumeral3}, some junior annotators refine the labels based on the prediction results, and each junior annotator is only responsible for part of 100 new data. A coordinator will check the quality of refinement by all junior annotators. For easy cases, the annotation process is over in this stage; for hard cases, senior experts are invited to make more precise annotations. Step \uppercase\expandafter{\romannumeral2} and Step \uppercase\expandafter{\romannumeral3} are repeated until we finish the annotation of all images in our dataset. Finally, we conduct another round of scrutiny for outliers and mistakes and make necessary corrections to ensure the final quality of our dataset. In Fig.~\ref{fig-pic-10}, `Junior annotators' are graduate students in the field of medical image analysis. The `Coordinator' is a medical image analysis practitioner with many years of experience, and the `Senior experts' are cooperating doctors in the partner hospital, one of the best orthopedic hospitals in our country. In total, we have annotations for $1,109$ metal-free CTs and 14 metal-affected CTs. The remaining 61 metal-affected CTs of image are left unannotated and planned for use in unsupervised learning. \section{Segmentation Methodology} \label{sect-2} The overall pipeline of our deep approach for segmenting pelvic bones is illustrated in Fig.~\ref{fig-pic-5}. The input is a 3D CT volume. (i) First, the input is sent to our segmentation module. It is a plug and play (PnP) module that can be replaced at will. (ii) After segmentation is done, we send the multi-class 3D prediction to a SDF post-processor, which removes some false predictions and outputs the final multi-bone segmentation result. \begin{figure}[t] \centering \includegraphics[width=0.9\textwidth]{Fig3.pdf} \caption{Overview of our pelvic bones segmentation system, which learns from multi-domain CT images for effective and robust representations. The 3D U-Net cascade is used here to exploit more spatial information in 3D CT images. SDF is introduced to our post-processor to add distance constraint besides size constraint used in traditional MCR-based method.} \label{fig-pic-5} \vspace{-0.0cm} \end{figure} \subsection{Segmentation Module} \label{subsectionSegModule} Based on our large-scale dataset collected from multiple sources together with annotations, we use a fully supervised method to train a deep network to learn an effective representation of the pelvic bones. The deep learning framework we choose here is 3D U-Net cascade version of nnU-Net~\cite{FabianNNUnet_a4}, which is a robust state-of-the-art deep learning-based medical image segmentation method. 3D U-Net cascade contains two 3D U-net, where the first one is trained on downsampled images (stage 1 in Fig.~\ref{fig-pic-5}), the second one is trained on full resolution images (stage 2 in Fig.~\ref{fig-pic-5}). A 3D network can better exploit the useful 3D spatial information in 3D CT images. Training on downsampled images first can enlarge the size of patches in relation to the image, then also enable the 3D network to learn more contextual information. Training on full resolution images second refines the segmentation results predicted from former U-Net. \subsection{SDF Post Processor} Post-processing is useful for a stable system in clinical use, preventing some mispredictions in some complex scenes. In the segmentation task, current segmentation systems usually determine whether to remove the outliers according to the size of the connected region to reduce mispredictions. However, in the pelvic fractures scene, broken bones may also be removed as outliers. To this end, we introduce the SDF~\cite{sdf_url1} filtering as our post-processing module to add a \textit{distance constraint} besides the \textit{size constraint}. We calculate SDF based on the maximum connected region (MCR) of the anatomical structure in the prediction result, obtaining a 3D distance map that increases from the bone border to the image boundary to help determining whether `outlier prediction' defined by traditional MCR-based method should be removed. \section{Experiments}\label{exp} \subsection{Implementation Details} We implement our method based on open source code of nnU-Net\footnote{\url{https://github.com/mic-dkfz/nnunet}}~\cite{FabianNNUnet_a4}. We also used MONAI\footnote{\url{https://monai.io/}} during our algorithm development. Details please refer to the Online Resource 1\textsuperscript{\ref {em1}}. For our metal-free dataset, we randomly select 3/5, 1/5, 1/5 cases in each sub-dataset as the training set, validation set, and testing set, respectively, and keep such a data partition unchanged in all-dataset experiments and sub-datasets experiments. \begin{table}[t] \centering \small \caption{(a) The DC and HD results for different models tested on `ALL' dataset. (b) Effect of different post-processing methods on `ALL' dataset. `ALL’ refers to the six metal-free sub-datasets. `Average' refers to the mean value of four anatomical structures' DC/HD. `Whole' refers to treating Sacrum, Left hip, Right hip and Lumbar spine as a whole bone. The top three numbers in each part are marked in \textbf{bold}, \textcolor{red}{red} and \textcolor{blue}{blue}.}\label{tab_basic} \begin{lrbox}{\tablebox} \begin{tabular}{lllllllll} \begin{tabular}{lllllllll} \hline Exp & Test & Model & Whole & Sacrum & Left hip & Right hip & Lumbar spine & Average \\ \cline{4-9} & (Dataset)&(Dataset)&Dice/HD&Dice/HD&Dice/HD&Dice/HD&Dice/HD&Dice/HD\\ \hline (a)& ALL & $\Phi_{ALL(2.5D)}$ & \textcolor{red}{.988}/\textbf{9.28} & \textcolor{red}{.979}/\textcolor{blue}{9.34} & \textbf{.990}/\textbf{3.58} & \textcolor{red}{.990}/\textcolor{red}{3.44} & \textcolor{blue}{.978}/\textcolor{blue}{8.32} & \textcolor{blue}{.984}/\textcolor{red}{6.17} \\ & ALL & $\Phi_{ALL(3D)}$ & \textcolor{red}{.988}/\textcolor{blue}{11.38} & \textbf{.984}/\textcolor{red}{8.13} & \textcolor{blue}{.988}/\textcolor{blue}{4.99} & \textcolor{red}{.990}/\textcolor{blue}{4.26} & \textcolor{red}{.982}/\textcolor{red}{7.80} & \textcolor{red}{.986}/\textcolor{blue}{6.30}\\ & ALL & $\Phi_{ALL(3D\_cascade)}$& \textbf{.989}/\textcolor{red}{10.23} & \textbf{.984}/\textbf{7.24} & \textcolor{red}{.989}/\textcolor{red}{4.24} & \textbf{.991}/\textbf{3.03} & \textbf{.984}/\textbf{7.49} & \textbf{.987}/\textbf{5.50}\\ \hline \hline (b)& w/o Post & $\Phi_{ALL}$ & \textcolor{red}{.988}/36.27 & \textbf{.984}/\textcolor{blue}{38.36} & \textcolor{red}{.988}/\textcolor{blue}{35.43} & \textbf{.991}/28.70 & \textcolor{red}{.983}/11.25 & \textbf{.987}/28.43\\ & MCR & $\Phi_{ALL}$ & \textcolor{red}{.988}/12.93 & \textbf{.984}/\textcolor{red}{7.50} & \textbf{.989}/\textbf{4.24} & \textbf{.991}/3.72 & .978/10.46 & \textcolor{red}{.986}/6.48\\ & SDF(5)& $\Phi_{ALL}$ & \textcolor{red}{.988}/12.02 & \textbf{.984}/\textbf{7.24} & \textbf{.989}/\textbf{4.24} & \textbf{.991}/3.51 & \textcolor{blue}{.980}/\textcolor{blue}{9.54} & \textcolor{red}{.986}/6.13\\ & SDF(15)& $\Phi_{ALL}$ & \textbf{.989}/\textcolor{red}{10.40} & \textbf{.984}/\textbf{7.24} & \textbf{.989}/\textbf{4.24} & \textbf{.991}/\textcolor{red}{3.35} & \textbf{.984}/\textcolor{red}{7.61} & \textbf{.987}/\textcolor{red}{5.61}\\ & SDF(35)& $\Phi_{ALL}$ & \textbf{.989}/\textbf{10.23} & \textbf{.984}/\textbf{7.24} & \textbf{.989}/\textbf{4.24} & \textbf{.991}/\textbf{3.03} & \textbf{.984}/\textbf{7.49} & \textbf{.987}/\textbf{5.50}\\ & SDF(55)& $\Phi_{ALL}$ & \textbf{.989}/\textcolor{blue}{10.78} & \textbf{.984}/\textbf{7.24} & \textbf{.989}/\textcolor{red}{4.52} & \textbf{.991}/\textcolor{blue}{3.38} & \textbf{.984}/\textbf{7.49} & \textbf{.987}/\textcolor{blue}{5.66}\\ \hline \end{tabular} \end{tabular} \end{lrbox} \scalebox{0.7}[0.7]{\usebox{\tablebox}} \end{table} \subsection{Results and Discussion}\label{results} \subsubsection{Segmentation Module} To prove that learning from our large-scale pelvic bones CT dataset is helpful to improve the robustness of our segmentation system, we conduct a series of experiments in different aspects. \textbf{Performance of baseline models.} Firstly, we test the performance of models of different dimensions on our entire dataset. The Exp (a) in Table~\ref{tab_basic} shows the quantitative results. $\Phi_{ALL}$ denotes a deep network model trained on `ALL' dataset. Following the conventions in most literature, we use Dice coefficient(DC) and Hausdorff distance (HD) as the metrics for quantitative evaluation. All results are tested on our testing set. Same as we discussed in Sect.~\ref{subsectionSegModule}, $\Phi_{ALL(3D\_cascade)}$ shows the best performance, achieving an average DC of 0.987 and HD of 5.50 voxels, which means 3D U-Net cascade can learn the semantic features of pelvic anatomy better then 2D/3D U-Net. As the following experiments are all trained with 3D U-Net cascade, the mark $_{(3D\_cascade)}$ of $\Phi_{ALL(3D\_cascade)}$ is omitted for notational clarity. \begin{table}[t] \centering \small \caption{The `Average' DC and HD results for different models tested on different datasets. Please refer to the Online Resource 1\textsuperscript{\ref {em1}} for details. The top three numbers in each part are marked in \textbf{bold}, \textcolor{red}{red} and \textcolor{blue}{blue}.}\label{tab_subdataset} \begin{lrbox}{\tablebox} \begin{tabular}{llllllll} \hline Average Dice/HD & & & Test & Datasets & & \\ \cline{2-8} Models &ALL &ABDOMEN&COLONOG&MSD\_T10&KITS19&CERVIX&CLINIC\\ \hline $\Phi_{ABDOMEN}$&.604/92.81 & \textbf{.979}/5.84 &.577/104.04 &\textcolor{blue}{.980}/3.74 &.360/158.02 &.305/92.07 &.342/148.12\\ $\Phi_{COLONOG}$& \textcolor{red}{.985}/\textcolor{red}{5.84} & \textcolor{blue}{.975}/3.29 &\textbf{.989}/\textbf{5.65} &.979/4.41 &\textcolor{blue}{.982}/8.41 &.969/5.17 &.974/9.24 \\ $\Phi_{MSD\_T10}$ & .534/96.14 & \textbf{.979}/\textcolor{blue}{2.97} &.501/106.86 &\textbf{.987}/\textcolor{red}{3.36} &.245/170.39 &.085/111.72 &.261/151.61 \\ $\Phi_{KITS19}$ &.704/68.29 & .255/120.31 &.746/70.75 &.267/121.57 &\textbf{.986}/\textbf{5.65} &\textcolor{red}{.973}/5.14 & \textcolor{blue}{.977}/9.25 \\ $\Phi_{CERVIX}$ &\textcolor{blue}{.973}/\textcolor{blue}{14.75} & .969/4.30 & \textcolor{blue}{.974}/18.74 &.967/6.55 &.979/\textcolor{blue}{7.78} & \textcolor{red}{.973}/\textbf{4.49} & .974/10.17 \\ $\Phi_{CLINIC}$ & .692/69.89 & .275/117.09 &.728/71.93 &.254/126.66 &\textcolor{red}{.985}/11.16 & .968/9.69 & \textbf{.983}/\textbf{7.27}\\ $\Phi_{ALL}$ & \textbf{.987}/\textbf{5.50} & \textbf{.979}/\textcolor{red}{2.88} &\textbf{.989}/\textcolor{red}{5.87} &\textbf{.987}/\textbf{3.11} &\textcolor{red}{.985}/\textcolor{red}{5.77} & \textcolor{blue}{.972}/\textcolor{blue}{5.01} &\textcolor{red}{.982}/\textcolor{red}{7.42} \\ $\Phi_{ex\ sub-dataset}$& - & \textcolor{red}{.978}/\textbf{2.77} &\textcolor{red}{.986}/\textcolor{blue}{7.37} &\textcolor{red}{.984}/\textcolor{blue}{3.37} &\textcolor{blue}{.982}/8.33 &\textbf{.975}/\textcolor{red}{4.92} &.975/\textcolor{blue}{8.87} \\ \hline \end{tabular} \end{lrbox} \scalebox{0.7}[0.7]{\usebox{\tablebox}} \end{table} \begin{figure}[t] \centering \subfigure[mean DC in Table~\ref{tab_subdataset}]{ \begin{minipage}[t]{0.5\linewidth} \centering \includegraphics[width=2in]{Fig5_1.pdf}\\ \end{minipage}% }% \subfigure[mean HD in Table~\ref{tab_subdataset}]{ \begin{minipage}[t]{0.5\linewidth} \centering \includegraphics[width=2in]{Fig5_2.pdf}\\ \end{minipage}% }% \centering \caption{Heat map of DC \& HD results in Table~\ref{tab_subdataset}. The vertical axis represents different sub-datasets and the horizontal axis represents different models. In order to show the normal values more clearly, we clip some outliers to the boundary value, i.e., 0.95 in DC and 30 in HD. The values out of range are marked in the grid. The cross in the lower right corner indicates that there is no corresponding experiment.} \vspace{-0.2cm} \label{table2fig} \end{figure} \textbf{Generalization across sub-datasets.} Secondly, we train six deep networks, one network per single sub-dataset ($\Phi_{ABDOMEN}$, etc.). Then we test them on each sub-dataset. Quantitative and qualitative results are shown in Table~\ref{tab_subdataset} and Fig.~\ref{fig-pic-6}, respectively. We also calculate the performance of $\Phi_{ALL}$ on each sub-dataset. For a fair comparison, cross-testing of sub-dataset networks is also conducted on each sub-dataset's testing set. We observe that the evaluation metrics of model $\Phi_{ALL}$ are generally better than those for the model trained on a single sub-dataset. These models trained on a single sub-dataset are difficult to consistently perform well in other domains, except $\Phi_{COLONOG}$, which contains the largest amount of data from various sources, originally. This observation implies that the domain gap problem does exist and the solution of collecting data directly from multi-source is effective. More intuitively, we show the `Average' values in heat map format in Fig.~\ref{table2fig}. Furthermore, we implement \textit{leave-one-out} cross-validation of these six metal-free sub-datasets to verify the generalization ability of this solution. Models are marked as $\Phi_{ex\ ABDOMEN}$, etc. The results of $\Phi_{ex\ COLONOG}$ can fully explain that training with data from multi-sources can achieve good results on data that has not been seen before. When the models trained separately on the other five sub-datasets cannot achieve good results on COLONOG, aggregating these five sub-datasets can get a comparable result compared with $\Phi_{ALL}$, using only one third of the amount of data. More data from multi-sources can be seen as additional constraints on model learning, prompting the network to learn better feature representations of the pelvic bones and the background. In Fig.~\ref{fig-pic-6}, the above discussions can be seen intuitively through qualitative results. \textbf{Others.} For more experimental results and discussions, e.g. `Generalization across manufacturers', `Limitations of the dataset', please refer to Online Resource 1\textsuperscript{\ref {em1}}. \begin{figure}[t] \includegraphics[width=\textwidth]{Fig4.pdf} \caption{Visualization of segmentation results from six datasets tested on different models. Among them, the white, green, blue and yellow parts of the segmentation results represent the sacrum, left hip bone, right hip bone and lumbar spine, respectively. } \label{fig-pic-6} \end{figure} \subsubsection{SDF post-processor}\label{sdfpostprocessor} The Exp (b) in Table~\ref{tab_basic} shows the effect of the post-processing module. SDF post-processor yields a decrease of 80.7\% and 15.1\% in HD compared with no post-processor and MCR post-processor. Details please refer to Online Resource 1\textsuperscript{\ref {em1}}. The visual effects of two cases are displayed in Fig.~\ref{fig-pic-8}. Large fragments near the anatomical structure are kept with SDF post-processing but are removed by the MCR method. \begin{figure}[t] \includegraphics[width=\textwidth]{Fig6.pdf} \caption{Comparison between post-processing methods: traditional MCR and the proposed SDF filtering.} \label{fig-pic-8} \end{figure} \section{Conclusion} To benefit the pelvic surgery and diagnosis community, we curate and open source\textsuperscript{\ref{opensource}} a large-scale pelvic CT dataset pooled from multiple domains, including $1,184$ CT volumes (over 320K CT slices) of various appearance variations, and present a pelvic segmentation system based on deep learning, which, to the best of our knowledge, marks the first attempt in the literature. We train a multi-class network for segmentation of lumbar spine, sacrum, left hip, and right hip using the multiple-domain images to obtain more effective and robust features. SDF filtering further improves the robustness of the system. This system lays a solid foundation for our future work. We plan to test the significance of our system in real clinical practices, and explore more options based on our dataset, e.g. devising a module for metal-affected CTs and domain-independent pelvic bones segmentation algorithm. \section*{Declarations} \paragraph{Funding} This research was supported in part by the Youth Innovation Promotion Association CAS (grant 2018135). \paragraph{Conflict of interest} The authors have no relevant financial or non-financial interests to disclose. \paragraph{Availability of data and material} Please refer to URL\textsuperscript{\ref{opensource}}. \paragraph{Code availability} Please refer to URL\textsuperscript{\ref{opensource}}. \paragraph{Ethical approval} We have obtained the approval from the Ethics Committee of clinical hospital. \paragraph{Informed consent} Not applicable.
{'timestamp': '2021-04-02T02:13:17', 'yymm': '2012', 'arxiv_id': '2012.08721', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08721'}
arxiv
\section{Introduction} \label{sc:introduction} The stylish Chinese font generation has attracted rising attention within recent years \cite{Lin2016,Cha2020,Chang2017,Tian2017,Kong2017,Jiang2017,Jiang2019,Chang2018,chen2019,Wu2020,Gao2020,Zhang2020}, since it has a wide range of applications including but not limited to the automatic generation of artistic Chinese calligraphy \cite{Zhao2020}, art font design \cite{Lin2014} and personalized style generation of Chinese characters \cite{Liu2012}. The existing Chinese font generation methods can be generally divided into two categories. The first category is firstly to extract some explicit features such as strokes and radicals of Chinese characters and then utilize some traditional machine learning methods to generate new characters \cite{Xu2005,Lin2016}. The quality of feature extraction plays a central role in the first category of Chinese font generation methods. However, such feature extraction procedure is usually hand-crafted, and thus time and effort consuming. The second category of Chinese font generation methods has been recently studied in \cite{Tian2017,Chang2018,chen2019,Gao2020,Wu2020,Zhang2020} with the development of deep learning \cite{Goodfellow2016}, particularly the generative adversarial networks (GAN) \cite{Goodfellow2014}. Due to the powerful expressivity and approximation ability of deep neural networks, feature extraction and generation procedures can be combined into one procedure, and thus, Chinese font generation methods in the second category can be usually realized in an end-to-end training way. Instead of using the stroke or radical features of Chinese characters, the methods in the second category usually regard Chinese characters directly as images, and then translate the Chinese font generation problem into certain image style translation problem \cite{Zhu2017,Isola2017}, for which GAN and its variants are the principal techniques. However, it is well-known that GAN usually suffers from the issue of mode collapse \cite{Goodfellow2014}, that is, producing the same patterns for different inputs by generator. Such issue will significantly degrade the diversity and quality of the generated results (see, Figure \ref{fig:mode-collapse} below). When adapted to Chinese font generation problem, the mode collapse issue will happen more frequently due to there are many Chinese characters with very similar strokes. \begin{figure}[ht] \begin{minipage}[b]{0.99\linewidth} \centering \includegraphics*[scale=0.25]{mode-cllopse.png} \end{minipage} \hfill \caption{CycleGAN for Chinese font generation suggested in \cite{Chang2018} suffers from the mode collapse issue when translating \textit{Black} font to \textit{Shu} font, while the suggested StrokeGAN can effectively tackle this issue. The settings are presented in the later experiment section.} \label{fig:mode-collapse} \end{figure} Due to the artificial nature of Chinese characters, the explicit stroke information contains amount of mode information of Chinese characters (see Figure \ref{fig:32 basic strokes}). This is very different from natural images, which are usually regarded to be generated according to some probability distributions at some latent spaces. Inspired by this observation, in this paper, we at first introduce a one-bit stroke encoding to preserve the key mode information of a Chinese character, and then suggest certain stroke-encoding reconstruction loss to reconstruct the stroke encoding of the generated character such that the key mode information can be well preserved, and finally incorporate them into CycleGAN for Chinese font generation \cite{Chang2018}. Thus, our suggested model is called \textit{StrokeGAN}. The contributions of this paper can be summarized as follows: \begin{enumerate} \item[(a)] We propose an effective method called \textit{StrokeGAN} for the generation of Chinese fonts with unpaired data. Our main idea is firstly to introduce a one-bit stroke encoding to capture the mode information of Chinese characters and then incorporate it into the training of CycleGAN \cite{Chang2018}, in the purpose of alleviating the mode collapse issue of CycleGAN and thus improving the diversity of its generated characters. In order to preserve the stroke encoding, we introduce a stroke-encoding reconstruction loss to the training of CycleGAN. By the use of such one-bit stroke encoding and the associated reconstruction loss, StrokeGAN can effectively alleviate the mode collapse issue for Chinese font generation, as shown by Figure \ref{fig:mode-collapse}. \item[(b)] The effectiveness of StrokeGAN is verified over a set of Chinese character datasets with 9 different fonts (see Figure \ref{fig:stgan-results}), that is, a handwriting font, 3 standard printing fonts and 5 pseudo-handwriting fonts. Compared to CycleGAN for Chinese font generation \cite{Chang2018}, StrokeGAN can generate Chinese characters with higher quality and better diversity, particularly, the strokes are better preserved. Besides CycleGAN \cite{Chang2018}, our method also outperforms the other state-of-the-art methods including zi2zi \cite{Tian2017} and Chinese typography transfer (CTT) method \cite{Chang2017} using paired data, in terms of generating Chinese characters with higher quality and accuracy. Some generated characters by our method with 9 different fonts can be found in Figure \ref{fig:stgan-results}. It can be observed that these generated characters of StrokeGAN are very realistic. \end{enumerate} \begin{figure}[ht] \begin{minipage}[b]{0.99\linewidth} \centering \includegraphics*[scale=0.35]{32-basic-strokes.png} \centerline{{\small (a) 32 basic strokes that make up Chinese characters}} \end{minipage} \hfill \begin{minipage}[b]{0.99\linewidth} \centering \includegraphics*[scale=0.35]{yi-character.png} \centerline{{\small (b) Strokes of the Chinese character "Yi"}} \end{minipage} \hfill \caption{(a) 32 basic strokes that make up Chinese characters. The first and fourth columns present these 32 basic strokes, the second and fifth columns present the names of these basic strokes, and the third and sixth columns present some typical Chinese characters involved these basic strokes. (b) The strokes of the Chinese character "Yi". } \label{fig:32 basic strokes} \end{figure} \begin{figure}[ht] \begin{minipage}[b]{0.99\linewidth} \centering \includegraphics*[scale=0.35]{results.png} \end{minipage} \hfill \caption{Some Chinese characters with 9 different fonts generated by StrokeGAN. The first row presents the generated Chinese characters with the handwriting font, the second to the fourth rows present the generated Chinese characters with three different standard printing fonts, and the fifth to the ninth rows present the generated Chinese characters with five different pseudo-handwriting fonts, which are very different from the standard printing fonts and in general embody more personalized fonts. } \label{fig:stgan-results} \end{figure} \subsection{Related work} In recent years, many generation methods of stylish Chinese fonts have been suggested in the literature \cite{Tian2017,Chang2017,Chang2018,chen2019,Wu2020,Jiang2017,Jiang2019,Zhang2020} with the development of deep learning. In \cite{Tian2017}, the authors adapted \textit{pix2pix} model developed in \cite{Isola2017} for the image style translation problem to Chinese font generation and then suggested \textit{zi2zi} method with paired training data, that is, there is a one-to-one correspondence between the characters in the source (input) style domain and target (output) style domain. Similar idea was extended to realize the Chinese character generation from one font to multiple fonts in \cite{chen2019}. Besides \cite{Tian2017} and \cite{chen2019}, some other paired data based Chinese font generation methods were suggested in \cite{Chang2017,Jiang2017,Wu2020}. However, it is usually human-intensive to build up the paired training data. In order to overcome this challenge, \cite{Chang2018} adapted CycleGAN developed in \cite{Zhu2017} for the image style translation to Chinese font generation based on unpaired training data. Yet, the CycleGAN based method suggested in \cite{Chang2018} (called \textit{CCG-CycleGAN}) may suffer from the mode collapse issue \cite{Goodfellow2014}. When mode collapse occurs, the generator produces fewer patterns for different inputs, and thus significantly degrades the diversity and quality of generated results. Motivated by the observation from traditional Chinese character generation and recognition methods (see \cite{Xu2005,Kim-stroke1999}) that the explicit stroke feature can provide much mode information for a Chinese character, in this paper, we incorporate such stroke information into the training of CycleGAN for Chinese font generation \cite{Chang2018} to tackle the issue of mode collapse, via introducing a one-bit stroke encoding and certain stroke-encoding reconstruction loss. The very recent papers \cite{Wu2020,Jiang2019,Zhang2020} also incorporated some stroke or radical information of Chinese characters into Chinese font generation. Their main idea is firstly to utilize a deep neural network to extract the strokes or radicals of Chinese characters and then merge them by another deep neural network, which is very different to our idea of the use of a very simple one-bit stroke encoding. According to our later numerical experiments, our introduced one-bit stroke encoding is very effective. The rest of this paper is organized as follows. In Section 2\ref{sc:preliminary work}, we present some preliminary work. In Section 3\ref{sc:Stroke GAN}, we introduce the proposed method in detail. In Section 4\ref{sc:experiments}, we provide a series of experiments to demonstrate the effectiveness of the proposed method. We conclude this paper in Section 5\ref{sc:conclusion}. \begin{figure*}[ht] \begin{minipage}[b]{1\linewidth} \centering \includegraphics*[scale=0.43]{network.png} \end{minipage} \hfill \caption{The diagram of StrokeGAN for Chinese font generation. There are a discriminator $D$ and a generator $G$ in StrokeGAN. The workflow of StrokeGAN can be divided into three parts: (a) we at first yield the stroke encodings of Chinese characters via certain one-bit encoding way, and then send the characters to $G$ as input; (b) $G$ at first generates a fake character according to the input character from the source font domain, and later reconstructs a character in the source font domain from the generated fake character in the target font domain such that the reconstructed character is as similar as possible to the original input character; (c) $D$ takes the fake character generated by $G$ and the real character in the source font domain as the input, and attempts to on one hand distinguish whether the generated character is real or fake and on the other hand reconstruct the stroke encoding of the generated character as accurately as possible, compare with the real stroke encoding to preserve the mode information of Chinese characters. The network architectures of generator and discriminator are stacked by the modules presented in the right column. } \label{fig:stgan-model} \end{figure*} \section{Preliminary Work} \label{sc:preliminary work} In this section, we introduce some preliminary work, which serves as the basis of this paper. \subsection{Generative Adversarial Networks} \label{sc:Generative adversarial networks} Generative adversarial networks (GAN) \cite{Goodfellow2014} have achieved great achievements in the task of high-quality image synthesis. The classic GAN model consists of two parts: a generator $G$ and a discriminator $D$. The generator $G$ generates fake images, and the discriminator $D$ judges whether the images generated by $G$ are fake or real. Mathematically, GAN can be formulated as the following two-player minimax game between $G$ and $D$, \begin{align*} \min_G \max_D \ \mathbb{E}_{x\sim \mathbb{P}_{data}} [\log D(x)] + \mathbb{E}_{z\sim \mathbb{P}_{z}} [\log(1-D(G(z)))] \end{align*} where $\mathbb{P}_{data}$ and $\mathbb{P}_{z}$ are the distributions of data $x$ and the input noise variable $z$ for the generator, respectively. In practice, the generator $G$ and discriminator $D$ are generally represented by some deep neural networks. \subsection{Conditional GAN} \label{sc:Conditional-GAN-(cGAN)-and-Cycle-GAN-(CycleGAN)} The conditional GAN (cGAN) was suggested in \cite{Mirza2014} mainly to embed some conditional information such as the category information of samples. Such idea was later exploited in \cite{Isola2017} for the image style translation. For cGAN, besides the original input $z$, the conditional information $c$ is also a part of input for $G$. Thus, the objective for GAN should be slightly modified for cGAN, shown as follows: \begin{align*} {\cal L}_{adv}(D,G) &=\mathbb{E}_{x\sim \mathbb{P}_{data}} [\log D(x)] \\ &+ \mathbb{E}_{z\sim \mathbb{P}_{z}, c\sim \mathbb{P}_c} [\log(1-D(G(z,c)))], \nonumber \end{align*} where $\mathbb{P}_c$ represents the distribution of the referred conditional information $c$. \subsection{CycleGAN} The training of cGAN \cite{Isola2017} is based on the paired data, of which the collection is usually time-consuming and laborious. In order to overcome this challenge, CycleGAN was proposed in \cite{Zhu2017} for the image style translation based on the unpaired data. The main idea of CycleGAN is to preserve key attributes between the source and target domains by utilizing a cycle consistency loss. Specifically, let $x\in {\cal X}$ and $x'\in {\cal X}'$ be two images from two different style domains conditioned on respectively some conditional information domains $c\in {\cal C}$ and $c' \in {\cal C}'$. In order to realize the bidirectional translation between them, two generators $G:{\cal X} \times {\cal C} \rightarrow {\cal X}'$ and $G':{\cal X}' \times {\cal C}' \rightarrow {\cal X}$ are exploited. With these, the cycle consistency loss can be defined as follows: \begin{align*} {\cal L}_{cyc}(G,G') &= \mathbb{E}_{x\sim \mathbb{P}_x, c \sim \mathbb{P}_c, c' \sim \mathbb{P}_{c'}}[\|x-G'(G(x,c),c')\|_1]\\ &+\mathbb{E}_{x'\sim \mathbb{P}_{x'}, c' \sim \mathbb{P}_{c'}, c \sim \mathbb{P}_c}[\|x'-G(G'(x',c'),c)\|_1], \end{align*} where $x\in {\cal X}$, $x'\in {\cal X}'$, $c\in {\cal C}$, $c'\in {\cal C}'$, and $\mathbb{P}_*$ represents the distribution of the associated domain $*$. The generators $G$ and $G'$ are trained to make the cycle consistency loss ${\cal L}_{cyc}(G,G')$ small. \section{StrokeGAN for Chinese Font Generation} \label{sc:Stroke GAN} In this section, we describe the proposed \textit{StrokeGAN} for automatic generation of stylish Chinese font. The core idea of StrokeGAN is to incorporate some one-bit stroke encodings of Chinese characters into CycleGAN to alleviate the issue of mode collapse, as presented in Figure \ref{fig:stgan-model}, mainly motivated by the basic observation that the stroke information embodies amount of mode information of Chinese characters. Recent studies suggested that mode collapse in GANs might be a by-product of removing sparse outlying modes toward robust estimation \cite{Yao2019iclr,Yao2020jmlr}. So a natural strategy to alleviate mode collapse is to enforce faithful conditional distribution reconstruction, conditioning on important modes represented by stroke encoding here. From Figure \ref{fig:stgan-model}, we at first yield the stroke encodings of Chinese characters via certain one-bit encoding way, and then take the characters in the source font domain as the inputs of generator $G$. After $G$, we yield a fake character in the target domain, then send such fake character to both generator and discriminator, where generator tries to reconstruct the character in the source font domain, and discriminator attempts to distinguish whether the generated character is real or fake and also reconstruct its stroke encoding. Thus, distinguished with the original CycleGAN for Chinese font generation in \cite{Chang2018}, there are two parts in the discriminator $D$, i.e., \[ D : x \rightarrow (D_{src}(x), D_{st}(x)), \] where $D_{src}(x)$ and $D_{st}(x)$ represent respectively the probability distribution over the source font domain and its stroke encoding for a given character $x$. \subsection{Stroke Encoding} \label{sc:structure loss} From Figure \ref{fig:stgan-model}, the stroke encoding of character is taken as a part of input of CycleGAN. To realize this, we introduce a simple one-bit encoding way to yield the associated stroke encoding for a given Chinese character. Specifically, according to Figure \ref{fig:32 basic strokes}, there are in total 32 kinds of strokes to make up Chinese characters. Thus, for any given Chinese character $x$, we define its stroke encoding as a 32-dimensional vector $c \in \{0,1\}^{32}$ with the $i$-th entry being $1$ if the $i$-th kind of stroke is included in $x$ and otherwise $0$ for all $i$ from $1$ to $32$. In this paper, we only use the indicator function of such kind of stroke instead of its exact number for a given Chinese character mainly in consideration of the robustness of StrokeGAN. This is in general sufficient according to our later experiments (see, Figure \ref{fig:comp-similar-character}). \subsection{Training Loss for StrokGAN} \label{sc:Structure GAN for CCG} The training loss for StrokeGAN consists of three parts, that is, the general adversarial loss, cycle consistency loss and stroke-encoding reconstruction loss, where the \textit{stroke-encoding reconstruction loss} is firstly introduced in this paper for the generation of stylish Chinese fonts. \begin{table*} \caption{The performance of StrokeGAN in 9 generation tasks via comparing with CycleGAN \cite{Chang2018}. } \label{tab:result-number} \begin{center} \begin{tabular}{|l|c|c|c|c|c|c|c|}\hline \multirow{2}*{Character style translation} & \multicolumn{2}{c|}{Content accuracy (\%) $\uparrow$} & \multicolumn{2}{c|}{Recognition accuracy (\%) $\uparrow$} & \multicolumn{2}{c|}{Stroke error ($\times 10^{-2}$) $\downarrow$} \\ \cline{2-3} \cline{4-5} \cline{6-7} & CycleGAN & StrokeGAN & CycleGAN & StrokeGAN & CycleGAN & StrokeGAN\\ \hline \textit{Regular Script} $\rightarrow$ \textit{Shu} & 89.56 & \textbf{90.48} & 89.36 & \textbf{90.52} &6.79 & \textbf{5.69}\\\hline \textit{Regular Script} $\rightarrow$ \textit{Huawen Amber} & 86.88 & \textbf{88.68} & 87.56 & \textbf{88.92} &8.71 &\textbf{7.20}\\\hline \textit{Regular Script} $\rightarrow$ \textit{Hanyi Lingbo} & 87.64 & \textbf{88.24} & 87.48 & \textbf{88.32} &7.90 &\textbf{6.81}\\\hline \textit{Regular Script} $\rightarrow$ \textit{Imitated Song}& 90.28 & \textbf{91.72} & 90.84 & \textbf{91.60} &7.33 &\textbf{5.55} \\\hline \textit{Regular Script} $\rightarrow$ \textit{Handwriting} & 87.08 & \textbf{87.64} & 87.12 & \textbf{87.60} &7.67 &\textbf{6.50}\\\hline \textit{Hanyi Thin Round} $\rightarrow$ \textit{Hanyi Doll} & 87.00 & \textbf{87.60} & 86.92 & \textbf{87.80} &7.69 &\textbf{6.52} \\\hline \textit{Black} $\rightarrow$ \textit{Hanyi Thin Round} & 86.60 & \textbf{87.76} & 86.60 & \textbf{87.92} &7.79 &\textbf{6.96}\\\hline \textit{Imitated Song} $\rightarrow$ \textit{Black} & \textbf{89.56}& 88.96 & \textbf{89.44} & 89.12 &8.06 & \textbf{6.72} \\\hline \textit{Imitated Song} $\rightarrow$ \textit{Regular Script} & 89.96 & \textbf{90.32} & 90.04 & \textbf{90.28} &8.49 &\textbf{6.28} \\ \hline \end{tabular} \end{center} \end{table*} {\bf A. Adversarial loss.} The first part of loss is the adversarial loss defined commonly as follows, \begin{align} \label{Eq:ad-loss} {\cal L}_{adv}(D,G) &= \mathbb{E}_{x}[\log D_{src}(x)] \\ &+ \mathbb{E}_{x}[\log(1-D_{src}(G(x)))], \nonumber \end{align} where the generator $G$ generates the fake character $G(x)$ conditional over the input character $x$, and the first part of discriminator $D_{src}$ attempts to distinguish the generated character is real or fake. {\bf B. Cycle consistency loss.} The second part of loss is the cycle consistency loss, which is introduced to let the generator reconstruct the character in the source font domain from the generated fake character, and thus avoid using the paired data. Specifically, such part of loss can be defined as follows: \begin{align} \label{Eq:cycle-consistency-loss} {\cal L}_{cyc}(G) =\mathbb{E}_{x}[\|x-G(G(x))\|_1], \end{align} where $G(x)$ represents the generated fake character according to the input pair $x$ and $G(G(x))$ represents the reconstructed character from the character $G(x)$ generated by $G$. {\bf C. Stroke-encoding reconstruction loss.} Notice that in both adversarial loss and cycle consistency loss, the characters are regarded as images during the training, while the stroke information is not paid much attention. Actually, as discussed before, the stroke information embodies amount of mode information of a Chinese character, and thus is some kind of very important information that should be preserved during the training. Also, the stroke information is very special for Chinese characters and makes the generation of Chinese characters very different from the style translation of natural images. Specifically, the \textit{stroke-encoding reconstruction loss} can be defined as follows: \begin{align} \label{Eq:structural-information-loss} {\cal L}_{st}(D) = \mathbb{E}_{x,c} \left[{\|D_{st}(G(x))-c\|_2} \right]. \end{align} where $D_{st}(G(x))$ is the stroke encoding yielded by discriminator for the generated fake character $G(x)$. Such stroke-encoding reconstruction loss is used to guide the networks to reconstruct the stroke encodings as accurately as possible so that the modes of characters can be preserved much better. {\bf D. Total training loss.} Combining the above three parts of loss, i.e., \eqref{Eq:ad-loss}-\eqref{Eq:structural-information-loss}, the total training loss of StrokeGAN is presented as follows: \begin{align} \label{Eq:total-loss} {\cal L}_{strokegan}(D,G) &= {\cal L}_{adv}(D,G) +\lambda_{cyc} {\cal L}_{cyc}(G) \\ &+ \lambda_{st}{\cal L}_{st}(D),\nonumber \end{align} where $\lambda_{cyc}$ and $\lambda_{st}$ are two penalty parameters. Based on the above defined loss ${\cal L}_{strokegan}(D,G)$, the discriminator $D$ attempts to maximize it while the generator $G$ tries to minimize it, shown as follows: \begin{align} \label{Eq:stgan-training} \min_G \max_D \ {\cal L}_{strokegan}(D,G). \end{align} \section{Numerical Experiments} \label{sc:experiments} In this section, we provide a series of experiments to demonstrate the effectiveness of the suggested StrokeGAN. All experiments were carried out in Pytorch environment running Linux, AMD(R) Ryzen 7 2700x eight-core processor $\times16$ CPU, GeForce RTX 2080 GPU. Our codes are available in \url{https://github.com/JinshanZeng/StrokeGAN}. \subsection{Experiment Settings} \label{sc:exp-settings} \begin{figure}[ht] \begin{minipage}[b]{0.99\linewidth} \centering \includegraphics*[scale=0.24]{results-4style.png} \end{minipage} \hfill \caption{Examples of Chinese characters generated by StrokeGAN. The characters in the left-hand side are real characters in the target font domains, while the characters in the right-hand side are generated characters in the associated target font domains. From the first row to the fourth row, the target fonts are $\{$\textit{Imitated Song}, \textit{Shu}, \textit{Hanyi Lingbo}, \textit{Huawen Amber}$\}$, respectively. It can be observed that the characters generated by StrokeGAN are very realistic. } \label{fig:results-4styles} \end{figure} \begin{figure}[ht] \begin{minipage}[b]{0.99\linewidth} \centering \includegraphics*[scale=0.21]{stGAN-cycleGAN.png} \end{minipage} \hfill \caption{Stoke-missing phenomena in the generated characters of CycleGAN \cite{Chang2018}. The suggested StrokeGAN can preserve strokes much better. The first two columns, the third and fourth columns, and the last two columns respectively present the generated characters from \textit{Regular Script} to \textit{Shu}, from \textit{Regular Script} to \textit{Huawen Amber}, and from \textit{Hanyi Thin Round} to \textit{Hanyi Doll}. } \label{fig:st-cycle} \end{figure} {\bf A. Collection of datasets.} The dataset used in this paper consists of 9 sub-datasets with different fonts divided into three categories, i.e., a handwriting font, three standard printing fonts $\{$\textit{Black}, \textit{Regular Script}, \textit{Imitated Song}$\}$, and five pseudo-handwriting fonts $\{$\textit{Huawen Amber}, \textit{Shu}, \textit{Hanyi Lingbo}, \textit{Hanyi Doll}, \textit{Hanyi Thin Round}$\}$, where the pseudo-handwriting fonts are personalized fonts designed by artistic font designers. The first kind of dataset related to the handwriting Chinese characters is built up from \textit{CASIA-HWDB1.1} \footnote{\url{http://www.nlpr.ia.ac.cn/databases/handwriting/Home.html}}, which was collected by 300 people. There are in total 3755 different commonly used Chinese characters written by everyone, and thus there are $3755 \times 300$ handwriting characters in this dataset. To build up our handwriting dataset, for each character, we randomly selected one sample from these 300 samples. Therefore, the size of the handwriting font dataset used in this paper is 3755. Except the handwriting Chinese characters, the other font datasets were collected by ourselves from the internet \footnote{say, \url{http://fonts.mobanwang.com/}} and made automatically via TTF. Specifically, the second kind of datasets contain three printing font datasets, of which the sizes are 2560, 3757 and 2506 respectively for the \textit{Black}, \textit{Regular Script} and \textit{Imitated Song} fonts. The third kind of datasets consist of five pseudo-handwriting fonts, of which the sizes are 3596, 2595, 3673, 3213 and 2840 respectively for the \textit{Huawen Amber}, \textit{Shu}, \textit{Hanyi Lingbo}, \textit{Hanyi Doll} and \textit{Hanyi Thin Round} fonts. The size of each character was resized to $128 \times 128 \times 3$. In our experiments, we used 90\% and 10\% of the samples respectively as the training and test sets. {\bf B. Network architectures and optimizer.} The network structure of the generator in StrokeGAN is the same as CycleGAN \cite{Zhu2017}, including 2 convolutional layers in the down-sampling module, 9 residual modules with 2 convolutional layers of residual networks for each residual module and 2 deconvolutional layers in the up-sampling module, as presented in Table \ref{tab:generator-structure} in Appendix. The network structure of the discriminator in StrokeGAN is similar to PatchGAN \cite{Isola2017} with 6 hidden convolutional layers and 2 convolutional layers in the output module, as presented in Table \ref{tab:discriminator-structure} in Appendix. Moreover, the batch normalization \cite{Ioffe2015} was used in all layers. In our experiments, we used the popular Adam algorithm \cite{Kingma2014} as the optimizer with the associated parameters $(0.5, 0.999)$ in both the generator and discriminator optimization subproblems. The penalty parameters of the cycle consistency loss and stroke reconstruction loss were fine-tuned at 10 and 0.18, respectively. {\bf C. Evaluation metrics.} To evaluate the performance of StrokeGAN, we introduced three evaluation metrics. The first one is the commonly used \textit{content accuracy} \cite{Zhu2017}, which was suggested to justify the quality of the contents of generated characters. Specifically, a pre-trained HCCG-GoogLeNet \cite{Szegedy2014} was exploited to calculate the content accuracy. Besides the \textit{content accuracy}, we also suggested the \textit{recognition accuracy} and \textit{stroke error} particularly for the Chinese character generation task. The \textit{recognition accuracy} is defined as the ratio of those generated characters that can be correctly recognized by people to all the generated characters for testing, via a crowdsourcing way. Specifically, we randomly invited five Chinese adults to recognize the generated Chinese characters, and then took their average as the \textit{recognition accuracy}. The \textit{stroke error} is defined as the ratio of the number of missing and redundant strokes in the generated Chinese characters to its true total number of strokes. Thus, the smaller stroke error means the strokes are preserved better. \begin{figure}[ht] \begin{minipage}[b]{0.99\linewidth} \centering \includegraphics*[scale=0.27]{comp-similar-character.png} \end{minipage} \hfill \caption{Generated results of StrokeGAN for some very similar Chinese characters with the same stroke encodings.} \label{fig:comp-similar-character} \end{figure} \begin{figure*}[ht] \begin{minipage}[b]{0.99\linewidth} \centering \includegraphics*[scale=0.45]{four-result.png} \end{minipage} \hfill \caption{Some examples of Chinese characters generated by StrokeGAN and three existing methods in the generation task from \textit{Regular Script} font to \textit{Shu} font.} \label{fig:four-model-result} \end{figure*} \subsection{Experiment Results} \label{sc:exp-results} Our experiments consist of three parts, where the first two parts were conducted to respectively show the effectiveness and sufficiency of the introduced one-bit stroke encoding, and the third part was conducted to demonstrate the effectiveness of StrokeGAN via comparing with the state-of-the-art methods including CycleGAN \cite{Chang2018}, zi2zi \cite{Tian2017} and Chinese typography transfer (CTT) method \cite{Chang2017}, where the latter two methods are based on paired training data. {\bf A. Effectiveness of one-bit stroke encoding.} In these experiments, we verified the feasibility and effectiveness of our idea that incorporating the stroke information into CycleGAN can preserve the modes of Chinese characters better and thus alleviate the issue of mode collapse. In order to verify this, we implemented nine one-to-one Chinese character style translation experiments as listed in Table \ref{tab:result-number}. For each experiment, we selected one font domain (say \textit{Regular Script}) from these nine different font styles as the source font domain and another font domain (say \textit{Shu}) as the target font domain, and then trained StrokeGAN as well as CycleGAN as the baseline. The performance of the suggested StrokeGAN is presented in Table \ref{tab:result-number}. Some examples of the generated Chinese characters by StrokeGAN are shown in the previous Figure \ref{fig:stgan-results} and Figure \ref{fig:results-4styles}, which demonstrate that StrokeGAN can generate very realistic Chinese characters for all these nine fonts. From Table \ref{tab:result-number}, StrokeGAN outperforms CycleGAN (without using the stroke encoding) in most of the tasks except the style translation task from \textit{Imitated Song} to \textit{Regular Script}. In terms of the stroke error presented in the last two columns, StrokeGAN consistently improves the performance of CycleGAN \cite{Chang2018}. This shows the feasibility and effectiveness of the suggested StrokeGAN. Moreover, as demonstrated in the previous Figure \ref{fig:mode-collapse}, CycleGAN sometimes suffers from the issue of mode collapse (particularly, when applied to the generation task from \textit{Black} font to \textit{Shu} font), while the suggested StrokeGAN can significantly alleviate this issue. Besides the issue of mode collapse, as shown in Figure \ref{fig:st-cycle}, CycleGAN also sometimes suffers from another issue, that is, missing some key strokes of Chinese characters generated, which may result in the recognition issues of these characters, while the suggested StrokeGAN can preserve these strokes much better. {\bf B. Sufficiency of one-bit stroke encoding.} Notice that there are many very similar Chinese characters having the same stroke encodings. In order to show the sufficiency of the introduced one-bit encoding, we tested the performance of StrokeGAN on some very similar Chinese characters, as shown in Figure \ref{fig:comp-similar-character}, which shows that the generated characters can be well distinguished with well preserved strokes. This demonstrates that such one-bit encoding way is in general enough to preserve the key modes of Chinese characters. {\bf C. Comparison with the state-of-the-art methods.} In this part of experiments, besides CycleGAN \cite{Chang2018}, we compared StrokeGAN with two paired data based methods, i.e., \textit{zi2zi} \cite{Tian2017} and CTT method \cite{Chang2017}. In order to implement both zi2zi and CTT methods, we manually built up two paired datasets based on the \textit{Regular Script} font and \textit{Shu} font datasets. Since the collection of paired training data is very costly, in these experiments, we only considered the generation task from the \textit{Regular Script} font to \textit{Shu} font for all these four methods, while for the other generation tasks, it can be implemented similarly. The performance of these four methods is presented in Table \ref{4-model-result}, and some examples of generated characters are shown in Figure \ref{fig:four-model-result}. From Table \ref{4-model-result}, the suggested StrokeGAN outperforms all these existing methods in terms of the suggested three evaluation metrics, and also generates the Chinese characters with the highest quality among all these methods. These experiment results demonstrate the effectiveness of the proposed StrokeGAN. \begin{table} \caption{Comparison on the performance of the suggested StrokeGAN with existing methods in the generation task from \textit{Regular Script} font to \textit{Shu} font. The first, second and third rows respectively present the content accuracies (\%), recognition accuracies (\%) and stroke errors in the scale $\times 10^{-2}$ of all these four methods.} \label{4-model-result} \begin{center} \footnotesize \begin{tabular}{|c|c|c|c|c|}\hline Methods & StrokeGAN & CycleGAN & zi2zi & CTT \\\hline Content acc. ($\uparrow$) & \textbf{90.48} & 89.56 & 90.12 & 87.92 \\\hline Recog. acc. ($\uparrow$) & \textbf{90.52} & 89.36 & 90.04 & 88.01 \\\hline Stroke error ($\downarrow$) & \textbf{5.67} & 6.79 & 6.36 & 7.52 \\\hline \end{tabular} \end{center} \end{table} \section{Conclusion} \label{sc:conclusion} This paper proposes an effective Chinese font generation method called \textit{StrokeGAN} by incorporating a one-bit stroke encoding into CycleGAN to tackle the mode collapse issue. The key intuition of our idea is that the stroke encodings of Chinese characters contain amount of mode information of Chinese characters, unlike the natural images. A new stroke-encoding reconstruction loss was introduced to enforce a faithful reconstruction of the stroke encoding as accurately as possible and thus preserve the mode information of Chinese characters. Besides the commonly used content accuracy, the crowdsourcing recognition accuracy and stroke error are also introduced to evaluate the performance of our method. The effectiveness of StrokeGAN is demonstrated by a series of Chinese font generation tasks over 9 datasets with different fonts, comparing with CycleGAN and other two existing methods based on the paired data. The experiment results show that StrokeGAN helps preserve the stroke modes of Chinese characters in a better way and generates very realistic characters with higher quality. Besides Chinese font generation, our idea of the one-bit stroke encoding can be easily adapted to other deep generative models and applied to the font generation related to other languages such as Korean and Japanese. \section*{Acknowledgment} The work of Jinshan Zeng is supported in part by the National Natural Science Foundation (NNSF) of China (No.61977038), and Thousand Talents Plan of Jiangxi Province (No. jxsq2019201124). The work of Mingwen Wang is supported in part by NNSF of China (No. 61876074). The research of Yuan Yao is supported in part by HKRGC 16303817, ITF UIM/390, as well as awards from Tencent AI Lab and Si Family Foundation. Part of Jinshan Zeng's work was done when he visited at Liu Bie Ju Centre for Mathematical Sciences, City University of Hong Kong.
{'timestamp': '2021-01-12T02:22:49', 'yymm': '2012', 'arxiv_id': '2012.08687', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08687'}
arxiv
\section{Introduction} Recently, it has been very popular to utilize cloud servers to carry out machine learning algorithms instead of using local servers. However, since cloud servers are semi-trusted, private data, such as personal information and medical records, may be revealed in cloud computing. For the reason, privacy-preserving machine learning has become an urgent challenge\cite{homomorphic1, 2007.08775, sirichotedumrong2019privacy, sirichotedumrong2019pixel, 2006.01342}. In this paper, we focus on dimensionality reduction methods in terms of two issues: difficulty in estimating visual information on original images from dimensionally reduced ones, and performance that reduced data can maintain in an image classification experiment. In machine learning, dimensionality reduction is used for not only reducing the number of random variables, but also protecting visual information for privacy-preserving machine learning. However, dimensionality reduction methods have never been evaluated in terms of above the two issues at same time. For such a reason, difficulty in estimating visual information is discussed. In particular, the random sampling method that was proposed for privacy-preserving machine learning\cite{aprilpyone2020encryption}, is compared with typical dimensionality reduction methods such as random projection and PCA\cite{bingham2001random, wold1987principal}. In an image classification experiment, the random sampling method is demonstrated not only to maintain high difficulty, but also to have close machine learning performance to that of the random projection method. \section{Linear Dimensionality Reductions} Let us consider a projection from a vector $x\in\mathbb{R}^D$ to a low-dimensional vector $y\in\mathbb{R}^K (K<D)$. If the projection can be represented by using a matrix $P\in\mathbb{R}^{K\times D}$ as \begin{align} y=Px\quad, \label{linear dim reduction} \end{align} it is a linear dimensionality reduction and $P$ is called a projection matrix. In machine learning, $P$ is used for reducing the number of random variables for avoiding negative effects of high-dimensional data. The random projection method\cite{bingham2001random} and principal component analysis (PCA) are typical linear dimensionality reduction methods. The random projection is a method that does not use any statistics of dataset, but PCA is not. For the random projection, elements of $P$ have a normal distribution with an average value of 0 and a variance of $\sqrt{1/K}$. Therefore, the random projection is not required to calculate any statistics of dataset for designing a projection matrix $P$. \section{Random Sampling} The random sampling method was proposed as a dimensionality reduction method for privacy preserving machine learning\cite{randomsampling}. It is also expected to be applied to deep convolutional neural network, due to the property of spatial information invariant\cite{aprilpyone2020encryption}. Let us consicer applying the random sampling method to a pixel vector $x\in\mathbb{R}^D$ of an image to create $y\in\mathbb{R}^K (K<D)$. Next, let $\{\phi(i)\, |\, i=1,\ldots,K\}$ denote $K$ indexes selected from $D$ pixel indexes, where $\phi(i)\neq\phi(i^\prime)$ if $i\neq i^\prime$, randomly generated with a seed. By using $\phi(i)$, the random sampling operation can be written as \footnotesize \begin{align} \label{random sampling} y=(x_{\phi(1)},x_{\phi(2)},\ldots,x_{\phi(K)})^{\rm T}\quad, \end{align} \normalsize where $x_{\phi(i)}$ is the $\phi(i)$-th element of $x$. Here, if we define a matrix $P\in\mathbb{R}^{K\times D}$ with elements $p_{ij} (i=1,\ldots,K,j=1,\ldots,D)$ defined by \footnotesize \begin{align} & p_{i,j}=\left\{ \begin{array}{ll} 1 & (j=\phi(i)) \\ 0 & ({\rm otherwise}) \end{array} \right. \quad, \label{random sampling 2} \end{align} \normalsize the random sampling is reduced to the form of Eq.(\ref{linear dim reduction}). That is, the random sampling is a linear dimensionality reduction, and is a method that does not use the statistics of dataset as well as the random projection. \section{Visual Information Estimation} \label{attacks} Assuming that an attacker knows a projection matrix $P$ used in dimensionality reduction, difficulty in estimating visual information on plain images is discussed. The attacker's goal is to create $Q$ to approximatelly reconstruct the target image $x$ from the low dimensional vector $y$ as \begin{align} x^\prime=Qy\quad. \label{reconstruction} \end{align} In this paper, two attacks are considered to estimate $Q$. \subsection{Attack With Pseudo-Inverse Matrix} An attacker can use a pseudo-inverse matrix ($Q_{\rm pinv}$) of projection matrix $P$ to estimate visual information on original images, where $Q_{\rm pinv}$ is designed by using an algorithm with the singular-value decomposition of $P$\cite{harville1998matrix}. \subsection{Regression Attack With Attacker's Dataset} \label{regression attack} An attacker first prepares his own dataset ($X_{\rm attack}$) and a dataset ($Y_{\rm attack}$) projected from $X_{\rm attack}$ by using $P$, and then designs a linear reconstruction matrix ($Q_{\rm reg}$) that regresses $X_{\rm attack}$ from $Y_{\rm attack}$ in accordance with the least squares method. In general, the effectiveness of this attack depends on the relation between the distribution of $X_{\rm attack}$ and that of target images. Therefore, in this paper, we classify $X_{\rm attack}$ into two types in accordance with the distribution of $X_{\rm attack}$. \begin{itemize} \item type 1: $X_{\rm attack}$ consists of images with the same class-labels and distribution as those of the target images. \item type 2: $X_{\rm attack}$ consists of images with class-labels and a distribution that are different from those of the target images. \end{itemize} \begin{comment} \begin{itemize} \item type1 ({\it Same Labels}): $X_{\rm attack}$ exactly has the same conditions and class labels as the target images. \item type2 ({\it Different Labels}): $X_{\rm attack}$ has similar conditions to the target images but has different class labels. \item type3 ({\it Totally Different}): $X_{\rm attack}$ has different conditions from the target images. \end{itemize} The {\it type 3} is practical when, for example, the attacker estimates facial images in a face recognition dataset. In this case, the attacker knows the conditions under the faces were taken, but the face samples of the target people are available. Here, we show concrete examples of the above three conditions, taking the case of an attacker attempting to reconstruct facial images in a face recognition dataset. \begin{itemize} \item {\it Same Labels} condition: The attacker knows the training images in the face recognition dataset. \item {\it Different Labels} condition: The attacker knows the conditions under which the faces were taken, but the face samples of the the target people are not available. \item {\it Totally Different} condition: The attacker does not know any condition about the dataset. \end{itemize} \end{comment} \begin{figure}[t] \begin{center} \includegraphics[scale=0.47]{./accs_linsvm.png} \caption{Classification accuracy with various dimensionality reduction methods (Linear SVM). \label{accs linsvm}} \end{center} \end{figure} \begin{figure}[t] \begin{center} \includegraphics[scale=0.47]{./accs_rf.png} \caption{Classification accuracy with various dimensionality reduction methods (Random Forest). \label{accs rf}} \end{center} \end{figure} \section{Experiment} Face-image classification experiments were carried out for evaluating the random sampling method in terms of both classification accuracy and difficulty in estimating visual information. The dataset was Extended Yale Database B\cite{Yale}, which contains 38 individuals and 64 frontal facial images with 168$\times$192 pixels per each person. Each image was normalized to a size of 28$\times$28, so it had $D=784$ dimension as a vector, we splitted the dataset into two datasets: $X_{\rm main}$ and $X_{\rm sub}$, each of which had 19 classes and 1216 images, without duplication of classes. Moreover, $X_{\rm main}$ was divided into $X_{\rm train}$ (912 images) for training and $X_{\rm test}$ (304 images) for testing. We also used the CIFAR-10\cite{krizhevsky2009learning} dataset: $X_{\rm CIFAR-10}$ for evaluating difficulty in estimating visual information on $X_{\rm test}$. This dataset consists of 60k images with 10 classes such as dogs and ships, whose distribution is different from $X_{\rm train}$, $X_{\rm test}$ and $X_{\rm sub}$. Finally, each vector $x\in\{X_{\rm train}$, $X_{\rm test}$, $X_{\rm sub}$, $X_{\rm CIFAR-10}\}$ was projected to $y\in\{Y_{\rm train}$, $Y_{\rm test}$, $Y_{\rm sub}$, $Y_{\rm CIFAR-10}\}$ with a target dimension ($K$) by using the random sampling and three dimensionality reduction methods: the random projection, PCA, and a feature selection algorithm proposed by Ono\cite{featureselector}. PCA and Ono's method require calculating the statistics of $X_{\rm train}$, but the random sampling and random projection do not. \begin{figure*}[t] \begin{center} \includegraphics[scale=0.77]{mse.png} \caption{Mean squared error between original image and reconstructed image. \label{mse}} \end{center} \end{figure*} \subsection{Machine Learning Performance} We trained a random forest classifier and SVM with the linear kernel by using $Y_{\rm train}$, and tested by using $Y_{\rm test}$. Figures \ref{accs linsvm} and \ref{accs rf} show the comparison of the dimensionality reduction methods in term of classification accuracy. Under the use of SVM, the random sampling had a similar performance to Ono's method. For the random forest, the random sampling also has almost the same accuracy as that of Ono's method. As a result, the random sampling was demonstrated to be comparable with other dimensionality reduction methods, while maintaining the property of spatial-information invariant. \subsection{Robustness Against Visual Information Estimation} Assuming that an attacker knows only projection matrix $P$ used in dimensionality reduction, difficulty in estimating visual information on $X_{\rm test}$ was evaluated. We assumed the following four attacks to estimate $X_{\rm test}$ from $Y_{\rm test}$. \begin{itemize} \item Attack 1: Attack using a pseudo-inverse matrix of $P$. \item Attack 2: Regression attack with $X_{\rm train}$ (type 1 in section \ref{regression attack}). \item Attack 3: Regression attack with $X_{\rm CIFAR-10}$ (type 2 in section \ref{regression attack}). \item Attack 4: Regression attack with $X_{\rm sub}$. \end{itemize} In attack 4, the attacker does not have facial images of the people included in $X_{\rm test}$, but knows the conditions under which $X_{\rm test}$ was taken. Figure \ref{mse} shows MSE values between $X_{\rm test}$ and $X_{\rm test}^\prime$. From the figure, the random sampling was relatively robust compared with the other dimensionality reduction methods. The absolute values of MSE of the random sampling were large for attacks 1 and 3, but were small for attacks 2 and 4 as well as the other methods. We defined accuracy reduction ratio (ARR) as another criterion. First, we trained a logistic regression classifier ($\theta$) by using $X_{\rm train}$, and then the ARR is defined as \begin{align} {\rm ARR}=\frac{{\rm ACC}_\theta(X_{\rm test})-{\rm ACC}_\theta(X_{\rm test}^\prime)}{{\rm ACC}_\theta(X_{\rm test})}\quad, \label{definied arr} \end{align} where ${\rm ACC}_\theta(X)$ is the function which returns the accuracy when dataset $X$ is applied to $\theta$. A high ARR value indicates that $X_{\rm test}^\prime$ has low class-specific visual information, i.e., the dimensionality reduction is robust against the attack. Figure \ref{arr} shows the comparison of ARR values. From the figure, the random sampling was demonstrated to be robust against attack 4. It indicates that attack 4 did not effectively recover the class-specific information of the target images. Figure \ref{reconst images} shows an original images and examples of reconstructed images. Although the images reconstructed by attack 4 can be easily interpreted as human faces, the facial features were different from the original person. \onecolumn \begin{figure}[t] \begin{center} \includegraphics[scale=0.68]{arr.png} \caption{Comparison of accuracy reduction ratio values. \label{arr}} \end{center} \end{figure} \begin{figure}[b] \begin{center} \includegraphics[scale=0.7]{PinvReconstImgs3.png} \caption{Examples of reconstructed images ($D$=784) with MSE (left) and ARR (right) values. \label{reconst images}} \end{center} \end{figure} \twocolumn \section{conclusion} In this paper, we compared the random sampling method with typical linear dimensionality reduction methods in terms of both machine learning performance and difficulty in estimating visual information in face classification experiments. The random sampling was demonstrated not only to have the property of spatial position invariant which is useful for privacy-preserving learning, but also to maintain comparable performance to other dimensionality reduction methods and difficulty in visual information estimation under practical conditions. \bibliographystyle{IEEEbib}
{'timestamp': '2020-12-17T02:09:52', 'yymm': '2012', 'arxiv_id': '2012.08751', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08751'}
arxiv
\section{1. Introduction} Deep learning is developing rapidly in many areas of Natural Language Understanding. While the deep learning requires a large amount of data to ensure the generalization of the model. For example, in the famous pre-trained language model ''BERT'' \cite{devlin-etal-2019-bert} where Google provides 400 million data to train Bert model, which requires a huge amount of data to guarantee the model performance. However, in many cases we cannot obtain a large amount of data. For example, training data is scarce in the task of word emotional classification.\\ Previous research \cite{DBLP:conf/acl/HatzivassiloglouM97} tried to get the "semantic orientation" of the sentence. For example, positive and negative tendencies. through obtaining the predictions of emotion tendencies and comparing the predictions with the real sentences, the accuracy of the prediction is obtained.\\ Further, the researchers found that, based on psychological research, multiple factors will lead to different emotions rather than solely determined by emotional polarity. For example, in the study of Bradley and Lang's research \cite{Measuring-emotion}, Valence-Arousal-Dominance model to determine the emotional tendency from three different factors.\\ Word embedding is an effective way to represent language features, such as similarity\cite{DBLP:conf/emnlp/PenningtonSM14}, emotional orientation \cite{DBLP:conf/naacl/RotheES16}, and sentiment\cite{DBLP:journals/ci/CalvoK13}. Word embedding is the method to victories strings, different dimensions of vectors may contain different information, but embedding representation is "black box", it is hard to know what exactly mean the dimension present.\\ In this paper, we proposed that emotional information can be compressed as a one dimension embedding called ultradense subspace, we hypotheses the ultradence subspace as the space where the sentiment be quantified as numerical values and be classified by trained ultradense word embedding. For Chinese and English, we predict that the emotional words of two languages can correctly classify but not restricted by language types and grammars.\\ The advantage of this method is that even if the data is lacking, the model has good performance. And the data does not need to be labeled, so there is a large amount of data that can be used to train. Another advantage is that, compared to the origin word embedding, the ultradense subspace has higher performance and quality. For example, in classification tasks, unrelated information is considered as noise, which is filtered through orthogonal transformation. As a result, the model has fewer parameters, which means that the training speed is improved and the possibility of overfitting is reduced.\\ In this paper, our goal is to produce a decent word embedding in Chinese. The output of model will be a lexicon, which is converted from the original embedding, the embedding of lexicon presented as one-dimensional ultradense embedding table, this table produce a clearer, easier-to-explain word representation for word emotions. \section{2. motivation} In most of the previous studies, the models were trained using English datasets, and rarely use Chinese datasets, especially web review data, the web review contain stronger emotional tendencies than the written context. I would like to do Chinese emotional classification by using this method, which transforms embedding into a low-dimensional, interpretable embedding. Based on the output of the embedding, we can know whether the model is well in Chinese emotion classification. At the same time, I am also looking for factors that decrease the performance of the model. For example, according to research \cite{DBLP:conf/naacl/RotheES16}, they find that some factors of embedding such as embedding size, stop words, embedding dimensions, and seed words may effect performance of model. Thus, we decide to evaluate what kind of factors influence the mode results.\\ \section{3. Background} In this section, I will introduce some relevant background about emotional expression and word embedding, and some of techniques will use in our methodological work. \subsection{3.1 emotion representation} Emotional expression is not only distinguished by positive and negative, but also by multiple factors. The VAD model (Figure 1) \cite{Measuring-emotion} considers that emotions to be composed of three different dimensions, named Valence (positive-negative), Arousal (clam-excited), and Dominance (perceived degree of control situation). There are also studies \cite{DBLP:conf/hci/ZhongQZ19} which suggest that Dominance does not affect the expression of emotion (only VA model works). As the most common system for assessing emotional tendencies, the VAD model quantifies Valence, Arousal and Dominance, and then evaluates them. \begin{figure} \centering \includegraphics[scale=0.6]{VAE_model.png} \caption{The emotion space covered by the Valence-Arousal-Dominance (VAD) model}~\label{fig:figure1} \end{figure} \subsection{3.2 emotion lexicon} In some psychological studies, words with emotional tendencies illustrated as specific numerical values. For example, if the value of a word is greater than a certain threshold, the word is considered to be a positive emotional word, whereas if a word is less than the threshold, it is Negative emotion word. In this paper, the emotion lexicon that we build only use positive and negative emotions as a one-dimensional evaluation. For illustration, we will visualize the result as a 2d figures to build the lexicon that the emotional values of word distributed on the figures.\\ \subsection{3.3 word embedding} Word embedding is a vector representation, which encodes word into a vector form. In this way, word is converted to the numeric values, it can use into unsupervised learning. Here are some very popular embedding algorithms today: WORD2VEC is a popular embedding algorithm, which provides a trimmed down neural network \cite{DBLP:conf/nips/MikolovSCCD13}. FASTTEXT is based on WORD2VEC, which is a derivative of WORD2VEC and combining the n-gram of characters \cite{DBLP:journals/tacl/BojanowskiGJM17}. Unlike the previous embedding algorithms, GLOVE directly trains word vectors on the word co-occurrence matrix, which improves the training efficiency. \subsection{3.4 word-level prediction} In previous research \cite{DBLP:journals/tois/TurneyL03}, researchers distinguished the emotional tendency of words by using the polarity of words. The specific approach is to divide words into two kind of training data, the original word embedding and the seed words. The seed words are usually positive or negative The word, the distance between the pair of seed words is obtained point-wise, so as to obtain the emotional tendencies of words. Afterwards, Rothe \cite{DBLP:conf/naacl/RotheES16} proposed to transform the word embedding from the original space to ultradense subspace by training the orthogonal matrix, which will get embedding of word's emotion.\\ \section{4. Research Method} In order to analyze the sentiment of TikTok comment data and build TikTok sentiment lexicon, I need to collect and process reviews from the TikTok app. My plan is to use web crawlers to crawl data from the TikTok app and preprocess and victories the data, which need to implement a web crawler framework to collect data for the TikTok app, then use python data analysis tool Pandas to pre-process review data and use WORD2VEC training tool Gensim to victories review sentences, the processed word embedding table saved as the VEC files. For seed words, I labeled 5, 10, 15 for seed word groups. In the end, After trained model, I visualized and analysed results.\\ \section{5. Research Questions} First, "Is there a relationship between the seed words and the emotions?" When the size of word reaches a certain amount, the generalization ability of the model improved, that is, the model may learn more prior information. While the model learned the distance between seed words, we can verify that whether the distinguishing ability of model be affected when the size of seed words change. One hypothesis is that the model's ability to distinguish emotions grows if we expands the size of the seed word. To verify the hypothesis, I set the size of seeds to 5, 10, 15 respectively, and each seed word group join the training processes. Finally, 3 results will be visualized to verify the hypothesis.\\ The second question is "Does a specific video guide the commentator's emotions?" When we collected data, we found that the commentator's emotional inclination would be consistent with the emotional tendencies that the video wanted to express. For example, most Comments are sad in videos of funerals, but most of the comments are pleasing in funny videos. Therefore, we made a hypothesis that the sentiment of a particular video will guide the comments emotional tendencies. To verify the hypothesis, we collected two different data, comment data from random videos and comment data from special videos, I use different datasets to train the model, and finally compare the distribution of words.\\ The third question is "Compared with the previous method, is there any improvement in compressing embedding to ultra dense subspace?" In the previous research, the commonly used approach of feature extraction is Principle Compose Analysis, PCA is the feature selection method, which is a commonly used tool in data analysis and model prediction. It is used to visualize the distance and relationship between data. PCA uses Singular Value Decomposition to select appropriate dimensions to achieve the goal of dimensionality reduction of data. In this paper, after processing data by PCA and the ultradense compression, we will compare the results to find that which method can better show the emotion of words. One hypothesis is than the data processed by ultradense compression has the better performance on emotional classification task, because ultradense compression uses seed words, which reduces the distance between the same emotion words and increases the distance between different emotion words. To verify this hypothesis, we will use the same training data to get results from PCA and ultradense compression, and then we will visualize and analyze the results to verify hypothesis. \section{6. Data Collection} \subsection{6.1 collection} The data we need to collect are user's comments from TikTok random videos and user's comments from particular videos. The comment data from random videos can analyse the user's sentiment for making sentiment lexicon, and the comment data of specific videos can analyze the user's sentiment expression under specific videos. People's sentiment often be reflected in words, and words with sentiment appeal are often commented by people. As a result, after the vectorization of comment data in vector space, the vector that have same sentiment are often collected together. Through research on RQ1 We can get the distribution of the vector of random video comments in vector space, which will tell us what sentiments expression will show what vector distribution.\\ We randomly crawl TikTok comments data through the web crawler, and crawl specific comment data under some very high like videos. These comment data can be found at \url{https://github.com/h2222/douyin_comment_dataset} the data contains 3 type of files. The dataset.csv file represents the original data crawled from TikTok where data preprocessing is required. The fixdata.py file is a data processing file for processing raw data. The processed file saved in dataupdate.xlsx file For further use, the data collects the user's age, gender, nickname, comments, number of comments liked, etc. \subsection{6.2 preprocess} The data will be saved as a csv file, and a new repository will be created to save the data on GitHub. The data set to two categories: random video comment data and specific video comment data. For the dataset, the related heads includes the user's nickname, age, gender, number of likes, and comment details, where gender head can be binarized, such as 0 for female and 1 for male. In addition, comments can be grouped with users of different ages to research if age affects sentiment expression. The Python Pandas module use to analyse and preprocess the data and Gensim module use to train a original embedding table by pre-processed comment data, we will also labeled emotional words as seed words. \section{7. Data Analysis} First of all, I want to evaluate the performance of the model When using a different number of seed words. I decided to plot the distribution of a word in the case of using different seed words. the figure 2 is the Chinese TikTok words distribution, which is based on the training results of the model, the emotional distribution can be shown as the distance between words.\\ \begin{figure} \centering \includegraphics[scale=0.25]{differences.png} \caption{the words distribution based on different seed words, red part is 5 seeds result, blue part is 10 seeds result, green part is 15 seeds result }~\label{fig:figure1} \end{figure} According to the word distribution, the X axis is the number of all words, which comes from the TikTok comment data after the word segmentation. The Y axis is a random number between 100 and -100, the reason we add the Y axis is that the word distribution is 1D distribution, which means that the experiment only obtains positive and negative emotions, and the distribution results will be "crowded" on a line. In order to better visualize the distribution results, we add a random number as the second dimension, so The words are mapped on the 2D plane.\\ Looking at the image, we find that the model's ability to distinguish positive emotions is stronger than that of negative emotions. For example, if we think that the position where index equals 0 is the distribution of neutral words, the minimum value of negative words are close to -600. Instead, The maximum value of positive words are close to +2000. Evaluating from the semantics, the model are also better distinguishes positive sentiment words. I think the reason for that is because there are more positive words in the TikTok dataset than negative words, so it will Let the model produce better training results to positive words.\\ Further, we found that the size of the seed words may affects the ability of emotional classification. For example, under the condition of training the model with same dataset, we found that when the seed word is 15 (green distribution in the figure), the positive word The maximum value is +1000 and the minimum value of the negative word is -250, and the span is approximately 1250. When the seed word is 5 (the red part in the figure), the maximum value of the word is +2000 and the minimum value is -600, and the span is 2600. Therefore , the smaller the seed words, the stronger the model's ability to distinguish sentiment words. In my opinion, during the training process, the model distinguishes word sentiment by optimizing the distance between seed words and embedding words. Excessive addition of seed words may increase the model's Parameters, which leads to overfitting of the model. Based on the experiments, when the size of the seed words equal to 5, the model's result is the best.\\ \begin{figure} \centering \includegraphics[scale=0.25]{line_graph_nosorted.png} \caption{the result embedding value against the set of words, red line is 5 seed result, blue line is 10 seed result, green line is 15 seed result }~\label{fig:figure1} \end{figure} Next, we draw a line graph to show the model's distinction between sentiment words. As shown in figure.3, the X axis is the number of all words, and the Y axis represents the output value of each words. According to the figure, we found that the model can be more distinguish the first 2000 words to a large extent of which 1 to 2000 words have a larger interval on the Y axis. When the word is after 2000, the model gradually loses its ability to distinguish the emotion of the words.\\ Next, we sort the results. The model converts words embedding table (shape is [vocabulary size, embedding size]) in the original space to words representation (shape is [vocabulary size, 1]) in ultradense subspace. Therefore, we sort all the words according to the values in the new 1D space. The result of sorting is shown in figure 4.\\ \begin{figure} \centering \includegraphics[scale=0.25]{line_graph_sorted.png} \caption{the line graph of sorted words, red line is 5 seed result, blue line is 10 seed result, green line is 15 seed result }~\label{fig:figure1} \end{figure} We found two obvious upward and downward trends on both sides of Figure 4, which shows that the word representation can distinguish the sentiment of the word in the ultradense subspace. When the seed words are 15 (the green part in the figure), the turning point is more obvious, I guess the increase of seed words may increase the model's ability to classify fuzzy words. For example, some nouns words with emotional tendencies such as 'cake', 'firework' can be correctly classified.\\ \begin{figure} \centering \includegraphics[scale=0.25]{PCA_curve.png} \caption{the result of PCA, the X axis is words index sorted by embedding value of PCA, the Y axis is the word embedding of PCA}~\label{fig:figure1} \end{figure} In order to prove that the emotion can be better represented by using the ultradense compression method, we use PCA for comparative experiments. The original word embedding table (shape is [vocabulary size, embedding size]) is compressed into a new embedding ( shape is [vocabulary size, 1], shape is consistent with that of result of ultradense compression), as shown in Figure 5.\\ As shown in Figure 5, the index of the sorted words on the X axis is based on the word embedding value of PCA, and the Y axis is the word embedding value. Compared with the orthogonal transformation method (Figure 4), the curve of the PCA-based method is more gentle, This shows that PCA cannot distinguish the emotion of words well. Moreover, the PCA method has insufficient predictive ability for negative emotion words. \section{8. Findings and discussion} \subsection{8.1 Is there a relationship between the seed words and the emotion?} A result shows that there is indeed a relationship between seed words and emotional tendencies, but the word emotion may more related with training data. An obvious conclusion is that most of the comments use positive words but negative words have not been widely appeared in the comments, which can be verified by figure 6, The interesting result is that words with a large ultradense embedding value appear very frequently in comments. These words usually have a positive meaning. table 1 are some of the most frequent words and the number of occurrences.\\ \begin{table} \centering \begin{tabular}{l r r r} {\small\textit{word}} & {\small \textit{numbers}}\\ \midrule feel & 3710 \\ Awesome & 3523 \\ heart & 3365\\ praise & 2351 \\ ...\\ \end{tabular} \caption{Table captions should be placed below the table. We recommend table lines be 1 point, 25\% black. Minimize use of table grid lines.}~\label{tab:table1} \end{table} In the comment dataset, the most of high frequent words have positive meanings, even when we set the seed words, we found that 30\% of the seed word appeared in the top 200 words of comment dataset. Combined with the previous model result, we guess that if words with certain type appear frequently, the word is easier to be distinguished by the model. In addition, we found that in the dataset, in the comments that contain high-frequency words, the comment with 2 or more The high-frequency words are 44\%. In other words, nearly half of the high-frequency words appear in pairs in the comments, which will cause the associated relationship when the word is converted into embedding. As the result, the model is affected.\\ \subsection{8.2 Does a specific video guide the commentator's emotions?} Special model videos will impact on the comments. the five different categories of video comment are collected and the categories are health, star, funny, news and entertainment. Through model training to get emotional lexicon, we found that the emotional tendency is biased to positive in funny videos, but the emotional tendencies of comments are more neutral in news videos. \\ I guess the reason for this result is that the content of the video will guide the emotional tendency of the comment, so that the frequency of the words that match the emotional tendency of the video will increase, and the model can better learn the emotional information of those words, thereby improving the model The ability to discern specific emotions. For example, when processing the comment data of funny videos, we found that some words with a clear positive tendency have a high Term Frequency (other words divided by the most frequent words), such as Awesome, funny , happy face, the Term Frequency of these words can be close to 0.9. Finally, we use the model to classify the emotions of the words, and find that the model has a more obvious effect on the classification of words with high frequency. \subsection{8.3 Compared with the previous method, is there any improvement in compressing embedding to ultra dense subspace?} After testing, we found that the performance of ultra dense word embedding is better than that of PCA method in sentiment classification tasks. Comparing Figure 5 and Figure 6, we observed a clear distinction between words using the ultra dense embedding method (the turning point in Figure 5). On the contrary, although the PCA method can distinguish words (the curve in Figure 6), it cannot clearly distinguish words, and the curve is relatively smooth, so PCA cannot distinguish the emotion of words well.\\ I think that ultra dense word embedding performs better because the model learns emotional information from seed words. The model reduces the distance of the same emotional words in the seed word and increases the distance of the opposite emotional words, so that the transformed representation of the model learns the emotion Information, which improves the word emotional representation. The PCA method does not analyze the emotion of the word, so ultra dense word embedding is better in the emotion classification.\\ \section{9 Threats to Validity} My paper may still have some disadvantages. First, my data collection volume is small and limited. Since English review data cannot be collected, we only build sentiment dictionaries on Chinese data, because both Chinese and English are different in grammar and expression, I expect differences in different language data sets, so a comparative test is necessary To evaluate the performance difference of the model when dealing with different languages. \\ secondly, the amount of data we collected did not meet expectations. We spent a long time on collecting TikTok's review data. As a very popular application, TikTok's company designed a complex encryption algorithm to protect user privacy, This is a very good thing, but for researchers who want to perform data analysis, they have to spend a lot of time users cracking the anti-crawl mechanism of TikTok. When collecting data with comments, it took us a long time to crack TikTok ’s x-gergon encryption algorithm, which is a hexadecimal encryption based on MD5, and it is difficult to crack. As a result, the data I collected did not reach the expected amount. In the future research, we will strengthen the data collect.\\ Finally, I think that in the experimental stage, the performance of the model can be further optimized. In the training process of the model, because we need to reduce the distance between the same emotion words and increase the distance between different emotion words, we need to optimize the same and different emotions at the same time. The loss of the word. Therefore, we use a loss function with hyper-parameter alpha, which can combine the two losses in a certain proportion, so that the global loss can be optimized. The formula is as follows:\\ \begin{align*} Loss = (1 - \alpha) \times SLoss + \alpha \times DLoss \end{align*} where $\alpha$ is the hyperparameter of the model, SLoss is the loss of the same sentiment words, and DLoss is the loss of different sentiment words.\\ During training, we found that when the iteration of the model reaches the 4th epoch (we set the model to iterate 10epoch), the loss of the model hardly drops. Regarding the cause of this problem, we guess that it is caused by the bias of the model data. In find and In the discussion section, we mentioned that positive emotion words have a higher frequency and higher in the data set, which leads to uneven distribution of positive emotion words and negative emotion words in the data set. Therefore, in the training stage of the model, the positive words are better optimized by the model compared to negative words, so the classification ability of the model for positive words is better than the classification ability of negative words. \section{10 Related Work} Faruqui \cite{DBLP:conf/acl/FaruquiD15} use word post-processing based on word similarity, so Faruqui does not use processing based on orthogonal transformation and does not need to consider word distance, which makes it worse for other applications such as syntax detection.The method of Faruqui does not benefit that ultra-dense embedding is more efficient.\\ In the tensor framework, Rothe and SchUtz \cite{DBLP:conf/acl/RotheS15} converts word embedding to perceptual (synonym) embedding. In their work, all the embeddings exist in the same subspace. However, we want to keep only specific information embedded in the subspace to create ultra-dense subspaces with a specific role (sentiment embedding).\\ The method we used is also related to directed PCA \cite{PCA}. However, compared to PCA, the directional PCA solution is not orthogonal.\\ The creation of the sentiment lexicon usually needs to label the training corpus. For example, people manually label the sentiment tendency of the words in the training set or form words with the same meaning into the training set, or add words with similar meanings to the seed set (\cite{DBLP:conf/acl/Turney02} and \cite{DBLP:journals/jair/KiritchenkoZM14}). Heerschop team \cite{DBLP:conf/bis/HeerschopHF11} used wordNet and pageRank-based algorithms to propagate the emotional information of seed words into unknown words. Scheible team \cite{DBLP:conf/acl/Scheible10} proposed a semi-automatic method for machine translation Based on sentiment lexicon. Hamdan team \cite{DBLP:conf/semeval/HamdanBB15} evaluated the sentiment level based on the average of six sentiment lexicons. Those method cannot apply less-resource languages. Our experiments show that the orthogonal transformation method can train the sentiment lexicon with a small amount of training resources, and has better performance than the lexicon created by other semi-automatic methods.\\ \section{11 Conclusions} We use the web crawler method to collect TikTok's Chinese comment data, and apply the method that can embed the original vector of data into the ultra-dense subspace. In this study, two experiments were used to verify that the ultra-dense subspace can classify the emotion of words. 1. By setting the number of different seed words, we get that the model can distinguish emotions through model training. 2. By comparing with the PCA method, ultra-dense word embedding can better distinguish the emotion of words. we only need to use 5-15 seed words as a training example to learn the subspace, and get the emotional information about the words through the subspace. \section{12 Future Work} In future work, we will find the probabilities that other information embedded in one or more orthogonal subspaces rather than just emotional embedding. This decomposition will not change the content of the information embedding, but it will make them more compact, meaningful and easier to interpret for any given application. In addition, we will use the larger dataset for training, because the size of the data determines the improvement of the model's generalization ability. \bibliographystyle{plain}
{'timestamp': '2020-12-17T02:11:02', 'yymm': '2012', 'arxiv_id': '2012.08773', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08773'}
arxiv
\section{Introduction} Graph, as a complex data structure, consists of nodes (or vertices) and edges (or links). It can be used to model lots of complex systems in real world, e.g. social networks, protein-protein interaction networks, brain networks, road networks, physical interaction networks and knowledge graph etc. Thus, Analyzing the complex networks becomes an intriguing research frontier. With the rapid development of deep learning techniques, many scholars employ the deep learning architectures to tackle the graphs. Graph Neural Networks (GNNs) emerge under these circumstances. Up to now, the GNNs have evolved into a prevalent and powerful computational framework for tackling irregular data such as graphs and manifolds. The GNNs can learn task-specific node/edge/graph representations via hierarchical iterative operators so that the traditional machine learning methods can be employed to perform graph-related learning tasks, e.g. node classification, graph classification, link prediction and clustering etc. Although the GNNs has attained substantial success over the graph-related learning tasks, they still face great challenges. Firstly, the structural complexity of graphs incurs expensive computational cost on large graphs. Secondly, perturbing the graph structure and/or initial features incurs sharp performance decay. Thirdly, the Wesfeiler-Leman (WL) graph isomorphism test impedes the performance improvement of the GNNs. At last, the blackbox work mechanism of the GNNs hinders safely deploying them to real-world applications. In this paper, we generalize the conventional deep architectures to the non-Euclidean domains, and summarize the architectures, extensions and applications, benchmarks and evaluation pitfalls and future research directions of the graph neural networks. Up to now, there have been several surveys on the GNNs. However, they usually discuss the GNN models from different angles and with different emphasises. To the best of our knowledge, the first survey on the GNNs was conducted by Michael M. Bronstein et al\cite{1}. Peng Cui et al\cite{2} reviewed different kinds of deep learning models applied to graphs from three aspects: semi-supervised learning methods including graph convolutional neural networks, unsupervised learning methods including graph auto-encoders, and recent advancements including graph recurrent neural networks and graph reinforcement learning. This survey laid emphasis on semi-supervised learning models, i.e. the spatial and spectral graph convolutional neural networks, yet comparatively less emphasis on the other two aspects. Due to the space limit, this survey only listed a few of key applications of the GNNs, but ignored the diversity of the applications. Maosong Sun et al\cite{3} provided a detailed review of the spectral and spatial graph convolutional neural networks from three aspects: graph types, propagation step and training method, and divided its applications into three scenarios: structural scenarios, non-structural scenarios and other scenarios. However, this article did not involve the other GNN architectures such as graph auto-encoders, graph recurrent neural networks and graph generative networks. Philip S. Yu et al\cite{4} conducted a comprehensive survey on the graph neural networks, and investigated available datasets, open-source implementations and practical applications. However, they only listed a few of core literatures on each research topic. Davide Bacciu et al\cite{367} gives a gentle introduction to the field of deep learning for graph data. The goal of this article is to introduce the main concepts and building blocks to construct neural networks for graph data, and therefore it falls short of an exposition of recent works on graph neural networks. \begin{figure}[htb] \centering \includegraphics[width=0.9\textwidth]{GNN-Panorama.pdf} \caption{The architecture of this paper.} \label{GNN Panorama} \end{figure} It is noted that all of the aforementioned surveys do not concern capability and interpretability of GNNs, combinations of the probabilistic inference and GNNs, and adversarial attacks on graphs. In this article, we provide a panorama of GNNs for readers from 4 perspectives: architectures, extensions and applications, benchmarks and evaluations pitfalls, future research directions, as shown in Fig. \ref{GNN Panorama}. For the architectures of GNNs, we investigate the studies on graph convolutional neural networks (GCNNs), graph pooling operators, graph attention mechanisms and graph recurrent neural networks (GRNNs). The extensions and applications demonstrate some notable research topics on the GNNs through integrating the above architectures. Specifically, this perspective includes the capabilities and interpretability, deep graph representation learning, deep graph generative models, combinations of the Probabilistic Inference (PI) and the GNNs, adversarial attacks for GNNs, Graph Neural Architecture Search and graph reinforcement learning and applications. In summary, our article provides a complete taxonomy for GNNs, and comprehensively review the current advances and trends of the GNNs. These are our main differences from the aforementioned surveys. \textbf{Contributions.} Our main contributions boils down to the following three-fold aspects. \begin{enumerate} \item We propose a novel taxonomy for the GNNs, which has three levels. The first includes architectures, benchmarks and evaluation pitfalls, and applications. The architectures are classified into 9 categories, the benchmarks and evaluation pitfalls into 2 categories, and the applications into 10 categories. Furthermore, the graph convolutional neural networks, as a classic GNN architecture, are again classified into 6 categories. \item We provide a comprehensive review of the GNNs. All of the literatures fall into the corresponding categories. It is expected that the readers not only understand the panorama of the GNNs, but also comprehend the basic principles and various computation modules of the GNNs through reading this survey. \item We summarize four future research directions for the GNNs according to the current facing challenges, most of which are not mentioned the other surveys. It is expected that the research on the GNNs can progress into a new stage by overcoming these challenges. \end{enumerate} \textbf{Roadmap.} The remainder of this paper is organized as follows. First of all, we provide some basic notations and definitions that will be often used in the following sections. Then, we start reviewing the GNNs from 4 aspects: architectures in section 3, extensions and applications in section 4, benchmarks and evaluation pitfalls in section 5 and future research directions in section 6. Finally, we conclude our paper. \section{Preliminaries} In this section, we introduce relevant notations so as to conveniently describe the graph neural network models. A simple graph can be denoted by $G=(V,E)$ where $V$ and $E$ respectively denote the set of $N$ nodes (or vertices) and $M$ edges. Without loss of generality, let $V=\left\{v_1,\cdots,v_N\right\}$ and $E=\left\{e_1,\cdots,e_M\right\}$. Each edge $e_j\in E$ can be denoted by $e_j=\left(v_{s_j},v_{r_j}\right)$ where $v_{s_j}, v_{r_j}\in V$. Let $A_G$ denote the adjacency matrix of $G$ where $A_G(s,r)=1$ iff there is an edge between $v_s$ and $v_r$. If $G$ is edge-weighted, $A_G(s,r)$ equals the weight value of the edge $\left(v_s,v_r\right)$. If $G$ is directed, $\left(v_{s_j},v_{r_j}\right)\neq\left(v_{r_j}, v_{s_j}\right)$ and therefore $A_G$ is asymmetric. A directed edge $e_j=\left(v_{s_j},v_{r_j}\right)$ is also called an arch, i.e. $e_j=\left\langle v_{s_j},v_{s_j}\right\rangle$. Otherwise $\left(v_{s_j},v_{r_j}\right)=\left(v_{r_j}, v_{s_j}\right)$ and $A_G$ is symmetric. For a node $v_s\in V$, let $N_G(v_s)$ denote the set of neighbors of $v_s$, and $d_G(v_s)$ denote the degree of $v_s$. If $G$ is directed, let $N_G^+(v_s)$ and $N_G^-(v_s)$ respectively denote the incoming and outgoing neighbors of $v_s$, and $d_G^+(v_s)$ and $d_G^-(v_s)$ respectively denote the incoming and outgoing degree of $v_s$. Given a vector $a=(a_1,\cdots,a_N)\in\mathbb{R}^N$, $\text{diag}(a)$ (or $\text{diag}(a_1,\cdots,a_N)$) denotes a diagonal matrix consisting of the elements $a_n, n=1,\cdots,N$. A vector $x\in\mathbb{R}^{N}$ is called a 1-dimensional graph signal on $G$. Similarly, $X\in\mathbb{R}^{N\times d}$ is called a $d\text{-dimensiaonl}$ graph signal on $G$. In fact, $X$ is also called a feature matrix of nodes on $G$. Without loss of generality, let $X[j,k]$ denote the $(j,k)\text{-th}$ entry of the matrix $X\in\mathbb{R}^{N\times d}$, $X[j,:]\in\mathbb{R}^d$ denote the feature vector of the node $v_j$ and $X[:,j]$ denote the $1\text{-dimensional}$ graph signal on $G$. Let $\mathbb{I}_N$ denote a $N\times N$ identity matrix. For undirected graphs, $L_G=D_G-A_G$ is called the Laplacian matrix of $G$, where $D_G[r,r]=\sum_{c=1}^N A_G[r,c]$. For a 1-dimensional graph signal $x$, its smoothness $s(x)$ is defined as \begin{equation}\label{SmoothnessOfGraphSignal} s(x)=x^TL_Gx=\frac{1}{2}\sum_{r,c=1}^NA_G(r,c)\left(x[r]-x[c]\right)^2. \end{equation} The normalization of $L_G$ is defined by $\overline{L}_G=\mathbb{I}_N-D_G^{-\frac{1}{2}}A_GD_G^{-\frac{1}{2}}$. $\overline{L}_G$ is a real symmetric semi-positive definite matrix. So, it has $N$ ordered real non-negative eigenvalues $\left\{\lambda_n:n=1,\cdots,N\right\}$ and corresponding orthonormal eigenvectors $\left\{u_n:n=1,\cdots,N\right\}$, namely $\overline{L}_G=U\Lambda U^T$ where $\Lambda=\text{diag}(\lambda_1,\cdots,\lambda_N)$ and $U=\left(u_1,\cdots,u_N\right)$ denotes a orthonormomal matrix. Without loss of generality, $0=\lambda_1\leq\lambda_2\leq\cdots\leq\lambda_N=\lambda_{\text{max}}$. The eigenvectors $u_n, n=1,\cdots,N$ are also called the graph Fourier bases of $G$. Obviously, the graph Fourier basis are also the 1-dimensional graph signal on $G$. The graph Fourier transform\cite{5} for a given graph signal $x$ can be denoted by \begin{equation}\label{GraphFourierTransform} \hat{x}\triangleq\mathcal{F}(x)=U^Tx. \end{equation} The inverse graph Fourier transform can be correspondingly denoted by \begin{equation}\label{InverseGraphFourierTransform} x\triangleq\mathcal{F}^{-1}(\hat{x})=U\hat{x}. \end{equation} Note that the eigenvalue $\lambda_n$ actually measures the smoothness of the graph Fourier mode $u_n$. Throughout this paper, let $\rho(\cdot)$ denote an activation function, $\bowtie$ denote the concatenation of at least two vectors, and $\left<\right>$ denote the inner product of two vectors/matrices. We somewhere use the function $\text{Concat}(\cdot)$ to denote the concatenation of two vectors as well. \section{Architectures} \subsection{Graph Convolutional Neural Networks (GCNNs)} The GCNNs play pivotal roles on tackling the irregular data (e.g. graph and manifold). They are motivated by the Convolutional Neural Networks (CNNs) to learn hierarchical representations of irregular data. There have been some efforts to generalize the CNN to graphs \cite{27,31,48}. However, they are usually computationally expensive and cannot capture spectral or spatial features. Below, we introduce the GCNNs from the next 6 aspects: spectral GCNNs, spatial GCNNs, Graph wavelet neural networks and GCNNs on special graphs. \subsubsection{Spectral Graph Convolution Operators} \begin{figure}[htb] \centering \includegraphics[width=1.0\textwidth]{Spectral-GCNN.pdf} \caption{Computational framework of the spectral GCNN.} \label{Spectral GCNN} \end{figure} The spectral graph convolution operator is defined via the graph Fourier transform. For two graph signals $x$ and $y$ on $G$, their spectral graph convolution $x\ast_Gy$ is defined by \begin{equation}\label{Spectral Graph Convolution} \begin{array}{rcl} x\ast_G y & = & \mathcal{F}^{-1}(\mathcal{F}(x)\circledast\mathcal{F}(y)) \\ [2mm] & = & U\left(U^Tx\circledast U^Ty\right) \\[2mm] & = & U\text{diag}(U^Ty)U^Tx, \end{array} \end{equation} where $\circledast$ denotes the element-wise Hadamard product \cite{7,18,27}. The spectral graph convolution can be rewritten as \begin{displaymath} x\ast_G f_{\theta}=Uf_{\theta}U^Tx, \end{displaymath} where $f_{\theta}$ is a diagonal matrix consisting of the learnable parameters. That is, the signal $x$ is filtered by the spectral graph filter (or graph convolution kernel) $f_{\theta}$. For a $d^{(l)}\text{-dimensional}$ graph signal $X^{(l)}$ on $G$, the output $X^{(l+1)}$ yielded by a graph convolution layer, namely $d^{(l+1)}\text{-dimensional}$ graph signal on $G$, can be written as \begin{equation} \label{Spectral GCNN Formula} X^{(l+1)}[:,k]=\rho\left(\sum_{j=1}^{d^{(l)}}Uf_{\theta,j,k}^{(l)}U^TX^{(l)}[:,j]\right), \end{equation} where $f_{\theta,j,k}^{(l)}$ is a spectral graph filter, i.e. a $N\times N$ diagonal matrix consisting of learnable parameters corresponding to the $j\text{-th}$ graph signal at $l\text{-th}$ layer and the $k\text{-th}$ graph signal at $(l+1)\text{-th}$ layer. The computational framework of the spectral GCNN in Eq. (\ref{Spectral GCNN Formula}) is demonstrated in Fig. \ref{Spectral GCNN}. It is worth noting that the calculation of the above graph convolution layer takes $O(N^3)$ time and $O(N^2)$ space to perform the eigendecomposition of $\overline{L}_G$ especially for large graphs. The article \cite{179} proposes a regularization technique, namely GraphMix, to augment the vanilla GCNN with a parameter-sharing Fully Connected Network (FCN). \textbf{Spectral Graph Filter.} Many studies \cite{27} focus on designing different spectral graph filters. In order to circumvent the eigendecomposition, the spectral graph filter $f_{\theta}$ can formulated as a $K\text{-localized}$ polynomial of the eigenvalues of the normalized graph Laplacian $\overline{L}_G$ \cite{6,8,78}, i.e. \begin{equation}\label{Chebyshev Spectral Filter} f_{\theta}=f_{\theta}(\Lambda)\triangleq\sum_{k=0}^{K-1}\theta_k\Lambda^k. \end{equation} In practice, the $K\text{-localized}$ Chebyshev polynomial \cite{78} is a favorable choice of formulating the spectral graph filter, i.e. \begin{displaymath} f_{\theta}(\Lambda)=\sum_{k=0}^{K-1}\theta_kT_k(\widetilde{\Lambda}), \end{displaymath} where the Chebyshev polynomial is defined as \begin{equation}\label{Chebeshev Polynomial} T_0(x)=1,\quad T_1(x)=x,\quad T_k(x)=2xT_{k-1}(x)-T_{k-2}(x) \end{equation} and $\widetilde{\Lambda}=\frac{2}{\lambda_{\text{max}}}\Lambda-\mathbb{I}_N$. The reason why $\widetilde{\Lambda}=\frac{2}{\lambda_{\text{max}}}\Lambda-\mathbb{I}_N$ is because it can map eigenvalues $\lambda\in\left[0,\lambda_{\text{max}}\right]$ into $[-1,1]$. This filter is $K\text{-localized}$ in the sense that it leverages information from nodes which are at most $K\text{-hops}$ away. In order to further decrease the computational cost, the $1\text{st-order}$ Chebyshev polynomial is used to define the spectral graph filter. Specifically, it lets $\lambda_{\text{max}}\approx 2$ (because the largest eigenvalue of $\overline{L}_G$ is less than or equal to 2 \cite{374}) and $\theta=\theta_0=-\theta_1$. Moreover, the renormalization trick is used here to mitigate the limitations of the vanishing/exploding gradient, namely substituting $\widetilde{D}_G^{-\frac{1}{2}}\widetilde{A}_G\widetilde{D}_G^{-\frac{1}{2}}$ for $\mathbb{I}_N+D_G^{-\frac{1}{2}}A_GD_G^{-\frac{1}{2}}$ where $\widetilde{A}_G=A_G+\mathbb{I}_N$ and $\widetilde{D}_G=\text{diag}\left(\sum_{k=1}^{N}\widetilde{A}[1,k],\cdots,\sum_{k=1}^{N}\widetilde{A}[N,k]\right)$. As a result, the Graph Convolutional Network (GCN) \cite{6,375} can be defined as \begin{equation}\label{GCN-Layer} X^{(l+1)}=\rho\left(\widetilde{D}_G^{-\frac{1}{2}}\widetilde{A}_G\widetilde{D}_G^{-\frac{1}{2}}X^{(l)}\Theta^{(l)}\right). \end{equation} The Chebyshev spectral graph filter suffers from a drawback that the spectrum of $\overline{L}_G$ is linearly mapped into $\left[-1,1\right]$. This drawback makes it hard to specialize in the low frequency bands. In order to mitigate this problem, Michael M. Bronstein et al \cite{12} proposes the Cayley spectral graph filter via the $\text{order-}r$ Cayley polynomial $f_{c,h}(\lambda)=c_0+2\text{Re}\left(\sum_{j=0}^{r}c_h\mathcal{C}(\lambda)^j\right)$ with the Cayley transform $\mathcal{C}(\lambda)=\frac{\lambda-i}{\lambda+i}$. Moreover, there are many other spectral graph filters, e.g. \cite{8,14,19,22,30,37,38,39,44,90}. In addition, some studies employ the capsule network \cite{400} to construct capsule-inspired GNNs \cite{52,53,54}. \textbf{Overcoming Time and Memory Challenges.} A chief challenge for GCNNs is that their training cost is strikingly expensive, especially on huge and sparse graphs. The reason is that the GCNNs require full expansion of neighborhoods for the feed-forward computation of each node, and large memory space for storing intermediate results and outputs. In general, two approaches, namely sampling \cite{9,10,11,25} and decomposition \cite{23,24}, can be employed to mitigate the time and memory challenges for the spectral GCNNs. \textbf{Depth Trap of Spectral GCNNs.} A bottleneck of GCNNs is that their performance maybe decease with ever-increasing number of layer. This decay is often attributed to three factors: (1) overfitting resulting from the ever-increasing number of parameters; (2) gradient vanishing/explosion during training; (3) oversmoothing making vertices from different clusters more and more indistinguishable. The reason for oversmoothing is that performing the Laplacian smoothing many times forces the features of vertices within the same connected component to stuck in stationary points \cite{16}. There are some available approaches, e.g. \cite{33,373,379,398,399}, to circumvent the depth trap of the spectral GCNNs. \subsubsection{Spatial Graph Convolution Operators} Original spatial GCNNs \cite{47,76,77,380} constitutes a transition function, which must be a contraction map in order to ensure the uniqueness of states, and an update function. In the following, we firstly introduce a generic framework of the spatial GCNN, and then investigate its variants. Graph networks (GNs) as generic architectures with relational inductive bias \cite{85} provide an elegant interface for learning entities, relations and structured knowledge. Specifically, GNs are composed of GN blocks in a sequential, encode-process-decode or recurrent manner. GN blocks contain three kinds of update functions, namely $\phi^{e}(\cdot),\phi^{v}(\cdot),\phi^{u}(\cdot)$, and three kinds of aggregation functions, namely $\psi^{e\rightarrow v}(\cdot), \psi^{e\rightarrow u}(\cdot), \psi^{v\rightarrow u}(\cdot)$. The iterations are described as follows. \begin{equation}\label{GN-BLOCK} \begin{array}{lll} e'_k=\phi^{e}\left(e_k,v_{r_k},v_{s_k},u\right), & \bar{e}'_i=\psi^{e\rightarrow v}\left(E'_i\right), & v'_i=\phi^{v}\left(v_i,\bar{e}'_i,u\right), \\[2mm] \bar{e}'=\psi^{e\rightarrow u}\left(E'\right), & u'=\phi^{u}\left(u,\bar{e}',\bar{v}'\right), & \bar{v}'=\psi^{v\rightarrow u}\left(V'\right) \end{array} \end{equation} where $e_k$ is an arch from $v_{s_k}$ to $v_{r_k}$, $E'_i=\left\{(e'_k,s_k,r_k):r_k=i,k=1,\cdots,M\right\}$, $V'=\left\{v'_i:i=1,\cdots,N\right\}$ and $E'=\left\{(e'_k,s_k,r_k):k=1,\cdots,M\right\}$, see Fig. \ref{Spatial GCNN}. It is noted that the aggregation functions should be invariant to any permutations of nodes or edges. In practice, the GN framework can be used to implement a wide variety of architectures in accordance with three key design principles, namely flexible representations, configuable within-block structure and flexible multi-block architectures. Below, we introduce three prevalent variants of the GNs, namely Message Passing Neural Networks (MPNNs) \cite{93}, Non-local Neural Networks (NLNNs) \cite{102} and GraphSAGE \cite{104}. \begin{figure}[htb] \centering \includegraphics[width=1.0\textwidth]{Spatial-GCNN.pdf} \caption{Computational framework of the spatial GCNN.} \label{Spatial GCNN} \end{figure} \textbf{Variants of GNs------MPNNs.} MPNNs \cite{93} have two phases, a message passing phase and a readout phase. The message passing phase is defined by a message function $M_l$ (playing the role of the composition of the update function $\psi^{e\rightarrow v}(\cdot)$ and the update function $\phi^{e}(\cdot)$) and a vertex update function $U_l$ (playing the role of the update function $\phi^{v}(\cdot)$). Specifically, \begin{displaymath} m_v^{(l+1)}=\displaystyle\sum_{u\in N_G(v)}M_l\left(x_v^{(l)},x_u^{(l)},e_{v,u}\right),\quad x_v^{(l+1)}=U_l\left(x_v^{(l)},m_v^{(l+1)}\right) \end{displaymath} where $e_{v,u}$ denotes the feature vector of the edge with two endpoints $v$ and $u$. The readout phase computes a universal feature vector for the whole graph using a readout function $R(\cdot)$, i.e. $u=R\left(\left\{x_v^{(L)}:v\in V\right\}\right)$. The readout function $R(\cdot)$ should be invariant to permutations of nodes. A lot of GCNNs can be regarded as special forms of the MPNN, e.g. \cite{103,122,336,195}. \textbf{Variants of GNs------NLNNs.} NLNNs \cite{102} give a general definition of non-local operations \cite{381} which is a flexible building block and can be easily integrated into convolutional/recurrent layers. Specifically, the generic non-local operation is defined as \begin{equation}\label{NLNN} y_s=\frac{1}{\mathcal{C}(x_s)}\sum_{t}f(x_s,x_t)g(x_t), \end{equation} where $f(\cdot,\cdot)$ denotes the affinity between $x_s$ and $x_t$, and $\mathcal{C}(x_s)=\sum_{t}f(x_s,x_t)$ is a normalization factor. The affinity function $f(\cdot,\cdot)$ is of the following form \begin{enumerate} \item Gaussian: $f(x_s,x_t)=e^{x_s^Tx_t}$; \item Embedded Gaussian: $f(x_s,x_t)=e^{\theta(x_s)^T\eta(x_t)}$, where $\theta(x_s)=W_{\theta}x_s$ and $\eta(x_t)=W_{\eta}x_t$; \item Dot Product: $f(x_s,x_t)=\theta(x_s)^T\eta(x_t)$; \item Concatenation: $f(x_s,x_t)=\text{ReLU}(w_f^T\left[\theta(x_s),\eta(x_t)\right])$. \end{enumerate} The non-local building block is defined as $z_s=W_zy_s+x_s$ where "$+x_s$" denotes a residual connection. It is noted that $f(\cdot,\cdot)$ and $g(\cdot)$ play the role of $\phi^e(e_k,v_{r_k},v_{s_k},u)$, and the summation in Eq. (\ref{NLNN}) plays the role of $\psi^{e\rightarrow v}(E'_i)$. \textbf{Variants of GNs------GraphSAGE.} GraphSAGE (\textsc{SAmple} and \textsc{aggreGatE}) \cite{104} is a general inductive framework capitalizing on node feature information to efficiently generate node embedding vectors for previously unseen nodes. Specifically, GraphSAGE is composed of an aggregation function $\text{\textsc{Aggregate}}^{(l)}(\cdot)$ and an update function $\text{\textsc{Update}}^{(l)}$, i.e. \begin{displaymath} \begin{array}{l} x_{N_G(v)}^{(l)}=\text{\textsc{Aggregate}}^{(l)}\left(\left\{x_u^{(l-1)}: u\in N_G(v)\right\}\right) \\[5mm] x_v^{(l)}=\text{\textsc{Update}}^{(l)}\left(\left\{x_v^{(l-1)},x_{N_G(v)}^{(l)}\right\}\right) \end{array} \end{displaymath} where $N_G(v)$ denotes a fixed-size set of neighbors of $v$ uniformly sampling from its whole neighbors. The aggregation function is of the following form \begin{enumerate} \item Mean Aggregator: $x_v^{(l)}=\sigma\left(W\cdot\text{\textsc{Mean}}\left(\left\{x_v^{(l-1)}\right\}\cup\left\{x_u^{(l-1)}:u\in N_G(v)\right\}\right)\right)$; \item LSTM Aggregator: applying the LSTM \cite{160} to aggregate the neighbors of $v$; \item Pooling Aggregator: $\text{\textsc{Aggregate}}^{(l)}=\max\left(\left\{\sigma\left(Wx_u^{(l)}+b\right): u\in N_G(v)\right\}\right)$. \end{enumerate} Note that the aggregation function and update function play the role of $\psi^{e\rightarrow v}(E'_i)$ and $\phi^{v}(v_i,\overline{e}'_i,u)$ in formula (\ref{GN-BLOCK}) respectively. \textbf{Variants of GNs------Hyperbolic GCNNs.} The Euclidean GCNNs aim to embed nodes in a graph into a Euclidean space. This will incur a large distortion especially when embedding real-world graphs with scale-free and hierarchical structure. Hyperbolic GCNNs pave an alternative way of embedding with little distortion. The $n\text{-dimensional}$ hyperbolic space \cite{69,193}, denoted as $\mathbb{H}_K^n$, is a unique, complete, simply connected $d\text{-dimensional}$ Riemannian manifold with constant negative sectional curvature $-\frac{1}{K}$, i.e. \begin{displaymath} \mathbb{H}_K^n=\left\{x\in\mathbb{R}^{n+1}:\langle x,x\rangle_{\mathcal{M}}=-K,x_0>0\right\}, \end{displaymath} where the Minkowski inner produce $\langle x,y\rangle_{\mathcal{M}}=-x_0y_0+\sum_{j=1}^dx_jy_j,\forall x,y\in\mathbb{R}^{n+1}$. Its tangent space centered at point $x$ is denoted as $\mathcal{T}_x\mathbb{H}_K^n=\left\{v\in\mathbb{R}^{n+1}:\langle x,v\rangle_{\mathcal{M}}=0\right\}$. Given $x\in\mathbb{H}_K^n$, let $u\in\mathcal{T}_x\mathbb{H}_K^n$ be unit-speed. The unique unit-speed geodesic $\gamma_{x\rightarrow u}(\cdot)$ such that $\gamma_{x\rightarrow u}(0)=x$ and $\dot{\gamma}_{x\rightarrow u}(0)=u$ is denoted as $\gamma_{x\rightarrow u}(t)=\cosh\left(\frac{t}{\sqrt{K}}\right)x+\sqrt{K}\sinh\left(\frac{t}{\sqrt{K}}\right), u, t>0.$ The intrinsic distance between two points $x,y\in\mathbb{H}_K^n$ is then equal to \begin{displaymath} d_{\mathcal{M}}^K\left(x,y\right)=\sqrt{K}\text{arcosh}\left(-\frac{\langle x,y\rangle_{\mathcal{M}}}{K}\right). \end{displaymath} Therefore, the above $n\text{-dimensional}$ hyperbolic space with constant negative sectional curvature $-\frac{1}{K}$ is usually denoted as $\left(\mathbb{H}_K^n,d_{\mathcal{M}}^K(\cdot,\cdot)\right)$. In particular, $\mathbb{H}_1^n$, i.e. $K=1$, is called the hyperboloid model of the hyperbolic space. Hyperbolic Graph Convolutional Networks (HGCN) \cite{15} benefit from the expressiveness of both GCNNs and hyperbolic embedding. It employs the exponential and logarithmic maps of the hyperboloid model, respectively denoted as $\exp_x^K(\cdot)$ and $\log_x^K(\cdot)$, to realize the mutual transformation between Euclidean features and hyperbolic ones. Let $\|v\|_{\mathcal{M}}=\langle v,v\rangle_{\mathcal{M}},v\in\mathcal{T}_x\mathbb{H}_K^n$. The $\exp_x^K(\cdot)$ and $\log_x^K(\cdot)$ are respectively defined to be \begin{displaymath} \begin{array}{l} \exp_x^K(v)=\cosh\left(\frac{\|v\|_{\mathcal{M}}}{\sqrt{K}}\right)x+\sqrt{K}\sinh\left(\frac{\|v\|_{\mathcal{M}}}{\sqrt{K}}\right)\frac{v}{\|v\|_{\mathcal{M}}} \\[2mm] \log_x^{K}(y)=d_{\mathcal{M}}^K(x,y)\dfrac{y+\frac{1}{K}\langle x,y\rangle_{\mathcal{M}}x}{\left\|y+\frac{1}{K}\langle x,y\rangle_{\mathcal{M}}x\right\|_{\mathcal{M}}}, \end{array} \end{displaymath} where $x\in\mathbb{H}_K^n$, $v\in\mathcal{T}_x\mathbb{H}_K^n$ and $y\in\mathbb{H}_K^n$ such that $y\neq 0$ and $y\neq x$. The HGCN architecture is composed of three components: a Hyperbolic Feature Transform (HFT), an Attention-Based Aggregation (ABA) and a Non-Linear Activation with Different Curvatures (NLADC). They are respectively defined as \begin{displaymath} \begin{array}{lr} h_j^{H,l}=\left(W^{(l)}\otimes^{K_{l-1}}x_j^{H,l-1}\right)\oplus^{K_{l-1}}b^{(l)} &\quad \text{(HFT)}, \\[2mm] y_j^{H,l}=\text{\textsc{Aggregate}}^{K_{l-1}}(h^{H,l})_j &\quad \text{(ABA)}, \\[2mm] x_j^{H,l}=\exp_o^{K_l}\left(\rho\left(\log_o^{K_{l-1}}\left(y_j^{H,l}\right)\right)\right) &\quad \text{(NLADC)}, \end{array} \end{displaymath} where $o=\left(\sqrt{K},0,\cdots,0\right)\in\mathbb{H}_K^n$, the subscript $j$ denotes the indices of nodes, the superscript $l$ denotes the layer of the HGCN. The linear transform in hyperboloid manifold is defined to be $W\otimes^K x^H=\exp_o^K\left(W\log_o^K(x^H)\right)$ and $x^H\oplus^K b=\exp_{x^H}^K\left(P_{o\rightarrow x^H}^K(b)\right)$, where $P_{o\rightarrow x^H}^K(b)$ is the parallel transport from $\mathcal{T}_o\mathbb{H}_K^n$ to $\mathcal{T}_{x^H}\mathbb{H}_K^{n}$. The attention-based aggregation is defined to be $\text{\textsc{Aggregate}}^K(x^H)_j=\exp_{x_j^H}^K\left(\sum_{k\in N_G(j)}\omega_{j,k}\log_{x_j^H}^K\left(x_k^H\right)\right)$, where the attention weight $\omega_{j,k}=\text{Softmax}_{k\in N_G(j)}\left(\text{MLP}\left(\log_o^K\left(x_j^H\right)\bowtie\log_o^K\left(x_k^H\right)\right)\right)$. \textbf{Higher-Order Spatial GCNNs.} the aforementioned GCNN architectures are constructed from the microscopic perspective. They only consider nodes and edges, yet overlook the higher-order substructures and their connections, i.e subgraphs consisting of at least 3 nodes. Here, we introduce the studies on the $k\text{-dimensional}$ GCNNs \cite{88}. Specifically, they take higher-order graph structures at multiple scales into consideration by leveraging the $k\text{-Weisfeiler-Leman}$ ($k\text{-WL}$) graph isomorphism test so that the message passing is performed directly between subgraph structures rather than individual nodes. Let $\{\hspace{-1.2mm}\{\cdots\}\hspace{-1.2mm}\}$ denote a multiset, $\text{\textsc{Hash}}(\cdot)$ a hashing function and $C_{l,k}^{(l)}(s)$ the node coloring (label) of $s=(s_1,\cdots,s_k)\in V^k$ at the $l\text{-th}$ time. Moreover, let $N_G^j(s)=\left\{(s_1,\cdots,s_{j-1},r,s_{j+1},\cdots,s_k):r\in V\right\}$. The $k\text{-WL}$ is computed by \begin{displaymath} C_{l,k}^{(l+1)}(s)=\text{\textsc{Hash}}\left(C_{l,k}^{(l)}(s),\left(c_1^{(l+1)}(s),\cdots,c_k^{(l+1)}(s)\right)\right), \end{displaymath} where $c_{j}^{(l+1)}=\text{\textsc{Hash}}\left(\left\{\hspace{-1.2mm}\left\{C_{l,k}^{(l)}(s'):s'\in N_G^j(s)\right\}\hspace{-1.2mm}\right\}\right)$. The $k\text{-GCNN}$ computes new features of $s\in V^k$ by multiple computational layers. Each layer is computed by \begin{displaymath} X_k^{(l+1)}[s,:]=\rho\left(X_k^{(l)}[s,:]W_1^{(l)}+\sum_{t\in N_G(s)}X_k^{(l)}[t,:]W_2^{(l)}\right). \end{displaymath} In practice, the local $k\text{-GCNNs}$ is often employed to learn the hierarchical representations of nodes in order to scale to larger graphs and mitigate the overfitting problem. \textbf{Other Variants of GNs.} In addition to the aforementioned GNs and its variants, there are still many other spatial GCNNs which is defined from other perspectives, e.g. Diffusion-Convolutional Neural Network (DCNN) \cite{20}, Position-aware Graph Neural Network (P-GNN) \cite{46}, Memory-based Graph Neural Network (MemGNN) and Graph Memory Network (GMN) \cite{84}, Graph Partition Neural Network (GPNN) \cite{35}, Edge-Conditioned Convolution (ECC) \cite{43}, DEMO-Net \cite{386}, Column network \cite{29}, Graph-CNN \cite{32}. \textbf{Invariance and Equivariance.} Permutation-invariance refers to that a function $f:\mathbb{R}^{n^k}\rightarrow\mathbb{R}$ (e.g. the aggregation function) is independent of any permutations of node/edge indices \cite{50,389}, i.e. $f(P^TA_GP)=f(A_G)$ where $P$ is a permutation matrix and $A_G\in\mathbb{R}^{n^k}$ is a $k\text{-order}$ tensor of edges or multi-edges in the (hyper-)graph $G$. Permutation-equivariance refers to that a function $f:\mathbb{R}^{n^k}\rightarrow\mathbb{R}^{n^l}$ coincides with permutations of node/edge indices \cite{50,389}, i.e. $f(P^TA_GP)=P^Tf(A_G)P$ where $P$ and $A_G$ are defined as similarly as the permutation-invariance. For permutation-invariant aggregation functions, a straightforward choice is to take $\text{sum}/\max/\text{average}/\text{concatenation}$ as heuristic aggregation schemes \cite{50}. Nevertheless, these aggregation functions treat all the neighbors of a vertex equivalently so that they cannot precisely distinguish the structural effects of different neighbors to the target vertex. That is, the aggregation functions should extract and filter graph signals aggregated from neighbors of different hops away and different importance. GeniePath \cite{34} proposes a scalable approach for learning adaptive receptive fields of GCNNs. It is composed of two complementary functions, namely adaptive breadth function and adaptive depth function. The former learns the importance of different sized neighborhoods, whereas the latter extracts and filters graph signals aggregated from neighbors of different hops away. More specifically, the adaptive breadth function is defined as follows. \begin{displaymath} h_{v_j}^{\text{temp}}=\tanh\left((W^{(t)})^T\sum_{v_k\in N_G(v_j)\cup\{v_j\}}\alpha(h_{v_j}^{(t)},h_{v_k}^{(t)})\cdot h_{v_k}^{(t)}\right), \end{displaymath} where $\alpha(x,y)=\text{Softmax}_y\left(\alpha^T\tanh\left(W_x^Tx+W_y^Ty\right)\right)$. The adaptive depth function is defined as a LSTM \cite{160}, i.e. \begin{equation}\label{LSTM Formulation} \begin{array}{ll} i_{v_j}=\sigma\left(\left(W_i^{(t)}\right)^Th_{v_j}^{\text{temp}}\right) & \qquad f_{v_j}=\sigma\left(\left(W_f^{(t)}\right)^Th_{v_j}^{\text{temp}}\right) \\ o_{v_j}=\sigma\left(\left(W_o^{(t)}\right)^Th_{v_j}^{temp}\right) & \qquad \widetilde{C}_{v_j}=\tanh\left(\left(W_c^{(t)}\right)^Th_{v_j}^{(temp)}\right) \\ C_{v_j}^{(t+1)}=f_{v_j}\circledast C_{v_j}^{(t)}+i_{v_j}\circledast\widetilde{C}_{v_j} & \qquad h_{v_j}^{(t+1)}=o_{v_j}\circledast\tanh\left(C_{v_j}^{(t+1)}\right). \end{array} \end{equation} \textsc{Geom-GCN} \cite{17} proposes a novel permutation-invariant geometric aggregation scheme consisting of three modules, namely node embedding, structural neighborhood, and bi-level aggregation. This aggregation scheme does not lose structural information of nodes and fail to capture long-range dependencies in disassortative graphs. For the permutation-invariant graph representations, PiNet \cite{41} proposes an end-to-end spatial GCNN architecture that utilizes the permutation equivariance of graph convolutions. It is composed of a pair of double-stacked message passing layers, namely attention-oriented message passing layers and feature-oriented message passing layers. \textbf{Depth Trap of Spatial GCNNs.} Similar to the spectral GCNNs, the spatial GCNNs is also confronted with the depth trap. As stated previously, the depth trap results from oversmoothing, overfitting and gradient vanishing/explosion. In order to escape from the depth trap, some studies propose some available strategies, e.g. DeepGCN \cite{13} and Jumping Knowledge Network \cite{89}. The jumping knowledge networks \cite{89} adopt neighborhood aggregation with skip connections to integrate information from different layers. The DeepGCN \cite{13} apply the residual/dense connections \cite{382,383} and dilated aggreagation \cite{384} in the CNNs to construct the spatial GCNN architecture. They has three instantiations, namely ResGCN, DenseGCN and dilated graph convolution. ResGCN is inspired by the ResNet \cite{382}, which is defined to be \begin{displaymath} \begin{array}{lcl} G^{(l+1)} & \triangleq & \mathcal{H}(G^{(l)},\Theta^{(l)}) \\ [2mm] & = & \mathcal{F}(G^{(l)},\Theta^{(l)})+G^{(l)}, \end{array} \end{displaymath} where $\mathcal{F}(\cdot,\cdot)$ can be computed by spectral or spatial GCNNs. DenseGCN collectively exploit information from different GCNN layers like the DenseNet \cite{383}, which is defined to be \begin{displaymath} \begin{array}{lcl} G^{(l+1)} & \triangleq & \mathcal{H}(G^{(l)},\Theta^{(l)}) \\ [2mm] & = & \text{Concat}\left(\mathcal{F}(G^{(l)},\Theta^{(l)}),G^{(l)}\right) \\ [2mm] & = & \text{Concat}\left(\mathcal{F}(G^{(l)},\Theta^{(l)}),\cdots,\mathcal{F}(G^{(0)},\Theta^{(0)}),G^{(0)}\right). \end{array} \end{displaymath} The dilated aggregation \cite{384} can magnify the receptive field of spatial GCNNs by a dilation rate $d$. More specifically, let $N_G^{(k,d)}(v)$ denote the set of $k$ $d\text{-dilated}$ neighbors of vertex $v$ in $G$. If $\left(u_1,u_2,\cdots,u_{k\times d}\right)$ are the first sorted $k\times d$ nearest neighbors, then $N_G^{(k,d)}(v)=\left\{u_1,u_{1+d},\cdots,u_{1+(k-1)d}\right\}$. Thereby, we can construct a new graph $G^{(k,d)}=\left(V^{(k,d)},E^{(k,d)}\right)$ where $V^{(k,d)}=V$ and $E^{(k,d)}=\left\{\left\langle v,u\right\rangle:v\in V,u\in N_G^{(k,d)}\right\}$. The dilated graph convolution layer can be obtained by running the spatial GCNNs over $G^{(k,d)}$. \subsubsection{Graph Wavelet Neural Networks} As stated previously, the spectral and spatial GCNNs are respectively inspired by the graph Fourier transform and message-passing mechanism. Here, we introduce a new GCNN architecture from the perspective of the Spectral Graph Wavelet Transform (SGWT) \cite{189}. First of all, the SGWT is determined by a graph wavelet generating kernel $g:\mathbb{R}^+\rightarrow\mathbb{R}^+$ with the property $g(0)=0,g(+\infty)=\lim_{x\rightarrow\infty}g(x)=0$. A feasible instance of $g(\cdot)$ is parameterized by two integers $\alpha$ and $\beta$, and two positive real numbers $x_1$ and $x_2$ determining the transition regions, i.e. \begin{displaymath} g(x;\alpha,\beta,x_1,x_2)=\left\{ \begin{array}{ll} x_1^{-\alpha}x^{\alpha} & x<x_1 \\ s(x) & x_1\leq x\leq x_2 \\ x^{-\beta}x_2^{\beta} & x>x_2, \end{array} \right. \end{displaymath} where $s(x)$ is a cubic polynomial whose coefficients can be determined by the continuity constraints $s(x_1)=s(x_2)=1$, $s'(x_1)=\frac{\alpha}{x_1}$ and $s'(x_2)=-\frac{\beta}{x_2}$. Given the graph wavelet generating kernel $g(\cdot)$ and a scaling parameter $s\in\mathbb{R}^+$, the spectral graph wavelet operator $\Psi_g^s$ is defined to be $\Psi_g^s=Ug(s\Lambda)U^T$ where $g(s\Lambda)=g\left(\text{diag}\left(s\lambda_1,\cdots,s\lambda_N\right)\right)$. A graph signal $x\in\mathbb{R}^N$ on $G$ can thereby be filtered by the spectral graph wavelet operator, i.e. $\mathcal{W}_{g,s}^x=\Psi_g^sx\in\mathbb{R}^N$. The literature \cite{190} utilizes a special instance of the graph wavelet operator $\Psi_g^s$ to construct a graph scattering network, and proves its covariance and approximate invariance to permutations and stability to graph operations. \textbf{Graph Wavelet Neural Networks.} The above spectral graph wavelet operator $\Psi_g^s$ can be employed to construct a Graph Wavelet Neural Network (GWNN) \cite{191}. Let $\Psi_g^{-s}\triangleq\left(\Psi_g^s\right)^{-1}$. The graph wavelet based convolution is defined to be \begin{displaymath} x*_Gy=\Psi_g^{-s}\left(\Psi_g^sx\circledast\Psi_g^sy\right). \end{displaymath} The GWNN is composed of multiple layers of the graph wavelet based convolution. The structure of the $l\text{-th}$ layer is defined as \begin{equation}\label{Graph Wavelet based Convolution in vector form} X^{(l+1)}[:,j]=\rho\left(\sum_{k=1}^{d^{(l)}}\Psi_g^{-s}\Theta_{j,k}^{(l)}\Psi_g^sX^{(l)}[:,k]\right), \end{equation} where $\Theta_{j,k}^{(l)}$ is a diagonal filter matrix learned in spectral domain. Eq. (\ref{Graph Wavelet based Convolution in vector form}) can be rewritten as a matrix form, i.e. $X^{(l+1)}=\rho\left(\Psi_g^{-s}\Theta\Psi_g^{s}X^{(l)}W^{(l)}\right)$. The learnable filter matrix $\Theta$ can be replaced with the $K\text{-localized}$ Chebyshev Polynomial so as to eschew the time-consuming eigendecomposition of $\overline{L}_G$. \subsubsection{Summary} The aforementioned GCNN architectures provide available ingredients of constructing the GNNs. In practice, we can construct our own GCNNs by assembling different modules introduced above. Additionally, some scholars also study the GCNNs from some novel perspectives, e.g. the parallel computing framework of the GCNNs \cite{40}, the hierarchical covariant compositional networks \cite{213}, the transfer active learning for GCNNs \cite{45} and quantum walk based subgraph convolutional neural network \cite{51}. They are closely related to the GCNNs, yet fairly different from the ones introduced above. \subsection{Graph Pooling Operators} Graph pooling operators are very important and useful modules of the GCNNs, especially for graph-level tasks such as the graph classification. There are two kinds of graph pooling operators, namely global graph pooling operators and hierarchical graph pooling operators. The former aims to obtain the universal representations of input graphs, and the latter aims to capture adequate structural information for node representations. \subsubsection{Global Graph Pooling Operators.} Global graph pooling operators pool all of representations of nodes into a universal graph representation. Many literatures \cite{8,21,41} apply some simple global graph pooling operators, e.g. max/average/concatenate graph pooling, to performing graph-level classification tasks. Here, we introduce some more sophisticated global graph pooling operators in contrast to the simple ones. Relational pooling (RP) \cite{98} provides a novel framework for graph representation with maximal representation power. Specifically, all node embeddings can be aggregated via a learnable function to form a global embedding of $G$. Let $X^{(v)}\in\mathbb{R}^{N\times d_v}$ and $\underline{X}^{(e)}\in\mathbb{N}^{N\times N\times d_e}$ respectively denote node feature matrix and edge feature tensor. Tensor $\underline{A}_G\in\mathbb{R}^{N\times N\times (1+d_e)}$ combines the adjacency matrix $A_G$ of $G$ with its edge feature tensor $\underline{X}^{(e)}$, i.e. $\underline{A}_G[u,v,:]=\mathbb{I}_{(u,v)\in E_G}\bowtie\underline{X}^{(e)}[u,v,:]$. After performing a permutation on $V_G$, the edge feature tensor $\underline{A}_G^{(\pi,\pi)}\left[\pi(r),\pi(c),d\right]=\underline{A}_G[r,c,d]$ and the node feature matrix $X_{\pi}^{(v)}[\pi(r),c]=X^{(v)}[r,c]$. The joint RP permutation-invariant function for directed or undirected graphs is defined as \begin{displaymath} \bar{\bar{f}}(G)=\frac{1}{N!}\sum_{\pi\in\Pi_{|V|}}\overrightarrow{f}(\underline{A}_G^{\pi,\pi},X_{\pi}^{(v)}), \end{displaymath} where $\Pi_{|V|}$ is the set of all distinct permutations on $V_G$ and $\overrightarrow{f}(\cdot,\cdot)$ is an arbitrary (possibly permutation-sensitive) vector-valued function. Specifically, $\overrightarrow{f}(\cdot,\cdot)$ can be denoted as Multi-Layer Perceptrons (MLPs), Recurrent Neural Networks (RNNs), Convolutional Neural Networks (CNNs) or Graph Neural Networks (GNNs). The literature \cite{98} proves that $\bar{\bar{f}}(G)$ has the most expressive representation of $G$ under some mild conditions, and provides approximation approaches to making RP computationally tractable. In addition, there are some other available global graph pooling operators, e.g. SortPooling \cite{92} and function space pooling \cite{97}. \subsubsection{Hierarchical Graph Pooling Operators.} Hierarchical graph pooling operators group a set of proximal nodes into a super-node via graph clustering methods. Consequently, the original graph is coarsened to a new graph with coarse granularity. In practice, the hierarchical graph pooling operators are interleaved with the vanilla GCNN layers. In general, there are three kinds of approaches to performing the graph coarsening operations, namely invoking the existing graph clustering algorithms (e.g. spectral clustering \cite{7} and Graclus \cite{99}), learning a soft cluster assignment and selecting the first $k$ top-rank nodes. \textbf{Invoking existing graph clustering algorithms.} The graph clustering aims to assign proximal nodes to the same cluster and in-proximal nodes to different clusters. The coarsened graph regards the resulting clusters as super-nodes and connections between two clusters as super-edges. The hierarchical graph pooling operators aggregate the representations of nodes in super-nodes via aggregation functions such as max pooling and average pooling \cite{91} to compute the representations of the super-nodes. The literature \cite{82} proposes the EigenPooling method and presents the relationship between the original and coarsened graph. In order to construct a coarsened graph of $G$, a graph clustering method is employed to partition $G$ into $K$ disjoint clusters, namely $\left\{G_k:k=1,\cdots,K\right\}$. Suppose each cluster $G_k$ has $N_k$ nodes, namely $\left\{v_{k,1},\cdots,v_{k,N_k}\right\}$, and its adjacency matrix is denoted as $A_{G_k}$. The coarsened graph $G_{\text{coar}}$ of $G$ can be constructed by regarding the clusters $G_k,k=1,\cdots,K$ as super-nodes and connections between two super-nodes as edges. For $G_k$, its sampling matrix $C_k$ of size $\left(N\times N_k\right)$ is defined by \begin{displaymath} C_k(s,t)=\left\{ \begin{array}{lll} 1 && \text{if node $v_{k,s}$ in $G_k$ is identical to vertex $v_{t}$ in $G$} \\ [2mm] 0 && \text{otherwise} \end{array} \right. \end{displaymath} On one hand, $C_k$ can be used to down-sample a $1\text{-dimensional}$ graph signal $x$ on $G$ to obtain an contracted graph signal $x_{G_k}$ on $G_k$, i.e. $x_{G_k}=C_k^Tx$. On the other hand, $C_k$ can also be used to up-sample a graph signal $x_{G_k}$ on $G_k$ to obtain a dilated graph $G$, i.e. $x=C_kx_{G_k}$. Furthermore, the adjacency matrix $A_{G_k}$ of $G_k$ can be computed by \begin{displaymath} A_{G_k}=C_k^TA_GC_k. \end{displaymath} The intra-subgraph adjacency matrix of $G$ is computed by $A_{\text{intra}}=\sum_{k=1}^KC_kA_{G_k}C_k^T$. Thereby, the inter-subgraph adjacency matrix of $G$ can be computed by $A_{\text{inter}}=A_G-A_{\text{intra}}$. Let $M_{\text{coar}}\in\mathbb{R}^{N\times K}$ denote the assignment matrix from $G$ to $G_{\text{coar}}$. Its $(j,k)\text{-th}$ entry is defined as \begin{displaymath} M_{\text{coar}}[j,k]=\left\{ \begin{array}{lll} 1 && \text{if $v_j$ in $G$ is grouped into $G_k$ in $G_{\text{coar}}$} \\ [2mm] 0 && \text{otherwise} \\ \end{array} \right. \end{displaymath} As a result, the adjacency matrix $A_{\text{coar}}$ of the coarsened graph $G_{\text{coar}}$ is computed by $A_{\text{coar}}=M_{\text{coar}}^TA_{\text{inter}}M_{\text{coar}}$. In fact, $A_{\text{coar}}$ can be written as $A_{\text{coar}}=f\left(M_{\text{coar}}^TA_GM_{\text{coar}}\right)$ as well, where $f(\widetilde{a}_{i,j})=1$ if $\widetilde{a}_{i,j}>0$ and $f(\widetilde{a}_{i,j})=0$ otherwise. As stated previously, $X$ is a $d\text{-dimensional}$ graph signal on $G$. Then, a $d\text{-dimensional}$ graph signal $X_{\text{coar}}$ on $G_{\text{coar}}$ can be computed by $X_{\text{coar}}=M_{\text{coar}}^TX$. EigenPooling \cite{82} employs spectral clustering to obtain the coarsened graph, and then up-sample the Fourier basis of subgraphs $G_k,k=1,\cdots,K$. These Fourier basis are then organized into pooling operators with regard to ascending eigenvalues. Consequently, the pooled node feature matrix is obtained via concatenating the pooled results. The literature \cite{42} proposes a novel Hierarchical Graph Convolutional Network (H-GCN) consisting of graph coarsening layers and graph refining layers. The former employs structural equivalence grouping and structural similarity grouping to construct the coarsened graph, and the latter restores the original topological structure of the corresponding graph. \textbf{Learning a soft cluster assignment.} \textsc{StructPool} \cite{390}, as a structured graph pooling technique, regards the graph pooling as a graph clustering problem so as to learn a cluster assignment matrix via the feature matrix $X$ and adjacency matrix $A_G$. Learning the cluster assignment matrix can formulated as a Conditional Random Field (CRF) \cite{391} based probabilistic inference. Specifically, the input feature matrix $X$ is treated as global observation, and $Y=\left\{Y_1,\cdots,Y_N\right\}$ is a random field where $Y_i\in\{1,\cdots,K\}$ is a random variable indicating which clusters the node $v_i$ is assigned to. As a result, $\left(Y,X\right)$ can be characterized by a CRF model, i.e. \begin{displaymath} \begin{array}{lll} \mathbb{P}(Y|X) & = & \dfrac{1}{Z(X)}\exp\left(-\mathcal{E}(Y|X)\right) \\[2mm] & = & \dfrac{1}{Z(X)}\exp\left(\displaystyle\sum_{C\in\mathcal{C}_G}\psi_C(Y_C|X)\right) \end{array} \end{displaymath} where $\mathcal{E}(Y|X)=-\sum_{C\in\mathcal{C}_G}\psi_C(Y_C|X)$ is called an energy function, $\mathcal{C}_G$ is a set of cliques, $\psi_C(Y_C|X)$ is a potential function and $Z(X)$ is a partition function. The energy function $\mathcal{E}(Y|X)$ can be characterized by an unary energy $\psi_u(\cdot)$ and a pairwise energy $\psi_p(\cdot,\cdot)$, i.e. \begin{displaymath} \mathcal{E}(Y|X)=\sum_{s=1}^N\psi_u(y_s|X)+\sum_{s\neq t}\psi_p(y_s,y_t|X)a_{s,t}^l, \end{displaymath} where $a_{s,t}^l$ denotes the $(s,t)\text{-th}$ entry of the $l\text{-hop}$ adjacency matrix $A_G^l$. The unary energy matrix $\Psi_u=\left(\psi_u(y_s|X)\right)_{N\times K}$ can be obtained by a GCNN taking the global observation $X$ and the adjacency $A_G$ as input. The pairwise energy matrix $\Psi_p=\left(\psi_p(y_s,y_t|X)\right)_{K\times K}$ can be obtained by \begin{displaymath} \psi_p(y_s,y_t|X)=\mu(y_s,y_t)\frac{x_s^Tx_t}{\sum_{j\neq s}x_s^Ts_j}, \end{displaymath} where $\mu(y_s,y_t)$ is a learnable compatibility function. Minimizing the energy function $\mathcal{E}(Y|X)$ via mean-field approximation results in the most probable cluster assignment matrix $M$ for a give graph $G$. As a result, we obtain a new graph $A_{\text{coar}}=f\left(M^TA_GM\right)$ and $X_{\text{coar}}=M^TX$. \textsc{DiffPool} \cite{94} is a differentiable graph pooling operator which can generate hierarchical representations of graphs and can be incorporated into various GCNNs in an end-to-end fashion. It maps an adjacency matrix $A_{G^{(l)}}$ and embedding matrix $Z^{(l)}$ at the $l\text{-th}$ layer to a new adjacency matrix $A_{G^{(l+1)}}$ and a coarsened feature matrix $X^{(l+1)}$, i.e. $\left(A_{G^{(l+1)}},X^{(l+1)}\right)=\text{\textsc{DiffPool}}\left(A_{G^{(l)}},Z^{(l)}\right)$. More specifically, $X^{(l+1)}=\left(M^{(l)}\right)^TZ^{(l)}$, $A_{G^{(l+1)}}=\left(M^{(l)}\right)^TA_{G^{(l)}}M^{(l)}$. Note that the assignment matrix $M^{(l)}$ and embedding matrix $Z^{(l)}$ are respectively computed by two separate GCNNs, namely embedding GCNN and pooling GCNN, i.e. $Z^{(l)}=\text{GCNN}_{\text{embed}}\left(A_{G^{(l)}},X^{(l)}\right)$, $M^{(l)}=\text{Softmax}\left(\text{GCNN}_{\text{pool}}\left(A_{G^{(l)}},X^{(l)}\right)\right)$. \textbf{Selecting the first $k$ top-rank nodes.} The literature \cite{86} proposes a novel Self-Attention Graph Pooling operator (abbreviated as SAGPool). Specifically, SAGPool firstly employs the GCN \cite{6} to calculate the self-attention scores, and then invokes the top-rank function to select the top $\lceil kN\rceil$ node indices, i.e. \begin{displaymath} \begin{array}{lll} Z=\rho\left(\widetilde{D}_G^{-\frac{1}{2}}\widetilde{A}_G\widetilde{D}_G^{-\frac{1}{2}}X\Theta\right), & \text{idx}=\text{top-rank}\left(Z,\lceil kN\rceil\right), & Z_{\text{mask}}=Z_{\text{idx}} \\ X'=X_{\text{idx}}, & X_{\text{out}}=X'\circledast Z_{\text{mask}}, & A_{\text{out}}=A_{\text{idx},\text{idx}}. \end{array} \end{displaymath} As a result, the selected $\text{top-}\lceil kN\rceil$ node indices are employed to extract the output adjacency matrix $A_{\text{out}}$ and feature matrix $X_{\text{out}}$. In order to exploit the expressive power of an encoder-decoder architecture like U-Net \cite{72}, the literature \cite{95} proposes a novel graph pooling (gPool) layer and a graph unpooling (gUnpool) layer. The gPool adaptively selects $\text{top-}k$ ranked node indices by the down-sampling technique to form a coarsened graph ($A_{\text{coar}}\in\mathbb{R}^{N\times N}$ and $X_{\text{coar}}\in\mathbb{R}^{N\times d}$) based on scalar projection values on a learnable projection vector, i.e. \begin{displaymath} \begin{array}{lll} y=\frac{Xp}{\|p\|}, & \text{idx}=\text{top-rank}(y,k), & \widetilde{y}=\tanh(y_{\text{idx}}) \\ \widetilde{X}_{\text{coar}}=X_{\text{idx},:}, & A_{\text{coar}}=A_{\text{idx},\text{idx}}, & X_{\text{coar}}=\widetilde{X}_{\text{coar}}\circledast(\widetilde{y}\mathbf{1}_C^T), \end{array} \end{displaymath} where $y\in\mathbb{R}^{d}$. The gUnpool performs the inverse operation of the gPool layer so as to restore the coarsened graph into its original structure. To this end, gUnpool records the locations of nodes selected in the corresponding gPool layer, and then restores the selected nodes to their original positions in the graph. Specifically, let $X_{\text{refine}}=\text{Distribute}(0_{N\times d},X_{\text{coar}},\text{idx})$, where the function $\text{Distribute}(\cdot,\cdot,\cdot)$ distributes row vectors in $X_{\text{coar}}$ into $0_{N\times d}$ feature matrix according to the indices $\text{idx}$. Note that row vectors of $X_{\text{refine}}$ with indices in $idx$ are updated by the ones in $X_{\text{coar}}$, whereas other row vectors remain zero. It is worth noting that the literature \cite{96} adopts the similar pooling strategy as gPool to learn the hierarchical representations of nodes. \subsection{Graph Attention Mechanisms} Attention mechanisms, firstly introduced in the deep learning community, guide deep learning models to focus on the task-relevant part of its inputs so as to make precise predictions or inferences \cite{73,306,393}. Recently, applying the attention mechanisms to GCNNs has gained considerable attentions so that various attention techniques have been proposed. Below, we summarize the graph attention mechanisms on graphs from the next 4 perspectives \cite{394}, namely softmax-based graph attention, similarity-based graph attention, spectral graph attention and attention-guided walk. Without loss of generality, the neighbors of a given node $v_0$ in $G$ are denoted as $v_1,\cdots,v_{d_0}$, and their current feature vectors are respectively denoted as $x_0,x_1,\cdots,x_{d_0}$, where $d_0=d_{G}(v_0)$. \begin{figure}[htb] \centering \includegraphics[width=0.8\textwidth]{GAT.pdf} \caption{Two kinds of graph attention mechanisms.} \label{GAT} \end{figure} \subsubsection{Concatenation-based Graph Attention.} The softmax-based graph attention is typically implemented by employing a softmax with learnable weights \cite{66,110} to measure the relevance of $v_j,j=1,\cdots,d_G(v_0)$ to $v_0$. More specifically, the softmax-based attention weights between $v_0$ and $v_j$ can be defined as \begin{equation}\label{Softmax-based Attention} \begin{array}{lll} \omega_{0,j} & = & \text{Softmax}\left(\left[e_{0,1},\cdots,e_{0,d_G(v_0)}\right]\right) \\[2mm] & = & \dfrac{\exp\left(\rho\left(a^T(Wx_0\bowtie Wx_j)\right)\right)}{\sum_{k=1}^{d_G(v_0)}\exp\left(\rho\left(a^T(Wx_0\bowtie W_k)\right)\right)}, \end{array} \end{equation} where $e_{0,j}=\exp\left(\rho\left(a^T(Wx_0\bowtie Wx_j)\right)\right)$, $a$ is a learnable attention vector and $W$ is a learnable weight matrix, see Fig. \ref{GAT}(a). As a result, the new feature vector of $v_0$ can be updated by \begin{equation} \label{Single_Graph_Attention} x'_{0}=\rho\left(\sum_{j=1}^{d_G(v_0)}\omega_{0,j}Wx_j\right). \end{equation} In practice, multi-head attention mechanisms are usually employed to stabilize the learning process of the single-head attention \cite{66}. For the multi-head attention, assume that the feature vector of each head is $x_0^{(h)}=\rho\left(\sum_{j=1}^{d_G(v_0)}\omega_{0,j}^{(h)}W^{(h)}x_j\right)$. The concatenation based multi-head attention is computed by $x'_0=\bowtie_{h=1}^H x_0^{(h)}=\bowtie_{h=1}^H \rho\left(\sum_{j=1}^{d_G(v_0)}\omega_{0,j}^{(h)}W^{(h)}x_j\right)$. The average based multi-head attention is computed by $x'_0=\rho\left(\frac{1}{H}\sum_{h=1}^H\sum_{j=1}^{d_G(v_0)}\omega_{0,j}^{(h)}W^{(h)}x_j\right)$. The conventional multi-head attention mechanism treats all the attention heads equally so that feeding the output of an attention that captures a useless representation maybe mislead the final prediction of the model. The literature \cite{74} computes an additional soft gate to assign different weights to heads, and gets the formulation of the gated multi-head attention mechanism. The Graph Transformer (GTR) \cite{110} can capture long-range dependencies of dynamic graphs with softmax-based attention mechanism by propagating features within the same graph structure via an intra-graph message passing. The Graph-BERT \cite{367} is essentially a pre-training method only based on the graph attention mechanism without any graph convolution or aggregation operators. Its key component is called a graph transformer based encoder, i.e. $X^{(l+1)}=\text{Softmax}\left(\frac{QK^T}{\sqrt{d_h}}\right)V$, where $Q=X^{(l)}W_Q^{(l+1)}$, $K=X^{(l)}W_K^{(l+1)}$ and $V=X^{(l)}W_V^{(l+1)}$. The Graph2Seq \cite{106} is a general end-to-end graph-to-sequence neural encoder-decoder model converting an input graph to a sequence of vectors with the attention based LSTM model. It is composed of a graph encoder, a sequence decoder and a node attention mechanism. The sequence decoder takes outputs (node and graph representations) of the graph encoder as input, and employs the softmax-based attention to compute the context vector sequence. \subsubsection{Similarity-based Graph Attention.} The similarity-based graph attention depends on the cosine similarities of the given node $v_0$ and its neighbors $v_j,j=1,\cdots,d_G(v_0)$. More specifically, the similarity-based attention weights are computed by \begin{equation}\label{Similarity-based Attention} \omega_{0,j}=\dfrac{\exp\left(\beta\cdot\cos\left(Wx_0,Wx_j\right)\right)}{\sum_{k=1}^{d_G(v_0)}\exp\left(\beta\cdot\cos\left(Wx_0,Wx_k\right)\right)}, \end{equation} where $\beta$ is learnable bias and $W$ is a learnable weight matrix, see Fig. \ref{GAT}(b). It is well known that $\cos\left(x,y\right)=\frac{\langle x,y\rangle}{\|x\|_2\|y\|_2}$. Attention-based Graph Neural Network (AGNN) \cite{67} adopts the similarity-based attention to construct the propagation matrix $P^{(l)}$ capturing the relevance of $v_j$ to $v_i$. As a result, the output hidden representation $X^{(l+1)}$ at the $(l+1)\text{-th}$ layer is computed by \begin{displaymath} X^{(l+1)}=\rho\left(P^{(l)}X^{(l)}W^{(l)}\right), \end{displaymath} where $P^{(l)}(i,j)\triangleq\omega_{i,j}$ is defined in formula (\ref{Similarity-based Attention}). \subsubsection{Spectral Graph Attention.} The Spectral Graph Attention Networks (SpGAT) aims to learn representations for different frequency components \cite{362}. The eigenvalues of the normalized graph Laplacian $\overline{L}_G$ can be treated as frequencies on the graph $G$. As stated in the Preliminary section, $0=\lambda_1\leq\lambda_2\leq\cdots\leq\lambda_N=\lambda_{\max}$. The SpGAT firstly extracts the low-frequency component $B_L=\left\{u_1,\cdots,u_{n}\right\}$ and the high-frequency component $B_H=\left\{u_{N-n+1},\cdots,u_N\right\}$ from the graph Fourier bases $\left\{u_1,u_2,\cdots,u_N\right\}$. So, we have \begin{equation}\label{Spectral Graph Attention Networks} \begin{array}{l} X_L=X^{(l)}\Theta_L,\quad X_H=X^{(l)}\Theta_H \\ X^{(l+1)}=\rho\left(\text{\textsc{Aggregate}}\left(B_LF_LB_L^TX_L,B_HF_HB_H^TX_H\right)\right), \end{array} \end{equation} where $F_L$ and $F_H$ respectively measure the importance of the low- and high-frequency. In practice, we exploit a re-parameterization trick to accelerate the training. More specifically, we replace $F_L$ and $F_H$ respectively with the learnable attention weights $\Omega_L=\text{diag}\left(\omega_L,\cdots,\omega_L\right)$ and $\Omega_H=\text{diag}\left(\omega_H,\cdots,\omega_H\right)$ so as to reduce the number of learnable parameters. To ensure that $\omega_L$ and $\omega_H$ are positive and comparable, we normalize them by the softmax function, i.e. $\omega_L=\frac{\exp\left(\omega_L\right)}{\exp\left(\omega_L\right)+\exp\left(\omega_H\right)},\quad \omega_H=\frac{\exp\left(\omega_H\right)}{\exp\left(\omega_L\right)+\exp\left(\omega_H\right)}$. In addition to the attention weights, another important issue is how to choose the low- and high-frequency components $B_L$ and $B_H$. A natural choice is to use the graph Fourier bases, yet the literatures \cite{191,194} conclude that utilizing the spectral graph wavelet operators can achieve better embedding results than the graph Fourier bases. Therefore, we substitute $B_L$ and $B_H$ in Eq. (\ref{Spectral Graph Attention Networks}) for the spectral graph wavelet operator $\Psi_{L,g}^s$ and $\Psi_{H,g}^s$, i.e. \begin{displaymath} X^{(l+1)}=\rho\left(\text{\textsc{Aggregate}}\left(\left(\Psi_{L,g}^s\right)F_L\left(\Psi_{L,g}^s\right)^{-1}X_L,\left(\Psi_{H,g}^s\right)F_H\left(\Psi_{H,g}^s\right)^{-1}X_H\right)\right). \end{displaymath} \subsubsection{Attention-guided Walk.} The two aforementioned kinds of attention mechanisms focus on incorporating task-relevant information from the neighbors of a given node into the updated representations of the pivot. Here, we introduce a new attention mechanism, namely attention-guided walk \cite{81}, which has different purpose from the softmax- and similarity-based attention mechanisms. Suppose a walker walks along the edges of the graph $G$ and he currently locates at the node $v_t$. The hidden representation $x^{(t)}$ of $v_t$ is computed by a recurrent neural network $f_x\left(\cdot\right)$ taking the step embedding $s^{(t)}$ and internal representation of the historical information from the previous step $x^{(t-1)}$ as input, i.e. \begin{displaymath} x^{(t)}=f_x\left(s^{(t)},x^{(t-1)};\Theta_x\right). \end{displaymath} The step embedding $s^{(t)}$ is computed by a step network $f_s\left(r^{(t-1)},x_{v_t};\Theta_s\right)$ taking the ranking vector $r^{(t-1)}$ and the input feature vector $x_{v_t}$ of the top-priority node $v_t$ as input, i.e. \begin{displaymath} s^{(t)}=f_s\left(r^{(t-1)},x_{v_t};\Theta_s\right). \end{displaymath} The hidden representation $x^{(t)}$ is then feeded into a ranking network $f_r\left(x^{(t)};\Theta_r\right)$ and a predicting network $f_p\left(x^{(t)};\Theta_p\right)$, i.e. \begin{displaymath} r^{(t)}=f_r\left(x^{(t)};\Theta_r\right), \quad\hat{l}^{(t)}=f_p\left(x^{(t)};\Theta_p\right). \end{displaymath} The ranking network $f_r\left(x^{(t)};\Theta_r\right)$ determines which neighbors of $v_t$ should be prioritized in the next step, and the predicting network $f_p\left(x^{(t)};\Theta_p\right)$ makes a prediction on graph labels. Now, $x^{(t)}$ and $r^{(t)}$ are feeded into the next node to compute its hidden representations. Fig. \ref{attention-guided-walk} shows the computational framework of the attention-guided walk. \begin{figure}[htb] \centering \includegraphics[width=0.8\textwidth]{attention-guided-walk.pdf} \caption{The computational framework of the attention-guided walk.} \label{attention-guided-walk} \end{figure} \subsection{Graph Recurrent Neural Networks} The Graph Recurrent Neural Networks (GRNNs) generalize the Recurrent Neural Networks (RNNs) to process the graph-structured data. In general, the GRNN can be formulated as $h_{v_j}^{(l+1)}=\text{GRNN}\left(x_{v_j}^{(l)},\left\{h_{v_k}^{(l)}:v_k\in N_G(v_j)\cup\left\{v_j\right\}\right\}\right)$. Below, we introduce some available GRNN architectures. \subsubsection{Graph LSTM} The Graph Long Short Term Memroy (Graph LSTM) \cite{117,118,119,120,121,123,143} generalizes the vanilla LSTM for the sequential data to the ones for general graph-structured data. Specifically, the graph LSTM updates the hidden states and cell states of nodes by the following formula, \begin{displaymath} \begin{array}{ll} i_{v_j}^{(l+1)}=\sigma\left(W_ix_{v_j}^{(l)}+\sum_{v_k\in N_G(v_j)\cup\left\{v_j\right\}}U_ih_{v_k}^{(l)}+b_i\right), \\ [2mm] o_{v_j}^{(l+1)}=\sigma\left(W_ox_{v_j}^{(l)}+\sum_{v_k\in N_G(v_j)\cup\left\{v_j\right\}}U_oh_{v_k}^{(l)}+b_o\right) \\ [2mm] \widetilde{c}_{v_j}^{(l+1)}=\tanh\left(W_cx_{v_j}^{(l)}+\sum_{v_k\in N_G(v_j)\cup\left\{v_j\right\}}U_ch_{v_k}^{(l)}+b_c\right), \\ [2mm] f_{v_j,v_k}^{(l+1)}=\sigma\left(W_fx_{v_j}^{(l)}+U_fh_{v_k}^{(l)}+b_f\right) \\ [2mm] c_{v_j}^{(l+1)}=i_{v_j}^{(l+1)}\circledast\widetilde{c}_{v_j}^{(l+1)}+\sum_{v_k\in N_G{v_j}\cup\left\{v_j\right\}}f_{v_j,v_k}^{(l+1)}\circledast c_{v_k}^{(l)}, \\ [2mm] h_{v_j}^{(l+1)}=o_{v_j}^{(l+1)}\circledast\tanh(c_{v_j}^{(l+1)}). \end{array} \end{displaymath} see the Fig. \ref{Graph LSTM}. The literature \cite{267} develops a general framework, named structure-evolving LSTM, for learning interpretable data representations via the graph LSTM. It progressively evolves the multi-level node representations by stochastically merging two adjacent nodes with high compatibilities estimated by the adaptive forget gate of the graph LSTM. As a result, the new graph is produced with a Metropolis-Hastings sampling method. The Gated Graph Sequence Neural Networks (GGS-NNs) \cite{122} employs the Gated Recurrent Unit (GRU) \cite{115} to modify the vanilla GCNNs so that it can be extended to process the sequential data. \begin{figure}[htb] \centering \includegraphics[width=0.8\textwidth]{Graph-lstm.pdf} \caption{Computational framework of the Graph LSTM.} \label{Graph LSTM} \end{figure} \subsubsection{GRNNs for Dynamic Graphs} A dynamic graph is the one whose structure (i.e. adding a node, removing a node, adding an edge, removing an edge) or features on nodes/edges evolve over time. The GRNNs are a straightforward approach to tackling dynamic graphs. Below, we introduce some studies on the GRNNs for dynamic graphs. The literature \cite{107} proposes a Dynamic Graph Neural Network (DGNN) concerning the dynamic graph only with nodes or edges adding. More specifically, the DGNN is composed of two key components: an update component and a propagation component. Suppose an edge $(v_s,v_g,t)$ is added to the input dynamic graph at time $t$. Let $t-$ denotes a time before the time $t$. The update component consists of three sequential units: the interacting unit, the S- or G-update unit and the merging unit. The interacting unit takes the source and target representations before the time $t$ as input, and outputs the joint representation of the interaction, i.e. $x_e^{(t)}=\rho\left(W_sx_s^{(t-)}+W_gx_g^{(t-)}+b_e\right)$. The S- and G-update units employ the LSTM \cite{160} to respectively update the cell states and hidden states of the source and target, i.e. \begin{displaymath} \begin{array}{l} \left(C_{v_s}^{(t)},h_{v_s}^{(t)}\right)=\text{LSTM}_s\left(C_{v_s}^{(t-)},h_{v_s}^{(t-)},\Delta t_s\right),\quad \left(C_{v_g}^{(t)},h_{v_g}^{(t)}\right)=\text{LSTM}_g\left(C_{v_g}^{(t-)},h_{v_g}^{(t-)},\Delta t_g\right). \end{array} \end{displaymath} The merging unit adopts the similar functions to the interacting unit to respectively merge $h_{v_s}^{(t)}$ and $h_{v_s}^{t-}$, and $h_{v_g}^{(t)}$ and $h_{v_g}^{t-}$. The propagation component can propagate information from two interacting nodes ($v_s$ and $v_g$) to influenced nodes (i.e. their neighbors). It also consists of three units: the interacting unit, the propagation unit and the merge unit, which are defined similarly to the update component except that they have different learnable parameters. The literature \cite{105} addresses the vertex- and graph-focused prediction tasks on dynamic graphs with a fixed node set by combining GCNs, LSTMs and fully connected layers. The Variational Graph Recurrent Neural Networks (VGRNNs) \cite{113} is essentially a variational graph auto-encoder whose encoder integrates the GCN and RNN into a graph RNN (GRNN) framework and decoder is a joint probability distribution of a multi-variate Gaussian distribution and Bernoulli Distribution. The semi-implicit variational inference is employed to approximate the posterior so as to generate the node embedding. \subsubsection{GRNNs based on Vanilla RNNs} The GRNNs based on vanilla RNNs firstly employ random walk techniques or traversal methods, e.g. Breadth-First Search (BFS) and Depth-First Search (DFS), to obtain a collection of node sequences, and then leverage a RNN, e.g. LSTM and GRU, to capture long short-term dependencies. The literature \cite{116} performs joint random walks on attributed networks, and utilizes them to boost the deep node representation learning. The proposed GraphRNA in \cite{116} consists of two key components, namely a collaborative walking mechanism AttriWalk and a tailored deep embedding architecture for joint random walks GRN. Suppose $\mathcal{A}_G$ denotes the node-attribute matrix of size $N\times M$. The AtriWalk admits the transition matrix of size $\mathbb{R}_+^{(N+M)\times(N+M)}$ which is written as \begin{displaymath} \mathcal{T}= \left[ \begin{array}{cc} \alpha A_G & (1-\alpha)\mathcal{A}_G \\ (1-\alpha)\mathcal{A}_G^T & 0 \end{array} \right]. \end{displaymath} After obtaining the sequences via the collaborative random walk, the bi-directional GRU \cite{115} and pooling operator are employed to learn the global representations of sequences. The literature \cite{111} leverages the BFS node ordering and truncation strategy to obtain a collection of node representation sequences, and then uses the GRU model and variational auto-regression regularization to perform the graph classification. \section{Extensions and Applications} The aforementioned architectures essentially provide ingredients of constructing the GNNs for us. Below, we investigate the extensions of the GNNs from the next 8 aspects: GCNNs on spectral graphs, capability and interpretability, deep graph representation learning, deep graph generative models, combinations of the PI and GNNs, adversarial attacks for the GNNs, graph neural architecture search and graph reinforcement learning, and briefly summarize the applications of the GNNs at last. \subsection{GCNNs on Special Graphs} The vanilla GCNNs aims at learning the representations of input graphs (directed or undirected, weighted or unweighted). The real-world graphs may have more additional characteristics, e.g. spatial-temporal graphs, heterogeneous graphs, hyper-graphs, signed graphs and so all. The GCNN for signed graphs \cite{28} leverage the balance theory to aggregate and propagate information through positive and negative links. \subsubsection{Heterogeneous Graphs.} Heterogeneous Graphs are composed of nodes and edges of different types, and each type of edges is called a relation between two types of nodes. For example, a bibliographic information network contains at least 4 types of nodes, namely Author, Paper, Venue and Term, and at least 3 types of edges, namely Author-Paper, Term-Paper and Venue-Paper \cite{395}. The heterogeneity and rich semantic information brings great challenges for designing heterogeneous graph convolutional neural networks. In general, a heterogeneous graph can be denoted as $H=(V,E,\nu,\zeta)$, where $\nu(v)$ denotes the type of node $v\in V$ and $\zeta(e)$ denotes the type of edge $e\in E$. Let $\mathcal{T}^v$ and $\mathcal{T}^e$ respectively denote the set of node types and edge types. Below, we summarize the vanilla heterogeneous GCNNs, namely HetGNNs \cite{61}. \textbf{Vanilla Heterogeneous GCNNs.} The Heterogeneous Graph Neural Networks (HetGNNs) \cite{61} aims to resolve the issue of jointly considering heterogeneous structural information as well as heterogeneous content information of nodes. It firstly samples a fixed size of strongly correlated heterogeneous neighbors for each node via a Random Walk with Restart (RWR) and groups them into different node types. Then, it aggregates feature information of those sampled neighboring nodes via a bi-directional Long Short Term Memory (LSTM) and attention mechanism. Running RWR with a restart probability $p$ from node $v$ will yield a collection of a fixed number of nodes, denoted as $\text{RWR}(v)$. For each node type $t$, the $t\text{-type}$ neighbors $N_G^t(v)$ of node $v$ denotes the set of $\text{top-}k_t$ nodes from $\text{RWR}(v)$ with regard to frequency. Let $\mathcal{C}_v$ denote the heterogeneous contents of node $v$, which can be encoded as a fixed size embedding via a function $f_1(v)$, i.e. \begin{displaymath} f_1(v)=\dfrac{\sum_{j\in\mathcal{C}_v}\left[\overrightarrow{\text{LSTM}}\left(\mathcal{FC}_{\theta_x}(x_j)\right)\bowtie\overleftarrow{\text{LSTM}}\left(\mathcal{FC}_{\theta_x}(x_j)\right)\right]}{|\mathcal{C}_v|}, \end{displaymath} where $\mathcal{FC}_{\theta_x}(\cdot)$ denotes feature transformer, e.g. identity or fully connected neural networks with parameter $\theta_x$, and $\overrightarrow{\text{LSTM}}\left(\cdot\right)$ and $\overleftarrow{\text{LSTM}}\left(.\right)$ is defined by the Eq. (\ref{LSTM Formulation}). The content embedding of the $t\text{-type}$ neighbors of node $v$ can be aggregated as follows, \begin{displaymath} \begin{array}{lcl} f_2^t(v) & = & \text{\textsc{Aggregate}}^T\left(\left\{f_1(v'):v'\in N_G^t(v)\right\}\right) \\[2mm] & = & \dfrac{\sum_{v'\in N_G^t(v)}\left[\overrightarrow{\text{LSTM}}(f_1(v'))\bowtie\overleftarrow{\text{LSTM}}(f_1(v'))\right]}{|N_G^t(v)|}. \end{array} \end{displaymath} Let $\mathcal{F}(v)=\{f_1(v)\}\cup\{f_2^t(v):t\in\mathcal{T}^v\}$. As a result, the output embedding of node $v$ can be obtained via the attention mechanism, i.e. $\mathcal{E}_v=\sum_{f_j(v)\in\mathcal{F}(v)}\omega_{v,j}f_j(v)$, where the attention weights is computed by $\omega_{v,j}=\dfrac{\exp\left(\rho\left(u^t\left[f_j(v)\bowtie f_1(v)\right]\right)\right)}{\sum_{f_j(v)\in\mathcal{F}(v)}\exp\left(\rho\left(u^t\left[f_j(v)\bowtie f_1(v)\right]\right)\right)}$. In addition, the GraphInception \cite{397} can be employed to learn the hierarchical relational features on heterogeneous graphs by converting the input graph into a multi-channel graph (each meta path as a channel) \cite{62}. \textbf{Heterogeneous Graph Attention Mechanism.} The literature \cite{75} firstly proposes a hierarchical attention based heterogeneous GCNNs consisting of node-level and semantic-level attentions. The node-level attention aims to learn the attention weights of a node and its meta-path-based neighbors, and the semantic-level attention aims to learn the importance of different meta-paths. More specifically, given a meta path $\Phi$, the node-level attention weight of a node $v_i$ and its meta-path-based neighbors $v_j\in N_G^{\Phi}(v_i)$ is defined to be \begin{displaymath} \omega_{j,k}^{\Phi}=\dfrac{\exp\left(\rho\left(a_{\Phi}^T(M_{\nu(v_j)}x_j\bowtie M_{\nu(v_k)}x_k)\right)\right)}{\sum_{v_k\in N_G^{\Phi}(v_j)}\exp\left(\rho\left(a_{\Phi}^T(M_{\nu(v_j)}x_j\bowtie M_{\nu(v_k)}x_k)\right)\right)}, \end{displaymath} where $M_{\nu(v_j)}$ transforms the feature vectors of nodes of type $\nu(v_j)$ in different vector spaces into a unified vector space. The embedding of node $v_i$ under the meta path $\Phi$ can be computed by \begin{displaymath} x_j^{\Phi,l+1}=\bowtie_{k=1}^K\rho\left(\sum_{k\in N_G^{\Phi}(v_j)}\omega_{j,k}^{\Phi}M_{\nu(v_k)}x_k^{\Phi,l}\right). \end{displaymath} Given a meta-path set $\left\{\Phi_0,\cdots,\Phi_P\right\}$, performing the node-level attention layers under each meta path will yield a set of semantic-specific node representations, namely $\left\{X^{\Phi_0},\cdots,X^{\Phi_P}\right\}$. The semantic-level attention weight of the meta path $\Phi_j$ is defined as \begin{displaymath} \beta^{\Phi_j}=\dfrac{\exp\left(\omega^{\Phi_j}\right)}{\sum_{p=1}^P\exp\left(\omega^{\Phi_p}\right)}, \end{displaymath} where $\omega^{\Phi_p}=\frac{1}{|V|}\sum_{v_k\in V}q^T\tanh\left(Wx_k^{\Phi_p}+b\right)$. As a result, the embedding matrix $X=\sum_{p=1}^P\beta^{\Phi_p}X^{\Phi_p}$. In addition, there are some available studies on the GCNNs for multi-relational graphs \cite{36,68,361} and the transformer for dynamic heterogeneous graphs \cite{60,114}. \subsubsection{Spatio-Temporal Graphs.} Spatio-temporal graphs can be used to model traffic networks \cite{59,71} and skeleton networks \cite{55,57}. In general, a spatio-temporal graph is denoted as $G_{ST}=(V_{ST},E_{ST})$ where $V_{ST}=\{v_{t,j}:t=1,\cdots,T,j=1,\cdots,N_{ST}\}$. The edge set $E_{ST}$ is composed of two types of edges, namely spatial edges and temporal edges. All spatial edges $(v_{t,j},v_{t,k})\in E_{ST}$ are collected in the intra-frame edge set $E_S$, and all temporal edges $(v_{t,j},v_{t+1,j})\in E_{ST}$ are collected in the inter-frame edge set $E_T$. The literature \cite{59} proposes a novel deep learning framework, namely Spatio-Temporal Graph Convolutional Networks (STGCN), to tackle the traffic forecasting problem. Specifically, STGCN consists of several layers of spatio-temporal convolutional blocks, each of which has a "sandwich" structure with two temporal gated convolution layers (abbreviated as Temporal Gated-Conv) and a spatial graph convolution layer in between (abbreviated as Spatial Graph-Conv). The Spatial Graph-Conv exploits the conventional GCNNs to extract the spatial features, whereas the Temporal Gated-Conv the temporal gated convolution operator to extract temporal features. Suppose that the input of the temporal gated convolution for each node is a $\text{length-}M$ sequence with $C_{\text{in}}$ channels, i.e. $X\in\mathbb{R}^{M\times C_{\text{in}}}$. The temporal gated convolution kernel $\Gamma\in\mathbb{R}^{K\times C_{\text{in}}\times 2C_{\text{out}}}$ is used to filter the input $Y$, i.e. \begin{displaymath} \Gamma\ast_T Y=P\circledast\sigma(Q)\in\mathbb{R}^{(M-K+1)\times C_{\text{out}}}, \end{displaymath} to yield an output $P\bowtie Q\in\mathbb{R}^{(M-K+1)\times(2C_{\text{out}})}$. The Spatial Graph-Conv takes a tensor $\underline{X}^{(l)}\in\mathbb{R}^{M\times N_{ST}\times C^{(l)}}$ as input, and outputs a tensor $\underline{X}^{(l+1)}\in\mathbb{R}^{(M-2(K-1))\times N_{ST}\times C^{(l+1)}}$, i.e. \begin{displaymath} \underline{X}^{(l+1)}=\Gamma_1^{(l)}\ast_T\rho\left(\Theta^{(l)}\ast_G\left(\Gamma_0^{(l)}\ast_T X^{(l)}\right)\right), \end{displaymath} where $\Gamma_{0}^{(l)},\Gamma_1^{(l)}$ are the upper and lower temporal kernel and $\Theta^{(l)}$ is the spectral kernel of the graph convolution. In addition, some other studies pay attention to the GCNNs on the spatio-temporal graphs from other perspectives, e.g. Structural-RNN \cite{56} via a factor graph representation of the spatio-temporal graph and GCRNN \cite{108,109} combining the vanilla GCNN and RNN. \subsubsection{Hypergraphs.} The aforementioned GCNN architectures are concerned with the conventional graphs consisting of pairwise connectivity between two nodes. However, there could be even more complicated connections between nodes beyond the pairwise connectivity, e.g. co-authorship networks. Under such circumstances, a hypergraph, as a generalization to the convectional graph, provides a flexible and elegant modeling tools to represent these complicated connections between nodes. A hypergraph is usually denoted as $\mathcal{G}=(\mathcal{V},\mathcal{E},\omega)$, where $\mathcal{V}=\{v_1,\cdots,v_N\}$ like the conventional graph, $\mathcal{E}=\{e_1,\cdots,e_M\}$ is a set of $M$ hyperedges. $\omega(e_k)$ denote weights of hyperedges $e_k\in\mathcal{E}$. A non-trivial hyperedge is a subset of $\mathcal{V}$ with at least 2 nodes. In particular, a trivial hyperedge, called a self-loop, is composed of a single node. The hypergraph $\mathcal{G}$ can also be denoted by an incidence matrix $\mathcal{H}_{\mathcal{G}}\in\mathbb{R}^{N\times M}$, i.e. \begin{displaymath} \mathcal{H}_{\mathcal{G}}[j,k]= \left\{ \begin{array}{ll} 0, & v_j\notin e_k \\ 1, & v_j\in e_k. \end{array} \right. \end{displaymath} For a node $v_j\in\mathcal{V}$, its degree $\text{deg}_{\mathcal{V}}(v_j)=\sum_{e_k\in\mathcal{E}}\omega(e_k)\mathcal{H}_{\mathcal{G}}[j,k]$. For a hyperedge $e_k\in\mathcal{E}$, its degree $\text{deg}_{\mathcal{E}}(e_k)=\sum_{v_j\in e_k}\mathcal{H}_{\mathcal{G}}[j,k]$. Let $\mathcal{D}_{\mathcal{V}}=\text{diag}\left(\text{deg}_{\mathcal{V}}(v_1),\cdots,\text{deg}_{\mathcal{V}}(v_N)\right)$, $\mathcal{D}_{\mathcal{E}}=\text{diag}\left(\text{deg}_{\mathcal{E}}(e_1),\cdots,\text{deg}_{\mathcal{E}}(e_M)\right)$, and $\mathcal{W}_{\mathcal{G}}=\text{diag}\left(\omega(e_1),\cdots,\omega(e_M)\right)$. The hypergraph Laplacian \cite{65} $\mathcal{L}_{\mathcal{G}}$ of $\mathcal{G}$ is defined to be \begin{displaymath} \mathcal{L}_{\mathcal{G}}=\mathcal{I}_N-\mathcal{D}_{\mathcal{V}}^{-\frac{1}{2}}\mathcal{H}_{\mathcal{G}}\mathcal{W}_{\mathcal{G}}\mathcal{D}_{\mathcal{E}}^{-1}\mathcal{H}_{\mathcal{G}}^T\mathcal{D}_{\mathcal{V}}^{-\frac{1}{2}}. \end{displaymath} It can also be factorized by the eigendecomposition, i.e. $\mathcal{L}_{\mathcal{G}}=\mathcal{U}\Lambda\mathcal{U}^T$. The spectral hypergraph convolution operator, the Chebyshev hypergraph convolutional neural network and the hypergraph convolutional network can be defined in analogy to the Eqs (\ref{Spectral Graph Convolution},\ref{Chebyshev Spectral Filter},\ref{GCN-Layer}). The HyperGraph Neural Network (HGNN) architecture proposed in the literature \cite{65} is composed of multiple layers of the hyperedge convolution, and each layer is defined as \begin{displaymath} X^{(l+1)}=\rho\left(\mathcal{D}_{\mathcal{V}}^{-\frac{1}{2}}\mathcal{H}_{\mathcal{G}}\mathcal{W}_{\mathcal{G}}\mathcal{D}_{\mathcal{E}}^{-1}\mathcal{H}_{\mathcal{G}}^T\mathcal{D}_{\mathcal{V}}^{-\frac{1}{2}}X^{(l)}\Theta^{(l)}\right). \end{displaymath} In essence, the HGNN essentially views each hyperedge as a complete graph so that the hypergraph is converted into a conventional graph. Treating each hyperedge as a complete graph obviously incurs expensive computational cost. Hence, some studies \cite{63,64} propose various approaches to approximate the hyperedges. The HNHN \cite{174} interleaves updating the node representations with the hyperedge representations by the following formulas, \begin{displaymath} \mathcal{X}_{\mathcal{V}}^{(l+1)}=\rho\left(\mathcal{D}_{\mathcal{V}}^{-1}\mathcal{H}_{\mathcal{G}}\mathcal{X}_{\mathcal{E}}^{(l)}\Theta_{\mathcal{V}}^{(l)}\right),\quad \mathcal{X}_{\mathcal{E}}^{(l+1)}=\rho\left(\mathcal{D}_{\mathcal{E}}^{-1}\mathcal{H}_{\mathcal{G}}^{T}\mathcal{X}_{\mathcal{V}}^{(l)}\Theta_{\mathcal{E}}^{(l)}\right). \end{displaymath} \subsection{Capability and Interpretability} The GCNNs have achieved tremendous empirical successes over the supervised, semi-supervised and unsupervised learning on graphs. Recently, many studies start to put their eyes on the capability and interpretability of the GCNNs. \subsubsection{Capability} The capability of the GCNNs refers to their expressive power. If two graphs are isomorphic, they will obviously output the same representations of nodes/edges/graph. Otherwise, they should output different representations. However, two non-isomorphic graphs maybe output the same representations in practice. This is the theoretical limitations of the GCNNs. As described in the literatures \cite{83,88,360}, The $1\text{-hop}$ spatial GCNNs (1-GCNNs) have the same expressive power as the $1\text{-dimensional}$ Weisfeiler-Leman (1-WL) graph isomorphism test in terms of distinguishing non-isomorphic graphs. The 1-WL iteratively update the colors of nodes according to the following formula \begin{displaymath} C_{l}^{(l+1)}(v)=\text{\textsc{Hash}}\left(C_{l}^{(l)}(v),\left\{\hspace{-1.5mm}\left\{C_{l}^{(l)}(u):u\in N_G(v)\right\}\hspace{-1.5mm}\right\}\right). \end{displaymath} According to the literatures \cite{83,88}, we have that the 1-GCNN architectures do not have more power in terms of distinguishing two non-isomorphic graphs than the 1-WL heuristic. Nevertheless, they have equivalent power if the aggregation and update functions are injective. In order to overcome the theoretical limitations of the GCNNs, the literature \cite{83} proposes a Graph Isomorphism Network (GIN) architecture, i.e. \begin{displaymath} \begin{array}{rl} A_v^{(l+1)}& =\text{\textsc{Aggregate}}^{(l+1)}\left(\left\{\left\{X^{(l)}[u,:]:u\in N_G(v)\right\}\right\}\right) \\[2mm] & \triangleq\sum_{u\in N_G(v)}X^{(l)}[u,:] \\[2mm] X^{(l+1)}[v,:] & =\text{\textsc{Update}}^{(l+1)}\left(X^{(l)}[v,:],A_v^{(l+1)}\right) \\ [2mm] & \triangleq\text{MLP}\left((1+\epsilon^{(l+1)})X^{(l)}[v,:]+A_v^{(l+1)}\right), \end{array} \end{displaymath} where $\epsilon^{(l)}$ is a scalar parameter. The literature \cite{163} studies the expressive power of the spatial GCNNs, and presents two results: (1) The spatial GCNNs are shown to be a universal approximator under sufficient conditions on their depth, width, initial node features and layer expressiveness; (2) The power of the spatial GCNNs is limited when their depth and width is restricted. In addition, there are some other studies on the capability of the GCNNs from different perspectives, e.g. the first order logic \cite{164}, $p\text{-order}$ graph moments \cite{167}, algorithmic alignment with the dynamic programming \cite{401}, generalization and representational limits of the GNNs \cite{407}. \subsubsection{Interpretability} Interpretability plays a vital role in constructing a reliable and intelligent learning systems. Although some studies have started to explore the interpretability of the conventional deep learning models, few of studies put their eyes on the interpretability of the GNs \cite{85}. The literature \cite{165} bridges the gap between the empirical success of the GNs and lack of theoretical interpretations. More specifically, it considers two classes of techniques: (1) gradient based explanations, e.g. sensitivity analysis and guided back-propagation; (2) decomposition based explanations, e.g. layer-wise relevance propagation and Taylor decomposition. The GNNExplainer \cite{166} is a general and model-agnostic approach for providing interpretable explanations for any spatial GCNN based model in terms of graph machine learning tasks. Given a trained spatial GCNN model $\Phi$ and a set of predictions, the GNNExplainer will generate a single-instance explanation by identifying a subgraph of the computation graph and a subset of initial node features, which are the most vital for the prediction of the model $\Phi$. In general, the GNNExplainer can be formulated as an optimization problem \begin{equation}\label{GNNExplainer optimization framework} \max_{G_S,X_S^F} I\left(Y,(G_S,X_S^F)\right)=H\left(Y\right)-H\left(Y|G=G_S,X=X_S^F\right), \end{equation} where $I(\cdot,\cdot)$ denotes the mutual information of two random variables, $G_S$ is a small subgraph of the computation graph and $X_S^F$ is a small subset of node features $\left\{X^F[j,:]:v_j\in G_S\right\}$. The entropy term $H(Y)$ is constant because the spatial GCNN model $\Phi$ is fixed. In order to improve the tractability and computational efficiency of the GNNExplainer, the final optimization framework is reformulated as \begin{displaymath} \min_{M,F} -\sum_{c=1}^C\mathbb{I}[y=c]\log P_{\Phi}\left(Y=y|G=A_G\circledast\sigma(M),X=X_S^F\right). \end{displaymath} In addition, the GNNExplainer also provides multi-instances explanations based on graph alignments and prototypes so as to answer questions like "How did a GCNN predict that a given set of nodes all have label $c$?". \subsection{Deep Graph Representation Learning} Graph representation learning (or called network embedding) is a paradigm of unsupervised learning on graphs. It gains a large amount of popularity since the DeepWalk \cite{154}. Subsequently, many studies exploit deep learning techniques to learn low-dimensional representations of nodes \cite{139}. In general, the network embedding via the vanilla deep learning techniques learn low-dimensional feature vectors of nodes by utilizing either stacked auto-encoders to reconstruct the adjacent or positive point-wise mutual information features \cite{124,132,133,136,141,142} or RNNs to capture long and short-term dependencies of node sequences yielded by random walks \cite{134,135}. In the following, we introduce the network embedding approaches based on GNNs. \subsubsection{Network Embedding based on GNNs} In essence, the GNNs provides an elegant and powerful framework for learning node/edge/graph representations. The majority of the GCNNs and GRNNs are concerned with semi-supervised learning (i.e. node-focused tasks) or supervised learning (i.e. graph-focused) tasks. Here, we review the GNN based unsupervised learning on graphs. In general, the network embedding based on GNNs firstly utilize the GCNNs and variational auto-encoder to generate gaussian-distributed hidden states of nodes, and then reconstruct the adjacency matrix and/or the feature matrix of the input graph \cite{87,127,129,131,138,148}. A representative approach among these ones is the Variational Graph Auto-Encoder (VGAE) \cite{87} consisting of a GCN based encoder and an inner product decoder. The GCN based encoder is defined to be \begin{displaymath} q(Z|X,A_G)=\prod_{j=1}^Nq(Z[j,:]|X,A_G)=\prod_{j=1}^N\mathcal{N}\left(Z[j,:]|\mu_j,\text{diag}(\sigma_j^2)\right), \end{displaymath} where $\mu_j=\text{GCN}_{\mu}\left(X,A_G\right)$ and $\log\sigma_j=\text{GCN}_{\sigma}(X,A_G)$. The inner product decoder is defined to be \begin{displaymath} p(A_G|Z)=\prod_{j=1}^N\prod_{k=1}^Np\left(A_G[j,k]|Z[j,:],Z[k,:]\right)=\prod_{j=1}^N\prod_{k=1}^N\sigma\left(Z[j,:]Z[k,:]^T\right). \end{displaymath} They adopt the evidence lower bound \cite{151} as their objective function. The adversarially regularized (variational) graph autoencoder \cite{129} extends the VGAE by adding an adversarial regularization term to the evidence lower bound. The literature \cite{128} proposes a symmetric graph convolutional autoencoder which produces a low-dimensional latent nodes representations. Its encoder employs the Laplacian smoothing \cite{16} to jointly encode the structural and attributed information, and its decoder is designed based on Laplacian sharpening as the counterpart of the Laplacian smoothing of the encoder. The Laplacian sharpening is defined to be $X^{(l+1)}=(1+\gamma)X^{(l)}-\gamma D^{-1}AX^{(l)}=X^{(l)}+\gamma(\mathbb{I}_N-D^{-1}A)X^{(l)}$, which allows utilizing the graph structure in the whole processes of the proposed autoencoder architecture. In addition, there are some other methods to perform the unsupervised learning on graphs, which do not rely on the reconstruction of the adjacency and/or feature matrix, e.g. the graph auto-encoder on directed acyclic graphs \cite{79}, pre-training GNNs via context prediction and attribute masking strategies \cite{130}, and deep graph Infomax using a noise-contrastive type objective with a standard binary cross-entropy loss between positive examples and negative examples \cite{140}. \subsection{Deep Graph Generative Models} The aforementioned work concentrates on embedding an input graph into a low-dimensional vector space so as to perform semi-supervised/supervised/unsupervised learning tasks on graphs. This subsection introduces deep graph generative models aiming to mimic real-world complex graphs. Generating complex graphs from latent representations is confronted with great challenges due to high nonlinearity and arbitrary connectivity of graphs. Note that graph translation \cite{145} is akin to graph generation. However, their difference lies in that the former takes two graphs, i.e. input graph and target graph, as input, and the latter only takes a single graph as input. The NetGAN \cite{154} utilizes the generative adversarial network \cite{149} to mimic the input real-world graphs. More specifically, it is composed of two components, i.e. a generator $G$ and a discriminator $D$, as well. The discriminator $D$ is modeled as a LSTM in order to distinguish real node sequences, which are yielded by the second-order random walks scheme node2vec \cite{155}, from faked ones. The generator $G$ aims to generate faked node sequences via another LSTM, whose generating process is as follows. \begin{displaymath} \begin{array}{l} v_0=0, \quad z\sim N_m(0,\mathbb{I}_m), \quad (C_0,h_0)=g_{\theta'}(z), \\ [2mm] (C_j,h_j,o_j)=\text{LSTM}_G(C_{j-1},h_{j-1},v_{j-1}),\quad v_j\sim\text{Cat}\left(\text{Softmax}(o_j)\right). \end{array} \end{displaymath} The motif-targeted GAN \cite{147} generalizes random walk based architecture of the NetGAN to characterize mesoscopic context of nodes. Different from \cite{147,154}, the GraphVAE \cite{146} adopts a probabilistic graph decoder to generate a probabilistic fully-connected graph, and then employs approximate graph matching to reconstruct the input graph. Its reconstruction loss is the cross entropy between the input and reconstructed graphs. The literature \cite{150} defines a sequential decision-making process to add a node/edge via the graph network \cite{85}, readout operator and softmax function. The GraphRNN \cite{152} is a deep autoregressive model, which generates graphs by training on a representative set of graphs and decomposes the graph generation process into a sequence of node and edge formations conditioned on the current generated graph. \subsection{Combinations of the PI and GNNs} The GNNs and PI are two different learning paradigms for complicated real-world data. The former specializes in learning hierarchical representations based on local and global structural information, and the latter learning the dependencies between random variables. This subsection provides a summarization of studies of combining these two paradigms. \subsubsection{Conditional Random Field Layer Preserving Similarities between Nodes} The literature \cite{162} proposes a CRF layer for the GCNNs to enforce hidden layers to preserve similarities between nodes. Specifically, the input $X^{(l)}$ to $(l+1)\text{-th}$ layer is a random vector around the output $B^{(l)}=\text{GCNN}(X^{(l-1)},A_G, X)$ of the $(l-1)\text{-th}$ layer. The objective function for the GCNN with a CRF layer can be reformulated as \begin{displaymath} \begin{array}{l} J\left(W;X,A_G,Y\right) =\mathcal{L}\left(Y;B^{(L)}\right)+\displaystyle\sum_{l=1}^{L-1}\left(\frac{\gamma}{2}\|X^{(l)}-B^{(l)}\|_F^2+\mathcal{R}(X^{(l)})\right), \end{array} \end{displaymath} where the first term after "=" is the conventional loss function for semi-supervised node classification problem, and the last term is a regularization one implementing similarity constraint. The similarity constraint $\mathcal{R}(X^{(l)})$ is modeled as a CRF, i.e. $p\left(X^{(l)}|B^{(l)}\right)=\frac{1}{Z(B^{(l)})}\exp\left(-E\left(X^{(l)}|B^{(l)}\right)\right)$ where the energy function $E\left(X^{(l)}|B^{(l)}\right)$ is formulated as \begin{displaymath} \begin{array}{ll} & E\left(X^{(l)}|B^{(l)}\right) \\ = & \displaystyle\sum_{v\in V}\varphi_v(X^{(l)}[v,:],B^{(l)}[v,:])+\displaystyle\sum_{(u,v)\in E}\varphi_{u,v}\left(X^{(l)}[u,:],X^{(l)}[v,:],B^{(l)}[u,:],B^{(l)}[v,:]\right). \end{array} \end{displaymath} Let $s_{u,v}$ denote the similarity between $u$ and $v$. The unary energy component $\varphi_v\left(\cdot,\cdot\right)$ and pairwise energy component $\varphi_{u,v}\left(\cdot,\cdot,\cdot,\cdot\right)$ for implementing the similarity constraint are respectively formulated as \begin{displaymath} \begin{array}{l} \varphi_v\left(X^{(l)}[v,:],B^{(l)}[v,:]\right)=\|X^{(l)}[v,:]-B^{(l)}[v,:]\|_2^2, \\[1.5mm] \varphi_{u,v}\left(X^{(l)}[u,:],X^{(l)}[v,:],B^{(l)}[u,:],B^{(l)}[v,:]\right)=s_{u,v}\|X^{(l)}[u,:]-X^{(l)}[v,:]\|_2^2. \end{array} \end{displaymath} The mean-field variational Bayesian inference is employed to approximate the posterior $p(B^{(l)}|X^{(l)})$. Consequently, the CRF layer is defined as \begin{displaymath} \left(X^{(l)}[v,:]\right)^{(k+1)}=\frac{\alpha B^{(l)}[v,:]+\beta\sum_{u\in N_G(v)}s_{u,v}\left(X^{(l)}[u,:]\right)^{(k)}}{\alpha+\beta\sum_{u\in N_G(v)}s_{u,v}}. \end{displaymath} \subsubsection{Conditional GCNNs for Semi-supervised Node Classification} The conditional GCNNs incorporate the Conditional Random Field (CRF) into the conventional GCNNs so that the semi-supervised node classification can be enhanced by both the powerful node representations and the dependencies of node labels. The GMNN \cite{80} performs the semi-supervised node classification by incorporating the GCNN into the Statistical Relational Learning (SRL). Specifically, the SRL usually models the conditional probability $p(Y_V|X_V)$ with the CRF, i.e. $p(Y_V|X_V)=\frac{1}{Z(X_V)}\prod_{(i,j)\in E}\varphi_{i,j}\left(y_i,y_j,X_V\right)$, where $y_*=Y_V[*,:], *=i,j$. Note that $Y_V$ is composed of the observed node labels $Y_L$ and hidden node labels $Y_U$. The variational Bayesian inference is employed to estimate the posterior $p(Y_U|Y_L,X_V)$. The objective function is defined as \begin{displaymath} \text{ELBO}\left(q_{\theta_v}(Y_U|X_V)\right)=\mathbb{E}_{q_{\theta_v}(Y_U|X_V)}\left[\log\left(p_{\theta_l}(Y_L,Y_U|X_V)\right)-\log\left(q_{\theta_v}(Y_U|X_V)\right)\right]. \end{displaymath} This objective can be optimized by the variational Bayesian EM algorithm \cite{161}, which iteratively updates the variational distribution $q_{\theta_v}(Y_U|X_V)$ and the likelihood $p_{\theta_l}(Y_U|Y_L,X_V)$. In the VBE stage, $q_{\theta_v}(Y_U|X_V)=\prod_{v\in U}q_{\theta_v}(y_v|X_V)$, and $q_{\theta_v}(y_v|X_V)$ is approximated by a GCNN. In the VBM stage, the pseudo-likelihood is employed to approximate \begin{displaymath} \mathbb{E}_{q_{\theta_v}(Y_U|X_V)}\left[\sum_{v\in V}\log p_{\theta_l}\left(y_n|Y_{V\backslash v},X_V\right)\right] =\mathbb{E}_{q_{\theta_v}(Y_U|X_V)}\left[\sum_{v\in V}\log p_{\theta_l}\left(y_n|Y_{N_G(v)},X_V\right)\right], \end{displaymath} and $p_{\theta_l}\left(y_n|Y_{N_G(v)},X_V\right)$ is approximated by another GCNN. The literature \cite{159} adopts the similar idea to the GMNN. Its posterior is modeled as a CRF with unary energy components and pairwise energy components whose condition is the outputs of the prescribed GCNN. The maximum likelihood estimation employed to estimate the model parameters. \subsubsection{GCNN-based Gaussian Process Inference} A Gaussian Process (GP) defines a distribution over a function space and assumes any finite collection of marginal distributions follows a multivariate Gaussian distribution. A function $f:\mathbb{R}^d\rightarrow\mathbb{R}$ follows a Gaussian Process $\text{GP}(m(\cdot),\kappa(\cdot,\cdot))$ iff $\left(f(X_1),\cdots,f(X_N)\right)^T$ for any $N$ $d\text{-dimensional}$ random vectors. follows a $N\text{-dimensional}$ Gaussian distribution $\mathcal{N}_N\left(\mu,\Sigma\right)$, where $\mu=\left(m(X_1),\cdots,m(X_N)\right)^T$ and $\Sigma=\left[\kappa(X_j,X_k)\right]_{N\times N}$, For two $d\text{-dimensional}$ random vectors $X$ and $X'$, we have $\mathbb{E}\left[f(X)\right]=m(X)$ and $\text{Cov}(f(X),f(X'))=\kappa(X,X')$. Given a collection of $N$ samples $\mathcal{D}=\left\{(X_j,y_j):j=1,\cdots N\right\}$, the GP inference aims to calculate the probability $p(y|X)$ for predictions, i.e. \begin{displaymath} f\sim\text{GP}(0(\cdot),\kappa(\cdot,\cdot)), y_j\sim\text{DIST}(\lambda(f(X_j))), \end{displaymath} where $\lambda(\cdot)$ is a link function and $\text{DIST}(\cdot)$ denotes an arbitrary feasible noise distribution. To this end, the posterior $p(f|\mathcal{D})$ needs to be calculated out firstly. The literature \cite{156} employs amortized variational Bayesian inference to approximate $p(f|\mathcal{D})$, i.e. $f=\mu+L\epsilon$, and the GCNNs to estimate $\mu$ and $L$. \subsubsection{Other GCNN-based Probabilistic Inference} The literature \cite{157} combines the GCNNs and variational Bayesian inference to infer the input graph structure. The literature \cite{158} infers marginal probabilities in probabilistic graphical models by incorporating the GCNNs to the conventional message-passing inference algorithm. The literature \cite{168} approximates the posterior in Markov logic networks with the GCNN-enhanced variational Bayesian inference. \subsection{Adversarial Attacks for the GNNs} In many circumstances where classifiers are deployed, adversaries deliberately contaminate data in order to fake the classifiers \cite{149,364}. This is the so-called adversarial attacks for the classification problems. As stated previously, the GNNs can solve semi-supervised node classification problems and supervised graph classification tasks. Therefore, it is inevitable to study the adversarial attacks for GNNs and defense \cite{365}. \subsubsection{Adversarial Attacks on Graphs} The literature \cite{182} firstly proposes a reinforcement learning based attack method, which can learn a generalizable attack policy, on graphs. This paper provides a definition for a graph adversarial attacker. Given a sample $(G,c,y)\in\{(G_j,c_j,y_j):j=1,\cdots,M\}$ and a classifier $f\in\mathcal{F}$, the graph adversarial attacker $g:\mathcal{F}\times\mathcal{G}\rightarrow\mathcal{G}$ attempts to modify a graph $G=(V,E)$ into $\widetilde{G}=(\widetilde{V},\widetilde{E})$, such that \begin{displaymath} \begin{array}{ll} \max_{g} & \mathbb{I}(f(\widetilde{G},c)\neq y) \\ [1.5mm] \text{s.t.} & \widetilde{G}=g(f,(G,c,y)), \\ [1.5mm] & \mathcal{I}(G,\widetilde{G},c)=1, \end{array} \end{displaymath} where $\mathcal{I}: \mathcal{G}\times\mathcal{G}\times V\rightarrow\{0,1\}$, named an equivalence indicator, checks whether two graph $G$ and $\widetilde{G}$ are equivalent under the classification semantics. The equivalence indicator are usually defined in two fashions, namely explicit semantics and small modifications. The explicit semantics are defined as $\mathcal{I}\left(G,\widetilde{G},c\right)=\mathbb{I}\left(f^*(G,c)=f^*(\widetilde{G},c)\right)$ where $f^*$ is a gold standard classifier, and the small modifications are defined as $\mathcal{I}\left(G,\widetilde{G},c\right)=\mathbb{I}\left(|(E-\widetilde{E})\cup(\widetilde{E}-E)|<m\right)\cdot\mathbb{I}\left(\widetilde{E}\subseteq N(G,b)\right)$ where $N(G,b)=\left\{(u,v):u,v\in V,d_G(u,v)<=b\right\}$. In order to learn an attack policy, the attack procedure is modeled as a finite horizon Markov Decision Process (MDP) $\mathcal{M}_m(f,G,c,y)$ and is therefore optimized by Q-learning with a hierarchical Q-function. For the MDP $\mathcal{M}_m(f,G,c,y)$, its action $a_t\in\mathcal{A}\subseteq V\times V$ at time step $t$ is defined to add or delete edges in the graph, its state $(\widehat{G}_t,c)$ at time step $t$ is a partially modified graph with some of the edges added/deleted from $G$, and the reward function is defined as \begin{displaymath} R\left(\widetilde{G},c\right)=\left\{ \begin{array}{ll} 1 & f(\widetilde{G},c)\neq y \\ [2mm] -1 & f(\widetilde{G},c)=y. \end{array} \right. \end{displaymath} Note that the GCNNs are employed to parameterize the Q-function. The \textsc{Nettack} \cite{181} considers attacker nodes in $\mathcal{A}$ to satisfy a feature attack constraint $X'_{u,j}\neq X_{u,j}^{(0)}\Longrightarrow u\in\mathcal{A}$, a structure attack constraint $A'_{u,v}\neq A_{u,v}^{(0)}\Longrightarrow u\in\mathcal{A}\vee v\in\mathcal{A}$ and an equivalence indicator constraint $\sum_{u}\sum_{j}|X_{u,j}^{(0)}-X'_{u,j}|+\sum_{u<v}|A_{u,v}^{(0)}-A'_{u,v}|\leq\Delta$, where $G'$ is derived by perturbing $G^{(0)}$. Let $\mathcal{P}_{\Delta,\mathcal{A}}^{G0}$ denote the set of all perturbed graphs $G'$ satisfying these three constraints. The goal is to find a perturbed graph $G'=(A',X')$ that classifies a target node $v_0$ as $c_{\text{new}}$ and maximizes the log-probability/logit to $c_{\text{old}}$, i.e. $\max_{(A',X')\in\mathcal{P}_{\delta,\mathcal{A}}^{G0}}\max_{c_{\text{new}}\neq c_{\text{old}}}\log Z_{v_0,c_{\text{new}}}^*-\log Z_{v_0,c_{\text{old}}}^*$ where $Z^*=f_{\theta^*}(A',X')$ with $\theta^*=\arg\min_{\theta}\mathcal{L}(\theta;A',X')$. The \textsc{Nettack} employs the GCNNs to model the classifier. The literature \cite{183} adopts the similar equivalence indicator, and poisoning attacks are mathematically formulated as a bilevel optimization problem, i.e. \begin{equation}\label{bilevel optimization} \begin{array}{ll} \min_{\widetilde{G}} & \mathcal{L}_{\text{attack}}\left(f_{\theta^*}\left(\widetilde{G}\right)\right) \\ [2mm] s.t. & \widetilde{G}\in\mathcal{P}_{\Delta,\mathcal{A}}^{G0} \\ [2mm] & \theta^*=\arg\min_{\theta}\mathcal{L}_{\text{train}}\left(f_{\theta}\left(\widetilde{G}\right)\right). \end{array} \end{equation} This bilevel optimization problem in formula (\ref{bilevel optimization}) is then tackled using meta-gradients, whose core idea is to treat the adjacency matrix of the input graph as a hyperparameter. \subsubsection{Defense against the Adversarial Attacks} A robust GCNN requires that it is invulnerable to perturbations of the input graph. The robust GCN (RGCN) \cite{180} can fortify the GCNs against adversarial attacks. More specifically, it adopts Gaussian distributions as the hidden representations of nodes, i.e. \begin{displaymath} X^{(l+1)}[j,:]\sim N\left(\mu_j^{(l+1)},\text{diag}(\sigma_j^{(l+1)})\right), \end{displaymath} in each graph convolution layer so that the effects of adversarial attacks can be absorbed into the variances of the Gaussian distributions. The Gaussian based graph convolution is defined as \begin{displaymath} \mu_j^{(l+1)}=\rho\left(\displaystyle\sum_{v_k\in N_G(v_j)}\frac{\mu_k^{(l)}\circledast\alpha_k^{(l)}}{\sqrt{\widetilde{D}_{j,j}\widetilde{D}_{k,k}}}W_{\mu}^{(l)}\right), \sigma_j^{(l+1)}=\rho\left(\displaystyle\sum_{v_k\in N_G(v_j)}\frac{\sigma_k^{(l)}\circledast\alpha_k^{(l)}\circledast\alpha_k^{(l)}}{\widetilde{D}_{j,j}\widetilde{D}_{k,k}}W_{\sigma}^{(l)}\right), \end{displaymath} where $\alpha_j^{(k)}$ are attention weights. Finally, the overall loss function is defined as regularized cross-entropy. The literature \cite{176} presents a batch virtual adversarial training method which appends a novel regularization term to the conventional objective function of the GCNNs, i.e. \begin{displaymath} \mathcal{L}=\mathcal{L}_0+\alpha\cdot\frac{1}{N}\sum_{u\in V}E(p(y|X_u,W))+\beta\cdot\mathcal{R}_{vadv}(V,W), \end{displaymath} where $\mathcal{L}_0$ is an average cross-entropy loss of all labelled nodes, $E(\cdot)$ is the conditional entropy of a distribution, and $\mathcal{R}_{\text{vadv}}(V,W)$ is the average Local Distributional Smoothness (LDS) loss for all nodes. Specifically, $\mathcal{R}_{\text{vadv}}(V,W)=\frac{1}{N}\sum_{u\in V}\text{LDS}(X[u,:],W,r_{\text{vadv},u})$ where $\text{LDS}(x,w,r_{\text{vadv}})=D_{KL}\left(p(y|x,\widehat{W})||p(y|x+r_{\text{vadv}},W)\right)$ and $r_{\text{vadv}}$ is the virtual adversarial perturbation. Additionally, there are some other studies aiming at verifying certifiable (non-)robustness to structure and feature perturbations for the GCNNs and developing robust training algorithm \cite{177,178}. The literature \cite{180} proposes to improve GCN generalization by minimizing the expected loss under small perturbations of the input graph. Its basic assumption is that the adjacency matrix $A_G$ is perturbed by some random noises. Under this assumption, the objective function is defined as $\min_{W}\int q(\epsilon|\alpha)\mathcal{L}(X,Y,A_G(\epsilon),W)d\epsilon$, where $A_G(\epsilon)$ denotes the perturbed adjacency matrix of $G$ and $q(\epsilon|\alpha)$ is a zero-centered density of the noise $\epsilon$ so that the learned GCN is robust to these noises and generalizes well. \subsection{Graph Neural Architecture Search} Neural Architecture Search (NAS) \cite{171} has achieved tremendous success in discovering the optimal neural network architecture for image and language learning tasks. However, existing NAS algorithms cannot be directly generalized to find the optimal GNN architecture. Fortunately, there have been some studies to bridge this gap. The graph neural architecture search \cite{172,173} aims to search for an optimal GNN architecture within a designed search space. It usually exploits a reinforcement learning based controller, which is a RNN, to greedily validate the generated architecture, and then the validation results are fed back to the controller. The literature \cite{175} proposes a Graph HyperNetwork (GHN) to amortize the search cost of training thousands of different networks, which is trained to minimize the training loss of the sampled network with the weights generated by a GCNN. \subsection{Graph Reinforcement Learning} The GNNs can also be combined with the reinforcement learning so as to solve sequential decision-making problems on graphs. The literature \cite{188} learns to walk over a graph from a source node towards a target node for a given query via reinforcement learning. The proposed agent M-Walk is composed of a deep RNN and Monte Carlo Tree Search (MCTS). The former maps a hidden vector representation $h_t$, yielded by a special RNN encoding the state $s_t$ at time $t$, to a policy and Q-values, and the latter is employed to generate trajectories yielding more positive rewards. The NerveNet \cite{187} propagates information over the underlying graph of an agent via a GCNN, and then predicts actions for different parts of the agent. The literature \cite{186} combines the GNNs and Deep Reinforcement Learning (DRL), named DRL+GNN, to learn, operate and generalize over arbitrary network topologies. The DRL+GNN agent employs a GCNN to model the Q-value function. \subsection{Applications} In this subsection, we introduce the applications of the GNNs. Due to the space limitation, we only list the application fields, including complex network analysis \cite{233,234,238}, combinatorial optimization \cite{215,216,223,224}, knowledge graph \cite{272,273,289}, bioinformatics \cite{201,210,211}, chemistry \cite{197,202,203}, brain network analysis \cite{205,206}, physical system \cite{102,338,339}, source code analysis \cite{340,341,342}, intelligent traffic \cite{353,355,403}, recommender systems \cite{343,344,349}, computer vision \cite{112,343,344,345,346} and natural language processing \cite{303,308,312,318,326}. \section{Benchmarks and Evaluation Pitfalls} In this section, we briefly introduce benchmarks and evaluation Pitfalls. The benchmarks provide ground truth for various GNN architectures so that different GNNs can be compared fairly, the evaluation pitfalls empirically show that the existing evaluation criterion have potential pitfalls. \subsubsection{Benchmarks} Graph neural networks have become a powerful toolkit for mining complex graphs. It becomes more and more critical to evaluate the effectiveness of new GNN architectures and compare different GNN models under a standardized benchmark with consistent experimental settings and large datasets. A feasible benchmark for the GNNs should include appropriate graph datasets, robust coding interfaces and experimental settings so that different GNN architectures can be compared in the same settings. The literature \cite{169} makes a pioneering effort to construct a reproducible GNN benchmarking framework in order to facilitate researchers to gauge the effectiveness of different GNN architectures. Specifically, it releases an open-source benchmark infrastructures for GNNs, hosted on GitHub based on PyTorch and DGL libraries \cite{402}, introduces medium-scale graph datasets with 12k-70k graphs of variable sizes 9-500 nodes, and identifies important building blocks of GNNs (graph convolutions, anistropic diffusion, residual connections and normalization layers) with the proposed benchmark infrastructures. The literature \cite{372} presents an Open Graph Benchmark (OGB) including challenging, real-world and large-scale benchmark graph datasets, encompassing multiple important graph deep learning tasks ranging from social and information networks to biological networks, molecular graphs and knowledge graphs, to facilitate scalable, robust and reproducible deep learning research on graphs. The OGB datasets, which provide a unified evaluation protocol using application-specific train/validation/test dataset splits and evaluation metrics, releases an end-to-end graph processing pipeline including graph data loading, experimental settings and model evaluations. \subsubsection{Evaluation Pitfalls} The literature \cite{170} compares four typical GCNN architectures: GCN \cite{6}, MoNet \cite{18}, GAT \cite{66} and GraphSAGE using three aggregation strategies \cite{104} against 4 baseline models: logistic regression, multi-layer perceptron, label propagation and normalized laplacian label propagation, and uses a standardized training and hyper-parameter tuning procedure for all these models so as to perform a more fair comparison. The experimental results show that different train/validation/test splits of datasets lead to dramatically different rankings of models. In addition, their findings also demonstrate that simpler GCNN architectures can outperform more sophisticated ones only if the hyper-parameters and training procedures are tuned fairly for all models. \section{Future Research Directions} Although the GNNs have achieved tremendous success in many fields, there still exists some open problems. This section summarizes the future research directions of the GNNs. \subsubsection{Highly Scalable GNNs} The real-world graphs usually contain hundreds of millions of nodes and edges, and have dynamically evolving characteristics. It turns out that it is difficult for the existing GNN architectures to scale up to the huge real-world graphs. This motivates us to design highly scalable GNN architectures which can efficiently and effectively learn node/edge/graph representations for the huge dynamically-evolving graphs. \subsubsection{Robust GNNs} The existing GNN architectures are vulnerable to adversarial attacks. That is, the performance of the GNN models will sharply drop once the structure and/or initial features of the input graph are attacked by adversaries. Therefore, we should incorporate the attack-and-defense mechanism into the GNN architectures, i.e. constructing robust GNN architecture, so as to reinforce them against adversarial attacks. \subsubsection{GNNs Going Beyond WL Test} The capabilities of the spatial GCNNs are limited by the 1-WL test, and the higher-order WL test is computationally expensive. Consequently, two non-isomorphic graphs will produce the same node/edge/graph representations under appropriate conditions. This motivates us to develop a novel GNN framework going beyond WL test, or design an elegant higher-order GNN architectures corresponding to the higher-order WL test. \subsubsection{Interpretable GNNs} The existing GNNs work in a black box. We do not understand why they achieve state-of-the-art performance in terms of the node classification task, graph classification task and graph embedding task etc. Interpretability has become a major obstacle to apply the GNNs to real-world issues. Although there have been some studies to interpret some specific GNN models, they cannot interpret general GNN models. This motivates us to construct a unified interpretable framework for the GNNs. \section{Conclusions} This paper aims to provide a taxonomy, advances and trends for the GNNs. We expand the content of this paper from 4 dimensions: architectures, extensions and applications, benchmarks and evaluation pitfalls, and future research directions. The GNN architectures are expanded from 4 perspectives: graph convolutional neural networks, graph pooling operators, graph attention mechanisms and graph recurrent neural networks. The extensions are expanded from 8 perspectives: GCNNS on special graphs, capability and interpretability, deep graph representation learning, deep graph generative models, combinations of the PI and GNNs adversarial attachks for the GNNs, graph neural architecture search and graph reinforcement. In the future directions, we propose 4 prospective topics on the GNNs: highly scalable GNNs, robust GNNs, GNNs going beyond WL test and interpretable GNNs. We expect that the relevant scholars can understand the computational principles of the GNNs, consolidate the foundations of the GNNs and apply them to more and more real-world issues, through reading this review. \begin{acks} This work was supported by National Natural Science Foundation of China (Grant No. 62002255, 62076177, 61972273). \end{acks} \bibliographystyle{ACM-Reference-Format}
{'timestamp': '2022-02-28T02:24:12', 'yymm': '2012', 'arxiv_id': '2012.08752', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08752'}
arxiv
\section{Introduction} With its high-resolution image and low cost, CT scan is critical in clinical decision and holds the key for making precise medical-care accessible to everyone around the world. Recently, deep learning methods have been introduced to detect lesions in CT slices~\cite{3DCE,MSB, Retina, MVP, MULAN}. Since it is difficult to distinguish lesions within a single axial slice, exploiting sufficient 3D context for accurate detection in volumetric CT data has emerged as a significant research focus. Various architectures have been proposed for proper modeling of 3D context from neighboring CT slices. Yan \textit{et al.}~\cite{3DCE} adopts a late fusion strategy which stacked 2D features of neighboring slices to build 3D context enhanced features. Although the pseudo-3D contextual information has provided prominent performance gain~\cite{3DCE,MSB, Retina, MVP, MULAN}, its late fusion strategy leads to notable losses of context information from early stages of the network. A direct way to address these issues is to employ 3D convolutions which introduce inter-slice connections hierarchically to learn 3D representations end to end. 3D convolutional filters can well preserve the 3D structure and texture information, but intensive memory and computation demands hinder its wide application in the universal lesion detection problem. What's worse, although 3D network pre-training has raised significant research attention~\cite{MG, Med3D,P3D,ACS}, the lack of good pre-trained 3D models makes it even harder to achieve good performance with 3D based detectors. In this paper, we focus on the problem of universal lesion detection in CT slices, where multiple adjacent CT slices are taken into consideration to localize 2D lesions for the target slice. We aim to develop a generic and efficient 3D backbone for 2D lesion detection with enhanced context modeling ability from multiple CT slices and devise a supervised pre-training method to boost its performance. Specifically, pseudo-3D convolutional filters~\cite{P3D} which use depth-wise separable convolution are adopted to reduce the memory and computation overhead. The backbone in our method is a Modified Pseudo-3D ResNet (MP3D ResNet), which extracts context enhanced 3D features from multiple neighboring CT slices (9 in our case) and then converted the 3D features into 2D ones with a group transform module (GTM) for further 2D lesion detection in the target slice. Then, we feed backbone features extracted from MP3D ResNet into the neck of Feature Pyramid Network (FPN) to form the MP3D FPN for effective multi-scale detection. Finally, to facilitate efficient training of the MP3D FPN, we designed a novel supervised pre-training method, which exploits supervised signals from large-scale 2D natural image object detection dataset to pre-train the proposed MP3D detector. In summary, the main contributions of our paper are three folds: \paragraph{1.} We have proposed a generic framework to employ 3D network for 2D lesion detection in CT slices. The proposed MP3D FPN is computational and memory efficient, and it achieves state-of-the-art performance on the DeepLesion dataset. \paragraph{2.} We have derived a novel and effective way to adopt 2D natural images to pre-train 3D network with supervised labels, whose pre-trained weights can potentially benefit other 3D medical image analysis tasks (e.g. segmentation). \paragraph{3.} We have conducted comprehensive experiments to explore the effects of pre-trained weights for deep medical image analysis. The results suggest that pre-trained weights can not only lead to faster convergence in all sized datasets, but also help to achieve better results in smaller-scale ones. \section{Methodology} Fig.\ref{flowchart} gives an overview of the proposed lesion detection framework. The proposed MP3D FPN comprises an MP3D ResNet as the backbone, a 2D FPN~\cite{FPN} as the neck and a 2D RPN/RCNN head. The MP3D ResNet takes multiple consecutive CT slices (e.g. 9) as input and generates 3D feature maps which bear the ability of 3D context modeling. Then a conversion block (GTM) further transforms the 3D feature maps into 2D ones for further 2D detection. Detailed architecture designs of the proposed MP3D backbone and the novel supervised pre-training scheme will be elaborated in the following sections. \begin{figure}[!tbp] \centering \includegraphics[width=\textwidth]{framework2.png} \caption{Overview of the proposed MP3D FPN. MP3D ResNet extracts context enhanced 3D features and converts them to 2D ones with a group transform module (GTM). These context enhanced 2D features are then fed into the FPN neck and the RPN/RCNN head for further 2D lesion detection. The MP3D FPN is pre-trained on Microsoft COCO object detection dataset~\cite{COCO}. } \label{flowchart} \end{figure} \subsection{3D Context Modeling with an MP3D ResNet Backbone} In this work, we explore to employ 3D convolutions for effective 3D context modeling in the problem of lesion detection from consecutive CT slices (e.g. 9 slices). To advance the time and memory efficiency of normal 3D ResNet, we adopt the Pseudo-3D Residual Network (P3D ResNet)~\cite{P3D} as the prototype of our backbone network. The pseudo-3D convolution simulates $3\times 3\times 3$ convolution with $1\times 3\times 3$ filter on axial-view slices plus $3\times 1\times 1$ filter to build inter-slice connections on adjacent CT slices. Lesion detection in CT slices aims to predict 2D bounding boxes in a certain slice, thus it requires 2D feature maps corresponding to the target slice for further prediction. Therefore, we need to convert the 3D feature maps to 2D ones for further prediction, meanwhile preserving the precise information of the target CT slice for accurate localization and classification. The designed Modified Pseudo-3D Residual Network (MP3D ResNet) highlights two aspects of modifications to fulfill such demands: 1) Instead of conducting isotropic pooling as in the original P3D ResNet, we neglect pooling operation in the inter-slice dimension. 2) A group transform module is introduced to generate the desired 2D feature maps from the context enhanced 3D features. Neglecting pooling operation in the inter-slice dimension can help to preserve precise information of the target slice. In the meantime, since the number of input slices (e.g. 9) is rather small, we can get enough receptive field in the inter-slice dimension without downsampling. Regarding 2D feature map conversions, Fang \textit{et al.}~\cite{PFN} proposed to extract $C$ 2D feature maps ($1\times 1\times H\times W$) corresponding to the center slice and concatenate them to form the converted 2D feature map of size ($C\times H\times W$). However, this method can not fully exploit the 3D context information resided in other adjacent slices. We, on the other hand, propose a group transform module (GTM) instead to includes all slice's features to compensate for the information loss. Specifically, we view 3D features ($C\times D\times H\times W$) into 2D ($CD\times H\times W$) and apply a group convolutional layer with the group size of $C$ (every $D$ channel is a group) to fuse all neighboring features to yield the final 2D feature maps ($C\times H\times W$). \begin{figure}[!tbp] \includegraphics[width=\textwidth]{pretrain1.png} \caption{Comparison between 1) using 2D Image-Net pre-trained weights for multi-slice medical image analysis and 2) decomposing 2D natural image to simulate multi-slice medical image for 3D network pre-training. } \label{pretrain} \end{figure} \subsection{Supervised 3D Pre-training with COCO Dataset} \begin{table}[!htbp] \caption{Sensitivities (\%) at various FPs per image on the test set of DeepLesion. $\mathbf{^*}$ indicates re-implementation of 3DCE using ResNet-50 FPN with the same configuration as our MP3D FPN.} \label{tab1} \centering \footnotesize \setlength{\tabcolsep}{8pt \renewcommand{\arraystretch}{1.2 \centering \label{tab:sample_1} \begin{tabular}{l|ccccccccc} \hline \textbf{Methods} & $\mathbf{0.5}$ & $\mathbf{1}$ & $\mathbf{2}$ & $\mathbf{4}$ & $\mathbf{MAP@0.5}$ \\ \hline \hline 3DCE, 27 slices\cite{3DCE} & 52.86 & 64.80 & 74.84 & 84.38 &-\\ MSB, 3 slices\cite{MSB} & 67.00 & 76.80 & 83.70 & 89.00 &-\\ RetinaNet, 3 slices\cite{Retina} & 72.15 & 80.07 & 86.40 & 90.77 &-\\ MVP-Net, 9 slices\cite{MVP} & 73.83 & 81.82 & 87.60 & 91.30 &-\\ MULAN, 9 slices\cite{MULAN} & \textbf{76.12} & \textbf{83.69} & \textbf{88.76} & \textbf{92.30} &-\\ \hline FPN+3DCE, 3 slices$\mathbf{^*}$ &68.52 & 77.59 & 83.91 & 88.33 & 64.41\\ FPN+3DCE, 9 slices$\mathbf{^*}$ &74.06 & 82.00 & 87.58 & 91.56 & 70.28\\ FPN+3DCE, 27 slices$\mathbf{^*}$ &\textbf{74.67} & \textbf{82.89} & \textbf{88.17} & \textbf{91.62} & \textbf{70.82}\\ \hline \textbf{MR3D FPN, 9 slices} & 79.09 & 84.84 & 89.18 & 92.06 & 76.57\\ \textbf{MP3D FPN, 9 slices} & \textbf{79.60} & \textbf{85.29} & \textbf{89.61} & \textbf{92.45} & \textbf{76.87} \\ \hline \textbf{Imp over} MULAN, 9 slices & $\uparrow$\textbf{3.48} & $\uparrow$1.60 & $\uparrow$0.85 & $\uparrow$0.15&- \\ \end{tabular} \end{table} Supervised pre-training from natural images has proven to be an effective way for 2D medical image transfer learning\cite{3DCE,MSB,Retina,MVP,MULAN, Chest}. This indicates that using supervised pre-training models from another domain can actually benefit the medical image analysis application. What's more, compared to self-supervised signals, we believe that supervised labels which carry the semantic information could enable the model to learn semantically invariant and discriminative features more effectively. Therefore, in this section, we aim to develop a method to exploit supervised labels from large-scale 2D natural image object detection dataset (e.g. coco~\cite{COCO}) to pre-train our MP3D FPN. Previous works~\cite{3DCE} have shown that by grouping 3 consecutive CT slices (which is natively 3D data) as a 3-channel RGB image, we can boost the detection performance with Image-Net pre-trained weights, indicating the feasibility of simulating RGB natural image with natively 3D CT slices. This inspires us to reversely decompose the 3 channels of natural RGB images into 3 consecutive CT slices, and train an MP3D FPN with such simulated 3D data. Fig~\ref{pretrain} illustrates a comparison of the two correlative strategies. For implementation details, we train the MP3D FPN on COCO dataset for 72 epochs and the final weights are used to initialize MP3D ResNet. To drive the network to learn useful 3D contextual features from inter-slice connections, it is essential to keep the resolution in the inter-slice dimension unchanged for all stages of the backbone The MP3D detector trained with a slice number of 3 can be used to initialize lesion detectors which takes variable number of slices as network input. \section{Experiments} \subsection{Experimental Setup} \noindent\textbf{Dataset and Metric:} The NIH DeepLesion is a large-scale dataset for lesion detection, which contains 32,735 lesions on 32,120 axial CT slices captured from 4,427 patients. DeepLesion is splitted into training (70\%), validation (15\%), and test (15\%) sets. We evaluate our MP3D FPN and all the compared methods on the test set by reporting the mean average precision (MAP@0.5) and average sensitivities at different false positives (FPs) per image. \noindent\textbf{Implementation Details:} As in~\cite{Retina}, the Hounsfield units (HU) are clipped into the range of $[-1024,1050]$. We interpolate in the z-axis to normalize the intervals of all CT slices to 2.5mm. Anchor scales are set to $\{16, 32, 64, 128, 256\}$ in FPN. Apart from horizontal and vertical flip, we resize the image to different scales of $\{448, 512, 576\}$ for data augmentation. MP3D-63 with group normalization\cite{GN} is used as the backbone in all our experiments, which has similar depth with the ResNet3D-50 model. The MP3D-63 model is derived from the conventional P3D-63\cite{P3D} model with the proposed modifications. Unless otherwise specified, the MP3D FPN takes 9 consecutive slices as input. We train all the models for 24 epochs at the base learning rate of 0.02, and reduce it by a factor of 10 after the 16-th and 22-th epoch (corresponding to the 2x learning schedule\cite{Rethinking} on COCO dataset). We conduct experiments on the NVIDIA TITAN V GPU with 12GB of memory, and mixed-precision training strategy is used in all our experiments to save memory. \subsection{Comparison with State-of-the-arts} Table \ref{tab1} presents the comparisons with the previous state-of-the-art (SOTA) methods. Our model surpasses all the SOTA methods on sensitivities at different FPs and MAP@0.5, which includes 3DCE\cite{3DCE}, MSB\cite{MSB}, RetinaNet\cite{Retina}, MVP-Net\cite{MVP} and MULAN\cite{MULAN}. Without using any auxiliary supervision, MP3D FPN outperforms MULAN, the previous SOTA which additionally employs multi task learning and a deeper backbone (DenseNet-121) to improve the detection accuracy, by up to \textbf{3.48\%} on the sensitivity of FPs@0.5. We re-implement 3DCE with ResNet-50 FPN using the same configuration as our MP3D FPN for fair comparison. Our proposed MP3D achieve a performance gain of \textbf{6.05\%} on MAP@0.5 compared with this 2D convolution based context encoding method, demonstrating the superior 3D context modeling ability of our MP3D backbones. As shown in Table \ref{tab1}, MP3D FPN (248.93 GFLOPS, 45.16 $M$ Params) and MR3D FPN (Modified ResNet 3D, 415.81 GFLOPS, 64.03 $M$ Params) based detector achieve comparable results, but the MP3D based detector consumes much less time and memory. This strongly proves the efficacy and the thrift of our MP3D model. \subsection{Ablation Study} We perform a number of ablations to probe into our MP3D FPN. The results are shown as follows: \begin{table}[!t] \caption{Detection performance and computational cost with variable numbers of input slice. GFLOPS is used to characterize the computational cost.} \label{tab:slice_num} \centering \footnotesize \setlength{\tabcolsep}{8pt \renewcommand{\arraystretch}{1.2 \centering \begin{tabular}{lccccccccc} \textbf{Methods} & $\mathbf{0.5}$ & $\mathbf{1}$ & $\mathbf{2}$ & $\mathbf{4}$ & $\mathbf{MAP@0.5}$ & $\mathbf{GFLOPS}$\\ \hline \hline MP3D, 5 slices &76.86 &83.44&88.13 &91.54&75.01 & 156.84\\ MP3D, 7 slices &78.22 &84.45&88.90 &91.50&76.69 & 202.88\\ MP3D, 9 slices &79.60 &85.29 & \textbf{89.61} &92.45 &76.87 & 248.93\\ MP3D, 11 slices&\textbf{80.05}&\textbf{85.77}&89.55 &\textbf{92.45}&\textbf{77.64} & 294.97\\ \end{tabular} \end{table} \noindent\textbf{Input Slices:} Table \ref{tab:slice_num} shows the performance of the MP3D detector when applying 5,7,9 and 11 slices as input. The detector achieves higher detection accuracy as more slices are used, meanwhile consuming more time and memory. MP3D with 7 slices as input get the best trade-off between effectiveness and efficiency. \begin{table}[!t] \caption{Comparison of different conversion modules and different pooling strategies for pre-training.} \label{tab:gtm} \centering \footnotesize \setlength{\tabcolsep}{8pt \renewcommand{\arraystretch}{1.2 \centering \begin{tabular}{lccccccccc} \textbf{Methods} & $\mathbf{0.5}$ & $\mathbf{1}$ & $\mathbf{2}$ & $\mathbf{4}$ & $\mathbf{MAP@0.5}$\\ \hline \hline MP3D w/ CTM &79.18 &84.90 &88.96 &91.90 &76.30 \\ MP3D w/ GTM &\textbf{79.60} &\textbf{85.29} & \textbf{89.61} & \textbf{92.45} &\textbf{76.87} \\ \hline MP3D w/ isotropic pooling &78.24 &84.41 &88.82 &91.98 &75.06\\ MP3D w/ proposed pooling &\textbf{79.60} &\textbf{85.29} & \textbf{89.61} & \textbf{92.45} &\textbf{76.87} \\ \end{tabular} \end{table} \noindent\textbf{Conversion Type:} Table \ref{tab:gtm} demonstrates the comparisons of proposed GTM with the center-cropping transform module (CTM), which is proposed by Fang \textit{et al.}~\cite{PFN}. The proposed GTM brings better results as it can efficiently aggregate information from all adjacent slices for further detection. \subsection{Effectiveness of the 3D Pre-trained Model} We conducted three groups of experiments to explore effectiveness of the pre-training method. \noindent\textbf{Comparison to Isotropic Pooling:} In this work, to achieve 3D context modeling ability in the z-axis, we neglect pooling operation in the inter-slice dimension when pre-training the MP3D model on the Microsoft COCO dataset. We compared our proposed method to isotropic pooling for validation. The pre-trained model takes three slices as input. When training with isotropic pooling, the z-axis degenerates to a single slice after the first two pooling layers, preventing further 3D convolution layers from learning useful 3D contextual information. As shown in Table\ref{tab:gtm}, pre-trained weights learned from isotropic pooling gives worse results than the proposed method. This also proves that using decomposed natural image as input can actually helps the 3D model to gain context-encoding ability. Thus the learned weights can potentially be used to boost the performance of other 3D medical image analysis tasks. \begin{table}[!t] \caption{Comparison of model performance with and without pre-training with different learning schedules. 1x, 2x and 6x indicates max training epochs of 12, 24 and 72 separately.} \label{tab:scratch} \centering \footnotesize \setlength{\tabcolsep}{8pt \renewcommand{\arraystretch}{1.2 \centering \label{tab:scratch} \begin{tabular}{lccccccccc} \textbf{Methods} & $\mathbf{0.5}$ & $\mathbf{1}$ & $\mathbf{2}$ & $\mathbf{4}$ & $\mathbf{MAP@0.5}$ \\ \hline \hline MP3D 1x w/o pretrain & 70.12& 78.00& 83.95& 88.23&67.60 \\ MP3D 2x w/o pretrain & 76.11& 82.65& 87.70& 91.17&74.00 \\ MP3D 6x w/o pretrain &\textbf{79.60} & 85.29& 89.26& 92.19& 76.75\\ \hline MP3D 1x w/ pretrain &78.02& 84.33& 88.84& 91.74&75.78\\ MP3D 2x w/ pretrain&79.58& \textbf{85.29}& \textbf{89.61}& \textbf{92.45}&\textbf{76.87}\\ \end{tabular} \end{table} \begin{table}[!t] \caption{Training with variable dataset sizes ($100\%$ to $20\%$). For simplicity, we present the results of MAP@0.5.} \label{tab4} \centering \footnotesize \setlength{\tabcolsep}{8pt \renewcommand{\arraystretch}{1.2 \centering \label{tab:datasize} \begin{tabular}{lcccccccc} \textbf{Methods} & $\mathbf{100\%}$ & $\mathbf{80\%}$ & $\mathbf{60\%}$ & $\mathbf{40\%}$ & $\mathbf{20\%}$ \\ \hline \hline 3DCE 9 slices 2x &70.28 &69.22 &67.08 &63.61 &57.02 \\ 3DCE 27 slices 2x &70.82 &69.96 &68.08 &65.36 &58.82 \\ \hline MP3D w/o pre-train 2x &74.00 &71.58 &68.79 &63.40 &50.67 \\ MP3D w/o pre-train 6x &76.75 &75.43 &72.87 &68.14 &58.98 \\ MP3D w/ pre-train 2x & \textbf{76.87} &\textbf{75.66} &\textbf{73.33} &\textbf{71.07} &\textbf{65.55} \\ \end{tabular} \end{table} \noindent\textbf{Comparison to Training From Scratch:} He \textit{et al.}\cite{Rethinking} demonstrated that with sufficient training data (around 35k from its experiment) and longer training schedule (6x), models trained from scratch could achieve comparable results to models training with pre-trained weights. Therefore, we examined the effectiveness of our proposed pre-training method by comparing MP3D with pre-training to model trained from scratch with longer schedule. As shown in Table\ref{tab:scratch}, when both trained for 1x learning schedule (12 epochs), MP3D with pre-trained weights significantly outperforms the one without pre-training, demonstrating faster convergence speed. And it turns out that with 2x learning schedule (24 epochs), model trained with the proposed pre-training weights can achieve comparable results with MP3D model trained from scratch with 6x learning schedule (72 epochs). These results validate the effectiveness of our proposed pre-training scheme. \noindent\textbf{Performance on Variable Dataset Sizes:} In medical image analysis tasks, annotated data is often scarce. Therefore, it is appealing to gain a better understanding of the effects of pre-trained weights when dataset size is small. In this subsection, we compare the model performance of 2x, 6x training from scratch and 2x with pre-training on variable dataset sizes by randomly choosing 20\%, 40\%, 60\% and 80\% of the whole training data. Pre-training based models achieve better performance with less training time on all the cases, and the smaller the size of the dataset, the larger the gap. A dramatic drop of performance starts when training with only 40\% of the whole data. And when training with only 20\% of the dataset, which is around 4,500 images, the model trained with our proposed pre-trained weights achieves an absolute performance gain of 6.57\% on MAP@0.5, accounting for an 11\% relative gain. \section{Conclusions} In this paper, we propose a generic model architecture to exploit 3D network for 2D lesion detection in CT slices. The proposed MP3D FPN can reduce computation and memory cost while providing enhanced 3D context modeling ability. A simple yet effective way for 3D network pre-training is also derived to facilitate efficient training. Without sophisticated structures and multi-supervision signals, it significantly improves the detection performance on the DeepLesion dataset, surpassing all the SOTAs. We have proved the benefits of pre-trained weights for variable dataset size, and we expect that the MP3D ResNet along with its pre-trained weights can serve as a benchmark backbone for 3D medical image analysis, making contributions towards accessible precise medication. \subsubsection{Acknowledgements.} This work is funded by National Key Research and Development Program of China (No. 2019YFC0118101), MOST-2018AAA0102004 and NSFC-61625201. We would like to thank Yemin Shi for valuable discussions. \input{paper62.bbl} \end{document}
{'timestamp': '2020-12-17T02:10:46', 'yymm': '2012', 'arxiv_id': '2012.08770', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08770'}
arxiv
\section{Introduction} Grasping is one of the important actions in people's daily life, but the limbs of some disabled people cannot implement the grasping function because of paralysis, amputation, etc. Wearable robots including exoskeletons~\cite{dollar2008lower}, prosthetics~\cite{belter2013mechanical}, and supernumerary robotic fingers~\cite{wu2015hold, hussain2016soft, ciullo2018analytical} can serve as alternative actuators. Recognition of grasping intention is the premise for controlling wearable robots. The current main methods include EMG-based methods~\cite{salvietti2016compensating, marco2017surface}, EEG-based methods~\cite{penaloza2018bmi, downey2018intracortical}, and action-based methods~\cite{huang2015control, de2015recognizing}. Among these methods, the EMG-based method is not suitable for patients with hemiplegic paralysis, because the EMG signals of affected limbs have been distorted, from which it is difficult to identify the intention of patients. The accuracy and discriminability of EEG signals obtained by the noninvasive brain-machine interface are relatively low, and it is easy to be interfered by external factors. Although the invasive interface can obtain accurate EEG signals, most patients cannot accept craniotomy. The action-based methods use sensors such as airbags and IMUs to obtain the action states of the user's limb to infer the user's intention, but these methods are impossible for those patients who have lost their locomotivity. Eye-tracking technology can be the feasible means of grasping intention recognition for such patients. The use of eye movement as a control interface relies on the fact that our gaze is proactive and directly correlated to action intentions and cognitions~\cite{hayhoe2005eye}. Furthermore, the oculomotor system control function is usually retained even in the most severe cases of paralysis related to muscular dystrophies or brain stroke. And in neurodegenerative diseases that affect the motor system (such as stroke, Parkinson's disease, or Multiple Sclerosis), it is easier for patients to control their gaze point rather than conducting stable skeletal movements~\cite{cipresso2011combined}. Most of the studies using eye movement technology only focus on reaching tasks, e.g., Roni et al. used gaze controlling robotic arms to assist human hands in reaching tasks~\cite{maimon2017towards} , and Shaft et al. used eye movement controlling robotic arms to perform tasks\cite{shafti2019gaze}. Other studies have adopted unnatural methods to recognize the grasping intention of patients, such as asking users to deliberately blink or prolong the gaze, which will increase the cognitive load on users. It is not easy for patients with nerve damage to complete these unnatural actions. In these case, natural human-robot interaction can be used to recognize the patients' intention. Natural human-robot interaction uses natural action to obtain the user's intention~\cite{ferland2013natural, valli2008design}, without imposing extra cognitive load on the users. This is similar to the user's control of their own limbs for activities without long-term training. Previous studies have shown that there are differences in natural gaze between grasping and viewing behaviours~\cite{brouwer2009differences}. However, these studies focus on the effects of different objects on the first two fixations. To the best of our knowledge, there are only qualitative summaries of differences from experimental observations but no quantitative features that can be used for grasping intention recognition reported in existing literatures. On this basis, we study the relationships of the fixations in the grasping tasks and viewing tasks when the thumb and index finger are visible, which is a common situation while humans are conducting grasping tasks. We analyze these relationships and extract some quantitative features to identify gasping intention. Using the obtained features, we recognize the user's grasping intention and verify the effectiveness of the method. Our main contributions are as follows: \begin{enumerate}[] \item We discover the relationships between the fixation selves, the fixations and objects, the fixations and grasping points in the grasping tasks and the viewing tasks. Compared with the viewing tasks, the fixations of the user are more centralized and tend to be close to the grasp point of the index finger in the grasping task. \item We propose four features from the relationships for grasping intention recognition. Then we compare the accuracy of different features in recognition of grasping intention. On this basis, we implement a natural method to recognize the grasping intention by eye movement. \item We carry out grasping experiments with humanoid robotic arms in actual daily scenes, which verifies the effectiveness of the proposed method. \end{enumerate} \section{Methods} \subsection{System overview and architecture} We aim to create a system to recognize grasping intention based on human natural gaze data. The system consists of a binocular eye-tracker, a scene camera, a head stand and a black background (see Fig.~\ref{setup}). The block diagram in Fig.~\ref{block} depicts an overview of our system. Individual modalities are described in detail in the following. \begin{figure*}[htbp] \centering \includegraphics[width=0.9\textwidth]{1-1.png} \caption{The block diagram of our system. The user's fixation positions are obtained by the eye-tracker, the object information is obtained by the image processing algorithms, and the grasping position is obtained by pre-experiment. The features proposed in this paper are extracted from these data and used to train the intent recognition model. In the task of intent recognition, the humanoid robot arm is controlled to complete the grasping action according to the model recognition result.} \label{block} \end{figure*} \subsubsection{Binocular eye-tracker} For 2D eye tracking, we use the Pupil Core~\cite{kassner2014pupil}. The eye-tracker is built from two infrared (IR) cameras used to photograph the eyes, yielding a resolution of 192 $\times$ 192 pixels at a maximum frame-rate of 120 Hz. It has two extendable mounts for the infrared cameras, which can be adjusted to focus the IR cameras on each eye respectively for individuals. There are two IR LEDs attached to the cameras to illuminate the pupil of the user. Using the obtained infrared images, we can select the appropriate eye model and apply ellipse fitting parameters during system operation to detect the pupil of the user, and then use this information to estimate the user's fixation point. An Intel Realsense D435 RGB-D camera (Intel Corporation, Santa Clara, California, USA) is mounted on the top of the eye-tracker as a scene camera, with a 3D printed frame. This camera is used to capture the user's ego-centric scene. \subsubsection{Object centroid detection} In the experiment environment, we use the OpenCV image processing library~\cite{kaehler2016learning} to process live scene video streams and detect the object's centroid in each frame with a contour-based algorithm. To avoid the interference from ambient light, we use a solid color background. Besides, we filter the centroid of some disturbing objects based on the area of the object contour. Because it is impossible to detect the real centroid of 3D objects in RGB images, we use the 2D centroid of objects in images instead. In real environment applications, we use Mask R-CNN~\cite{he2017mask} to quickly and accurately obtain object information. This machine learning-based method can effectively improve the robot system's ability to perceive the environment and identify objects that patients need to grasp in their daily lives. \subsubsection{Grasp position detection} In grasping tasks the thumb and the other fingers play different roles. The thumb guides the hand straight to the object's location, and then the other fingers represented by the index finger grip around the object to ensure a safe grasp~\cite{haggard1997hand}. We record the positions of the participants' digits to obtain the relationship between the fixation position and the grasping position. The grasping positions are obtained through pre-experiment. In the preliminary experiment, we ask participants to grasp each object in repeated fashion and use the average positions as the grasping positions of the thumb and index finger. \subsection{Experiment} There are two categories of gaze behaviour: fixations and saccades. Fixations are those times when our eyes essentially stop scanning about the scene, holding the central foveal vision in place so that the visual system can take in detailed information about what is being looked at~\cite{rayner200935th}. The main goal of the experiment is to investigate the difference of fixation modes of the participants under different task conditions of grasping and viewing. Eight different participants carry out both viewing and grasping tasks. Their ages range between 20 and 30. Prior to the experiments, a short introduction is provided to these subjects, including technologies involved, the system setup and the research purpose. During the experiment, a head stand is used to fix the subjects' head. In practical applications, a head tracking module can be added to track the movement of the use's head, which is not covered in this paper. \subsubsection{Procedure} The shapes that the participants are asked to grasp or view are magnetically attached to a black background, which is placed in front of an iron plate (Fig.~\ref{setup}). We use three different white plastic objects for training, depicted in Fig.~\ref{setup}(b): a square, a cross, a T-shape (presented in four different orientations). They are 10 mm thick. There are two types of grasping tasks, horizontal grasping and vertical grasping. The vertical T-shape is used for vertical grasping tasks, while the horizontal T-shape is used for horizontal grasping tasks. The square and cross shapes are used in both grasping tasks. For each type of the grasping task, participants perform 4 shapes * 5 repetitions = 20 practice trials, presented in random order. For the viewing task, participants perform the same number of trials. We use two other shapes: a triangle and a bar (presented in 2 different orientations) for testing. \begin{figure*}[thbp] \centering \subfigure[]{ \begin{minipage}[t]{0.45\linewidth} \centering \includegraphics[width=1\linewidth,height=3.8cm]{3-1.png} \end{minipage}% }% \subfigure[]{ \begin{minipage}[t]{0.45\linewidth} \centering \includegraphics[width=1\linewidth]{3-2.png} \end{minipage}% }% \centering \caption{The experimental scene and target shapes. (a) Schematic depiction of the setup and the way of grasping in the experiment. (b) Different shapes in the experiment.} \label{setup} \end{figure*} The eye-tracker needs to be calibrated before the experiment starts. Participants rest their head on a head stand, 50 cm in front of the monitor, which is the same distance as in the experiment. Both eyes are calibrated using a nine point calibration/validation procedure on the computer monitor. After the participants have performed half trials, the calibration is repeated. At the start of each trial, the participants fix at the start point and closes their eyes after fixation. For grasping tasks, participants start a trial with the eyes closed and the hands resting on the lap. When hearing a ``grasp'' command, they open their eyes and immediately fix their eyes on the start point. Participants then stretch out their thumb and index finger to grasp the shape (Fig.~\ref{setup}(a)). Different grasping tasks have different grasping modes. The user's fingers of the horizontal grasping tasks contact with the left and right edges of the object, while the fingers of the vertical grasping tasks contact with the top and bottom edges. The trial is ended when the ``finish" command is heard. After completing the trial, the participants return to the start point with their hands on the lap and their eyes closed, until hearing the verbal command to start next trial. The procedure of the viewing task is similar to the grasping task, with the exception that instead of being asked to grasp, participants are asked to ``view the shape'' until hearing a "finish" command. The viewing process lasts for three seconds. The duration is measured by the participants through the pre-experiment. In the experiment, participants perform 10 grasping tests repeatedly and we select the maximum time of task execution as the benchmark time in the experiment. \section{Data analysis} Among 640 grasping and viewing trails, the data of 16 grasping trails (5\%) and 24 viewing trails (7.5\%) are rejected due to insufficient quality of eye data. We use the fixation detection algorithm to distinguish fixations from fast saccades. The parameters of the algorithm recommended by the manufacturer are set as follows: \begin{equation} \begin{aligned} &dp{s_{\max }}{\rm{ = 3}}{\rm{.01}},~du{r_{\min }}{\rm{ = 80}}ms,~du{r_{\max }} = 400ms \end{aligned} \end{equation} $dps_{max}$ indicates the threshold of the distance between all gaze locations during a fixation. $dur_{min}$ indicates the minimum duration in which the distance between every two gaze locations must not exceed $dps_{max}$ and $dur_{max}$ indicates the maximum duration. After processing the gaze information, the two-dimensional coordinates of the fixation points of participants in the trial are obtained. The coordinates are the relative positions of the fixations to the centroid of the shape. We compare the result of the grasping and viewing tasks through repeated measures analysis of variance (ANOVAs), taking the objects as within-subjects variable and the tasks as between-subjects variable. For all statistical tests, we use 0.05 as the level of significance. \begin{table*}[thbp] \centering \caption{Significant results for two kinds of grasping tasks and viewing tasks repeated measures ANOVAs on the ADF2C, the ADF2I, the ADF2T, and the VAR} \begin{tabular}{lllll} \toprule \textbf{} & \textbf{ADF2C} & \textbf{ADF2I} & \textbf{ADF2T} & \textbf{VAR} \\ \hline \textbf{Vertical grasping and viewing} & \textit{F}=0.046, \textit{p} = 0.829 & \textit{F}=142.699, \textit{p} $<$0.001 & \textit{F}=5.699, \textit{p}=0.0176 & \textit{F}=284.699, \textit{p} $<$0.001 \\ \midrule \textbf{Horizontal grasping and viewing} & \textit{F}=3.781, \textit{p} = 0.053 & \textit{F}=192.511, \textit{p} $<$0.001 & \textit{F}=164.964, \textit{p} $<$0.001 & \textit{F}=171.128, \textit{p} $<$0.001 \\ \midrule \textbf{Grasp and viewing} & \textit{F}=3.209, \textit{p} = 0.074 & \textit{F}=270.596, \textit{p} $<$0.001 & \textit{F}=80.568, \textit{p} $<$0.001 & \textit{F}=437.500, \textit{p} $<$0.001 \\ \midrule \end{tabular} \label{ANOVAS} \end{table*} \subsection{Number of fixation} Table~\ref{fixation} shows the average fixation times in one trial. On average, there are 8.18 (\textit{STD}=0.99) fixation points for each grasping task and 8.62 (\textit{STD}=0.76) fixations for each viewing task. The results of repeated measures ANOVA show that the task type affects the number of fixations (\textit{F}=270.60, \textit{p}$<$0.001). But in one trial, the number of fixations will only be an integer, which makes it difficult to distinguish between grasping and viewing by the number of fixations. \begin{table*}[thbp] \centering \caption{Fixations in different trials} \begin{tabular}{cccccccc} \toprule \textbf{Shape} & \textbf{square} & \textbf{cross} & \textbf{cross\_down} & \textbf{cross\_up} & \textbf{cross\_right} & \textbf{cross\_left} & \textbf{mean} \\ \midrule \textbf{Viewing} & 8.71$\pm$0.83 & 8.35$\pm$0.70 & 8.60$\pm$0.89 & 8.57$\pm$0.70 & 8.08$\pm$0.87 & 8.62$\pm$0.66 &8.62$\pm$0.80 \\ \midrule \textbf{Grasping} & 8.28$\pm$1.09 & 8.11$\pm$0.69 & 8.64$\pm$1.11 & 8.23$\pm$0.70 & 8.08$\pm$0.36 & 8.08$\pm$0.36 &8.18$\pm$0.86 \\ \midrule \end{tabular} \label{fixation} \end{table*} \subsection{Fixations locations} Fig.~\ref{mean_location} illustrates the distribution of the fixation location by showing the fixations in certain trials in the grasping and viewing tasks respectively. The centroid of the shapes is represented by the blue point. We can find that fixations have different characteristics under different tasks. To effectively distinguish between grasping and viewing, we propose some features and quantitatively analyze their relationship in different tasks. In one trial, the user's fixations are expressed as: \begin{equation} F({t_i}) = ({f_x}({t_i}),{f_y}({t_i})) \label{fix_coordinate} \end{equation} $i$ represents the number of fixation, and $t_i$ represents the time corresponding to fixation $i$. The two-dimensional centroid coordinates of the object are expressed as follows: \begin{equation} C(t) = ({c_x}(t),{c_y}(t)) \label{cog_coordinate} \end{equation} where $t$ represents the time of coordinates. The coordinates of the user's thumb and index finger grasp points in the egocentric video are expressed as: \begin{equation} \begin{aligned} {G_1}(t) = (g{1_x}(t),g{1_y}(t))\\ {G_2}(t) = (g{2_x}(t),g{2_y}(t)) \label{grasp_coordinate} \end{aligned} \end{equation} \begin{figure}[htp] \centering \includegraphics[width=0.5\textwidth]{mean_location.png} \caption{The fixation position of participants on four shapes in certain trials. The centroid of the shapes is represented by the blue point.} \label{mean_location} \end{figure} \subsubsection{The average distance from the fixations to the centroid} The first feature we propose is the average distance from the user's fixation points to the centroid of the shape (ADF2C). This feature is used to describe the relationship between the participants' fixations and the object: \begin{equation} \begin{aligned} ADF2C = \frac{1}{n}\sum\limits_{i = 1}^n {\sqrt {{{({f_x}({t_i}) - {c_x}({t_i}))}^2} + ({f_y}({t_i}) - {c_y}{{({t_i})}^2}} } \label{ADF2C_equ} \end{aligned} \end{equation} If the detected centroid does not belong to the user's target object, this feature will appear abnormal (too large), which means that the user's target object can be determined by this feature. Fig.~\ref{dis_cog} shows the distance between the fixations and the centroid of the shape in grasping and viewing, including the mean value of the distances. Obviously, the curves of ADF2Cs intertwine in the grasping and viewing tasks, and their average values are so close that there is no significant difference. A repeated measures ANOVA on the ADF2C with the tasks as variable indicates that the ADF2C does not differ between grasping and viewing (\textit{F}=3.20, \textit{p} = 0.07). \begin{figure}[thp] \centering \includegraphics[width=0.5\textwidth]{distance_to_COG.png} \caption{The ADF2Cs in all trials. The solid line represents the result of each trial, and the dotted line represents the average of all results. } \label{dis_cog} \end{figure} \subsubsection{The average distance from the fixations to the grasping point} We find that there are also different relationships between the fixations and the grasp position in different tasks. The grasping positions of the participants are obtained from the pre-experiment. We consider using the average distance between the fixations and the grasping positions in each trial to reflect these relationships. These two features are the average distance from the fixations to the index finger (ADF2I) and the average distance from the fixations to the thumb (ADF2T): \begin{equation} \begin{aligned} ADF2T = \frac{1}{n}\sum\limits_{i = 1}^n {\sqrt {{{({f_x}({t_i}) - g{1_x}({t_i}))}^2} + ({f_y}({t_i}) - g{1_y}{{({t_i})}^2}} } \\ ADF2I = \frac{1}{n}\sum\limits_{i = 1}^n {\sqrt {{{({f_x}({t_i}) - g{2_x}({t_i}))}^2} + ({f_y}({t_i}) - g{2_y}{{({t_i})}^2}} } \label{ADF2TI_equ} \end{aligned} \end{equation} Fig.~\ref{dis_grasp} shows the relationship between ADF2I and ADF2T in all trials, respectively. We can find that ADF2I and ADF2T are obviously different in grasping and viewing tasks. Furthermore, the mean value of ADF2I is significantly lower than that of ADF2T in grasping tasks. The reason is that in the grasping tasks, the participants' eyes focus on the index finger more than the thumb, which may help stabilize the grasps. A repeated measures ANOVA on the ADF2I shows a significant effect of the tasks (\textit{F}=270.60, \textit{p}$<$0.001). Similar to ADF2I, ADF2T is also affected by the task(\textit{F}=80.57, \textit{p}$<$0.001). Table~\ref{ANOVAS} reveals that this significant effect is more obvious in horizontal grasping tasks than in vertical grasping tasks (the value of \textit{F} indicates the extent of the effect). \begin{figure}[thp] \centering \includegraphics[width=0.5\textwidth]{distance_to_indexandthumb.png} \caption{The average distance from the fixation to the grasping point. The solid line represents the result of each trial, and the dotted line represents the average of all results.} \label{dis_grasp} \end{figure} \subsubsection{The relationship between fixation points} We also find that in one trial, there is a relationship between the fixations. We first propose the variance (VAR) of the distances from all the fixation points to the center as a quantitative description of concentration: \begin{equation} \begin{aligned} &O = ({o_x},{o_y}) = (\frac{1}{n}\sum\limits_{i = 1}^n {{f_x}({t_i})} ,\frac{1}{n}\sum\limits_{i = 1}^n {{f_y}({t_i})} )\\ &{d_i} = \sqrt {{{({f_x}({t_i}) - {o_x})}^2} + {{({f_y}({t_i}) - {o_y})}^2}}\\ &M = \frac{1}{n}\sum\limits_{i = 1}^n {{d_i}}\\ &VAR = \frac{{\sum\limits_{i = 1}^n {{{({d_i} - M)}^2}} }}{n} \end{aligned} \end{equation} It can be seen from Fig.~\ref{var} that the VARs in the grasping tasks are significantly smaller than those in the view tasks. In the grasping tasks, the mean value of the VARs is 29.85. \textit{(STD}=44.08), which is much smaller than the viewing tasks (\textit{MEAN}=256.67, \textit{STD}=181.05). This can be explained by the fact that in the grasping tasks, the participant's attention and sight need to be more concentrated to complete the grasp, and the participant's sight changes randomly across the target during the viewing task. A repeated measures ANOVA on the VARs show a significant effect of the tasks (\textit{F}=437.50, \textit{p}$<$0.001). This effect is similar in horizontal grasping and vertical grasping. \begin{figure}[thp] \centering \includegraphics[width=0.5\textwidth]{var_of_fixation.png} \caption{The VARs in all trials. The solid line represents the result of each trial, and the dotted line represents the average of all results.} \label{var} \end{figure} Table~\ref{ANOVAS} shows all significant results of the repeated measures ANOVA on the ADF2C, the ADF2I, the ADF2T, and the VAR. \section{Grasping intention recognition} From the above data analysis, we can know that in the viewing and grasping tasks, participants' fixations have different features, which show the potential of accurately estimating the participants' grasping intention. Thanks to the use of human natural eye behavior, people's cognitive load is reduced and can be quickly accepted by users. This method is especially suitable for patients with upper limb injuries. They can use gaze data to control and express their grasping intention, instead of relying on residual EMG or movement. To evaluate the effect of different features on grasping intention recognition, we selected five feature combinations. 1) Combination1:ADF2T+VAR 2) Combination2:ADF2I+VAR 3) Combination3:ADF2C+ADF2T+VAR 4) Combination4:ADF2C+ADF2I+VAR 5) Combination5:ADF2C+ADF2I+ADF2T+VAR Several different machine learning methods are used, including support vector machine (SVM), K-Nearest Neighbor (KNN), stochastic gradient descent (SGD), and decision tree (DT). The total samples are randomly partitioned into 5 equal-sized subsets. Among the 5 subsets, four subsets are used as the training set while the remaining one is used as the testing set (Test1). For each methods,we use the 5-fold cross-validation to evaluate the accuracy of recognition. The other test set (Test2) is collected from three other shapes that does not exist in the training set, each of which contains 20 samples. From Fig.~\ref{acc} we can learn that for different feature combinations, Combination3 has the highest average accuracy on Test1, which is 89.7\%$\pm$1.9\%. The average recognition accuracy of the other four feature combinations on Test1 also exceeds 88.8\%. On Test2, Combination2 has the highest average recognition accuracy of 90.6\%$\pm$4.5\%. The average recognition accuracy of other feature combinations is also acceptable, the lowest of which is higher than 87\%. For different classifiers, the KNN has the highest average accuracy on Test1, which is 91.6\%$\pm$0.3\%. The SGD has the lowest grasping intention recognition accuracy on Test1, with an average of 85.1\%$\pm$2.5\%. But this is also an acceptable result, which means that the influence of classifiers is small. On Test2, the SVM (linear) achieves the best accuracy of 93.6\%$\pm$0.3\%. The accuracy of other classifiers also exceeds 82\%. The reason why the SVM classifier has higher accuracy on Test2 than Test1 may be that Test1 has a longer experimental process. This makes the participants become fatigued and lead to abnormal fixation mode. From the analysis, we can know that the features we discovered can effectively identify the user's grasping intention and can achieve excellent results with different classifiers. Furthermore, we have successfully applied the proposed feature combinations to the newly appeared objects in the test set to identify the user's grasping intention. These results show that the features we extracted from the gaze data are robust and can reflect human intention, which can be effectively applied to the recognition of users' grasping intention. \begin{figure*}[htbp] \centering \subfigure[]{ \begin{minipage}[bp]{0.5\linewidth} \centering \includegraphics[width=1\linewidth]{acc_test1.png} \end{minipage} }% \subfigure[]{ \begin{minipage}[bp]{0.5\linewidth} \centering \includegraphics[width=1\linewidth]{acc_test2.png} \end{minipage} }% \centering \caption{Classification accuracy of each classifier and combinations for grasping intention recognition. We perform 100 repeated experiments and used the average accuracy and standard deviation. (a) The accuracy of Test1. (b) The accuracy of Test2} \label{acc} \end{figure*} \section{Grasping experiment in real environment} We have carried out the application experiment in the actual daily scene with the humanoid arm. The experimental scene is shown in the Fig.~\ref{realexp}. We chose a cup that is commonly used in daily life as the intended target. We used the Mask R-CNN~\cite{he2017mask} object detection algorithm to extract the target information we need from the real and complex environment. Through the selected algorithm, we can detect the mask of the cup from the user's egocentric scene and use it to calculate the two-dimensional centroid of the object. We set up a sliding window with a duration of three seconds to sample the data. Then, the features are extracted by combining the centroid of the object, the grasping points with the user's fixation information. At the same time, we use the Combination4 and the KNN as features and the classifier for grasping intention recognition. The experimental results show that, combined with the current advanced image processing algorithms, our proposed method can effectively identify the user's grasping intention and successfully implement the grasp. The complete experimental process is shown in the video in the material. Four subjects participated in our experiment. To complete the objective evaluation, the subjects were asked to complete the Quebec User Evaluation of Satisfaction with assistive Technology (QUEST) questionnaire~\cite{demers2002quebec}. The results are shown in Table~\ref{question}. From the QUEST questionnaire we find that although there is general agreement with effectiveness, easiness to use, and safety, there is displeasure on comfort. This is probably because the scene camera is relatively heavy and the eye-tracker is not a mature wearable product. \begin{figure}[htp] \centering \includegraphics[width=0.5\textwidth]{real_experiment.png} \caption{Application experiment in the real environment. The system recognizes the user's grasping intention and controls the humanoid robotic arm to complete the grasp.} \label{realexp} \end{figure} \begin{table}[htbp] \centering \caption{QUEST evaluation results for the humanoid robotic arm assist system} \begin{tabular}{ccccc} \hline \textbf{} & \textbf{Safety} & \textbf{\begin{tabular}[c]{@{}c@{}}Easy \\ to Use\end{tabular}} & \textbf{Comfort} & \textbf{\begin{tabular}[c]{@{}c@{}}Effec\\ -tive\end{tabular}} \\ \hline \textbf{Not satified at all} & 0 & 0 & 0 & 0 \\ \hline \textbf{Not very satisfied} & 0 & 0 & 1 & 0 \\ \hline \textbf{More or less satisfied} & 1 & 0 & 1 & 0 \\ \hline \textbf{Quite satisfied} & 3 & 3 & 2 & 2 \\ \hline \textbf{Very satisfied} & 0 & 1 & 0 & 2 \\ \hline \end{tabular} \label{question} \end{table} \section{Discussion and Conclusion} Recognition of grasping intentions is the premise for wearable robots to assist users in grasping, but in some cases, the eye movements are the only intention related activities that can be observed. So we study the eye movements related to grasping. We obtain the fixation messages of participants in grasping and viewing tasks through experiments. These messages are combined with the target centroid and the grasping positions to study the fixation laws under different tasks. Through the experimental results and statistical analysis, we find that fixations are significantly different in the two tasks. In the grasping task, the participants' fixations are closer to the grasp position of the index finger and concentrate on a small area. While in viewing tasks, the distribution of participants' fixations are arbitrary, which may be distributed in multiple parts of the target. This phenomenon has inspired us to use these natural gaze fixations to identify the grasping intention of participants. We first propose four features- the ADF2C, the ADF2I, the ADF2T, and the VAR to describe these differences quantitatively. Utilizing the quantitative features, we can use machine learning methods to recognize the user's grasp intention, and further control the robot to help the user complete the grasp. It is crucial that only the natural gaze fixations of the human are used in our method, and no additional actions or commands are required. Thus, this method is very suitable for patients with hemiplegia. However, not all users' fixations follow the rules we have found. Some users' fixations are close the centroid or the grasp point of the thumb rather than the grasp point of the index finger when grasping. When the user knows the pose and shape of the object in advance, he/she may be able to grasp it without staring at it. Additionally, the work of this paper explores the relationships of the users' fixations in different tasks when the thumb and index finger are visible. For some grasping tasks, the contact position of the index finger is not visible. In the next work, we will explore the laws of fixations in grasping and viewing tasks when not all the grasping points are visible. Furthermore, we intend to apply the method to patients with hemiplegia so that they can complete daily grasping tasks. In conclusion, we are exploiting the clues behind eye movements, which are highly correlated to our motor actions. They are key factors in human motor planning and imply our movement intention. Consequently, gaze tracking becomes a rich source of information about user intent that can be utilized. Fixations reflect the focus of human gaze. We have proved that only a few fixations are needed to quickly and accurately recognize the user's grasping intention. This technology bears a tremendous potential as an interface for human-robot interaction. Moreover, eye-movements are retained in the majority of motor disabilities, which enhances the applicability of eye-tracking technology in the field of human-robot interfaces for the paralysed and in prosthetics. Unlike EMG based and EEG based methods that require long-term training, our method only needs natural eye movement and does not need training. The intention recognition performance of our system are subject to the accuracy of gaze estimation. We hope to improve the accuracy of gaze estimation in the future to achieve more accurate recognition results. Our system allows for straightforward control of the robot for grasping. The application in the real environment has proved its effectiveness. Furthermore, the user's fixations can also provide the location information of the target. If we combine the user's intention with the position information of the object, the user can control the humanoid robotic arm to grasp the object with his eyes only. The ability to recognize the user's grasp intention from fixations enables novel ways of achieving the embodiment in robotic solutions that restore or augment human functions. \addtolength{\textheight}{-12cm} \bibliographystyle{IEEEtran}
{'timestamp': '2020-12-17T02:07:35', 'yymm': '2012', 'arxiv_id': '2012.08703', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08703'}
arxiv
\section{INTRODUCTION} Communities around the world are fighting the COVID-19 pandemic. In the United States alone, more than 50 million cases and 800,000 deaths have been recorded \cite{CDCCOVID}. The most reliable way to end transmission of this and other rapidly spreading diseases is to stop any and all contact between individuals in the population; no interaction means no transmission. While this strategy is extreme, many communities (even nations) implemented some version of this plan in the early weeks and months of the COVID-19 pandemic. These guidelines and mandates for social separation (distancing) were largely successful in slowing the spread of the disease \cite{socialDistancing1, socialDistancing2, socialDistancing3}, but they also prevented healthy people from interacting with each other, hindering global economic activity \cite{econ1, econ2} and leaving many feeling isolated and lonely \cite{lonely1, lonely2}. Reopening schools, businesses and other organizations and returning to a more normal level of interaction is therefore a priority for many communities. However, this does not mean that we must expect and accept community-wide outbreaks; other interventions can be implemented to limit the risk of transmission. Such interventions include (but are not limited to) mask use, vaccinations, viral testing, and contact tracing. This paper quantifies the effect of each of these mitigation strategies on the spread of disease and presents practical guidance for creating policies to maintain low risk of disease outbreak. The analysis that leads to this guidance is performed on a stochastic compartmental model for disease transmission, and the result is a single algebraic criterion (an effective disease reproduction number) based on the implemented interventions. In simulations of infections on random networks (agent-based simulations), this single criterion is able to predict the presence or absence of outbreaks across a vast array of population and disease parameters, whose true values will be unknown to those implementing intervention strategies. The practical guidance produced here was also the foundation of the policies regarding interventions implemented at the Massachusetts Institute of Technology (MIT), which has gradually resumed its normal functioning over the last two years without widespread outbreaks. Policies at other colleges and universities can also be considered in the framework of this analysis, and the outbreak trends at these other institutions are consistent with the analysis presented below given their chosen disease mitigation policies. \section{METHODS} \subsection{Modeling foundations} We begin by applying the principles established by Kermack and McKendrick \cite{SIR_OG} for modeling the spread of infection. This model relies on partitioning the population into different categories (e.g.~Susceptible, Infectious, Recovered or SIR) based on disease status and applying a conservation law on the total population size. The rate of change of the number of people in a particular partition is determined only by the net flow of individuals into or out of that group. Stable dynamics (i.e.~a shrinking infectious population) can be equivalently defined as a positive net flow of people out of the infectious compartment. Many extensions of the SIR model include additional classifications of individuals \cite{SIQRmodel, SEIRModel2, berger2020seir, ageModel}. In our cases, we partition the population into four groups: susceptible, infectious, isolated, and recovered.\footnote{An exposed/latent group, which separates presymptomatic from symptomatic individuals, is not considered in this study due to the high number of COVID-19 cases that never become symptomatic \cite{COVIDAsymptomatic, asympSpread}. Additionally, by ignoring the development of symptoms (and thus detection), we will end up \textit{overestimating} the number of total undetected infections, leading to more conservative policies to prevent outbreaks.} The choice of partitions and the flows between the compartments are depicted in Fig.~\ref{fig:CVdiagram}. The rate of the flow into the infectious class is denoted as $\Phi_{\mathrm{in}}$. The flow out is driven by two mechanisms: recovery ($\Phi_{\mathrm{rec}}$) and detection ($\Phi_{\mathrm{det}}$). \begin{figure* \centering \includegraphics[width=0.9\linewidth]{Figure1.pdf} \caption{Compartmental model for COVID-19 and similar diseases. Individuals join the infectious class (red) by contracting the disease (at a rate $\Phi_{\mathrm{in}}$) and leave by recovering ($\Phi_{\mathrm{rec}}$) or by being detected and subsequently isolated ($\Phi_{\mathrm{det}}$).} \label{fig:CVdiagram} \end{figure*} We can now write a conservation equation for the infectious group: \begin{equation} I_{t+1} - I_t = \Phi_{\mathrm{in}} - \Phi_{\mathrm{rec}} - \Phi_{\mathrm{det}} \label{eq:CVeqn} \end{equation} where $I_t$ is the number of infectious individuals at time $t$. This conservation equation highlights the three levers that we can operate to reduce the spread of the disease and achieve controlled, stable dynamics. The first is reducing the rate of infection ($\Phi_{\mathrm{in}}$), which can be achieved by increasing social distancing, wearing masks, or vaccinating the population. The second is increasing the rate of recovery. This lever is not easy to operate and is dictated by biological constraints and available medical treatments. The final lever, increasing detection, is achieved by ramping up infection testing and contact tracing measures. The objective of this analysis is to provide practical guidance to organizations looking to reopen. For this reason, the model must capture the fact that, in practice, compliance to these intervention strategies may not be perfect; organizations may not be able to mandate particular mitigation strategies and even if they do, individuals may choose not to abide. In order to capture the effect (and danger) of this non-compliance, the model presented here allows for some members of the population to employ the intervention strategies while others abstain. The fraction of the population who are vaccinated $f_v$, who opt into random surveillance testing $f_T$, and who wear masks $f_m$ are therefore all considered. While a person's decision to get vaccinated or to opt into a surveillance testing program is fixed, their decision to wear a mask may vary day-to-day. Such considerations are made in formalizing the partitions and flows between partitions of the model. Stability in the disease dynamics is defined as the case where the size of the infectious population (shown in red in Fig.~\ref{fig:CVdiagram}) is shrinking, meaning this is the partition we are most concerned with modeling. For this study, we will assume that vaccinated individuals and unvaccinated individuals will behave the same way when they are infectious, i.e.~they will have the same ability to transmit the disease and will be equally likely to recover or be tested/detected on a given day. Additionally, because we do not assume masking behavior is constant day-to-day, we need not separate the infectious population into masked and unmasked partitions. Opting into or out of a surveillance testing program, however, is a different story. An individual's testing status (their opt-in or opt-out decision) remains the same over time and infected individuals who are tested will become isolated and leave the infectious population much faster than those who opt-out of testing. Therefore, we need to consider the behavior of the opt-into testing population and the opt-out-of testing population separately, meaning we will examine two conservation principles, one for those opting into testing \begin{equation} I_{t+1,\mathrm{oi}} - I_{t, \mathrm{oi}} = \Phi_{\mathrm{in}, \mathrm{oi}} - \Phi_{\mathrm{rec},\mathrm{oi}} - \Phi_{\mathrm{det},\mathrm{oi}} \label{eq:CVeqnOI} \end{equation} and one for those opting out \begin{equation} I_{t+1,\mathrm{oo}} - I_{t, \mathrm{oo}} = \Phi_{\mathrm{in}, \mathrm{oo}} - \Phi_{\mathrm{rec},\mathrm{oo}} - \Phi_{\mathrm{det},\mathrm{oo}}. \label{eq:CVeqnOO} \end{equation} The next step is defining these flows into and out of the infectious populations. First, we consider the infection process. Infection occurs when an infectious individual successfully transmits the disease to one of their susceptible contacts. To estimate the likelihood of transmission, we must first introduce the basic reproduction number of a disease, denoted $\mathcal{R}_0$. This classic epidemiological parameter is defined as the number of secondary cases resulting from a single infected individual in a fully susceptible population \cite{IntroMathEpid, SIR_OG}. If, for instance, that single infected individual was contagious for $d$ days, had $\hat{x}$ daily contacts (all susceptible individuals), and there was a likelihood of transmitting the disease to each contact (each day) of $\rho$, the basic reproduction number would be \begin{equation} \mathcal{R}_0 = \rho \hat{x} d. \label{eq:R0} \end{equation} This relationship defines the transmission likelihood in the absence of mitigation strategies ($\rho$) in terms of the parameters most often reported for a particular infectious disease, i.e.~$\mathcal{R}_0$ and $d$. The daily number of susceptible contacts $\hat{x}$ will depend on the particular community and will be discussed further below. The transmission likelihood in a given interaction, however, will be reduced when interventions such as mask-wearing and vaccination are implemented. If one person is wearing a mask, the likelihood of transmission is reduced by a factor of $\left(1-\epsilon_m\right)$ where $\epsilon_m$ is the efficacy of mask use at preventing the spread of the disease. If both people in the interaction are wearing masks, the reduction factor is $\left(1-\epsilon_m\right)^2$. Similarly, if the susceptible individual is vaccinated, the transmission likelihood is reduced by a factor of $\left(1-\epsilon_v\right)$ with vaccine efficacy to breakthrough infectious $\epsilon_v$. If the susceptible individual is a testing opt-in individual, they will join the testing opt-in infectious population when they contract the disease. If instead the susceptible individual is a testing opt-out individual, they will join the opt-out infectious population when they contract the disease. All together, these parameters can be used to define the flow of susceptible individuals into the infectious compartments: \begin{equation} \begin{split} \Phi_{\mathrm{in},oi} &= \sum_{j=1}^{I_{t,\mathrm{oi}}}\sum_{k=1}^{X_j} T_k Y_{jk} + \sum_{j=1}^{I_{t,\mathrm{oo}}}\sum_{k=1}^{X_j} T_k Y_{jk} \\ \Phi_{\mathrm{in},oo} &= \sum_{j=1}^{I_{t, \mathrm{oi}}}\sum_{k=1}^{X_j} \left(1-T_k\right) Y_{jk} + \sum_{j=1}^{I_{t, \mathrm{oo}}}\sum_{k=1}^{X_j} \left(1-T_k\right) Y_{jk} \end{split} \end{equation} where $X_j$ is a random variable representing the number of susceptible contacts of infected individual $j$. For now, we will assume we know this distribution and that it has a mean $\mu_x$ and a variance $\sigma^2_x$, though we will find that in determining stability to outbreaks, the basic reproduction number $\mathcal{R}_0$ is sufficient for capturing the critical aspects of this distribution. The testing status (opt-in or opt-out) of the susceptible contact $k$ is captured by the Bernoulli random variable $T_k$ which has parameter $f_T$ and indicates whether or not that individual will join the opt-in or opt-out population upon infection. The random variable $Y_{jk}$ is a Bernoulli random variable with parameter equal to the effective transmission likelihood \begin{equation} \rho_{\mathrm{eff}} = \rho \left(1-\epsilon_m M_j\right)\left(1- \epsilon_m M_k \right)\left( 1- \epsilon_v V_k \right) \label{eq:rhoEff} \end{equation} which itself depends on the normal (no intervention) transmission probability $\rho$, the intervention efficacies $\epsilon_m$ and $\epsilon_v$, and the intervention statuses of both individuals determined by the Bernoulli random variables $M_j$ (mask status of $j$, parameter $f_m$), $M_k$ (mask status of $k$, parameter $f_m$), and $V_k$ (vaccine status of $k$, parameter $f_v$). Next we consider the recovery process. A simple approximation is to assume that each infected individual is equally likely to recover on any given day and that the expected duration for which they are infectious (in the absence of interventions) is $d$. The resulting recovery flows are \begin{equation} \begin{split} \Phi_{\mathrm{det}, \mathrm{oi}} &= \sum_{j=1}^{I_{t, \mathrm{oi}}} Z_{j}\\ \Phi_{\mathrm{det}, \mathrm{oo}} &= \sum_{j=1}^{I_{t, \mathrm{oo}}} Z_{j} \end{split} \end{equation} where $Z_j$ is a Bernoulli random variable with parameter $1/d$. Finally, we consider detection through infection testing and follow-up contact tracing. While only opt-in individuals will be detected through random surveillance testing, both their opt-in and opt-out contacts may be identified and isolated through follow-up contact tracing. In the surveillance (random) testing group, any member is equally likely to be selected for testing on a given day (with probability $\nu$, the daily testing frequency). If an individual tests positive, their contacts are traced and tested. Isolating contacts only has a substantial effect on disease dynamics when those contacts themselves are infectious at the time of tracing. At the previous time step, each contact had a likelihood $\rho_{\mathrm{eff}}$ of having been infected by person $j$. Using this as the likelihood that contact $k$ is infected at the current time step will \textit{underestimate} the number of infectious contacts (because person $j$ may have been infecting their contacts for more than one day), which will lead to more conservative stability bounds. We also consider that not all contacts will be successfully traced, an event which happens with likelihood $\epsilon_c$. Each contact therefore has a probability $\epsilon_c \rho_{\mathrm{eff}}$ of being detected as infectious through contact tracing. Together, the number of infectious individuals removed from the infectious groups by detection via both random testing and contact tracing are \begin{equation} \begin{split} \Phi_{\mathrm{det}, \mathrm{oi}} &= \sum_{j=1}^{I_{t,\mathrm{oi}}} V_j \left(1 + \sum_{k=1}^{X_j} T_k W_{jk} \right) \\ \Phi_{\mathrm{det}, \mathrm{oo}} &= \sum_{j=1}^{I_{t,\mathrm{oi}}} V_j \left(0+ \sum_{k=1}^{X_j} \left(1-T_k\right)W_{jk} \right) \end{split} \end{equation} where $V_j$ (random testing) and $W_{jk}$ (tracing) are Bernoulli random variables with parameters $\nu$ and $\epsilon_c \rho_{\mathrm{eff}}$ respectively. Again, the testing status is captured in the random variable $T_k$ as defined above and the transmission probability $\rho_{\mathrm{eff}}$ is affected by the mask and vaccine statuses of the individuals involved (see Eq.~\ref{eq:rhoEff}). Using the the constitutive relationships defined above and the conservation laws of Eq.~\ref{eq:CVeqnOI}-\ref{eq:CVeqnOO}, we can rewrite the equations for the evolution of the number of infectious individuals in each testing group: \begin{equation} \begin{split} I_{t+1, \mathrm{oi}} &= I_{t, \mathrm{oi}} + \sum_{j=1}^{I_{t, \mathrm{oi}}} \left[\left(\sum_{k=1}^{X_j} T_k \left(Y_{jk} - V_j W_{jk}\right)\right) - Z_j \left(1-V_j\right) - V_j \right] + \sum_{j=1}^{I_{t,\mathrm{oo}}}\left[ \sum_{k=1}^{X_j} T_k Y_{jk} \right] \\ I_{t+1, \mathrm{oo}} &= I_{t, \mathrm{oo}} + \sum_{j=1}^{I_{t, \mathrm{oi}}} \left[\sum_{k=1}^{X_j} \left(1-T_k\right) \left(Y_{jk} - V_j W_{jk}\right)\right] + \sum_{j=1}^{I_{t,\mathrm{oo}}}\left[\left( \sum_{k=1}^{X_j} \left(1-T_k\right) Y_{jk} \right) - Z_j\right]. \end{split} \label{eq:stochasticDiff} \end{equation} Here, we have made one additional correction. The recovery removal for each member of the opt-in population is $Z_j\left(1-V_j\right)$ to avoid double counting people who recover on the same time step that they test positive. This ensures we are not overestimating the flow out of the infectious population, hence our results will remain conservative. \subsection{Stability analysis} The disease dynamics in a community are considered stable if a randomly infected individual will not be able to spread the disease to others in the community before being detected or recovering. In a real (stochastic) environment it will always be possible for a single infection to lead to a widespread outbreak, as in the case of ``superspreader" events where a single infectious individual has many more contacts than usual on a single day and will likely be able to spread the disease before being identified. To capture the dynamics, therefore, we consider the mean and variance of the evolution of the number of infectious individuals at a given time. The mean dynamics are found by taking the expectation of Eq.~\ref{eq:stochasticDiff} for the full stochastic process. Doing so leads us to find a 2-by-2 transition matrix: \begin{equation} \textbf{A} = \left[\begin{array}{cc} a_{11} & a_{12} \\ a_{21} & a_{22} \end{array} \right] = \left[\begin{array}{cc} 1+\hat{\rho}_{\mathrm{eff}}\mu_x f_T \left(1-\nu \epsilon_c\right) - \left(\frac{1}{d} + \nu - \frac{\nu}{d}\right)& \hat{\rho}_{\mathrm{eff}} \mu_x f_T \\ \hat{\rho}_{\mathrm{eff}}\mu_x \left(1-f_T\right)\left(1-\nu \epsilon_c\right) & 1+ \hat{\rho}_{\mathrm{eff}} \mu_x \left(1-f_T\right) - \frac{1}{d} \end{array} \right] \end{equation} such that \begin{equation} \left(\begin{array}{cc} \mathbb{E}\left[ I_{t+1, \mathrm{oi}}\right] \\ \mathbb{E} \left[I_{t+1, \mathrm{oo}}\right] \end{array}\right) = \textbf{A} \left(\begin{array}{cc} \mathbb{E} \left[I_{t, \mathrm{oi}} \right]\\ \mathbb{E} \left[I_{t, \mathrm{oo}}\right] \end{array} \right). \label{eq:2by2} \end{equation} Here, we have used \begin{equation} \hat{\rho}_{\mathrm{eff}} = \mathbb{E}\left[\rho_{\mathrm{eff}}\right] = \rho \left(1- \epsilon_m f_m\right)^2 \left(1-\epsilon_v f_v\right). \end{equation} Stability in the mean dynamics therefore is achieved when the eigenvalues of $\textbf{A}$, the transition matrix, are both less than 1. Finding the eigenvalues of the matrix in Eq.~\ref{eq:2by2} leads to a single stability criterion; this system is stable if \begin{equation} 1 > \rho \mu_x d \left(1-\epsilon_m f_m\right)^2 \left(1- \epsilon_v f_v\right)\left(f_T \frac{1-\nu \epsilon_c}{1+\nu\left(d-1\right)} + \left(1-f_T\right)\right) \label{eq:stability} \end{equation} Notice, the mean value of the distribution $X$ (the number of susceptible contacts of an infectious individual) appears in this expression, implying that we need to know something about the underlying distribution, information that is typically unavailable. In analyzing stability to create practical guidance for intervention measures, this distribution (particularly its mean) need not be known exactly, but we do need an upper bound on this value to ensure that we overestimate disease transmission and determine conservative values for mitigation requirements. To estimate this upper bound, we return to the discussion of the basic reproduction number $\mathcal{R}_0$ (see Eq.~\ref{eq:R0}). Certainly, assuming that all of an individual's contacts are susceptible (which is implied in the $\hat{x}$ of the basic reproduction number) is an overestimate of the true number of susceptible contacts that an individual has. However, we are not considering the number of susceptible contacts that any random individual in the population has; we are considering the number of susceptible contacts that an \textit{infected} individual has, which, akin to the friendship paradox, is expected to be higher than that of non-infected individuals \cite{KojakuSadamori2021_friendship}. In this case, $\hat{x}$ is still a reasonable (over)estimate for $\mathbb{E}\left[X\right]$ because it is inferred from the measured $\mathcal{R}_0$ (based on infection case data), which naturally incorporates the tendency of a disease to spread to highly-connected individuals \cite{HeffernanJM2005_measureR0, KEELINGMATTJ2000_measureR0, DelamaterPaulL2019ComplexR0, LiJing2011T_failureR0}. In conclusion, the term $\rho\mu_x$, which contains parameters that are unknown and difficult to measure, can be rewritten as $\mathcal{R}_0/d$ without jeopardizing confidence in the resulting stability bound. Now we return to Eq.~\ref{eq:stability} to redefine it in more familiar terms, i.e.~in terms of an effective reproduction number $\mathcal{R}_{\mathrm{eff}}$: \begin{equation} \mathcal{R}_{\mathrm{eff}} = \mathcal{R}_0 \left(1-\epsilon_m f_m\right)^2 \left(1- \epsilon_v f_v\right)\left(f_T \frac{1-\nu \epsilon_c}{1+\nu\left(d-1\right)} + \left(1-f_T\right)\right) < 1 \label{eq:ReffStability} \end{equation} which ensures stability of the system. The implications of this expression, i.e.~how it can be used to quantify trade-offs between mitigation strategies, are discussed in the following sections. One important note, however, is that this expression depends on the underlying network of the community only through the basic reproduction number $\mathcal{R}_0$, a commonly measured and reported value for a disease. No further information about the network, such as the variance in the distribution of contacts $X$, is required to determine a sufficient balance of interventions to ensure stability. Having explored the evolution of the mean number of infectious individuals, we now turn to the evolution of the variance. All of these dynamic equations together can be written as \begin{equation} \left(\begin{array}{cc} \mathbb{E}\left[ I_{t+1, \mathrm{oi}}\right] \\ \mathbb{E} \left[I_{t+1, \mathrm{oo}}\right] \\ \mathrm{var} \left(I_{t+1, \mathrm{oi}} \right)\\ \mathrm{var} \left(I_{t+1, \mathrm{oo}} \right) \end{array}\right) = \left[\begin{array}{cccc} a_{11} & a_{12} & 0 & 0 \\ a_{21} & a_{22} & 0 & 0 \\ b_{11} & b_{12} & a_{11}^2 & a_{12}^2 \\ b_{21} & b_{22} & a_{21}^2 & a_{22}^2 \end{array} \right] \left(\begin{array}{cc} \mathbb{E} \left[I_{t, \mathrm{oi}} \right]\\ \mathbb{E} \left[I_{t, \mathrm{oo}}\right] \\ \mathrm{var} \left(I_{t, \mathrm{oi}} \right)\\ \mathrm{var} \left(I_{t, \mathrm{oo}} \right) \end{array} \right). \label{eq:4by4} \end{equation} where the elements $b_{11}, b_{12}, b_{21},$ and $b_{22}$ are functions of the disease and mitigation parameters defined as: \begin{equation} \begin{split} b_{11} &= \mu_x f_T \hat{\rho}_{\mathrm{eff}} \left(1- f_T \hat{\rho}_{\mathrm{eff}}\right)+ \sigma_x^2 \left(f_T \hat{\rho}_{\mathrm{eff}}\right)^2 \\ & \qquad + \nu \left( \mu_x f_T \hat{\rho}_{\mathrm{eff}} \epsilon_c \left(1- f_T \hat{\rho}_{\mathrm{eff}} \epsilon_c\right) + \sigma_x^2 \left(f_T \hat{\rho}_{\mathrm{eff}}\epsilon_c\right)^2 \right) \\ & \qquad + \nu \left(1-\nu\right) \left(1+ \mu_x f_T \hat{\rho}_{\mathrm{eff}}\epsilon_c\right)^2 + \frac{1}{d} \left(1- \frac{1}{d}\right) \\ b_{12} &= \mu_x f_T \hat{\rho}_{\mathrm{eff}} \left(1- f_T \hat{\rho}_{\mathrm{eff}} \right) + \sigma_x^2 \left (f_T \hat{\rho}_{\mathrm{eff}} \epsilon_c \right)^2 \\ b_{21} &= \mu_x \left(1-f_T\right) \hat{\rho}_{\mathrm{eff}} \left(1- \left(1-f_T\right)\hat{\rho}_{\mathrm{eff}}\right) + \sigma_x^2 \left(\left(1-f_T\right)\hat{\rho}_{\mathrm{eff}}\right)^2 \\ & \qquad + \nu \left(\mu_x \left(1-f_T\right)\hat{\rho}_{\mathrm{eff}} \epsilon_c \left(1- \left(1-f_T\right)\hat{\rho}_{\mathrm{eff}}\epsilon_c\right) + \sigma_x^2 \left(\left(1-f_T\right)\hat{\rho}_{\mathrm{eff}}\epsilon_c\right)^2 \right) \\ & \qquad +\nu \left(1-\nu\right) \left(\mu_x \left(1-f_T\right) \hat{\rho}_{\mathrm{eff}}\epsilon_c \right)^2\\ b_{22} &= \mu_x \left(1-f_T\right) \hat{\rho}_{\mathrm{eff}} \left(1-\left(1-f_T\right) \hat{\rho}_{\mathrm{eff}}\right) + \sigma_x^2 \left(\left(1-f_T\right)\hat{\rho}_{\mathrm{eff}}\right)^2 + \frac{1}{d}\left(1-\frac{1}{d}\right) \end{split}. \end{equation} While these expressions are cumbersome, there are two important results to discuss. First, while only the mean number of contacts of an infectious individual ($\mu_x$) appeared in the expression for the mean dynamics (which was then related to $\mathcal{R}_0$), the variance in this distribution $\sigma_x^2$ appears in this set of equations. Second, even though the variance $\sigma_x^2$ appears, it does not affect the stability requirements. Given the structure of this transition matrix, its eigenvalues are less than 1 when the eigenvalues of the matrix $\textbf{A}$ are less than 1. The effective reproduction number $\mathcal{R}_{\mathrm{eff}}$ from Eq.~\ref{eq:ReffStability} remains a sufficient stability criterion for both the mean and variance of the number of infectious individuals. \subsection{Simulating infection} To test the analytic result derived above in Eq.~\ref{eq:ReffStability}, we implemented an infection simulation on a fixed population. In these simulations, a population network is established at the outset, where every member of the population is a node in the network and every edge represents a contact between two people. Such networks are difficult to estimate for a real population, but generating random networks with wide ranges of structures and properties is straightforward. Fig.~\ref{fig:NetworkComparison} shows random network realizations for four different structure types---Erd\H{o}s-R\'{e}nyi, Uniform, Scale-free, and Small World---and their resulting degree distributions. \begin{figure}[htp] \hspace{-1cm} \includegraphics[clip,width=0.6\columnwidth]{Ploterdos.png}% \hspace{-1cm} \includegraphics[clip,width=0.6\columnwidth]{Plotuniform.png}% \hspace{-1cm} \includegraphics[clip,width=0.6\columnwidth]{Plotbarabasi.png}% \hspace{-1cm} \includegraphics[clip,width=0.6\columnwidth]{Plotstrogatz.png}% \caption{Sample realizations of four different network structures and their resulting degree distributions. Intervention-free infection was simulated on each network to make a measurement of $\mathcal{R}_0$. The required testing to stabilize the system was determined using Eq.~\ref{eq:testingReqFull} and another infection simulation was implemented with testing just above this stabilizing value. Both infection progressions are show: intervention-free (red) and with stabilizing testing (blue).} \label{fig:NetworkComparison} \end{figure} Once the underlying network of connections is established, each individual is assigned to one of the partitions of the model as well as to vaccine and testing statuses. At each time step, the infection status of each individual is updated. If a person is infectious, they infect their susceptible neighbors with probability $\rho_{\mathrm{eff}}$ at each time, where $\rho_{\mathrm{eff}}$ is determined by the vaccine and masking status of the individuals involved. If an individual is infectious at time $t$, they recover at $t+1$ with probability $1/d$. The opt-in individuals will become isolated if they are detected through random testing with probability $\nu$. If they are detected, each of their infectious neighbors has a probability $\epsilon_c$ of also joining the isolated population. Isolated individuals will eventually recover and do so with probability $1/d$ at each time step. The simulation continues until there are no longer any infectious individuals remaining or for a fixed number of days. \section{RESULTS} \subsection{Balancing mitigation strategies: analysis} Having performed the stability analysis, we turn our attention to the practical implications of the effective reproduction number of Eq.~\ref{eq:ReffStability}. The stability criterion ($\mathcal{R}_{\mathrm{eff}} < 1$) can be rearranged to provide guidance on how much of each mitigation strategy an organization should employ to ensure their reopening does not lead to widespread outbreaks. \subsubsection{Without testing} Let us first consider the case where no testing is done $\nu = 0$, which is also equivalent to the case where testing is available (nonzero $\nu$) but no one opts into the program ($f_T= 1$). This will be the case for the many organizations that do not have access to testing resources or the funding to secure them. It would also be the case for organizations where the vast majority of individuals are opposed to being testing and a testing requirement cannot be implemented. In this case, the stability criterion simplifies to \begin{equation} 1 > \mathcal{R}_0 \left(1-\epsilon_m f_m\right)^2 \left(1- \epsilon_v f_v\right) = \mathcal{R}_{\nu = 0} \label{eq:noTesting} \end{equation} In the absence of masking and vaccinations, this simplifies to the well-known result for stable dynamics in the mitigation-free case: $1 > \mathcal{R}_0$. Implementing masking and/or vaccination requirements, however, will allow for controlled dynamics even in the case of basic reproduction numbers larger than 1. First let us consider the effect of masking in the absence of vaccines, as would be the case at the beginning of a disease epidemic when vaccines may not exist or may not be widely available. Given a disease ($\mathcal{R}_0$) and the efficacy of masks at preventing transmission of that disease $\epsilon_m$, we can determine the fraction of the population that must be masked in order to ensure stability to disease outbreaks: \begin{equation} f_m > \frac{1- \frac{1}{\sqrt{\mathcal{R}_0}}}{\epsilon_m}. \end{equation} We are of course limited by the fact that no more than 100\% of the population can be masked at a given time. Meaning if $\mathcal{R}_0 > 1/\left(1-\epsilon_m\right)^2$, the disease cannot be controlled by masking alone. Similar analysis can be performed to determine the effect of vaccination on the spread of a disease. Because compliance to masking can be difficult to ensure and because masking can be unpleasant and a hindrance to some activities, we now aim to determine what fraction of the population needs to be vaccinated to ensure that, in the absence of testing, no masking is required. The required vaccinated fraction is \begin{equation} f_v > \frac{1- \frac{1}{\mathcal{R}_0}}{\epsilon_v}. \label{eq:vaxMandate} \end{equation} This recovers the classical definition of \textit{herd immunity}, i.e.~the fraction of the population that needs to be vaccinated to control the spread of a disease. Similar to the analysis of masking, we are limited by the fact that no more than 100\% of the population can be vaccinated, the result being that only diseases with $R_0 < 1/\left(1-\epsilon_v\right)$ can be controlled by vaccine mandates alone. In reality, less than 100\% of the population will be vaccinated, and if Eq.~\ref{eq:vaxMandate} does not hold for that value of $f_v$, additional mitigation strategies will be required to ensure stable disease dynamics. Such additional strategies may include masking (and the combined effects of these two interventions together is captured in Eq.~\ref{eq:noTesting}) or testing and contact tracing, as discussed below. \subsubsection{With testing} Now we will consider the case where testing resources are available to a given organization. We will first assume that participation in the testing program is mandatory for all individuals, i.e.~$f_T = 1$. In this case, the stability criterion of Eq.~\ref{eq:ReffStability} simplifies to \begin{equation} 1 > \mathcal{R}_{\nu=0} \left(\frac{1-\nu \epsilon_c}{1 + \nu \left(d-1\right)}\right). \end{equation} where $\mathcal{R}_{\nu=0}$ is the effective reproduction number in the absence of testing but includes the effects of masking and vaccinations (see Eq.~\ref{eq:noTesting}). This expression can be rearranged to determine the minimum required daily testing fraction \begin{equation} \nu_{f_T = 1} > \frac{\mathcal{R}_{\nu=0} -1}{\epsilon_c \mathcal{R}_{\nu=0} + d - 1}. \label{eq:testingMin} \end{equation} Again, this expression holds for the case where everyone opts into the testing program. We also recover the fact that if the masking and vaccine interventions can drive the effective reproduction number $\mathcal{R}_{ \nu=0}$ below 1, then no testing is required ($\nu_{f_T=1} = 0$). We further recover the result that if $R_0 < 1$, even without masking and vaccines, no testing is required to ensure stability to disease outbreaks. Unlike the masking and vaccinated fractions ($f_m$ and $f_v$), the daily testing fraction can exceed $1$, meaning individuals are tested (on average) more than once per day. In reality, this is unlikely due to available testing resources. Additionally, rather than random testing, organizations may prefer to perform fixed-cadence testing for simpler logistical implementation. For instance, organizations may choose to test once a day (with an effective testing fraction $\nu=1$), once a week ($\nu = 1/7$), or once every two weeks ($\nu = 1/14$). Even if the testing capability is larger than the given effective testing fraction, organizations may still opt to test on a regular cadence to keep the implementation as easy as possible. Finally, before discussing the case where individuals only participate in the testing program voluntarily ($f_T < 1$), the effect of contact tracing must be noted. By examining Eq.~\ref{eq:testingMin}, we see that less contact tracing (lower efficacy $\epsilon_c$) corresponds to increased required daily testing fractions and thus increased required daily testing resources. Organizations with the capability to do contact tracing (and to do so at little to no cost) should therefore employ this strategy to reduce the burden and cost of testing. Next we consider the case where not all individuals are required to participate in surveillance testing (or if they are required to but are not compliant). Eq.~\ref{eq:ReffStability} can again be rearranged to provide guidance on how much testing must be done in this case: \begin{equation} \nu > \frac{\mathcal{R}_{\nu=0} -1}{\left[f_T\epsilon_c - \left(1-f_T\right) \left(d-1\right)\right]\mathcal{R}_{\nu=0} + d - 1 } \label{eq:testingReqFull} \end{equation} where again, $\mathcal{R}_{\nu=0}$ is the effective reproduction number in the presence of masking and vaccinations but the absence of testing (see Eq.~\ref{eq:noTesting}). This expression captures the effect of all of the mitigation strategies we have explored. Given the masking ($f_m$), vaccination ($f_v$), and testing ($f_T$) requirements of an organization, this relationship determines the amount of daily testing that must be done ($\nu$) to ensure reopening without risk of causing widespread outbreaks of a specific disease ($\mathcal{R}_0, d$). If an organization does not have sufficient resources to perform this level of daily testing, they can alter their requirements for the other mitigation strategies to lower the needed testing. \subsection{Balancing mitigation strategies: example} While the trade-offs between the discussed mitigation strategies are fully expressed in Eq.~\ref{eq:testingReqFull}, they are nonlinear and perhaps difficult to imagine. In this section, an illustration of these trade-offs is provided for a specific set of disease parameters. These parameters loosely correspond to the reported values for the Delta variant of SARS-CoV-2. The selected basic reproduction number is $\mathcal{R}_0 = 5$ \cite{deltaR0_5}; the length of the contagious period is $d=14$ days \cite{d_14}; and the efficacies of masking and vaccinations are $\epsilon_m = 0.25$ \cite{hosoi2021estimating} and $\epsilon_v = 0.65$ \cite{vaccineEfficacy}. For this particular disease, we consider four scenarios: no masking and no vaccines ($f_m = f_v = 0$), only masking with full compliance ($f_m = 1, f_v = 0$), only vaccinating with full compliance ($f_m = 0, f_v =1$), and full compliance on both masking and vaccination mandates ($f_m=f_v=1$). In each scenario, we consider the full spectrum of compliance to participation in a testing program ($f_T = [0,1]$), and testing scenarios from none at all to daily testing for everyone ($\nu = [0,1]$). In all scenarios, contacts of infectious individuals are assumed to be successfully identified and tracked down with efficacy $\epsilon_c = 0.8$. Using these values and Eq.~\ref{eq:testingReqFull}, a stability boundary was determined in the space spanning the testing frequency ($\nu$) and testing compliance ($f_T$) for each of these scenarios. This stability boundary is shown for each of the four scenarios as white lines in Fig.~\ref{fig:tradeoffs}. If the combination of daily testing fraction and fraction of the population opting-in to the testing program falls above the stability boundary (in a blue region in Fig.~\ref{fig:tradeoffs}), the mitigation strategies in place will lead to successful prevention of widespread outbreaks of this disease. If instead a community's testing program parameters fall below the stability boundary (in a red region in Fig.~\ref{fig:tradeoffs}), that community would be susceptible to outbreaks. \begin{figure \centering \includegraphics[trim = 100 50 100 0, clip, width=1\columnwidth]{tradeoffsFinal.png} \caption{Trade-offs between mitigation strategies. Infection of a disease similar to the Delta variant of SARS-CoV-2 with $\mathcal{R}_0 = 5$ and $d = 14$ was simulated on random networks of various structures under random intervention combinations. The analytical stability boundary is shown as a white line separating the controlled region (blue background) from the uncontrolled region (red background). Points represent the average over 100 infection simulations for the same set of parameters on a random network whose structure is represented by point shape.} \label{fig:tradeoffs} \end{figure} To further illustrate the separation of stable and unstable dynamics, the propagation of a disease with these parameters was simulated on 200 random networks (50 for each scenario) comprised of 5000 nodes with a randomly selected testing program ($f_T, \nu$ combination). The structure and properties of these networks were selected randomly from the ranges specified in Table \ref{table:MC}. In Fig.~\ref{fig:tradeoffs}, each simulated network is represented as a point whose shape indicates its network structure and whose color represents the percent of the population that became infected with the disease over 180 days (averaged over 100 random infection progressions for initial seeded infections of $I_0 = 5$). Notice, the color scale is nonlinear; blue-to-white points represent those where each initially infected individual ($5$ people) spread the disease to, on average, fewer than one other individual ($<10$ people infected total), while white-to-red points represent those where the disease spread more than that, up to propagating through the entire population (5000 people). The simulation results are consistent with the stability analysis performed above. The results in Fig.~\ref{fig:tradeoffs} are an illustration of the analysis presented in this paper only for one specific disease (based on the Delta variant of SARS-CoV-2), but the analysis will hold for diseases of all parameters. For instance, in the case of both mask and vaccine mandates (the lower right plot of Fig.~\ref{fig:tradeoffs}), some amount of regular testing and compliance to testing is required to ensure a community will be stable to widespread outbreaks of this disease. However, if a different set of disease parameters were selected, e.g.~ones based on the Alpha variant of SARS-CoV-2 which will have a lower basic reproduction number and against which vaccines will be more effective \cite{vaccineEfficacy, d_14}, mask and vaccine mandates would be sufficient for controlling the spread of the disease (see Eq.~\ref{eq:noTesting}), and testing would no longer be needed. Finally, while Fig.~\ref{fig:tradeoffs} only shows four scenarios based on the absence/presence of fully compliant masking and/or vaccine mandate, compliance to either mandate in practice would likely fall somewhere in between. The stability boundary in these scenarios can still be calculated using Eq.~\ref{eq:testingReqFull} and used to determine the requirements of a successful testing program. \subsection{Network (in)dependence} The simulations whose results are shown in Fig.~\ref{fig:NetworkComparison} and Fig.~\ref{fig:tradeoffs} both begin to suggest the minimal role of the network parameters on the stability criterion. All relevant network information is captured in the value of $\mathcal{R}_{0}$; no additional information about the network structure or degree distribution is required. This result is clear from the expression for the effective reproduction number (Eq.~\ref{eq:ReffStability}) but is further illustrated by performing a Monte Carlo simulation of the parameter space. \begin{figure} \includegraphics[trim = 0 125 0 0, clip, width=0.8\columnwidth]{plot1Dfinal.png} \caption{Monte Carlo infection simulation. Intervention strategies, intervention efficacies, disease parameters, and network parameters were all generated randomly. The mean total fraction of the population which became infected over 100 trials at each combination of parameters is shown (via point color) against the effective reproduction number $\mathcal{R}_{\mathrm{eff}}$. This single parameter successfully separates the controlled and uncontrolled infection outbreaks denoted by blue and red backgrounds respectively.} \label{fig:oneDplot} \end{figure} The results of this Monte Carlo simulation are shown in Fig.~\ref{fig:oneDplot} and the ranges from which all the parameters were sampled are listed in Table \ref{table:MC}. Networks of 5000 nodes were generated and seeded randomly with 5 initial infections. Fig.~\ref{fig:oneDplot} presents the fraction of the population that became infected over the whole simulated epidemic (on average over 100 random infection progressions) against the $\mathcal{R}_{\mathrm{eff}}$ (computed from the randomly selected combination of parameters using Eq.~\ref{eq:ReffStability}). For all combinations and networks, only this effective reproduction number is required to predict whether outbreaks are limited to $<1\%$ of the population or spread to nearly everyone. While the exact number of individuals who become infected may vary, the presence or absence of an outbreak is well predicted by the effective reproduction number, regardless of the network structure. Again, this is consistent with the analysis in which $\mathcal{R}_0$ captures all of the relevant network information; no further information about the distribution of edges (contacts) in the network, e.g.~the mean or variance of this distribution, is required to determine what combination of mitigation strategies will successfully lead to controlled disease dynamics. \begin{table}[htbp] \caption{The ranges for each parameter that was sampled randomly and used in an infection simulation.} \begin{center} \begin{tabular}{l c|c|c} \multicolumn{2}{c|}{\textbf{Parameter}}&\textbf{Description}&\textbf{Range}\\ \hline{} Disease & $\mathcal{R}_0$ & basic reproduction number & 3--13 \\ & $d$ & contagious period (days) & 5--15 \\ \hline Intervention & $\epsilon_m$ & mask efficacy & 0--1 \\ & $\epsilon_v$ & vaccine efficacy & 0--1 \\ & $\epsilon_c$ & contact tracing efficacy & 0--1 \\ & $f_m$ & fraction masked & 0--1 \\ & $f_v$ & fraction vaccinated & 0--1 \\ & $f_T$ & fraction opting-in to testing & 0--1 \\ & $\nu$ & daily testing fraction & 0--1 \\ \hline Network & & & \\ \textit{Erd\H{o}s-R\'{e}nyi} & $\mu_{\mathrm{ER}}$ & mean degree & 5--25 \\ \textit{Uniform} & $x_{\mathrm{min,U}}$ & minimum degree & 1--10 \\ & $x_{\mathrm{max,U}}$ & maximum degree & 10--20 \\ \textit{Scale-free} & $\alpha_{\mathrm{SF}}$ & distribution power law & 3--5 \\ & $x_{\mathrm{min,SF}}$ & minimum degree & 1--20 \\ \textit{Small World} & $\mu_{\mathrm{SW}}$ & mean degree & 5--25 \\ & $\beta_{\mathrm{SW}}$ & rewiring probability & 0--1 \end{tabular} \label{table:MC} \end{center} \end{table} \section{DISCUSSION} \subsection{Comparison to university case data} This analysis was performed to inform policy making for semi-contained organizations with a limited number of individuals, universities in particular. Since the large-scale shutdowns of the early COVID-19 pandemic, most universities have returned to nearly full operation using some combination of the mitigation strategies discussed above. Few universities have reported widespread outbreaks since their reopenings. This is consistent with our analysis and may be because schools are implementing a sufficient combination of mitigation strategies to prevent such outbreaks. However, a lack of reported outbreaks does not necessarily imply stability; universities may not be reporting outbreaks because they are simply not detecting them. Detection requires regular viral testing of some kind. If schools are testing regularly, they would detect outbreaks. However, testing weekly would also be a sufficient way to ensure that there are no outbreaks.\footnote{The Delta variant of SARS-CoV-2 was discovered after the vaccine was developed, and as seen in Fig.~\ref{fig:tradeoffs}, weekly testing in the case of a highly vaccinated population is sufficient for controlling the spread of this disease regardless of masking behavior. In reality, compliance to vaccine requirements will be less that $100\%$, but weekly testing is likely still sufficient provided enough individuals opt-into the program. Therefore, schools that are testing their members once a week are implementing mitigation strategies that our analysis suggests are sufficient for preventing outbreaks.} Universities that are not testing may not be in the stable disease dynamics regime but may also not detect instability. Case data can also be misleading as cases can go up at a university even if appropriate mitigation strategies are in place. This happens because each day there can be interactions between those inside the community (e.g.~students at the school) and those outside the community (e.g.~individuals in the town or city in which the school is located). These interactions effectively lead to new ``seed" infections in the community population. While the policies in place at the university can control whether or not these seeds grow, they may be limited in the control of how often the seeds are planted; the seeding rate will depend more on the overall prevalence of the disease in the area. Separating case data at a university by the origin of the infection (from intra-community or extra-community interactions) is a complex data task beyond the scope of this analysis. \subsection{Generality of results} While this work was originally inspired by the necessity to use testing and other interventions to control the spread of COVID-19, the results depend neither on the details of the disease nor on the details of the population structure. Given some estimate of the parameters of a disease's proliferation, the stability analysis performed in this paper gives general guidelines on what successful testing programs require based on the adherence to masking and/or vaccination policies by individuals in the population. The resulting stability criterion interestingly \emph{does not} depend on the variance of the underlying network of the community. Highly connected individuals only impact the dynamics through their contribution to the measured basic reproduction number $\mathcal{R}_0$. This simplifies the analysis of the spread of an epidemic as all the relevant network details are captured in the measured $\mathcal{R}_0$, allowing one to evaluate mitigation strategies for all communities, not just those whose interaction behaviors are roughly homogeneous. Hence in examining the impact of interventions on \textit{stability}, higher complexity network models (those with additional information about the underlying community structure) are unnecessary. Analyses that go beyond stability, e.g.~predicting the exact size of an outbreak rather than whether or not an outbreak will exist, require models that contain more detailed network information \cite{SakaguchiInhomogeneous,RadicchiOutbreakSize}. However, for the prevention of widespread outbreaks, the stability criterion presented in Eq.~\ref{eq:ReffStability} is sufficient for capturing the effect of different mitigation strategies in a way that allows policy makers to balance trade-offs, given their available resources, how to reopen their schools, businesses, and other organization safely amidst a pandemic. \bibliographystyle{plain}
{'timestamp': '2022-02-02T02:26:15', 'yymm': '2012', 'arxiv_id': '2012.08755', 'language': 'en', 'url': 'https://arxiv.org/abs/2012.08755'}
arxiv
\section{Introduction} \label{Section:Introduction_IFB} \input{Introduction_IFB.tex} \section{Problem Formulation} \label{Section:Problem_IFB} \input{Problem_IFB.tex} \section{Statement of the Main Results} \label{Section:Main_IFB} \input{Main_IFB_symmetric.tex} \section{Proof of Theorem~\ref{THM:Capacity_IFB}: Outer Bounds} \label{Section:Converse_IFB} \input{Converse_IFB.tex} \section{Proof of Theorem~\ref{THM:Ach_IFB}: Transmission Protocol} \label{Section:Achievability_IFB} \input{Achievability_IFB_March2020.tex} \section{Proof of Theorem~\ref{THM:InnerBound_IFB}} \label{Section:Achievability_InnerBound_IFB} \input{Achievability_InnerBound_IFB.tex} \section{Discussion on Other Regimes and Connection to Blind Index Coding} \label{Section:Discussion_IFB} The authors conjecture that the outer-bound region of Theorem~\ref{THM:Capacity_IFB} is also fact the capacity region of the two-user erasure broadcast channel with intermittent feedback considered in Theorem \ref{THM:InnerBound_IFB}. We believe the transmission strategy needs to be improved to provide a smooth transition between global delayed CSI scenario and the one-sided scenario. As we discussed briefly in Section~\ref{Section:Achievability_IFB}, the transmission strategy under the one-sided feedback assumption~\cite{ISIT19sclin} requires careful utilization of the available feedback in all phases of communication. However, in Case 2 of Theorem~\ref{THM:Ach_IFB} and in the proof of Theorem~\ref{THM:InnerBound_IFB}, we do not utilize feedback during certain phases of communications. The reason why the achievable rates do not degrade by ignoring feedback during Phase 3 of each iteration of Case~2 lies in the specific assumptions on channel parameters: we assume fully correlated feedback links and thus, transmitter wither has delayed feedback from both receivers or from no one. The story is more complicated for Theorem~\ref{THM:InnerBound_IFB}. In the BIC phase, we have a BC in which a fraction of the bits for each receiver is available to the other one but the transmitter does not know which ones. However, different to the BIC problem in \cite{kao2016blind}, now we have additional (intermittent) feedback. To simplify the scheme, we provide signals intended for each receiver to both. However, using feedback one can indeed improve upon this scheme and improve the rates. Unfortunately, we face the following challenges: (1) the scheme becomes rather complex even if we assume after the BIC step feedback links are no longer intermittent; (2) even for erasure BIC without feedback, the capacity is not provided in \cite{kao2016blind}. Not to mention our more complicated setting. Thus, the BIC with feedback is an interesting yet challenging problem that needs to be solved before we can fully address the capacity region of the two-user erasure broadcast channel with intermittent feedback. Ideally, the transmission strategy should cover both extreme cases of DD and DN, and this is an ongoing part of our research. \section{Conclusion} \label{Section:Conclusion_IFB} We developed new outer bounds on the capacity region of two-user erasure BCs with intermittent feedback. We also showed that these outer bounds are achievable under certain assumptions on channel parameters. The next step is to characterize the capacity region for all channel parameters. We conjecture the outer bounds are tight, and the region given in Theorem~\ref{THM:Capacity_IFB} is in fact the capacity region. However, we need to solve BIC with (intermittent) feedback as an intermediate step before settling this conjecture. An interesting future direction is consider the scenario in which receivers can encode the feedback messages, and find the minimum required feedback bandwidth to achieve the global feedback performance with only intermittent feedback. Finally, in~\cite{vahid2016two}, two-user erasure interference channels~\cite{vahid2014capacity} with local delayed feedback were studied. There, it was shown that each transmitter must at least know the delayed CSI of the links connected to it in order to achieve the global delayed CSI performance. For distributed transmitters, understanding the capacity region of the two-user erasure interference channel with intermittent feedback would be the starting point. \bibliographystyle{ieeetr}
{'timestamp': '2021-02-08T02:08:23', 'yymm': '2005', 'arxiv_id': '2005.14383', 'language': 'en', 'url': 'https://arxiv.org/abs/2005.14383'}
arxiv