diff --git a/generalizedsobolevtransportforprobabilitymeasuresonagraph/e4246e10-834a-4549-b45f-9796ee8067a1_content_list.json b/generalizedsobolevtransportforprobabilitymeasuresonagraph/e4246e10-834a-4549-b45f-9796ee8067a1_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..39f40b3edb59281f3e4cce310a2d1f54140aab6e --- /dev/null +++ b/generalizedsobolevtransportforprobabilitymeasuresonagraph/e4246e10-834a-4549-b45f-9796ee8067a1_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07d20f388fb7f919f89ae01a6a4c019bc26b6b88c478066b9649326638c67413 +size 178254 diff --git a/generalizedsobolevtransportforprobabilitymeasuresonagraph/e4246e10-834a-4549-b45f-9796ee8067a1_model.json b/generalizedsobolevtransportforprobabilitymeasuresonagraph/e4246e10-834a-4549-b45f-9796ee8067a1_model.json new file mode 100644 index 0000000000000000000000000000000000000000..aaec67eb6b26aeafd0dac1e9905b675043677632 --- /dev/null +++ b/generalizedsobolevtransportforprobabilitymeasuresonagraph/e4246e10-834a-4549-b45f-9796ee8067a1_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad3064bf973f3c886400805b87bab9a100796c96b6c3c92745ecf36340fa7350 +size 216078 diff --git a/generalizedsobolevtransportforprobabilitymeasuresonagraph/e4246e10-834a-4549-b45f-9796ee8067a1_origin.pdf b/generalizedsobolevtransportforprobabilitymeasuresonagraph/e4246e10-834a-4549-b45f-9796ee8067a1_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..afde56dee86af17b86f469ea264ec8527c710175 --- /dev/null +++ b/generalizedsobolevtransportforprobabilitymeasuresonagraph/e4246e10-834a-4549-b45f-9796ee8067a1_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df8983157bd4276f59bc9be3bd163f45afa9745ff12d93b75f7a9e77c1563b3e +size 915084 diff --git a/generalizedsobolevtransportforprobabilitymeasuresonagraph/full.md b/generalizedsobolevtransportforprobabilitymeasuresonagraph/full.md new file mode 100644 index 0000000000000000000000000000000000000000..f6d8ae95963088840bd3cc803547df9331476614 --- /dev/null +++ b/generalizedsobolevtransportforprobabilitymeasuresonagraph/full.md @@ -0,0 +1,992 @@ +# Generalized Sobolev Transport for Probability Measures on a Graph + +Tam Le $^{*1,2}$ Truyen Nguyen $^{*3}$ Kenji Fukumizu + +# Abstract + +We study the optimal transport (OT) problem for measures supported on a graph metric space. Recently, Le et al. (2022) leverage the graph structure and propose a variant of OT, namely Sobolev transport (ST), which yields a closed-form expression for a fast computation. However, ST is essentially coupled with the $L^p$ geometric structure within its definition which makes it nontrivial to utilize ST for other prior structures. In contrast, the classic OT has the flexibility to adapt to various geometric structures by modifying the underlying cost function. An important instance is the Orlicz-Wasserstein (OW) which moves beyond the $L^p$ structure by leveraging the Orlicz geometric structure. Comparing to the usage of standard $p$ -order Wasserstein, OW remarkably helps to advance certain machine learning approaches. Nevertheless, OW brings up a new challenge on its computation due to its two-level optimization formulation. In this work, we leverage a specific class of convex functions for Orlicz structure to propose the generalized Sobolev transport (GST). GST encompasses the ST as its special case, and can be utilized for prior structures beyond the $L^p$ geometry. In connection with the OW, we show that one only needs to simply solve a univariate optimization problem to compute the GST, unlike the complex two-level optimization problem in OW. We empirically illustrate that GST is several-order faster than the OW. Moreover, we provide preliminary evidences on the advantages of GST for document classification and for several tasks in topological data analysis. + +# 1. Introduction + +Optimal transport (OT) is a natural geometry to compare probability measures (Villani, 2008; Peyre & Cuturi, 2019). Intuitively, OT lifts the cost metric on support data points of input measures to the distance for the measures by minimizing the cost to transport a measure into the other. OT has been applied on many applications in various research fields, e.g., in machine learning (Nadjahi et al., 2019; Titouan et al., 2019; Janati et al., 2020; Mukherjee et al., 2021; Altschuler et al., 2021; Fatras et al., 2021; Scutbon et al., 2021; Le & Nguyen, 2021; Le et al., 2021a;b; Liu et al., 2021; Nguyen et al., 2021a;b; Takezawa et al., 2022; Fan et al., 2022; Bunne et al., 2022; 2023a; Bonet et al., 2023; Mahey et al., 2023; Nguyen et al., 2023a;b; Hua et al., 2023; Korotin et al., 2023; 2024; Le et al., 2024; Nguyen et al., 2024), statistics (Mena & Niles-Weed, 2019; Weed & Berthet, 2019; Liu et al., 2022; Nguyen et al., 2022; Wang et al., 2022; Nietert et al., 2022; 2023; Pham et al., 2024), and biology (Schiebinger et al., 2019; Tong et al., 2020; Bunne et al., 2023a;b; Korotin et al., 2024). + +A main drawback of OT is that its computational complexity is high, i.e., super cubic with respect to the number of supports of input measures, which hinders its applications in large-scale applications. Recently, several approaches have been proposed in the literature to scale up the OT problem. Cuturi (2013) proposes to use entropic regularization for OT and leverages the Sinkhorn algorithm to reduce its complexity into quadratic. Scetbon et al. (2021) propose low-rank approach to further reduce the computation of Sinkhorn algorithm for entropic regularized OT. Another direction is to exploit the local structure on supports of input measures. Rabin et al. (2011) propose sliced-Wasserstein (SW) which projects supports of input measures into a randomly one-dimensional space and utilizes the closed-form computation of the univariate OT. However, by relying on the one-dimensional projection, SW limits its capacity to capture the topological structure of input measures, especially when measures are supported in a high-dimensional space. Le et al. (2019) propose to leverage tree structure which provides more flexibility and degrees of freedom, i.e., choosing a tree rather than a line as in SW, to alleviate the curse of dimensionality in SW. For practical applications, the tree structure might be a restricted requirement. Recently, Le et al. (2022) propose a variant of OT, namely + +Sobolev transport (ST), for measures supported on a graph which admits a closed-form expression for fast computation. + +Unlike the classic OT where one can easily utilize various prior geometric structures on supports of input measures, e.g., via the ground cost metric, it is nontrivial to use other structures rather than the $L^p$ structure for the ST. Essentially, the definition of ST is based on the Kantorovich duality of 1-order Wasserstein, but ST considers the graph-based Sobolev constraint for the critic function. This makes the ST coupled with the $L^p$ functional geometric structure within the graph-based Sobolev space. + +One approach to move beyond the $L^p$ geometry is to employ the Orlicz geometric structure, which is obtained by leveraging a specific class of convex functions. Indeed, Orlicz norm has been utilized to advance several machine learning approaches in the literature. In particular, Andoni et al. (2018) and Song et al. (2019) leverage the Orlicz norm as a loss for the classic linear regression. Orlicz norm loss regression not only generalizes both the least squared regression (i.e., squared $\ell_2$ norm loss) and the least absolute deviation regression (i.e., $\ell_1$ norm loss), but also provides a scale-invariant version of $\mathbb{M}$ -estimator function loss (e.g., the Huber, Cauchy, Welsh, Tukey, Geman-McClure functions (Zhang, 1997, Table 1)). Moreover, Andoni et al. (2018) illustrate that the Orlicz norm loss regression improves performances of linear regression with $\ell_1 / \ell_2$ norms on Gaussian/sparse noise respectively. In addition, Deng et al. (2022) propose an efficient data structure for the Orlicz norm as its special case, which helps to scale up many machine learning problems including reinforcement learning, kernelized support vector machine, and clustering. Notably, in order to address the challenging polynomial growing nature of the underlying function class in the empirical process for random Fourier features on approximation of high-order kernel derivatives, Chamakh et al. (2020) leverage the Orlicz metric on the sample distribution to derive a finite-sample deviation bound for a general class of polynomial-growth functions. In particular, Chamakh et al. (2020) propose finite-sample uniform guarantee for random Fourier features which is almost surely convergence to approximate high-order derivatives for arbitrary kernel. + +Furthermore, Orlicz metric has been recently explored in the context of OT. In particular, Lorenz & Mahler (2022) propose to leverage Orlicz norm as a regularization for OT problem with continuous probability measures. Especially, Orlicz metric is also utilized as a ground cost for OT, which is known as the Orlicz-Wasserstein (OW) (Sturm, 2011; Kell, 2017). Notably, Guha et al. (2023) and Altschuler & Chewi (2023) have shown that OW possesses unique + +implicit essences, which may not exist in the classic OT with $L^p$ structure cost, and help to advance certain results in machine learning. In particular, Guha et al. (2023) propose to consider OW metric for studying the Bayesian contraction convergence behavior of parameters arising from hierarchical Bayesian nonparametric models. OW metric helps to alleviate a number of raised concerns caused from the usage of the classic OT with Euclidean cost for quantifying the rates of parameter convergence within infinite Gaussian mixtures to significantly improve the contraction rate. Additionally, Altschuler & Chewi (2023) propose to also leverage OW as a metric shift for Rényi divergence to develop novel differential-privacy-inspired techniques to overcome longstanding challenges for proving fast convergence of hypocoercive differential equations. In spite of these achievements, OW brings up a difficult challenge on its computation. Precisely, OW is a two-level optimization problem: one level is for the transportation plan as in the classic OT problem, and another level is for an extra positive scalar within the Orlicz metric structure. + +In this work, we focus on OT problem for probability measures supported on a graph metric space (Le et al., 2022). On one hand, ST efficiently exploits the graph structure to yield a closed-form for a fast computation. However, ST is essentially coupled with the $L^p$ geometric structure, and it is therefore nontrivial to utilize ST with other prior structures. On the other hand, OW metric owns unique implicit essences to improve certain machine learning problems, but its optimization formulation is challenging for computation. Our goal is to alleviate these issues by adopting Orlicz geometry to generalize the ST for measures on a graph. This allows us to propose the generalized Sobolev transport (GST) which inherit the merits from both ST and OW. + +Contribution. In summary, our contributions are three-fold: + +- We leverage a certain class of convex functions corresponding to Orlicz geometric structure, and propose the GST for probability measures supported on a graph metric space. We show that GST can be computed by simply solving a univariate optimization problem. +- We demonstrate that ST is a special case of the proposed GST. Additionally, GST utilizes the Orlicz geometric structure in the same sense as the OW for OT problem. We further draw a connection between GST and OW. +- We empirically illustrate that GST is more computationally efficient than OW. We also show some preliminary evidences on the advantages of GST for document classification and for several tasks in topological data analysis (TDA). + +Organization. We briefly review related notations used in + +the development of our proposals in §2. In §3, we describe our proposed approach, the generalized Sobolev transport (GST). We show that GST is a metric, and then derive its properties and draw its connection to ST and OW in §4. In §5, we empirically illustrate the computational advantages of GST over OW, and show preliminary improvements of GST on document classification and TDA. In §6, we give concluding remarks. Additionally, we defer the proofs of key theoretical results and additional materials to the Appendices. We have also released code for our proposed approach. $^2$ + +# 2. Preliminaries + +In this section, we introduce the notations and give a brief review about graphs together with the Sobolev transport (ST) for measures on a graph, as well as the Orlicz geometric structure and the Orlicz-Wasserstein (OW). + +# 2.1. Graph and functions on graph + +We describe the graph setting for measures, and functions on graph. + +Graph. We use the same graph setting as in (Le et al., 2022). Specifically, let $V$ and $E$ be respectively the sets of nodes and edges. We consider a connected, undirected, and physical $^3$ graph $\mathbb{G} = (V,E)$ with positive edge lengths $\{w_e\}_{e \in E}$ . Following the convention in (Le et al., 2022) for continuous graph setting, $\mathbb{G}$ is regarded as the set of all nodes in $V$ together with all points forming the edges in $E$ . Also, $\mathbb{G}$ is equipped with the graph metric $d_{\mathbb{G}}(x,y)$ which equals to the length of the shortest path in $\mathbb{G}$ between $x$ and $y$ . Additionally, we assume that there exists a fixed root node $z_0 \in V$ such that the shortest path connecting $z_0$ and $x$ is unique for any $x \in \mathbb{G}$ , i.e., the uniqueness property of the shortest paths (Le et al., 2022). + +Let $[x,z]$ denote the shortest path connecting $x$ and $z$ in $\mathbb{G}$ . For $x\in \mathbb{G}$ , edge $e\in E$ , define the sets $\Lambda (x)$ , $\gamma_{e}$ as follows: + +$$ +\Lambda (x) := \left\{y \in \mathbb {G}: x \in [ z _ {0}, y ] \right\}, +$$ + +$$ +\gamma_ {e} := \left\{y \in \mathbb {G}: e \subset \left[ z _ {0}, y \right] \right\}. \tag {1} +$$ + +Denote $\mathcal{P}(\mathbb{G})$ (resp. $\mathcal{P}(\mathbb{G}\times \mathbb{G})$ ) as the set of all nonnegative Borel measures on $\mathbb{G}$ (resp. $\mathbb{G}\times \mathbb{G}$ ) with a finite mass. + +Functions on graph. By a continuous function $f$ on $\mathbb{G}$ , we mean that $f: \mathbb{G} \to \mathbb{R}$ is continuous w.r.t. the topology on $\mathbb{G}$ induced by the Euclidean distance. Henceforth, $C(\mathbb{G})$ denotes the set of all continuous functions on $\mathbb{G}$ . Similar + +notation is used for continuous functions on $\mathbb{G}\times \mathbb{G}$ + +Given a scalar $b > 0$ , then a function $f: \mathbb{G} \to \mathbb{R}$ is called $b$ -Lipschitz w.r.t. the graph metric $d_{\mathbb{G}}$ if + +$$ +| f (x) - f (y) | \leq b d _ {\mathbb {G}} (x, y), \forall x, y \in \mathbb {G}. +$$ + +# 2.2. Sobolev transport (ST) + +For probability measures on a graph, Le et al. (2022) propose the ST which is a scalable variant of OT. More specifically, Le et al. (2022) leverage the graph structure and propose ST by building upon the dual form of the 1-order Wasserstein distance, but considering its Lipschitz constraint for the critic function within the graph-based Sobolev space. + +In particular, let $\omega$ be a nonnegative Borel measure on $\mathbb{G}$ . Given $1 \leq p \leq \infty$ , and let $p'$ be its conjugate, i.e., the number $p' \in [1, \infty]$ satisfying $\frac{1}{p} + \frac{1}{p'} = 1$ . For $\mu, \nu \in \mathcal{P}(\mathbb{G})$ , the $p$ -order Sobolev transport (ST) (Le et al., 2022, Definition 3.2) is defined as + +$$ +\mathcal {S} _ {p} (\mu , \nu) := \left\{ \begin{array}{l} \sup \left[ \int_ {\mathbb {G}} f (x) \mu (\mathrm {d} x) - \int_ {\mathbb {G}} f (x) \nu (\mathrm {d} x) \right] \\ \text {s . t .} f \in W ^ {1, p ^ {\prime}} (\mathbb {G}, \omega), \| f ^ {\prime} \| _ {L ^ {p ^ {\prime}} (\mathbb {G}, \omega)} \leq 1, \end{array} \right. \tag {2} +$$ + +where we write $f'$ for the generalized graph derivative of $f$ , $W^{1,p'}(\mathbb{G},\omega)$ for the graph-based Sobolev space on $\mathbb{G}$ , and $L^{p'}(\mathbb{G},\omega)$ for the $L^p$ functional space on $\mathbb{G}$ . Notably, the ST yields a closed-form expression for a fast computation (Le et al., 2022, Proposition 3.5). + +Additionally, when graph $\mathbb{G}$ is a tree and $\omega$ is a length measure5, the 1-order Sobolev transport coincides with the 1-order Wasserstein distance (Le et al., 2022, Corollary 4.3). + +However, unlike standard OT where one can easily adjust the ground cost following prior structure for applications, it is nontrivial for such adaptation in the ST due to its graph structure and the generalized graph derivation within the graph-based Sobolev space. + +# 2.3. Orlicz functional space and Orlicz-Wasserstein + +We describe a family of convex functions which we leverage to generalize the ST, and briefly review the Orlicz functional geometric structure, as well as the OW which utilizes Orlicz norm as its ground cost. + +A family of convex functions. We consider the collection of $N$ -functions (Adams & Fournier, 2003, §8.2) which are special convex functions on $\mathbb{R}_+$ . Hereafter, a strictly increasing and convex function $\Phi : [0, \infty) \to [0, \infty)$ is called an $N$ -function if $\lim_{t \to 0} \frac{\Phi(t)}{t} = 0$ and $\lim_{t \to +\infty} \frac{\Phi(t)}{t} = +\infty$ . + +Examples. Some popular examples for $N$ -functions are (i) $\Phi(t) = t^p$ with $1 < p < \infty$ ; (ii) $\Phi(t) = \exp(t) - t - 1$ ; (iii) $\Phi(t) = \exp(t^p) - 1$ with $1 < p < \infty$ ; and (iv) $\Phi(t) = (1 + t)\log(1 + t) - t$ (Adams & Fournier, 2003, §8.2). + +Orlicz functional space. Given an $N$ -function $\Phi$ and a nonnegative Borel measure $\omega$ on $\mathbb{G}$ , let $L_{\Phi}(\mathbb{G},\omega)$ be the linear hull of the set of all Borel measurable functions $f:\mathbb{G}\to \mathbb{R}$ satisfying $\int_{\mathbb{G}}\Phi (|f(x)|)\omega (\mathrm{d}x) < \infty$ . Then, $L_{\Phi}(\mathbb{G},\omega)$ is a normed space with the Luxemburg norm being defined by + +$$ +\left\| f \right\| _ {L _ {\Phi}} := \inf \left\{t > 0 \mid \int_ {\mathbb {G}} \Phi \left(\frac {| f (x) |}{t}\right) \omega (\mathrm {d} x) \leq 1 \right\}. \tag {3} +$$ + +The infimum in Equation (3) for $\| f \|_{L_{\Phi}}$ is attained (Adams & Fournier, 2003, §8.9). + +Orlicz-Wasserstein (OW). Following Guha et al. (2023, Definition 3.2), the OW with the $N$ -function $\Phi$ for measures $\mu, \nu \in \mathcal{P}(\mathbb{G})$ is defined as follows: + +$$ +\begin{array}{l} W _ {\Phi} (\mu , \nu) = \inf _ {\pi \in \Pi (\mu , \nu)} \inf \left[ t > 0: \right. \\ \int_ {\mathbb {G} \times \mathbb {G}} \Phi \left(\frac {d _ {\mathbb {G}} (x , z)}{t}\right) \mathrm {d} \pi (x, z) \leq 1 ], \tag {4} \\ \end{array} +$$ + +where $\Pi (\mu ,\nu)$ is the set of all couplings between $\mu$ and $\nu$ + +In this work, we propose to leverage the collection of $N$ -functions to generalize the ST, which can adopt Orlicz geometric structure in the same sense as the OW. Therefore, the proposed generalized Sobolev transport can inherit advantages from both ST and OW. + +# 3. Generalized Sobolev Transport (GST) + +In this section, we examine a special family of convex functions which grows faster than linear. By leveraging it, we generalize the ST in Equation (2) by proposing the graph-based Orlicz-Sobolev space for the Lipschitz constraint on the critic function for measures on a graph. + +# Graph-based Orlicz-Sobolev space. + +Definition 3.1 (Graph-based Orlicz-Sobolev space). Let $\Phi$ be an $N$ -function and $\omega$ be a nonnegative Borel measure on graph $\mathbb{G}$ . A continuous function $f: \mathbb{G} \to \mathbb{R}$ is said to belong to the graph-based Orlicz-Sobolev space $WL_{\Phi}(\mathbb{G}, \omega)$ if there exists a function $h \in L_{\Phi}(\mathbb{G}, \omega)$ satisfying + +$$ +f (x) - f \left(z _ {0}\right) = \int_ {\left[ z _ {0}, x \right]} h (y) \omega (\mathrm {d} y), \quad \forall x \in \mathbb {G}. \tag {5} +$$ + +Such function $h$ is unique in $L_{\Phi}(\mathbb{G}, \omega)$ and is called the generalized graph derivative of $f$ w.r.t. the measure $\omega$ . Henceforth, this generalized graph derivative of $f$ is denoted $f'$ . + +We remark that the Orlicz-Sobolev space $WL_{\Phi}(\mathbb{G}, \omega)$ depends on the point $z_0$ and the choice of the $N$ -function $\Phi$ . + +For brevity, we however do not explicitly display these dependencies in its notation. Additionally, the formulation in Equation (5) can be considered as a generalized version of the fundamental theorem of calculus, which defines the generalized graph derivative for a continuous function $f$ at any point $x \in \mathbb{G}$ . Moreover, the graph-based Orlicz-Sobolev space may be regarded as a generalized version of the graph-based Sobolev space (analyzed rigorously in §4). + +Unlike the OW which directly utilizes the given $N$ -function within the Luxemburg norm of the Orlicz functional space (Equation (4)), in order to generalize the ST, we also require a notion of the complementary function of the given $N$ -function. + +Complementary function. For the given $N$ -function $\Phi$ , its complementary function $\Psi: \mathbb{R}_+ \to \mathbb{R}_+$ (Adams & Fournier, 2003, §8.3) is the $N$ -function, defined as follows + +$$ +\Psi (t) = \sup [ a t - \Phi (a) \mid a \geq 0 ], \quad \text {f o r} t \geq 0. \tag {6} +$$ + +Examples. Some popular complementary pairs of $N$ -functions (Adams & Fournier, 2003, §8.3), (Rao & Ren, 1991, §2.2) are: (i) $\Phi(t) = \frac{t^p}{p}$ and $\Psi(t) = \frac{t^q}{q}$ where $q$ is the conjugate of $p$ , i.e., $\frac{1}{p} + \frac{1}{q} = 1$ and $1 < p < \infty$ , and (ii) $\Phi(t) = \exp(t) - t - 1$ and $\Psi(t) = (1 + t)\log(1 + t) - t$ . Additionally, for the $N$ -function $\Phi(t) = \exp(t^p) - 1$ with $1 < p < \infty$ , its complementary $N$ -function admits an explicit expression, but not simple (Rao & Ren, 1991, §2.2).6 + +Inspired by the ST for measures on a graph (Le et al., 2022), we exploit the dual formulation of the 1-order Wasserstein distance to propose the generalized Sobolev transport (GST). More precisely, we replace the Lipschitz constraint for the critic function by a constraint involving the graph-based Orlicz-Sobolev space. + +Definition 3.2 (Generalized Sobolev transport distance on graph). Let $\Phi$ be an $N$ -function and $\omega$ be a nonnegative Borel measure on $\mathbb{G}$ . For $\mu, \nu \in \mathcal{P}(\mathbb{G})$ , we define + +$$ +\mathcal {G S} _ {\Phi} (\mu , \nu) := \left\{ \begin{array}{l l} \sup & \Big | \int_ {\mathbb {G}} f (x) \mu (\mathrm {d} x) - \int_ {\mathbb {G}} f (x) \nu (\mathrm {d} x) \Big | \\ \text {s . t .} & f \in W L _ {\Psi} (\mathbb {G}, \omega), \| f ^ {\prime} \| _ {L _ {\Psi}} \leq 1, \end{array} \right. +$$ + +where $\Psi$ is the complementary function of $\Phi$ (see (6)). + +The Definition 3.2 implies that the GST for probability measures supported on a graph metric space is an instance of the integral probability metric (Müller, 1997). + +Computation. We next show that one can compute $\mathcal{GS}_{\Phi}$ by simply solving a univariate optimization problem. + +Theorem 3.3 (GST as univariate optimization problem). The generalized Sobolev transport $\mathcal{G}\mathcal{S}_{\Phi}(\mu ,\nu)$ in Defini + +tion 3.2 can be computed as follows: + +$$ +\mathcal {G} \mathcal {S} _ {\Phi} (\mu , \nu) = \inf _ {k > 0} \frac {1}{k} \left(1 + \int_ {\mathbb {G}} \Phi (k | h (x) |) \omega (d x)\right), \tag {7} +$$ + +where $h(x)\coloneqq \mu (\Lambda (x)) - \nu (\Lambda (x))$ for all $x\in \mathbb{G}$ + +The proof is placed in Appendix $\S A.1$ + +We next derive the discrete case for the GST in Equation (7). + +Corollary 3.4 (Discrete case). Assume that $\omega(\{x\}) = 0$ for every $x \in \mathbb{G}$ , and suppose that $\mu, \nu \in \mathcal{P}(\mathbb{G})$ are supported on nodes in $V$ of graph $\mathbb{G}$ . Then, we have + +$$ +\mathcal {G S} _ {\Phi} (\mu , \nu) = \inf _ {k > 0} \frac {1}{k} \left[ 1 + \sum_ {e \in E} w _ {e} \Phi (k | \bar {h} (e) |) \right], \tag {8} +$$ + +where $\bar{h}(e) \coloneqq \mu(\gamma_e) - \nu(\gamma_e)$ for every edge $e \in E$ . + +The proof is placed in Appendix §A.2. $^{8}$ + +From Corollary 3.4, one only needs to simply solve the univariate optimization problem to compute the GST. + +Remark 3.5 (GST for non-physical graph). Similar to the ST, we have assumed that $\mathbb{G}$ is a physical graph in §2.1. However, Corollary 3.4 implies that the GST $\mathcal{G}S_{\Phi}$ does not depend on the physical assumption when input measures are supported on graph nodes. In particular, it only depends on the graph structure $(V,E)$ and edge weights $w_{e}$ . Thus, we can apply the GST for non-physical graph $\mathbb{G}$ . + +Remark 3.6 (Complementary pairs of $N$ -functions for GST.). The Definition 3.2 for GST with the $N$ -function $\Phi$ involves its complementary $N$ -function $\Psi$ . However, we can reformulate GST as a univariate optimization problem without involving the complementary function $\Psi$ as in Equation (7). Note that in order to obtain the univariate optimization formulation, the complementary function $\Psi$ is finite-valued, which is satisfied by any $N$ -function $\Phi$ , i.e., growing faster than linear (see (6)). + +Preprocessing. For the computation of GST in Equation (8), observe that set $\gamma_{e}$ (see Equation (1)) can be precomputed for all edge $e$ in $\mathbb{G}$ . This preprocessing step only involves the graph $\mathbb{G}$ itself, and is not related to input measures. Moreover, we only need to precompute it once, regardless the number of input pairs of probability measures to be measured by the GST. In particular, we recompute the shortest paths from the root node $z_{0}$ to all other input supports (or vertices) by Dijkstra algorithm with the complexity $\mathcal{O}(|E| + |V|\log |V|)$ , where $|\cdot|$ is the cardinality of a set. + +Remark 3.7 (Sparsity in Problem (8)). Let $\operatorname{supp}(\mu)$ be the set of supports of $\mu$ . Observe that for any support $x \in$ + +$\operatorname{supp}(\mu)$ , its mass is accumulated into $\mu(\gamma_e)$ if and only if $e \subset [z_0, x]$ . Let define set $E_{\mu,\nu} \subset E$ as + +$$ +E _ {\mu , \nu} := \left\{e \in E \mid \exists z \in \left(\operatorname {s u p p} (\mu) \cup \operatorname {s u p p} (\nu)\right), e \subset [ z _ {0}, z ] \right\}. +$$ + +Then in (8), we in fact only need to take the summation over all edges $e \in E_{\mu, \nu}$ , i.e., removing all edges $e \in E \setminus E_{\mu, \nu}$ . + +# 4. Properties of the GST + +In this section, we derive the metric property for the GST and establish a relationship for the GST with different $N$ -functions. Additionally, we draw connections of the GST to the ST, the OW, and OT. + +Theorem 4.1 (Metrization). The generalized Sobolev transport $\mathcal{GS}_{\Phi}(\mu, \nu)$ is a metric on the space $\mathcal{P}(\mathbb{G})$ . + +The proof is placed in Appendix $\S A.3$ + +The GST is monotone with respect to the $N$ -function $\Phi$ as shown in the next result. Consequently, it may enclose a stronger notion of metrics than the ST for comparing measures on a graph. + +Proposition 4.2 (GST with different $N$ -functions). For any two $N$ -functions $\Phi_1, \Phi_2$ satisfying $\Phi_1(t) \leq \Phi_2(t)$ for all $t \in \mathbb{R}_+$ , we have + +$$ +\mathcal {G S} _ {\Phi_ {1}} (\mu , \nu) \leq \mathcal {G S} _ {\Phi_ {2}} (\mu , \nu) f o r e v e r y \mu , \nu \in \mathcal {P} (\mathbb {G}). +$$ + +The proof is placed in Appendix $\S A.4$ + +Connection with Sobolev transport. We next show the connection between the graph-based Orlicz-Sobolev space and the graph-based Sobolev space (Le et al., 2022). + +Proposition 4.3. Let $1 < p < \infty$ and $\omega$ be a nonnegative Borel measure on graph $\mathbb{G}$ . By taking $\Phi(t) \coloneqq t^p$ for the $N$ -function, then the associated graph-based Sobolev-Orlicz space is the same as the graph-based Sobolev space of order $p$ , denoted as $W^{1,p}(\mathbb{G},\omega)$ .9 That is, + +$$ +W L _ {\Phi} (\mathbb {G}, \omega) = W ^ {1, p} (\mathbb {G}, \omega). +$$ + +The proof is placed in Appendix $\S A.5$ + +By leveraging the result in Proposition 4.3, we next derive the closed-form expression for the univariate optimization problem in (7) for the GST with certain $N$ -functions. This allows us to draw its connection to the ST (Le et al., 2022). + +Proposition 4.4 (Connection between GST and ST). Let $\Phi(t) \coloneqq \frac{(p - 1)^{p - 1}}{p^p} t^p$ with $1 < p < \infty$ , and let $\omega$ be a nonnegative Borel measure on graph $\mathbb{G}$ . Then, the GST admits the following closed-form expression: + +$$ +\mathcal {G} \mathcal {S} _ {\Phi} (\mu , \nu) = \left(\int_ {\mathbb {G}} | \mu (\Lambda (x)) - \nu (\Lambda (x)) | ^ {p} \omega (d x)\right) ^ {\frac {1}{p}}, \tag {9} +$$ + +for all measures $\mu, \nu \in \mathcal{P}(\mathbb{G})$ . Consequently, we have + +$$ +\mathcal {G} \mathcal {S} _ {\Phi} (\mu , \nu) = \mathcal {S} _ {p} (\mu , \nu). +$$ + +The proof is placed in Appendix $\S A.6$ + +Connection with Orlicz-Wasserstein and OT. In the special case $\Phi(t) = t^p$ with $p \geq 1$ , the OW coincides with the $p$ -order Wasserstein (Guha et al., 2023).10 It is worth noting that OW in Equation (4) is a two-level optimization problem involving the transportation plan and the positive scalar $t$ . Thus, it is more challenging to compute the OW than the classic OT (e.g., with squared Euclidean cost). + +Remark 4.5. Following Guha et al. (2023), the OW is equal to the 1-order Wasserstein if we take $\Phi(t) = t^p$ and then take the limit $p \to 1^+$ . In the similar way and by taking the limit $p \to 1^+$ , the closed-form GST in Equation (9) is equal to the 1-order ST. With an additional assumption that graph $\mathbb{G}$ is a tree, it follows from Le et al. (2022) that the 1-order ST is in turn equal to the 1-order Wasserstein. Thus, the GST coincides with the OW when $\Phi(t) = t$ and the graph $\mathbb{G}$ is a tree. + +Due to Remark 4.5, the GST can be regarded as a variant of the OW. We summarize it in the following Proposition 4.6. + +Proposition 4.6 (Connection between GST and OW). When $\Phi(t) = t$ and the graph $\mathbb{G}$ is a tree, the generalized Sobolev transport and Orlicz-Wasserstein coincide, i.e., + +$$ +\mathcal {G S} _ {\Phi} (\mu , \nu) = W _ {\Phi} (\mu , \nu), +$$ + +for all measures $\mu, \nu \in \mathcal{P}(\mathbb{G})$ . + +Notice that our obtained results show that one only needs to solve a univariate optimization problem to compute the GST. On the other hand, it is much more challenging to solve the two-level optimization problem (4) for the OW. Notably, a recent realization is that solving exactly OT problems leads to overfitting (Peyre & Cuturi, 2019, §8.4). Therefore, it would be self-defeating to give excessive efforts to optimize the OT problems since it would lead to overfitting within the computation of the OT problems themselves. Consequently, GST can be regarded as a regularization approach for OW. + +# 5. Experiments + +In this section, we illustrate that the computation of OW for general $N$ -function $\Phi$ is very expensive, and the GST is several-order faster than OW. Then, we evaluate the GST + +and show preliminary evidences on its advantages for document classification and for several tasks in TDA. + +![](images/7ac88ad01bf7707c41ef8bb4ecbeb943e44b329199cba183dbdbafc85bee0e53.jpg) +Figure 1. Time consumption for GST and OW on $\mathbb{G}_{\mathrm{Log}}$ + +![](images/9d57b58b01fa18a814976b84cb5e0e45a4ebc0a0d4aa2619540061222ab68090.jpg) +Figure 2. Time consumption for GST and OW on $\mathbb{G}_{\mathrm{Sqrt}}$ + +Document classification. We consider 4 traditional document datasets: TWITTER, RECIPE, CLASSIC, AMAZON. The characteristic properties of these datasets are summarized in Figure 3. Following Le et al. (2022), we use word embedding, e.g., word2vec (Mikolov et al., 2013) pretrained on Google News for documents, to map words into vectors in $\mathbb{R}^{300}$ . Additionally, we remove SMART stop words (Salton & Buckley, 1988), and words in documents which are not in the pretrained word2vec. We then regard each document as a probability measure by considering each word in the document as its support in $\mathbb{R}^{300}$ , and using word frequency as the mass on that corresponding word. + +TDA. We consider two tasks: orbit recognition on the synthesis Orbit dataset (Adams et al., 2017), and object shape classification on MPEG7 dataset (Latecki et al., 2000) as in Le et al. (2022). The characteristic properties of these datasets are summarized in Figure 5. We utilize the persistence diagrams (PD) to represent objects of interest for these tasks. Particularly, PD is a multiset of points in $\mathbb{R}^2$ , where each point summarizes a life span (i.e., birth and death time) of a particular topological feature (e.g., connected component, ring, or cavity), extracted by algebraic topology methods (e.g., persistence homology) (Edelsbrunner & Harer, 2008). We consider each PD as a probability measure of the 2-dimensional topological feature data points with a uniform mass. + +![](images/976c58a08b20005e3229ec3f3bfc2f6223140fd1da5ec40347a00d0bfd76ee10.jpg) + +![](images/81e72f819fca2d2f90a8bb4032493b4225f8c3147c13280f4153659ab8dd956a.jpg) + +![](images/0cccf78da37425bd7c52477b00d0c5d05407d8a2e96131f7033eba3caa566f1a.jpg) + +![](images/4775a9d41c7fc9d84763463114f6a1951e3c62bc2f2f0b1dc0bb3c36cbe037ed.jpg) + +![](images/f75dfdf49e67ce5963f9e3c07a3edfbec8c2b5d56724a0e37025147dc84161c6.jpg) +Figure 3. Document classification on graph $\mathbb{G}_{\mathrm{Log}}$ . For each dataset, the numbers in the parenthesis are respectively the number of classes; the number of documents; and the maximum number of unique words for each document. + +![](images/438dbfeeac36d543cb15446b0c804652ca37737ab5cdfe88a7889b98a0a79c55.jpg) + +![](images/403bf8e3455a895021a48b360b8e5a7d3f285458a32d01d3e5f2a080174daf09.jpg) + +![](images/2a6aa5ce6588d7440ae8f05a61194a4da2808372206fa181a276a29900fa1416.jpg) + +![](images/118780abd109a04e11a0d2addc72acc791c8fedaa7b8ef2bf4bff556dc9bcd36.jpg) + +![](images/47c6b8719c7c947bd68f87c1926a42fecf645be997d6ab959ae71581eb59c542.jpg) + +![](images/63fb320dafafe55eee7ca0924db322c6f1a6c2c575e084bb93fb0affcc0bf2bc.jpg) + +![](images/0b29f4ada0644be1820bad5bacd8cd854f3986ce943be3e1caa64ea4c2b73432.jpg) + +![](images/7f7f796197cd7b8cd98eae76493273cf4ac1d6c5a691250f4a9d09af9486de97.jpg) +Figure 4. Document classification on graph $\mathbb{G}_{\mathrm{Sqrt}}$ + +![](images/47416b24bc49fc3bd51cd13c47999a8870aee1d31887fa3bc76f89311fa14bf5.jpg) + +![](images/7b95482f6c15ffb50b1f8309deb7d11e672ceb2ca509d0e1e6e5104666a41ab4.jpg) + +![](images/8d0f259e55e12d4b5a943f0aa6f461f03b4c771ef75e5a639d73e8edbe2b16ad.jpg) + +Graph. We employ the graphs $\mathbb{G}_{\mathrm{Log}}$ and $\mathbb{G}_{\mathrm{Sqrt}}$ (Le et al., 2022, §5) for our simulations, which empirically satisfy the assumptions in §2. $^{12}$ Additionally, we consider $M = 10^{2}, 10^{3}, 10^{4}$ as the number of nodes for these graphs. + +$N$ -function. We consider popular $N$ -functions $\Phi$ for the GST and the OW: $\Phi_1(t) = \exp (t) - t - 1$ , and $\Phi_2(t) = \exp (t^2) - 1$ . We also examine the limit case: $\Phi_0(t) = t$ . + +Optimization algorithm. For general $N$ -functions, we use Guha et al. (2023, Algorithm 1) to compute OW, and a second-order method, e.g., fmincon Trust Region Reflective solver in MATLAB, for solving the univariate optimization problem to compute the GST. + +Classification. We use support vector machine (SVM) for both document classification and the tasks in TDA. We employ kernel $\exp(-\bar{t}\bar{d}(\cdot,\cdot))$ , where $\bar{d}$ is a distance (e.g., GST, OW) for probability measures supported on a graph, and $\bar{t} > 0$ . Following Cuturi (2013), we regularize for the Gram + +Table 1. The number of pairs on datasets for SVM. + +
Datasets#pairs
TWITTER4394432
RECİPE8687560
CLASSIC22890777
AMAZON29117200
Orbit11373250
MPEG718130
+ +matrices by adding a sufficiently large diagonal term for SVM with indefinite kernels. We use 1-vs-1 strategy to carry out SVM for multi-class classification, e.g., with Libsvm. $^{13}$ + +For each dataset, we randomly split it into $70\% / 30\%$ for training and test with 10 repeats. We typically choose hyperparameters via cross validation. For kernel hyperparameter, we choose $1 / \bar{t}$ from $\{q_s, 2q_s, 5q_s\}$ with $s = 10, 20, \ldots, 90$ where $q_s$ is the $s\%$ quantile of a subset of distances observed on a training set. For SVM regularization hyperparameter, + +we choose it from $\{0.01, 0.1, 1, 10\}$ . For the root node $z_0$ in graph $\mathbb{G}$ , we choose it from a random 10-root-node subset of $V$ in $\mathbb{G}$ . For document classification and TDA, reported time consumption includes preprocessing procedures, e.g., computing shortest paths for GST and OW. + +We also summarize the number of pairs which we need to compute distances in training and test with kernel SVM for each run in Table 1, e.g., more than 29 million pairs of measures on AMAZON dataset. + +# 5.1. Computation + +We compare the time consumption of GST and OW with popular $N$ -functions $\Phi_1, \Phi_2$ , and the limit case $\Phi_0$ .14 + +Setup. We randomly sample $10^{4}$ pairs of measures from Amazon dataset, and consider graphs $\mathbb{G}_{\mathrm{Log}}$ and $\mathbb{G}_{\mathrm{Sqrt}}$ with the number of nodes $M = 10^{3}$ . + +Results and discussions. We illustrate the time consumption on $\mathbb{G}_{\mathrm{Log}}$ and $\mathbb{G}_{\mathrm{Sqrt}}$ in Figures 1 and 2 respectively. GST is several-order faster than OW. More concretely, GST is $100\times ,5000\times ,3000\times$ faster than OW for $\Phi_0,\Phi_1,\Phi_2$ respectively. Especially, for $\Phi_{1}$ and $\Phi_{2}$ , GST takes less than 25 seconds, but OW takes at least 17 hours, and up to 33 hours. + +Notice that the OW with $\Phi_0$ is equal to the OT with graph metric $d_{\mathbb{G}}$ as its ground cost. Additionally, GST with $\Phi_0$ yields a closed-form expression for a fast computation, following the Proposition 4.4 and Remark 4.5. Therefore, the computation of GST and OW with $\Phi_0$ is more efficient than with $\Phi_1, \Phi_2$ . + +# 5.2. Document classification + +Set up. We evaluate GST with $\Phi_0, \Phi_1, \Phi_2$ as in §5.1 (denoted as GST- $\Phi_i$ for $i = 0, 1, 2$ ). For OW, we only consider $\Phi_0$ (denoted as OW- $\Phi_0$ ), but exclude $\Phi_1, \Phi_2$ due to their heavy computations (illustrated and discussed in §5.1). Following Le et al. (2022) and Proposition 4.6, we also consider a special case for OW- $\Phi_0$ , where we randomly sample a tree from the given graph $\mathbb{G}$ (denoted as OW- $\Phi_0$ -Tree). Notice that OW- $\Phi_0$ -Tree admits a closed-form expression for a fast computation (Le et al., 2019). We report results on graphs $\mathbb{G}_{\mathrm{Log}}$ and $\mathbb{G}_{\mathrm{Sqrt}}$ with the number of nodes $M = 10^4$ . Further empirical results with different values for $M$ are placed in Appendix §B.5. + +Results and discussions. We illustrate SVM results and the time consumption of kernel matrices on graphs $\mathbb{G}_{\mathrm{Log}}$ and $\mathbb{G}_{\mathrm{Sqrt}}$ in Figures 3 and 4 respectively. The performances of GST with all $\Phi$ functions compare favorably to those of OW. Additionally, the computation of GST- $\Phi_0$ is several-order + +faster than $\mathrm{OW - }\Phi_0$ . We also reemphasize that it is prohibitively expensive to evaluate OW with $\Phi_{1},\Phi_{2}$ functions on many pairs of measures (See Table 1 and §5.1). GST- $\Phi_1$ and GST- $\Phi_2$ improve performances of GST- $\Phi_0$ , but their computational time is several-order higher (i.e., GST- $\Phi_0$ has a closed-form expression for a fast computation). Thus, it may imply that Orlicz geometric structure in GST may be useful for document classification. Recall that OW- $\Phi_0$ -Tree uses a partial information of $\mathbb{G}$ , while OW- $\Phi_0$ uses information of the whole $\mathbb{G}$ . On the other hand, kernel for OW- $\Phi_0$ -Tree is positive definite, while kernel for OW- $\Phi_0$ is indefinite. Performances of OW- $\Phi_0$ -Tree are worse than those of OW- $\Phi_0$ in TWITTER, RECIPE, but better than those of OW- $\Phi_0$ in CLASSIC, AMAZON, which agrees with observations in Le et al. (2022). + +![](images/684490294361007d009fe5ee40a095fa02e8aa16d06df3617e74a0e992e8fc73.jpg) +Figure 5. TDA on graph $\mathbb{G}_{\mathrm{Log}}$ . For each dataset, the numbers in the parenthesis are respectively the number of PD; and the maximum number of points in PD. + +![](images/3c37a72d8cd2242c21d53497d71f3cf00f0cc582c3ae3523bf4b0508380d26f9.jpg) +Figure 6. TDA on graph $\mathbb{G}_{\mathrm{Sqrt}}$ + +# 5.3. Topological Data Analysis + +Set up. We evaluate the same distances as in document classification, i.e., GST- $\Phi_{i}$ for $i = 0,1,2$ ; OW- $\Phi_0$ ; and OW- $\Phi_0$ -Tree. We report results on graphs $\mathbb{G}_{\mathrm{Log}}$ and $\mathbb{G}_{\mathrm{Sqrt}}$ with $M = 10^{4}$ for Orbit dataset, and $M = 10^{3}$ for MPEG7 dataset due to its small size. We also include further empirical results with different values for $M$ in Appendix §B.5. + +Results and discussions. We illustrate SVM results and the time consumption of kernel matrices on graphs $\mathbb{G}_{\mathrm{Log}}$ and $\mathbb{G}_{\mathrm{Sqrt}}$ in Figures 5 and 6 respectively. We have similar observations as for document classification. GST is several-order faster than OW (for the same $\Phi$ function), and improve performances of OW. Orlicz geometry structure is also helpful for TDA. Although only using a partial information of $\mathbb{G}$ , positive definiteness may play an important role for OW- $\Phi_0$ -Tree to improve performances of OW- $\Phi_0$ in TDA, also observed in Le et al. (2022). + +# 6. Conclusion + +We propose the generalized Sobolev transport (GST) for probability measures supported on a graph metric space. This is achieved by leveraging a special family of convex functions (i.e., the set of $N$ -functions) to extend the Sobolev transport (ST), which is a scalable variant of OT on a graph. This novel approach enables us to adopt Orlicz geometric structure for GST. Consequently, GST can inherit advantages from both ST and the Orlicz-Wasserstein (OW). An important feature is that unlike OW which involves a complex two-level optimization problem, one can simply solve a univariate optimization problem for the GST computation. Thus, GST is a computationally efficient variant for the computationally-demanding OW, which paves a way to use OW in applications. For future work, it is interesting to extend the GST for measures possibly having different total mass (i.e., unbalanced setting), which is essential for applications having noisy supports or outliers in input measures (Frogner et al., 2015; Balaji et al., 2020; Mukherjee et al., 2021; Fatras et al., 2021). + +# Acknowledgements + +We thank the area chairs and anonymous reviewers for their comments. KF has been supported in part by Grant-in-Aid for Transformative Research Areas (A) 22H05106. TL gratefully acknowledges the support of JSPS KAKENHI Grant number 23K11243, and Mitsui Knowledge Industry Co., Ltd. grant. + +# Impact Statement + +The paper presents a generalized version for the Sobolev transport (ST) which is a scalable variant of optimal transport for probability measures on a graph. By leveraging a special family of convex functions, we can adopt Orlicz geometric structure for the generalized Sobolev transport (GST). Furthermore, GST can be regarded as a computationally efficient variant of the computationally-demanding Orlicz-Wasserstein (OW), which possesses implicit essences to advance certain results in machine learning. Therefore, the proposed GST can inherit the merits from both ST and + +OW. To our knowledge, there are no foreseeable potential societal consequences of our work. + +# References + +Adams, H., Emerson, T., Kirby, M., Neville, R., Peterson, C., Shipman, P., Chepushtanova, S., Hanson, E., Motta, F., and Ziegelmeier, L. Persistence images: A stable vector representation of persistent homology. Journal of Machine Learning Research, 18(1):218-252, 2017. +Adams, R. A. and Fournier, J. J. Sobolev spaces. Elsevier, 2003. +Altschuler, J. M. and Chewi, S. Faster high-accuracy log-concave sampling via algorithmic warm starts. In 2023 IEEE 64th Annual Symposium on Foundations of Computer Science (FOCS), pp. 2169-2176, 2023. +Altschuler, J. M., Chewi, S., Gerber, P., and Stromme, A. J. Averaging on the Bures-Wasserstein manifold: Dimension-free convergence of gradient descent. Advances in Neural Information Processing Systems, 2021. +Andoni, A., Lin, C., Sheng, Y., Zhong, P., and Zhong, R. Subspace embedding and linear regression with Orlicz norm. In International Conference on Machine Learning, pp. 224-233. PMLR, 2018. +Balaji, Y., Chellappa, R., and Feizi, S. Robust optimal transport with applications in generative modeling and domain adaptation. Advances in Neural Information Processing Systems, 33:12934-12944, 2020. +Bonet, C., Berg, P., Courty, N., Septier, F., Drumetz, L., and Pham, M.-T. Spherical sliced-Wasserstein. In The Eleventh International Conference on Learning Representations, 2023. +Bunne, C., Papaxanthos, L., Krause, A., and Cuturi, M. Proximal optimal transport modeling of population dynamics. In International Conference on Artificial Intelligence and Statistics, pp. 6511-6528. PMLR, 2022. +Bunne, C., Hsieh, Y.-P., Cuturi, M., and Krause, A. The Schrödinger bridge between Gaussian measures has a closed form. In International Conference on Artificial Intelligence and Statistics, pp. 5802-5833. PMLR, 2023a. +Bunne, C., Stark, S. G., Gut, G., Del Castillo, J. S., Levesque, M., Lehmann, K.-V., Pelkmans, L., Krause, A., and Ratsch, G. Learning single-cell perturbation responses using neural optimal transport. Nature Methods, 20(11):1759-1768, 2023b. +Chamakh, L., Gobet, E., and Szabó, Z. Orlicz random Fourier features. The Journal of Machine Learning Research, 21(1):5739-5775, 2020. + +Cuturi, M. Sinkhorn distances: Lightspeed computation of optimal transport. In Advances in Neural Information Processing Systems, pp. 2292-2300, 2013. +Deng, Y., Song, Z., Weinstein, O., and Zhang, R. Fast distance oracles for any symmetric norm. Advances in Neural Information Processing Systems, 35:7304-7317, 2022. +Dong, Y. and Sawin, W. COPT: Coordinated optimal transport on graphs. Advances in Neural Information Processing Systems, 33:19327-19338, 2020. +Edelsbrunner, H. and Harer, J. Persistent homology-a survey. Contemporary mathematics, 453:257-282, 2008. +Fan, J., Haasler, I., Karlsson, J., and Chen, Y. On the complexity of the optimal transport problem with graph-structured cost. In International Conference on Artificial Intelligence and Statistics, pp. 9147-9165. PMLR, 2022. +Fatras, K., Séjourné, T., Flamary, R., and Courty, N. Unbalanced minibatch optimal transport; applications to domain adaptation. In International Conference on Machine Learning, pp. 3186-3197. PMLR, 2021. +Frogner, C., Zhang, C., Mobahi, H., Araya, M., and Poggio, T. A. Learning with a wasserstein loss. In Advances in neural information processing systems, pp. 2053-2061, 2015. +Guha, A., Ho, N., and Nguyen, X. On excess mass behavior in Gaussian mixture models with Orlicz-Wasserstein distances. In International Conference on Machine Learning, ICML, volume 202, pp. 11847-11870. PMLR, 2023. +Hua, X., Nguyen, T., Le, T., Blanchet, J., and Nguyen, V. A. Dynamic flows on curved space generated by labeled data. In Proceedings of the Thirty-Second International Joint Conference on Artificial Intelligence, IJCAI-23, pp. 3803-3811, 2023. +Huber, P. J. Robust estimation of a location parameter. In Breakthroughs in statistics: Methodology and distribution, pp. 492-518. Springer, 1992. +Janati, H., Muzellec, B., Peyré, G., and Cuturi, M. Entropic optimal transport between (unbalanced) Gaussian measures has a closed form. In Advances in neural information processing systems, 2020. +Kell, M. On interpolation and curvature via Wasserstein geodesics. Advances in Calculus of Variations, 10(2): 125-167, 2017. +Korotin, A., Selikhanovych, D., and Burnaev, E. Neural optimal transport. In The Eleventh International Conference on Learning Representations, 2023. + +Korotin, A., Gushchin, N., and Burnaev, E. Light Schrödinger bridge. In *The Eleventh International Conference on Learning Representations*, 2024. +Latecki, L. J., Lakamper, R., and Eckhardt, T. Shape descriptors for non-rigid shapes with a single closed contour. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), volume 1, pp. 424-429, 2000. +Le, T. and Nguyen, T. Entropy partial transport with tree metrics: Theory and practice. In Proceedings of The 24th International Conference on Artificial Intelligence and Statistics (AISTATS), volume 130 of Proceedings of Machine Learning Research, pp. 3835-3843. PMLR, 2021. +Le, T., Yamada, M., Fukumizu, K., and Cuturi, M. Treesliced variants of Wasserstein distances. In Advances in neural information processing systems, pp. 12283-12294, 2019. +Le, T., Ho, N., and Yamada, M. Flow-based alignment approaches for probability measures in different spaces. In International Conference on Artificial Intelligence and Statistics, pp. 3934-3942. PMLR, 2021a. +Le, T., Nguyen, T., Yamada, M., Blanchet, J., and Nguyen, V. A. Adversarial regression with doubly non-negative weighting matrices. Advances in Neural Information Processing Systems, 34, 2021b. +Le, T., Nguyen, T., Phung, D., and Nguyen, V. A. Sobolev transport: A scalable metric for probability measures with graph metrics. In International Conference on Artificial Intelligence and Statistics, pp. 9844-9868. PMLR, 2022. +Le, T., Nguyen, T., and Fukumizu, K. Scalable unbalanced Sobolev transport for measures on a graph. In International Conference on Artificial Intelligence and Statistics, pp. 8521-8560. PMLR, 2023. +Le, T., Nguyen, T., and Fukumizu, K. Optimal transport for measures with noisy tree metric. In International Conference on Artificial Intelligence and Statistics. PMLR, 2024. +Liu, L., Pal, S., and Harchaoui, Z. Entropy regularized optimal transport independence criterion. In International Conference on Artificial Intelligence and Statistics, pp. 11247-11279. PMLR, 2022. +Liu, Y., Yamada, M., Tsai, Y.-H. H., Le, T., Salakhutdinov, R., and Yang, Y. LSMI-Sinkhorn: Semi-supervised mutual information estimation with optimal transport. In European Conference on Machine Learning and Principles & Practice of Knowledge Discovery in Databases (ECML-PKDD), 2021. + +Lorenz, D. and Mahler, H. Orlicz space regularization of continuous optimal transport problems. Applied Mathematics & Optimization, 85(2):14, 2022. +Mahey, G., Chapel, L., Gasso, G., Bonet, C., and Courty, N. Fast optimal transport through sliced Wasserstein generalized geodesics. 2023. +Mena, G. and Niles-Weed, J. Statistical bounds for entropic optimal transport: sample complexity and the central limit theorem. In Advances in Neural Information Processing Systems, pp. 4541-4551, 2019. +Mikolov, T., Sutskever, I., Chen, K., Corrado, G. S., and Dean, J. Distributed representations of words and phrases and their compositionality. In Advances in neural information processing systems, pp. 3111-3119, 2013. +Mukherjee, D., Guha, A., Solomon, J. M., Sun, Y., and Yurochkin, M. Outlier-robust optimal transport. In International Conference on Machine Learning, pp. 7850-7860. PMLR, 2021. +Müller, A. Integral probability metrics and their generating classes of functions. Advances in Applied Probability, 29 (2):429-443, 1997. +Musielak, J. Orlicz spaces and modular spaces, volume 1034. Springer, 2006. +Nadjahi, K., Durmus, A., Simsekli, U., and Badeau, R. Asymptotic guarantees for learning generative models with the sliced-Wasserstein distance. In Advances in Neural Information Processing Systems, pp. 250-260, 2019. +Nguyen, H., Le, K., Nguyen, Q. M., Pham, T., Bui, H., and Ho, N. On robust optimal transport: Computational complexity and barycenter computation. Advances in Neural Information Processing Systems, 34:21947-21959, 2021a. +Nguyen, K., Ren, T., and Ho, N. Markovian sliced Wasserstein distances: Beyond independent projections. Advances in Neural Information Processing Systems, 2023a. +Nguyen, K., Zhang, S., Le, T., and Ho, N. Sliced Wasserstein with random-path projecting directions. In International Conference on Machine Learning (ICML), 2024. +Nguyen, Q. M., Nguyen, H. H., Zhou, Y., and Nguyen, L. M. On unbalanced optimal transport: Gradient methods, sparsity and approximation error. The Journal of Machine Learning Research, 2023b. +Nguyen, T. D., Trippe, B. L., and Broderick, T. Many processors, little time: MCMC for partitions via optimal + +transport couplings. In International Conference on Artificial Intelligence and Statistics, pp. 3483-3514. PMLR, 2022. +Nguyen, V., Le, T., Yamada, M., and Osborne, M. A. Optimal transport kernels for sequential and parallel neural architecture search. In International Conference on Machine Learning, pp. 8084-8095. PMLR, 2021b. +Nietert, S., Goldfeld, Z., and Cummings, R. Outlier-robust optimal transport: Duality, structure, and statistical analysis. In International Conference on Artificial Intelligence and Statistics, pp. 11691-11719. PMLR, 2022. +Nietert, S., Goldfeld, Z., and Shafiee, S. Outlier-robust Wasserstein DRO. Thirty-seventh Conference on Neural Information Processing Systems, 2023. +Petric Maretic, H., El Gheche, M., Chierchia, G., and Frossard, P. GOT: An optimal transport framework for graph comparison. Advances in Neural Information Processing Systems, 32, 2019. +Peyre, G. and Cuturi, M. Computational optimal transport. Foundations and Trends® in Machine Learning, 11(5-6): 355-607, 2019. +Pham, T., Shimizu, S., Hino, H., and Le, T. Scalable counterfactual distribution estimation in multivariate causal models. In Conference on Causal Learning and Reasoning (CLeaR), 2024. +Rabin, J., Peyre, G., Delon, J., and Bernot, M. Wasserstein barycenter and its application to texture mixing. In International Conference on Scale Space and Variational Methods in Computer Vision, pp. 435-446, 2011. +Rao, M. M. and Ren, Z. D. Theory of Orlicz spaces. Marcel Dekker, 1991. +Salton, G. and Buckley, C. Term-weighting approaches in automatic text retrieval. Information processing & management, 24(5):513-523, 1988. +Scetbon, M., Cuturi, M., and Peyre, G. Low-rank Sinkhorn factorization. International Conference on Machine Learning (ICML), 2021. +Schiebinger, G., Shu, J., Tabaka, M., Cleary, B., Subramanian, V., Solomon, A., Gould, J., Liu, S., Lin, S., Berube, P., et al. Optimal-transport analysis of single-cell gene expression identifies developmental trajectories in reprogramming. Cell, 176(4):928-943, 2019. +Song, Z., Wang, R., Yang, L., Zhang, H., and Zhong, P. Efficient symmetric norm regression via linear sketching. Advances in Neural Information Processing Systems, 32, 2019. + +Sturm, K.-T. Generalized Orlicz spaces and Wasserstein distances for convex-concave scale functions. Bulletin des sciences mathématiques, 135(6-7):795-802, 2011. +Takezawa, Y., Sato, R., Kozareva, Z., Ravi, S., and Yamada, M. Fixed support tree-sliced Wasserstein barycenter. In Proceedings of The 25th International Conference on Artificial Intelligence and Statistics, volume 151, pp. 1120-1137. PMLR, 2022. +Tam, E. and Dunson, D. Multiscale graph comparison via the embedded laplacian discrepancy. arXiv:2201.12064, 2022. +Titouan, V., Courty, N., Tavenard, R., and Flamary, R. Optimal transport for structured data with application on graphs. In International Conference on Machine Learning, pp. 6275-6284. PMLR, 2019. +Tong, A., Huang, J., Wolf, G., Van Dijk, D., and Krishnaswamy, S. Trajectorynet: A dynamic optimal transport + +network for modeling cellular dynamics. In International conference on machine learning, pp. 9526-9536. PMLR, 2020. +Villani, C. Optimal transport: old and new, volume 338. Springer Science & Business Media, 2008. +Wang, J., Gao, R., and Xie, Y. Two-sample test with kernel projected Wasserstein distance. In Proceedings of The 25th International Conference on Artificial Intelligence and Statistics, volume 151, pp. 8022-8055. PMLR, 2022. +Weed, J. and Berthet, Q. Estimation of smooth densities in Wasserstein distance. In Proceedings of the Thirty-Second Conference on Learning Theory, volume 99, pp. 3118-3119, 2019. +Zhang, Z. Parameter estimation techniques: A tutorial with application to conic fitting. Image and vision Computing, 15(1):59-76, 1997. + +# Supplement to “Generalized Sobolev Transport for Probability Measures on a Graph” + +In §A of this appendix, we give the detailed proofs for our theoretical results. Further results and discussions are given in §B. + +# A. Detailed Proofs + +In this section, we give detailed proofs for our theoretical findings. + +# A.1. Proof for Theorem 3.3 + +Proof. Let us consider a critic function $f \in WL_{\Psi}(\mathbb{G}, \omega)$ . Then by Definition 3.1, we have + +$$ +f (x) = f \left(z _ {0}\right) + \int_ {\left[ z _ {0}, x \right]} f ^ {\prime} (y) \omega (\mathrm {d} y) \quad \text {f o r} \quad x \in \mathbb {G}. \tag {10} +$$ + +For convenience, let $\mathbf{1}_{[z_0,x]}(y)$ denote the indicator function of the shortest path $[z_0,x]$ , i.e., + +$$ +\mathbf {1} _ {[ z _ {0}, x ]} (y) = \left\{ \begin{array}{l l} 1 & \text {i f} y \in [ z _ {0}, x ] \\ 0 & \text {o t h e r w i s e .} \end{array} \right. \tag {11} +$$ + +Using (10)-(11) and due to $\mu (\mathbb{G}) = 1$ , we can rewrite $\int_{\mathbb{G}}f(x)\mu (\mathrm{d}x)$ as + +$$ +\begin{array}{l} \int_ {\mathbb {G}} f (x) \mu (\mathrm {d} x) = \int_ {\mathbb {G}} f (z _ {0}) \mu (\mathrm {d} x) + \int_ {\mathbb {G}} \int_ {[ z _ {0}, x ]} f ^ {\prime} (y) \omega (\mathrm {d} y) \mu (\mathrm {d} x) \\ = f (z _ {0}) + \int_ {\mathbb {G}} \int_ {\mathbb {G}} \mathbf {1} _ {[ z _ {0}, x ]} (y) f ^ {\prime} (y) \omega (\mathrm {d} y) \mu (\mathrm {d} x). \\ \end{array} +$$ + +It then follows by applying Fubini's theorem to interchange the order of integration in the above last integral that + +$$ +\begin{array}{l} \int_ {\mathbb {G}} f (x) \mu (\mathrm {d} x) = f \left(z _ {0}\right) + \int_ {\mathbb {G}} \int_ {\mathbb {G}} \mathbf {1} _ {[ z _ {0}, x ]} (y) f ^ {\prime} (y) \mu (\mathrm {d} x) \omega (\mathrm {d} y) \\ = f (z _ {0}) + \int_ {\mathbb {G}} \left[ \int_ {\mathbb {G}} \mathbf {1} _ {[ z _ {0}, x ]} (y) \mu (\mathrm {d} x) \right] f ^ {\prime} (y) \omega (\mathrm {d} y). \\ \end{array} +$$ + +Owing to the definition of $\Lambda(y)$ in (1), the above expression is equivalent to + +$$ +\int_ {\mathbb {G}} f (x) \mu (\mathrm {d} x) = f (z _ {0}) + \int_ {\mathbb {G}} f ^ {\prime} (y) \mu (\Lambda (y)) \omega (\mathrm {d} y). +$$ + +By exactly the same arguments, we also have + +$$ +\int_ {\mathbb {G}} f (x) \nu (\mathrm {d} x) = f (z _ {0}) + \int_ {\mathbb {G}} f ^ {\prime} (y) \nu (\Lambda (y)) \omega (\mathrm {d} y). +$$ + +As a consequence, the generalized Sobolev transport in Definition 3.2 can be rewritten as + +$$ +\mathcal {G} \mathcal {S} _ {\Phi} (\mu , \nu) = \sup _ {f \in \mathbb {F}} \left| \int_ {\mathbb {G}} f ^ {\prime} (x) [ \mu (\Lambda (x)) - \nu (\Lambda (x)) ] \omega (\mathrm {d} x) \right|, \tag {12} +$$ + +where $\mathbb{F} := \left\{f \in WL_{\Psi}(\mathbb{G}, \omega) : \| f' \|_{L_{\Psi}} \leq 1\right\}$ with $\| \cdot \|_{L_{\Psi}}$ being the Luxemburg norm defined in (3). + +Next, on one hand it is clear that $\{f': f \in \mathbb{F}\} \subset \{g \in L_{\Psi}(\mathbb{G}, \omega): \| g \|_{L_{\Psi}} \leq 1\}$ . On the other hand, for any $g \in L_{\Psi}(\mathbb{G}, \omega)$ we have $g = f'$ with $f(x) \coloneqq \int_{[z_0, x]} g(y) \omega(\mathrm{d}y) \in W L_{\Psi}(\mathbb{G}, \omega)$ . Therefore, we conclude that $\{f': f \in \mathbb{F}\} = \{g \in L_{\Psi}(\mathbb{G}, \omega): \| g \|_{L_{\Psi}} \leq 1\}$ . As a consequence, we can rewrite identity (12) as + +$$ +\mathcal {G S} _ {\Phi} (\mu , \nu) = \sup _ {g \in L _ {\Psi} (\mathbb {G}, \omega): \| g \| _ {L _ {\Psi}} \leq 1} \left| \int_ {\mathbb {G}} g (x) h (x) \omega (\mathrm {d} x) \right|, \tag {13} +$$ + +where $h(x)\coloneqq \mu (\Lambda (x)) - \nu (\Lambda (x))$ for all $x\in \mathbb{G}$ + +Recall from Definition 3.2 that $\Psi : \mathbb{R}_+ \to \mathbb{R}_+$ is the complementary function of $\Phi$ . Therefore, we obtain from (13) and (Rao & Ren, 1991, Proposition 10, pp.81) that + +$$ +\mathcal {G} \mathcal {S} _ {\Phi} (\mu , \nu) = \| h \| _ {\Phi} \tag {14} +$$ + +with $\| h\|_{\Phi}$ being the Orlicz norm defined by (see (Rao & Ren, 1991, Definition 2, pp.58)) + +$$ +\| h \| _ {\Phi} := \sup \left\{\int_ {\mathbb {G}} | h (x) g (x) | \omega (\mathrm {d} x): \int_ {\mathbb {G}} \Psi (| g (x) |) \omega (\mathrm {d} x) \leq 1 \right\}. \tag {15} +$$ + +By applying (Rao & Ren, 1991, Theorem 13, pp.69), we have + +$$ +\| h \| _ {\Phi} = \inf _ {k > 0} \frac {1}{k} \left(1 + \int_ {\mathbb {G}} \Phi (k | h (x) |) \omega (\mathrm {d} x)\right). +$$ + +This together with (14) yields + +$$ +\mathcal {G S} _ {\Phi} (\mu , \nu) = \inf _ {k > 0} \frac {1}{k} \left(1 + \int_ {\mathbb {G}} \Phi (k | h (x) |) \omega (\mathrm {d} x)\right). +$$ + +This completes the proof of the theorem. + +# A.2. Proof for Corollary 3.4 + +Proof. By Theorem 3.3, we have + +$$ +\mathcal {G S} _ {\Phi} (\mu , \nu) = \inf _ {k > 0} \frac {1}{k} \left(1 + \int_ {\mathbb {G}} \Phi (k | h (x) |) \omega (\mathrm {d} x)\right) \tag {16} +$$ + +with $h(x)\coloneqq \mu (\Lambda (x)) - \nu (\Lambda (x))$ . We next compute the integral in (16). + +Give two data points $u, v$ in $\mathbb{R}^n$ , let $\langle u, v \rangle$ be the line segment in $\mathbb{R}^n$ connecting the two points $u, v$ , and denote $(u, v)$ as the same line segment but without its two end-points. + +Using the assumption $\omega (\{x\}) = 0$ for every $x\in \mathbb{G}$ , we have + +$$ +\int_ {\mathbb {G}} \Phi (k | h (x) |) \omega (\mathrm {d} x) = \sum_ {e = \langle u, v \rangle \in E} \int_ {(u, v)} \Phi (k | h (x) |) \omega (\mathrm {d} x). +$$ + +As the input measures $\mu$ and $\nu$ are assumed to be supported on nodes $V$ of graph $\mathbb{G}$ , we also have $h(x) = \mu(\Lambda(x)) - \nu(\Lambda(x)) = \mu(\Lambda(x) \setminus (u, v)) - \nu(\Lambda(x) \setminus (u, v))$ for every edge $e = \langle u, v \rangle \in E$ . Therefore, the above identity can be further rewritten as + +$$ +\int_ {\mathbb {G}} \Phi (k | h (x) |) \omega (\mathrm {d} x) = \sum_ {e = \langle u, v \rangle \in E} \int_ {(u, v)} \Phi (k | \mu (\Lambda (x) \backslash (u, v)) - \nu (\Lambda (x) \backslash (u, v)) |) \omega (\mathrm {d} x). \tag {17} +$$ + +Consider edge $e$ between two nodes $u, v \in V$ of graph $\mathbb{G}$ , i.e., $e = \langle u, v \rangle$ . For $x \in (u, v)$ , we have $y \in \mathbb{G} \setminus (u, v)$ belongs to $\Lambda(x)$ if and only if $y \in \gamma_e$ (see Equation (1) for the definitions of $\Lambda(x)$ and $\gamma_e$ ). It follows that $\Lambda(x) \setminus (u, v) = \gamma_e$ , and thus we deduce from (17) that + +$$ +\begin{array}{l} \int_ {\mathbb {G}} \Phi (k | h (x) |) \omega (\mathrm {d} x) = \sum_ {e = \langle u, v \rangle \in E} \int_ {(u, v)} \Phi (k | \mu (\gamma_ {e}) - \nu (\gamma_ {e}) |) \omega (\mathrm {d} x) \\ = \sum_ {e = \langle u, v \rangle \in E} \Phi (k | \mu (\gamma_ {e}) - \nu (\gamma_ {e}) |) \int_ {(u, v)} \omega (\mathrm {d} x) \\ = \sum_ {e \in E} w _ {e} \Phi (k | \mu (\gamma_ {e}) - \nu (\gamma_ {e}) |). \\ \end{array} +$$ + +This together with (16) yields + +$$ +\mathcal {G S} _ {\Phi} (\mu , \nu) = \inf _ {k > 0} \frac {1}{k} \left(1 + \sum_ {e \in E} w _ {e} \Phi (k | \mu (\gamma_ {e}) - \nu (\gamma_ {e}) |\right). +$$ + +Thus, the proof is complete. + +# A.3. Proof for Theorem 4.1 + +Proof. We will prove that the generalized Sobolev transport $\mathcal{G}S_{\Phi}(\mu, \nu)$ satisfies: (i) nonnegativity, (ii) indiscernibility, (iii) symmetry, and (iv) triangle inequality. + +(i) Nonnegativity. By choosing $f = 0$ in Definition 3.2, we see that $\mathcal{G}S_{\Phi}(\mu ,\nu)\geq 0$ for every $(\mu ,\nu)$ in $\mathcal{P}(\mathbb{G})\times \mathcal{P}(\mathbb{G})$ . Therefore, the generalized Sobolev transport is nonnegative. +(ii) Indiscernibility. Assume that $\mathcal{G}\mathcal{S}_{\Phi}(\mu ,\nu) = 0$ , then we have + +$$ +\int_ {\mathbb {G}} f (x) \mu (\mathrm {d} x) - \int_ {\mathbb {G}} f (x) \nu (\mathrm {d} x) = 0, \tag {18} +$$ + +for all $f\in W L_{\Psi}(\mathbb{G},\omega)$ satisfying the constraint $\| f^{\prime}\|_{L_{\Psi}}\leq 1$ + +Now let $g \in WL_{\Psi}(\mathbb{G}, \omega)$ be any nonconstant function. Then $c \coloneqq \| g' \|_{L_{\Psi}} > 0$ . Then by taking $f \coloneqq \frac{q}{c}$ , we have $f \in WL_{\Psi}(\mathbb{G}, \omega)$ with $\| f' \|_{L_{\Psi}} = \| \frac{g'}{c} \|_{L_{\Psi}} = \frac{1}{c} \| g' \|_{L_{\Psi}} = 1$ . Hence, it follows from (18) that + +$$ +\int_ {\mathbb {G}} \frac {g (x)}{c} \mu (\mathrm {d} x) - \int_ {\mathbb {G}} \frac {g (x)}{c} \nu (\mathrm {d} x) = 0, +$$ + +which implies that + +$$ +\int_ {\mathbb {G}} g (x) \mu (\mathrm {d} x) = \int_ {\mathbb {G}} g (x) \nu (\mathrm {d} x). \tag {19} +$$ + +Thus, we have shown that (19) holds true for every nonconstant function $g \in WL_{\Psi}(\mathbb{G}, \omega)$ . But (19) is also obviously true for any constant function $g$ . So, we in fact obtain + +$$ +\int_ {\mathbb {G}} g (x) \mu (\mathrm {d} x) = \int_ {\mathbb {G}} g (x) \nu (\mathrm {d} x) \quad \text {f o r e v e r y} \quad g \in W L _ {\Psi} (\mathbb {G}, \omega), +$$ + +which gives $\mu = \nu$ as desired. + +(iii) Symmetry. This property is obvious from Definition 3.2 as the value $\mathcal{G}S_{\Phi}(\mu, \nu)$ is unchanged when the role of $\mu$ and $\nu$ is interchanged. That is, $\mathcal{G}S_{\Phi}(\mu, \nu) = \mathcal{G}S_{\Phi}(\nu, \mu)$ . +(iv) Triangle inequality. Let $\mu, \nu, \sigma$ be probability measures in $\mathcal{P}(\mathbb{G})$ . Then for any function $f \in WL_{\Psi}(\mathbb{G}, \omega)$ satisfying $\| f' \|_{L_{\Psi}} \leq 1$ , we have + +$$ +\begin{array}{l} \left| \int_ {\mathbb {G}} f (x) \mu (\mathrm {d} x) - \int_ {\mathbb {G}} f (x) \nu (\mathrm {d} x) \right| = \left| \left[ \int_ {\mathbb {G}} f (x) \mu (\mathrm {d} x) - \int_ {\mathbb {G}} f (x) \sigma (\mathrm {d} x) \right] + \left[ \int_ {\mathbb {G}} f (x) \sigma (\mathrm {d} x) - \int_ {\mathbb {G}} f (x) \nu (\mathrm {d} x) \right] \right| \\ \leq \left| \int_ {\mathbb {G}} f (x) \mu (\mathrm {d} x) - \int_ {\mathbb {G}} f (x) \sigma (\mathrm {d} x) \right| + \left| \int_ {\mathbb {G}} f (x) \sigma (\mathrm {d} x) - \int_ {\mathbb {G}} f (x) \nu (\mathrm {d} x) \right| \\ \leq \mathcal {G S} _ {\Phi} (\mu , \sigma) + \mathcal {G S} _ {\Phi} (\sigma , \nu). \\ \end{array} +$$ + +By taking the supremum over $f$ , this implies that $\mathcal{G}\mathcal{S}_{\Phi}(\mu, \nu) \leq \mathcal{G}\mathcal{S}_{\Phi}(\mu, \sigma) + \mathcal{G}\mathcal{S}_{\Phi}(\sigma, \nu)$ . + +Due to the above properties, we conclude that the generalized Sobolev transport $\mathcal{G}\mathcal{S}_{\Phi}(\mu ,\nu)$ is a metric on the space $\mathcal{P}(\mathbb{G})$ of probability measures on graph $\mathbb{G}$ . + +# A.4. Proof for Proposition 4.2 + +Proof. Let $\Psi_{1}$ and $\Psi_{2}$ be respectively the complementary functions of $\Phi_{1}$ and $\Phi_{2}$ according to definition (6). + +Let $t\in \mathbb{R}_+$ be arbitrary. Since $\Phi_1\leq \Phi_2$ we have: + +$$ +\begin{array}{l} a t - \Phi_ {1} (a) \geq a t - \Phi_ {2} (a) \text {f o r e v e r y} a \in \mathbb {R} _ {+}, \\ \Rightarrow \sup _ {a \geq 0} \left(a t - \Phi_ {1} (a)\right) \quad \geq \sup _ {a \geq 0} \left(a t - \Phi_ {2} (a)\right). \\ \end{array} +$$ + +This implies that + +$$ +\Psi_ {1} (t) \geq \Psi_ {2} (t), \text {f o r a l l} t \in \mathbb {R} _ {+}. +$$ + +It follows that $L_{\Psi_1}(\mathbb{G},\omega)\subset L_{\Psi_2}(\mathbb{G},\omega)$ and $WL_{\Psi_1}(\mathbb{G},\omega)\subset WL_{\Psi_2}(\mathbb{G},\omega)$ . Moreover, for any fixed Orlicz function $f^{\prime}$ and any number $t > 0$ , we have + +$$ +\int_ {\mathbb {G}} \Psi_ {1} \left(\frac {| f ^ {\prime} (x) |}{t}\right) \omega (\mathrm {d} x) \geq \int_ {\mathbb {G}} \Psi_ {2} \left(\frac {| f ^ {\prime} (x) |}{t}\right) \omega (\mathrm {d} x). +$$ + +Consequently, we obtain + +$$ +\left\{t > 0 \mid \int_ {\mathbb {G}} \Psi_ {1} \left(\frac {| f ^ {\prime} (x) |}{t}\right) \omega (\mathrm {d} x) \leq 1 \right\} \subset \left\{t > 0 \mid \int_ {\mathbb {G}} \Psi_ {2} \left(\frac {| f ^ {\prime} (x) |}{t}\right) \omega (\mathrm {d} x) \leq 1 \right\}. +$$ + +Since the infimum of a set is smaller than or equal to the infimum of its subset, we deduce that + +$$ +\left\| f ^ {\prime} \right\| _ {L _ {\Psi_ {1}}} \geq \left\| f ^ {\prime} \right\| _ {L _ {\Psi_ {2}}}. +$$ + +It follows from this and $WL_{\Psi_1}(\mathbb{G},\omega)\subset WL_{\Psi_2}(\mathbb{G},\omega)$ that + +$$ +\left\{f \mid f \in W L _ {\Psi_ {1}} (\mathbb {G}, \omega), \| f ^ {\prime} \| _ {L _ {\Psi_ {1}} (\mathbb {G}, \omega)} \leq 1 \right\} \subset \left\{f \mid f \in W L _ {\Psi_ {2}} (\mathbb {G}, \omega), \| f ^ {\prime} \| _ {L _ {\Psi_ {2}} (\mathbb {G}, \omega)} \leq 1 \right\}. +$$ + +Since the supremum of a set is larger than or equal to the supremum of its subset, we conclude that + +$$ +\mathcal {G S} _ {\Phi_ {1}} (\mu , \nu) \leq \mathcal {G S} _ {\Phi_ {2}} (\mu , \nu) +$$ + +for any input measures $\mu, \nu$ in $\mathcal{P}(\mathbb{G})$ . Therefore, the proof is completed. + +We further note that one can directly leverage the result in Theorem 3.3, where generalized Sobolev transport can be computed by solving univariate optimization problem, to simplify the proof. + +# A.5. Proof for Proposition 4.3 + +Proof. For the $N$ -function $\Phi(t) = t^p$ with $1 < p < \infty$ , we have + +$$ +L _ {\Phi} (\mathbb {G}, \omega) = L ^ {p} (\mathbb {G}, \omega), +$$ + +where $L^p (\mathbb{G},\omega)$ is the standard $L^p$ functional space which is reviewed in $\S \mathrm{B.1}$ (appendix). + +Thus, following Definition 3.1 and the definition of graph-based Sobolev transport (Le et al., 2022, Definition 3.1) (a review is given in Definition B.1 (appendix)), we have + +$$ +W L _ {\Phi} (\mathbb {G}, \omega) = W ^ {1, p} (\mathbb {G}, \omega). +$$ + +Thus, the proof is complete. + +# A.6. Proof for Proposition 4.4 + +Proof. Let $h(x) \coloneqq \mu(\Lambda(x)) - \nu(\Lambda(x))$ for $x \in \mathbb{G}$ . Then since $\Phi(t) = \frac{(p-1)^{p-1}}{p^p} t^p$ with $1 < p < \infty$ , we obtain from Theorem 3.3 that + +$$ +\begin{array}{l} \mathcal {G} \mathcal {S} _ {\Phi} (\mu , \nu) = \inf _ {k > 0} \frac {1}{k} \left(1 + \int_ {\mathbb {G}} \frac {(p - 1) ^ {p - 1}}{p ^ {p}} k ^ {p} | h (x) | ^ {p} \omega (\mathrm {d} x)\right) \\ = \inf _ {k > 0} F (k), \tag {20} \\ \end{array} +$$ + +where $F(k) \coloneqq \frac{1}{k} + \frac{(p - 1)^{p - 1}}{p^p} k^{p - 1} \int_{\mathbb{G}} |h(x)|^p \omega(\mathrm{d}x)$ for $k > 0$ . + +Let us consider the following two possibilities: + +Case 1: $\int_{\mathbb{G}}|h(x)|^p\omega (\mathrm{d}x) = 0$ . In that case, we have from (20) that + +$$ +\mathcal {G} \mathcal {S} _ {\Phi} (\mu , \nu) = \inf _ {k > 0} \frac {1}{k} = 0 = \left(\int_ {\mathbb {G}} | h (x) | ^ {p} \omega (\mathrm {d} x)\right) ^ {\frac {1}{p}} = \mathcal {S} _ {p} (\mu , \nu). +$$ + +Case 2: $\int_{\mathbb{G}} |h(x)|^p \omega(\mathrm{d}x) \neq 0$ . Then $\lim_{k \to 0^+} F(k) = \lim_{k \to +\infty} F(k) = +\infty$ . Therefore, it follows from (20) that + +$$ +\mathcal {G} \mathcal {S} _ {\Phi} (\mu , \nu) = F \left(k _ {0}\right) \tag {21} +$$ + +for some finite number $k_0 \in (0, +\infty)$ satisfying $F'(k_0) = 0$ . As $F'(k) = -\frac{1}{k^2} + \left(\frac{p-1}{p}\right)^p k^{p-2} \int_{\mathbb{G}} |h(x)|^p$ , we can solve the equation $F'(k_0) = 0$ for $k_0$ to obtain + +$$ +k _ {0} = \frac {1}{\frac {p - 1}{p} \left(\int_ {\mathbb {G}} | h (x) | ^ {p} \omega (\mathrm {d} x)\right) ^ {\frac {1}{p}}}. +$$ + +Plugging this value of $k_{0}$ into Equation (21) and using the formula for $F(k)$ , we get + +$$ +\begin{array}{l} \mathcal {G S} _ {\Phi} (\mu , \nu) = \frac {1}{k _ {0}} \left(1 + \frac {(p - 1) ^ {p - 1}}{p ^ {p}} k _ {0} ^ {p} \int_ {\mathbb {G}} | h (x) | ^ {p}\right) \\ = \frac {p - 1}{p} \left(\int_ {\mathbb {G}} | h (x) | ^ {p} \omega (\mathrm {d} x)\right) ^ {\frac {1}{p}} \left(1 + \frac {(p - 1) ^ {p - 1}}{p ^ {p}} \frac {1}{\frac {(p - 1) ^ {p}}{p ^ {p}} \left(\int_ {\mathbb {G}} | h (x) | ^ {p} \omega (\mathrm {d} x)\right)} \int_ {\mathbb {G}} | h (x) | ^ {p} \omega (\mathrm {d} x)\right) \\ = \left(\int_ {\mathbb {G}} | h (x) | ^ {p} \omega (\mathrm {d} x)\right) ^ {\frac {1}{p}} \\ = \mathcal {S} _ {p} (\mu , \nu). \\ \end{array} +$$ + +Thus, we have shown that $\mathcal{G}S_{\Phi}(\mu ,\nu) = S_p(\mu ,\nu)$ in both cases, and hence the proof is complete. + +Remark A.1. For the $N$ -function $\Phi(t) = t^q$ where $1 < q < \infty$ , its complementary function is $\Psi(t) = \frac{(p - 1)^{p - 1}}{p^p} t^p$ where $p$ is the conjugate of $q$ , i.e., $\frac{1}{q} + \frac{1}{p} = 1$ . + +# A.7. Proof for $\lim_{p\to 1^{+}}\frac{(p - 1)^{p - 1}}{p^p} t^p = t$ in Remark 4.5 + +We will prove that $\lim_{p\to 1^{+}}\frac{(p - 1)^{p - 1}}{p^p} t^p = t$ which is used in Remark 4.5. For this and since $\lim_{p\to 1^{+}}\frac{t^p}{p^p} = t$ , it is enough to show that + +$$ +\lim_{p\to 1^{+}}(p - 1)^{p - 1} = 1. +$$ + +By taking logarithm, this in turn is equivalent to proving that + +$$ +\lim _ {p \rightarrow 1 ^ {+}} \ln (p - 1) ^ {p - 1} = 0. \tag {22} +$$ + +Proof of (22). + +$$ +\lim _ {p \to 1 ^ {+}} \ln (p - 1) ^ {p - 1} = \lim _ {p \to 1 ^ {+}} \frac {\ln (p - 1)}{1 / (p - 1)} = \lim _ {p \to 1 ^ {+}} \frac {1 / (p - 1)}{- 1 / (p - 1) ^ {2}}, +$$ + +where we apply the L'Hopital's rule for the last equality. It follows that $\lim_{p\to 1^{+}}\ln (p - 1)^{p - 1} = \lim_{p\to 1^{+}} - (p - 1) = 0$ as desired. Hence, the proof is complete. + +# A.8. Complementary function for $\Phi(t) = \exp(t^p) - 1$ with $1 < p < \infty$ + +For the given $N$ -function $\Phi(t) = \exp(t^p) - 1$ with $1 < p < \infty$ , its complementary function $\Psi$ is computed as follows + +$$ +\Psi (t) = \sup _ {a \geq 0} (a t - \Phi (a)). \tag {23} +$$ + +Let us fix $t \geq 0$ and denote the objective function in Equation (23) as $F(a)$ . Then $F(a) = at - \exp(a^p) + 1$ , and we have + +$$ +F ^ {\prime} (a) = t - p a ^ {p - 1} \exp (a ^ {p}), +$$ + +$$ +F ^ {\prime \prime} (a) = - p (p - 1) a ^ {p - 2} \exp (a ^ {p}) - p ^ {2} a ^ {2 (p - 1)} \exp (a ^ {p}) = - \Big [ p (p - 1) a ^ {p - 2} + p ^ {2} a ^ {2 (p - 1)} \Big ] \exp (a ^ {p}). +$$ + +Since $1 < p < \infty$ , we obtain $F''(a) < 0$ for all $a > 0$ . Thus, $F'(a)$ is a strictly decreasing function on $(0, +\infty)$ . Additionally, we have + +$$ +F ^ {\prime} (0) = t \geq 0, +$$ + +$$ +\lim _ {a \rightarrow + \infty} F ^ {\prime} (a) = - \infty . +$$ + +Therefore, $F'(a) = 0$ has a unique root, which is denoted by $a^*$ . Then, the complementary function $\Psi$ is + +$$ +\Psi (t) = \sup _ {a \geq 0} F (a) = F (a ^ {*}) = a ^ {*} t - \exp ((a ^ {*}) ^ {p}) - 1. +$$ + +# B. Further Results and Discussions + +In this section, we give further results and discussions. + +Notations. Let $\langle x,y\rangle$ be the line segment in $\mathbb{R}^n$ connecting two points $x,y$ , and denote $(x,y)$ as the same line segment but without its two end-points. + +# B.1. On Sobolev transport + +$L^p$ functional space. For a nonnegative Borel measure $\omega$ on $\mathbb{G}$ , denote $L^p(\mathbb{G}, \omega)$ as the space of all Borel measurable functions $f: \mathbb{G} \to \mathbb{R}$ such that $\int_{\mathbb{G}} |f(y)|^p \omega(\mathrm{d}y) < \infty$ . For $p = \infty$ , we instead assume that $f$ is bounded $\omega$ -a.e. + +Functions $f_{1},f_{2}\in L^{p}(\mathbb{G},\omega)$ are considered to be the same if $f_{1}(x) = f_{2}(x)$ for $\omega$ -a.e. $x\in \mathbb{G}$ + +Then, $L^p (\mathbb{G},\omega)$ is a normed space with the norm defined by + +$$ +\| f \| _ {L ^ {p} (\mathbb {G}, \omega)} := \left(\int_ {\mathbb {G}} | f (y) | ^ {p} \omega (\mathrm {d} y)\right) ^ {\frac {1}{p}} \text {f o r} 1 \leq p < \infty , \text {a n d} +$$ + +$$ +\left\| f \right\| _ {L ^ {\infty} (\mathbb {G}, \omega)} := \inf \left\{t \in \mathbb {R}: | f (x) | \leq t \text {f o r} \omega \text {- a . e .} x \in \mathbb {G} \right\}. +$$ + +Connection between $L^p$ and $L_{\Phi}$ functional spaces. When the convex function $\Phi(t) = t^p$ , for $1 < p < \infty$ , we have + +$$ +L ^ {p} (\mathbb {G}, \omega) = L _ {\Phi} (\mathbb {G}, \omega). +$$ + +Definition B.1 (Graph-based Sobolev space (Le et al., 2022)). Let $\omega$ be a nonnegative Borel measure on $\mathbb{G}$ , and let $1 \leq p \leq \infty$ . A continuous function $f: \mathbb{G} \to \mathbb{R}$ is said to belong to the Sobolev space $W^{1,p}(\mathbb{G}, \omega)$ if there exists a function $h \in L^p(\mathbb{G}, \omega)$ satisfying + +$$ +f (x) - f \left(z _ {0}\right) = \int_ {\left[ z _ {0}, x \right]} h (y) \omega (\mathrm {d} y) \quad \forall x \in \mathbb {G}. \tag {24} +$$ + +Such function $h$ is unique in $L^p(\mathbb{G}, \omega)$ and is called the graph derivative of $f$ w.r.t. the measure $\omega$ . The graph derivative of $f \in W^{1,p}(\mathbb{G}, \omega)$ is denoted $f' \in L^p(\mathbb{G}, \omega)$ . + +Proposition B.2 (Closed-form expression of ST (Le et al., 2022)). Let $\omega$ be any nonnegative Borel measure on $\mathbb{G}$ , and let $1 \leq p \leq \infty$ . Then, we have + +$$ +\mathcal {S} _ {p} (\mu , \nu) = \left(\int_ {\mathbb {G}} | \mu (\Lambda (x)) - \nu (\Lambda (x)) | ^ {p} \omega (\mathrm {d} x)\right) ^ {\frac {1}{p}}, +$$ + +where $\Lambda (x)$ is the subset of $\mathbb{G}$ defined by Equation (1). + +Definition B.3 (Length measure (Le et al., 2022)). Let $\omega^{*}$ be the unique Borel measure on $\mathbb{G}$ such that the restriction of $\omega^{*}$ on any edge is the length measure of that edge. That is, $\omega^{*}$ satisfies: + +i) For any edge $e$ connecting two nodes $u$ and $v$ , we have $\omega^{*}(\langle x, y \rangle) = (t - s)w_{e}$ whenever $x = (1 - s)u + sv$ and $y = (1 - t)u + tv$ for $s, t \in [0,1)$ with $s \leq t$ . Here, $\langle x, y \rangle$ is the line segment in $e$ connecting $x$ and $y$ . +ii) For any Borel set $F\subset \mathbb{G}$ , we have + +$$ +\omega^ {*} (F) = \sum_ {e \in E} \omega^ {*} (F \cap e). +$$ + +Lemma B.4 ( $\omega^{*}$ is the length measure on graph (Le et al., 2022)). Suppose that $\mathbb{G}$ has no short cuts, namely, any edge $e$ is a shortest path connecting its two end-points. Then, $\omega^{*}$ is a length measure in the sense that + +$$ +\omega^ {*} ([ x, y ]) = d _ {\mathbb {G}} (x, y) +$$ + +for any shortest path $[x,y]$ connecting $x, y$ . Particularly, $\omega^{*}$ has no atom in the sense that $\omega^{*}(\{x\}) = 0$ for every $x \in \mathbb{G}$ . + +# B.2. On Wasserstein distance + +We review the definition of the $p$ -Wasserstein distance with graph metric cost for measures on graph $\mathbb{G}$ . + +Definition B.5. Let $1 \leq p < \infty$ , suppose that $\mu$ and $\nu$ are two nonnegative Borel measures on $\mathbb{G}$ satisfying $\mu(\mathbb{G}) = \nu(\mathbb{G}) = 1$ . Then, the $p$ -order Wasserstein distance between $\mu$ and $\nu$ is defined as follows: + +$$ +\mathcal {W} _ {p} (\mu , \nu) ^ {p} = \inf _ {\gamma \in \Pi (\mu , \nu)} \int_ {\mathbb {G} \times \mathbb {G}} d _ {\mathbb {G}} (x, y) ^ {p} \gamma (\mathrm {d} x, \mathrm {d} y), +$$ + +where + +$$ +\Pi (\mu , \nu) := \left\{\gamma \in \mathcal {P} (\mathbb {G} \times \mathbb {G}): \gamma_ {1} = \mu , \gamma_ {2} = \nu \right\}, +$$ + +where $\gamma_{1},\gamma_{2}$ are the first and second marginals of $\gamma$ respectively. + +# B.3. On generalized Sobolev transport + +Young inequality. Let $\Phi, \Psi$ be a pair of complementary $N$ -functions, then + +$$ +s t \leq \Psi (s) + \Phi (t). +$$ + +Equivalence (Adams & Fournier, 2003, §8.17) (Musielak, 2006, §13.11). The Luxemburg norm is equivalent to the Orlicz norm + +$$ +\left\| f \right\| _ {L _ {\Phi}} \leq \left\| f \right\| _ {\Phi} \leq 2 \left\| f \right\| _ {L _ {\Phi}}, \tag {25} +$$ + +where we recall that the Luxemburg norm $\| \cdot \|_{L_\Phi}$ is defined in Equation (3), and the Orlicz norm $\| \cdot \|_{\Phi}$ is defined in Equation (15) (see (Rao & Ren, 1991, Definition 2, pp.58)). + +Generalized Hölder inequality. Let $\Phi, \Psi$ be a pair of complementary $N$ -functions, then Hölder inequality w.r.t. Luxemburg norm (Adams & Fournier, 2003, §8.11) is as follows: + +$$ +\left| \int_ {\mathbb {G}} f (x) g (x) \omega (d x) \right| \leq 2 \| f \| _ {L _ {\Phi}} \| g \| _ {L _ {\Psi}}. \tag {26} +$$ + +Additionally, Hölder inequality w.r.t. Luxemburg norm and Orlicz norm (Musielak, 2006, §13.13) is as follows: + +$$ +\left| \int_ {\mathbb {G}} f (x) g (x) \omega (d x) \right| \leq \| f \| _ {L _ {\Phi}} \| g \| _ {\Psi}. \tag {27} +$$ + +# B.4. Further discussions + +For completeness, we recall important discussions on the underlying graph in Le et al. (2022) for ST, since they are also applied and/or adapted for the GST. + +OT problems for measures on a graph. In this work, our considered problem is to compute OT distance between two input probability measures supported on the same graph. We distinguish this line of research to the OT problem between two (different) input graphs, considered in Petric Maretic et al. (2019); Dong & Sawin (2020); Tam & Dunson (2022), where its goal is to compute the distance between two input graphs by using OT approach. + +Algorithms for the univariate optimization to compute GST. For empirical simulations, we leverage the fmincon in MATLAB with the trust-region-reflective algorithm since it is easy to compute the gradient and Hessian for the objective function for the univariate optimization problem. + +Path length for points in $\mathbb{G}$ (Le et al., 2023). We can canonically measure a path length connecting any two points $x, y \in \mathbb{G}$ where $x, y$ are not necessary to be nodes in $V$ . Indeed, for $x, y \in \mathbb{R}^n$ belonging to the same edge $e = \langle u, v \rangle$ which connects two nodes $u, v \in V$ , we have + +$$ +x = (1 - s) u + s v, +$$ + +$$ +y = (1 - t) u + t v, +$$ + +for some numbers $t, s \in [0,1]$ . Therefore, the length of the path connecting $x, y$ along the edge $e$ (i.e., the line segment $\langle x, y \rangle$ ) is defined by $|t - s|w_e$ . + +Thus, the length for an arbitrary path in $\mathbb{G}$ can be similarly defined by breaking down into pieces over edges and summing over their corresponding lengths (Le et al., 2022). + +Extension to measures supported on $\mathbb{G}$ . Similar to ST (Le et al., 2022), the discrete case of GST in Equation (8) can be extended for measures with finite supports on $\mathbb{G}$ (i.e., measures which may have supports on edges) by using the same strategy to measure a path length for points in $\mathbb{G}$ (discussed in the above paragraph). More precisely, we break down edges containing supports into pieces and sum over their corresponding values instead of the sum over edges as in Equation (8). + +About the assumption of uniqueness property of the shortest paths on $\mathbb{G}$ . As discussed in (Le et al., 2022) for the ST, note that $w_{e} \in \mathbb{R}$ for any edge $e \in E$ in $\mathbb{G}$ , it is almost surely that every node in $V$ can be regarded as unique-path root node (with a high probability, lengths of paths connecting any two nodes in graph $\mathbb{G}$ are different). + +Additionally, for some special graph, e.g., a grid of nodes, there is no unique-path root node for such graph. However, by perturbing each node (and/or perturbing lengths of edges in case $\mathbb{G}$ is a non-physical graph) with a small deviation, we can obtain a graph satisfying the unique-path root node assumption. + +About the generalized Sobolev transport (GST). Similar to the ST (Le et al., 2022), we assume that the graph metric space (i.e., the graph structure) is given, and leave the question to learn an optimal graph metric structure from data for future work. + +About graphs $\mathbb{G}_{\mathrm{Log}}$ and $\mathbb{G}_{\mathrm{Sqrt}}$ (Le et al., 2022). We use a clustering method, e.g., the farthest-point clustering, to partition supports of measures into at most $M$ clusters. Then, let $V$ be the set of centroids of these clusters, i.e., graph vertices. For edges, in graph $\mathbb{G}_{\mathrm{Log}}$ , we randomly choose $M\log(M)$ edges; and $M^{3/2}$ edges for graph $\mathbb{G}_{\mathrm{Sqrt}}$ . We further denote the set of those randomly sampled edges as $\tilde{E}$ . + +For each edge $e$ , its corresponding edge length (i.e., weight) $w_{e}$ is computed by the Euclidean distance between the two corresponding nodes of edge $e$ . Let $n_c$ be the number of connected components in the graph $\tilde{\mathbb{G}}(V, \tilde{E})$ . Then, we randomly add $(n_c - 1)$ more edges between these $n_c$ connected components to construct a connected graph $\mathbb{G}$ from $\tilde{\mathbb{G}}$ . Let $E_{c}$ be the set of these $(n_c - 1)$ added edges and denote set $E = \tilde{E} \cup E_{c}$ , then $\mathbb{G}(V, E)$ is the constructed graph. + +Huber function and its corresponding normalized function (Andoni et al., 2018). Consider the Huber function (Huber, + +![](images/7c23fe50b59aa52533c4296e6a1bde6da49688a34d0f0585b65f38d855ccc166.jpg) + +![](images/c381ccfb4128de2c9c314473e4bdf992849f240f0210c87846f27e566ca088bc.jpg) + +![](images/1ce2b92a7b57aeacfc624026bafea656a5d55b961ff4f5f5291432acfdab9b9a.jpg) + +![](images/c24a8870be5558c95b05ae4c2ce533e1d3a10a409659e8efa55cce2865d7997e.jpg) + +![](images/81c8149b3baa44576f16eeb580afdaf53512baabf406257044483da69e8602cb.jpg) +Figure 7. Document classification on graph $\mathbb{G}_{\mathrm{Log}}$ ( $M = 10^{3}$ ). + +![](images/24d31c83df4a6316dd59d05588a641af852d3b1660d755428b85fe985ab3e595.jpg) + +![](images/3227ae9b09b480f9a5f9313f43365509df68b0f5d4894a3389a250d4e5a6fc27.jpg) + +![](images/800e009ae1b4117a0f88f26af58dfa3932268241ef0d2996506258aace8da885.jpg) + +1992) on the domain $[0, +\infty)$ , defined as, + +$$ +f _ {H} (t) = \left\{ \begin{array}{l l} t ^ {2} / 2 & \text {i f} 0 \leq t \leq \delta \\ \delta (t - \delta / 2) & \text {i f} t > \delta , \end{array} \right. \tag {28} +$$ + +where $\delta > 0$ is a constant. Then, the normalized Huber function (Andoni et al., 2018) on the domain $[0, +\infty)$ is defined as + +$$ +\Phi_ {H} (t) = \left\{ \begin{array}{l l} f _ {H} \left(f _ {H} ^ {- 1} (1) t\right) & \text {i f} 0 \leq t \leq 1 \\ \Phi_ {H _ {-}} ^ {\prime} (1) t - \left(\Phi_ {H _ {-}} ^ {\prime} (1) - 1\right) & \text {i f} t > 1, \end{array} \right. \tag {29} +$$ + +where $\Phi_{H - }^{\prime}$ is the left derivative of $\Phi_H$ + +Hyperparameter validation. For validation, we further randomly split the training set into $70\% / 30\%$ for validation-training and validation with 10 repeats to choose hyper-parameters in our simulations. + +The number of pairs in training and test for kernel SVM. Let $N_{tr}$ , $N_{te}$ be the number of measures used for training and test respectively. For the kernel SVM training, the number of pairs which we compute the distances is $(N_{tr} - 1) \times \frac{N_{tr}}{2}$ . For the test phase, the number of pairs which we compute the distances is $N_{tr} \times N_{te}$ . Therefore, for 1 repeat, the number of pairs which we compute the distances for both training and test is totally $N_{tr} \times \left( \frac{N_{tr} - 1}{2} + N_{te} \right)$ . + +# B.5. Further empirical results + +Document classification. We further illustrate document classification on graphs $\mathbb{G}_{\mathrm{Log}}$ and $\mathbb{G}_{\mathrm{Sqrt}}$ for: + +- $M = 10^{3}$ in Figures 7 and 8 respectively. +- $M = 10^{2}$ in Figures 9 and 10 respectively. + +TDA. We also further illustrate TDA on graphs $\mathbb{G}_{\mathrm{Log}}$ and $\mathbb{G}_{\mathrm{Sqrt}}$ for: + +- $M = 10^{3}$ in Figures 11 and 12 respectively. +- $M = 10^{2}$ in Figures 13 and 14 respectively. + +![](images/466d593a1e299d6d7fbdf2ab0a689871f8a6ab15f93b0a1f935f39d800130ddd.jpg) +Figure 8. Document classification on graph $\mathbb{G}_{\mathrm{Sqrt}}$ ( $M = 10^{3}$ ). + +![](images/b1b99b26c31ecf71c63b92145c333b01dd9a78cde574bef29bb6d2b657c8368a.jpg) +Figure 9. Document classification on graph $\mathbb{G}_{\mathrm{Log}}$ ( $M = 10^{2}$ ). + +![](images/575a04d29d7777d1cef40aabe2182ef8903a09c7d134e2eb1ad1b5afc21237da.jpg) +Figure 10. Document classification on graph $\mathbb{G}_{\mathrm{Sqrt}}$ ( $M = 10^{2}$ ). + +![](images/1933c72acea428ab587aaed0089c433ac0f252c63e89eb17fea8a372f1a98850.jpg) + +![](images/c066d3ee8743e20c3764bc6f53cfa7cacae0262c001683e02c2563eaefe0900d.jpg) +Figure 11. Topological data analysis on graph $\mathbb{G}_{\mathrm{Log}}$ ( $M = 10^{3}$ ). + +![](images/f32836e9d64c55c9440fb44fec8fed0677cea8abb952264d13f93f8d6e4cc45b.jpg) +Figure 12. Topological data analysis on graph $\mathbb{G}_{\mathrm{Sqrt}}$ ( $M = 10^{3}$ ). + +![](images/45411d7b30247080f6ca9b3e5c897cfdf8800bcc1810088c556fe3329f438d0d.jpg) +Figure 13. Topological data analysis on graph $\mathbb{G}_{\mathrm{Log}}$ ( $M = 10^{2}$ ). +Figure 14. Topological data analysis on graph $\mathbb{G}_{\mathrm{Sqrt}}$ ( $M = 10^{2}$ ). \ No newline at end of file diff --git a/generalizedsobolevtransportforprobabilitymeasuresonagraph/images.zip b/generalizedsobolevtransportforprobabilitymeasuresonagraph/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..df558e19ce5f33b5574b76a1ddd1e10eb6dc95b4 --- /dev/null +++ b/generalizedsobolevtransportforprobabilitymeasuresonagraph/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e244c8e8a97334f784271449c8e332a229d509f492f78798b2e039f5719f5234 +size 1141294 diff --git a/generalizedsobolevtransportforprobabilitymeasuresonagraph/layout.json b/generalizedsobolevtransportforprobabilitymeasuresonagraph/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..fd870a084742aca9785543ba3b41637ca3610168 --- /dev/null +++ b/generalizedsobolevtransportforprobabilitymeasuresonagraph/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c9e76ef1e750190d2f1fe42fc584291cb3014f63aa9c2dd14c567fe3850eca1b +size 1324187 diff --git a/generalizingknowledgegraphembeddingwithuniversalorthogonalparameterization/0e58a898-eb00-4814-90d9-56e04418fa37_content_list.json b/generalizingknowledgegraphembeddingwithuniversalorthogonalparameterization/0e58a898-eb00-4814-90d9-56e04418fa37_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..78bda97a0dc4475b7379c4f4fd3844abb9b13425 --- /dev/null +++ b/generalizingknowledgegraphembeddingwithuniversalorthogonalparameterization/0e58a898-eb00-4814-90d9-56e04418fa37_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6987ccf3c03ca94ec6aa55e8a64395374f11d4ec72ba06e8c58babe2f0478423 +size 173134 diff --git a/generalizingknowledgegraphembeddingwithuniversalorthogonalparameterization/0e58a898-eb00-4814-90d9-56e04418fa37_model.json b/generalizingknowledgegraphembeddingwithuniversalorthogonalparameterization/0e58a898-eb00-4814-90d9-56e04418fa37_model.json new file mode 100644 index 0000000000000000000000000000000000000000..7e9a91e51b3adafa7eaae7310722ff74f9e9ed19 --- /dev/null +++ b/generalizingknowledgegraphembeddingwithuniversalorthogonalparameterization/0e58a898-eb00-4814-90d9-56e04418fa37_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bfe469258c18db6827f6d345c7c5446d2da758bd8c32596b1e61a5a228a40c3b +size 206328 diff --git a/generalizingknowledgegraphembeddingwithuniversalorthogonalparameterization/0e58a898-eb00-4814-90d9-56e04418fa37_origin.pdf b/generalizingknowledgegraphembeddingwithuniversalorthogonalparameterization/0e58a898-eb00-4814-90d9-56e04418fa37_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..f024ed8a58ea388d9b57eb969cfa430bd2ea8f97 --- /dev/null +++ b/generalizingknowledgegraphembeddingwithuniversalorthogonalparameterization/0e58a898-eb00-4814-90d9-56e04418fa37_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e817aab4f3afdc834bbee869ebb52fe7cfe71d1dd4d4ae950c8a91ad667f22dc +size 676920 diff --git a/generalizingknowledgegraphembeddingwithuniversalorthogonalparameterization/full.md b/generalizingknowledgegraphembeddingwithuniversalorthogonalparameterization/full.md new file mode 100644 index 0000000000000000000000000000000000000000..7fb53f44859f0ada478c30c236b97dcace3ce727 --- /dev/null +++ b/generalizingknowledgegraphembeddingwithuniversalorthogonalparameterization/full.md @@ -0,0 +1,729 @@ +# Generalizing Knowledge Graph Embedding with Universal Orthogonal Parameterization + +Rui Li1 Chaozhuo Li2 Yanming Shen3 Zeyu Zhang1 Xu Chen1 + +# Abstract + +Recent advances in knowledge graph embedding (KGE) rely on Euclidean/hyperbolic orthogonal relation transformations to model intrinsic logical patterns and topological structures. However, existing approaches are confined to rigid relational orthogonalization with restricted dimension and homogeneous geometry, leading to deficient modeling capability. In this work, we move beyond these approaches in terms of both dimension and geometry by introducing a powerful framework named GoldE, which features a universal orthogonal parameterization based on a generalized form of Householder reflection. Such parameterization can naturally achieve dimensional extension and geometric unification with theoretical guarantees, enabling our framework to simultaneously capture crucial logical patterns and inherent topological heterogeneity of knowledge graphs. Empirically, GoldE achieves state-of-the-art performance on three standard benchmarks. Codes are available at https://github.com/xxrep/GoldE. + +# 1. Introduction + +Knowledge graphs (KGs) structurally organize vast human knowledge into the factual triples, where each triple $(h,r,t)$ signifies the existence of a relation $r$ between head entity $h$ and tail entity $t$ . Imbued with a wealth of factual knowledge, KGs have facilitated a myriad of downstream applications (Saxena et al., 2020; Yasunaga et al., 2022; Sun et al., 2023). However, real-world KGs such as Freebase (Bollacker et al., 2008) are plagued by incompleteness (Bordes et al., 2013). This motivates substantial research on Knowledge Graph + +$^{1}$ Gaoling School of Artificial Intelligence, Renmin University of China, Beijing, China $^{2}$ Key Laboratory of Trustworthy Distributed Computing and Service (MOE), Beijing University of Posts and Telecommunications, China $^{3}$ School of Computer Science and Technology, Dalian University of Technology, China. Correspondence to: Xu Chen . + +Proceedings of the $41^{st}$ International Conference on Machine Learning, Vienna, Austria. PMLR 235, 2024. Copyright 2024 by the author(s). + +![](images/88b50f6c5c5408de8858bc2c6b80ef53a732f32d008501c88a4a817a211bbe74.jpg) +Figure 1. Illustrations of logical patterns (a-d) (Sun et al., 2019) and topological structures (e-f) (Chami et al., 2020). + +Embedding (KGE), which learns expressive representations of entities and relations for predicting the missing links. + +The key to KGE lies in capturing crucial logical patterns (e.g., symmetry, antisymmetry, inversion and composition) (Sun et al., 2019) and inherent topological structures (e.g., cyclicity and hierarchy) (Chami et al., 2020) as illustrated in Figure 1. Recent advances highlight the effectiveness of orthogonal relation transformations for this principle. As a pioneering work, RotatE (Sun et al., 2019) represents relations as 2-dimensional Euclidean rotations, i.e., isometries on 1-spheres (Sommer, 2013), which is able to model the four logical patterns and cyclical structures. The subsequent works can be categorized into two branches: (1) "Dimension Branch" (Zhang et al., 2019; Gao et al., 2020; Cao et al., 2021; Li et al., 2022) extends the (Euclidean) orthogonal relation transformations into higher-dimensional spaces for better modeling capacity; (2) "Geometry Branch" (Balazevic et al., 2019; Chami et al., 2020) leverages hyperbolic isometries to preserve the hierarchical structures. + +However, it takes two to tango—none of existing approaches can simultaneously break the restrictions of dimension and geometry for orthogonal relation transformations. As shown in Table 1, the dimensional extensions are entrenched in Euclidean geometry, while the hyperbolic relational orthogonalization remains constrained in low-dimensional spaces due to the significant computational demand and complexity. Moreover, all these approaches are specifically designed on homogeneous geometry, which is inadequate to preserve the topological heterogeneity of KGs—in some regions cyclical, in others hierarchical (Gu et al., 2019; Skopek et al., 2020; Wang et al., 2021). In light of such limitations, a challenging + +Table 1. Recent models' capability of modeling logical patterns and topological structures of KGs. E, P and Q denote Euclidean, elliptic and hyperbolic geometries for orthogonal relation transformations, respectively. Note that Euclidean models essentially act by isometries on hyperspheres (Sommer, 2013), which can be viewed as special cases of our elliptic parameterization. + +
ModelGeometry of Orth.Dimension of Orth.Logical PatternsTopological Structures
SymmetryAntisymmetryInversionCompositionCyclicityHierarchy
RotatE (Sun et al., 2019)E2✓✓✓✓✓X
Rotate3D (Gao et al., 2020)E3✓✓✓✓✓X
DualE (Cao et al., 2021)E3✓✓✓X✓X
QuatE (Zhang et al., 2019)E4✓✓✓X✓X
HousE (Li et al., 2022)Ek✓✓✓✓✓X
RefH (Chami et al., 2020)Q2✓✓✓✓X✓
RotH (Chami et al., 2020)Q2✓✓✓✓X✓
AttH (Chami et al., 2020)Q2✓✓✓✓X✓
GoldEP(E), Qk✓✓✓✓✓✓
+ +question arises: can we generalize these approaches in both dimension and geometry to achieve the best of all worlds? + +In this paper, we give an affirmative answer by presenting a general framework named GoldE, which represents relations with a universal orthogonal parameterization. To establish the universality, we first derive a generalized form of Householder reflection (Householder, 1958) based on a quadratic inner product. By treating such reflection as the elementary operator, we can then theoretically design elegant mappings to parameterize orthogonal relation transformations of typical geometric types (i.e., Euclidean, elliptic and hyperbolic). Each of them breaks through the dimensional rigidity without losing degrees of freedom, enabling superior capacity for modeling logical patterns and corresponding topologies. Considering the inherent topological heterogeneity of KGs, we further integrate the designed mappings within a product manifold (Ficken, 1939) to unify multiple geometric types of orthogonal transformations. In this way, such parameterization can simultaneously achieve dimensional extension and geometric unification for relational orthogonalization, empowering our framework to better match heterogeneous topologies and thus provide higher-quality representations. + +Contributions: To the best of our knowledge, GoldE is the first framework that generalizes existing KGE approaches in both dimension and geometry of the orthogonal relation transformations. With theoretical guarantees, we establish a universal orthogonal parameterization, based on which our GoldE can simultaneously capture crucial logical patterns and inherent topological heterogeneity as shown in Table 1. Empirically, we conduct extensive experiments over three standard benchmarks, and GoldE consistently outperforms current state-of-the-art baselines across all the datasets. + +# 2. Preliminaries + +# 2.1. Problem Setup + +Given the entity set $\mathcal{V}$ and relation set $\mathcal{R}$ , a knowledge graph can be formally defined as a collection of factual triples $\mathcal{F} =$ + +$\{(h,r,t)\} \subseteq \mathcal{V}\times \mathcal{R}\times \mathcal{V},$ where each triple represents that there is a relation $r$ between head entity $h$ and tail entity $t$ . As an effective technique for automatically inferring missing links, KGE encodes entities and relations into expressive representations, and measures the plausibility of each triple with a pre-defined score function. + +# 2.2. Geometric Background + +We briefly introduce some necessary background on elliptic and hyperbolic geometry. More relevant details are available in the standard texts (Do Carmo, 1992; Eisenhart, 1997). + +Elliptic Manifold: Let $\mathbf{p} \in \mathbb{R}_+^k$ be a weighting vector where all elements are positive. For any $\mathbf{x}, \mathbf{y} \in \mathbb{R}^k$ , the elliptic inner product (Özdemir, 2016) is defined as: + +$$ +\langle \mathbf {x}, \mathbf {y} \rangle_ {\mathbf {p}} = \mathbf {x} ^ {\top} \operatorname {d i a g} (\mathbf {p}) \mathbf {y} = p _ {1} x _ {1} y _ {1} + \dots + p _ {k} x _ {k} y _ {k}. +$$ + +For any $\beta > 0$ , the elliptic manifold (ellipsoid) $\mathbb{P}_{\mathbf{p},\beta}^{k}$ is the following submanifold in $\mathbb{R}^k$ : + +$$ +\mathbb {P} _ {\mathbf {p}, \beta} ^ {k} = \left\{\mathbf {x} \in \mathbb {R} ^ {k}: \left\langle \mathbf {x}, \mathbf {x} \right\rangle_ {\mathbf {p}} = \beta \right\}. \tag {1} +$$ + +If one set $\mathbf{p}$ to an all-ones vector $\mathbf{1}$ , $\langle \mathbf{x},\mathbf{y}\rangle_{\mathbf{p}} = \sum_{i = 1}^{k}x_{i}y_{i}$ is the Euclidean inner product, based on which the ellipsoid $\mathbb{P}_{\mathbf{p},\beta}^k$ is specialized into the hypersphere $\mathbb{S}_\beta^k$ . + +Hyperbolic Manifold: This paper chooses the hyperboloid model of hyperbolic space for its simplicity and numerical stability (Nickel & Kiela, 2018). Let $\mathbf{q} \in \mathbb{R}^k$ be a weighting vector with the first element equal to $-1$ and the remaining elements equal to $+1$ . For any $\mathbf{x}, \mathbf{y} \in \mathbb{R}^k$ , the hyperbolic (Lorentz) inner product is defined as: + +$$ +\langle \mathbf {x}, \mathbf {y} \rangle_ {\mathbf {q}} = \mathbf {x} ^ {\top} \operatorname {d i a g} (\mathbf {q}) \mathbf {y} = - x _ {1} y _ {1} + x _ {2} y _ {2} + \dots + x _ {k} y _ {k}. +$$ + +For any $\beta > 0$ , the hyperboloid $\mathbb{Q}_{\beta}^{k}$ is denoted as: + +$$ +\mathbb {Q} _ {\beta} ^ {k} = \left\{\mathbf {x} \in \mathbb {R} ^ {k}: \langle \mathbf {x}, \mathbf {x} \rangle_ {\mathbf {q}} = - \beta , x _ {1} > 0 \right\}. \tag {2} +$$ + +For the sake of clarification, all notations used in this paper are listed in Appendix A. + +![](images/7e8d09ac5c7d4b6fc8bc32cfaaaef1d45c0dff844090551b52e6dd758667426b.jpg) +(a) + +![](images/0d4b8faaa7c82a1de50320be6dbd0a2341d783113b7145007fb4c7269f84b5f2.jpg) +(b) +Figure 2. (a) Illustration of generalized Householder reflection; (b) Three types of reflections of $\mathbf{x}$ about the hyperplanes $\zeta$ orthogonal to $\mathbf{u}$ under different weighting vectors, i.e., Euclidean (green lines), elliptic (purple lines) and hyperbolic (blue lines). Note that all quantities are displayed in the uniformly weighted Euclidean space, thus the non-Euclidean hyperplanes $\zeta_{\mathbb{P}}$ and $\zeta_{\mathbb{Q}}$ do not appear perpendicular to $\mathbf{u}$ ; (c) Elliptic orthogonal parameterization in 2-dimensional space; (d) Hyperbolic orthogonal parameterization in 2-dimensional space. + +![](images/69be8191460e67f15fb4ca15f91dec613ab4563ba2745105eeb9f428965e46b6.jpg) +(c) + +![](images/0943c544530228e1761c4d069355137aa2f4da39713c78f49907f8098b8d09bb.jpg) +(d) + +# 3. Methodology + +# 3.1. Generalized Orthogonal Matrix and Mapping + +In the first step, we seek an elegant parameterization method for modeling orthogonal matrices in Euclidean, elliptic and hyperbolic spaces of arbitrary dimension $k$ . To establish this universality, we take a broader perspective by introducing a generalized space equipped with a quadratic inner product. + +Quadratic form: For any $\mathbf{x},\mathbf{y}\in \mathbb{R}^k$ , the quadratic inner product $\langle \mathbf{x},\mathbf{y}\rangle_{\mathbf{w}}$ with respect to $\mathbf{w}\in \mathbb{R}^k$ is defined as: + +$$ +\langle \mathbf {x}, \mathbf {y} \rangle_ {\mathbf {w}} = \mathbf {x} ^ {\top} \operatorname {d i a g} (\mathbf {w}) \mathbf {y} = \sum_ {i = 1} ^ {k} w _ {i} x _ {i} y _ {i}, \tag {3} +$$ + +where $\mathbf{w}$ is a weighting vector with no elements equal to 0, ensuring that $\langle \mathbf{x},\mathbf{y}\rangle_{\mathbf{w}}$ is non-degenerate. + +Generalized orthogonal matrix: In the generalized space endowed with $\langle \mathbf{x},\mathbf{y}\rangle_{\mathbf{w}}$ , a real square matrix $\mathbf{G} \in \mathbb{R}^{k\times k}$ is orthogonal if it satisfies: + +$$ +\langle \mathbf {G} \mathbf {x}, \mathbf {G} \mathbf {y} \rangle_ {\mathbf {w}} = \langle \mathbf {x}, \mathbf {y} \rangle_ {\mathbf {w}} \Leftrightarrow \mathbf {G} ^ {\top} \operatorname {d i a g} (\mathbf {w}) \mathbf {G} = \operatorname {d i a g} (\mathbf {w}). \tag {4} +$$ + +We call the set of all $\mathbf{G}$ as the generalized orthogonal group in dimension $k$ , denoted by $\mathbf{O}_{\mathbf{w}}(k)$ . According to Equation (1) and (2), the generalized orthogonal matrix $\mathbf{G} \in \mathbf{O}_{\mathbf{w}}(k)$ can be naturally specialized into Euclidean, elliptic and hyperbolic spaces by setting $\mathbf{w}$ to $\mathbf{1}$ , $\mathbf{p}$ and $\mathbf{q}$ , respectively. Based on this observation, we turn to modeling such generalized orthogonal matrices for establishing the universality. + +Generalized Householder matrix: Before fully covering all $\mathbf{G} \in \mathbf{O}_{\mathbf{w}}(k)$ , we start with the simplest case: elementary reflection matrix, which is also known as the Householder matrix (Householder, 1958) in Euclidean space. Here we derive the generalized form of Householder matrix in the quadratic inner product space. + +Geometrically, the generalized Householder matrix $\mathbf{H}$ describes an elementary reflection from $\mathbf{x}$ to $\mathbf{x}'$ about a hyperplane $\zeta$ as shown in Figure 2(a). Given a normal vector + +$\mathbf{u} \in \mathbb{R}^k$ of $\zeta$ , the projection of $\mathbf{x}$ onto $\mathbf{u}$ is denoted as: + +$$ +\operatorname {P r o} _ {\mathbf {u}} (\mathbf {x}) = \frac {\langle \mathbf {u} , \mathbf {x} \rangle_ {\mathbf {w}}}{\langle \mathbf {u} , \mathbf {u} \rangle_ {\mathbf {w}}} \mathbf {u}. \tag {5} +$$ + +By the law of vector addition, the projection of $\mathbf{x}$ onto the hyperplane $\zeta$ , i.e., $\operatorname{Pro}_{\zeta}(\mathbf{x})$ , is calculated as: + +$$ +\operatorname {P r o} _ {\zeta} (\mathbf {x}) = \mathbf {x} - \operatorname {P r o} _ {\mathbf {u}} (\mathbf {x}). \tag {6} +$$ + +Based on the concept of projections, we move to the elementary reflection of $\mathbf{x}$ with respect to $\zeta$ in the quadratic inner product space. The resulting vector $\mathbf{x}'$ is given by: + +$$ +\mathbf {x} ^ {\prime} = \operatorname {P r o} _ {\zeta} (\mathbf {x}) - \operatorname {P r o} _ {\mathbf {u}} (\mathbf {x}) = \underbrace {\left(\mathbf {I} - 2 \frac {\mathbf {u u} ^ {\top} \operatorname {d i a g} (\mathbf {w})}{\mathbf {u} ^ {\top} \operatorname {d i a g} (\mathbf {w}) \mathbf {u}}\right)} _ {\mathbf {H} (\mathbf {u}, \mathbf {w})} \mathbf {x}, \tag {7} +$$ + +where $\mathbf{I} \in \mathbb{R}^{k \times k}$ is the identity matrix. Notably, the induced reflection matrix $\mathbf{H}(\mathbf{u}, \mathbf{w})$ , with normal vector $\mathbf{u}$ and weighting vector $\mathbf{w}$ as variables, can be viewed as a generalization of Euclidean Householder matrix ( $\mathbf{w} = \mathbf{1}$ ) in the quadratic inner product space. It is straightforward to demonstrate that the generalized Householder matrix $\mathbf{H}(\mathbf{u}, \mathbf{w})$ is orthogonal, which satisfies the inner product invariance in Equation (4). Figure 2(b) illustrates the Euclidean, elliptic and hyperbolic reflections in 2-dimensional space, described by $\mathbf{H}$ with $\mathbf{w}$ equal to $\mathbf{1}$ , $\mathbf{p}$ and $\mathbf{q}$ , respectively. + +Orthogonal mapping: By taking the elementary reflections as basic operators, we can design a mapping to represent the generalized orthogonal transformations. Formally, given a series of vectors $\mathbf{U} = \{\mathbf{u}_c\}_{c=1}^n$ where $\mathbf{u}_c \in \mathbb{R}^k$ , we define the mapping with respect to $\mathbf{w} \in \mathbb{R}^k$ as follows: + +$$ +\operatorname {O r t h} (\mathbf {U}, \mathbf {w}) = \prod_ {c = 1} ^ {n} \mathbf {H} \left(\mathbf {u} _ {c}, \mathbf {w}\right). \tag {8} +$$ + +Since each $\mathbf{H}(\mathbf{u}_c,\mathbf{w})$ preserves the quadratic inner product, one can easily verify that the output of $\mathrm{Orth}(\mathbf{U},\mathbf{w})$ is also a generalized orthogonal matrix according to Equation (4). Moreover, we have the following theorem: + +Theorem 3.1. When $n = k$ , the image of Orth is the set of all $k \times k$ generalized orthogonal matrices, i.e., $\operatorname{Image}(\operatorname{Orth}) = \mathbf{O}_{\mathbf{w}}(k)$ . (See proof in Appendix B) + +This theorem guarantees that the output of Orth completely covers the generalized orthogonal group $\mathbf{O}_{\mathbf{w}}(k)$ . Therefore, such a mapping can naturally represent all the orthogonal matrices of Euclidean, elliptic and hyperbolic types with the weighting vector $\mathbf{w}$ equal to $\mathbf{1}$ , $\mathbf{p}$ and $\mathbf{q}$ , respectively. + +# 3.2. GoldE: Universal Orthogonal Parameterization + +In the following, we leverage the derived mapping Orth as the cornerstone to develop the elliptic (Section 3.2.1) and hyperbolic (Section 3.2.2) orthogonal parameterizations for modeling relations, which are further integrated in a product manifold to establish our GoldE framework (Section 3.2.3). + +# 3.2.1. ELLIPTIC ORTHOGONAL PARAMETERIZATION + +To better capture logical patterns and cyclical structures of KGs, we propose to model each relation as a $k$ -dimensional elliptic orthogonal transformation between head and tail entities with the designed mapping Orth in Equation (8). + +Given an elliptic weighting vector $\mathbf{p} \in \mathbb{R}_+^k$ , the initial embedding $\mathbf{e}_v \in \mathbb{R}^k$ for entity $v \in \mathcal{V}$ can be regarded as lying on the ellipsoid $\mathbb{P}_{\mathbf{p},\beta_{\mathbf{e}_v,\mathbf{p}}}^k$ , where $\beta_{\mathbf{e}_v,\mathbf{p}} = \langle \mathbf{e}_v, \mathbf{e}_v \rangle_{\mathbf{p}}$ . Considering that each entity typically exhibits different characteristics when involving different relations (Wang et al., 2014), we define a learnable weighting vector $\mathbf{p}_r$ for each relation $r \in \mathcal{R}$ to associate entities with the $r$ -specific ellipsoid. For each triple $(h,r,t)$ , the $r$ -associated embeddings of head entity $h$ and tail entity $t$ are denoted as $\mathbf{e}_{h,r} \in \mathbb{P}_{\mathbf{p}_r,\beta_{\mathbf{e}_h,\mathbf{p}_r}}^k$ and $\mathbf{e}_{t,r} \in \mathbb{P}_{\mathbf{p}_r,\beta_{\mathbf{e}_t,\mathbf{p}_r}}^k$ . We then represent relation $r$ as an elliptic orthogonal transformation between $\mathbf{e}_{h,r}$ and $\mathbf{e}_{t,r}$ . Formally, the embedding of relation $r$ is defined as $\mathbf{U}_r \in \mathbb{R}^{k \times k}$ , in which each row $\mathbf{U}_r[i] \in \mathbb{R}^k$ is a normal vector for elementary reflection. Taking $\mathbf{U}_r$ and $\mathbf{p}_r$ as input to the mapping Orth, we can apply the $r$ -specific elliptic orthogonal transformation to the head embedding $\mathbf{e}_{h,r}$ : + +$$ +\begin{array}{l} \mathbf {e} _ {h, r} ^ {\prime} = \operatorname {O r t h} _ {\mathbb {P}} \left(\mathbf {U} _ {r}, \mathbf {p} _ {r}\right) \mathbf {e} _ {h, r} \\ = \prod_ {i = 1} ^ {k} \mathbf {H} \left(\mathbf {U} _ {r} [ i ], \mathbf {p} _ {r}\right) \mathbf {e} _ {h, r}. \tag {9} \\ \end{array} +$$ + +Based on Theorem 3.1, any $k$ -dimensional elliptic orthogonal relation transformation can be naturally represented by Equation (9) without any loss of degrees of freedom. + +Objective function: If triple $(h,r,t)$ holds, the transformed head embedding $\mathbf{e}_{h,r}^{\prime}$ is expected to be close to the tail embedding $\mathbf{e}_{t,r}$ . Figure 2(c) illustrates the elliptic orthogonal parameterization in 2-dimensional space. Note that $\mathbf{e}_{h,r}^{\prime}$ and $\mathbf{e}_{t,r}$ lie on the ellipsoids that have the same $\mathbf{p}_r$ but different $\beta$ . To measure such proximity, we introduce the extrinsic + +Mahalanobis distance (Mitchell & Krzanowski, 1985) as the score function for each $(h,r,t)$ : + +$$ +\begin{array}{l} s _ {r} (h, t) = - d _ {\mathbb {P}} \left(\mathbf {e} _ {h, r} ^ {\prime}, \mathbf {e} _ {t, r}\right) \tag {10} \\ = - \sqrt {(\mathbf {e} _ {h , r} ^ {\prime} - \mathbf {e} _ {t , r}) ^ {\top} \operatorname {d i a g} (\mathbf {p} _ {r}) (\mathbf {e} _ {h , r} ^ {\prime} - \mathbf {e} _ {t , r})}. \\ \end{array} +$$ + +Note that it is also possible to normalize all entities onto one ellipsoid and measure similarity using the elliptic geodesic distance. However, the extrinsic measurement usually works better in practice (Sun et al., 2019; Wang et al., 2021). + +Connections to Euclidean models: As shown in Table 1, a series of existing models such as RotatE, QuatE and HousE represent relations as Euclidean orthogonal transformations with respective dimensions. All these models can be viewed as the special cases of the proposed elliptic parameterization by setting $\mathbf{p}_r$ to $\mathbf{1}$ for all $r\in \mathcal{R}$ . With the designed orthogonal mapping Orth, our parameterization is applicable to the space of any dimension $k$ . Moreover, we highlight that such elliptic generalization moves beyond Euclidean models by introducing an additional relation-specific scaling operation. Formally, we can prove the following claim: + +Claim 3.2. The proposed elliptic parameterization can be reformulated as Euclidean parameterization equipped with element-wise scaling transformations determined by $\sqrt{\mathbf{p}_r}$ . (See proof in Appendix C) + +Such scaling transformations enable an adaptive adjustment of the margin in loss function to fit for complex relations (Chao et al., 2021). However, elliptic geometry is inherently not the optimal choice for preserving the hierarchical structures due to its mismatched geometric characteristics, which then motivates us to investigate hyperbolic parameterization. + +# 3.2.2. HYPERBOLIC ORTHOGONAL PARAMETERIZATION + +As a complement for preserving the hierarchical structures of KGs with low distortion, we further represent relations as $k$ -dimensional hyperbolic orthogonal transformations. + +In order to rigorously measure similarity with the hyperbolic geodesic distance1, we begin by projecting the initial entity embeddings $\mathbf{e}_h$ and $\mathbf{e}_t$ to the hyperboloid via the hyperbolic exponential map $g_{\beta}:\mathbb{R}^{k - 1}\to \mathbb{Q}_{\beta}^k$ . Given any $\mathbf{x}\in \mathbb{R}^{k - 1}$ , $g_{\beta}$ is defined as (Mishne et al., 2023): + +$$ +g _ {\beta} (\mathbf {x}) = \left(\sqrt {\beta} \cosh \left(\frac {\| \mathbf {x} \|}{\sqrt {\beta}}\right), \sqrt {\beta} \sinh \left(\frac {\| \mathbf {x} \|}{\sqrt {\beta}}\right) \frac {\mathbf {x}}{\| \mathbf {x} \|}\right). \tag {11} +$$ + +Following (Chami et al., 2020), we define a learnable radius of curvature $\beta_r$ for each relation $r$ to encode a variety of hierarchies. For each triple $(h,r,t)$ , $\mathbf{e}_h$ and $\mathbf{e}_t$ are mapped + +to the $r$ -specific hyperboloid $\mathbb{Q}_{\beta_r}^k$ via $g_{\beta_r}$ , resulting in the $r$ -associated embeddings $\mathbf{e}_{h,r} = g_{\beta_r}(\mathbf{e}_h)$ and $\mathbf{e}_{t,r} = g_{\beta_r}(\mathbf{e}_t)$ . + +For parameterizing hyperbolic orthogonal transformation of any dimension $k$ between $\mathbf{e}_{h,r}$ and $\mathbf{e}_{t,r}$ , a straightforward strategy is to leverage the designed orthogonal mapping Orth in the case of $\mathbf{w} := \mathbf{q} = (-1,1,\dots,1)^{\top}$ . Given the relation embedding $\mathbf{U}_r\in \mathbb{R}^{k\times k}$ , the mapping $\mathrm{Orth}(\mathbf{U}_r,\mathbf{q})$ is able to represent every hyperbolic orthogonal relation matrix $\mathbf{G}_r\in \mathbf{O}_{\mathbf{q}}(k)$ according to Theorem 3.1. + +Nevertheless, although $\mathbf{G}_r$ satisfies the inner product invariance in Equation (4), it is not guaranteed to preserve the sign of the first element of $\mathbf{e}_{h,r}$ . In other words, $\mathbf{e}_{h,r}^{\prime}$ might be transformed to the lower sheet of the hyperboloid with the first element less than 0, leading to the inability to calculate the geodesic distance between $\mathbf{e}_{h,r}^{\prime} \notin \mathbb{Q}_{\beta_r}^k$ and $\mathbf{e}_{t,r} \in \mathbb{Q}_{\beta_r}^k$ . To remedy this deficiency, we restrict the orthogonal relation matrix $\mathbf{G}_r$ into the positive subgroup of $\mathbf{O}_{\mathbf{q}}(k)$ such that for any $\mathbf{x} \in \mathbb{Q}_{\beta_r}^k$ , the first element of $\mathbf{G}_r\mathbf{x}$ is positive, thereby ensuring that $\mathbf{G}_r\mathbf{x} \in \mathbb{Q}_{\beta_r}^k$ . Essentially, the full hyperbolic orthogonal group $\mathbf{O}_{\mathbf{q}}(k)$ can be classified into two distinct connected components based on the following proposition: + +Proposition 3.3. For any $\mathbf{x} \in \mathbb{Q}_{\beta}^{k}$ , every hyperbolic orthogonal matrix $\mathbf{G} \in \mathbf{O}_{\mathbf{q}}(k)$ falls into two subsets according to the sign of its first element $G_{11}$ for which $|G_{11}| \geq 1$ : + +- The matrix in the positive subset $\mathbf{O}_{\mathbf{q}}^{+}(k) = \{\mathbf{G} \in \mathbf{O}_{\mathbf{q}}(k) : G_{11} \geq +1\}$ preserves the sign of the first element of $\mathbf{x}$ ; +- The matrix in the negative subset $\mathbf{O}_{\mathbf{q}}^{-}(k) = \{\mathbf{G} \in \mathbf{O}_{\mathbf{q}}(k) : G_{11} \leq -1\}$ reverses the sign of the first element of $\mathbf{x}$ ; +- $\mathbf{O}_{\mathbf{q}}^{+}(k)$ is a multiplicative subgroup of $\mathbf{O}_{\mathbf{q}}(k)$ . + +(See proof in Appendix D) + +For fully covering the positive subgroup $\mathbf{O}_{\mathbf{q}}^{+}(k)$ , we employ the polar decomposition (Gallier, 2005) to express any $\mathbf{G} \in \mathbf{O}_{\mathbf{q}}^{+}(k)$ as the product of a Euclidean orthogonal matrix and a hyperbolic boost matrix. Formally, we have the following proposition, based on which a positive hyperbolic mapping $\mathrm{Orth}_{\mathbb{Q}}$ is defined for relational parameterization: + +Proposition 3.4. Every (positive) hyperbolic orthogonal matrix $\mathbf{G} \in \mathbf{O}_{\mathbf{q}}^{+}(k)$ can be expressed by a mapping $\mathrm{Orth}_{\mathbb{Q}}$ such that for $\mathbf{U} \in \mathbb{R}^{(k-1) \times (k-1)}$ and $\mathbf{b} \in \mathbb{R}^{k-1}$ : + +$$ +\begin{array}{l} G = \operatorname {O r t h} _ {\mathbb {Q}} (\mathbf {U}, \mathbf {b}) \\ = \left[ \begin{array}{c c} 1 & 0 \\ 0 & \operatorname {O r t h} (\mathbf {U}, \mathbf {1}) \end{array} \right] \left[ \begin{array}{c c} \sqrt {\| \mathbf {b} \| ^ {2} + 1} & \mathbf {b} ^ {\top} \\ \mathbf {b} & \sqrt {\mathbf {I} + \mathbf {b b} ^ {\top}} \end{array} \right]. \\ \end{array} +$$ + +(See proof in Appendix E) + +Based on Proposition 3.4, we can represent each relation $r$ as a hyperbolic orthogonal transformation whose output space is restricted to $\mathbb{Q}_{\beta_r}^k$ . Specifically, two types of parameters are defined for each $r$ : $\mathbf{U}_r \in \mathbb{R}^{(k-1) \times (k-1)}$ and $\mathbf{b}_r \in \mathbb{R}^{k-1}$ . + +Taking $\mathbf{U}_r$ and $\mathbf{b}_r$ as input to the mapping $\mathrm{Orth}_{\mathbb{Q}}$ , we apply such restricted orthogonal transformation to $\mathbf{e}_{h,r} \in \mathbb{Q}_{\beta_r}^k$ : + +$$ +\begin{array}{l} \mathbf {e} _ {h, r} ^ {\prime} = \operatorname {O r t h} _ {\mathbb {Q}} \left(\mathbf {U} _ {r}, \mathbf {b} _ {r}\right) \mathbf {e} _ {h, r} \tag {12} \\ = \left[ \begin{array}{c c} 1 & 0 \\ 0 & \prod_ {i = 1} ^ {k - 1} \mathbf {H} (\mathbf {U} _ {r} [ i ], \mathbf {1}) \end{array} \right] \left[ \begin{array}{c c} \sqrt {\| \mathbf {b} _ {r} \| ^ {2} + 1} & \mathbf {b} _ {r} ^ {\top} \\ \mathbf {b} _ {r} & \sqrt {\mathbf {I} + \mathbf {b} _ {r} \mathbf {b} _ {r} ^ {\top}} \end{array} \right] \mathbf {e} _ {h, r}. \\ \end{array} +$$ + +Objective function: Proposition 3.4 theoretically ensures that the transformed head embedding $\mathbf{e}_{h,r}^{\prime}$ lies on the same hyperboloid as the tail embedding $\mathbf{e}_{t,r}$ , enabling us to measure their similarity using the hyperbolic geodesic distance. Formally, the score function for each $(h,r,t)$ is defined as: + +$$ +\begin{array}{l} s _ {r} (h, t) = - d _ {\mathbb {Q}} \left(\mathbf {e} _ {h, r} ^ {\prime}, \mathbf {e} _ {t, r}\right) \\ = - \sqrt {\beta} \cosh^ {- 1} \left(- \frac {\left\langle \mathbf {e} _ {h , r} ^ {\prime} , \mathbf {e} _ {t , r} \right\rangle_ {\mathbf {q}}}{\beta}\right). \tag {13} \\ \end{array} +$$ + +Connections to hyperbolic models: Existing hyperbolic models such as AttH, RotH and RefH (Chami et al., 2020) represent each relation as the combination of a rotation (or reflection) and a Möbius addition in the Poincaré ball. Since the Poincaré ball is isometric to the hyperboloid (Nickel & Kiela, 2017), and the Möbius addition is equivalent to the hyperbolic boost (Tabaghi & Dokmanic, 2021), all these models can be viewed as the special cases of our proposed hyperbolic parameterization. Note that these models parameterize rotations/reflections using the 2-dimensional Givens transformations, while our approach breaks the dimensional restriction without loss of degrees of freedom, thereby generalizing them and achieving superior modeling capacity. + +# 3.2.3. MIXED ORTHOGONAL PARAMETERIZATION + +Although our elliptic and hyperbolic parameterizations are advantageous for embedding the corresponding topologies (cyclicity or hierarchy), real-world KGs typically exhibit non-uniform structures (Gu et al., 2019; Wang et al., 2021). Considering such inherent topological heterogeneity, we further introduce a mixed orthogonal parameterization in the product manifold (Gu et al., 2019) to unify multiple geometric spaces, culminating in the universal GoldE framework. + +Product manifold: Beyond individual elliptic or hyperbolic spaces, we leverage the Cartesian product to describe a heterogeneous embedding space for GoldE: $\mathbb{D}^k = \times_{i=1}^{m} \mathbb{X}_i^{k_i}$ , where $\mathbb{X}_i^{k_i} \in \{\mathbb{E}, \mathbb{P}, \mathbb{Q}\}^2$ denotes the $i$ -th component space of dimension $k_i^3$ such that the total dimension $k = \sum_{i=1}^{m} k_i$ . The resulting product space is a "non-constantly" curved manifold that is more flexible than a single constant curvature manifold (Skopek et al., 2020). + +For each triple $(h,r,t)$ , GoldE represents relation $r$ as a component-wise orthogonal transformation between head entity $h$ and tail entity $t$ in the product manifold. Formally, let $\mathbf{e}_{h,r}^{(i)}$ and $\mathbf{e}_{t,r}^{(i)}$ denote the $i$ -th sub-embeddings of $h$ and $t$ , which are associated to the $r$ -specific (elliptic or hyperbolic) space as described in Section 3.2.1 and 3.2.2. GoldE applies the generalized orthogonal transformation to $\mathbf{e}_{h,r}^{(i)}$ according to the geometric type of the $i$ -th component space $\mathbb{X}_i$ : + +$$ +\mathbf {e} _ {h, r} ^ {\prime (i)} = \left\{ \begin{array}{l l} \operatorname {O r t h} _ {\mathbb {P}} \left(\mathbf {U} _ {r} ^ {(i)}, \mathbf {p} _ {r} ^ {(i)}\right) \mathbf {e} _ {h, r} ^ {(i)}, & \text {f o r} \mathbb {X} _ {i} = \mathbb {P} \\ \operatorname {O r t h} _ {\mathbb {Q}} \left(\mathbf {U} _ {r} ^ {(i)}, \mathbf {b} _ {r} ^ {(i)}\right) \mathbf {e} _ {h, r} ^ {(i)}, & \text {f o r} \mathbb {X} _ {i} = \mathbb {Q} \end{array} , \right. \tag {14} +$$ + +where $\mathbf{U}_r^{(i)}$ , $\mathbf{p}_r^{(i)}$ and $\mathbf{b}_r^{(i)}$ are the parameters of relation transformations in the $i$ -th component space. + +Objective function: Since the orthogonal transformations guarantee the inner product invariance in each component space, the transformed head embedding $\mathbf{e}_{h,r}^{\prime}$ remains in the product space $\mathbb{D}^k$ . The distance between $\mathbf{e}_{h,r}^{\prime}$ and $\mathbf{e}_{t,r}$ can be calculated by performing decomposition (Ficken, 1939; Turaga & Srivastava, 2016). Formally, the score function for measuring the plausibility of each $(h,r,t)$ is defined as: + +$$ +s _ {r} (h, t) = - d _ {\mathbb {D}} \left(\mathbf {e} _ {h, r} ^ {\prime}, \mathbf {e} _ {t, r}\right) = - \sum_ {i = 1} ^ {m} d _ {\mathbb {X} _ {i}} ^ {l} \left(\mathbf {e} _ {h, r} ^ {\prime (i)}, \mathbf {e} _ {t, r} ^ {(i)}\right), \tag {15} +$$ + +where $l$ is the norm indicator. We highlight that such mixed orthogonal parameterization in the product space naturally achieves the geometric unification, enabling improved representations by better matching the geometry of the embedding space to the heterogeneous structures of KGs. + +Complexity analysis: The learnable parameters of GoldE include $\{\mathbf{e}_v\}_{v\in \mathcal{V}}$ and $\{\mathbf{U}_r,\mathbf{p}_r,\mathbf{b}_r,\beta_r\}_{r\in \mathcal{R}}$ . Compared to the previous models (Sun et al., 2019; Chami et al., 2020; Li et al., 2022), the extra space cost is proportional to the number of relation types, which is usually much smaller than the number of entities. Therefore, GoldE has the same space complexity as the existing KGE models, i.e., $O(k|\mathcal{V}|)$ . In the aspect of time cost for processing a single triple, one may observe that the time complexity of Equation (14) is $O(k_i^3)$ , in which $k_{i}$ matrix-vector multiplications incur high computational costs. However, it is worth noting that these multiplications can be entirely replaced by vector operations via efficient computation (refer to Appendix G for details), thereby reducing the time complexity to $O(k_i^2)$ . + +Modeling capability: Benefiting from the dimensional extension and geometric unification achieved by the designed parameterization, GoldE is able to simultaneously model the logical patterns and heterogeneous structures as shown in Table 1. Formally, we have the following claim: + +Claim 3.5. GoldE is capable of capturing the symmetry, antisymmetry, inversion and composition patterns, as well as the inherent cyclical and hierarchical structures in KGs. (See proof in Appendix F) + +# 3.3. Optimization + +Following (Sun et al., 2019; Gao et al., 2020; Li et al., 2022), we use the self-adversarial negative sampling loss (Sun et al., 2019) to optimize our GoldE framework. Formally, given a positive triple $(h,r,t)$ , the loss function is defined as: + +$$ +\begin{array}{l} L = - \log \sigma (\gamma + s _ {r} (h, t)) \\ - \sum_ {i = 1} ^ {g} p \left(h _ {i} ^ {\prime}, r, t _ {i} ^ {\prime}\right) \log \sigma \left(- s _ {r} \left(h _ {i} ^ {\prime}, t _ {i} ^ {\prime}\right) - \gamma\right), \tag {16} \\ \end{array} +$$ + +where $\gamma$ is a pre-defined margin, $\sigma$ is the sigmoid function, $g$ is the number of negative samples, $(h_i', r, t_i')$ is the $i$ -th negative sample against $(h, r, t)$ , and $p(h_i', r, t_i')$ determines the proportion of $(h_i', r, t_i')$ in the current optimization as defined in (Sun et al., 2019). Note that we initially define the entity embeddings of GoldE in Euclidean space, and all the relation transformations (including $g_{\beta}$ ) are differentiable and bijective (Chami et al., 2019). This enables us to learn the parameters using the standard Euclidean optimization techniques for the numerical stability (Mishne et al., 2023). + +# 4. Experiments + +To comprehensively validate the effectiveness of GoldE, we conduct extensive experiments on link prediction task, and attempt to answer the following questions: + +(1) How does GoldE perform on link prediction compared to existing KGE approaches? (Section 4.2) +(2) What is the effect of configuring different geometries and dimensions for orthogonal relation transformations on the performance of GoldE? (Section 4.3) +(3) From a fine-grained perspective, does GoldE effectively model different relation types? (Section 4.4) +(4) Can GoldE still learn high-quality representations even when the embedding size $k$ is restricted? (Section 4.5) + +# 4.1. Experimental Setup + +Datasets: We evaluate GoldE framework on three standard benchmarks: WN18RR (Dettmers et al., 2018), FB15k-237 (Toutanova & Chen, 2015) and YAGO3-10 (Mahdisoltani et al., 2015). Refer to Appendix H for statistical details. + +Baselines: We compare GoldE to a series of advanced KGE approaches, including (1) non-orthogonal models: TransE (Bordes et al., 2013), DistMult (Yang et al., 2015), ComplEx (Trouillon et al., 2016), ConvE (Dettmers et al., 2018) and MuRP (Balazevic et al., 2019); (2) Euclidean orthogonal models: RotatE (Sun et al., 2019), Rotate3D (Gao et al., 2020), QuatE (Zhang et al., 2019), DualE (Cao et al., 2021), ReflectE (Zhang et al., 2022), HousE (Li et al., 2022) and CompoundE (Ge et al., 2023); (3) hyperbolic orthogonal models: RefH, RotH and AttH (Chami et al., 2020). + +Table 2. Link prediction results on WN18RR, FB15k-237 and YAGO3-10. Best results are in bold and second best results are underlined. [†]: Results are taken from (Nguyen et al., 2018); [◇]: Results are taken from (Dettmers et al., 2018). [∗]: HousE-pro is a variant of HousE with additional projection operations (Li et al., 2022). Other results are taken from the corresponding original papers. + +
ModelWN18RRFB15k-237YAGO3-10
MRMRRH@1H@3H@10MRMRRH@1H@3H@10MRMRRH@1H@3H@10
TransE†3384.226--.501357.294--.465-----
DistMult◇5110.430.390.440.490254.241.155.263.4195926.340.240.380.540
ComplEx◇5261.440.410.460.510339.247.158.275.4286351.360.260.400.550
ConvE◇4187.430.400.440.520224.325.237.356.5011671.440.350.490.620
MuRP-.481.440.495.566-.335.243.367.518-.354.249.400.567
RotatE3340.476.428.492.571177.338.241.375.5331767.495.402.550.670
Rotate3D3328.489.442.505.579165.347.250.385.543-----
QuatE3472.481.436.500.564176.311.221.342.495-----
DualE-.482.440.500.561-.330.237.363.518-----
ReflectE1730.488.450.501.559148.358.263.396.546-----
HousE1885.496.452.511.585165.348.254.384.5341449.565.487.616.703
HousE-pro*1303.511.465.528.602153.361.266.399.5511415.571.491.620.714
CompoundE-.491.450.508.576-.357.264.393.545-----
RefH-.461.404.485.568-.346.252.383.536-.576.502.619.711
RotH-.496.449.514.586-.344.246.380.535-.570.495.612.706
AttH-.486.443.499.573-.348.252.384.540-.568.493.612.702
GoldE790.525.476.542.615142.370.277.405.558536.588.510.634.723
+ +Table 3. Link prediction results for our GoldE framework under different geometric combinations. + +
Geometry of Orth.WN18RRFB15k-237YAGO3-10
MRRH@10MRRH@10MRRH@10
E^k.496.585.348.534.565.703
P^k.505.593.358.547.572.708
Q^k.513.606.354.542.580.714
(P^k_p)_{i}^{m_P}.509.602.365.553.578.712
(Q^k_q)_{m_Q}^{m_Q}.518.610.360.549.585.718
(P^k_p)_{m_P} \times (Q^k_q)_{m_Q}.525.615.370.558.588.723
+ +Implementation details: For fair comparisons, we follow (Li et al., 2022) to fix the embedding dimension $k$ , ensuring that the number of parameters is comparable to the baselines. Moreover, we follow the most natural way (Gu et al., 2019) to construct the product manifold $\mathbb{D}$ as the combination of both $\mathbb{P}$ and $\mathbb{Q}$ for GoldE, i.e., $\mathbb{D}^k = \times_{i=1}^{m_{\mathbb{P}}} \mathbb{P}_i^{k_{\mathbb{P}}} \times \times_{j=1}^{m_{\mathbb{Q}}} \mathbb{Q}_j^{k_{\mathbb{Q}}}$ . The hyperparameters $m_{\mathbb{P}}$ and $k_{\mathbb{P}}$ ( $m_{\mathbb{Q}}$ and $k_{\mathbb{Q}}$ ) determine the number and dimension of elliptic (hyperbolic) components, respectively. More details can be found in Appendix I. + +# 4.2. Performance Comparison + +Table 2 summarizes the main results on link prediction task. One can observe that GoldE framework consistently outperforms the baselines on all metrics across the three datasets. In particular, compared to HousE, the most relevant baseline that represents relations as $k$ -dimensional Euclidean Householder rotations, GoldE achieves an average absolute gain of $2.5\%$ in MRR, and even surpasses its projection-enhanced variant (i.e., HousE-pro) with $1.3\%$ absolute improvement in MRR. Moreover, GoldE also outperforms existing hyperbolic orthogonal models (i.e., RefH, RotH and AttH) by a clear margin. Such new state-of-the-art results demonstrate the superiority of our universal orthogonal parameterization. + +![](images/d589c7dad53094846c8c9c2719c316efb36bc50b59d159dd5e9dfdb3ae067fa2.jpg) +(a) MRR vs. $k_{\mathbb{X}}$ on WN18RR + +![](images/ec0940123026f342d4b9cebd47dd2c52731020dc143f7d25a54b97ada62f9fde.jpg) +(b) MRR vs. $k_{\mathbb{X}}$ on FB15k-237 +Figure 3. MRR results of GoldE under the product of $\mathbb{X}$ with varying dimension $k_{\mathbb{X}}$ $(\mathbb{X}\in \{\mathbb{E},\mathbb{P},\mathbb{Q}\})$ on WN18RR and FB15k-237. + +# 4.3. Effect of Universal Orthogonal Parameterization + +Effect of geometric unification: To investigate the effect of geometries for orthogonal relation transformations, we explore the performance of GoldE under different geometric combinations4. From the results summarized in Table 3, one can observe the following: (1) Both elliptic and hyperbolic parameterizations are more effective than the Euclidean counterpart, indicating the importance of additional scaling operations and modeling inherent hierarchies, respectively; (2) As we expected, hyperbolic parameterization performs better on the two datasets (i.e., WN18RR and YAGO3-10) dominated by hierarchies, while the elliptic counterpart excels on the dataset (i.e., FB15k-237) dominated by cycles. Note that the product of multiple $\mathbb{P}$ (or $\mathbb{Q}$ ) outperforms its single case, since such homogeneous combination is able to embed a variety of cycles (or hierarchies) (Gu et al., 2019); (3) By combining multiple $\mathbb{P}$ and $\mathbb{Q}$ , our GoldE can naturally preserve both cyclical and hierarchical structures, thereby achieving the optimal performance on all the three datasets. + +Table 4. MRR for the models tested on each relation of WN18RR. + +
Relation Name#TripleRotHHousEGoldE
hypernym1,2510.1900.1820.226
instance_hypernym1220.3620.3950.453
member_meronym2530.2660.2750.296
synset_domain_topic_of1140.4060.3960.430
has_part1720.2130.2170.255
member_of_domain_usage240.3500.4150.455
member_of_domain_region260.3560.2810.403
derivationally_related_form1,0740.9470.9580.961
also Seeing560.5830.6380.665
verb_group390.8200.9680.975
similar_to31.0001.0001.000
+ +Such improvements confirm the effectiveness of the geometric unification in our universal orthogonal parameterization. + +Effect of dimensional extension: To verify the expressiveness of the dimensional extension in our parameterization, we further conduct experiments for GoldE under the product of $\mathbb{X}$ with varying dimension $k_{\mathbb{X}}$ . Figure 3 exhibits the MRR results on WN18RR and FB15k-237. As expected, whether in Euclidean, elliptic, or hyperbolic parameterizations, the higher-dimensional orthogonal transformations enhance modeling capability, leading to superior performance compared to their lower-dimensional counterparts. + +# 4.4. Fine-grained Performance Analysis + +To verify the modeling capability of our GoldE from a fine-grained perspective, we report its performance per relation on WN18RR in Table 4. Compared to the hyperbolic model RotH and the Euclidean model HousE, our GoldE achieves the best performance on all 11 relation types. Specifically, GoldE not only obtains significant improvements on hierarchical relations (e.g., hypernym and instance_hypernym), but also performs well on symmetric relations (e.g., derivationally_related_form and verb_group). These advanced fine-grained results demonstrate the superior and comprehensive modeling capability of our GoldE framework. + +# 4.5. Results with Restricted Embedding Size + +We also follow (Chami et al., 2020) to evaluate our GoldE under the restriction of fixing the embedding size $k$ to 32. It is challenging for KGE models to offer qualified representations in such a restricted setting. Table 5 reports the experimental results on the three datasets. We observe that GoldE consistently surpasses the baselines by a clear margin across all datasets, confirming the higher-quality representations learned by our universal orthogonal parameterization. See Appendix J for more results of GoldE with varying $k$ . + +# 5. Related Work + +Early KGE approaches explore various geometric operations such as translation (Bordes et al., 2013; Wang et al., 2014; + +Table 5. Link prediction results for 32-dimensional embeddings. + +
ModelWN18RRFB15k-237YAGO3-10
MRRH@10MRRH@10MRRH@10
RotatE.387.491.290.458--
QuatE.421.467.293.460--
MuRE.458.525.313.489.283.478
MuRP.465.544.323.501.230.392
RefH.447.518.312.489.381.530
RotH.472.553.314.497.393.559
AttH.466.551.324.501.397.566
GoldE.482.558.335.506.420.586
+ +Lin et al., 2015; Ji et al., 2015) and scaling (Yang et al., 2015; Trouillon et al., 2016) to model relations. As a representative work, RotatE (Sun et al., 2019) goes beyond the previous methods by modeling relations as 2-dimensional rotations between entities to handle the crucial logical patterns in KGs. Inspired by the effectiveness of orthogonal transformations, subsequent research mainly advances in two directions. + +Dimension direction: A series of works (Zhang et al., 2019; Gao et al., 2020; Cao et al., 2021; Li et al., 2022) seek higher-dimensional orthogonal transformations for better modeling capacity. Recently, HousE (Li et al., 2022) introduces the Euclidean Householder reflections to represent relations as $k$ -dimensional Euclidean rotations, which can be viewed as the Euclidean specialization of our proposal. + +Geometry direction: Another branch of KGE models (Balazevic et al., 2019; Chami et al., 2020) exploits hyperbolic geometry for preserving the hierarchical structures in KGs. AttH (Chami et al., 2020) represents relations as hyperbolic orthogonal transformations to accommodate both hierarchical structures and logical patterns, yet remains constrained by low-dimensional space and homogeneous geometry. + +Notably, our GoldE framework generalizes existing KGE models in terms of both dimension and geometry. Moreover, the designed parameterization is orthogonal to advanced techniques such as regularizers (Lacroix et al., 2018) and graph encoders (Vashishth et al., 2020; Zhu et al., 2021), allowing for their integration to achieve better performance. + +# 6. Conclusion + +In this paper, we introduce GoldE, a powerful and general framework that generalizes existing KGE approaches based on a universal orthogonal parameterization. Empowered by such parameterization, our framework can simultaneously achieve dimensional extension and geometric unification for relational orthogonalization, thereby possessing the superior capability of capturing logical patterns and heterogeneous structures in KGs. Experimental results over three datasets comprehensively validate the effectiveness of our proposal. In future work, we will explore the potential of GoldE in modeling hyper-relational and temporal knowledge graphs. + +# Acknowledgements + +This work is supported in part by National Natural Science Foundation of China (No. 62102420), Beijing Outstanding Young Scientist Program NO. BJWZYJH 012019100020098, Intelligent Social Governance Platform, Major Innovation & Planning Interdisciplinary Platform for the "Double-First Class" Initiative, Renmin University of China, Public Computing Cloud, Renmin University of China, fund for building world-class universities (disciplines) of Renmin University of China, Intelligent Social Governance Platform. + +# Impact Statement + +This work presents GoldE based on a universal orthogonal parameterization, aiming to advance the field of knowledge graph embedding in terms of both dimension and geometry. We highlight that the designed orthogonal parameterization is a general technique, even with the potential to enhance various foundational models such as RNN (Vorontsov et al., 2017), GNN (Guo et al., 2022) and Transformer (Zhang et al., 2021), thus possessing the capability of facilitating a wide range of downstream tasks. As for the negative impact, GoldE may encode the biases present in the training graph, which can lead to stereotyped predictions for missing links between certain nodes (e.g., users on a social or e-commerce platform). We expect future studies to mitigate this issue. + +# References + +Balazevic, I., Allen, C., and Hospedales, T. M. Multi-relational poincaré graph embeddings. In Advances in Neural Information Processing Systems, pp. 4465-4475, 2019. +Barrett, J. F. The hyperbolic theory of special relativity. arXiv preprint arXiv:1102.0462, 2011. +Bergstra, J. and Bengio, Y. Random search for hyperparameter optimization. Journal of Machine Learning Research, 13:281-305, 2012. +Bollacker, K., Evans, C., Paritosh, P., Sturge, T., and Taylor, J. Freebase: a collaboratively created graph database for structuring human knowledge. In Proceedings of the ACM SIGMOD International Conference on Management of Data, pp. 1247-1250, 2008. +Bordes, A., Usunier, N., Garcia-Duran, A., Weston, J., and Yakhnenko, O. Translating embeddings for modeling multi-relational data. In Advances in Neural Information Processing Systems, pp. 2787-2795, 2013. +Cao, Z., Xu, Q., Yang, Z., Cao, X., and Huang, Q. Dual quaternion knowledge graph embeddings. In Proceed- + +ings of the Thirty-Fifth AAAI Conference on Artificial Intelligence, pp. 6894-6902, 2021. +Cartan, É. The theory of spinors. M.I.T. Press, 1966. +Chami, I., Ying, Z., Ré, C., and Leskovec, J. Hyperbolic graph convolutional neural networks. In Advances in Neural Information Processing Systems, pp. 4869-4880, 2019. +Chami, I., Wolf, A., Juan, D., Sala, F., Ravi, S., and Ré, C. Low-dimensional hyperbolic knowledge graph embeddings. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 6901-6914, 2020. +Chao, L., He, J., Wang, T., and Chu, W. Pairre: Knowledge graph embeddings via paired relation vectors. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, pp. 4360-4369, 2021. +Clark, P. L. Quadratic forms chapter i: Witt's theory. University of Georgia, 2013. +Dettmers, T., Minervini, P., Stenetorp, P., and Riedel, S. Convolutional 2d knowledge graph embeddings. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, pp. 1811-1818, 2018. +Dieudonné, J. A. Sur les groupes classiques. Hermann, 1967. +Do Carmo, M. P. Riemannian geometry. Birkhäuser, 1992. +Eisenhart, L. P. Riemannian geometry. Princeton University Press, 1997. +Feng, B.-J., Cheng, X., Xu, H.-N., and Xue, W.-F. Corporate credit ratings based on hierarchical heterogeneous graph neural networks. Machine Intelligence Research, 21:257-271, 2024. +Ficken, F. A. The riemannian and affine differential geometry of product-spaces. Annals of Mathematics, pp. 892-913, 1939. +Gallier, J. Notes on group actions, manifolds, lie groups, and lie algebras. University of Pennsylvania, 27, 2005. +Gallier, J. Geometric methods and applications: for computer science and engineering, volume 38. Springer Science & Business Media, 2011. +Gao, C., Sun, C., Shan, L., Lin, L., and Wang, M. Rotate3d: Representing relations as rotations in three-dimensional space for knowledge graph embedding. In Proceedings of the 29th ACM International Conference on Information & Knowledge Management, pp. 385-394, 2020. + +Ge, X., Wang, Y., Wang, B., and Kuo, C. J. Compounding geometric operations for knowledge graph completion. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 6947-6965, 2023. +Gu, A., Sala, F., Gunel, B., and Ré, C. Learning mixed-curvature representations in product spaces. In 7th International Conference on Learning Representations, 2019. +Guo, K., Zhou, K., Hu, X., Li, Y., Chang, Y., and Wang, X. Orthogonal graph neural networks. In Thirty-Sixth AAAI Conference on Artificial Intelligence, pp. 3996-4004, 2022. +Householder, A. S. Unitary triangularization of a nonsymmetric matrix. Journal of the ACM (JACM), pp. 339-342, 1958. +Hu, J., Wu, L., Chen, Y., Hu, P., and Zaki, M. J. Graphflow+: Exploiting conversation flow in conversational machine comprehension with graph neural networks. Machine Intelligence Research, 21:272-282, 2024. +Ji, G., He, S., Xu, L., Liu, K., and Zhao, J. Knowledge graph embedding via dynamic mapping matrix. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing, pp. 687-696, 2015. +Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization. In 3rd International Conference on Learning Representations, 2015. +Lacroix, T., Usunier, N., and Obozinski, G. Canonical tensor decomposition for knowledge base completion. In Proceedings of the 35th International Conference on Machine Learning, pp. 2869-2878, 2018. +Law, M. T., Liao, R., Snell, J., and Zemel, R. S. Lorentzian distance learning for hyperbolic representations. In Proceedings of the 36th International Conference on Machine Learning, pp. 3672-3681, 2019. +Li, C., Wang, S., Yang, D., Li, Z., Yang, Y., Zhang, X., and Zhou, J. PPNE: property preserving network embedding. In Database Systems for Advanced Applications, volume 10177, pp. 163-179. Springer, 2017. +Li, C., Cao, Y., Zhu, Y., Cheng, D., Li, C., and Morimoto, Y. Ripple knowledge graph convolutional networks for recommendation systems. Machine Intelligence Research, 21:481-494, 2024. +Li, R., Zhao, J., Li, C., He, D., Wang, Y., Liu, Y., Sun, H., Wang, S., Deng, W., Shen, Y., Xie, X., and Zhang, + +Q. House: Knowledge graph embedding with householder parameterization. In International Conference on Machine Learning, pp. 13209-13224, 2022. +Li, R., Chen, X., Li, C., Shen, Y., Zhao, J., Wang, Y., Han, W., Sun, H., Deng, W., Zhang, Q., and Xie, X. To copy rather than memorize: A vertical learning paradigm for knowledge graph completion. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 6335-6347, 2023. +Lin, Y., Liu, Z., Sun, M., Liu, Y., and Zhu, X. Learning entity and relation embeddings for knowledge graph completion. In Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence, pp. 2181-2187, 2015. +Liu, W., Wen, Y., Yu, Z., Li, M., Raj, B., and Song, L. Spherface: Deep hypersphere embedding for face recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 212-220, 2017. +Liu, Y., Wang, Z., Zhou, X., and Zheng, L. A study of using synthetic data for effective association knowledge learning. Machine Intelligence Research, 20:194-206, 2023. +Mahdisoltani, F., Biega, J., and Suchanek, F. Yago3: A knowledge base from multilingual wikimedia. In 7th Biennial Conference on Innovative Data Systems Research, 2015. +Miller, G. A. Wordnet: a lexical database for english. Communications of the ACM, pp. 39-41, 1995. +Mishne, G., Wan, Z., Wang, Y., and Yang, S. The numerical stability of hyperbolic representation learning. In International Conference on Machine Learning, pp. 24925-24949, 2023. +Mitchell, A. F. and Krzanowski, W. J. The mahalanobis distance and elliptic distributions. Biometrika, 72(2): 464-467, 1985. +Nguyen, D. Q., Nguyen, T. D., Nguyen, D. Q., and Phung, D. A novel embedding model for knowledge base completion based on convolutional neural network. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 327-333, 2018. +Nickel, M. and Kiela, D. Poincaré embeddings for learning hierarchical representations. In Advances in Neural Information Processing Systems, pp. 6338-6347, 2017. +Nickel, M. and Kiela, D. Learning continuous hierarchies in the lorentz model of hyperbolic geometry. In Proceedings of the 35th International Conference on Machine Learning, pp. 3776-3785, 2018. + +Özdemir, M. An alternative approach to elliptical motion. Advances in Applied Clifford Algebras, 26:279-304, 2016. +O'Meara, O. T. Introduction to quadratic forms, volume 117. Springer, 2013. +Rui, Y., Carmona, V. I. S., Pourvali, M., Xing, Y., Yi, W.-W., Ruan, H.-B., and Zhang, Y. Knowledge mining: A cross-disciplinary survey. Machine Intelligence Research, 19:89-114, 2022. +Saxena, A., Tripathi, A., and Talukdar, P. P. Improving multihop question answering over knowledge graphs using knowledge base embeddings. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 4498-4507, 2020. +Skopek, O., Ganea, O., and Bécigneul, G. Mixed-curvature variational autoencoders. In 8th International Conference on Learning Representations, 2020. +Sommer, G. Geometric computing with Clifford algebras: theoretical foundations and applications in computer vision and robotics. Springer Science & Business Media, 2013. +Sun, J., Xu, C., Tang, L., Wang, S., Lin, C., Gong, Y., Shum, H.-Y., and Guo, J. Think-on-graph: Deep and responsible reasoning of large language model with knowledge graph. arXiv preprint arXiv:2307.07697, 2023. +Sun, Z., Deng, Z.-H., Nie, J.-Y., and Tang, J. Rotate: Knowledge graph embedding by relational rotation in complex space. In 7th International Conference on Learning Representations, 2019. +Tabaghi, P. and Dokmanic, I. On procrastes analysis in hyperbolic space. IEEE Signal Process. Lett., 28:1120-1124, 2021. +Toutanova, K. and Chen, D. Observed versus latent features for knowledge base and text inference. In Proceedings of the 3rd Workshop on Continuous Vector Space Models and Their Compositionality, pp. 57-66, 2015. +Trouillon, T., Welbl, J., Riedel, S., Gaussier, É., and Bouchard, G. Complex embeddings for simple link prediction. In Proceedings of the 33nd International Conference on Machine Learning, pp. 2071-2080, 2016. +Turaga, P. K. and Srivastava, A. Riemannian computing in computer vision, volume 1. Springer, 2016. +Vashisht, S., Sanyal, S., Nitin, V., and Talukdar, P. P. Composition-based multi-relational graph convolutional networks. In 8th International Conference on Learning Representations, 2020. + +Vorontsov, E., Trabelsi, C., Kadoury, S., and Pal, C. On orthogonality and learning recurrent networks with long term dependencies. In Proceedings of the 34th International Conference on Machine Learning, pp. 3570-3578, 2017. +Wang, S., Wei, X., dos Santos, C. N., Wang, Z., Nallapati, R., Arnold, A. O., Xiang, B., Yu, P. S., and Cruz, I. F. Mixed-curvature multi-relational graph neural network for knowledge graph completion. In Proceedings of the Web Conference, pp. 1761-1771, 2021. +Wang, Z., Zhang, J., Feng, J., and Chen, Z. Knowledge graph embedding by translating on hyperplanes. In Proceedings of the Twenty-Eighth AAAI Conference on Artificial Intelligence, pp. 1112-1119, 2014. +Wilson, R. C., Hancock, E. R., Pekalska, E., and Duin, R. P. W. Spherical and hyperbolic embeddings of data. IEEE Transactions on Pattern Analysis and Machine Intelligence, 36(11):2255-2269, 2014. +Yan, H., Li, C., Long, R., Yan, C., Zhao, J., Zhuang, W., Yin, J., Zhang, P., Han, W., Sun, H., Deng, W., Zhang, Q., Sun, L., Xie, X., and Wang, S. A comprehensive study on text-attributed graphs: Benchmarking and rethinking. In Advances in Neural Information Processing Systems, pp. 17238-17264, 2023. +Yang, B., Yih, W., He, X., Gao, J., and Deng, L. Embedding entities and relations for learning and inference in knowledge bases. In 3rd International Conference on Learning Representations, 2015. +Yang, H.-R. and Ni, W. Continuous-time distributed heavy-ball algorithm for distributed convex optimization over undirected and directed graphs. Machine Intelligence Research, 19:75-88, 2022. +Yasunaga, M., Bosselut, A., Ren, H., Zhang, X., Manning, C. D., Liang, P. S., and Leskovec, J. Deep bidirectional language-knowledge graph pretraining. In Advances in Neural Information Processing Systems, pp. 37309-37323, 2022. +Zhang, A., Chan, A., Tay, Y., Fu, J., Wang, S., Zhang, S., Shao, H., Yao, S., and Lee, R. K. On orthogonality constraints for transformers. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, pp. 375-382, 2021. +Zhang, P., Guo, J., Li, C., Xie, Y., Kim, J., Zhang, Y., Xie, X., Wang, H., and Kim, S. Efficiently leveraging multi-level user intent for session-based recommendation via attenu-mixer network. In Proceedings of the Sixteenth ACM International Conference on Web Search and Data Mining, pp. 168-176, 2023. + +Zhang, Q., Wang, R., Yang, J., and Xue, L. Knowledge graph embedding by reflection transformation. Knowl. Based Syst., 238:107861, 2022. +Zhang, S., Tay, Y., Yao, L., and Liu, Q. Quaternion knowledge graph embeddings. In Advances in Neural Information Processing Systems, pp. 2731-2741, 2019. +Zhao, J., Qu, M., Li, C., Yan, H., Liu, Q., Li, R., Xie, X., and Tang, J. Learning on large-scale text-attributed graphs via variational inference. In The Eleventh International Conference on Learning Representations, 2023. +Zhu, Z., Zhang, Z., Xhonneux, L. A. C., and Tang, J. Neural bellman-ford networks: A general graph neural network framework for link prediction. In Advances in Neural Information Processing Systems, pp. 29476-29490, 2021. + +# A. Glossary of Symbols + +Table 6. Glossary of variables and symbols used in this paper. + +
SymbolShapeDescription
V-Set of entities
R-Set of relations
F-Set of factual triples
h,t-Head entity and tail entity
r-Relation type
Ek-k-dimensional Euclidean space, equivalent to Rk
Pk-Elliptic subspace embedded in Rk
Qk-Hyperbolic subspace embedded in Rk
Dk-Product manifold with total dimension k
Xki-The i-th component space of product manifold D
mR+Number of component spaces
βrR+Param. of r ∈ R that determines the curvature of manifold
prRk+r-specific elliptic weighting vector
qRkHyperbolic weighting vector (-1,1,...,1)
evRkEmbedding of entity v ∈ V
ev,rRkr-associated representation of entity v ∈ V
brRkParam. of r ∈ R for hyperbolic boost
UrRk×kParam. of r ∈ R for generalized orthogonal transformation
+ +# B. Proof of Theorem 3.1 + +This theorem is a special case of the "Cartan-Dieudonné Theorem" (Cartan, 1966; Dieudonné, 1967), which is one of the fundamental results of geometric algebra (Gallier, 2011). Since this result is not used in the remainder of this paper and the proof is somewhat intricate, we encourage the beginning reader to read the statement and then skip to the next part. + +# B.1. Proof of Theorem B.1 (Cartan-Dieudonné Theorem) + +Theorem B.1. (Cartan-Dieudonné Theorem). In the non-degenerate quadratic space $V$ endowed with $\langle \cdot, \cdot \rangle_{\mathbf{w}}$ , every element $\mathbf{G}$ of the orthogonal group $\mathbf{O}_{\mathbf{w}}(k)$ can be expressed as a product of at most $k$ reflections. + +Proof. (1) The first step is to prove the following lemma: Suppose that $\mathbf{G} \in \mathbf{O}_{\mathbf{w}}(k)$ satisfies such a condition: for every anisotropic vector $\mathbf{x}$ , the vector $\mathbf{Gx} - \mathbf{x}$ is nonzero and isotropic5. Then, $k \geq 4$ , $k$ is even, and $\mathbf{G}$ is a rotation. + +It is evident that we cannot have $k = 1$ . If $k = 2$ , let $\mathbf{x}$ be an anisotropic vector. Since $\mathbf{G}\mathbf{x} - \mathbf{x}$ is isotropic and nonzero, $\mathbf{G}\mathbf{x}$ must be linearly independent from $\mathbf{x}$ . This implies that the determinant of the quadratic form with respect to the basis $\mathbf{G}\mathbf{x} - \mathbf{x}$ and $\mathbf{x}$ is equal to 0, contradicting the non-degeneracy of the space. We therefore must have $k \geq 3$ . + +Since $\mathbf{G}\mathbf{x} - \mathbf{x}$ is isotropic for all anisotropic $\mathbf{x}$ , we have $q(\mathbf{G}\mathbf{x} - \mathbf{x}) = \langle \mathbf{G}\mathbf{x} - \mathbf{x},\mathbf{G}\mathbf{x} - \mathbf{x}\rangle_{\mathbf{w}} = 0$ . In fact, this holds for all $\mathbf{x}$ . To see this, let $\mathbf{y}$ be a nonzero isotropic vector. There is a plane containing $\mathbf{y}$ and splitting the space $V$ (O'Meara, 2013), hence there is a vector $\mathbf{z}$ with $q(\mathbf{z})\neq 0$ and $\langle \mathbf{y},\mathbf{z}\rangle_{\mathbf{w}} = 0$ . Then, we have $q(\mathbf{y} + \epsilon \mathbf{z})\neq 0$ for any $\epsilon \in \mathbb{R}\setminus \{0\}$ , hence + +$$ +q (\mathbf {G} (\mathbf {y} + \epsilon \mathbf {z}) - (\mathbf {y} + \epsilon \mathbf {z})) = 0, \quad q (\mathbf {G} \mathbf {z} - \mathbf {z}) = 0. +$$ + +It follows that + +$$ +q (\mathbf {G} \mathbf {y} - \mathbf {y}) + 2 \epsilon \langle \mathbf {G} \mathbf {y} - \mathbf {y}, \mathbf {G} \mathbf {z} - \mathbf {z} \rangle_ {\mathbf {w}} = 0. +$$ + +If we substitute $\epsilon = 1$ , and then $\epsilon = -1$ , and then add, we obtain $q(\mathbf{G}\mathbf{y} - \mathbf{y}) = 0$ as we asserted. Therefore, if we define the space $W := (\mathbf{G} - 1)V$ , we have $q(\mathbf{y}) = 0$ for any $y \in W$ , i.e., $q(W) = 0$ . Then, the orthogonal complement of $W$ is $W^{\perp} = \{\mathbf{x} \in V \mid \forall \mathbf{y} \in W, \langle \mathbf{x}, \mathbf{y} \rangle_{\mathbf{w}} = 0\}$ . Now for any $\mathbf{x} \in V$ and $\mathbf{y} \in W^{\perp}$ , we have + +$$ +\begin{array}{l} \langle \mathbf {x}, \mathbf {G y} - \mathbf {y} \rangle_ {\mathbf {w}} = \langle \mathbf {G x}, \mathbf {G y} - \mathbf {y} \rangle_ {\mathbf {w}} - \langle \mathbf {G x} - \mathbf {x}, \mathbf {G y} - \mathbf {y} \rangle_ {\mathbf {w}} \\ = \langle \mathbf {G} \mathbf {x}, \mathbf {G} \mathbf {y} - \mathbf {y} \rangle_ {\mathbf {w}} \\ = \langle \mathbf {G} \mathbf {x}, \mathbf {G} \mathbf {y} \rangle_ {\mathbf {w}} - \langle \mathbf {G} \mathbf {x}, \mathbf {y} \rangle_ {\mathbf {w}} \\ = \langle \mathbf {x}, \mathbf {y} \rangle_ {\mathbf {w}} - \langle \mathbf {G x}, \mathbf {y} \rangle_ {\mathbf {w}} \\ = - \left\langle \mathbf {G} \mathbf {x} - \mathbf {x}, \mathbf {y} \right\rangle_ {\mathbf {w}} \\ = 0. \\ \end{array} +$$ + +Hence $\mathbf{G}\mathbf{y} - \mathbf{y}$ is perpendicular to all of $V$ . Since $V$ is non-degenerate, we conclude that $\mathbf{G}\mathbf{y} = \mathbf{y}$ for all $\mathbf{y} \in W^{\perp}$ . Then, $q(W^{\perp}) = 0$ by the given condition. Thus we get $W = W^{\perp}$ . Therefore, $k = \dim(V) = \dim(W) + \dim(W^{\perp}) = 2\dim(W)$ is even, hence at least 4. Moreover, since $\mathbf{G}$ acts as the identity on a maximal totally isotropic subspace of $V$ (Clark, 2013), $\mathbf{G}$ is a rotation with the determinant equal to $+1$ , completing Step 1. + +(2) Now we can prove the theorem. The proof is by induction on $k$ . For $k = 1$ , the result is trivial, so let $k > 1$ . + +Case 1: Suppose there exists an anisotropic vector $\mathbf{x} \in V$ such that $\mathbf{G}\mathbf{x} = \mathbf{x}$ . Then the restriction of $\mathbf{G}$ to the hyperplane $\zeta$ orthogonal to $\mathbf{x}$ is an element of $\mathbf{O}_{\mathbf{w}}(k - 1)$ . By the inductive assumption, this restriction is a product of at most $k - 1$ reflections taken with respect to lines in $\zeta$ . One can naturally view each of them as the reflection on all of $V$ , and the same product of reflections agrees with $\mathbf{G}$ on $\zeta$ . Moreover, it also agrees with $\mathbf{G}$ on $\mathbf{x}$ , since $\mathbf{G}$ and all of the reflections are equal to the identity on $\mathbf{x}$ . Thus $\mathbf{G}$ is itself equal to the product of the at most $k - 1$ reflections. + +Case 2: Next suppose that there is an anisotropic vector $\mathbf{x}$ such that $\mathbf{G}\mathbf{x} - \mathbf{x}$ is anisotropic, i.e., $q(\mathbf{G}\mathbf{x} - \mathbf{x})\neq 0$ . To facilitate presentation, we denote the elementary reflection in Equation (7) as $\tau_{\mathbf{u}}$ . In this way, we have + +$$ +\begin{array}{l} \tau_ {\mathbf {G} \mathbf {x} - \mathbf {x}} (\mathbf {G} \mathbf {x}) = \mathbf {G} \mathbf {x} - 2 \frac {\left\langle \mathbf {G} \mathbf {x} , \mathbf {G} \mathbf {x} - \mathbf {x} \right\rangle_ {\mathbf {w}}}{\left\langle \mathbf {G} \mathbf {x} - \mathbf {x} , \mathbf {G} \mathbf {x} - \mathbf {x} \right\rangle_ {\mathbf {w}}} (\mathbf {G} \mathbf {x} - \mathbf {x}) \\ = \mathbf {G} \mathbf {x} - 2 \frac {\langle \mathbf {x} , \mathbf {x} \rangle_ {\mathbf {w}} - \langle \mathbf {G} \mathbf {x} , \mathbf {x} \rangle_ {\mathbf {w}}}{\langle \mathbf {G} \mathbf {x} - \mathbf {x} , \mathbf {G} \mathbf {x} - \mathbf {x} \rangle_ {\mathbf {w}}} (\mathbf {G} \mathbf {x} - \mathbf {x}) \\ = \mathbf {G} \mathbf {x} - \frac {\left\langle \mathbf {G} \mathbf {x} - \mathbf {x} , \mathbf {G} \mathbf {x} - \mathbf {x} \right\rangle_ {\mathbf {w}}}{\left\langle \mathbf {G} \mathbf {x} - \mathbf {x} , \mathbf {G} \mathbf {x} - \mathbf {x} \right\rangle_ {\mathbf {w}}} (\mathbf {G} \mathbf {x} - \mathbf {x}) \\ = \mathbf {G} \mathbf {x} - (\mathbf {G} \mathbf {x} - \mathbf {x}) \\ = \mathbf {x}, \\ \end{array} +$$ + +which implies that $\tau_{\mathbf{G}\mathbf{x} - \mathbf{x}}\mathbf{G}$ leaves $\mathbf{x}$ fixed. Based on the first case, the orthogonal matrix $\tau_{\mathbf{G}\mathbf{x} - \mathbf{x}}\mathbf{G}$ is a product of at most $k - 1$ reflections, hence $\mathbf{G}$ is a product of at most $k$ reflections. + +Case 3: According to Case 1 and 2, any $\mathbf{G}$ that does not satisfy the condition in Step 1 is a product of at most $k$ reflections. Now, let's consider the $\mathbf{G}$ that for every anisotropic vector $\mathbf{x} \in V$ , $\mathbf{Gx} - \mathbf{x}$ is isotropic and nonzero. Based on Step 1, we conclude that $k$ is even and $\mathbf{G}$ is a rotation matrix. Then, $\mathbf{G}' = \tau \mathbf{G}$ is a reflection that cannot satisfy the condition in Step 1. Hence $\mathbf{G}'$ can be expressed as a product of at most $k$ reflections based on Case 1 and 2. Therefore, $\mathbf{G}$ is itself a product of at most $k + 1$ reflections. However, $\mathbf{G}$ cannot be a product of $k + 1$ reflections, since $k + 1$ is odd and $\mathbf{G}$ is a rotation matrix. Hence $\mathbf{G}$ is a product of at most $k$ reflections, qed. + +# B.2. Proof of Theorem 3.1 + +Proof. First, the designed mapping Orth is a product of $n$ elementary reflections, and its output is a generalized orthogonal matrix that satisfies the quadratic inner product invariance, i.e., $(\mathbf{H}_n \cdots \mathbf{H}_1)^\top \mathrm{diag}(\mathbf{w})(\mathbf{H}_n \cdots \mathbf{H}_1) = \mathrm{diag}(\mathbf{w})$ . Therefore, we have $\operatorname{Image}(\operatorname{Orth}) \subseteq \mathbf{O}_{\mathbf{w}}(k)$ . Then, according to the Cartan-Dieudonné Theorem, every generalized orthogonal matrix $\mathbf{G} \in \mathbf{O}_{\mathbf{w}}(k)$ can be expressed as $\prod_{c=1}^{z} \mathbf{H}(\mathbf{u}_c, \mathbf{w})$ for a certain $z \leq k$ . Since the $k \times k$ identity matrix $\mathbf{I} \in \operatorname{Image}(\operatorname{Orth})$ for any value of $n$ , we can get $\mathbf{G} = \mathbf{G}\mathbf{I} = \prod_{c=1}^{k} \mathbf{H}(\mathbf{u}_c, \mathbf{w})$ . Therefore, we also have $\mathbf{O}_{\mathbf{w}}(k) \subseteq \operatorname{Image}(\operatorname{Orth})$ when $n = k$ . On the whole, we conclude that $\operatorname{Image}(\operatorname{Orth}) = \mathbf{O}_{\mathbf{w}}(k)$ . + +# C. Proof of Claim 3.2 + +Proof. We show that the elliptic parameterization is equivalent to Euclidean parameterization equipped with element-wise scaling transformations determined by $\sqrt{\mathbf{p}_r}$ . Specifically, the distance function of elliptic parameterization in Equation (10) can be reformulated as follows: + +$$ +\begin{array}{l} d _ {\mathbb {P}} (\mathbf {e} _ {h, r} ^ {\prime}, \mathbf {e} _ {t, r}) = \sqrt {(\mathbf {e} _ {h , r} ^ {\prime} - \mathbf {e} _ {t , r}) ^ {\top} \mathrm {d i a g} (\mathbf {p} _ {r}) (\mathbf {e} _ {h , r} ^ {\prime} - \mathbf {e} _ {t , r})} \\ = \sqrt {(\operatorname {d i a g} (\sqrt {\mathbf {p} _ {r}}) \mathbf {e} _ {h , r} ^ {\prime} - \operatorname {d i a g} (\sqrt {\mathbf {p} _ {r}}) \mathbf {e} _ {t , r}) ^ {\top} (\operatorname {d i a g} (\sqrt {\mathbf {p} _ {r}}) \mathbf {e} _ {h , r} ^ {\prime} - \operatorname {d i a g} (\sqrt {\mathbf {p} _ {r}}) \mathbf {e} _ {t , r})} \\ = \left\| \operatorname {d i a g} \left(\sqrt {\mathbf {p} _ {r}}\right) \mathbf {e} _ {h, r} ^ {\prime} - \operatorname {d i a g} \left(\sqrt {\mathbf {p} _ {r}}\right) \mathbf {e} _ {t, r} \right\| \\ = \left\| \operatorname {d i a g} \left(\sqrt {\mathbf {p} _ {r}}\right) \prod_ {i = 1} ^ {k} \mathbf {H} \left(\mathbf {U} _ {r} [ i ], \mathbf {p} _ {r}\right) \mathbf {e} _ {h, r} - \operatorname {d i a g} \left(\sqrt {\mathbf {p} _ {r}}\right) \mathbf {e} _ {t, r} \right\| \\ = \| \operatorname {d i a g} (\sqrt {\mathbf {p} _ {r}}) (\mathbf {I} - 2 \frac {\mathbf {U} [ k ] \mathbf {U} [ k ] ^ {\top} \operatorname {d i a g} (\mathbf {p} _ {r})}{\mathbf {u} ^ {\top} \operatorname {d i a g} (\mathbf {p} _ {r}) \mathbf {u}}) \prod_ {i = 1} ^ {k - 1} \mathbf {H} (\mathbf {U} _ {r} [ i ], \mathbf {p} _ {r}) \mathbf {e} _ {h, r} - \operatorname {d i a g} (\sqrt {\mathbf {p} _ {r}}) \mathbf {e} _ {t, r} \| \\ = \| (\mathbf {I} - 2 \frac {\operatorname {d i a g} (\sqrt {\mathbf {p} _ {r}}) \mathbf {U} [ k ] \mathbf {U} [ k ] ^ {\top} \operatorname {d i a g} (\sqrt {\mathbf {p} _ {r}}) ^ {\top}}{\mathbf {U} [ k ] ^ {\top} \operatorname {d i a g} (\sqrt {\mathbf {p} _ {r}}) ^ {\top} \operatorname {d i a g} (\sqrt {\mathbf {p} _ {r}}) \mathbf {U} [ k ]}) \operatorname {d i a g} (\sqrt {\mathbf {p} _ {r}}) \prod_ {i = 1} ^ {k - 1} \mathbf {H} (\mathbf {U} _ {r} [ i ], \mathbf {p} _ {r}) \mathbf {e} _ {h, r} - \operatorname {d i a g} (\sqrt {\mathbf {p} _ {r}}) \mathbf {e} _ {t, r} \| \\ = \| \mathbf {H} (\operatorname {d i a g} (\sqrt {\mathbf {p} _ {r}}) \mathbf {U} _ {r} [ k ], \mathbf {1}) \operatorname {d i a g} (\sqrt {\mathbf {p} _ {r}}) \prod_ {i = 1} ^ {k - 1} \mathbf {H} (\mathbf {U} _ {r} [ i ], \mathbf {p} _ {r}) \mathbf {e} _ {h, r} - \operatorname {d i a g} (\sqrt {\mathbf {p} _ {r}}) \mathbf {e} _ {t, r} \| \\ = \| \prod_ {i = 1} ^ {k} \mathbf {H} (\operatorname {d i a g} (\sqrt {\mathbf {p} _ {r}}) \mathbf {U} _ {r} [ i ], \mathbf {1}) \operatorname {d i a g} (\sqrt {\mathbf {p} _ {r}}) \mathbf {e} _ {h} - \operatorname {d i a g} (\sqrt {\mathbf {p} _ {r}}) \mathbf {e} _ {t} \| \\ = \left\| \operatorname {O r t h} \left(\operatorname {d i a g} \left(\sqrt {\mathbf {p} _ {r}}\right) \mathbf {U} _ {r}, \mathbf {1}\right) \operatorname {d i a g} \left(\sqrt {\mathbf {p} _ {r}}\right) \mathbf {e} _ {h} - \operatorname {d i a g} \left(\sqrt {\mathbf {p} _ {r}}\right) \mathbf {e} _ {t} \right\|. \\ \end{array} +$$ + +This expression implies that the head embedding $\mathbf{e}_h\in \mathbb{R}^k$ is first scaled by $\sqrt{\mathbf{p}_r}$ , and then performs a Euclidean orthogonal transformation, with the expectation of being similar to the tail embedding $\mathbf{e}_t\in \mathbb{R}^k$ , which is also scaled by $\sqrt{\mathbf{p}_r}$ . + +# D. Proof of Proposition 3.3 + +Proof. For any $\mathbf{G} \in \mathbf{O}_{\mathbf{q}}(k)$ and $\mathbf{x} \in \mathbb{Q}_{\beta}^{k}$ , the hyperbolic orthogonal transformation $\mathbf{Gx}$ can be expressed in the following block form: + +$$ +\mathbf {G} \mathbf {x} = \left[ \begin{array}{c c} a & \mathbf {b} ^ {\top} \\ \mathbf {c c} & \mathbf {A} \end{array} \right] \left[ \begin{array}{c} x _ {1} \\ \mathbf {x} _ {2: k} \end{array} \right] = \left[ \begin{array}{c} a x _ {1} + \mathbf {b} ^ {\top} \mathbf {x} _ {2: k} \\ x _ {1} \mathbf {c c} + \mathbf {A} \mathbf {x} _ {2: k} \end{array} \right], +$$ + +where $a \in \mathbb{R}$ , $\mathbf{b}, \mathbf{c} \in \mathbb{R}^{k-1}$ and $\mathbf{A} \in \mathbb{R}^{(k-1) \times (k-1)}$ . We prove that (1) the absolute value of the first element of $\mathbf{G}$ is greater than or equal to 1, i.e., $|G_{11}| = |a| \geq 1$ ; (2) when $a \geq 1$ (or $a \leq -1$ ), the transformation $\mathbf{Gx}$ preserves (or reverses) the sign of the first element of $\mathbf{x}$ , i.e., $\mathrm{sign}(x_1) = \mathrm{sign}(ax_1 + \mathbf{b}^\top \mathbf{x}_{2:k})$ for $a \geq 1$ and $\mathrm{sign}(x_1) \neq \mathrm{sign}(ax_1 + \mathbf{b}^\top \mathbf{x}_{2:k})$ for $a \leq -1$ . + +According to the definition of generalized orthogonal matrix in Equation (4), one can verify that the hyperbolic orthogonal matrix $\mathbf{G} \in \mathbf{O}_{\mathbf{q}}(k)$ satisfies the inner product invariance: + +$$ +\mathbf {G} ^ {\top} \operatorname {d i a g} (\mathbf {q}) \mathbf {G} = \operatorname {d i a g} (\mathbf {q}) \Rightarrow \mathbf {G} \operatorname {d i a g} (\mathbf {q}) \mathbf {G} ^ {\top} = \operatorname {d i a g} (\mathbf {q}). +$$ + +Since $\mathbf{q} = (-1, 1, \dots, 1) \in \mathbb{R}^k$ , the first element of $\mathbf{G}$ (i.e., $G_{11} = a$ ) requires that + +$$ +a ^ {2} - \| \mathbf {b} \| ^ {2} = 1 \Rightarrow | a | = \sqrt {1 + \| \mathbf {b} \| ^ {2}} \geq 1. +$$ + +We then consider the following square equation: + +$$ +\begin{array}{l} (\frac {\mathbf {b}}{a} + \frac {\mathbf {x} _ {2 : k}}{x _ {1}}) ^ {2} = (\frac {\mathbf {b}}{a}) ^ {2} + 2 \frac {\mathbf {b} ^ {\top} \mathbf {x} _ {2 : k}}{a x _ {1}} + (\frac {\mathbf {x} _ {2 : k}}{x _ {1}}) ^ {2} \\ = (\frac {\| \mathbf {b} \| ^ {2}}{a ^ {2}}) + 2 \frac {\mathbf {b} ^ {\top} \mathbf {x} _ {2 : k}}{a x _ {1}} + (\frac {\| \mathbf {x} _ {2 : k} \| ^ {2}}{x _ {1} ^ {2}}) \\ = (\frac {a ^ {2} - 1}{a ^ {2}}) + 2 \frac {\mathbf {b} ^ {\top} \mathbf {x} _ {2 : k}}{a x _ {1}} + (\frac {\| \mathbf {x} _ {2 : k} \| ^ {2}}{x _ {1} ^ {2}}) \geq 0. \\ \end{array} +$$ + +Since $\mathbf{x} \in \mathbb{Q}_{\beta}^{k}$ , one can easily derive that $x_{1}^{2} > \| \mathbf{x}_{2:k}\|^{2}$ according to the definition of hyperboloid in Equation (2). Based on this, we further have the following inequality: + +$$ +- 2 \frac {\mathbf {b} ^ {\top} \mathbf {x} _ {2 : k}}{a x _ {1}} \leq (\frac {a ^ {2} - 1}{a ^ {2}}) + (\frac {\| \mathbf {x} _ {2 : k} \| ^ {2}}{x _ {1} ^ {2}}) < (\frac {a ^ {2} - 1}{a ^ {2}}) + 1 < 2. +$$ + +When $a \geq +1$ and $x_1 > 0$ , we have + +$$ +2 a x _ {1} > - 2 \mathbf {b} ^ {\top} \mathbf {x} _ {2: k} \Rightarrow a x _ {1} + \mathbf {b} ^ {\top} \mathbf {x} _ {2: k} > 0. +$$ + +When $a \geq +1$ and $x_{1} < 0$ , we have + +$$ +2 a x _ {1} < - 2 \mathbf {b} ^ {\top} \mathbf {x} _ {2: k} \Rightarrow a x _ {1} + \mathbf {b} ^ {\top} \mathbf {x} _ {2: k} < 0. +$$ + +When $a \leq -1$ and $x_1 > 0$ , we have + +$$ +2 a x _ {1} < - 2 \mathbf {b} ^ {\top} \mathbf {x} _ {2: k} \Rightarrow a x _ {1} + \mathbf {b} ^ {\top} \mathbf {x} _ {2: k} < 0. +$$ + +When $a \leq -1$ and $x_1 < 0$ , we have + +$$ +2 a x _ {1} > - 2 \mathbf {b} ^ {\top} \mathbf {x} _ {2: k} \Rightarrow a x _ {1} + \mathbf {b} ^ {\top} \mathbf {x} _ {2: k} > 0. +$$ + +Therefore, we can observe that the hyperbolic orthogonal matrix $\mathbf{G}$ with its first element $G_{11} = a\geq +1$ preserves the sign of $x_{1}$ , while $\mathbf{G}$ with $G_{11}\leq -1$ reverses the sign of $x_{1}$ . Moreover, the set of all $\mathbf{G}$ with $G_{11}\geq +1$ , namely the positive subset $\mathbf{O}_{\mathbf{q}}^{+}(k) = \{\mathbf{G}\in \mathbf{O}_{\mathbf{q}}(k):G_{11}\geq +1\}$ , forms a multiplicative subgroup of $\mathbf{O}_{\mathbf{q}}(k)$ , since (1) for any $\mathbf{G}_1,\mathbf{G}_2\in \mathbf{O}_{\mathbf{q}}^{+}(k)$ , their multiplication also preserves the quadratic inner product of $\mathbf{x}$ and the sign of $x_{1}$ , i.e., $\mathbf{G}_1\mathbf{G}_2\in \mathbf{O}_{\mathbf{q}}^{+}(k)$ ; (2) $\mathbf{O}_{\mathbf{q}}^{+}(k)$ contains the identity matrix $\mathbf{I}$ ; (3) every matrix $\mathbf{G}\in \mathbf{O}_{\mathbf{q}}^{+}(k)$ has an inverse $\mathbf{G}^{-1}\in \mathbf{O}_{\mathbf{q}}^{+}(k)$ such that $\mathbf{GG}^{-1} = \mathbf{I}$ . + +# E. Proof of Proposition 3.4 + +Proof. The positive hyperbolic orthogonal matrix $\mathbf{G} \in \mathbf{O}_{\mathbf{q}}^{+}(k)$ can be written in block form as follows: + +$$ +\mathbf {G} = \left[ \begin{array}{c c} a & \mathbf {b} ^ {\top} \\ \mathbf {c c} & \mathbf {A} \end{array} \right], +$$ + +where $a \geq +1$ , $\mathbf{b}, \mathbf{c} \in \mathbb{R}^{k-1}$ and $\mathbf{A} \in \mathbb{R}^{(k-1) \times (k-1)}$ . Since $\mathbf{G}^{\top} \mathrm{diag}(\mathbf{q}) \mathbf{G} = \mathbf{G} \mathrm{diag}(\mathbf{q}) \mathbf{G}^{\top} = \mathrm{diag}(\mathbf{q})$ , we get + +$$ +\left[ \begin{array}{c c} a & \mathbf {c} ^ {\top} \\ \mathbf {b} & \mathbf {A} ^ {\top} \end{array} \right] \left[ \begin{array}{c c} - a & - \mathbf {b} ^ {\top} \\ \mathbf {c c} & \mathbf {A} \end{array} \right] = \left[ \begin{array}{c c} a & \mathbf {b} ^ {\top} \\ \mathbf {c c} & \mathbf {A} \end{array} \right] \left[ \begin{array}{c c} - a & - \mathbf {c} ^ {\top} \\ \mathbf {b} & \mathbf {A} ^ {\top} \end{array} \right] = \left[ \begin{array}{c c} - 1 & 0 \\ 0 & \mathbf {I} \end{array} \right], +$$ + +then + +$$ +\begin{array}{l} \mathbf {A} ^ {\top} \mathbf {A} = \mathbf {I} + \mathbf {b b} ^ {\top}, \\ \mathbf {c} ^ {\top} \mathbf {c} = a ^ {2} - 1, \\ \mathbf {A} ^ {\top} \mathbf {c} = a \mathbf {b}, \\ \mathbf {b} ^ {\top} \mathbf {b} = a ^ {2} - 1, \\ \mathbf {A b} = a \mathbf {c}. \\ \end{array} +$$ + +From $\mathbf{A}^{\top}\mathbf{A} = \mathbf{I} + \mathbf{b}\mathbf{b}^{\top}$ , we get that $\mathbf{A}^{\top}\mathbf{A}$ is symmetric and positive definite. Geometrically, it is well known that $\frac{\mathbf{bb}^{\top}}{\mathbf{b}^{\top}\mathbf{b}}$ is the orthogonal projection onto the line determined by $\mathbf{b}$ . Consequently, $\mathbf{bb}^{\top}$ has the eigenvalue 0 with multiplicity $k - 2$ and the eigenvalue $\mathbf{b}^{\top}\mathbf{b} = a^{2} - 1$ with multiplicity 1. The eigenvectors associated with 0 are orthogonal to $\mathbf{b}$ and the eigenvectors associated with $a^{2} - 1$ are proportional with $\mathbf{b}$ . It follows that $\mathbf{I} + \mathbf{bb}^{\top}$ has the eigenvalue 1 with multiplicity $k - 2$ and the eigenvalue $a^{2}$ with multiplicity 1, the eigenvectors being as before. Now, $\mathbf{A}$ has the polar form $\mathbf{A} = \mathbf{QS}$ , where $\mathbf{Q}$ is a Euclidean orthogonal matrix, $\mathbf{S}$ is a positive semi-definite symmetric matrix and $\mathbf{S}^2 = \mathbf{S}^\top \mathbf{S} = \mathbf{A}^\top \mathbf{A} = \mathbf{I} + \mathbf{bb}^\top$ . Since $a\geq +1$ , $\mathbf{S} = \sqrt{\mathbf{I} + \mathbf{bb}^{\top}}$ has the eigenvalue 1 with multiplicity $k - 2$ and the eigenvalue $a$ with multiplicity 1, the eigenvectors being as before. Then, since $\mathbf{b}$ is an eigenvector of $\mathbf{S}$ for the eigenvalue $a$ , we have + +$$ +\mathbf {A b} = \mathbf {Q S b} = \mathbf {Q} (\mathbf {S b}) = \mathbf {Q} (a \mathbf {b}) = a \mathbf {Q b}. +$$ + +Since we also have $\mathbf{Ab} = ac$ , this implies + +$$ +a \mathbf {Q} \mathbf {b} = a \mathbf {c} \Rightarrow \mathbf {Q} \mathbf {b} = \mathbf {c}. +$$ + +It follows that + +$$ +\mathbf {G} = \left[ \begin{array}{c c} a & \mathbf {b} ^ {\top} \\ \mathbf {c c} & \mathbf {A} \end{array} \right] = \left[ \begin{array}{c c} a & \mathbf {b} ^ {\top} \\ \mathbf {Q b} & \mathbf {Q S} \end{array} \right] = \left[ \begin{array}{c c} 1 & 0 \\ 0 & \mathbf {Q} \end{array} \right] \left[ \begin{array}{c c} \sqrt {\| \mathbf {b} \| ^ {2} + 1} & \mathbf {b} ^ {\top} \\ \mathbf {b} & \sqrt {\mathbf {I} + \mathbf {b b} ^ {\top}} \end{array} \right]. +$$ + +Based on Theorem 3.1, we can further parameterize the Euclidean orthogonal matrix $\mathbf{Q} \in \mathbb{R}^{(k-1) \times (k-1)}$ as the composition of $k-1$ Euclidean Householder reflections: + +$$ +\mathbf {G} = \left[ \begin{array}{c c} 1 & 0 \\ 0 & \mathrm {O r t h} (\mathbf {U}, \mathbf {1}) \end{array} \right] \left[ \begin{array}{c c} \sqrt {\| \mathbf {b} \| ^ {2} + 1} & \mathbf {b} ^ {\top} \\ \mathbf {b} & \sqrt {\mathbf {I} + \mathbf {b b} ^ {\top}} \end{array} \right]. +$$ + +# F. Proof of Claim 3.5 + +Proof. Our proposed GoldE framework models each relation $r$ as a generalized orthogonal transformation between entities. To facilitate presentation, we denote the $r$ -specific generalized orthogonal matrix derived from Equation (14) as $\mathbf{G}_r$ : + +$$ +\mathbf {G} _ {r} ^ {(i)} = \left\{ \begin{array}{l l} \operatorname {O r t h} _ {\mathbb {P}} (\mathbf {U} _ {r} ^ {(i)}, \mathbf {p} _ {r} ^ {(i)}), & \text {f o r \mathbb {X} _ {i} = \mathbb {P}} \\ \operatorname {O r t h} _ {\mathbb {Q}} (\mathbf {U} _ {r} ^ {(i)}, \mathbf {b} _ {r} ^ {(i)}), & \text {f o r \mathbb {X} _ {i} = \mathbb {Q}} \end{array} \right.. +$$ + +Due to the orthogonality of the relation matrix and the geometric unification of the embedding space, GoldE is capable of simultaneously capturing the crucial logical patterns and the inherent topological structures in KGs. For simplicity, we omit the indices $(i)$ of component spaces in the following proofs. + +Symmetry/antisymmetry pattern: A relation $r$ is symmetric (antisymmetric) if $\forall x, y$ + +$$ +r (x, y) \Rightarrow r (y, x) \quad (r (x, y) \Rightarrow \neg r (y, x)). +$$ + +If $r(x,y)$ and $r(y,x)$ hold, we have + +$$ +\mathbf {e} _ {y} = \mathbf {G} _ {r} \mathbf {e} _ {x} \wedge \mathbf {e} _ {x} = \mathbf {G} _ {r} \mathbf {e} _ {y} \Rightarrow \mathbf {G} _ {r} \mathbf {G} _ {r} = \mathbf {I}. +$$ + +Otherwise, if $r(x,y)$ and $\neg r(y,x)$ hold, we have + +$$ +\mathbf {e} _ {y} = \mathbf {G} _ {r} \mathbf {e} _ {x} \wedge \mathbf {e} _ {x} \neq \mathbf {G} _ {r} \mathbf {e} _ {y} \Rightarrow \mathbf {G} _ {r} \mathbf {G} _ {r} \neq \mathbf {I}. +$$ + +Inversion pattern: A relation $r_1$ is inverse to relation $r_2$ if $\forall x, y$ + +$$ +r _ {2} (x, y) \Rightarrow r _ {1} (y, x). +$$ + +If $r_1(x,y)$ and $r_2(y,x)$ hold, we have + +$$ +\mathbf {e} _ {y} = \mathbf {G} _ {r _ {1}} \mathbf {e} _ {x} \wedge \mathbf {e} _ {x} = \mathbf {G} _ {r _ {2}} \mathbf {e} _ {y} \Rightarrow \mathbf {G} _ {r _ {1}} = \mathbf {G} _ {r _ {2}} ^ {\top}. +$$ + +Composition pattern: A relation $r_1$ is composed of relation $r_2$ and relation $r_3$ if $\forall x, y, z$ + +$$ +r _ {2} (x, y) \wedge r _ {3} (y, z) \Rightarrow r _ {1} (x, z). +$$ + +If $r_1(x,z),r_2(x,y)$ and $r_3(y,z)$ hold, we have + +$$ +\mathbf {e} _ {z} = \mathbf {G} _ {r _ {1}} \mathbf {e} _ {x} \wedge \mathbf {e} _ {y} = \mathbf {G} _ {r _ {2}} \mathbf {e} _ {x} \wedge \mathbf {e} _ {z} = \mathbf {G} _ {r _ {3}} \mathbf {e} _ {y} \Rightarrow \mathbf {G} _ {r _ {1}} = \mathbf {G} _ {r _ {3}} \mathbf {G} _ {r _ {2}}. +$$ + +Cyclical and hierarchical structures: The fidelity of representations arises from the correspondence between the structure of the data and the geometry of the space (Gu et al., 2019). Our GoldE is endowed with a product manifold composed of multiple model spaces, enabling improved representations by better matching the geometry of the embedding space to the heterogeneous structures of KGs. On the one hand, the orthogonal relation transformations in the elliptic component spaces are naturally suitable for capturing the cyclical structures (Wilson et al., 2014; Liu et al., 2017). On the other hand, the hyperbolic orthogonal transformation in Equation (12) inherently encodes the hierarchical structures—the Euclidean orthogonal matrix models the transformation between entities at the same level of hierarchies, and the hyperbolic boost matrix models the transformation between entities at different levels of hierarchies (Tabaghi & Dokmanic, 2021). + +# G. Efficient Computation + +The training time cost of GoldE primarily stems from the elliptic and hyperbolic orthogonal relation transformations in Equation (9) and (12), where $k$ matrix-vector multiplications incur the time complexity of $O(k^3)$ . We show that these matrix-vector multiplications can be entirely replaced by vector-vector operations to achieve efficient computation. + +For the elliptic orthogonal relation transformations in Equation (9), the entity embedding $\mathbf{e}_{h,r}$ iteratively performs $k$ elliptic Householder reflections. Each iteration can be achieved by vector-vector operations as follows: + +$$ +\mathbf {e} _ {h, r} ^ {i + 1} = \mathbf {H} \left(\mathbf {U} _ {r} [ i ], \mathbf {p} _ {r}\right) \mathbf {e} _ {h, r} ^ {i} = \left(\mathbf {I} - 2 \frac {\mathbf {U} _ {r} [ i ] \mathbf {U} _ {r} [ i ] ^ {\top} \operatorname {d i a g} \left(\mathbf {p} _ {r}\right)}{\mathbf {U} _ {r} [ i ] ^ {\top} \operatorname {d i a g} \left(\mathbf {p} _ {r}\right) \mathbf {U} _ {r} [ i ]}\right) \mathbf {e} _ {h, r} ^ {i} = \mathbf {e} _ {h, r} ^ {i} - 2 \frac {\left\langle \mathbf {U} _ {r} [ i ] , \mathbf {e} _ {h , r} ^ {i} \right\rangle_ {\mathbf {p} _ {r}}}{\left\langle \mathbf {U} _ {r} [ i ] , \mathbf {U} _ {r} [ i ] \right\rangle_ {\mathbf {p} _ {r}}} \mathbf {U} _ {r} [ i ], \tag {17} +$$ + +where $\mathbf{e}_{h,r}^{1}$ is the initial entity embedding $\mathbf{e}_{h,r}$ . In this way, the time complexity of Equation (9) is reduced to $O(k^2)$ . + +For the hyperbolic orthogonal relation transformations in Equation (12), the entity embedding $\mathbf{e}_{h,r}$ is transformed by a hyperbolic boost matrix and a Euclidean orthogonal matrix. We first replace the hyperbolic boost matrix with its equivalent form (Barrett, 2011) to avoid calculating the matrix square root, and then accelerate the transformation via block matrix multiplication. Formally, the hyperbolic boost transformation can be achieved by vector-vector operations as follows: + +$$ +\left[ \begin{array}{c c} \sqrt {\| \mathbf {b} _ {r} \| ^ {2} + 1} & \mathbf {b} _ {r} ^ {\top} \\ \mathbf {b} _ {r} & \sqrt {\mathbf {I} + \mathbf {b} _ {r} \mathbf {b} _ {r} ^ {\top}} \end{array} \right] \mathbf {e} _ {h, r} = \left[ \begin{array}{c c} \gamma & - \gamma \mathbf {v} _ {r} ^ {\top} \\ - \gamma \mathbf {v} _ {r} & \mathbf {I} + \frac {\gamma^ {2}}{1 + \gamma} \mathbf {v} _ {r} \mathbf {v} _ {r} ^ {\top} \end{array} \right] \left[ \begin{array}{c} e _ {h, r} ^ {1} \\ \mathbf {e} _ {h, r} ^ {2: k} \end{array} \right] = \left[ \begin{array}{c} \gamma e _ {h, r} ^ {1} - \gamma \left\langle \mathbf {v} _ {r}, \mathbf {e} _ {h, r} ^ {2: k} \right\rangle_ {\mathbf {1}} \\ - \gamma e _ {h, r} ^ {1} \mathbf {v} _ {r} + \mathbf {e} _ {h, r} ^ {2: k} + \frac {\gamma^ {2} \left\langle \mathbf {v} _ {r} , \mathbf {e} _ {h , r} ^ {2 : k} \right\rangle_ {\mathbf {1}}}{{1 + \gamma}} \mathbf {v} _ {r} \end{array} \right], \tag {18} +$$ + +where $\mathbf{v}_r\in \mathbb{R}^{k - 1},\| \mathbf{v}_r\| < 1,\gamma = \frac{1}{\sqrt{1 - \| \mathbf{v}_r\|^2}},e_{h,r}^1$ and $\mathbf{e}_{h,r}^{2:k}$ are the first and the remaining $k - 1$ entries of $e_{h,r}$ , respectively. The subsequent Euclidean orthogonal transformation can also be replaced by vector-vector operations, which is analogous to Equation (17). Therefore, the time complexity of Equation (12) is also reduced to $O(k^2)$ . + +Table 7 shows the convergence time required for training the models on three standard benchmarks. We select RotatE (for its simplicity) and HousE (for its advanced performance) as the baselines. By using the efficient computation, our GoldE framework costs comparable training time to these two models. Combined with the link prediction results in Table 2, one can see that the GoldE is capable of achieving superior effectiveness without sacrificing the efficiency. + +Table 7. Training time of RotatE, HousE and our GoldE on three datasets. + +
ModelWN18RRFB15k-237YAGO3-10
RotatE4h6h10h
HousE2h3h11h
GoldE2h5h13h
+ +# H. Datasets + +Table 8 summarizes the detailed statistics of three benchmark datasets. + +WN18RR (Dettmers et al., 2018) and FB15k-237 (Toutanova & Chen, 2015) datasets are subsets of WN18 (Bordes et al., 2013) and FB15k (Bordes et al., 2013) respectively with inverse relations removed to avoid test leakage. WN18 is extracted from WordNet (Miller, 1995), a database featuring lexical relations between words. FB15k is extracted from Freebase (Bollacker et al., 2008), a large-scale KG containing general knowledge facts. + +YAGO3-10 is a subset of YAGO3 (Mahdisoltani et al., 2015), containing 123,182 entities and 37 relations. Most of the triples in YAGO3-10 are descriptive attributes of people, such as citizenship, gender, profession and marital status. + +Table 8. Statistics of five standard benchmarks. + +
Dataset#Entity#Relation#Training#Validation#Test
WN18RR40,9431186,8353,0343,134
FB15k-23714,541237272,11517,53520,466
YAGO3-10123,182371,079,0405,0005,000
+ +# I. Implementation Details + +Evaluation: We follow the filtered ranking protocol (Bordes et al., 2013) for evaluation. For a test triple $(h, r, t)$ , we rank it against all negative triplets $(h, r, t')$ or $(h', r, t)$ that do not appear in the knowledge graph. We report mean rank (MR), mean reciprocal rank (MRR) and HITS at N (H@N) as performance metrics. + +Fair comparisons: To ensure fair comparisons, we control the total number of parameters of GoldE to be similar to the baselines as shown in Table 9. Specifically, we follow (Li et al., 2022) to fix the embedding size $k$ of each entity as 800, 600, 1000 on WN18RR, FB15k-237 and YAGO3-10 datasets, respectively. + +Table 9. Comparison of the number of parameters. The results of baselines are taken from the original papers. + +
DatasetRotatERotate3DDualEHousEGoldE
WN18RR40.95M61.44M32.76M32.57M31.23M
FB15k-23729.32M44.57M11.64M12.13M15.93M
YAGO3-10123.18M--122.91M118.52M
+ +Selection of Product Manifold: For reducing the number of hyperparameters, we set identical dimensions for component spaces of the same geometric type to describe the product space as $\mathbb{D}^k = \times_{i=1}^{m_{\mathbb{P}}} \mathbb{P}_i^{k_{\mathbb{P}}} \times \times_{j=1}^{m_{\mathbb{Q}}} \mathbb{Q}_j^{k_{\mathbb{Q}}}$ , where $m_{\mathbb{P}}$ and $m_{\mathbb{Q}}$ denote the number of elliptic and hyperbolic component spaces, $k_{\mathbb{P}}$ and $k_{\mathbb{Q}}$ denote the dimension of elliptic and hyperbolic component spaces. We omit $\mathbb{E}$ since the Euclidean orthogonal parameterization is the special case of our proposed elliptic orthogonal parameterization according to Claim 3.2. Considering that the embedding size $k$ is fixed to ensure fair comparisons, we can define the product manifold $\mathbb{D}^k$ with only three hyperparameters: the embedding size of one partition $k_* = m_{\mathbb{P}} k_{\mathbb{P}}$ , the number of elliptic component spaces $m_{\mathbb{P}}$ , and the number of hyperbolic component spaces $m_{\mathbb{Q}}$ . Note that the selected product manifold may not be the optimal case due to the simplified dimension configuration. One potential direction is to design a signature estimator (Gu et al., 2019) for KGs, and we leave this as the future work. + +Hyperparameters: We use Adam (Kingma & Ba, 2015) as the optimizer and fine-tune the hyperparameters on the validation dataset. The hyperparameters are tuned by the random search (Bergstra & Bengio, 2012), including batch size $b$ , self-adversarial sampling temperature $\alpha$ , fixed margin $\gamma$ , learning rate $lr$ , dimension $k_*$ , number of elliptic component spaces $m_{\mathbb{P}}$ , and number of hyperbolic component spaces $m_{\mathbb{Q}}$ . The hyperparameter search space is shown in Table 10. + +Table 10. Hyperparameter search space. + +
HyperparameterSearch SpaceType
b{500,800,1000,1500,2000}Choice
α[0.5,2.0]Range
γ{6,8,10,12,16,20,24,28}Choice
lr{0.0001,0.0005,0.001,0.003}Choice
k*{0,200,400,600,800}Choice
mP,mQ{2,4,8,10,15,20,25,30}Choice
+ +# J. More Results of GoldE with Varying Embedding Size + +Table 11 shows the full results of GoldE with embedding size $k$ equal to 32. Such low-dimensional setting follows (Chami et al., 2020). One can observe that our GoldE framework consistently outperforms the baselines on all metrics across the three datasets, demonstrating the superior modeling capability of our designed universal orthogonal parameterization. + +Table 11. Full results of GoldE with embedding size $k$ equal to 32. + +
ModelWN18RRFB15k-237YAGO3-10
MRRH@1H@3H@10MRRH@1H@3H@10MRRH@1H@3H@10
RotatE.387.330.417.491.290.208.316.458----
QuatE.421.396.430.467.293.212.320.460----
MuRE.458.421.471.525.313.226.340.489.283.187.317.478
MuRP.465.420.484.544.323.235.353.501.230.150.247.392
RefH.447.408.464.518.312.224.342.489.381.302.415.530
RotH.472.428.490.553.314.223.346.497.393.307.435.559
AttH.466.419.484.551.324.236.354.501.397.310.437.566
GoldE.482.447.493.558.335.246.360.506.420.330.465.586
+ +![](images/31819d08d3f4e5a3bbef11849ca984aa8e8878f6fd50aca5c8c653591cd9cef0.jpg) +Figure 4. MRR results of the models with embedding size $k \in \{10, 16, 20, 32, 50, 200, 500, 800\}$ on WN18RR. + +To delve deeper into the impact of different embedding sizes, we further conduct experiments for GoldE with varying values of $k$ . The parameters in all cases are tuned, and the results are averaged over 5 runs with different random initializations. Figure 4 exhibits the MRR performance curves on WN18RR. It reveals that GoldE consistently surpasses the baselines across a broad range of embedding sizes, comprehensively confirming the effectiveness of our proposal. + +# K. Limitations and Future Work + +The proposed GoldE framework follows the traditional learning paradigm of KGE (Li et al., 2023). Specifically, GoldE (as well as existing KGE approaches) models each training triple independently to implicitly capture the multi-hop logical patterns. However, the single-triple constraints inevitably have biases during optimization. These biases will accumulate with the increase of relation hops and make the perceived logical patterns unreliable, thereby hindering the generalization ability. A possible solution is to combine our framework with a path/graph encoder (Li et al., 2023; Zhang et al., 2023) to simultaneously process multiple structurally-dependent training triples. Furthermore, GoldE purely accesses the graph structures for symbolic inference. We plan to incorporate the textual attributes (Li et al., 2017; Yan et al., 2023; Zhao et al., 2023) of entities and relations in our future work to enhance the quality of learned representations. In addition, we would also like to investigate other theories and methodologies (Yang & Ni, 2022; Liu et al., 2023; Li et al., 2024; Hu et al., 2024; Feng et al., 2024) to unveil their potential significance in the realm of knowledge mining (Rui et al., 2022). \ No newline at end of file diff --git a/generalizingknowledgegraphembeddingwithuniversalorthogonalparameterization/images.zip b/generalizingknowledgegraphembeddingwithuniversalorthogonalparameterization/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..17589c6dd5187e2b6e20cd9e22cec8be76a658d0 --- /dev/null +++ b/generalizingknowledgegraphembeddingwithuniversalorthogonalparameterization/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c438a95b71e51df725e6805b6c7810a8811273b84e4c3007acf88701dbb372c +size 980194 diff --git a/generalizingknowledgegraphembeddingwithuniversalorthogonalparameterization/layout.json b/generalizingknowledgegraphembeddingwithuniversalorthogonalparameterization/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..937d0164db6544a8b65de4c434e383fab87714e6 --- /dev/null +++ b/generalizingknowledgegraphembeddingwithuniversalorthogonalparameterization/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:813912944c98d0db2f6cb825f431e96f6a72b1ebb69c876b6a5725df47ad1d05 +size 1086661 diff --git a/generalizingorthogonalizationformodelswithnonlinearities/32b7fe5c-c2f7-44b1-918b-16aed34f6b11_content_list.json b/generalizingorthogonalizationformodelswithnonlinearities/32b7fe5c-c2f7-44b1-918b-16aed34f6b11_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..dd002352adb6d0b5b5d02423b9225e83716eb1a5 --- /dev/null +++ b/generalizingorthogonalizationformodelswithnonlinearities/32b7fe5c-c2f7-44b1-918b-16aed34f6b11_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:565f38661cba1cb345cbbe9306effb571a1b3f57390f866f7573506dfc787f2f +size 157566 diff --git a/generalizingorthogonalizationformodelswithnonlinearities/32b7fe5c-c2f7-44b1-918b-16aed34f6b11_model.json b/generalizingorthogonalizationformodelswithnonlinearities/32b7fe5c-c2f7-44b1-918b-16aed34f6b11_model.json new file mode 100644 index 0000000000000000000000000000000000000000..3db789f79a374da3aea90479f2cd5a763dd009dd --- /dev/null +++ b/generalizingorthogonalizationformodelswithnonlinearities/32b7fe5c-c2f7-44b1-918b-16aed34f6b11_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b4b459a3ae28b7bdccbd26cbd947eb16a32b2702740e740553af5ebc2fec25b +size 183277 diff --git a/generalizingorthogonalizationformodelswithnonlinearities/32b7fe5c-c2f7-44b1-918b-16aed34f6b11_origin.pdf b/generalizingorthogonalizationformodelswithnonlinearities/32b7fe5c-c2f7-44b1-918b-16aed34f6b11_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..59756a4cfb36b2362d95930c41652013d8ee9867 --- /dev/null +++ b/generalizingorthogonalizationformodelswithnonlinearities/32b7fe5c-c2f7-44b1-918b-16aed34f6b11_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c43d08d08b0c05d381d4fcbe6b47c25ca4c87bf383ceb97e77a0b6376e183383 +size 859618 diff --git a/generalizingorthogonalizationformodelswithnonlinearities/full.md b/generalizingorthogonalizationformodelswithnonlinearities/full.md new file mode 100644 index 0000000000000000000000000000000000000000..e977538b049c622b02cb57e8fd62f2fb902b9c3c --- /dev/null +++ b/generalizingorthogonalizationformodelswithnonlinearities/full.md @@ -0,0 +1,693 @@ +# Generalizing Orthogonalization for Models with Non-Linearities + +David Rügamer $^{1,2}$ Chris Kolb $^{1,2}$ Tobias Weber $^{1,2}$ Lucas Kook $^{3}$ Thomas Nagler $^{1,2}$ + +# Abstract + +The complexity of black-box algorithms can lead to various challenges, including the introduction of biases. These biases present immediate risks in the algorithms' application. It was, for instance, shown that neural networks can deduce racial information solely from a patient's X-ray scan, a task beyond the capability of medical experts. If this fact is not known to the medical expert, automatic decision-making based on this algorithm could lead to prescribing a treatment (purely) based on racial information. While current methodologies allow for the "orthogonalization" or "normalization" of neural networks with respect to such information, existing approaches are grounded in linear models. Our paper advances the discourse by introducing corrections for non-linearities such as ReLU activations. Our approach also encompasses scalar and tensor-valued predictions, facilitating its integration into neural network architectures. Through extensive experiments, we validate our method's effectiveness in safeguarding sensitive data in generalized linear models, normalizing convolutional neural networks for metadata, and rectifying pre-existing embeddings for undesired attributes. + +# 1. Introduction + +In the burgeoning landscape of artificial intelligence and deep learning, black-box algorithms have become a centerpiece for driving advances in many fields of application. These powerful and often inscrutable models offer impressive predictive capabilities, but their complexity also gives rise to challenges that cannot be overlooked. One of the most urgent contemporary challenges is the correction of un + +$^{1}$ Department of Statistics, LMU Munich, Munich, Germany $^{2}$ Munich Center for Machine Learning (MCML), Munich, Germany $^{3}$ Institute for Statistics and Mathematics, Vienna University of Economics and Business, Vienna, Austria. Correspondence to: David Rügamer . + +Proceedings of the $41^{st}$ International Conference on Machine Learning, Vienna, Austria. PMLR 235, 2024. Copyright 2024 by the author(s). + +wanted behaviors in these algorithms. In particular, the presence of biases in model predictions and learned representations can lead to unintended consequences that transcend the technological sphere, impacting societal norms and ethical considerations. For example, Glocker et al. (2023b) and Weber et al. (2023) realized that predictions of convolutional networks trained for chest X-ray pathology classification are heavily affected by implicitly encoded racial information, leading to potentially inaccurate or unfair medical assessments. + +In this paper, we stress the necessity of addressing these challenges and propose several solutions, focusing on what has been termed "orthogonalization" or "normalization" of neural networks in the literature (see, e.g., Lu et al., 2021; Rügamer, 2023). These approaches can be used to adjust predictions, prevent unequal treatment of population subgroups, protect from unintentionally revealing sensitive information, or ensure the interpretability of black-box models. + +# 1.1. Related Literature + +Classical Orthogonalization In contrast to research investigating network weight dependencies (see, e.g., Huang et al., 2020), the orthogonalization discussed in this work is usually motivated as a normalization operation or correction method. Lu et al. (2021), e.g., proposed the so-called metadata normalization network, which applies a layer-wise orthogonalization to remove metadata information from layers. Similarly, He et al. (2019) study an orthogonalization procedure to encourage fair learning by removing protected information from feature representations. To circumvent training instabilities caused by dependence on the batch size, Vento et al. (2022) propose to cast the metadata normalization as a bi-level problem optimized using a penalty approach. Kaiser et al. (2022) use the same idea to incorporate fairness in automated decision-making systems for labor market data. A related but different problem is addressed by Rügamer et al. (2023), who propose an orthogonalization cell to preserve effect identifiability and thereby interpretability. This idea was then also adapted to other model classes (Baumann et al., 2021; Kopper et al., 2021). Further, orthogonalization can also be used as a debiasing technique (e.g., in graph neural networks, Palowitch & Perozzi, 2020). Similar to our work, orthogonalization can be + +Table 1. Estimated influence (coefficients) of sex, age, and race on the model's predictions when using self-supervised embeddings of the MIMIC-CXR dataset (Sellergren et al., 2022) on the label Pleural Effusion. The first row shows uncorrected values, the second row the results after classical orthogonalization, and the third row after applying our generalized orthogonalization. p-values in brackets indicate whether these coefficients represent a significant influence (p-values smaller than 0.05 show a $\times$ -sign, otherwise a $\checkmark$ -sign). + +
Sex (male)AgeRace (Black)Race (White)
Without correction0.064 (9.3e-9) X2.237 (< 2e-16) X-0.483 (< 2e-16) X-0.050 (0.0743) ✓
Classical orthogonalization Cl0.014 (0.192) ✓0.453 (< 2e-16) X-0.117 (< 2e-4) X-0.015 (0.603) ✓
Generalized orthogonalization Ch0.001 (0.994) ✓-0.011 (0.689) ✓-0.001 (0.753) ✓-0.000 (0.904) ✓
+ +applied as part of a neural network (e.g., Lu et al., 2021) or post-model fitting (Rügamer, 2023). The latter approach also has a link to double and debiased machine learning in econometrics (see, e.g., Chernozhukov et al., 2018), where a related correction is performed to allow for inference statements about a treatment variable after removing (potentially non-linear) nuisance effects. + +Fair Machine Learning Another related strand of literature is fair machine learning (Chen et al., 2022). As we discuss later in our work, methods to achieve fairness are closely linked to orthogonalization and vice versa. A wide range of notions and approaches exists to operationalize the concept of fairness (see, e.g., Mehrabi et al., 2021; Pes-sach & Shmueli, 2022, for literature reviews). Proposed methods are applied at different steps, e.g., in data preprocessing (Calmon et al., 2017) or post-processing (Hardt et al., 2016; Sattigeri et al., 2022; Xu et al., 2022), and have been derived for different model classes, such as generalized linear models (GLMs; Do et al., 2022) or kernel learning (Pérez-Suay et al., 2017). These approaches are usually implemented as constrained (see, e.g., Komi-yama et al., 2018; Zafar et al., 2019) or regularized optimization problems (e.g., Scutari et al., 2022; Do et al., 2022) and require making a trade-off between model performance and the amount of achieved fairness. In contrast, our approach forces the model predictions to be uncorrelated with the protected information, thereby ensuring that they can not be inferred to any degree from the predictions using a linear model. While this potentially comes at the cost of a loss in model performance, a conservative correction routine that errs on the side of caution is required in many risk-averse domains such as medical applications with sensitive patient information (Glocker et al., 2023a), or when the goal is to achieve model identifiability (Rügamer, 2023). A limitation of presented fairness solutions is that the sensitive information is made explicit in the model under the assumption of a linear effect on the outcome (see, e.g., Scutari et al., 2022). + +Despite the versatility of orthogonalization in practice, most existing methods share the same working principle which assumes linearity in both the model that needs to be corrected and the correction function. In many real-world situations, however, models include non-linearities that render the clas- + +sical orthogonalization unable to fully correct the model (cf. Table 1 with details in Section 4.2.1). + +# 1.2. Our Contribution + +In this paper, we extend the orthogonalization operation to non-linearity in both the model that needs to be corrected and the correction function. We derive a correction routine that works for a variety of non-linear models, including GLMs and neural networks. Moreover, we show how to extend our approach to arbitrary tensor-valued predictions. This allows our method to be flexibly inserted anywhere in common neural network architectures and thereby further generalizes the idea of normalization. Our experimental results demonstrate the efficacy of our approach, showing how 1) sensitive information can be successfully protected in GLMs, 2) neural networks with non-linear activation functions can be normalized for metadata during training, and 3) orthogonalization effectively corrects pre-trained embeddings for unwanted attributes. + +# 2. Orthogonalization + +Given an input $X \in \mathbb{R}^{n \times p}$ , $p \leq n$ with full column rank, the linear predictor in a parametric learning model (or the pre-activation of a fully-connected neural network layer) is given by $X\beta$ , where $\beta \in \mathbb{R}^p$ denotes the model's or layer's weights. In a linear model, we can write the least squares predictions $\hat{\pmb{y}}$ as a function of the inputs $X$ and targets $\pmb{y}$ : + +$$ +\hat {\boldsymbol {y}} = \boldsymbol {X} \hat {\boldsymbol {\beta}} = \mathcal {P} _ {\boldsymbol {X}} \boldsymbol {y}, +$$ + +where $\mathcal{P}_{\pmb{X}} = \pmb {X}(\pmb{X}^{\top}\pmb {X})^{-1}\pmb{X}^{\top}$ is the projection matrix projecting $\pmb{y}$ onto $\operatorname {span}(\pmb {X})$ , the space spanned by the columns of $\pmb{X}$ . Instead of projecting onto $\operatorname {span}(\pmb {X})$ , we can also project onto the orthogonal complement $\operatorname {span}(\pmb {X})^{\perp}$ using $\mathcal{P}_{\pmb{X}}^{\perp}\pmb {y} = (\pmb{I}_n - \mathcal{P}_\pmb {X})\pmb {y},$ where $\pmb{I}_n$ is the identity matrix. Hence, when left-multiplying a term by $\mathcal{P}_{\overline{X}}^{\perp}$ , we orthogonalize this term (w.r.t. features $\pmb{X}$ ). Ultimately — whether the motivation is debiasing, protecting information, or identifiability — the universal recipe for most approaches discussed in Section 1.1 is to use the described orthogonalization operation. Given protected features $\pmb{X}$ , which are not supposed to influence the modeling process, and a model that uses a different set of features $Z\in \mathbb{R}^{n\times q}$ $q\geq p$ for prediction, we + +![](images/19b1ba930d728946b3a8a7744723c1fe33509039c5ffdaa81475f7ea1dcb4661.jpg) + +![](images/b689f641c7171b72345a711c0a05cc681fc0873ceacfa999c58f366b656d48c3.jpg) + +![](images/9b422e4e113f1dcba8955a4e132197ce54b7f2943e8c139adf44ec7c0d9d9cee.jpg) + +![](images/3c0f615f55bebab1404eac646478c7822c59c5132bcd46eda1d1109db4107b99.jpg) +Figure 1. Exemplary optimization process for a fixed number of iterations (converging towards the black crosses) for logistic regression with features $z_{1}, z_{2}$ , weights $\gamma_{1}, \gamma_{2}$ , and one protected feature $x_{1}$ correlated with $z_{1}$ . The upper row shows the loss surface and optimization path for the three different methods (columns) a small step size. The bottom row shows the correlation between the model's prediction and the protected feature along the optimization path, where only the generalized orthogonalization yields predictions uncorrelated with the sensitive information. + +![](images/e55b779d606a73f2c105e0591d712f06c85325cebc7df6d0ebaff97bec3caaf1.jpg) + +![](images/9c249948d032f9978fe02b99363528d3897be261e18744944e7c4cf6e5dcb1f7.jpg) + +can "correct" the model (or, in this case equivalently, the features $Z$ ) by fitting the model with $Z^c \coloneqq \mathcal{P}_X^\perp Z$ instead of $Z$ . This is equivalent to removing all linear $X$ -information in $Z$ . Note that $Z$ might also contain features from $X$ , but the correction is supposed to work for unobserved relationships between $Z$ and $X$ . We call this correction function $\mathcal{C}^l$ in the following. + +To see that $\mathcal{C}^l$ in fact removes the effect of protected features $X$ from $Z$ in the prediction, we can check whether the corrected predictions $\hat{\pmb{y}}^c = \pmb{Z}^c\hat{\pmb{\gamma}}^c$ , based on the orthogonalized features $\pmb{Z}^{c} = \mathcal{P}_{\pmb{X}}^{\perp}\pmb{Z}$ and a corrected weight vector $\hat{\gamma}^c\in \mathbb{R}^q$ , can be linearly explained by the features $X$ to any degree. This can be done by regressing $\hat{\pmb{y}}^c$ on $X$ . If the correction is successful, the debiased effect + +$$ +\hat{\boldsymbol{\beta}}^{c}:= \operatorname *{arg min}_{\boldsymbol{\beta}^{c}}\| \hat{\boldsymbol{y}}^{c} - \boldsymbol {X}\boldsymbol{\beta}^{c}\|_{2}^{2} +$$ + +of $X$ in the linear model with outcome $\hat{\pmb{y}}^c$ and features $X$ should be $\hat{\beta}^c\equiv 0$ . Plugging in the terms of the ordinary least squares solution for both $\hat{\beta}^c$ and $\hat{\gamma}$ , we get + +$$ +\begin{array}{l} \hat {\boldsymbol {\beta}} ^ {c} = \left(\boldsymbol {X} ^ {\top} \boldsymbol {X}\right) ^ {- 1} \boldsymbol {X} ^ {\top} \hat {\boldsymbol {y}} ^ {c} = \left(\boldsymbol {X} ^ {\top} \boldsymbol {X}\right) ^ {- 1} \boldsymbol {X} ^ {\top} \boldsymbol {Z} ^ {c} \hat {\boldsymbol {\gamma}} \\ = \left(\boldsymbol {X} ^ {\top} \boldsymbol {X}\right) ^ {- 1} \boldsymbol {X} ^ {\top} \mathcal {P} _ {\boldsymbol {X}} ^ {\perp} \boldsymbol {Z} (\boldsymbol {Z} ^ {\top} \mathcal {P} _ {\boldsymbol {X}} ^ {\perp} \boldsymbol {Z}) ^ {- 1} \boldsymbol {Z} ^ {\top} \mathcal {P} _ {\boldsymbol {X}} ^ {\perp} \boldsymbol {y}, \\ \end{array} +$$ + +which yields $\mathbf{0}$ as $X^{\top} \mathcal{P}_{\overline{X}}^{\perp} = \mathbf{0}_{p \times n}$ . This confirms that we have successfully removed any linear effect of $X$ from the predictions $\hat{\boldsymbol{y}}^{c}$ and corrected features $Z^{c}$ . So when $Z$ is, e.g., a pre-trained embedding, using $Z^{c}$ instead of $Z$ in a downstream task removes the partial influence of protected features $X$ contained in $Z$ , as we first project the original embedding onto a space that is orthogonal to the space spanned by the protected features $X$ . + +# 3. Orthogonalization for Models with Non-linearities + +While the classical orthogonalization allows correcting for metadata of images (Lu et al., 2021) or identifying contributions in additive predictors (Rügamer, 2023), all previous methods fail to provide a valid correction in the case of a non-linear, element-wise transformation $h$ applied to $Z\gamma$ , i.e., $\hat{\pmb{y}} = h(Z\pmb{\gamma})$ , such as in GLMs or most neural network layers (see Figure 1 for an example). In the following, we present an extension to previously proposed orthogonalization approaches that also encompass models with non-linear transformations of the linear predictor, thereby accounting for various important use cases. For simplicity, we motivate our approach using a GLM, but also discuss its embedding in neural architectures in Sections 3.2-3.4. Before deriving the theoretical details, we provide an instructive example in the following. + +Example 1. Following Weber et al. (2023), assume we are given an embedding $Z \in \mathbb{R}^{n \times q}$ from a medical imaging task and want to ensure that by using this embedding, we do not share any protected patient information encoded in $X$ . Assume that the embedding contains information from $X$ (which represents a very real problem; see Glocker et al., 2023b). When predicting the patients' disease status using the embedding $Z$ in a GLM with $\hat{y} = h(Z\hat{\gamma})$ , where $h$ is the sigmoid function, we risk making decisions implicitly based on protected features. Instead, we have to come up with a corrected GLM routine such that the corrected nonlinear model predictions $\hat{y}^c$ do not utilize or leak patient information $X$ . + +![](images/30b9c84ae0a94b64aad13ddfb081d6bef4f48495c9b0b6415d186e73ff9e6146.jpg) +Figure 2. Workflow of generating predictions via model $\mathcal{M}^p$ and checking the influence of $\mathbf{X}$ on the resulting predictions $\hat{\mathbf{y}}$ using $\mathcal{M}^e$ . Green parts indicate the orthogonalization applied to $\mathcal{M}^p$ . + +# 3.1. Types of Orthogonalizations + +We first start by examining the properties of the original orthogonalization $\mathcal{C}^l$ when applied to models with non-linear activation functions. In particular, it is worth noting that using $Z^{c} = \mathcal{P}_{X}^{\perp}Z$ from Section 2 can be used in a GLM when the goal is to orthogonalize the model's additive predictor $\eta = Z\gamma$ . In this case, a corrected version $\eta^{c} = Z^{c}\gamma$ will be orthogonal to the column space of $X$ for any $\gamma$ and hence, before the non-linear transformation $h$ , "free" of any (linear) effect of protected features $X$ . In other words, regressing $\eta^{c}$ on $X$ will result in effects $\hat{\beta}^{c} = 0$ as derived for the linear case in Section 2. In contrast, when transforming $\eta^{c}$ with $h$ , the model space becomes non-linear and regressing $\hat{y} = h(\eta^{c})$ on $X$ will generally not yield effects $\hat{\beta}^{c} = 0$ , i.e., the transformed predictor $h(\eta^{c})$ still potentially contains $X$ -information (cf. Appendix A for an illustrative explanation). As illustrated in Example 1, such non-linear transformations are ubiquitous in machine learning and employed in most classification tasks. + +When using a non-linear activation function $h$ in the prediction of $y$ based on $Z$ , a natural choice is to also use the same non-linear transformation to check the model's prediction for any $X$ influence. To better clarify the different types of models involved in an orthogonalization and to unify previous endeavors, we define the following terms for the workflow described in Figure 2: + +Definition 1. Given features $Z \in \mathbb{R}^{n \times q}$ , a monotonic activation function $h$ , loss function $\ell: \mathbb{R}^n \times \mathbb{R}^n \to \mathbb{R}$ and protected features stored in a full column rank matrix $X \in \mathbb{R}^{n \times p}$ , we define + +- the prediction model $\mathcal{M}^p: \mathbb{R}^{n \times q} \to \mathbb{R}^n$ , $Z \mapsto \hat{y} = h(Z \hat{\gamma})$ , the model using $Z$ to generate predictions $\hat{y}$ for an outcome of interest $y$ , with parameters $\hat{\gamma}$ learned by minimizing $\ell$ ; +- the correction routine $\mathcal{C}^h$ : A routine correcting $\mathcal{M}^p$ to produce corrected predictions $\hat{\boldsymbol{y}}^c$ ; + +- the evaluation model $\mathcal{M}^e: \mathbb{R}^{n \times p} \times \mathbb{R}^n \to \mathbb{R}^p$ , $(X, \hat{\boldsymbol{y}}^c) \mapsto \hat{\boldsymbol{\beta}}^c$ , the model minimizing $\ell(\hat{\boldsymbol{y}}^c, h(X \hat{\boldsymbol{\beta}}^c))$ to check whether the influence of $X$ on the corrected predictions $\hat{\boldsymbol{y}}^c$ from $\mathcal{M}^p$ has been successfully removed by $\mathcal{C}^h$ . + +The previous definition assumes that the activation function $h$ is the same for all three components $\mathcal{M}^p, \mathcal{M}^e$ , and $\mathcal{C}^h$ . + +Before introducing our new orthogonalization algorithm when the activation function $h$ is used, we more formally define what we mean by "correcting for the influence of $X$ ". + +Definition 2. Given the setup and models in Definition 1, we say the model predictions $\hat{\pmb{y}}$ of $\mathcal{M}^p$ are corrected (or orthogonalized) if $\mathcal{M}^e$ yields coefficient values $\hat{\beta}^c = 0$ . $\hat{\pmb{y}}^c$ are then called corrected predictions. + +While these definitions imply a similar goal as pursued in fair machine learning, our approach uses a slightly different measure of "unbiasedness" that coincides with the previously introduced normalization (Lu et al., 2021) as well as the orthogonalization for identifiability (Rugamer et al., 2023). In contrast, in fair machine learning, the level of unfairness is, e.g., defined as the proportion of the variance of $\hat{\pmb{y}}$ that can be explained by $X$ (see, e.g., Scutari et al., 2022, or further explanations in Appendix B). Using this notion, a model adhering to Definition 2 is perfectly fair, but the opposite is not always true. This is because fairness is achieved using a criterion different from the one in Definition 2. In addition, these approaches often do not fully enforce fairness to preserve other model properties, in most cases only use the $L_{2}$ loss for $\ell$ and assume a linear relationship between $X$ and $\pmb{y}$ . + +# 3.2. Orthogonalization for GLM-type Routines + +We first extend the classical orthogonalization of Section 2 motivated by linear models to GLMs. This model class is described by a distributional assumption inducing a loss function $\ell$ defined by the corresponding negative log-likelihood and strictly monotone activation function $h$ (equal to the so-called inverse link function in GLMs). The implied loss function comprises many common machine learning setups: binary classification using sigmoid activation, multi-class classification using a softmax-type activation, or, e.g., a count regression using the exp-activation function. When applying Definition 2 to these GLMs using their canonical link function, we say that the correction of a model $\mathcal{M}^p$ yielding $\hat{\boldsymbol{y}}^c$ is successful if the evaluation model $\mathcal{M}^e$ defined by the minimizer + +$$ +\hat {\boldsymbol {\beta}} ^ {c} = \underset {\boldsymbol {\beta} ^ {c}} {\arg \min } \ell (\hat {\boldsymbol {y}} ^ {c}, h (\boldsymbol {X} \boldsymbol {\beta} ^ {c})) \tag {1} +$$ + +is a null model, i.e., $\hat{\beta}^c\equiv 0$ . Note that we here assume a model without intercept for better readability1. While the solution of (1) is known not to have an analytical solution in general (see, e.g., Nelder & Wedderburn, 1972), the GLM poses a convex optimization problem and can be solved efficiently with iteratively reweighted least squares or Newton-type procedures (Gill et al., 2019). + +Importantly, the iterates of these Newton-type optimization procedures can be represented as $\hat{\beta}^{[t]} = (X^{\top}\Upsilon^{[t]}X)^{-1}X^{\top}\Upsilon^{[t]}r^{[t - 1]}$ , $t\in \mathbb{N}$ , where the weights $\Upsilon^{[t]}\in \mathbb{R}^{n\times n}$ are given by a diagonal matrix and $\boldsymbol {r}^{[t]}\in \mathbb{R}^n$ is a working response (see Appendix D for details). As both $\Upsilon^{[t]}$ and $\boldsymbol {r}^{[t - 1]}$ are fixed after fitting the evaluation model, we can make use of the approximate linearity of both $\mathcal{M}^p$ and $\mathcal{M}^e$ at convergence to derive our generalized orthogonalization. A helpful intermediate result is the following: + +Lemma 3. Given any GLM model $\mathcal{M}^p$ with predictions $\hat{\mathbf{y}}$ , and GLM model $\mathcal{M}^e$ with features $\mathbf{X}$ + +$$ +\hat {\mathbf {y}} ^ {c} = \mathcal {P} _ {\boldsymbol {X}} ^ {\perp} \hat {\mathbf {y}} + h (0) \mathbf {1} _ {n} \tag {2} +$$ + +defines corrected predictions yielding $\hat{\beta}^c = 0$ . + +Lemma 3 is an interesting and important finding to construct a correction, stating that despite the non-linearity of $\mathcal{M}^e$ , it is sufficient to (linearly) orthogonalize predictions of $\mathcal{M}^p$ using the orthogonal projection $\mathcal{P}_{\overline{X}}^{\perp}$ . The derivation and proof can be found in Appendix E.1. However, as we discuss in the following paragraph, it is not straightforward to relate this finding to a corrected GLM model $\mathcal{M}^p$ . + +Deriving corrected coefficients In order to derive a corrected GLM routine for corrected coefficients $\hat{\gamma}^c$ that are consistent with $\hat{\pmb{y}}^c$ , a naive approach is to simply invert their definition $\hat{\pmb{y}}^c = h(Z\hat{\gamma}^c)$ , yielding + +$$ +\hat {\boldsymbol {\gamma}} ^ {c} = \boldsymbol {Z} ^ {\dagger} h ^ {- 1} (\hat {\boldsymbol {y}} ^ {c}) = \boldsymbol {Z} ^ {\dagger} h ^ {- 1} (\mathcal {P} _ {\boldsymbol {X}} ^ {\perp} \hat {\boldsymbol {y}}), +$$ + +where $Z^{\dagger} = (Z^{\top}Z)^{-1}Z^{\top}$ is the pseudo-inverse of $Z$ . However, as $\mathrm{dom}(\mathcal{P}_{\pmb{X}}^{\perp}\hat{\pmb{y}})$ is not necessarily a subset of $\mathrm{dom}(\hat{\pmb{y}})$ , $h^{-1}$ might not be defined on this new domain. In classification tasks, for example, this could lead to predicted probabilities $\hat{\pmb{y}}^c \notin (0,1)$ for which the inverse sigmoid function is not defined. Since this problem will occur whenever non-linear functions $h$ or $h^{-1}$ are employed, we instead have to adapt the GLM optimization routine as described in the following. + +Corollary 4. Given activation function $h$ , prediction model $\mathcal{M}^p$ and evaluation model $\mathcal{M}^e$ with features $X$ , the solution $\gamma^c$ to the optimization problem + +$$ +\operatorname {a r g} \min \ell (\boldsymbol {y}, h (\boldsymbol {Z} \boldsymbol {\gamma})) +$$ + +$$ +\gamma \tag {3} +$$ + +$$ +s. t. \left\| \left(\boldsymbol {X} - n ^ {- 1} \mathbf {1} _ {n} \mathbf {1} _ {n} ^ {\top} \boldsymbol {X}\right) ^ {\top} h (\boldsymbol {Z} \boldsymbol {\gamma}) \right\| _ {2} ^ {2} = 0 +$$ + +produces corrected coefficients satisfying $\hat{\beta}^c = 0$ . + +The mathematical details and derivations are given in the Appendix E.2. While various routines exist to solve (3), the problem turns out to be hard in practice, in particular in applications that are concerned with fairness, such as the ones addressed in Section 4.1. We found the modified differential multiplier method (Platt & Barr, 1987) to be very effective and describe its details in Appendix E.2. Further, note that in the case of an identity activation function $h$ , the derived optimization problem in Corollary 4 is also directly solved by using $\mathcal{C}^h = \mathcal{C}^l$ . + +# 3.3. Orthogonalization with Piece-wise Linear Activations + +While the previous orthogonalization can be used in many different situations, intermediate network layers are often specified with piece-wise linear activation functions not comprised by the GLM framework, most notably the ReLU function. As for canonical activation functions in GLMs, the ReLU activation $\mathrm{ReLU}(X\beta) = X\beta \circ \mathbb{1}(X\beta >0)$ is applied element-wise, with $\circ$ denoting the Hadamard product and $\mathbb{1}(\cdot)$ an indicator function individually evaluated for all entries of the vector. While at first glance the definition of the ReLU activation might suggest that $\mathrm{ReLU}(X\beta)\in \operatorname {span}(X)$ and hence $\mathcal{C}^l$ from Section 3.1 is sufficient for successful orthogonalization, this is not the case as can be verified with a simple counterexample. + +Example 2. Assume $\mathbf{X} = (1, -1)^{\top} \in \mathbb{R}^{2}$ and $\beta = 1$ . Then $\operatorname{ReLU}(\mathbf{X}\beta) = (1,0) \notin \operatorname{span}(\mathbf{X})$ . + +Although $\mathrm{ReLU}(\pmb {X}\beta)$ does not necessarily lie in $\operatorname {span}(\pmb {X})$ we can derive the following result + +Theorem 5. Given a prediction model $\mathcal{M}^p$ with ReLU activation, and an evaluation model $\mathcal{M}^e$ with ReLU activation and $L_{2}$ loss, a $\mathcal{C}^h$ -orthogonalization of the form $Z^{c} = \mathcal{P}_{X}^{\perp}Z$ , will yield $\hat{\beta}^c = 0$ . + +The proof of Theorem 5 is given in the Appendix. + +# 3.4. Orthogonalization for Tensor Predictions + +We now show that our concept of orthogonalization is not restricted to regression models, but can also be used to remove information from learned representations in layers of neural networks. Such a correction should be able to deal with prediction models (or layers) with tensor-shaped predictions (e.g., present in early layers of convolutional networks) and we show how to adapt previous results accordingly. We first define the linear evaluation model $\mathcal{M}^e$ with $L_{2}$ -loss $\ell$ as the solution of the following tensor-on-vector regression: + +$$ +\hat {\mathfrak {B}} ^ {c} = \underset {\mathfrak {B} ^ {c}} {\arg \min } \ell \left(\hat {\mathfrak {Y}} ^ {c}, \boldsymbol {X} \times_ {1} \mathfrak {B} ^ {c}\right), \tag {4} +$$ + +where the outcome tensor $\hat{\mathfrak{Y}}^c\in \mathbb{R}^{n\times d_1\times \dots \times d_R}$ is the corrected version of an (intermediate) non-linear prediction $\hat{\mathfrak{Y}}$ $X\in \mathbb{R}^{n\times p}$ is a feature matrix as before, $\mathfrak{B}^c\in$ $\mathbb{R}^{p\times d_1\times \dots \times d_R}$ a tensor-valued regression coefficient, and $\times_{1}$ denotes the 1-mode product. For a successful correction $\mathcal{C}^h$ from which we obtain $\hat{\mathfrak{Y}}^c$ , it must hold $\hat{\mathfrak{B}}^c\equiv \mathbf{0}$ in (4), which can be achieved by projecting vec( $\hat{\mathfrak{V}})$ onto $\operatorname {span}(\boldsymbol {X})^\perp$ as before. Indeed, using a vectorized reformulation, we can prove that this yields corrected predictions (see Appendix E.4 for details): + +Corollary 6. Given the set-up around the evaluation model defined by (4), the corrected predictions satisfying $\hat{\mathfrak{B}}^c\equiv \mathbf{0}$ are given by + +$$ +\hat {\mathcal {Y}} ^ {c} = \mathcal {P} _ {\boldsymbol {X}} ^ {\perp} \times_ {1} \hat {\mathcal {Y}}. \tag {5} +$$ + +While the result in (5) can be extended to GLM-type nonlinearities, and hence an orthogonalization as the one in Section 3.2 can be derived, we here focus on the ReLU activation function, arguably the pervasive type of non-linearity in intermediate DNN layers. Hence, we consider an evaluation model $\mathcal{M}^e$ with ReLU activation defined by + +$$ +\hat {\mathfrak {B}} ^ {c} = \underset {\mathfrak {B} ^ {c}} {\arg \min } \ell (\hat {\mathfrak {Y}} ^ {c}, \operatorname {R e L U} (X \times_ {1} \mathfrak {B} ^ {c})), \tag {6} +$$ + +and a prediction model $\mathcal{M}^p$ yielding predictions $\hat{\mathfrak{V}} = \mathrm{ReLU}(\bar{\mathfrak{V}})$ with pre-activation $\mathfrak{V}$ . In contrast to previous sections, we here focus on correcting the predictions and not the effects of $\mathcal{M}^p$ , as predictions of an intermediate layer in a large neural network are not necessarily formed by a linear operation. We obtain the following result: + +Corollary 7. Assuming the evaluation model (6), the corrected pre-activations $\mathfrak{Y}^c$ yielding corrected predictions $\hat{\mathfrak{Y}}^c$ following ReLU activation are given by $\bar{\mathfrak{Y}}^c = \mathcal{P}_{\bar{\boldsymbol{X}}}^\perp \times_1\bar{\mathfrak{Y}}$ . + +See Appendix E.5 for a proof. In other words, by multiplying the first dimension of a non-activated output of some layer with $\mathcal{P}_{\overline{X}}^{\perp}$ from the left before applying the ReLU activation, we obtain corrected predictions in the next layer. + +# 4. Numerical Experiments + +In Section 4.1, we first check whether sensitive information can be successfully protected in GLMs with our approach, using both synthetic and real-world datasets. We then show in various settings how our method corrects learned representations for potential biases (Section 4.2), and finally investigate its effectiveness as an online version applied during training (Section 4.3). The details of all experiments are provided in Appendix F. In all experiments, categorical information in the protected features is included in $Z$ as one-hot encoded features with the first column removed (as we don't want to orthogonalize or penalize the model for a constant intercept term). + +# 4.1. Generalized Linear Model + +In the following, we focus on real-world applications but provide synthetic data examples in Appendix G.1, confirming that $\mathcal{C}^h$ works as intended for GLMs in a variety of settings. + +# 4.1.1. ADULT INCOME DATA + +Using the adult income data also investigated in Xu et al. (2022) to analyze algorithm fairness, we check the efficacy of our approach for protected features sex and race. We therefore first fit our prediction model, a GLM with features age, work class, education, marital status, relationship, and working hours per week, to predict the person's income binarized into $\leq 50\mathrm{k}$ and $>50\mathrm{k}$ (as provided by the original dataset) and then correct for the protected features. + +Results We find (Table 2, first row) that the income predictions are significantly influenced if the individual is white and/or male with a multiplicative increase in the odds-ratio of approximately $\exp(0.522) = 1.68$ and $\exp(1.066) = 2.90$ for earning more than $50\mathrm{k}$ for white individuals and males, respectively. Similar results are inferred from Xu et al. (2022)'s approach. When applying our framework and adjusting for sex and race, we can see that all effects of these protected features are estimated to be close to zero and are non-significant. + +Table 2. Estimated coefficients from $\mathcal{M}^e$ with corresponding p-values in brackets when not correcting the model (first column), when using Xu et al. (2022) (second column), and when correcting with $\mathcal{C}^h$ (last column). P-values smaller than 0.05 show a $X$ -sign, otherwise a $\checkmark$ -sign. + +
w/o correctionXu et al. (2022)using Ch
Sex (male)1.066 (< 2e-16) X1.255 (< 2e-16) X-0.000 (0.998)✓
Race (Asian)0.263 (0.227)✓0.859 (2e-4) X0.011 (0.954)✓
Race (Black)-0.094 (0.577)✓0.191 (0.319)✓0.008 (0.957)✓
Race (Other)-0.165 (0.594)✓-0.131 (0.706)✓-0.131 (0.609)✓
Race (White)0.522 (0.001) X0.928 (4e-7) X0.005 (0.969)✓
+ +# 4.1.2. FAIRNESS BENCHMARK + +While fairness methods target a slightly different goal than orthogonalization, it might still be interesting to see whether our criterion for orthogonalization (cf. Definition 2) can also be met by approaches suggested in the fairness literature. We therefore run a comprehensive analysis on fairness datasets with non-Gaussian outcomes and compare the results of various fairness methods with our orthogonalization. In the case of GLMs, closely related methods are fair (logistic / Poisson) regression with different optimization strategies. Komiyama et al. (2018) bounds the proportion of explained variance by protected features (we refer to this as Komiyama1). Another variant by the same authors first regresses the fitted values against the protected features (re + +Figure 3. Comparison of orthogonalization properties of fairness methods in comparison with our approach. Ideally, methods should yield effects of zero (in the left plot) and large p-values (in the right plot). Missing boxes indicate that the method did not converge. +![](images/3d99d4c7049f0b7d91580b15e791aff20d043495190ae4dd452351b341a4e0e3.jpg) +Komiyama1 Komiyama2 Berk Zafar Ours + +![](images/70ddcc8fc358449873281b707aaff26e162617eb3f52df4b5e31181379ffba55.jpg) + +ferred to as Komiyama2). An alternative is the approach by Berk et al. (2017) enforcing individual fairness by penalizing pairs of observations that have different outcomes for the same protected features (referred to as Berk). A fourth approach we compare against is the one of Zafar et al. (2019) (referred to as Zafar) enforcing fairness by bounding the covariance of protected features and other predictors. We run these and our method on the benchmark datasets adult, bank, compas, and health. retirement provided in Scutari (2023) containing various protected features such as race, sex, or marriage. + +Results The results are depicted in Figure 3 showing that all fairness approaches show significant feature effects with effect strengths often different from 0. In contrast, our approach adheres to the orthogonality requirement from Definition 2, yielding effects close to 0 with no significant impact. As stated earlier, this does not imply unfairness of the other approaches, but demonstrates that fairness approaches cannot be simply used as a substitute to achieve orthogonality. As orthogonality might potentially decrease model performance, Table 3 additionally compares the model performances with and without the correction. Since most of + +Table 3. Test set prediction performances with/out correction. + +
Dataset (Metric)w/o Corr.w/ Corr.
adult (Accuracy)0.8540.833
bank (Accuracy)0.8990.887
compas (Accuracy)0.7390.724
health (Root mean squared error)0.7500.789
+ +the datasets contain the protected features also in $Z$ , i.e., as features for the prediction model, the prediction performance with orthogonalization will naturally decrease (if not, then the protected features would likely not bias the model and raise fairness issues in the first place). However, as can be seen in Table 3, the decrease in performance is often negligible with a maximum of $2\%$ decrease in accuracy for compas. + +# 4.2. Orthogonalization of Learned Representations + +# 4.2.1. COMPARING $\mathcal{C}^l$ AND $\mathcal{C}^h$ ON IMAGE EMBEDDINGS + +Going back to our instructive Example 1, we use self-supervised embeddings for the MIMIC Chest X-Ray dataset (Johnson et al., 2019; Sellersgren et al., 2022) known to have encoded race, sex and age (Glocker et al., 2023b), and try to remove this implicit information using orthogonalization. Following Glocker et al. (2023b), we first validate that meta-information such as race, in fact, is influencing predictions in a downstream task. As $\mathcal{M}^p$ we use a GLM to predict whether the patient suffers from pleural effusion using only the embedding as features. We then check whether a $\mathcal{C}^l$ -orthogonalization is sufficient to remove this information, but in contrast to the Adult data application, check on the level of probabilities where $\mathcal{C}^l$ should fail. Finally, we apply $\mathcal{C}^h$ -orthogonalization to obtain the corrected predictions. + +Results Table 1 (page 2) summarizes the results, confirming our hypotheses and demonstrating that our approach effectively removes the meta-information from embeddings. In this case, removing the features even results in a slight improvement in prediction performance with a 0.02 increase in AUC. + +# 4.2.2. POST-HOC ORTHOGONALIZATION FOR NEURAL REPRESENTATIONS + +As another demonstration, we analyze the race and age bias in a learned neural representation of faces from the UTKFace dataset (Zhang et al., 2017), where previous literature suggests, among other biases, a misalignment for black women (see, e.g., Krishnan et al., 2020). We first train a ResNet50 (He et al., 2016) on the provided images to classify the sex of the depicted person. We then check the influence of race and age on the predictions using a logistic regression. In order to correct for biases, we extract the weights in the ResNet's penultimate layer and apply the $\mathcal{C}^h$ -orthogonalization by fitting a corrected GLM (following Corollary 4) with learned representations as features and sex + +as the binary outcome. Finally, we again check the influence of race and age on the model's predictions. + +Results Results are summarized in Table 4, again depicting coefficients and p-values, and confirm the effectiveness of our approach in blinding the network for certain features (here age and race). The orthogonalization in this case comes at the cost of an AUC reduction from 0.831 (w/o correction) to 0.826 (with $\mathcal{C}^h$ ), which seems to be a reasonable trade-off to correct for age and race effects. + +Table 4. Estimated coefficients from $\mathcal{M}^e$ with corresponding p-values in brackets when not correcting the model (first column) and when correcting the model for age and race (second column). Significant influences are highlighted in bold for an $\alpha$ -level of 0.05. + +
w/o correctionChorthogonalization
Age-0.017 (< 2e-16) X-0.000 (0.976)✓
Race (Black)-0.352 (8.68e-10) X0.009 (0.872)✓
Race (Indian)-0.620 (< 2e-16) X0.008 (0.894)✓
Race (Other)-0.315 (4.05e-05) X-0.002 (0.979)✓
Race (White)-0.377 (5.65e-13) X-0.008 (0.872)✓
+ +# 4.2.3. WORD EMBEDDINGS + +As a last example, we demonstrate that our approach is not limited to tabular and image data. As, e.g., discussed in Bolukbasi et al. (2016), text embeddings, as well, can have biases encoded, and addressing this property seems of great relevance given the rise of GPT(-like) models which have also been shown to not always be neutral in their generation (see, e.g., Ray, 2023). To show that the proposed method also works for the correction of text embeddings in a nonlinear model, we use the movies review dataset (Maas et al., 2011), which we enhance with the gender information of the protagonist and the movie director. Using an LSTM model and a learned text embedding $Z$ (see Appendix F for details), we try to predict the number of reviews for each movie (i.e., a Poisson-distributed outcome). We do this once without correction and once by correcting the embeddings $Z$ of size $100 \times 100$ of every movie description following the results from Corollary 7 using the available gender information as $X$ . + +Results When not correcting the model's prediction, we obtain p-values $< 2\mathrm{e}-16$ for both gender effects, suggesting a significant influence of gender on the predictions $\hat{\mathbf{y}}$ . After correction, p-values are 0.993 and 1.0, implying a successful embedding correction with only a small increase in root mean squared error of $1\%$ compared to the model without correction. + +# 4.3. Online Orthogonalization + +Finally, we test how our approach performs when applied in an online fashion by iteratively optimizing a small CNN + +and orthogonalizing the network with respect to some fixed features $X$ as proposed in the Metadata Normalization approach (Lu et al., 2021). In other words, we perform the proposed orthogonalization during training. Inspired by Clever Hans predictors (Lapuschkin et al., 2019) and orthogonalization in distribution shift situations (Chen et al., 2023), we colorize the MNIST data by reshaping the grayscale image to an RGB image where one of the three channels is filled with the original grayscale pixel values and the remaining two channels filled with zeros, i.e., set to black. The binary prediction task is to classify a subset of the MNIST dataset reduced to digits 0 and 9. For the train set, we intentionally create only red images of 0s by assigning the pixel values to the first channel. For the images of 9s we randomly assign either the second (green) or third (blue) channel. In the counterfactual test set, images of both classes are colored randomly in green or blue, but not red. As a result, the color red is predictive for the train but not the test set. We then use the color information "red", denoted as the binary feature $X$ , in the correction model to normalize the CNN's predictions. In other words, we train a CNN on RGB images but blind the network w.r.t. the color red (or in fact any) color information by orthogonalizing the first convolutional layer's latent features w.r.t. $X$ . + +![](images/824051be7bfd0771ae61f8242c9f18e7bb5102adf414f56115cce13b14843b95.jpg) +Figure 4. Estimated influence of the color red on the convolutional layer's predictions (left plot) and train-, validation- and test-accuracy of the two models (with/out correction). + +![](images/fa64575a6f1421e25595fc4061963fbba7f96c79ec56ec1e1b00074b43de8bca.jpg) + +Results Figure 4 summarizes the results of the experiment showing that our method correcting for the color red in fact yields no influence of the metadata information on the hidden layer's weights (left plot) and further illustrates how the model without correction is fooled by the training/validation data by focusing on the information of the color channels instead of the pixel values. This leads to a poor test performance of not much more than $50\%$ accuracy. The corrected model shows a better test performance as it learned to focus on the image content and not the channel information. + +# 5. Discussion + +In this work, we introduced a novel correction routine that extends the concept of orthogonalization to non-linear and + +![](images/508aeb0d52466e8a9f1bbf433d5250e70787723740bc3137cb0b1bd66a312b56.jpg) +Figure 5. Comparison of orthogonalization properties of fairness methods in comparison with our approach when extending the notion of orthogonality beyond linear feature effects. Ideally, methods should yield random forest feature importance (RFimp) of zero (in the left plot) and large p-values (in the right plot). Missing boxes indicate that the method did not converge. + +tensor-valued models. Our experimental results confirm that our approach is effective in correcting sensitive data in linear models and neural networks, as well as rectifying pre-existing embeddings for undesired attributes. + +Caveat We want to emphasize that the given examples and results in this paper are limited by the representativeness of the datasets used and should not be the sole basis for decision-making in applications involving medical imaging or text applications. Furthermore, as "protection of information" can be defined in various ways, our presented methods do not offer guarantees of absolute protection for sensitive information in every situation. In particular, note that orthogonalization does not imply stochastic independence of the involved random variables, which means that some form of residual dependence could persist in theory. + +Limitations and future research The proposed algorithms require the number of observations $n$ to be larger than the number of features $p$ (or intermediate layer predictions in a network), and that there are more features $q$ in the prediction model than in the evaluation model $(p)$ . While this is usually the case, extensions to applications for $n < p$ or $q < p$ are a challenging yet interesting future research direction. + +The proposed orthogonalization also requires knowledge of features $Z$ related to protected information. Performing such an operation to remove implicit biases is another interesting approach brought up by an anonymous reviewer but would require simultaneously learning the protected feature and being able to evaluate whether these present potential biases. + +# 6.Outlook + +A possible extension suggested by one of the anonymous reviewers is to make the class of evaluation models more flexible, allowing it to go beyond linear effects of protected features on the additive predictor scale, i.e., fitting an evalu- + +ation model $h(g(X))$ where $g$ is, e.g., a non-linear function. This would yield a more general notion of orthogonalization than presented in this paper but is also more challenging to analyze theoretically. In order to check how robust existing approaches and ours are w.r.t. non-linear evaluation models, we run the fairness benchmark again and use a random forest as an evaluation model to explain the prediction model's output using protected information. We then extract the importance of each feature together with a p-value for the importance values using a permutation test. Results are depicted in Figure 5, showing a very similar pattern to Figure 3. Interestingly, our method seems to work well in terms of this new orthogonalization notion, only yielding significant feature importances for the bank dataset. Results for all other methods suggest that protected features play a significant role in the random forest's explanation of the prediction model's output. + +# Impact Statement + +This paper presents work whose goal is to advance the field of machine learning. There are many potential societal consequences of our work, none of which we feel must be specifically highlighted here. + +# References + +Baumann, P. F., Hothorn, T., and Rügamer, D. Deep conditional transformation models. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 3-18. Springer, 2021. +Berk, R., Heidari, H., Jabbari, S., Joseph, M., Kearns, M., Morgenstern, J., Neel, S., and Roth, A. A convex framework for fair regression. arXiv preprint arXiv:1706.02409, 2017. +Bolukbasi, T., Chang, K.-W., Zou, J. Y., Saligrama, V., and Kalai, A. T. Man is to computer programmer as woman + +is to homemaker? debiasing word embeddings. Advances in neural information processing systems, 29, 2016. +Calmon, F., Wei, D., Vinzamuri, B., Natesan Ramamurthy, K., and Varshney, K. R. Optimized pre-processing for discrimination prevention. Advances in neural information processing systems, 30, 2017. +Chen, A. S., Lee, Y., Setlur, A., Levine, S., and Finn, C. Project and probe: Sample-efficient domain adaptation by interpolating orthogonal features. arXiv preprint arXiv:2302.05441, 2023. +Chen, Y., Li, Y., Weller, A., et al. Scalable infomin learning. Advances in Neural Information Processing Systems, 35: 2226-2239, 2022. +Chernozhukov, V., Chetverikov, D., Demirer, M., Duflo, E., Hansen, C., Newey, W., and Robins, J. Double/debiased machine learning for treatment and structural parameters, 2018. +Do, H., Putzel, P., Martin, A. S., Smyth, P., and Zhong, J. Fair generalized linear models with a convex penalty. In International Conference on Machine Learning, pp. 5286-5308. PMLR, 2022. +Ganin, Y., Ustinova, E., Ajakan, H., Germain, P., Larochelle, H., Laviolette, F., March, M., and Lempitsky, V. Domain-adversarial training of neural networks. Journal of machine learning research, 17(59):1-35, 2016. +Gill, J., Gill, J. M., Torres, M., and Pacheco, S. M. T. Generalized linear models: a unified approach, volume 134. Sage Publications, 2019. +Glocker, B., Jones, C., Bernhardt, M., and Winzeck, S. Algorithmic encoding of protected characteristics in chest x-ray disease detection models. *Ebiomedicine*, 89, 2023a. +Glocker, B., Jones, C., Roschewitz, M., and Winzeck, S. Risk of bias in chest radiography deep learning foundation models. *Radiology: Artificial Intelligence*, 5(6), 2023b. +Hardt, M., Price, E., and Srebro, N. Equality of opportunity in supervised learning. Advances in neural information processing systems, 29, 2016. +He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778, 2016. +He, Y., Burghardt, K., and Lerman, K. Learning fair and interpretable representations via linear orthogonalization. arXiv preprint arXiv:1910.12854, 2019. + +Huang, L., Liu, L., Zhu, F., Wan, D., Yuan, Z., Li, B., and Shao, L. Controllable orthogonalization in training dnns. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6429-6438, 2020. +Johnson, A. E., Pollard, T. J., Greenbaum, N. R., Lun-gren, M. P., Deng, C.-y., Peng, Y., Lu, Z., Mark, R. G., Berkowitz, S. J., and Horng, S. Mimic-cxr-jpg, a large publicly available database of labeled chest radiographs. arXiv preprint arXiv:1901.07042, 2019. +Kaiser, P., Kern, C., and Rügamer, D. Uncertainty-aware predictive modeling for fair data-driven decisions. In Workshop on Trustworthy and Socially Responsible Machine Learning, NeurIPS 2022, 2022. +Komiyama, J., Takeda, A., Honda, J., and Shimao, H. Nonconvex optimization for regression with fairness constraints. In Dy, J. and Krause, A. (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 2737-2746. PMLR, 10-15 Jul 2018. +Kopper, P., Pölsterl, S., Wachinger, C., Bischl, B., Bender, A., and Rügamer, D. Semi-structured deep piecewise exponential models. In Survival Prediction-Algorithms, Challenges and Applications, pp. 40-53. PMLR, 2021. +Krishnan, A., Almadan, A., and Rattani, A. Understanding fairness of gender classification algorithms across gender-race groups. In 2020 19th IEEE International Conference on Machine Learning and Applications (ICMLA), pp. 1028-1035. IEEE, 2020. +Lapuschkin, S., Waldchen, S., Binder, A., Montavon, G., Samek, W., and Müller, K.-R. Unmasking clever hans predictors and assessing what machines really learn. Nature communications, 10(1):1096, 2019. +Lu, M., Zhao, Q., Zhang, J., Pohl, K. M., Fei-Fei, L., Niebles, J. C., and Adeli, E. Metadata normalization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10917-10927, 2021. +Maas, A. L., Daly, R. E., Pham, P. T., Huang, D., Ng, A. Y., and Potts, C. Learning word vectors for sentiment analysis. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pp. 142-150. Association for Computational Linguistics, 2011. +Mehrabi, N., Morstatter, F., Saxena, N., Lerman, K., and Galstyan, A. A survey on bias and fairness in machine learning. ACM computing surveys (CSUR), 54(6):1-35, 2021. + +Nelder, J. A. and Wedderburn, R. W. Generalized linear models. Journal of the Royal Statistical Society Series A: Statistics in Society, 135(3):370-384, 1972. +Palowitch, J. and Perozzi, B. Debiasing graph representations via metadata-orthogonal training. In 2020 IEEE/ACM International Conference on Advances in Social Networks Analysis and Mining (ASONAM), pp. 435–442, 2020. doi: 10.1109/ASONAM49781.2020.9381348. +Pérez-Suay, A., Laparra, V., Mateo-García, G., Muñoz-Mari, J., Gómez-Chova, L., and Camps-Valls, G. Fair kernel learning. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 339-355. Springer, 2017. +Pessach, D. and Shmueli, E. A review on fairness in machine learning. ACM Computing Surveys (CSUR), 55(3):1-44, 2022. +Platt, J. and Barr, A. Constrained differential optimization. In Neural Information Processing Systems, 1987. +Ray, P. P. Chatgpt: A comprehensive review on background, applications, key challenges, bias, ethics, limitations and future scope. _Internet of Things and Cyber-Physical Systems_, 2023. +Rügamer, D. A new PHO-rmula for improved performance of semi-structured networks. In Proceedings of the 40th International Conference on Machine Learning, volume 202 of Proceedings of Machine Learning Research, pp. 29291-29305. PMLR, 23-29 Jul 2023. +Rügamer, D., Kolb, C., and Klein, N. Semi-structured distributional regression. The American Statistician, pp. 1-12, 2023. +Sagawa, S., Koh, P. W., Hashimoto, T. B., and Liang, P. Distributionally robust neural networks for group shifts: On the importance of regularization for worst-case generalization. arXiv preprint arXiv:1911.08731, 2019. +Sattigeri, P., Ghosh, S., Padhi, I., Dognin, P., and Varshney, K. R. Fair infinitesimal jackknife: Mitigating the influence of biased training data points without refitting. Advances in Neural Information Processing Systems, 35: 35894-35906, 2022. +Scutari, M. fairml: A statistician's take on fair machine learning modelling. arXiv preprint arXiv:2305.02009, 2023. +Scutari, M., Panero, F., and Proissl, M. Achieving fairness with a simple ridge penalty. Statistics and Computing, 32 (5):77, 2022. + +Sellergren, A. B., Chen, C., Nabulsi, Z., Li, Y., Maschinot, A., Sarna, A., Huang, J., Lau, C., Kalidindi, S. R., Etemadi, M., et al. Simplified transfer learning for chest radiography models using less data. Radiology, 305(2): 454-465, 2022. +Shankar, S., Piratla, V., Chakrabarti, S., Chaudhuri, S., Jyothi, P., and Sarawagi, S. Generalizing across domains via cross-gradient training. arXiv preprint arXiv:1804.10745, 2018. +Vento, A., Zhao, Q., Paul, R., Pohl, K. M., and Adeli, E. A penalty approach for normalizing feature distributions to build confounder-free models. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pp. 387-397. Springer, 2022. +Weber, T., Ingrisch, M., Bischl, B., and Rügamer, D. Unreading race: Purging protected features from chest x-ray embeddings. arXiv preprint arXiv:2311.01349, 2023. +Wood, S. N. Generalized additive models: an introduction with R. CRC press, 2017. +Xu, Y., He, H., Shen, T., and Jaakkola, T. S. Controlling directions orthogonal to a classifier. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=DIjCrlsu6Z. +Zafar, M. B., Valera, I., Gomez-Rodriguez, M., and Gummadi, K. P. Fairness constraints: A flexible approach for fair classification. The Journal of Machine Learning Research, 20(1):2737-2778, 2019. +Zhang, Z., Song, Y., and Qi, H. Age progression/regression by conditional adversarial autoencoder. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR). IEEE, 2017. + +# A. Simplified Problem Statement + +To illustrate our problem, consider two vectors $x = (0,1)$ and $y = (1,0)$ , which are orthogonal as $x^{\top}y = 0$ . However, after transformation $h(x)$ and $h(y)$ are not orthogonal anymore for non-linear transformations $h$ as depicted in Figure 6. + +![](images/5828641c7d47d3dae94549f454546f4b4ff1f9a434e0bc89e2b3391ea754d9f3.jpg) +Figure 6. Graphical depiction of orthogonality without transformation (blue vectors) and after transformation with $h_{\mathrm{exp}}$ (red) or the sigmoid function $h_{\sigma}$ (green). + +# B. Connection to Fair Machine Learning + +When comparing the original orthogonalization approach in Lu et al. (2021); Rügamer et al. (2023) and Komiyama et al. (2018), both approaches use corrected features + +$$ +\boldsymbol {Z} ^ {c} = \mathcal {P} _ {\boldsymbol {X}} ^ {\perp} \boldsymbol {Z} \tag {7} +$$ + +in their model equation. The main difference is that fair machine learning approaches incorporate the protected features into the analysis as well, i.e., estimate the model + +$$ +\boldsymbol {y} = \boldsymbol {X} \boldsymbol {\beta} + \boldsymbol {Z} ^ {c} \boldsymbol {\gamma} ^ {c} + \varepsilon \tag {8} +$$ + +with residual term $\varepsilon$ , whereas the prediction model $\mathcal{M}^p$ in the orthogonalization approach does not necessarily include the features $X$ in the model. If $X$ is incorporated and without further constraints on the model, the approach of Komiyama et al. (2018) and the orthogonalization would lead to the same effect estimates (e.g., when using orthogonalization for identifiability as in Rügamer, 2023). Fair machine learning, however, offers a trade-off between model performance and (un-)fairness by regularizing the effects $\beta$ of $X$ in (8) using an explained variance formulation: + +$$ +\min _ {\boldsymbol {\beta}, \boldsymbol {\gamma} ^ {c}} \mathbb {E} \left[ \left(\boldsymbol {y} - \hat {\boldsymbol {y}}\right) ^ {2} \right] \quad s. t. \frac {\operatorname {V a r} (\boldsymbol {X} \boldsymbol {\beta})}{\operatorname {V a r} (\hat {\boldsymbol {y}})} \leq r \tag {9} +$$ + +with predictions $\hat{\pmb{y}} = \pmb{X}\hat{\pmb{\beta}} +\pmb{Z}^{c}\hat{\gamma}^{c}$ and some constraint $r\in [0,1]$ . This approach and reformulations, such as the one of Scutari et al. (2022) as a ridge-penalized optimization problem, hence do not provide the full unpenalized effects $\beta$ as obtained by the orthogonalization. + +Apart from the difference between the two approaches induced by the regularization, the generalization of fair machine learning approaches to models with activation functions differs further. In particular, as, e.g., suggested by Scutari et al. (2022) the orthogonal predictors $Z^c$ are only used on the pre-activation scale, i.e., the fair model uses $Z^c$ in the GLM by incorporating it only once in the additive predictor: $\mathbb{E}(\boldsymbol{y}|\boldsymbol{X},\boldsymbol{Z}) = h(\boldsymbol{X}\boldsymbol{\beta} + \boldsymbol{Z}^c\boldsymbol{\gamma}^c)$ . As discussed in the main part of our paper and in the previous section, this does not imply orthogonality of $h(\boldsymbol{X}\boldsymbol{\beta})$ and $h(\boldsymbol{Z}\boldsymbol{\gamma})$ as required in our work. + +A slightly different approach is used by Xu et al. (2022) who correct a classifier trained with all variables by another classifier trained only on the protected variables. Their approach, however, does not debias representations but only finds directions for predictions that are orthogonal. + +# C. Other Notions of Orthogonality + +In the following, we briefly describe connections to other notions of orthogonality that are used in different fields of machine learning research. + +# C.1. Domain Generalization + +The objective of the domain generalization (DG) problem is to train models to be robust against (or orthogonal to) domain (or covariate) shifts (Ganin et al., 2016; Shankar et al., 2018). While our orthogonalization approach and DG have different goals, viewing orthogonalization through the lens of DG is an interesting idea brought up by an anonymous reviewer. In particular, distributionally robust optimization (DRO; Sagawa et al., 2019) aims to ensure that predictive accuracy is robust w.r.t. changes in the distribution of the sensitive features. Our orthogonalization approach, in contrast, aims to ensure that the sensitive features do not affect the predictions (in the sense of a zero coefficient in the evaluation model). Note, however, that DRO does not provide any guarantees regarding our goal. + +# C.2. Orthogonality of Predictions and Embeddings + +Another interesting question brought up by an anonymous reviewer is how our notion of orthogonality relates to the following two concepts: + +- Concept 1: requiring that the predictions do not change when the sensitive attributes are changed; +- Concept 2: requiring that the embeddings are free from the influence of sensitive information. + +Concept 2 is a special case of our proposed notion if the model is linear. Concept 1 can also coincide with our definition if sensitive attributes are part of the prediction model. In our setting, however, this is not necessarily the case. Other (fairness) approaches aligning with concept 1 assume knowledge of the causal relationship between sensitive and non-sensitive attributes, which we also do not require. + +# D. Background on GLMs + +We briefly introduce several quantities used in the estimation of GLMs, but refer to Wood (2017) for more detailed explanations and derivations. Let $g = h^{-1}$ be the link function. The weights $\Upsilon$ are defined as + +$$ +\Upsilon = \operatorname {d i a g} \left(\alpha \left(\mu_ {i}\right) / \left\{g ^ {\prime} \left(\mu_ {i}\right) ^ {2} V \left(\mu_ {i}\right) \right\}\right) \tag {10} +$$ + +where $\mu_{i} = h(\pmb{x}_{i}^{\top}\pmb {\beta})$ and + +$$ +\alpha \left(\mu_ {i}\right) = 1 + \left(y _ {i} - \mu_ {i}\right) \left\{V ^ {\prime} \left(\mu_ {i}\right) / V \left(\mu_ {i}\right) + g ^ {\prime \prime} \left(\mu_ {i}\right) / g ^ {\prime} \left(\mu_ {i}\right) \right\} \tag {11} +$$ + +and + +$$ +V \left(\mu_ {i}\right) = \operatorname {V a r} (y) / \phi \tag {12} +$$ + +with $\phi$ denoting the distribution's scale parameter. The working response $\pmb{r}$ is defined as + +$$ +\boldsymbol {r} = \boldsymbol {G} (\boldsymbol {y} - \boldsymbol {\mu}) \tag {13} +$$ + +where $\pmb {\mu} = (\mu_1,\dots ,\mu_n)^\top$ and + +$$ +\boldsymbol {G} = \operatorname {d i a g} \left(g ^ {\prime} \left(\mu_ {i}\right) / \alpha \left(\mu_ {i}\right)\right). \tag {14} +$$ + +In particular, note that in the case of using Fisher weights, i.e., the expected Hessian matrix, $\alpha (\mu_i) = 1$ and we have the following simplification: + +$$ +\boldsymbol {G} ^ {- 1} \boldsymbol {\Upsilon} ^ {- 1 / 2} = \operatorname {d i a g} \left(V \left(\mu_ {i}\right) ^ {1 / 2}\right), \tag {15} +$$ + +i.e., a function of $\mu_{i}$ only. We can use this result in later derivations. + +# D.1. GLM in Detail + +The above derivation for GLMs can be made more explicit for our purposes. As noted before, using the Fisher weights implies $\alpha (\mu_i) = 1$ . As $\mu_{i} = h(x_{i}^{\top}\beta)\equiv h(0)$ in case of a successful correction, this implies + +$$ +\boldsymbol {G} = \operatorname {d i a g} \left(g ^ {\prime} \left(\mu_ {i}\right)\right) = \left(h ^ {- 1}\right) ^ {\prime} (0) \cdot \boldsymbol {I}. \tag {16} +$$ + +In other words, multiplying with $G$ only scales all observations by a constant. Similarly, (15) reduces to a constant multiplicative factor of $V(h(0)^{1/2})$ . + +# E. Proofs and Derivations + +# E.1. Proof of Lemma 3 + +To prove Lemma 3, we use the final iterate representation of weights $\hat{\beta}^c$ in a GLM and note that the evaluation model (first without intercept) must yield + +$$ +\hat {\boldsymbol {\beta}} ^ {c} = \left(\boldsymbol {X} ^ {\top} \boldsymbol {\Upsilon} \boldsymbol {X}\right) ^ {- 1} \boldsymbol {X} ^ {\top} \boldsymbol {\Upsilon} \boldsymbol {r} = \left(\boldsymbol {X} ^ {\top} \boldsymbol {\Upsilon} \boldsymbol {X}\right) ^ {- 1} \boldsymbol {X} ^ {\top} \boldsymbol {\Upsilon} \boldsymbol {G} \left(\hat {\boldsymbol {y}} ^ {c} - \boldsymbol {\mu}\right) \stackrel {!} {=} \mathbf {0}. \tag {17} +$$ + +Consequently, it must also hold $\pmb{\mu} = h(\pmb{X}\hat{\beta}^c) = h(\pmb{0})$ . The equality in (17) yields two possible solutions: either $\hat{\pmb{y}}^c = \pmb{\mu}$ , which is undesirable as it implies that we cannot predict anything after removing the influence of $\pmb{X}$ , or we can construct $\hat{\pmb{y}}^c$ so that when first subtracting $\pmb{\mu}$ and then projecting it onto the space spanned by the columns of $\widetilde{\pmb{X}} = \pmb{\Upsilon}^{1/2}\pmb{X}$ , we obtain the zero vector (see details below). Solving for $\hat{\pmb{y}}^c$ , we get the following result. + +Lemma 8. Consider a prediction model $\mathcal{M}^p$ with activation function $h$ using data $\mathbf{Z}$ to produce predictions $\hat{\mathbf{y}}$ . Given weights $\Upsilon$ and protected features $\mathbf{X}$ , corrected predictions satisfying $\hat{\beta}^c = \mathbf{0}$ are given by + +$$ +\hat {\boldsymbol {y}} ^ {c} = \boldsymbol {G} ^ {- 1} \boldsymbol {\Upsilon} ^ {- 1 / 2} \mathcal {P} _ {\tilde {\boldsymbol {X}}} ^ {\perp} \hat {\boldsymbol {y}} + h (\boldsymbol {0}). \tag {18} +$$ + +We can easily confirm that this yields a desired solution by plugging in (18) into (17). Further note that $\pmb{\mu} = h(0)\cdot \mathbf{1}_n$ , i.e., shifts by a constant $c_{2}\coloneqq h(0)$ and the multiplication from the left with $G^{-1}\Upsilon^{-1 / 2}$ does only scale by a constant factor $c_{1}\coloneqq V(h(0))^{1 / 2}$ (see Section D.1) but not rotate $\mathcal{P}_{\overline{\mathbf{X}}}^{\perp}\hat{\mathbf{y}}$ , i.e., + +$$ +\hat {\boldsymbol {y}} ^ {c} = \boldsymbol {G} ^ {- 1} \boldsymbol {\Upsilon} ^ {- 1 / 2} \mathcal {P} _ {\tilde {\boldsymbol {X}}} ^ {\perp} \hat {\boldsymbol {y}} + \boldsymbol {\mu} \stackrel {(1 5)} {=} V (h (0)) ^ {1 / 2} \mathcal {P} _ {\tilde {\boldsymbol {X}}} ^ {\perp} \hat {\boldsymbol {y}} + h (\boldsymbol {0}) = c _ {1} \mathcal {P} _ {\tilde {\boldsymbol {X}}} ^ {\perp} \hat {\boldsymbol {y}} + c _ {2} \mathbf {1} _ {n} \tag {19} +$$ + +with constants $c_{1}, c_{2}$ . Any multiplicative constant does not change the result. We can therefore further simplify the previous expression from (18) to + +$$ +\hat {\mathbf {y}} ^ {c} = \mathcal {P} _ {\boldsymbol {X}} ^ {\perp} \hat {\mathbf {y}} + c _ {2} \mathbf {1} _ {n}. \tag {20} +$$ + +This is due to the fact that $\mathcal{P}_{\widetilde{\boldsymbol{X}}}^{\perp}$ is the projection matrix of $\widetilde{\boldsymbol{X}} = \boldsymbol{\Upsilon}^{1/2}\boldsymbol{X}$ with $\boldsymbol{\Upsilon}^{1/2}$ being $\boldsymbol{\Upsilon}^{1/2} = \mathrm{diag}(1/(g'(\mu_i)\sqrt{V(\mu_i)})) \equiv c_3 \cdot \boldsymbol{I}$ for some constant $c_3$ as $\boldsymbol{\mu} = h(\boldsymbol{0}) = \mathrm{const.} \cdot \mathbf{1}_n$ , and hence both $g'(\mu_i)$ and $V(\mu_i)$ are constant. As a consequence, we have $\mathcal{P}_{\widetilde{\boldsymbol{X}}} = c_3\boldsymbol{X}(c_3^2\boldsymbol{X}^\top\boldsymbol{X})^{-1}\boldsymbol{X}c_3 = \mathcal{P}_{\boldsymbol{X}}$ . For a similar reason, we can ignore $c_1$ as $(\boldsymbol{X}^\top\boldsymbol{X})^{-1}\boldsymbol{X}^\top c_1\mathcal{P}_{\boldsymbol{X}}^{\perp}\hat{\boldsymbol{y}} = c_1(\boldsymbol{X}^\top\boldsymbol{X})^{-1}\bar{\boldsymbol{X}}^\top\mathcal{P}_{\boldsymbol{X}}^{\perp}\hat{\boldsymbol{y}} = \mathbf{0}$ . + +Model with Intercept Similar results can be derived for a model with intercept. First, note that $\pmb{\mu} = h(\beta_0\mathbf{1}_n)$ . Hence, $c_{1}$ and $c_{2}$ are fixed constants $c_{2} = h(\beta_{0})$ and $c_{1} = V(h(\beta_{0}))^{1 / 2}$ . Hence, this yields again (20), now just with different constants $c_{1}$ and $c_{2}$ . In an intercept-only GLM with canonical link function, the intercept can be computed using only the response values, allowing to derive the closed-form solution $\hat{\beta}_{0} = h^{-1}(\hat{y})$ with $\bar{y} = n^{-1}\sum_{i}\hat{y}_{i}$ . As the intercept in the evaluation model is of no particular interest, one can alternatively center the predictions $\hat{\pmb{y}}$ and subsequently drop the constant $c_{2}$ . We will assume centered predictions in the following and use the correction $\hat{\pmb{y}}^c = \mathcal{P}_{\pmb{X}}^{\perp}\hat{\pmb{y}}$ . + +# E.2. Details and Derivation of Corollary 4 + +In the following, we describe how to derive the constrained optimization problem and subsequently our preferred way of solving it. + +Deriving the constrained optimization problem To see that we can write problem + +$$ +\hat {\gamma} ^ {c} = \underset {\gamma^ {c}} {\arg \min } \ell (\boldsymbol {y}, h (\boldsymbol {Z} \boldsymbol {\gamma} ^ {c})) \text {s . t .} \hat {\beta} ^ {c} = \mathbf {0} \tag {21} +$$ + +with + +$$ +\hat {\boldsymbol {\beta}} ^ {c} = \underset {\boldsymbol {\beta} ^ {c}} {\arg \min } \ell (\hat {\boldsymbol {y}} ^ {c} = h (\boldsymbol {Z} \hat {\gamma} ^ {c}), h (\boldsymbol {X} \boldsymbol {\beta} ^ {c})) \tag {22} +$$ + +as + +$$ +\hat {\gamma} ^ {c} = \underset {\gamma^ {c}} {\arg \min } \ell (\boldsymbol {y}, h (\boldsymbol {Z} \boldsymbol {\gamma} ^ {c})) \tag {23} +$$ + +$$ +s. t. \left| \left| \left(\boldsymbol {X} - n ^ {- 1} \mathbf {1} _ {n} \mathbf {1} _ {n} ^ {\top} \boldsymbol {X}\right) ^ {\top} h (\boldsymbol {Z} \gamma^ {c}) \right| \right| _ {2} ^ {2} = 0, +$$ + +note that the statement in Lemma 3 can be simplified by recognizing that (17) will also hold true if $\pmb{X}^{\top}(\hat{\pmb{y}}^{c} - \pmb{\mu}) = \pmb{X}^{\top}(\hat{\pmb{y}}^{c} - c_{2}\mathbf{1}_{n}) = \mathbf{0}$ . The second term $\pmb{X}^{\top}c_{2}\mathbf{1}_{n}$ is always equal to zero if we center $\pmb{X}$ , i.e., use $(\pmb{X} - n^{-1}\mathbf{1}_{n}\mathbf{1}_{n}^{\top}\pmb{X})$ . Hence, if $(\pmb{X} - n^{-1}\mathbf{1}_{n}\mathbf{1}_{n}^{\top}\pmb{X})^{\top}\hat{\pmb{y}}^{c} = \mathbf{0}$ is fulfilled, (17) will also hold true. Now, instead of using $(\pmb{X} - n^{-1}\mathbf{1}_{n}\mathbf{1}_{n}^{\top}\pmb{X})^{\top}h(\pmb{Z}\gamma^{c}) = \mathbf{0}$ as a constraint, introducing $p$ auxiliary variables when using the Lagrangian multiplier method (see details below), we can instead also use the constraint $||(\pmb{X} - n^{-1}\mathbf{1}_{n}\mathbf{1}_{n}^{\top}\pmb{X})^{\top}h(\pmb{Z}\gamma^{c})||_{2}^{2} = 0$ , which implies the former, but only requires one Lagrangian multiplier variable. + +Modified differential multiplier method (MDMM) Following Platt & Barr (1987), we first reformulate the constrained optimization problem (23) using Lagrangian multipliers, yielding + +$$ +\underset {\gamma , \lambda} {\arg \min } \ell (\boldsymbol {y}, h (\boldsymbol {Z} \boldsymbol {\gamma})) + \lambda \underbrace {\left\| \left(\boldsymbol {X} - n ^ {- 1} \mathbf {1} _ {n} \mathbf {1} _ {n} ^ {\top} \boldsymbol {X}\right) ^ {\top} h (\boldsymbol {Z} \boldsymbol {\gamma}) \right\| _ {2} ^ {2}} =: \underset {\gamma , \lambda} {\arg \min } \mathcal {E} (\boldsymbol {\gamma}, \lambda). \tag {24} +$$ + +In order to optimize (24), we can use the basic differential multiplier method (BDMM) by performing gradient descent to optimize $\mathcal{E}$ w.r.t. $\gamma$ but gradient ascent for the auxiliary term $\lambda \mathcal{A}$ w.r.t. $\lambda$ , i.e., updating the parameters in each iteration $t \in \mathbb{N}$ as + +$$ +\boldsymbol {\gamma} ^ {[ t ]} = \boldsymbol {\gamma} ^ {[ t - 1 ]} - \nu^ {[ t ]} \nabla_ {\boldsymbol {\gamma}} \mathcal {E} (\boldsymbol {\gamma} ^ {[ t - 1 ]}; \lambda^ {[ t - 1 ]}), \tag {25} +$$ + +$$ +\lambda^ {[ t ]} = \lambda^ {[ t - 1 ]} + \nu^ {[ t ]} \mathcal {A} (\lambda^ {[ t - 1 ]}; \boldsymbol {\gamma} ^ {[ t - 1 ]}), +$$ + +with learning rate $\nu^{[t]}$ . The modified version MDMM of the BDMM suggested by Platt & Barr (1987) combines the Lagrangian method with the penalty method augmenting the overall objective by a penalty term + +$$ +\mathcal {E} _ {P} (\boldsymbol {\gamma}, \lambda) := \mathcal {E} (\boldsymbol {\gamma}, \lambda) + \frac {\zeta}{2} \mathcal {A} (\boldsymbol {\gamma}) ^ {2} \tag {26} +$$ + +with damping factor $\zeta$ (that defaults to 1), and thus adds another term $\zeta A(\gamma)$ to the gradient descent direction in (25). + +# E.3. Proof of Theorem 5 + +Consider the ReLU activation function defined as $h(x) = x \cdot \mathbb{1}(x \geq 0)$ . Using the fact that the MSE-optimal $\hat{\beta}^c$ is found by + +$$ +\hat {\boldsymbol {\beta}} ^ {c} = \underset {\boldsymbol {\beta} ^ {c}} {\arg \min } \frac {1}{n} | | h (\boldsymbol {Z} \boldsymbol {\gamma}) - h (\boldsymbol {X} \boldsymbol {\beta} ^ {c}) | | _ {2} ^ {2}, \tag {27} +$$ + +we can first expand the objective which is minimized in (27) to + +$$ +\frac {1}{n} \left(h (\boldsymbol {Z} \boldsymbol {\gamma}) ^ {\top} h (\boldsymbol {Z} \boldsymbol {\gamma}) - 2 h (\boldsymbol {Z} \boldsymbol {\gamma}) ^ {\top} h \left(\boldsymbol {X} \boldsymbol {\beta} ^ {c}\right) + h \left(\boldsymbol {X} \boldsymbol {\beta} ^ {c}\right) ^ {\top} h \left(\boldsymbol {X} \boldsymbol {\beta} ^ {c}\right)\right). \tag {28} +$$ + +The first dot product in (28) is constant w.r.t. $\beta^c$ and the last dot product only determines the scaling of $\hat{\beta}^c$ , hence we focus on the mixed term. If, after feature correction $Z^{c} = \mathcal{P}_{X}^{\perp}Z$ , the mixed term + +$$ +h \left(\boldsymbol {Z} ^ {c} \boldsymbol {\gamma}\right) ^ {\top} h \left(\boldsymbol {X} \boldsymbol {\beta} ^ {c}\right) = 0, \tag {29} +$$ + +the optimal $\hat{\beta}^c$ in (27) will also be zero. + +We can exploit properties of the ReLU function to show that this is indeed the case, using the fact that for any $\mathbf{a}, \mathbf{b} \in \mathbb{R}^n$ it holds + +$$ +\begin{array}{l} \boldsymbol {a} ^ {\top} \boldsymbol {b} = \sum_ {i} a _ {i} b _ {i} = \sum_ {i} [ h (a _ {i}) h (b _ {i}) + h (- a _ {i}) h (b _ {i}) + h (a _ {i}) h (- b _ {i}) + h (- a _ {i}) h (- b _ {i}) ] \\ = \sum_ {i} h \left(a _ {i}\right) h \left(b _ {i}\right) + \sum_ {i} h \left(- a _ {i}\right) h \left(b _ {i}\right) + \sum_ {i} h \left(a _ {i}\right) h \left(- b _ {i}\right) + \sum_ {i} h \left(- a _ {i}\right) h \left(- b _ {i}\right) \tag {30} \\ = h (\pmb {a}) ^ {\top} h (\pmb {b}) + h (- \pmb {a}) ^ {\top} h (\pmb {b}) + h (\pmb {a}) ^ {\top} h (- \pmb {b}) + h (- \pmb {a}) ^ {\top} h (- \pmb {b}), \\ \end{array} +$$ + +which allows us to rewrite the left-hand side of (29) as + +$$ +\begin{array}{l} h (\boldsymbol {Z} ^ {c} \boldsymbol {\gamma}) ^ {\top} h (\boldsymbol {X} \boldsymbol {\beta} ^ {c}) = (\boldsymbol {Z} ^ {c} \boldsymbol {\gamma}) ^ {\top} (\boldsymbol {X} \boldsymbol {\beta} ^ {c}) - h (- \boldsymbol {Z} ^ {c} \boldsymbol {\gamma}) ^ {\top} h (\boldsymbol {X} \boldsymbol {\beta} ^ {c}) - h (\boldsymbol {Z} ^ {c} \boldsymbol {\gamma}) ^ {\top} h (- \boldsymbol {X} \boldsymbol {\beta} ^ {c}) - h (- \boldsymbol {Z} ^ {c} \boldsymbol {\gamma}) ^ {\top} h (- \boldsymbol {X} \boldsymbol {\beta} ^ {c}) \\ \Longleftrightarrow h \left(\boldsymbol {Z} ^ {c} \boldsymbol {\gamma}\right) ^ {\top} h (\boldsymbol {X} \boldsymbol {\beta} ^ {c}) = \underbrace {\boldsymbol {\gamma} ^ {\top} \boldsymbol {Z} ^ {\top} \mathcal {P} _ {\boldsymbol {X}} ^ {\perp} \boldsymbol {X} \boldsymbol {\beta} ^ {c}} _ {= 0} - h (- \boldsymbol {Z} ^ {c} \boldsymbol {\gamma}) ^ {\top} h (\boldsymbol {X} \boldsymbol {\beta} ^ {c}) - h \left(\boldsymbol {Z} ^ {c} \boldsymbol {\gamma}\right) ^ {\top} h (- \boldsymbol {X} \boldsymbol {\beta} ^ {c}) - h (- \boldsymbol {Z} ^ {c} \boldsymbol {\gamma}) ^ {\top} h (- \boldsymbol {X} \boldsymbol {\beta} ^ {c}) \\ \Longleftrightarrow h \left(\boldsymbol {Z} ^ {c} \boldsymbol {\gamma}\right) ^ {\top} h (\boldsymbol {X} \boldsymbol {\beta} ^ {c}) = - h \left(- \boldsymbol {Z} ^ {c} \boldsymbol {\gamma}\right) ^ {\top} h \left(\boldsymbol {X} \boldsymbol {\beta} ^ {c}\right) - h \left(\boldsymbol {Z} ^ {c} \boldsymbol {\gamma}\right) ^ {\top} h \left(- \boldsymbol {X} \boldsymbol {\beta} ^ {c}\right) - h \left(- \boldsymbol {Z} ^ {c} \boldsymbol {\gamma}\right) ^ {\top} h \left(- \boldsymbol {X} \boldsymbol {\beta} ^ {c}\right) \\ \Longleftrightarrow h \left(\boldsymbol {Z} ^ {c} \boldsymbol {\gamma}\right) ^ {\top} h \left(\boldsymbol {X} \boldsymbol {\beta} ^ {c}\right) + h \left(- \boldsymbol {Z} ^ {c} \boldsymbol {\gamma}\right) ^ {\top} h \left(\boldsymbol {X} \boldsymbol {\beta} ^ {c}\right) + h \left(\boldsymbol {Z} ^ {c} \boldsymbol {\gamma}\right) ^ {\top} h \left(- \boldsymbol {X} \boldsymbol {\beta} ^ {c}\right) + h \left(- \boldsymbol {Z} ^ {c} \boldsymbol {\gamma}\right) ^ {\top} h \left(- \boldsymbol {X} \boldsymbol {\beta} ^ {c}\right) = 0. \tag {31} \\ \end{array} +$$ + +Since $h(\cdot) \geq 0$ for all inputs, the left side of the equation consists of a sum of products of non-negative terms, implying that all product terms must be equal to zero. + +# E.4. Proof of Corollary 6 + +Using the $\mathrm{vec}(\cdot)$ operation, we can first reformulate the evaluation model with uncorrected predictions $\mathrm{vec}(\hat{\mathfrak{V}}) \in \mathbb{R}^{n\cdot d}$ , $d = \prod_{r=1}^{R} d_r$ , as + +$$ +\operatorname {v e c} (\mathfrak {Y}) = \operatorname {v e c} \left(\boldsymbol {X} \times_ {1} \mathfrak {B} ^ {c}\right) = \operatorname {v e c} \left(\boldsymbol {X} \underbrace {\operatorname {m a t} \left(\mathfrak {B} ^ {c}\right)} _ {p \times d}\right) = \left(\boldsymbol {I} _ {d} \otimes \boldsymbol {X}\right) \operatorname {v e c} \left(\mathfrak {B} ^ {c}\right). \tag {32} +$$ + +The orthogonal projection matrix of $(\mathbf{I}_d\otimes \mathbf{X})$ is given by $(\mathbf{I}_d\otimes \mathcal{P}_{\mathbf{X}}^{\perp})$ . Premultiplying $\operatorname {vec}(\tilde{\mathfrak{V}})$ by this term yields + +$$ +\left(\boldsymbol {I} _ {d} \otimes \mathcal {P} _ {\boldsymbol {X}} ^ {\perp}\right) \operatorname {v e c} (\hat {\mathfrak {Y}}) = \operatorname {v e c} \left(\mathcal {P} _ {\boldsymbol {X}} ^ {\perp} \underbrace {\operatorname {m a t} (\hat {\mathfrak {Y}})} _ {n \times d}\right) = \operatorname {v e c} \left(\underbrace {\mathcal {P} _ {\boldsymbol {X}} ^ {\perp} \times_ {1} \hat {\mathfrak {Y}}}\right). \tag {33} +$$ + +The solution $\mathfrak{B}^c$ to the evaluation model using corrected predictions $\hat{\mathfrak{V}}^c$ can then be found by minimizing + +$$ +\left| \left| \operatorname {v e c} \left(\widehat {\mathfrak {Y}} ^ {c}\right) - \operatorname {v e c} \left(\boldsymbol {X} \times_ {1} \mathfrak {B} ^ {c}\right) \right| \right| _ {2} ^ {2}, \tag {34} +$$ + +over $\mathfrak{B}^c$ . The closed-form solution is given by + +$$ +\operatorname {v e c} \left(\hat {\mathfrak {B}} ^ {c}\right) = \left(\left(\boldsymbol {I} _ {d} \otimes \boldsymbol {X}\right) ^ {\top} \left(\boldsymbol {I} _ {d} \otimes \boldsymbol {X}\right)\right) ^ {- 1} \left(\boldsymbol {I} _ {d} \otimes \boldsymbol {X}\right) ^ {\top} \operatorname {v e c} \left(\hat {\mathfrak {Y}} ^ {c}\right) = \left(\left(\boldsymbol {I} _ {d} \otimes \boldsymbol {X}\right) ^ {\top} \left(\boldsymbol {I} _ {d} \otimes \boldsymbol {X}\right)\right) ^ {- 1} \underbrace {\left(\boldsymbol {I} _ {d} \otimes \boldsymbol {X}\right) ^ {\top} \left(\boldsymbol {I} _ {d} \otimes \mathcal {P} _ {\boldsymbol {X}} ^ {\perp}\right)} _ {= 0} \operatorname {v e c} (\hat {\mathfrak {Y}}), \tag {35} +$$ + +proving that $\tilde{\mathfrak{B}}^c\equiv \mathbf{0}$ + +# E.5. Proof of Corollary 7 + +Similar to the proof of Theorem 5, we start with the solution of the evaluation model given by + +$$ +\hat {\mathfrak {B}} ^ {c} = \underset {\mathfrak {B} ^ {c}} {\arg \min } \frac {1}{n} \left\| h \left(\operatorname {v e c} \left(\bar {\mathcal {Y}} ^ {c}\right)\right) - h \left(\operatorname {v e c} \left(\boldsymbol {X} \times_ {1} \mathfrak {B} ^ {c}\right)\right) \right\| _ {2} ^ {2}, \tag {36} +$$ + +where $h(x) = x \cdot \mathbb{1}(x \geq 0)$ denotes the ReLU function, and focus on the mixed term $h(\operatorname{vec}(\bar{\mathfrak{V}}^c))^\top h(\operatorname{vec}(\boldsymbol{X} \times_1 \mathfrak{B}^c))$ when expanding the argument. Noting that this is again a dot product of vectors, we can use the same argument as before in (30) for the proof of Theorem 5. In particular, the non-activated mixed term including the correction evaluates to + +$$ +\operatorname {v e c} \left(\mathcal {P} _ {\boldsymbol {X}} ^ {\perp} \times_ {1} \bar {\mathfrak {Y}}\right) ^ {\top} \operatorname {v e c} (\boldsymbol {X} \times_ {1} \mathfrak {B} ^ {c}) = \left(\operatorname {v e c} \bar {\mathfrak {Y}}\right) ^ {\top} \underbrace {\left(\boldsymbol {I} _ {d} \otimes \mathcal {P} _ {\boldsymbol {X}} ^ {\perp}\right) \left(\boldsymbol {I} _ {d} \otimes \boldsymbol {X}\right)} _ {\mathbf {0}} \operatorname {v e c} \left(\mathfrak {B} ^ {c}\right) = 0, \tag {37} +$$ + +and all other terms are again activated using the ReLU activation (and hence must be non-negative, but since their sum must be zero, all terms must be zero). + +# F. Numerical Experiment Details + +The code for reproducing results can be found on the first author's Github repository. + +Table 5. Overview of all datasets used. The reference category refers to the category used as a reference in the $\mathcal{M}^e$ when encoding categorical variables. + +
ntrainntestpqreference category
Adult30162-545female, White
Bank40195-149-
Compas5855-613female, African-American
Health Retirement38653-425female, married, Black
MNISTred118721989128 × 28red
MIMIC18134230414111female, Asian
UTKfaces1651441295256Asian
Movie Reviews3416785382100 × 100female, female (main actor, movie director)
+ +# F.1. Adult Income Prediction + +For $\mathcal{M}^p$ we use the features age, employment status, education, marital status, relationship, and hours per week. Protected features are given in Table 5. All models are GLMs with canonical link function and binomial distribution, i.e., $\ell$ is the binary cross-entropy loss and $h()$ the sigmoid function. + +# F.2. Fairness Benchmark + +For all methods, we set the unfairness amount to 0.05 (as 0 would result in an infinite penalty). + +# F.3. Chest X-ray Embeddings + +We utilize the publicly available embeddings $^2$ of the CXR foundation model proposed by (Sellergren et al., 2022). The train and test partition is based on the recommended splits of the original MIMIC-CXR database. + +Before using the embedding in a classifier, we apply singular value decomposition (SVD) to reduce the risk of overfitting in the 1376-dimensional embedding. We find that $q = 111$ dimensions are the best trade-off between explained variance (98%) and sparsity. The prediction model uses only these $q$ features while the correction function and evaluation model are defined by age, sex, and race. + +# F.4. Face Recognition + +The embedding of the UTKFace dataset consists of the activations in the penultimate layer in a ResNet-50. Similar to the Chest X-ray application, we first reduce the 2048-dimensional embedding to $q = 32$ features using an SVD. These $q$ features explain $95\%$ of the embedding's variance. The train and test split is based on a random 80/20 partitioning. We use these embedding features in the prediction model while using age and race for the correction function and evaluation model. + +# F.5. Movie Reviews + +We first extract the first actor's sex and the director's sex from the provided metadata. We then tokenize the movie descriptions using 1000 words and an embedding size of 100 with a maximum length of 100 words for each description. Padding is done at the end of sentences with less than 100 words. We further remove stop words and punctuations from sentences and transform all texts to lowercase. We use the vote count as a Poisson-distributed outcome and partition the data into $80 / 20\%$ for training and testing. + +The LSTM model is defined by an embedding layer with embedding size 100, an LSTM layer with 50 units and ReLU activation, a dropout layer with 0.1 dropout rate, a dense layer with 25 units and ReLU activation, a dropout layer with 0.2 dropout rate, a dense layer with 5 units and ReLU activation, a dropout layer with 0.3 dropout rate, and a final dense layer with 1 unit and exponential activation. The network is trained for a maximum of 1000 epochs with early stopping using Adam with a learning rate of 1e-6, a batch size of 128, and Poisson loss. + +For the orthogonalization, we use the same architecture but insert an orthogonalization operation between the embedding layer and the LSTM layer. As features $Z$ we use only the movie descriptions, whereas the protected features $X$ consist of the gender of the protagonist and director. + +# F.6. Online Orthogonalization + +We subsample the MNIST dataset to observations with labels 0 or 9. Based on the coloring described in the main part of the paper, we train a CNN defined by a Conv2D layer with 8 filters, kernel size of $3 \times 3$ , and ReLU activation, followed by the orthogonalization operation for the network that uses a correction. The output (with or without correction) is then fed into another Conv2D layer with 16 filters, kernel size of $3 \times 3$ , and ReLU activation, followed by Max pooling of size $2 \times 2$ and a flattening operation. Finally, the classification head comprises a dense layer with 64 units and ReLU activation followed by the output layer with one unit and sigmoid activation. + +The prediction model only uses the images and, if corrected, also the color information to perform the orthogonal projection for training. The networks are trained for 100 epochs with early stopping and a batch size of 128. Early stopping is based on a $20\%$ validation split and a patience of 25. The evaluation model is optimized using quadratic programming and only uses the color red information. + +# F.7. Runtimes + +Table 6 compares the runtimes of different methods on the fairness benchmark dataset. + +
Table 6. Runtimes on the fairness benchmark dataset (in seconds).
Methodadultbankcompashealth. retirement
Komiyama13.622.370.651.00
Komiyama25.662.681.1914.17
Berk1.132.591.183.52
Zafar15.020.5612.02-
Ours1.1113.200.483.84
+ +For the colorized MNIST dataset, the average fitting time until early stopping (with standard deviation in brackets) of both networks was 1.08 (0.528) minutes with orthogonalization and 0.40 (0.006) minutes without orthogonalization. We can see that the orthogonalization takes on average longer to "converge". This can mainly be attributed to the fact that it runs for more iterations and not the additional operations required to perform the orthogonalization. + +# G. Additional Results + +# G.1. Synthetic Data + +First, we simulate data from a Bernoulli and Poisson distribution to check whether our approach provides the proposed protection for features $\mathbf{X}$ using a canonical activation function $h$ and either $\mathcal{C}^l$ or $\mathcal{C}^h$ . We generate features $\mathbf{X}$ from a standard normal distribution and generate features $\mathbf{Z}$ correlated to $\mathbf{X}$ using the transformation $\mathbf{X} = \rho \mathbf{Z}_{[\cdot,1:q]} + \mathbf{E}$ , where $\rho \in \{0,1,2\}$ and $\mathbf{E}$ are realizations of a standard normal distribution with $\dim(\mathbf{E}) = \dim(\mathbf{Z})$ . We examine different settings for $p \in \{5,10\}$ , $q \in \{10,100\}$ , and $n \in \{200,1000,5000,10000\}$ , and repeat every setting 10 times with different random seed. + +Results Figure 7 shows the results of the simulation for the classification task and $\rho = 2$ (the count response task in the Appendix is qualitatively the same) with and without correction for the model's pre-activation (corrected with $\mathcal{C}^l$ ) and post-activation values (corrected with $\mathcal{C}^h$ ). Results confirm that not only are coefficients estimated to be close to zero after correction, but their p-value is also close to 1 in most cases, suggesting no significant influence of protected features in the predicted value $\hat{\pmb{y}}^c$ . In contrast, without correction, coefficients tend to be non-zero and "highly significant" (with a very small p-value). + +Similar results are obtained when using $\rho = 0$ or $\rho = 1$ for a logistic regression model (cf. Figure 8 and 9, respectively) and also for $\rho \in \{0,1,2\}$ for a count regression (Figures 10-12). + +![](images/d639d5ad83f35d0ca3bcb7584dd8ea0e2adb7ddaf58b075cc30dcaa1e60ade74.jpg) +Figure 7. Distribution of estimated coefficients (top row) and corresponding p-values (bottom row) for different data sizes $n$ and features $q$ (columns) for the binary classification task (Bernoulli distribution). Boxplots summarize all different values of $p$ and the 10 simulation repetitions. + +![](images/fcf44688cf5311e77a75d42c22cc30088f9ba3c7ad6210cc8796a9d8193640de.jpg) +Figure 8. Distribution of estimated coefficients (top row) and corresponding p-values (bottom row) for different data sizes $n$ (columns) for the classification task and $\rho = 0$ . Boxplots summarize all different values of $p, q$ , and the 10 simulation repetitions. + +![](images/63ba576130699de3aa7f836e5db6f921323e03c5b4476a0b007a1be6c8c9f300.jpg) +Figure 9. Distribution of estimated coefficients (top row) and corresponding p-values (bottom row) for different data sizes $n$ (columns) for the classification task and $\rho = 0$ . Boxplots summarize all different values of $p$ and the 10 simulation repetitions. + +![](images/4936bd1389fda729680a2dc05a26907bb8cb0b32173144ffd95af24d47aee6bc.jpg) +Figure 10. Distribution of estimated coefficients (top row) and corresponding p-values (bottom row) for different data sizes $n$ (columns) for the count task (Poisson) and $\rho = 0$ . Boxplots summarize all different values of $p$ and the 10 simulation repetitions. + +![](images/313fcd77805c9ad38a8735b7b6dc82969abd4348289ca5944395f0d4799e5035.jpg) +Figure 11. Distribution of estimated coefficients (top row) and corresponding p-values (bottom row) for different data sizes $n$ (columns) for the count task (Poisson) and $\rho = 1$ . Boxplots summarize all different values of $p$ and the 10 simulation repetitions. + +![](images/6788b4d2120bf64b88755acaab3a363f2904f992acbc6f92f2ba03a553d0d6ab.jpg) +Figure 12. Distribution of estimated coefficients (top row) and corresponding p-values (bottom row) for different data sizes $n$ (columns) for the count task (Poisson) and $\rho = 2$ . Boxplots summarize all different values of $p$ and the 10 simulation repetitions. \ No newline at end of file diff --git a/generalizingorthogonalizationformodelswithnonlinearities/images.zip b/generalizingorthogonalizationformodelswithnonlinearities/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..7d7fdd7e67d9ec0ea5e9195dd55ff15f391735f6 --- /dev/null +++ b/generalizingorthogonalizationformodelswithnonlinearities/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2bd83e4758767e53a4330ed5476a10354a9f3b456814ae90d70c5c33dbde11c3 +size 1236727 diff --git a/generalizingorthogonalizationformodelswithnonlinearities/layout.json b/generalizingorthogonalizationformodelswithnonlinearities/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..ea27b8181aa3ec7de792cf30cb2625e4394eb2ce --- /dev/null +++ b/generalizingorthogonalizationformodelswithnonlinearities/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7e140ad003f715b63aaf0037d27662a5ea25b38b429c5965a7d399d8ced7246b +size 957791 diff --git a/generatingchainofthoughtswithapairwisecomparisonapproachtosearchingforthemostpromisingintermediatethought/4d35b91a-8784-4c65-8a03-bde77cd7bcfe_content_list.json b/generatingchainofthoughtswithapairwisecomparisonapproachtosearchingforthemostpromisingintermediatethought/4d35b91a-8784-4c65-8a03-bde77cd7bcfe_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..927a135ecce041967aab4557c0391d3e98a90df8 --- /dev/null +++ b/generatingchainofthoughtswithapairwisecomparisonapproachtosearchingforthemostpromisingintermediatethought/4d35b91a-8784-4c65-8a03-bde77cd7bcfe_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5fe1d2461f6675e05d99a1b37c254117a05dbff78d69e68fd2995b59d4184394 +size 120498 diff --git a/generatingchainofthoughtswithapairwisecomparisonapproachtosearchingforthemostpromisingintermediatethought/4d35b91a-8784-4c65-8a03-bde77cd7bcfe_model.json b/generatingchainofthoughtswithapairwisecomparisonapproachtosearchingforthemostpromisingintermediatethought/4d35b91a-8784-4c65-8a03-bde77cd7bcfe_model.json new file mode 100644 index 0000000000000000000000000000000000000000..716124d1ebdea16bba546cd0938b6ffcbd04e34c --- /dev/null +++ b/generatingchainofthoughtswithapairwisecomparisonapproachtosearchingforthemostpromisingintermediatethought/4d35b91a-8784-4c65-8a03-bde77cd7bcfe_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a12a0c596b419a9fc48fad6bc46500b200363058ba25718fb38cbe75bbf47f6 +size 140842 diff --git a/generatingchainofthoughtswithapairwisecomparisonapproachtosearchingforthemostpromisingintermediatethought/4d35b91a-8784-4c65-8a03-bde77cd7bcfe_origin.pdf b/generatingchainofthoughtswithapairwisecomparisonapproachtosearchingforthemostpromisingintermediatethought/4d35b91a-8784-4c65-8a03-bde77cd7bcfe_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..4f51c6a16d020d8463163fd4e5868c897874419e --- /dev/null +++ b/generatingchainofthoughtswithapairwisecomparisonapproachtosearchingforthemostpromisingintermediatethought/4d35b91a-8784-4c65-8a03-bde77cd7bcfe_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b4df7d4a9960a2f2c7f7f035a899d7486f5f17b5264c68a832cfbdfe3af336f3 +size 452974 diff --git a/generatingchainofthoughtswithapairwisecomparisonapproachtosearchingforthemostpromisingintermediatethought/full.md b/generatingchainofthoughtswithapairwisecomparisonapproachtosearchingforthemostpromisingintermediatethought/full.md new file mode 100644 index 0000000000000000000000000000000000000000..367959b5ffe38da48c14df95f942919328a311fb --- /dev/null +++ b/generatingchainofthoughtswithapairwisecomparisonapproachtosearchingforthemostpromisingintermediatethought/full.md @@ -0,0 +1,556 @@ +# Generating Chain-of-Thoughts with a Pairwise-Comparison Approach to Searching for the Most Promising Intermediate Thought + +Zhen-Yu Zhang1 Siwei Han2 Huaxiu Yao2 Gang Niu1 Masashi Sugiyama13 + +# Abstract + +To improve the ability of the large language model (LLMs) to tackle complex reasoning problems, chain-of-thoughts (CoT) methods were proposed to guide LLMs to reason step-by-step, enabling problem solving from simple to complex. State-of-the-art methods for generating such a chain involve interactive collaboration, where the learner generates candidate intermediate thoughts, evaluated by the LLM, guiding the generation of subsequent thoughts. However, a widespread yet understudied problem is that the evaluation from the LLM is typically noisy and unreliable, potentially misleading the generation process in selecting promising intermediate thoughts. In this paper, motivated by Vapnik's principle, we use pairwise-comparison evaluation instead of pointwise scoring to search for promising intermediate thoughts with the noisy feedback from the LLM. In each round, we randomly pair intermediate thoughts and directly prompt the LLM to select the more promising one from each pair, allowing us to identify the most promising thoughts through an iterative process. To further alleviate the noise in the comparison, we incorporate techniques from ensemble learning andueling bandits, proposing two variants of the algorithm. Experiments on three real-world tasks demonstrate the effectiveness of our proposed algorithm and verify the rationale of the pairwise comparison mechanism. + +# 1. Introduction + +Large language models (LLMs), such as the GPT (Brown et al., 2020) and PaLM (Chowdhery et al., 2023), have re + +1Center for Advanced Intelligence Project, RIKEN 2University of North Carolina at Chapel Hill 3Graduate School of Frontier Sciences, The University of Tokyo. Correspondence to: Masashi Sugiyama . + +Proceedings of the $41^{st}$ International Conference on Machine Learning, Vienna, Austria. PMLR 235, 2024. Copyright 2024 by the author(s). + +cently demonstrated remarkable capabilities in a variety of real-world tasks. However, current LLMs still face limitations when dealing with complex tasks, especially those involving multi-step reasoning, such as mathematical or reasoning problems (Rae et al., 2021; Wei et al., 2022). To deal with such implicit complexity, chain-of-thoughts (CoT) approaches were proposed (Wei et al., 2022; Wang et al., 2022; Yao et al., 2023). These approaches were proposed to use an incorporation of intermediate steps of reasoning (intermediate "thought"), enabling the LLM to reason progressively, first generating intermediate solutions for simpler problems to incrementally improve its capacity to handle complicated tasks. Therefore, the key challenge is to design an effective CoT generation algorithm that guides the LLM towards desired solutions through step-by-step reasoning. + +There is a fruitful line of work that considers the CoT generation problem. The pioneering work uses manual design prompts to let the LLM generate a CoT by itself (Wei et al., 2022; Wang et al., 2022). This line of research was recently extended by the score-based tree-of-thoughts (S-ToT) approaches (Yao et al., 2023; Long, 2023), where the CoT generation is framed as an interactive process with the algorithm and the LLM. These approaches generate a set of candidate intermediate thoughts each round and ask the LLM to score them and select the most promising ones. The next thoughts are then generated based on these selected ones, creating a tree-like data structure. A search algorithm, such as deep-first search, is used to identify the most promising CoT in the tree (see the detailed illustration in Figure 2). + +While these methods have shown remarkable empirical success, they rely on an accurate score evaluation of each intermediate thought by the LLM. However, it is important to notice that: LLM scores are often noisy. For example, the LLM may give different responses to different prompts, even though these prompts convey the same meaning (Lu et al., 2022). The noisy nature of LLM feedback introduces new problems in the selection of the most promising intermediate thoughts and the subsequent generation of the tree structure. Therefore, it is crucial to make the CoT generation algorithms robust to the noisy feedback from LLMs. + +Several preliminary approaches have been proposed to mitigate such noise in the LLM feedback, including estimating + +uncertainty from the semantic aspect (Kuhn et al., 2022) or assembling multiple thoughts (Wang et al., 2022). However, getting an accurate point-wise estimate for each intermediate thought could be resource-intensive, requiring the construction of an additional model (Paul et al., 2024) or multiple queries (Wang et al., 2022): see also Figure 4 and Table 6 to 8 in our experiments. Fortunately, in the context of CoT generation, our focus is on identifying the most promising chain. Motivated by Vapnik's principle (Vapnik, 1991), we do not need to solve a more general and difficult problem as an intermediate step, i.e. to estimate an accurate pointwise score for each intermediate thought. Instead, we can focus directly on identifying the most promising one in each round. However, it is still impractical to directly vote on all intermediate thoughts to identify the most promising one by LLMs due to the input length limit and the "lost in the middle" phenomenon (Liu et al., 2024). + +We argue that for LLMs, comparing two thoughts simultaneously provides a more robust evaluation than assigning individual scores. We aim to leverage the comparison of two thoughts instead of evaluating a single thought in isolation, thereby providing a feasible alternative for identifying the most promising intermediate thought. This argument is well established in human cognition, as seen in mathematical problems, where it is often more feasible to approximate which thought is better by comparison than by considering and evaluating them separately. We also observe similar phenomena that LLMs to generate a more reliable evaluation in the experiments on the Sudo task, as shown in Figure 1, where the LLM successfully identifies the better option given two intermediate solutions, but struggles to assign the correct value to intermediate thoughts individually. + +Based on the above insights, we propose a pairwise comparison-based algorithm for CoT generation to alleviate the noise in the LLM feedback and to find the most promising intermediate thoughts each round. In each round, we randomly pair all the intermediate thoughts and directly ask the LLM to compare and select the more promising one from each pair, keeping the selected one and discarding the other. Then we repeat this procedure so that we get a small set of most promising intermediate thoughts, and subsequently, we generate the next thoughts based on these selected ones. This mechanism allows us to use a direct pairwise comparison to identify the promising thoughts with a more robust evaluation. We also propose to include previous thoughts in the tree structure for comparison to mitigate the noisy nature of LLM's feedback. Taking these two points into account, we frame the problem as an iterative process and propose a general CoT generation algorithm called comparison-based tree-of-thoughts (C-ToT). To further model the noise in the comparison, we resort to the techniques of ensemble and best-arm identification withueling feedback (Falahatgar et al., 2017) and propose two variants of the proposed C + +![](images/44a4bbed72eb726e3c6816b71aa979a1e66c2481b5eb406592f933658c853f77.jpg) +Figure 1: A demonstration of point-wise evaluation vs. pair-wise comparison based on real experimental results in Sudoku puzzles. The point-wise evaluation algorithm (S-ToT) assigns hard scores to each intermediate thought (the higher, the better), while our proposed algorithm (C-ToT) uses pair-wise comparison to obtain the more promising thoughts (green tick). In these cases, the LLM assigns incorrect scores, but it makes a correct comparison. + +ToT algorithm. Through experiments on three real-world reasoning problems, we demonstrate the effectiveness of our proposed approaches and verify the rationale of the pairwise comparison mechanism. Our main contributions are: + +(1) We investigate the problem of noisy feedback in the CoT generation, which is widespread but understudied. +(2) Motivated by Vapnik's principle, we propose a pairwise-comparison based approach for CoT generation that exploits noisy feedback from the LLMs. +(3) We proposed two variants of C-ToT that further account for different types of noise in the comparison feedback. + +# 2. Related Work + +CoT Generation. Generating appropriate CoT for LLMs to enhance their inference power is a critical problem in real-world applications. Previous work has explored task-specific training algorithms for identifying the CoT, including creating semantic graphs (Xu et al., 2021), refining the model through human-annotated CoT (Cobbe et al., 2021), or learning an additional extractor using heuristic-driven pseudo CoT (Chen et al., 2019). Different from these approaches, the LLM-based CoT generation is used directly during inference, coupling the generation process with an LLM. In these approaches, the LLM guides the CoT generation, eliminating the need for additional training. + +The pioneering work in LLM-based CoT generation introduces intermediate thoughts sequentially between the input query and LLM's response. By simply prompting the LLM to "think step by step", this strategy has been shown to significantly improve several tasks over directly asking the LLM the original question, such as mathematical puzzles (Wei et al., 2022) or other general mathematical reasoning problems (Drori et al., 2022). Due to the noisy nature of the LLM feedback, robustness can be improved by using an ensemble of different CoTs (Wang et al., 2022). + +To further improve the effectiveness of CoT generation, the score-based tree-of-thoughts generation algorithm was intro- + +duced independently by Yao et al. (2023) and Long (2023). They model the CoT generation process as a tree generation and search process. A single node in the tree represents an intermediate thought. Starting from a given node, the thought generator constructs a set of new nodes and the LLM generates scores for each node as an evaluation. Finally, the timing of the tree expansion is determined by the search algorithm used (e.g., breadth-first or depth-first search). In addition, this search algorithm can also provide capabilities including backtracking from unpromising thoughts. Further research extended the tree structure to a graph, such as the graph-of-thoughts (Besta et al., 2023), allowing the distillation of knowledge about entire network of thoughts. However, these methods cannot handle the noisy evaluation feedback caused by the LLM itself. + +Self-Reflection. Rather than interacting with LLMs to generate a step-by-step reasoning chain, self-reflection approaches involve LLMs directly offering an initial thought chain to the query, followed by iterative refinement of the whole chain. Madaan et al. (2023) and Paul et al. (2024) introduced the "self-reflection" mechanism, using the LLMs to provide feedback to their generation candidates and then fine-tuning. Paul et al. (2024) updated the model to explicitly generate intermediate thoughts while interacting with a critic model that provides automated feedback on the reasoning. These methods introduced new models to provide evaluation for the intermediate thoughts, but these critical models still do not always provide perfect evaluation. Furthermore, for complex problems that require sequential reasoning, such as the Game of 24, where the next thought should be generated and evaluated based on previous ones, the C-ToT generation could be more appropriate. + +Uncertainty Quantification in LLMs. This is a recent interest that aims to evaluate the confidence of a given answer by the LLM itself. Some work considered letting the LLM provide the confidence (Northcutt et al., 2021; Kadavath et al., 2022) by retraining the model. Another line of work considered designing entropy-based measures (Kuhn et al., 2022), or generating multiple outputs to obtain an uncertainty measure (Wang et al., 2022). Although they can be included in the CoT generation, they introduce a high computational cost during testing, particularly when obtaining an accurate score for each intermediate thought. + +# 3. Our Approach + +In this section, we first introduce the proposed comparison-based ToT generation algorithm, which is a general framework that generates CoT with a pairwise comparison mechanism to find the most promising intermediate thought. To further alleviate the noise in LLM's comparison feedback, we propose two different instantiations of our framework with theoretical analysis. + +# 3.1. CoT Generation via Pair-wise Comparison + +We first introduce the comparison-based ToT framework, where the key mechanism is the selection of the most promising thoughts among all candidates in each round. + +We illustrate our proposed algorithm and compare it with previous approaches in Figure 2. The CoT approaches directly ask the LLM to generate a CoT. The S-ToT approaches ask the LLM to score each intermediate thought and select the highest-scoring ones to generate the next layer. Different from these methods, we propose a pairwise-comparison approach to searching for the most promising intermediate thoughts. Note that with LLMs, due to feedback noise and input limitations, we cannot do a listwise voting that directly asks the LLM to sort all the intermediate thoughts. Let $Z$ be the set of all candidate intermediate thoughts, and we want to select the most promising $K$ thoughts from it. The comparison iterates as follows: we randomly pair thoughts from the set and select only the winner in each pair, thereby halving the size of $Z_{i}$ to $|Z_{i}| / 2$ , where $Z_{i}$ denotes the set in the $i$ -th iteration. After at most $K \times \log_2|Z|$ rounds, we can identify the $K$ most promising intermediate thoughts by such direct comparison. In practice, we can do one iteration of comparison and keep the remaining $K$ thoughts in the last few rounds. For each pair, we compare thoughts $a$ and $b$ with the LLM by asking which one is better, using different prompts with $n$ times, where $n \geq 1$ . We defer the implementation details to Section 4.1. + +We take previous unselected intermediate thoughts into comparison to explore possibly valuable but mis-evaluated thoughts caused by the noise in feedback. This is because the evaluation of intermediate thoughts may not always be accurate, and the generation of the tree structure may miss valuable intermediate thoughts in previous iterations. In the seminal research of S-ToT (Yao et al., 2023; Long, 2023; Besta et al., 2023), the thought generator uses a backtracking mechanism to revisit previous thoughts when the current ones fall below a certain threshold. While this strategy aims to rescue promising thoughts, its efficiency is questionable because it may delay the exploration of previously valuable but incorrectly scored thoughts. In addition, backtracking only occurs after a thought has fallen below a manually chosen threshold, which is hard to know in advance. + +Motivated by these shortcomings and the efficiency of our pairwise-comparison mechanism, we maintain a repository of previous intermediate thoughts. At each round, we include previously unselected thoughts in the comparisons, rather than relying on a fixed threshold. As illustrated in Figure 2, during the pairwise comparison in the second layer, we include the intermediate thought that was not selected in the first layer. This mechanism ensures that the algorithm has the flexibility to revisit previous thoughts based on the comparison results from the LLM in each round. + +![](images/17feb2ae06e550f2890088b9f187e9113d29a466a9bfa10f9565eb76c89abd06.jpg) +Chain-of-Thoughts + +![](images/a76aa451e3dbcdceec680b62f6a1f5778be3d94b491bc063fb6dbac647f649ba.jpg) +Score-based Tree-of-Thoughts (S-ToT) + +![](images/03e9a235bc922346c3eacb7120eb3b407be2413a00b7700c28fb8b4a6004c807.jpg) +Comparison-based Tree-of-Thoughts (C-ToT) +Figure 2: Schematic illustration of previous CoT and S-ToT approaches with our proposed C-ToT approach for CoT generation with LLMs. Each circle box represents an intermediate thought, which is a coherent sequence of language or equations that serves as an intermediate step in problem solving. In the S-ToT method, each intermediate thought is scored by the LLM (denoted by $s$ in the figure), and the searching algorithm considers the highest-scoring ones as the most promising and then generates next intermediate thoughts based on them. In the C-ToT approach, we use pairwise comparison with the LLM in each round to find the most promising intermediate thoughts and then generate the next thoughts. Meanwhile, we include all previous intermediate thoughts in the comparison. + +We formulate the comparison-based ToT generation as an iterative interaction between the thought generation and the LLM. Take the C-ToT illustration in Figure 2 as an example. The algorithm starts by generating intermediate thoughts #1 to #3 based on the input. Following a pairwise comparison mechanism, thoughts #1 and #3 are selected, leading to the generation of new intermediate thoughts, namely #4 to #8. In the second layer, thought #2, thoughts #4 and #5 (linked to #1), along with thoughts #6 to #8 (linked to #3) are compared, subsequently resulting in the selection of thought #2 and thought #7 (linked to #3), and the generation of the next intermediate thoughts. + +Formally, we denote an intermediate thought by $\mathbf{z}$ . In round $t$ , $Z^t$ represents the set of candidate intermediate thoughts for comparison, and $\widehat{Z}^t$ denotes the selected intermediate thoughts. In a sequence of $T$ rounds, in the first round the algorithm generates a set of thoughts $Z^1 = \{\mathbf{z}_i^1\}_{i=1}^m$ based on the query, where $m$ denotes the set size. Then, the comparison-based ToT selects $K$ most promising intermediate thoughts based on the comparison result from the LLM. We denote the selected set of thoughts by $\widehat{Z}^1 = \{\mathbf{z}_j^1\}_{j \in [K]}$ . In the second round, the algorithm generates the new intermediate thoughts based on each selected thought1. After $T$ rounds, we can get $K$ most promising thoughts, and all of them contain information about their parent nodes, thus formulating as $K$ CoTs. Therefore, this iterative process facilitates the refinement and selection of thoughts over multiple rounds. For each pair of thoughts, we use a direct comparison to identify the more promising one. We call such a direct comparison method "Standard Mode". We + +# Algorithm 1 C-ToT Algorithm + +1: Input: Query x, comparison times $n$ , number of intermediate thoughts generation $m$ , number of selected thoughts $K$ , depth of the tree $T$ . +2: Generate initial thoughts $Z^1$ of size $m$ with query $\mathbf{x}$ +3: for $t = 1$ to $T$ do +4: if Standard Mode then +5: Pair thoughts in $Z^t$ randomly +6: while $|Z^t| > K$ do +7: for every pair $(a,b)$ in $Z^t$ do +8: Compare thoughts $a$ and $b$ by LLM $n$ times, then take a majority vote. If $a$ wins, keep thought $a$ in $Z^t$ and drop $b$ , and vice versa. +9: end for +10: end while +11: Denote $\widehat{Z}^t$ by the remaining thoughts +12: else +13: Call Algorithm 2 to obtain $\widehat{Z}^t$ +14: end if +15: Generate the next $m$ thoughts for each thought in $\widehat{Z}^t$ . +16: end for + +summarize the proposed approach in Algorithm 1. + +Remark 1 (Comparison Complexity). In our approach, we keep all previous intermediate thoughts to compare in each round. This may affect the operational efficiency and exceed the storage limit. To improve the efficiency, we can introduce a counter for each intermediate thought to track its comparison frequency. If the comparison count of an intermediate thought exceeds a threshold, we can remove it from the tree. Since the comparison in each round is independent of each other, we could use parallel computing to improve + +the efficiency of the algorithm, or exploit more efficient machine learning techniques to schedule computational resources more adaptively and efficiently (Zhou, 2024) in the future. If the tree depth is $T$ , the total number of comparisons required is less than the order of $\mathcal{O}(nTK\log(m))$ . + +Remark 2 (Token Cost). The token costs of our proposed C-ToT approach and the S-ToT approaches are task-specific and generally incomparable. The C-ToT approach could discover valuable but misevaluated previous intermediate thoughts earlier than the S-ToT method. However, it may introduce more token overhead as we compare these thoughts multiple times. Therefore, we are better suited to the problem where the initial intermediate thoughts are more uncertain. We provide the token cost analysis in Appendix C.2. + +# 3.2. Instantiations and Analysis + +In the proposed C-ToT framework, we use a direct comparison for each pair of thoughts. Although our C-ToT method explores two sample information compared to the S-ToT methods that use only single sample information, the comparison feedback could still be inaccurate. We offer two methods to select the winning thought in a pair. + +Standard. Suppose the comparison difficulty of each pair is the same. Inspired by the ensemble algorithms in CoT generation (Wang et al., 2022), we can improve the robustness of the comparison feedback by setting $n > 1$ in the "Standard Mode", so that we compare the two thoughts in each pair for $n$ times and take majority voting output. + +Dueling. We consider a more general assumption of noisy comparisons, where we only assume an unknown ranking of the $M_t$ thoughts at round $t$ . This implies that the comparison difficulty of each pair varies, requiring a different number of comparisons for each pair. If two thoughts $a$ and $b$ are compared, thought $a$ is chosen with some unknown probability $p(a, b)$ and $b$ is chosen with $p(b, a) = 1 - p(a, b)$ , where the higher-ranked one has probability $\geq 1/2$ . Repeated comparisons are independent of each other. + +We formulate it as a best-arm identification problem with dueling feedback (Yue et al., 2012; Falahatgar et al., 2017), propose a dueling bandits instantiation of the C-ToT framework, and analyze its properties. For each pair, we keep the empirical probability $\widehat{p}_a$ , a proxy for $p(a,b)$ . We also maintain a confidence value $\widehat{c}$ s.t., w.h.p., $\widehat{p}_a \in (p(a,b) - \widehat{c}, p(a,b) + \widehat{c})$ . We stop the comparisons when it is sure of the winner or when it reaches its comparison budget $n$ . If it reaches $n$ comparisons, it outputs the element with more wins, randomly breaking ties. During comparison, we also compare two elements $a, b$ with LLM by query them with different prompts. We summarize the proposed instantiation in Algorithm 2. Here stochasticity $\gamma$ models the problem hardness. + +Analysis. First, we introduce some definitions. Given a set + +Algorithm 2 Knockout +1: Input: Set $Z$ , bias $\varepsilon$ , confidence $\delta$ , stochasticity $\gamma$ , $i = 1$ +2: while $|Z| > K$ do +3: Pair thoughts in $Z$ randomly +4: for every pair $(a, b)$ do +5: Set bias $\varepsilon = \frac{(2^{1/3} - 1)\varepsilon}{\gamma 2^{i/3}}$ , confidence $\delta = \frac{\delta}{2^i}$ , $\widehat{p}_a = 1/2$ , $\widehat{c} = 1/2$ , $n = \frac{1}{2\varepsilon^2} \log \frac{2}{\varepsilon}$ , $r = 0$ , $w_a = 0$ +6: while $|\widehat{p}_a - 1/2| \leq \widehat{c} - \varepsilon$ and $r \leq n$ do +7: Compare thoughts $a$ and $b$ by LLM. if thought $a$ wins, $w_a = w_a + 1$ , and vice versa. +8: $r = r + 1$ , $\widehat{p}_a = \frac{w_a}{r}$ , $\widehat{c} = \sqrt{\frac{1}{2r} \log \frac{4r^2}{\delta}}$ +9: if $\widehat{p}_a \leq 1/2$ then +10: Keep thought $b$ in $Z$ and drop $a$ , break. +11: else +12: Keep thought $a$ in $Z$ and drop $b$ , break. +13: end if +14: end while +15: end for +16: $i = i + 1$ +17: end while +18: Return $\widehat{Z}$ by the remaining thoughts + +of thoughts $Z = \{\mathbf{z}_1, \dots, \mathbf{z}_M\}$ of size $M$ . Suppose there is an unknown underlying ranking function $r: \mathcal{Z} \mapsto \mathbb{N}$ that ranks all the thoughts. Let $r(\mathbf{z}_1), \dots, r(\mathbf{z}_M)$ be the ranking of the thoughts, such that when two elements $\mathbf{z}_a$ and $\mathbf{z}_b$ are compared, the higher ranked one is selected first, e.g. $r(\mathbf{z}_a) < r(\mathbf{z}_b)$ . We define the $\varepsilon$ -maximum via the $(\varepsilon, \delta)$ -PAC paradigm, which requires that the output is likely to be close to the intended value. Specifically, given $\varepsilon > 0, \delta > 0$ , with probability $\geq 1 - \delta$ , the maximum selection must produce an element $a$ such that for $b$ , with $r(b) = M$ , $p(a, b) \geq \frac{1}{2} - \varepsilon$ . We call such an output $\varepsilon$ -maximum. + +Lemma 1 (Theorem 3 in (Falahatgar et al., 2017)). Knockout $(Z, \varepsilon, \delta)$ uses $\mathcal{O}\left(\frac{\gamma^2|Z|}{\varepsilon^2} \log \frac{1}{\delta}\right)$ comparisons and with probability at least $1 - \delta$ , outputs an $\varepsilon$ -maximum. + +Proposition 1. Suppose that the depth of the tree is $T$ , and thoughts in the shallower layers are more promising than those in the deeper ones. Then, the probability of missing the $\varepsilon$ -maximum promising thoughts in the $\tau$ -th layer is $1 - \delta^{\tau}$ with at most $\mathcal{O}\left(\frac{\gamma^{2}\sum_{i = 1}^{T}|Z^{i}|}{\varepsilon^{2}}\log \frac{1}{\delta}\right)$ comparisons required for generating the whole tree of thoughts. + +Remark 3. Proposition 1 is directly derived from Lemma 1 by the union bound. Proposition 1 shows that, under the general assumption of noisy comparisons and utilizing our proposed pairwise-comparison approach, valuable intermediate thoughts will still not be overlooked, especially for the thoughts in the shallow layer, which may be more uncertain as they appear at the beginning of the ToT generation. We leave the detailed proofs to Appendix B. + +# 4. Experiments + +We test our proposed algorithm in three real-world tasks: question answering (QA), as well as mathematical reasoning tasks, namely, the Game of 24 and Sudoku Puzzles. The LLM employed in experiments is GPT-3.5-turbo-1106. + +# 4.1. Experiment Setup + +Contenders Setup. Our evaluation firstly includes a comparison with a baseline method that directly queries the LLM for the final result (we denote it as Direct); three state-of-the-art contenders: CoT (Wei et al., 2022), SC-CoT (Wang et al., 2022), and SToT (Yao et al., 2023). For the CoT method, we query the LLM directly to get the final answer, following the settings as in (Wei et al., 2022). For the SC-CoT method, for a fair comparison, if without further notice, we set the CoT number approximately the same number of tokens with our proposed algorithm. Specifically, 15 samples were generated for each question, using the same settings as in (Wang et al., 2022), with the final answer determined by majority voting. The SToT approach is also implemented identically to the setting in Yao et al. (2023). For the depth of the tree in the SToT algorithm, we set it equal to the depth with our proposed algorithms C-ToT (Stand.) and C-ToT (Duel.). + +We further propose three contenders for comparison to test the effectiveness of our proposed algorithm. A robust implementation of SToT is proposed that follows the main idea of SC-CoT to account for noise in the LLM feedback, called SC-SToT. Two variants of SToT that equipped with our proposed mechanisms are also included, denoted as Comp-SToT, Back-SToT. Specifically, + +(1) SC-SToT: We denote the self-consistent variant of the ToT algorithm as SC-SToT, short for Self-Consistent ToT algorithm. To alleviate feedback noise in the ToT algorithm, we draw inspiration from the self-consistent CoT generation algorithm (Wang et al., 2022). Our proposal involves querying the LLM multiple times during intermediate thought evaluation in the ToT algorithm and using the majority voting results as the final evaluation in the SC-SToT. This contender is a direct extension of the ToT algorithm to account for the feedback noise of the LLM, but the cost is very high as it scores each intermediate thought multiple times; +(2) Comp-SToT: We replace the score-based evaluation in the original SToT algorithm with our proposed pairwise comparison approach and refer to this variant algorithm as Comp-SToT. +(3) Back-SToT: We replace the search algorithm in the original SToS algorithm with our proposed mechanism, which retains all previous intermediate thoughts with their corresponding socres and takes the highest scoring thoughts as the most promising ones. We call this variant algorithm as Back-SToT. + +In addition, we include three state-of-the-art algorithms into comparison: PoT (Chen et al., 2023), Self-Refine (Madaan et al., 2023) and GoT (Besta et al., 2023). Detailed experimental results can be found in Appendix C.1. + +For our proposed C-ToT approaches, we denote the C-ToT algorithm in "Standard Mode" by C-ToT (Stand.) and set the number of comparisons $n$ to 1. We denote the C-ToT algorithm that considers the general comparison noise by C-ToT (Duel.), and set the maximum number of comparisons to 3 and set $\gamma = 0.1$ . All experiments are repeated 3 times. + +Intermediate Thoughts Generation. In general, different tasks should have different thought generators. Exploiting problem properties is essential to effectively design the intermediate thoughts. We follow the setting of (Yao et al., 2023) to generate the intermediate thoughts. For example, we generate the thoughts as a few words, as in QA; as a line of equations, as in the Game of 24; or as an intermediate solution in the Sudoku puzzle. We defer the implementation for prompts and the cost comparison of our approaches and other contenders to Appendix A and Appendix C.2. + +# 4.2. Question Answering + +Task Setup. We first test the performance of our proposed algorithm on the question answering tasks using the AQuA dataset (Ling et al., 2017), which comprises 254 arithmetic reasoning tasks aimed at assessing logical abilities through various mathematical computation problems. Each question in this dataset is accompanied by five multiple-choice options, labeled from A to E. We follow the experimental protocol as it is in the work of Wang et al. (2022). The accuracy of the responses is gauged by comparing the generated answers with the standard solutions. Results on other QA datasets can be found in Appendix C.1. + +C-ToT Setup. For the AQuA dataset, we set the maximum depth of tree of thoughts to 3. For each intermediate thought selected, we set $m = 12$ , thus generating 12 new intermediate thoughts as the next step. The maximum number of selected thoughts $K$ per layer is set to 3. Therefore, starting from the "question" as the root, all newly generated thoughts are compared, and we select 3 most promising intermediate thoughts to generate the next step. + +In the question answering task, it is difficult to set a fixed length for the C-ToT, i.e., an intermediate thought may already summarize the answer before reaching the maximum length of the C-ToT. For those selected intermediate thoughts that have already reached an answer, we add them to the "answer list" and do not include them in the comparison in the next round. For those intermediate thoughts that have already reached an answer but were not selected, we will include them in the comparison in the next round. This mechanism thus gives excluded answers a chance to + +
MethodAccuracy
Direct24.8%
CoT42.3%
SC-CoT58.4%
SToS57.1%
SC-SToS57.6%
Comp-SToS59.0%
Back-SToS58.0%
C-ToT (Stand.)61.4%
C-ToT (Duel.)63.0%
+ +![](images/c0990059509bd72a0ab40775f73e35575d6cdc370862bfc4f75be72f09b8c80f.jpg) +Figure 3: Predictions of SToT and Comp-SToT on AQuA. + +Table 1: Average accuracy on AQuA. + +
MethodAccuracy
Direct8.0%
CoT4.3%
SC-CoT8.0%
SToS34.3%
SC-SToS40.0%
Comp-SToS36.3%
Back-SToS39.0%
C-ToT (Stand.)40.0%
C-ToT (Duel.)41.0%
+ +Table 2: Average accuracy on Game of 24. + +![](images/73be3fc485bde6223503939f81dc68ea7d9dffdf05dc6fe7db59b3bfbb984d69.jpg) + +Figure 4: Accuracy and token costs of differenta methods. + +be included in the "answer list" by subsequent comparisons. After $T$ rounds of thought generation and comparison for selection, the selected chains are appended to the "answer list", and a majority voting mechanism is used on the "answer list" to determine the final answer. We leave the implementation details of the thought generator and the comparison prompt for the question answering task to Appendix A.1. + +Comparison Results. We report the comparison results of our proposed approaches with other contenders in Table 1. All CoT approaches outperform the Direct query method, showing the importance of designing effective CoTs to guide LLMs from simplicity to complexity. We can also observe that the SC-SToT method outperforms the original SToT method, where the algorithm scores the intermediate thoughts multiple times to alleviate the noise. However, this mechanism will significantly increase the token cost. We leave the detailed discussion of token cost to Appndex C.2. + +Both proposed variants of SToS methods achieve higher average accuracy than the original SToS method. In CompSToS, the point-wise scoring mechanism is replaced by a pairwise comparison, while in Back-SToS, our backtracking search algorithm replaces the original search algorithm, taking into account all previous intermediate thoughts. These results demonstrate the effectiveness of these two mechanisms, such that the proposed C-ToT (Stand.) and C-ToT (Duel.) approaches outperform all contenders. Moreover, C-ToT (Duel.) achieves superior performance by further modeling noise in the comparison. + +We delve deeper to explore the benefits of the pairwise comparison mechanism to test whether it can better find the most promising intermediate thoughts. Note that we do not have access to the underlying value or order of the intermediate thoughts in each round. Therefore, we use the final prediction error as a proxy, since the depth of the tree structure in the QA datasets is shallow, limited to 1 to 3 levels. We quantify the number of QA problems correctly/incorrectly predicted by ToT and Comp-SToT and report it in Figure 3. Our observation shows that Comp-SToT predicts more correctly when S-ToT predicts incorrectly, showing the superiority of the pairwise comparison mechanism over the pointwise scoring mechanism. This validates the rationale of pairwise comparison mechanism. + +# 4.3. Game of 24 + +Task setup. This is a math problem where the goal is to use four numbers and basic arithmetic operations $\{+, -, *, / \}$ to get a sum of 24. For example, given the input $\{4, 9, 10, 13\}$ , a viable solution would be $(10 - 4) * (13 - 9) = 24$ . In our experiments, we use the same dataset as in the work of Yao et al. (2023) and follow their experimental setup, which consists of 1,362 problems taken from the 24-point game on 4nums.com. We have selected questions numbered 401 to 500 as our question set. Each problem consisted of four numbers selected from 1 to 13, and the goal is to formulate a calculation using these numbers to reach a total of 24. The accuracy of the solutions is scored based on whether all 4 input numbers were used and whether the result is 24. + +C-ToT Setup. In this task, we restore unselected intermediate thoughts in previous layers and apply pruning when the current node is inferior to previously unselected ones. We set the maximum depth of tree to 6. The computation terminates either when an answer containing the number 24 is derived, or when the maximum layer limit is reached. + +We set the number of selected intermediate thoughts per layer $K = 5$ and let the LLM generate a variable number of new thoughts. If the total number of new thoughts is less than or equal to twice the maximum number of selected thoughts, thoughts are moved from the "remain list" (a list that stores reserved thoughts) to the new node list until the number of new thoughts reaches twice the maximum number of selected thoughts or the "remain list" is emptied. + +We also optimize the pruning process that takes place before the comparison stage and apply it to all contenders to save tokens. Newly generated intermediate thoughts with a single number unequal to 24 is eliminated. The rest are then filtered by comparison, selecting a number of new thoughts equal to or less than the maximum number of selected thoughts. Thoughts that are not selected are added to the "remain list". If one of the selected thoughts contains the final answer, it is added to the "answer list" and the interactive process is stopped. We leave the implementation details of the thought generator and the comparison prompt to Appendix A.2. + +Comparison Results. We report the overall comparison results in Table 2. We observed trends similar to those reported in the QA task. We find that both the SToT and + +CToT approaches significantly outperform the CoT-based methods, indicating the need to interact with the LLM to generate a more powerful chain of thoughts to handle complex reasoning tasks. The SC-SToT method improves the performance of SToT, while the Comp-SToT can achieve a similar improvement with pairwise comparison, indicating the superiority of the comparison mechanism. Therefore, the combination of the comparison mechanism and the specific design for comparison noise allows the C-ToT (Duel.) to achieve the highest average accuracy. + +We also report the average accuracy of different methods against their token cost in Figure 4. We can observe that the token cost per question of the Comp-SToT algorithm is the same as that of the SToT algorithm, but it achieves a better performance. In practice, we can reduce the token cost by using a counter for each thought to track its comparison frequency. If the comparison count of a thought exceeds a threshold, we can remove it from the tree. We also leave the detailed discussion of token cost to Appendix C.2. + +# 4.4. Sudoku Puzzle + +Task Setup. We use the Selenium Dataset (Long, 2023), containing 10 Selenium puzzles each of $3 \times 3$ , $4 \times 4$ , and $5 \times 5$ dimensions. Each puzzle is partially filled with numbers, and the task is to complete the entire Selenium grid without changing the given numbers. The correctness of the solutions was determined by whether a complete and correct Selenium grid is generated. + +C-ToT Setup. In this task, we test our proposed algorithm against other competitors in Sudoku puzzles of three different sizes. In each case, we set the maximum depth of tree of thoughts to 15. The computation stops either when the correct Sudoku solution is derived or when the maximum number of steps is reached. For each intermediate thought selected, we set $m = 5$ , thus generating 5 new intermediate thoughts as the next step. The maximum number of selected thoughts $K$ per layer is also set to 3. + +From the newly generated thoughts, a number equal to or less than the maximum allowed was selected by comparison. A pruning strategy was used to check for and eliminate thoughts containing results that did not meet the Selenium requirements, such as duplicate numbers in the same row or column. These non-compliant results were removed from both the selected and unselected thoughts. The remaining unselected thoughts were then added to the "remain list". + +If the number of selected thoughts was less than the maximum, additional thoughts were moved from the "remain list" to the "select list" until either the maximum number was reached or the "remain list" was emptied. We then checked whether the "select list" contained a correct solution. If a correct solution was found, it was added to the "answer list" + +
MethodAcc. 3 × 3Acc. 4 × 4Acc. 5 × 5
Direct56.7%37.7%16.7%
CoT73.3%36.7%23.3%
SC-CoT76.7%50.0%16.7%
SToS86.7%46.7%46.7%
SC-SToS96.7%53.3%50.0%
Comp-SToS100.0%46.7%50.0%
Back-SToS100.0%60.0%56.7%
C-ToT (Stand.)100.0%63.3%60.0%
C-ToT (Duel.)100.0%63.3%63.3%
+ +Table 3: Average accuracy on Selenium Puzzles. + +and the program was terminated. We leave the implementation details of the thought generator and the comparison prompt to Appendix A.3. + +Comparison Results. We report the comparison results in Table 3. In all three tasks, our proposed approaches, C-ToT (Stand.) and C-ToT (Duel.), consistently achieve the highest average accuracy, demonstrating their superior ability to handle complex reasoning tasks. While the SToT method generally outperforms the Direct method and the CoT method, it does not always outperform the SC-ToT method, as seen in the $4 \times 4$ Sudoku task. This phenomenon may be due to the potential noise in pointwise scoring methods, which could mislead the subsequent generation of intermediate thoughts. The SC-ToT method introduces thought ensembles, which naturally mitigate the noise in the LLM feedback. Our proposed methods consistently outperform other contenders, suggesting that pairwise comparison mechanism effectively mitigates noise in LLM feedback, identifies the most promising intermediate thoughts, and improves the generated chain compared to SToT-based methods. We can observe that the C-ToT (Stand.) algorithm achieves the same performance as the C-ToT (Duel.) algorithm, which indicates that a single pairwise comparison could already provide reliable feedback in the Sudoku puzzle tasks. + +# 5. Conclusion + +This paper investigates a widespread but understudied problem of noisy feedback from LLMs in CoT generation tasks. Motivated by Vapnik's principle, we argue that for LLMs, the simultaneous comparison of two thoughts provides a more robust evaluation compared to individual value evaluations, and thus we propose a pairwise-comparison ToT approach C-ToT, approaching to searching for the most promising intermediate thought. The proposed method directly selects the most promising intermediate thought by pairwise comparison, and incorporates previous thoughts into the comparison to allow for rethinking. To further alleviate the noise in the comparison, we propose two variants of the C-ToT algorithm, and analyze the theoretical properties. Experiments on three real-world mathematical and reasoning tasks show the effectiveness of our proposed algorithm and verify the rationale of the pairwise comparison. + +# Acknowledgments + +HY was supported by Cisco Faculty Research Award. MS was supported by JST CREST Grant Number JP-MJCR18A2. + +# Impact Statement + +This research investigates a general problem of CoT generation with any LLM, where we take into account the noise in the feedback of the LLM. Therefore, when using LLMs for complex mathematical or logical reasoning problems, the user could benefit from our study from the aspect of generating a more effective CoT. The consequences of system failure and bias in the data are not applicable. + +# References + +Besta, M., Blach, N., Kubicek, A., Gerstenberger, R., Gi-aninazzi, L., Gajda, J., Lehmann, T., Podstawski, M., Niewiadomski, H., Nczyk, P., et al. Graph of thoughts: Solving elaborate problems with large language models. arXiv preprint arXiv:2308.09687, 2023. +Brown, T., Mann, B., Ryder, N., Subbiah, M., Kaplan, J. D., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. Language models are few-shot learners. Advances in Neural Information Processing Systems (NeurIPS), 33:1877-1901, 2020. +Chen, J., Lin, S.-t., and Durrett, G. Multi-hop question answering via reasoning chains. arXiv preprint arXiv:1910.02610, 2019. +Chen, W., Ma, X., Wang, X., and Cohen, W. W. Program of thoughts prompting: Disentangling computation from reasoning for numerical reasoning tasks. Transactions on Machine Learning Research, 2023. +Chowdhery, A., Narang, S., Devlin, J., Bosma, M., Mishra, G., Roberts, A., Barham, P., Chung, H. W., Sutton, C., Gehrmann, S., et al. Palm: Scaling language modeling with pathways. Journal of Machine Learning Research, 24(240):1-113, 2023. +Cobbe, K., Kosaraju, V., Bavarian, M., Chen, M., Jun, H., Kaiser, L., Plappert, M., Tworek, J., Hilton, J., Nakano, R., et al. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021. +Drori, I., Zhang, S., Shuttleworth, R., Tang, L., Lu, A., Ke, E., Liu, K., Chen, L., Tran, S., Cheng, N., et al. A neural network solves, explains, and generates university math problems by program synthesis and few-shot learning at human level. Proceedings of the National Academy of Sciences, 119(32):e2123433119, 2022. + +Falahatgar, M., Orlitsky, A., Pichapati, V., and Suresh, A. T. Maximum selection and ranking under noisy comparisons. In Proceedings of the 34th International Conference on Machine Learning (ICML), pp. 1088-1096, 2017. +Kadavath, S., Conerly, T., Askell, A., Henighan, T., Drain, D., Perez, E., Schiefer, N., Dodds, Z. H., DasSarma, N., Tran-Johnson, E., et al. Language models (mostly) know what they know. arXiv preprint arXiv:2207.05221, 2022. +Kuhn, L., Gal, Y., and Farquhar, S. Semantic uncertainty: Linguistic invariances for uncertainty estimation in natural language generation. In Proceedings of the 11th International Conference on Learning Representations (ICLR), 2022. +Ling, W., Yogatama, D., Dyer, C., and Blunsom, P. Program induction by rationale generation: Learning to solve and explain algebraic word problems. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (ACL), pp. 158-167, 2017. +Liu, N. F., Lin, K., Hewitt, J., Paranjape, A., Bevilacqua, M., Petroni, F., and Liang, P. Lost in the middle: How language models use long contexts. Transactions of the Association for Computational Linguistics, 12:157-173, 2024. +Long, J. Large language model guided tree-of-thought. arXiv preprint arXiv:2305.08291, 2023. +Lu, Y., Bartolo, M., Moore, A., Riedel, S., and Stenetorp, P. Fantastically ordered prompts and where to find them: Overcoming few-shot prompt order sensitivity. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (ACL), pp. 8086-8098, 2022. +Madaan, A., Tandon, N., Gupta, P., Hallinan, S., Gao, L., Wiegreffe, S., Alon, U., Dziri, N., Prabhumoye, S., Yang, Y., et al. Self-refine: Iterative refinement with self-feedback. Advances in Neural Information Processing Systems (NeurIPS), 36:pages to appear, 2023. +Northcutt, C. G., Jiang, L., and Chuang, I. L. Confident learning: Estimating uncertainty in dataset labels. Journal of Artificial Intelligence Research, 70:1373-1411, 2021. +Paul, D., Ismayilzada, M., Peyrard, M., Borges, B., Bosselut, A., West, R., and Faltings, B. Refiner: Reasoning feedback on intermediate representations. In Proceedings of the 18th Conference of the European Chapter of the Association for Computational Linguistics (EACL), pp. 1100-1126, 2024. + +Rae, J. W., Borgeaud, S., Cai, T., Millican, K., Hoffmann, J., Song, F., Aslanides, J., Henderson, S., Ring, R., Young, S., et al. Scaling language models: Methods, analysis & insights from training gopher. arXiv preprint arXiv:2112.11446, 2021. +Srivastava, A., Rastogi, A., Rao, A., Shoeb, A. A. M., Abid, A., Fisch, A., Brown, A. R., Santoro, A., Gupta, A., Garriga-Alonso, A., et al. Beyond the imitation game: Quantifying and extrapolating the capabilities of language models. Transactions on Machine Learning Research, 2023. +Vapnik, V. Principles of risk minimization for learning theory. Advances in Neural Information Processing Systems, 4, 1991. +Wang, X., Wei, J., Schuurmans, D., Le, Q. V., Chi, E. H., Narang, S., Chowdhery, A., and Zhou, D. Self-consistency improves chain of thought reasoning in language models. In Proceedings of the 11th International Conference on Learning Representations (ICLR), 2022. +Wei, J., Wang, X., Schuurmans, D., Bosma, M., Xia, F., Chi, E., Le, Q. V., Zhou, D., et al. Chain-of-thought prompting elicits reasoning in large language models. Advances in Neural Information Processing Systems (NeurIPS), 35: 24824-24837, 2022. +Xu, W., Deng, Y., Zhang, H., Cai, D., and Lam, W. Exploiting reasoning chains for multi-hop science question answering. In Findings of the Association for Computational Linguistics: EMNLP 2021, pp. 1143-1156, 2021. +Yao, S., Yu, D., Zhao, J., Shafran, I., Griffiths, T. L., Cao, Y., and Narasimhan, K. Tree of thoughts: Deliberate problem solving with large language models. Advances in Neural Information Processing Systems (NeurIPS), 36: 11809-11822, 2023. +Yue, Y., Broder, J., Kleinberg, R., and Joachims, T. The k-armed dueling bandits problem. Journal of Computer and System Sciences, 78(5):1538-1556, 2012. +Zhou, Z.-H. Learnability with time-sharing computational resource concerns. arXiv preprint arXiv:2305.02217, 2024. + +# A. Implementation Details + +In this section, we provide implementation details for all experiments, focusing primarily on the design of the thought generation and comparison prompts for each task. + +# A.1. Question Answering + +Thought Generator. We use a zero-shot prompt. For each question, we use the same prompt multiple times to generate a specified number of different new thoughts. + +```txt +Prompt = 'Here is a question. You should work on it step by step. Your answer must be only the alphabet of your choice and begin with _____. For example: ____A, which should be at the last line. Q: {question}' +``` + +Comparison Prompt. We use multiple different prompts to generate the comparison result at each round. For the QA problem, we use three different prompts. We evaluate the same thought three times by using each prompt once and take the majority as the answer. + +```txt +Prompt 1 = 'You should judge which of the two analysis is better. You must only reply 1 or 2. +1: {input_1} +2: {input_2}' +Prompt 2 = 'Find out which of the two analysis is better. You must only reply 1 or 2. +1: {input_1} +2: {input_2}' +Prompt 3 = 'Compare the two analysis and find which is better. You must only reply 1 or 2. +1: {input_1} +2: {input_2}' +``` + +# A.2. Game of 24 + +Thought Generator. In this experiment, we use prompts similar to the ToT experiment to generate thoughts. There are two prompts: one is to select two numbers from the remaining list for the next step in the 24-point calculation, and then to add the newly obtained number back into the remaining list of numbers. The other is to generate the total operation formula that results in 24, based on all previous steps, when only one number remains. Both prompts are few-shot. + +```txt +Prompt 1 = 'You should choose two of the input numbers and use basic arithmetic operations (+ - * /) to obtain a new number. The new number should replace those two input numbers. Give me at least 6 possible next steps. +Input: 2 8 8 14 +Possible next steps: +2 + 8 = 10 (left: 8 10 14) +8 / 2 = 4 (left: 4 8 14) +14 + 2 = 16 (left: 8 8 16) +2 * 8 = 16 (left: 8 14 16) +8 - 2 = 6 (left: 6 8 14) +14 - 8 = 6 (left: 2 6 8) +14 / 2 = 7 (left: 7 8 8) +14 - 2 = 12 (left: 8 8 12) +Input: {input} +Possible next steps: +``` + +```txt +Prompt 2 = 'Use numbers and basic arithmetic operations (+ - * /) to obtain 24. Each step, you are only allowed to choose two of the remaining numbers to obtain a new number. +``` + +```txt +Input: 4 4 6 8 +Steps: +4 + 8 = 12 (left: 4 6 12) +6 - 4 = 2 (left: 2 12) +2 * 12 = 24 (left: 24) +Answer: (6 - 4) * (4 + 8) = 24 +Input: 2 9 10 12 +Steps: +12 * 2 = 24 (left: 9 10 24) +10 - 9 = 1 (left: 1 24) +24 * 1 = 24 (left: 24) +Answer: (12 * 2) * (10 - 9) = 24 +Input: {input} +``` + +Comparison Prompt. We use multiple different prompts to generate the comparison result at each round. For the 24 problem, we use three different prompts. All prompts are few-shot. We evaluate the same thought three times by using each prompt once and take the majority as the answer. + +```txt +Prompt 1 = 'I will give you two groups of numbers. The evaluation criteria is if using all of the given numbers with basic arithmetic operations (+ - * /) can reach 24. You should compare the two inputs and decide which input is better. You should only reply 1 or 2. +input_1: 2 12 +2 * 12 = 24 +input_2: 11 12 +all arithmetic operations can't get 24 +Answer: 1 +input_1: 1 2 4 +too small +input_2: 3 8 +3 * 8 = 24 +Answer: 2 +input_1: 1 12 11 +1 + 12 + 11 = 24 +input_2: 12 12 +12 + 12 = 24 +Both can reach 24, randomly select one +Answer: 1 +input_1: {input_1} +input_2: {input_2} +Answer: ' +``` + +```javascript +Prompt 2 = 'I will give you two groups of numbers. Tell me which input is better. The better one is more possible to reach 24 by using all of the given numbers with basic arithmetic operations (+ - * /). You should only reply 1 or 2. //same examples input_1: {input_1} input_2: {input_2} Answer: ' +``` + +```txt +Prompt $3 =$ 'Here are two groups of numbers. Tell me which input is more possible to use all of the given numbers with basic arithmetic operations (+ - * /) to get 24. You should only reply 1 or 2. Don't add any explanation. //same examples +``` + +```txt +input_1: {input_1} +input_2: {input_2} +Answer: +``` + +# A.3. Sudoku Puzzle + +Thought Generator. We use the following prompt to generate thoughts. + +```txt +Prompt = 'This is a {puzzle_size}x{puzzle_size} two-dimensional array represents a matrix, where some numbers are already given, and '\*' represents the numbers that need to be filled in. You should pick 1 or 2 '\*' to fill in a number between 1 to {puzzle_size}. Don't change the given number. Don't complete the whole puzzle immediately until there is only 1 or 2 '\*' left to be filled in. Your answer should just be the same format as the question below. When you answer, begin with \*\*\*. For example: \*\*\*[1, *, *], [*, 1, *], [*, 2, *]] Question: {question}' +``` + +Comparison Prompt. We use multiple different prompts to generate the comparison result at each round. For the Sudoku problem, we use three different prompts. All prompts are zero-shot. + +```txt +Prompt 1 = 'You should judge which of the two two-dimensional array better represents a {puzzle_size}x{puzzle_size} Sudooku puzzle. ' $\star$ ' means the value is yet to be decided. You should judge by considering if in each row or column 1 to {puzzle_size} could appear and only appear once. You must only reply 1 or 2. +1:{input_1} +2:{input_2}' +``` + +```txt +Prompt 2 = 'Find which of the two two-dimensional array better represents a { puzzle_size}x{puzzle_size} Sudoku puzzle. '\* means the value hasn't been decided. The better one should satisfy that in each row or column 1 to { puzzle_size} could appear and only appear once. You must only reply 1 or 2. 1:{input_1} 2:{input_2}' +``` + +```txt +Prompt 3 = 'Which of the two two-dimensional array better represents a { puzzle_size}x{puzzle_size} Sudooku puzzle? ' means the value is yet to be decided. A better one means in each row or column 1 to {puzzle_size} could appear and only appear once. You must only reply 1 or 2. 1:{input_1} 2:{input_2}' +``` + +# B. Proofs + +We first introduce the following lemma before our main proof. + +Lemma 2 (Lemma 2 in (Falahatgar et al., 2017)). Let $\widetilde{p}(i,j) = p(i,j) - 1/2$ be the additional probability by which $i$ is preferable to $j$ . Let $z^*$ be the maximum in $Z$ and $k^*$ be the comparison winner. The comparison algorithm on set $Z$ uses $\frac{|Z|}{4\varepsilon^2} \log \frac{2}{\delta}$ comparisons and with probability $\geq 1 - \delta$ , + +$$ +\widetilde {p} (z ^ {*}, k ^ {*}) \leq \gamma \varepsilon . +$$ + +Proof of Lemma 2. To make this paper self-contained, we provide the proofs in (Falahatgar et al., 2017) here. First, we prove that the probability of the direct pairwise comparison process providing a wrong winner is less than $\delta$ . Let $\widehat{p}_i^r$ and $\widehat{c}^r$ + +denote $\widehat{p}_i$ and $\widehat{c}$ respectively after $r$ number of comparisons. The output of the pairwise comparison will not be $i$ only if $\widehat{p}_i^r < \frac{1}{2} + \varepsilon - \widehat{c}^r$ for any $r < m = \frac{1}{2\varepsilon^2} \log \frac{2}{\delta}$ or if $\widehat{p}_i < \frac{1}{2}$ for $r = m$ . + +Considering the first case, after $r$ comparisons, by Chernoff bound, + +$$ +\operatorname * {P r} (\widehat {p} _ {i} ^ {r} < \frac {1}{2} + \varepsilon - \widehat {c} ^ {r}) \leq e ^ {- 2 r (\widehat {c} ^ {r}) ^ {2}} = e ^ {- \log \frac {4 r ^ {2}}{\delta}} = \frac {\delta}{4 r ^ {2}}. +$$ + +Using union bound, + +$$ +\Pr (\exists r \mathrm {s . t .} \widehat {p} _ {i} ^ {r} \leq \frac {1}{2} + \varepsilon - \widehat {c} ^ {r}) \leq \frac {\delta}{2}. +$$ + +Considering the second case, after $m = \frac{1}{2\varepsilon^2}\log \frac{2}{\delta}$ rounds, by Chernoff bound, + +$$ +P r \left(\widehat {p} _ {i} ^ {m} < \frac {1}{2}\right) \leq e ^ {- 2 m \varepsilon^ {2}} = \frac {\delta}{2}. \tag {1} +$$ + +Thus, the probability of each of these events happening is bounded by $\frac{\delta}{2}$ , and thus the probability of the pairwise comparison process providing a wrong winner is less than $\delta$ . + +As each of the $|Z|/2$ pairs is compared at most $\frac{1}{2\varepsilon^2}\log \frac{2}{\delta}$ times, the total comparisons is less than $\frac{|Z|}{4\varepsilon^2}\log \frac{2}{\delta}$ . Let $k^*$ be the comparison winner and $z^*$ be the maximum in $Z$ . Let $a$ be the element paired with $z^*$ . There are two cases: $\widetilde{p}(z^*, a) \geq \varepsilon$ and $\widetilde{p}(z^*, a) < \varepsilon$ . + +If $\widetilde{p}(z^*, a) \geq \varepsilon$ , by Eqn. (1) with probability $\geq 1 - \delta$ , $z^*$ will win and hence by definitions of $z^*$ and $k^*$ , $\widetilde{p}(z^*, k^*) = 0 \leq \gamma \varepsilon$ . Alternatively, if $\widetilde{p}(z^*, a) < \varepsilon$ , let winner $(i, j)$ denote the winner between $i$ and $j$ when compared for $\frac{1}{2\varepsilon^2} \log \frac{1}{\delta}$ times. Then, + +$$ +r (a) \stackrel {(a)} {\leq} r (\operatorname {w i n n e r} (z ^ {*}, a)) \stackrel {(b)} {\leq} r (k ^ {*}) \stackrel {(c)} {\leq} r (z ^ {*}) +$$ + +where (a) follows from $r(a)\leq r(z^{*})$ , (b) and (c) follow from the definitions of $z^{*}$ and $k^{*}$ respectively. From strong stochastic transitivity on $a,k^{*}$ and $z^{*},\widetilde{p} (z^{*},k^{*})\leq \gamma \widetilde{p} (z^{*},a)\leq \gamma \varepsilon .$ + +Now we begin to prove Lemma 1. + +Proof of Lemma 1. To make this paper self-contained, we also provide the proofs in (Falahatgar et al., 2017) here. We first show that with probability $\geq 1 - \delta$ , the output of Knockout is an $\varepsilon$ -maximum. Let $\varepsilon_{i} = c\varepsilon / 2^{i/3}$ and $\delta_{i} = \delta / 2^{i}$ . Note that $\varepsilon_{i}$ and $\delta_{i}$ are bias and confidence values used in round $i$ . Let $b_{i}$ be a maximum element in the set $Z$ before round $i$ . Then by Lemma 2, with probability $\geq 1 - \delta_{i}$ , + +$$ +\widetilde {p} \left(b _ {i}, b _ {i + 1}\right) \leq \frac {c \varepsilon}{2 ^ {i / 3}}. \tag {2} +$$ + +By union bound, denote by $p'$ the probability that Eqn. (2) does not hold for some round $1 \leq i \leq \log |Z|$ , then we have + +$$ +p ^ {\prime} \leq \sum_ {i = 1} ^ {\log | Z |} \delta_ {i} = \sum_ {i = 1} ^ {\log | Z |} \frac {\delta}{2 ^ {i}} \leq \delta . +$$ + +With probability $\geq 1 - \delta$ , Eqn. (2) holds for all $i$ and by stochastic triangle inequality, + +$$ +\widetilde {p} \left(b _ {1}, b _ {\log | Z | + 1}\right) \leq \sum_ {i = 1} ^ {\log | Z |} \widetilde {p} \left(b _ {i}, b _ {i + 1}\right) \leq \sum_ {i = 1} ^ {\infty} \frac {c \varepsilon}{2 ^ {i / 3}} = \varepsilon . +$$ + +We now bound the number of comparisons. Let $n_i = \frac{|Z|}{2^{i-1}}$ be the number of elements in the set at the beginning of round $i$ . Denote by $\mathrm{NC}_i$ the number of comparisons at round $i$ , then we have + +$$ +\mathrm {N C} _ {i} \leq \frac {n _ {i}}{2} \cdot \frac {\gamma^ {2} 2 ^ {2 i / 3}}{2 c ^ {2} \varepsilon^ {2}} \cdot \log \frac {2 ^ {i + 1}}{\delta}. +$$ + +Hence the number of comparisons in all rounds is + +$$ +\begin{array}{l} \sum_ {i = 1} ^ {\log | Z |} \frac {| Z |}{2 ^ {i}} \cdot \frac {\gamma^ {2} 2 ^ {2 i / 3}}{2 c ^ {2} \varepsilon^ {2}} \cdot \log \frac {2 ^ {i + 1}}{\delta} \leq \frac {| Z | \gamma^ {2}}{2 c ^ {2} \varepsilon^ {2}} \sum_ {i = 1} ^ {\infty} \frac {1}{2 ^ {i / 3}} \left(i + \log \frac {2}{\delta}\right) \\ = \frac {| Z | \gamma^ {2}}{2 c ^ {2} \varepsilon^ {2}} \left(\frac {2 ^ {1 / 3}}{c ^ {2}} + \frac {1}{c} \log \frac {2}{\delta}\right) = \mathcal {O} \left(\frac {| Z | \gamma^ {2}}{\varepsilon^ {2}} \log \frac {1}{\delta}\right). \\ \end{array} +$$ + +![](images/d54803f95fb1ea2c0f28755c47623e52814f84650300d44c061d2b129ac7c002.jpg) + +Now we begin to prove Proposition 1. + +Proof of Proposition 1. In each round of comparison, according to Lemma 1, we have the probability of $1 - \delta$ to output the $\varepsilon$ -maximum thoughts. Suppose that the thoughts in the shallower layers are more promising than those in the deeper ones, which is often the case in step-by-step reasoning tasks. For example, $r([{\bf z}_j^1])\geq r([{\bf z}_i^1,{\bf z}^2 ])$ for $j\in [K],i\notin [K]$ , and $\mathbf{z}^2\in Z^2$ . When generating the intermediate thoughts in the $\tau$ -th layer, the probability that the $\varepsilon$ -maximum thoughts are not selected is $1 - \delta^{\tau}$ . + +Therefore, the probability of missing the $\varepsilon$ -maximum promising thoughts in the $\tau$ -th layer is $1 - \delta^{\tau}$ with at most $\mathcal{O}\left(\frac{\gamma^2\sum_{i=1}^{T}|Z^i|}{\varepsilon^2}\log \frac{1}{\delta}\right)$ comparisons required for generating the tree. + +# C. Additional Experimental Results + +# C.1. Experimental Results Summary + +First, we present a summary of the experimental results. + +We introduce three additional QA datasets—Gsm8k (Cobbe et al., 2021), Coin Flip (OOD) (Wei et al., 2022), and BBH (Srivastava et al., 2023)—along with two more state-of-the-art algorithms for comparison, with implementation details provided below. + +Contenders. PoT (Chen et al., 2023): PoT requires in-context samples to guide LLMs generating Python code step-by-step, and the number of samples is a hyperparameter. Since SToT and C-ToT do not always require such samples, we choose appropriate number of samples in PoT to maintain experimental consistency with other methods. We use one in-context sample for all datasets expecting Game of 24, which uses 3 samples. + +Self-Refine (Madaan et al., 2023): The parameter of in Self-Refine is the number of iterations of Self-Refine. For each task, we set the number of iterations to 3 so that the number of tokens used is approximately the same. We use the same template as in the original paper and set the number of in-context examples to the same as in the PoT. + +We can observe in Table 4 that the proposed C-ToT (Stand.) and C-ToT (Duel.) algorithms achieve the best performance in almost all tasks. The Self-Refine also achieves promising results in QA tasks, while it performs relatively poorly compared to the SToT and C-ToT algorithms in complex tasks that require step-by-step interaction and reasoning, such as Game of 24. + +
Method / DataGsm8kCoin flip (OOD)BBHAQuAGame of 24Sudoku
CoT68.8 ± 2.556.3 ± 2.167.7 ± 2.642.3 ± 2.54.3 ± 3.244.4 ± 2.3
SToT59.3 ± 2.462.1 ± 2.969.6 ± 2.057.1 ± 2.134.3 ± 3.960.0 ± 3.8
PoT62.2 ± 3.371.1 ± 2.866.7 ± 2.347.5 ± 4.527.2 ± 3.743.1 ± 3.9
Self-Refine67.6 ± 3.264.8 ± 1.669.2 ± 3.756.2 ± 4.116.3 ± 3.952.3 ± 3.0
C-ToT (Stand.)71.3 ± 3.366.2 ± 2.875.7 ± 1.961.4 ± 2.940.0 ± 4.674.4 ± 2.1
C-ToT (Duel.)73.0 ± 2.770.4 ± 2.180.0 ± 2.263.0 ± 2.641.0 ± 3.075.4 ± 3.3
+ +Table 4: Performance comparisons on benchmark datasets. On each dataset, 5 test runs were conducted and the average accuracy as well as standard deviation are presented, and the best one is emphasized in bold. + +Our method is generally not comparable to GoT (Besta et al., 2023), but the idea of comparison can improve GoT. The GoT divides a complex task into several subtasks, generate thoughts for each subtask and merge them, while the ToT-style + +methods aim at step-by-step thinking, where the new generated thought is based on previous ones, so it is hard to split or merge. Thus, they are better suited for different tasks. For example, for sorting, we can divide it into subtasks; while for the Game of 24, the answer should be generated based on previous thoughts, so C-ToT is more proper. + +We can use the idea of comparison to improve the solving of subtasks, so we can subsequently improve the GoT. The following is a preliminary study of the sorting task in the GoT paper, remaining all its setups, and comparing the performance with scoring mechanism by LLM and the pairwise comparison mechanism by LLM in subtasks. Accuracy and token usage are reported as in Table 5. 5 test runs were conducted and the average accuracy and the number of tokens (completion tokens / prompt tokens) are reported. + +
Data / MethodS-GoTC-GoT
32 elements90.4%; 1232/1272690.5%; 1217/14969
64 elements86.1%; 2592/3111886.6%; 2356/35313
+ +# C.2. Cost and Efficiency + +In Table 6, 7 and 8, we report the token cost and average accuracy comparison of our proposed approaches with other contenders. 5 test runs were conducted and the average accuracy and the number of tokens (completion tokens / prompt tokens) are reported. + +We can observe that the token costs of our proposed C-ToT approaches and the contenders are task-specific and generally incomparable. Since we preserve all previous intermediate thoughts in the QA task, the token cost of the C-ToT approaches is higher than that of the S-ToT algorithm, but the performance is simultaneously improved. In the QA and Game of 24, the token costs of the Comp-SToT and S-ToT approaches are comparable, but the Comp-SToT approaches achieve better average accuracy. In the Sudoku puzzle, the token cost of Comp-SToT is lower than that of S-ToT. These results indicate the effectiveness of using the direct pairwise comparison approach to find the most promising intermediate thoughts. In practice, we can further reduce the token cost by using a counter for each intermediate thought to track its comparison frequency. If the comparison count of an intermediate thought exceeds a threshold, we can remove it from the tree. + +Table 5: Performance comparisons with GoT. + +
MethodGenerate/Prompt tokensCost per caseAccuracy
CoT106/1360.000342.3%
SC-CoT1647/20230.005458.4%
SToS1551/54150.008557.1%
SC-SToS2081/134590.01857.6%
Comp-SToS1515/62990.009359.0%
Back-SToS1551/81350.01158.0%
C-ToT (Stand.)1498/146270.01761.4%
C-ToT (Duel.)1649/520440.05563.0%
+ +Table 6: Average accuracy of different methods with token costs on QA. + +
MethodGenerate/Prompt tokensCost per caseAccuracy
CoT99/4370.00064.3%
SC-CoT1717/65550.0108.0%
SToS1368/122050.01534.3%
SC-SToS2284/408250.04540.0%
Comp-SToS1309/119630.01536.3%
Back-SToS1679/231780.02739.0%
C-ToT (Stand.)2452/210030.02640.0%
C-ToT (Duel.)2174/605780.06541.0%
+ +Table 7: Average accuracy of different methods with token costs on Game of 24. + +
MethodGenerate/Prompt tokensCost per caseAccuracy
CoT431/1780.00144.4%
SC-CoT6292/26660.01547.8%
SToS6309/239330.03760.0%
SC-SToS6568/701290.08366.7%
Comp-SToS2666/131640.01965.6%
Back-SToS4536/213830.03072.2%
C-ToT (Stand.)5340/295650.04074.4%
C-ToT (Duel.)7148/864250.10175.5%
+ +# C.3. Ablation Studies + +We report the ablation studies on Aqua dataset, while we also observe the same trend in other datasets. 5 test runs were conducted and the average accuracy and the number of tokens (completion tokens / prompt tokens) are reported. + +We study the number of intermediate thoughts generated and selected in each round and report the results in Table 9. With a fixed number of thoughts generated each round, selecting more thoughts leads to higher costs, while accuracy may not benefit much. With a fixed number of thoughts selected each round, generating more thoughts leads to a significant increase in accuracy because we can explore more thoughts. These results could benefit the further use of CoT methods. + +Table 8: Average accuracy of different methods with token costs on Sodomoku. + +
Generate m / Select KK = 1K = 2K = 3K = 5K = 6
m = 141.6%; 50/515----
m = 346.7%; 139/152550.2%; 244/256549.8%; 375/3658--
m = 550.1%; 288/265353.5%; 495/445255.0%; 549/594554.8%; 882/9379-
m = 1053.0%; 518/518956.6%; 896/871657.3%; 1091/1187557.5%; 2120/1947357.6%; 2155/20982
m = 1253.8%; 674/633457.4%; 1212/1073261.4%; 1498/1462761.4%; 1531/1600261.5%; 2125/26329
+ +We study the threshold for removing intermediate thoughts vs. accuracy and cost and report the results in Table 10. Under the same tree depth, different thresholds show relatively stable performance. + +Table 9: Ablation studies on parameters. + +
Depth d / Threshold ThTh= 1Th= 2Th= 3Th= 4Th= 5
d = 358.0%; 1062/1133760.7%; 1315/1361161.0%; 1478/1511161.4%; 1513/1571361.4%; 1558/16107
d = 458.8%; 1426/1379260.9%; 1732/1882261.4%; 1771/1994061.6%; 1804/2000361.3%; 2001/20312
d = 560.0%; 1760/1755661.0%; 2143/2100661.6%; 2271/2341261.7%; 2265/2403161.3%; 2425/24755
+ +We study the number of comparison and report the results in Table 11. In general, increasing the number of comparison results in better accuracy and higher cost. + +Table 10: Ablation studies on the number of thresholds for removing intermediate thoughts. + +
Dataset / Comparison nn = 1n = 3n = 5n = 8
Aqua61.4%; 1498/1462763.0%; 1649/5204464.3%; 1824/7819464.7%; 1997/128802
+ +Table 11: Ablation studies on the number of comparisons. \ No newline at end of file diff --git a/generatingchainofthoughtswithapairwisecomparisonapproachtosearchingforthemostpromisingintermediatethought/images.zip b/generatingchainofthoughtswithapairwisecomparisonapproachtosearchingforthemostpromisingintermediatethought/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..ab22e3a8ff8ecc35405031eeac7ac3d19252747b --- /dev/null +++ b/generatingchainofthoughtswithapairwisecomparisonapproachtosearchingforthemostpromisingintermediatethought/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9cf6b7a722bb928d5007dc9655dd656d598336d8a673c9a7acbbd0a605d93670 +size 513154 diff --git a/generatingchainofthoughtswithapairwisecomparisonapproachtosearchingforthemostpromisingintermediatethought/layout.json b/generatingchainofthoughtswithapairwisecomparisonapproachtosearchingforthemostpromisingintermediatethought/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..c3e973344489cbd06d3ad18bb35f119c2e0d032d --- /dev/null +++ b/generatingchainofthoughtswithapairwisecomparisonapproachtosearchingforthemostpromisingintermediatethought/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:abc310e0ce3abfd3d72d8fd1fa06851c92d3570daaffabf953703e1041f0cf5e +size 641849 diff --git a/generatingindistributionproxygraphsforexplaininggraphneuralnetworks/b1c1dde9-3628-4002-883d-f75c6eaa951f_content_list.json b/generatingindistributionproxygraphsforexplaininggraphneuralnetworks/b1c1dde9-3628-4002-883d-f75c6eaa951f_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..b4226576b1d86f7b9ab29c80b610673fd074f84b --- /dev/null +++ b/generatingindistributionproxygraphsforexplaininggraphneuralnetworks/b1c1dde9-3628-4002-883d-f75c6eaa951f_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e2511ba3757a33b589f192dd9836e143e702a53143b45ef5e6e79e89d3985022 +size 134682 diff --git a/generatingindistributionproxygraphsforexplaininggraphneuralnetworks/b1c1dde9-3628-4002-883d-f75c6eaa951f_model.json b/generatingindistributionproxygraphsforexplaininggraphneuralnetworks/b1c1dde9-3628-4002-883d-f75c6eaa951f_model.json new file mode 100644 index 0000000000000000000000000000000000000000..7fd8094992f4c15bdf08c2378371d1962d97a1ae --- /dev/null +++ b/generatingindistributionproxygraphsforexplaininggraphneuralnetworks/b1c1dde9-3628-4002-883d-f75c6eaa951f_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aa43c99b90cb7f437111d89268dfb2f31fbc495a8b00f6fe6866ef381f328d74 +size 161796 diff --git a/generatingindistributionproxygraphsforexplaininggraphneuralnetworks/b1c1dde9-3628-4002-883d-f75c6eaa951f_origin.pdf b/generatingindistributionproxygraphsforexplaininggraphneuralnetworks/b1c1dde9-3628-4002-883d-f75c6eaa951f_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..5b96994192600bd32f611d35847075362fd75447 --- /dev/null +++ b/generatingindistributionproxygraphsforexplaininggraphneuralnetworks/b1c1dde9-3628-4002-883d-f75c6eaa951f_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d5286ef35b75682f68ecb02ae79c44145cad689fe6a5a5d6677c65488e789405 +size 7220539 diff --git a/generatingindistributionproxygraphsforexplaininggraphneuralnetworks/full.md b/generatingindistributionproxygraphsforexplaininggraphneuralnetworks/full.md new file mode 100644 index 0000000000000000000000000000000000000000..02a2c310bbd16f6d579a64912d9c73b49a5dddb3 --- /dev/null +++ b/generatingindistributionproxygraphsforexplaininggraphneuralnetworks/full.md @@ -0,0 +1,616 @@ +# Generating In-Distribution Proxy Graphs for Explaining Graph Neural Networks + +Zhuomin Chen1 Jiaxing Zhang2 Jingchao Ni3 Xiaoting Li4 Yuchen Bian5 Md Mezbahul Islam1 Ananda Mohan Mondal1 Hua Wei6 Dongsheng Luo1 + +# Abstract + +Graph Neural Networks (GNNs) have become a building block in graph data processing, with wide applications in critical domains. The growing needs to deploy GNNs in high-stakes applications necessitate explainability for users in the decision-making processes. A popular paradigm for the explainability of GNNs is to identify explainable subgraphs by comparing their labels with the ones of original graphs. This task is challenging due to the substantial distributional shift from the original graphs in the training set to the set of explainable subgraphs, which prevents accurate prediction of labels with the subgraphs. To address it, in this paper, we propose a novel method that generates proxy graphs for explainable subgraphs that are in the distribution of training data. We introduce a parametric method that employs graph generators to produce proxy graphs. A new training objective based on information theory is designed to ensure that proxy graphs not only adhere to the distribution of training data but also preserve explanatory factors. Such generated proxy graphs can be reliably used to approximate the predictions of the labels of explainable subgraphs. Empirical evaluations across various datasets demonstrate our method achieves more accurate explanations for GNNs. + +![](images/6a40a0d06ee56ad842055a3afd0a568e6b47952aaaeb56d6c4b0b255e5fc6eef.jpg) +(a) Explanation process + +![](images/96f242702dbafcf6c606056c5b47bf3dffbed85cc9db43c38b3734ac5920aa6c.jpg) +(b) OOD problem +Figure 1. Examples of the explanation process and out-of-distribution problem. (a) is the explanation process for a graph learning model. The original graph $G$ undergoes an explanation process, resulting in an explanation graph $G'$ that highlights the most significant features and relationships; (b) shows the explanation graph $G'$ is out of distribution where the GNN is trained. + +# 1. Introduction + +Graph Neural Networks (GNNs) have emerged as a pivotal technology for handling graph-structured data, demonstrating remarkable performance in various applications including node classification and link prediction (Kipf & Welling, 2017; Hamilton et al., 2017; Velicković et al., 2018; Scarselli et al., 2008). Their growing use in critical sectors such as healthcare and fraud detection has escalated the need for explainability in their decision-making processes (Wu et al., 2022; Li et al., 2022; Zhang et al., 2024). To meet this demand, a variety of explanation methods have been recently developed to interpret the behavior of GNN models. These methods primarily concentrate on identifying a subgraph that significantly impacts the model's prediction for a particular instance (Ying et al., 2019; Luo et al., 2020). + +A prominent approach to explain GNNs involves the Graph Information Bottleneck (GIB) principle (Wu et al., 2020). This principle focuses on extracting a compact yet informative subgraph from the input graph, ensuring that this subgraph retains sufficient information for the model to maintain its original prediction. A key aspect of the GIB approach is evaluating the predictive capability of such a subgraph. Typically, this is accomplished by feeding the subgraph into the GNN model and comparing its prediction against that of the complete input graph. + +Although it is intuitively correct, the underlying assumption of the aforementioned approach - GNN model can + +make accurate predictions on explanation subgraphs – may not always hold. As shown in Figure 1, explanation subgraphs can significantly deviate from the distribution of original graphs, leading to an Out-Of-Distribution (OOD) issue (Zhang et al., 2023b; Fang et al., 2023c;a; Zheng et al., 2024). For instance, in the MUTAG dataset (Debnath et al., 1991), each graph represents a molecule, with nodes symbolizing atoms and edges indicating chemical bonds. The molecular graphs in this dataset usually contain hundreds of edges. In contrast, the $NO_2$ functional group, identified as a key subgraph influencing positive mutagenicity in a molecule, comprises merely 2 edges. This stark contrast in structural properties leads to a significant difference in the distributions of explanation subgraphs and original graphs. Since the model was trained with original graphs, the reliability of predictions on subgraphs is undermined due to the distribution shifting problem. + +Several pioneering studies have attempted to address this distributional challenge (Fang et al., 2023c; Zhang et al., 2023b;a). For example, CGE regards the GNN model as a transparent, fully accessible system. It considers the GNN model as a teacher network and employs an additional "student" network to predict the labels of explanation subgraphs (Fang et al., 2023c). As another example, MixupExplainer (Zhang et al., 2023b) generates a mixed graph for the explanation by blending it with a non-explanatory subgraph from a different input graph. This method posits that the mixup graph aligns with the distribution of the original input graphs. However, this claim is predicated on a rather simplistic assumption that the explanation and non-explanatory subgraphs are independently drawn. However, in real-world applications, these methods often face practical limitations. The dependence on a "white box" model in CGE and the oversimplified assumptions in MixupExplainer are not universally applicable. Instead, GNN models are usually given as "black boxes", and the graphs in real-life applications do not conform to strict independence constraints, highlighting the need for more versatile and realistic approaches to the OOD problem. + +In response to these challenges, in this work, we introduce an innovative concept of proxy graphs to the realm of explainable GNNs. These proxy graphs are designed to be both explanation-preserving and distributionally aligned with the training data. By this means, the predictive capabilities of explanation subgraphs can be reliably inferred from the corresponding proxy graphs. We begin with a thorough investigation into the feasible conditions necessary for generating such in-distributed proxy graphs. Leveraging our findings, we further propose a novel architecture that incorporates variational graph auto-encoders to produce proxy graphs. Specifically, we utilize a graph auto-encoder to reconstruct the explainable subgraph and another variational auto-encoder to generate a non-explanatory subgraph. + +A proxy graph is then obtained by combining two output subgraphs of auto-encoders. We delineate our main contributions as follows: + +- We systematically analyze and address the challenge of the OOD issue in explainable GNNs, which is pivotal for enhancing the reliability and interpretability of GNNs in real-world applications. +- We introduce an innovative parametric method that incorporates graph auto-encoders to produce in-distributed proxy graphs that are both situated in the original data distribution and preserve essential explanation information. This facilitates more precise and interpretable explanations in GNN applications. +- Through comprehensive experiments on various real-world datasets, we substantiate the effectiveness of our proposed approach, showcasing its practical utility and superiority in producing explanations. + +# 2. Notations and Preliminary + +# 2.1. Notations and Problem Formulation + +We denote a graph $G$ from an graph set $\mathcal{G}$ by a triplet $(\mathcal{V},\mathcal{E};\boldsymbol {X})$ , where $\mathcal{V} = \{v_{1},v_{2},\dots,v_{n}\}$ is the node set and $\mathcal{E}\subseteq \mathcal{V}\times \mathcal{V}$ is the edge set. $\boldsymbol {X}\in \mathbb{R}^{n\times d}$ is the node feature matrix, where $d$ is the feature dimension and the $i$ -th row is the feature vector associated with node $v_{i}$ . The adjacency matrix of $G$ is denoted by $\pmb {A}\in \{0,1\}^{n\times n}$ , which is determined by the edge set $\mathcal{E}$ such that $A_{ij} = 1$ if $(v_{i},v_{j})\in \mathcal{E}$ , $A_{ij} = 0$ , otherwise. In this paper, we focus on the graph classification task, and node classification can be converted to computation graph classification problem (Ying et al., 2019; Luo et al., 2020). Specifically, for graph classification task, each graph $G$ is associated with a label $Y\in \mathcal{V}$ . The to-be-explained GNN model $f(\cdot)$ has been well-trained to classify $G$ into its class, i.e., $f:\mathcal{G}\mapsto \{1,2,\dots,|\mathcal{V}|\}$ . + +Following the existing works (Ying et al., 2019; Luo et al., 2020; Yuan et al., 2022; Huang et al., 2024), the explanation methods under consideration in this paper are model/task agnostic and treat GNN models as black boxes — i.e., the so-called post-hoc, instance-level explanation methods. Formally, our research problem is described as follows: + +Problem 1 (Post-hoc Instance-level GNN Explanation). Given a to-be-explained GNN model $f(\cdot)$ and a set of graphs $\mathcal{G}$ , the goal of post-hoc instance-level explanation is to learn a parametric function so that for an arbitrary graph $G \in \mathcal{G}$ , it finds a compact subgraph $G^{*} \subseteq G$ that can "explain" the prediction $f(G)$ . The parametric mapping $\Psi_{\psi}: \mathcal{G} \mapsto \mathcal{G}^{*}$ is called an explanation function, where $\mathcal{G}^{*}$ is the alphabet of $G^{*}$ , and $\psi$ is the parameter of the explanation function. + +# 2.2. Graph Information Bottleneck as the Objective Function + +The Information Bottleneck (IB) principle, foundational in learning dense representations, suggests that optimal representations should balance minimal and sufficient information for predictions (Tishby et al., 2000). This concept has been adapted for GNNs through the Graph Information Bottleneck (GIB) approach, consolidating various post-hoc GNN explanation methods like GNNExplainer (Ying et al., 2019) and PGExplainer (Luo et al., 2020). The GIB framework aims to find a subgraph $G^{*}$ to explain a GNN model's prediction on a graph $G$ as (Zhang et al., 2023b): + +$$ +G ^ {*} = \underset {G ^ {\prime}} {\arg \min } I (G, G ^ {\prime}) - \alpha I (Y, G ^ {\prime}), \tag {1} +$$ + +where $G'$ is a candidate explanatory subgraph, $Y$ is the label, and $\alpha$ is a balance parameter. The first term is the mutual information between the original graph $G$ and the explanatory subgraph $G'$ and the second term is negative mutual information of $Y$ and the explanatory subgraph $G'$ . At a high level, the first term encourages detecting a small and dense subgraph for explanation, and the second term requires that the explanatory subgraph is label preserving. + +Due to the intractability of mutual information between $Y$ and $G'$ in equation 1, some existing works (Wu et al., 2020; Miao et al., 2022) derived a parameterized variational lower bound of $I(Y, G')$ : + +$$ +I \left(Y, G ^ {\prime}\right) \geq \mathbb {E} _ {G ^ {\prime}, Y} \left[ \log P \left(Y \mid G ^ {\prime}\right) \right] + H (Y), \tag {2} +$$ + +where the first term measures how well the subgraphs predict the labels. A higher value indicates that the subgraphs are, on average, more predictive of the correct labels. The second term $H(Y)$ quantifies the amount of inherent unpredictability or variability in the labels. By introducing equation 2 to equation 1, a tractable upper bound is used as the objective: + +$$ +G ^ {*} = \underset {G ^ {\prime}} {\arg \min } I (G, G ^ {\prime}) - \alpha \mathbb {E} _ {G ^ {\prime}, Y} [ \log P (Y | G ^ {\prime}) ], \tag {3} +$$ + +where $H(Y)$ is omitted due to its independence to $G'$ . + +The OOD Problem in GIB. In the existing research, the estimation of $P(Y|G')$ is typically achieved by applying the to-be-explained model $f(\cdot)$ to the input graph $G'$ (Ying et al., 2019; Miao et al., 2022). A critical assumption in these approaches involves the GNN model's ability to accurately predict candidate explanation subgraphs $G'$ . This assumption, however, overlooks the OOD problem, where the distribution of explanation subgraphs significantly deviates from that of the original training graphs (Zhang et al., 2023b; Fang et al., 2023a;c;b; Zheng et al., 2024; Amara + +et al., 2023). Formally, let $P_{\mathcal{G}}$ be the distribution of the training graphs, and $P_{\mathcal{G}'}$ be the distribution of the explanation subgraphs. The core issue in the GIB objective function is caused by $P_{\mathcal{G}} \neq P_{\mathcal{G}'}$ . This distributional disparity undermines the predictive reliability of the model $f(\cdot)$ , trained on $P_{\mathcal{G}}$ when applied to subgraphs from $P_{\mathcal{G}'}$ . As a result, the predictive power of explanations provided by $f(G')$ is an unreliable approximation of $P(Y|G')$ in equation 3. + +# 3. Graph Information Bottleneck with Proxy Graphs + +In this section, we propose the concept of proxy graphs to mitigate the aforementioned OOD issue. A proxy graph not only retains the label information present in $G'$ but also conforms to the distribution of the original graph dataset. Specifically, we assume that proxy graphs $\tilde{G}$ are drawn from the distribution $P_{\mathcal{G}}$ and reformulate the estimation of $P(Y|G')$ by marginalizing over the distribution of proxy graphs as follows: + +$$ +P (Y | G ^ {\prime}) = \mathbb {E} _ {\tilde {G} \sim P _ {\mathcal {G}}} [ P (Y | \tilde {G}) \cdot P (\tilde {G} | G ^ {\prime}) ]. \tag {4} +$$ + +In equation 4, we address the OOD challenge by predicting $Y$ using a proxy graph $\tilde{G}$ instead of directly using $G'$ . This approach is particularly effective when the conditional probability $P(Y|\cdot)$ is approximated by the model $f(\cdot)$ . To facilitate the maximization of the likelihood as outlined in equation 4, we further approximate $P(\tilde{G}|G')$ with a parameterized function, denoted as $Q_{\phi}(\tilde{G}|G')$ . The formal representation is thus given by + +$$ +P \left(Y \mid G ^ {\prime}\right) = \mathbb {E} _ {\tilde {G} \sim P _ {\mathcal {G}}} \left[ P \left(Y \mid \tilde {G}\right) \cdot Q _ {\phi} \left(\tilde {G} \mid G ^ {\prime}\right) \right], \tag {5} +$$ + +where $\phi$ denotes model parameters. + +Given the combinatorial complexity inherent in graph structures, it is computationally infeasible to enumerate all potential proxy graphs $\tilde{G}$ from the unknown distribution $P_{\mathcal{G}}$ which is necessary for calculating equation 5. To overcome this challenge, we propose to approximate $P_{\mathcal{G}}$ with the parameterized function $Q_{\phi}(\tilde{G}|G')$ , and estimate equation 5 with a Monte Carlo estimator that samples proxy graphs from $Q_{\phi}(\tilde{G}|G')$ . That is + +$$ +P (Y | G ^ {\prime}) = \mathbb {E} _ {\tilde {G} \sim Q _ {\phi} (\tilde {G} | G ^ {\prime})} [ P (Y | \tilde {G}) ], \tag {6} +$$ + +with constraints + +$$ +Q _ {\phi} (\tilde {G} | G ^ {\prime}) \approx P _ {\mathcal {G}}, \quad H (Y | \tilde {G}) \approx H (Y | G ^ {\prime}), \tag {7} +$$ + +where the first constraint ensures that $\tilde{G}$ is sampled from a distribution that approximates $P_{\mathcal{G}}$ , effectively addressing the OOD challenge. The second constraint guarantees that the label information preserved in $\tilde{G}$ is similar to that in $G^{\prime}$ . + +Therefore, combining equation 3, equation 6 and equation 7, our proxy graph-induced objective function becomes: + +$$ +\begin{array}{l} \underset {G ^ {\prime}} {\arg \min } I (G, G ^ {\prime}) - \alpha \mathbb {E} _ {G ^ {\prime}, Y} [ \log \mathbb {E} _ {\tilde {G} \sim Q _ {\phi} (\tilde {G} | G ^ {\prime})} [ P (Y | \tilde {G}) ] ] \\ \text {s . t .} Q _ {\phi} (\tilde {G} \mid G ^ {\prime}) \approx P _ {\mathcal {G}}, H (Y | \tilde {G}) \approx H (Y \mid G ^ {\prime}). \tag {8} \\ \end{array} +$$ + +Bi-level optimization. In equation 8, we formulate a joint optimization loss function that aims to identify the optimal explanation alongside its corresponding proxy graphs. Building upon this, we refine the framework by replacing the first constraint with a distributional distance measure, specifically the Kullback-Leibler (KL) divergence, between $Q_{\phi}(\tilde{G}|G^{\prime})$ and $P_{\mathcal{G}}$ . This leads to the development of a bi-level optimization model. Formally, the model is expressed as follows: + +$$ +\begin{array}{l} \underset {G ^ {\prime}} {\arg \min } I (G, G ^ {\prime}) - \alpha \mathbb {E} _ {G ^ {\prime}, Y} [ \log \mathbb {E} _ {\tilde {G} \sim Q _ {\phi^ {*} (\tilde {G} | G ^ {\prime})}} [ P (Y | \tilde {G}) ] ] \\ \text{where}\phi^{*} = \operatorname *{arg min}_{\phi}\mathrm{KL}(Q_{\phi}(\tilde{G} |G^{\prime}),P_{\mathcal{G}}), \\ s. t. H (Y | \tilde {G}) \approx H (Y | G ^ {\prime}). \tag {9} \\ \end{array} +$$ + +# 3.1. Derivation of Outer Optimization + +For the outer optimization objective, we elaborate on instantiating the first term $I(G, G')$ . Akin to the original graph, we denote the explanation subgraph $G'$ by $(\mathcal{V}, \mathcal{E}', X)$ , whose adjacency matrix is $A'$ . We follow (Miao et al., 2022) to include a variational approximation distribution $R(G')$ for the distribution $P(G')$ . Then, we obtain its upper bound as follows: + +$$ +I (G, G ^ {\prime}) \leq \mathbb {E} _ {G} [ \mathrm {K L} (P (G ^ {\prime} | G) | | R (G ^ {\prime})) ]. \tag {10} +$$ + +We follow the Erdős–Rényi model (Erdős et al., 1960) and assume that each edge in $G'$ has a probability of being present or absent, independently of the other edges. Specifically, we assume that the existence of an edge $(u, v)$ in $G'$ is determined by a Bernoulli variable $A_{u, v}' \sim \mathrm{Bern}(\pi_{uv}')$ . Thus, $P(G'|G)$ can be decomposed as $P(G'|G) = \prod_{(u, v) \in \mathcal{E}} P(A_{uv}'|\pi_{uv}')$ . The bound is always true for any prior distribution $R(G')$ . We follow an existing work and assume that in the prior distribution, the existence of an edge $(u, v)$ in $G'$ is determined by another Bernoulli variable $A_{u, v}'' \sim \mathrm{Bern}(r)$ , where $r \in [0, 1]$ is a hyper-parameter (Miao et al., 2022), independently to the graph $G$ . We have $R(G') = P(|\mathcal{E}|) \prod_{(u, v) \in \mathcal{E}} P(A_{uv}'')$ . Thus, the KL divergence between $P(G'|G)$ and the above + +marginal distribution $R(G^{\prime})$ becomes: + +$$ +\begin{array}{l} \mathrm {K L} (P (G ^ {\prime} | G) | | R (G ^ {\prime})) \\ = \sum_ {(u, v) \in \mathcal {E}} \pi_ {u v} ^ {\prime} \log \frac {\pi_ {u v} ^ {\prime}}{r} + \left(1 - \pi_ {u v} ^ {\prime}\right) \log \frac {1 - \pi_ {u v} ^ {\prime}}{1 - r} + \text {C o n s t .} \tag {11} \\ \end{array} +$$ + +By replacing $I(G, G')$ with the above tractable upper bound, we obtain the loss function, denoted by $\mathcal{L}_{\mathrm{exp}}$ , for training the explainer $\Psi(\cdot)$ . + +# 3.2. Derivation of Inner Optimization + +For the inner optimization objective, we implement the first constraint by minimizing the distribution distance between $Q_{\phi}(\hat{G}|G')$ and $P_{\mathcal{G}}$ . Under the Erdős–Rényi assumption, the distribution loss is equivalent to the cross-entropy loss between $\tilde{G}$ given $G'$ and $G$ over the full adjacency matrix (Chen et al., 2023b). Considering that $G$ is usually sparse rather than a fully connected graph, in practice, we adopt a weighted version to emphasize more connected node pairs (Wang et al., 2016). Formally, we have the following distribution loss. + +$$ +\mathcal {L} _ {\text {d i s t}} = \frac {\beta}{| \mathcal {E} |} \sum_ {(u, v) \in \mathcal {E}} \log \left(\tilde {p} _ {u v}\right) + \frac {1}{| \bar {\mathcal {E}} |} \sum_ {(u, v) \in \bar {\mathcal {E}}} \log \left(1 - \tilde {p} _ {u v}\right), \tag {12} +$$ + +where $\bar{\mathcal{E}}$ is the set of node pairs that are unconnected in $G$ , $\tilde{p}_{uv}$ is the probability of node pair $(u,v)$ in $\tilde{G}$ , and $\beta$ is a hyper-parameter to for the trade-off between connected and unconnected node pairs. + +The second constraint requires the mutual information of $Y$ and $\tilde{G}$ is the same as that of $Y$ and $G'$ . Due to the OOD problem, it is non-trivial to directly compute $P(Y|G')$ or $H(Y|G')$ . Instead, we implement this constraint with a novel graph generator that $\tilde{G}$ is obtained by combining $G'$ and a non-explanatory subgraph (Zhang et al., 2023b). In practice, we implement the non-explanatory part by perturbing the residual subgraph $G - G'$ . The intuition is that if an explanation comprises label information, it is unlikely to change the prediction by manipulating the remaining non-explanatory part, which is widely adopted in the literature (Fang et al., 2023a; Zheng et al., 2024). + +# 4. The Proxy Explainer + +Based on our novel GIB with proxy graphs, in this section, we introduce a straightforward yet theoretically robust instantiation, named ProxyExplainer. As shown in Figure 2, the architecture of our model comprises two key modules: the explainer and the proxy graph generator. The explainer takes the original graph $G$ as its input and outputs a subgraph $G'$ as an explanation, which is optimized through the outer objective in equation 9. The proxy graph generator + +![](images/e79c0274d96fa8168ad7cd556a156bdb1d70b87fabb8c9fa09fa3adf11fa0467.jpg) +Figure 2. ProxyExplainer consists of two components: an Explainer and a Proxy Graph Generator. The Explainer takes a graph $G$ as input and produces an explainable subgraph $G'$ , The proxy generator creates in-distribution proxy graphs that preserve the label information in $G'$ . The proxy generator consists of a graph auto-encoder (GAE) and a variational graph auto-encoder (VGAE). + +generates an in-distributed proxy graph, which is optimized with the inner objective. + +# 4.1. The Explainer + +For the sake of optimization, we follow the existing works to relax the element in $\mathbf{A}$ from binary values to continuous values in the range [0, 1] (Luo et al., 2020; 2024). We adopt a generative explainer due to its effectiveness and efficiency (Chen et al., 2023a). Specifically, we decompose the to-be-explained model $f(\cdot)$ into two functions that $f_{\mathrm{enc}}(\cdot)$ learns node representations and $f_{\mathrm{cls}}(\cdot)$ predicts graph labels based on node embeddings. Formally, we have $\mathbf{Z} = f_{\mathrm{enc}}(\mathbf{X},\mathbf{A})$ and $\hat{Y} = f_{\mathrm{cls}}(\mathbf{Z})$ , where $\mathbf{Z}$ is the node representation matrix and $\hat{Y}$ is prediction. Routinely, $f_{\mathrm{cls}}(\cdot)$ consists of a pooling layer followed by a classification layer and $f_{\mathrm{enc}}(\cdot)$ consists of the other layers. Following the independence assumption in Section 3.1, we approximate Bernoulli distributions with binary concrete distributions (Maddison et al., 2017; Jang et al., 2017). Specifically, the probability of sampling an edge $(u,v)$ is computed by an MLP parameterized by $\psi$ , denoted by $g_{\psi}(\cdot)$ . Formally, we have + +$$ +\omega_ {u v} = g _ {\psi} ([ \boldsymbol {z} _ {u}; \boldsymbol {z} _ {v} ]), +$$ + +$$ +\epsilon \sim \operatorname {U n i f o r m} (0, 1), \tag {13} +$$ + +$$ +A _ {u v} ^ {\prime} = \sigma \left(\left(\log \epsilon - \log (1 - \epsilon) + \omega_ {u v}\right) / \tau\right), +$$ + +where $[z_u;z_v]$ is the concatenation of node representations $z_{u}$ and $z_{v},\epsilon$ is a independent variable, $\sigma (\cdot)$ is the Sigmoid function, and $\tau$ is a temperature hyper-parameter for approximation. According to (Luo et al., 2020), the parameter $\pi_{uv}^{\prime}$ of Bernoulli distribution in equation 11 can be obtained by $\pi_{uv}^{\prime} = \frac{\exp(\omega_{uv})}{1 + \exp(\omega_{uv})}$ . + +# 4.2. The Proxy Graph Generator + +As shown in our analysis in Section 3.2, we demonstrate the synthesis of a proxy graph through the amalgamation of the explanation subgraph $G'$ and the perturbation of its non-explanatory subgraph, represented as $G^{\Delta} = (\mathcal{V}, \mathcal{E}^{\Delta}, X)$ . We define the edge set of $G^{\Delta}, \mathcal{E}^{\Delta}$ , as the differential set $\mathcal{E} - \mathcal{E}'$ . Correspondingly, the adjacency matrix $A^{\Delta}$ is derived through $A - A'$ . Building upon this foundation, and as illustrated in Figure 2, our proposed framework introduces a dual-structured mechanism comprising two distinct graph auto-encoders(GAE) (Bank et al., 2023). To be more specific, we first include an encoder to learn a latent matrix $Z'$ according to $A'$ and $X'$ , and a decoder network recovers $A'$ based on $Z'$ . Formally, we have: + +$$ +\boldsymbol {Z} ^ {\prime} = \operatorname {E N C} _ {1} \left(\boldsymbol {A} ^ {\prime}, \boldsymbol {X}\right), \quad \tilde {\boldsymbol {A}} ^ {\prime} = \operatorname {D E C} \left(\boldsymbol {Z} ^ {\prime}\right), \tag {14} +$$ + +where $\mathrm{ENC}_1$ and DEC are the encoder network and decoder network. Our framework is flexible to the choices of these two networks. $\tilde{\boldsymbol{A}}^{\prime}\in \mathbb{R}^{n\times n}$ is the reconstructed adjacency matrix. + +To introduce perturbations into the non-explanatory segment, our approach employs a Variational Graph AutoEncoder (VGAE), a generative model adept at creating varied yet structurally coherent graph data. This capability is pivotal in generating nuanced variations of the non-explanatory subgraph. The VGAE operates by first encoding the non-explanatory subgraph $G^{\Delta}$ into a latent probabilistic space, characterized by Gaussian distributions. This process is articulated as: + +$$ +\boldsymbol {\mu} ^ {\Delta} = \operatorname {E N C} _ {1} (\boldsymbol {A} ^ {\Delta}, \boldsymbol {X}), \quad \boldsymbol {\sigma} ^ {\Delta} = \operatorname {E N C} _ {2} (\boldsymbol {A} ^ {\Delta}, \boldsymbol {X}), \tag {15} +$$ + +where $\mathrm{ENC}_1$ and $\mathrm{ENC}_2$ are encoder networks that learn the mean $\mu^{\Delta}$ and variance $\sigma^{\Delta}$ of the Gaussian distributions, respectively. Following this, the latent representations $Z^{\Delta}$ are sampled from these distributions, ensuring that each generated instance is a unique variation of the original. The decoder network then reconstructs the perturbed non-explanatory subgraph from these sampled latent representations: + +$$ +\boldsymbol {Z} ^ {\Delta} \sim \mathcal {N} (\boldsymbol {\mu} ^ {\Delta}, \operatorname {d i a g} (\boldsymbol {\sigma} ^ {\Delta}) ^ {2}), \quad \tilde {\boldsymbol {A}} ^ {\Delta} = \mathrm {D E C} (\boldsymbol {Z} ^ {\Delta}), \tag {16} +$$ + +where $\tilde{A}^{\Delta} \in \mathbb{R}^{n \times n}$ represents the adjacency matrix of the perturbed non-explanatory subgraph. This novel use of VGAE facilitates the generation of diverse yet representative perturbations, crucial for enhancing the interpretability of explainers in our proxy graph framework. The adjacency matrix of a proxy graph is then obtained by + +$$ +\tilde {\boldsymbol {A}} = \tilde {\boldsymbol {A}} ^ {\prime} + \tilde {\boldsymbol {A}} ^ {\Delta}. \tag {17} +$$ + +Loss function. To train the proxy graph generator, we introduce a standard Gaussian distribution as the prior for + +the latent space representations in the VGAE, specifically $\mathbf{Z} \sim \mathcal{N}(0,\mathcal{I})$ , where $\mathcal{I}$ represents the identity matrix. Then, the loss function is as follows. + +$$ +\mathcal {L} _ {\text {p r o x y}} = \mathcal {L} _ {\text {d i s t}} + \lambda \mathcal {L} _ {\mathrm {K L}}, \tag {18} +$$ + +where $\mathcal{L}_{\mathrm{dist}}$ is equivalent to cross-entropy between $\tilde{G}$ and $G$ (Chen et al., 2023b). $\mathcal{L}_{\mathrm{KL}}$ represents the KL divergence between the distribution of the latent representations $Z^{\Delta}$ and the assumed Gaussian prior. This term is crucial for regulating the variational aspect of the VGAE, ensuring that the generated perturbations are meaningful and controlled. $\lambda$ is a hyper-parameter. + +Alternate Training. To train the explainer and the proxy graph generator networks, we follow existing works (Zheng et al., 2024) to use an alternate training schedule that trains the proxy graph generator network $M$ times and then trains the explainer network once. $M$ is a hyper-parameter determined by grid search. The detailed algorithm description of our model is shown in Appendix B. + +# 5. Related Work + +GNN Explanation. The goal of explainability in GNNs is to ensure transparency in graph-based tasks. Recent works have been directed towards elucidating the rationale behind GNN predictions. These explanation methods can be broadly classified into two categories: instance-level and model-level approaches (Yuan et al., 2022). In this study, we focus on instance-level explanations, which aim to clarify the specific reasoning behind individual predictions made by GNNs. These methods are critical for understanding the decision-making process on a case-by-case basis to enhance the explainability of GNNs. For example, GNNExplainer (Ying et al., 2019) excludes certain edges and node features to observe the changes in prediction. However, its single-instance focus limits its applicability to provide a global understanding of the to-be-explained model (Chen et al., 2023a). PGExplainer (Luo et al., 2020; 2024) introduces a parametric neural network to learn edge weights. Thus, once training is complete, it can explain new graphs without retraining. ReFine (Wang et al., 2021) integrates a pre-training phase that focuses on class comparisons and is fine-tuned to refine context-specific explanations. GStarX (Zhang et al., 2022) assigns an importance score to each node by calculating the Hamiache and Navarro values of the structure to obtain explanatory subgraphs. GFlowExplainer (Li et al., 2023) uses a generator to construct a TD-like flow matching condition to learn a policy for generating explanations by adding nodes sequentially. + +Distribution Shifting in Explanations. The distribution shifting problem in post-hoc explanations has been increasingly recognized in explainable AI fields (Chang et al., 2019; + +Qiu et al., 2022). For example, FIDO (Chang et al., 2019) works on enhancing image classifier explanations, focusing on relevant contextual details that agree with the training data's distribution. A recent study tackles the distribution shifting problem in image explanations by introducing a module that assesses the similarity between altered data and the original dataset distribution (Qiu et al., 2022). In the graph domain, an ad-hoc strategy to mitigate distribution shifting is to initially reduce the size constraint coefficient during the explanation process (Fang et al., 2023b). Mixup-Explainer (Zhang et al., 2023b) and RegExplainer (Zhang et al., 2023a) propose non-parametric solutions by mixing up the explanation subgraph with a non-explainable part from another graph. However, these methods operates under the assumption that the explanatory and non-explanatory subgraphs in mixed graphs are independent, which may not hold in many real-life graphs. + +# 6. Experiments + +We present empirical results that illustrate the effectiveness of our proposed method. These experiments are mainly designed to explore the following research questions: + +- RQ1: Can the proposed framework outperform other baselines in identifying explanations for GNNs? +- RQ2: Is the distribution shifting severe in explanation subgraphs? Can the proposed approach alleviate that? +- RQ3: How does each component of ProxyExplainer impact the overall performance in generating explanations? + +# 6.1. Experimental Settings + +To evaluate the performance of ProxyExplainer, we use six benchmark datasets with ground-truth explanations. These include four real-world datasets: MUTAG (Kazius et al., 2005), Benzene (Sanchez-Lengeling et al., 2020), Alkane-Carbonyl (Sanchez-Lengeling et al., 2020), and Fluoride-Carbonyl (Sanchez-Lengeling et al., 2020), along with two synthetic datasets: BA-2motifs (Luo et al., 2020) and BA-3motifs (Chen et al., 2023b). We take GradCAM (Pope et al., 2019), GNNExplainer(Ying et al., 2019), PGExplainer(Luo et al., 2020), ReFine (Wang et al., 2021), and MixupExplainer (Zhang et al., 2023b) for comparison. We follow the experimental setting in previous works (Ying et al., 2019; Luo et al., 2020; Sanchez-Lengeling et al., 2020) to train a Graph Convolutional Network (GCN) model (Kipf & Welling, 2017) with three layers. Experiments on another representative GNN, Graph Isomorphism Network (GIN) (Xu et al., 2019), can be found in Appendix D.3. We use the Adam optimizer (Kingma & Ba, 2014) with the inclusion of a weight decay $5e - 4$ . Detailed information + +Table 1. Explanation accuracy in terms of AUC-ROC on edges. + +
MUTAGBenzeneAlkane-CarbonylFluoride-CarbonylBA-2motifsBA-3motifs
GradCAM0.727±0.0000.740±0.0000.448±0.0000.694±0.0000.714±0.0000.709±0.000
GNNExplainer0.682±0.0090.485±0.0010.551±0.0030.574±0.0020.644±0.0070.511±0.002
PGExplainer0.832±0.0320.793±0.0540.660±0.0360.702±0.0180.734±0.1170.796±0.010
ReFine0.612±0.0040.606±0.0020.768±0.0010.571±0.0000.698±0.0010.629±0.005
MixupExplainer0.863±0.1030.611±0.0320.811±0.0060.706±0.0130.906±0.0590.859±0.019
ProxyExplainer0.977±0.0090.845±0.0360.934±0.0050.758±0.0680.935±0.0080.960±0.008
+ +Table 2. Explanation accuracy in terms of AP on MUTAG and BA-2motifs. + +
MUTAGBA-2motifs
GradCAM0.247±0.0000.664±0.000
GNNExplainer0.232±0.0010.608±0.004
PGExplainer0.611±0.0240.682±0.117
ReFine0.227±0.0010.619±0.002
MixupExplainer0.647±0.0830.787±0.073
ProxyExplainer0.756±0.1070.839±0.036
+ +Table 3. Fidelity evaluation on MUTAG and BA-2motifs. + +
MUTAGBA-2motifs
\(Fid_{\alpha_1,+}\)↑\(Fid_{\alpha_2,-}\)↓\(Fid_{\alpha_1,+}\)↑\(Fid_{\alpha_2,-}\)↓
GradCAM0.004±0.0000.162±0.0000.072±0.0000.107±0.000
GNNExp.0.031±0.0010.148±0.0010.057±0.0020.132±0.001
PGExp.0.034±0.0110.148±0.0050.065±0.0170.126±0.009
ReFine0.003±0.0000.160±0.0010.060±0.0050.125±0.001
MixupExp.0.037±0.0060.146±0.0030.074±0.0050.112±0.003
ProxyExp.0.040±0.0020.145±0.0010.086±0.0030.106±0.002
+ +regarding datasets and baselines is delineated in Appendix C. + +To evaluate the quality of explanations, we approach the explanation task as a binary classification of edges. Edges that are part of ground truth subgraphs are labeled as positive, while all others are deemed negative. The importance weights given by the explanation methods are interpreted as prediction scores. An effective explanation technique is one that assigns higher weights to edges within the ground truth subgraphs compared to those outside of them. We utilize the AUC-ROC for quantitative assessment (Ying et al., 2019; Luo et al., 2020). + +# 6.2. Quantitative Evaluation (RQ1) + +To answer RQ1, we compare the proposed method, ProxyExplainer, to other baselines. Each experiment was conducted 10 times using random seeds, and the average AUC scores as well as standard deviations are presented in Table 1. + +The results demonstrate that ProxyExplainer provides the + +most accurate explanations across all datasets. Specifically, it improves the AUC scores by an average of $10.6\%$ on real-world datasets and $7.5\%$ on synthetic datasets over the leading baselines. Comparisons with baseline methods highlight the advantages of our proposed explanation framework. Besides, ProxyExplainer captures underlying explanatory factors consistently across diverse datasets. For instance, MixupExplainer exhibits proficiency on the synthetic BA-2motifs dataset but performs poorly on the real-world Benzene dataset. The reason is that MixupExplainer relies on the independence assumption of explanation and non-explanation subgraphs, which may not hold in real-world datasets. In contrast, ProxyExplainer consistently demonstrates high performance across different datasets, showcasing its robustness and adaptability. + +Considering the importance of precision for the positive class in our context, we further adopt AP to evaluate the performance. As shown in Table 2, with AP scores, ProxyExplainer consistently outperforms the other baselines in two benchmark datasets MUTAG and BA-2motifs. + +Additionally, some existing works, such as SubgraphX (Yuan et al., 2021), adopt faithfulness-based metrics for evaluation. However, these metrics are problematic due to the OOD problem (Zheng et al., 2024; Amara et al., 2023). So we use the robust fidelity metrics $(\text{Fid}_{\alpha_1, + }, \text{Fid}_{\alpha_2, - })$ as described in (Zheng et al., 2024) with default settings $(\alpha_1 = 0.1, \alpha_2 = 0.9)$ to evaluate model faithfulness. Table 3 demonstrates that ProxyExplainer is consistently outperforms all baselines in both $\text{Fid}_{\alpha_1, + }$ and $\text{Fid}_{\alpha_2, - }$ . + +# 6.3. Alleviating Distribution Shifts (RQ2) + +In this section, we assess ProxyExplainer's ability to generate in-distribution proxy graphs. Due to the intractable of direct computation, we follow the previous work (Chen et al., 2023b) to utilize Maximum Mean Discrepancy (MMD) between distributions of multiple graph statistics, including degree distributions, clustering coefficients, and spectrum distributions, between the generated proxy graphs and original graphs. Specifically, we utilize Gaussian Earth Mover's Distance kernel when computing MMDs. Smaller MMD + +Table 4. MMD results between the ground truth explanations and original graphs (GT); PGExplainer explanations and original graphs (PGE); proxy graphs in our methods and original graphs (Proxy). + +
MUTAGBenzeneAlkane-Carbonyl
MetricGTPGEProxyGTPGEProxyGTPGEProxy
Deg.0.6140.4680.1230.8430.3930.2360.8720.6650.177
Clus.0.0030.0030.0090.0090.0020.0040.0110.0110.011
Spec.0.4140.3410.1860.2950.1630.1010.5960.4470.049
Sum.1.0320.8130.3171.1470.5580.3411.4791.1230.237
Fluoride-CarbonylBA-2motifsBA-3motifs
MetricGTPGEProxyGTPGEProxyGTPGEProxy
Deg.0.6380.4880.1960.7590.4960.0600.5410.1490.092
Clus.0.0120.0120.0120.4470.4630.5840.2620.3820.245
Spec.0.3510.3150.1000.2450.2560.0910.2170.0630.062
Sum.1.0000.8150.3081.4511.2150.7351.0200.5940.399
+ +values indicate similar graph distributions. For comparison, we also include the Ground truth explanations and the ones generated by PGExplainer. + +The results are shown in Table 4. "GT" denotes the MMDs between the ground truth explanations and original graphs. "PGE" represents the MMDs between explanations generated by PGExplainer and original graphs. "Proxy" denotes the MMDs between proxy graphs in our method and original graphs. We have the following observations. First, the MMDs between ground truth and original graphs are usually large, verifying our motivation that a model trained on original graphs may not have correct predictions on the OOD explanation subgraphs. Second, the explanations generated by a representative work, PGExplainer, are often OOD from original graphs, indicating that the original GIB-based objective function may be sub-optimal. Third, in most cases, proxy graphs generated by our method are with smaller MMDs, demonstrating their in-distribution property. + +# 6.4. Ablation Studies (RQ3) + +In this section, we conduct ablation studies to investigate the roles of different components. Specifically, we consider the following variants of ProxyExplainer: (1) w/o $G^{\Delta}$ : in this variant, we remove the non-explanatory subgraph generator (VGAE), which is the bottom half as shown in Figure 2; (2) w/o $\mathcal{L}_{\mathrm{KL}}$ : in this variant, we remove the KL divergence from the training loss in ProxyExplainer; (3) w/o $\mathcal{L}_{\mathrm{dist}}$ : in this variant, we remove the distribution loss from ProxyExplainer. The results of the ablation study on MUTAG and BA-2motifs are reported in Figure 3. + +Figure 3 illustrates a notable performance drop for all variants, indicating that each component contributes positively to the effectiveness of ProxyExplainer. Especially, in the real-life dataset MUTAG, without the in-distribution constraint, w/o $\mathcal{L}_{\mathrm{dist}}$ is much worse than ProxyExplainer, indicating the vital role of in-distributed proxy graphs in our + +![](images/0b1d66053df82b784db082b3b23d7d28a8282664251f4a0df6cfab5d512be87d.jpg) +Figure 3. Ablation Studies on MUTAG and BA-2motifs. + +framework. Extensive ablation studies on other datasets can be found in the Appendix D.2. + +# 6.5. Case Studies + +In this part, we conduct case studies to qualitatively compare the performances of ProxyExplainer against others. We adopt examples from Benzene and BA-2motifs in this part. We show visualization results in Figure 4 and Figure 5. Explanations are highlighted with bold black and bold orange edges, respectively. From the results, our ProxyExplainer stands out by generating more compelling explanations compared to baselines. Specifically, ProxyExplainer maintains clarity without introducing irrelevant edges and exhibits more concise results compared to alternative methods. The visualized performance underscores ProxyExplainer's ability to provide meaningful and focused subgraph explanations. More visualizations on these two datasets can be found in the Appendix D.5. + +# 7. Conclusion + +In this paper, we systematically investigate the OOD problem in the de facto framework, GIB, for learning explanations in GNNs, which is highly overlooked in the literature. To address this issue, we extend the GIB by innovatively including in-distributed proxy graphs. On top of that, we derive a tractable objective function for practical implementations. We further present a new explanation framework that utilizes two graph auto-encoders to generate proxy graphs. We conduct comprehensive empirical studies on both benchmark synthetic datasets and real-life datasets to demonstrate the effectiveness of our method in alleviating the OOD problem and achieving high-quality explanations. There are several topics we will investigate in the future. First, the OOD problem also exists in obtaining model-level explanations and counterfactual explanations. We will extend our + +![](images/af0c2330ce3fe8e5ad873dfa6ee7597990addc6cdc744289c30b6de18d1916e6.jpg) +(a) Ground Truth + +![](images/ea1f94a18f534031990089870794d21b0a876f21876e1f442d7209194e0cada3.jpg) +(b) ProxyExplainer + +![](images/6523c7584423569f8f9437aefa874ce22d79804f3bd9273f086548fe37849dc7.jpg) +(c) MixupExplainer + +![](images/ea40d356680fbb1232f7039bf37adb054a34dfbc191a2b076008a1b1baa85244.jpg) +(d) PGExplainer + +![](images/4e48565005a65000729635f9c984a347eef174884b5b2b4db0afd082dc919a21.jpg) +(e) GNNExplainer + +![](images/cb26f73851cb00c141cefc4185dab949599b592a3f4b4e7449c87657712f512a.jpg) +Figure 4. Visualization of explanation results from different explanation models on Benzene. The generated explanations are highlighted with bold orange edges. +(a) Ground Truth +Figure 5. Visualization of explanation results from different explanation models on BA-2motifs. The generated explanations are highlighted with bold black edges. + +![](images/c23463453ac4ec5868780f2da5a876ae112efb348052a075831793da48fe07e9.jpg) +(b) ProxyExplainer + +![](images/4ebd0d6c88a420cf54318084076512566efc2e1cc79520d8eb7d2b2e32366018.jpg) +(c) MixupExplainer + +![](images/39999e69bda92848e744903c4185c51c0db798692df36598e409491beb84bee8.jpg) +(d) PGExplainer + +![](images/3721ce9b63ca7878da1988fe12a65896b5fd1a949b97725bf689a22f48754d00.jpg) +(e) GNNExplainer + +method to these research problems. Second, we will also analyze explainable learning methods with proxies in other data structures, such as image, language, and time series. + +# Impact Statement + +This paper presents work whose goal is to advance the field of Machine Learning. There are many potential societal consequences of our work, none of which we feel must be specifically highlighted here. + +# Acknowledgments + +This project was partially supported by NSF grant IIS-2331908. The views and conclusions contained in this paper are those of the authors and should not be interpreted as representing any funding agencies. + +# References + +Amara, K., El-Assady, M., and Ying, R. Ginx-eval: Towards in-distribution evaluation of graph neural network explanations. arXiv preprint arXiv:2309.16223, 2023. +Bank, D., Koenigstein, N., and Giryes, R. Autoencoders. Machine learning for data science handbook: data mining and knowledge discovery handbook, pp. 353-374, 2023. +Chang, C.-H., Creager, E., Goldenberg, A., and Duvenaud, + +D. Explaining image classifiers by counterfactual generation. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id=B1MXz20cYQ. +Chen, J., Amara, K., Yu, J., and Ying, R. Generative explanations for graph neural network: Methods and evaluations. arXiv preprint arXiv:2311.05764, 2023a. +Chen, J., Wu, S., Gupta, A., and Ying, Z. D4explainer: In-distribution explanations of graph neural network via discrete denoising diffusion. In Thirty-seventh Conference on Neural Information Processing Systems, 2023b. URL https://openreview.net/forum?id=GJtP1ZEzua. +Debnath, A. K., Lopez de Compadre, R. L., Debnath, G., Shusterman, A. J., and Hansch, C. Structure-activity relationship of mutagenic aromatic and heteroaromatic nitro compounds. correlation with molecular orbital energies and hydrophobicity. Journal of medicinal chemistry, 34 (2):786-797, 1991. +Erdős, P., Rényi, A., et al. On the evolution of random graphs. Publ. math. inst. hung. acad. sci, 5(1):17-60, 1960. +Fang, J., Liu, W., Gao, Y., Liu, Z., Zhang, A., Wang, X., and He, X. Evaluating post-hoc explanations for graph neural networks via robustness analysis. In Thirty-seventh Conference on Neural Information Processing Systems, 2023a. + +Fang, J., Liu, W., Zhang, A., Wang, X., He, X., Wang, K., and Chua, T.-S. On regularization for explaining graph neural networks: An information theory perspective, 2023b. URL https://openreview.net/forum?id=5rX7M4wa2R_. +Fang, J., Wang, X., Zhang, A., Liu, Z., He, X., and Chua, T.-S. Cooperative explanations of graph neural networks. In Proceedings of the Sixteenth ACM International Conference on Web Search and Data Mining, pp. 616-624, 2023c. +Hamilton, W., Ying, Z., and Leskovec, J. Inductive representation learning on large graphs. In Advances in Neural Information Processing Systems, volume 30, 2017. +Huang, R., Shirani, F., and Luo, D. Factorized explainer for graph neural networks. In Proceedings of the AAAI conference on artificial intelligence, 2024. +Jang, E., Gu, S., and Poole, B. Categorical reparameterization with gumbel-softmax. In International Conference on Learning Representations, 2017. URL https://openreview.net/forum?id=rkE3y85ee. +Kazius, J., McGuire, R., and Bursi, R. Derivation and validation of toxicophores for mutagenicity prediction. Journal of medicinal chemistry, 48(1):312-320, 2005. +Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. +Kipf, T. N. and Welling, M. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations, 2017. URL https://openreview.net/forum?id=SJU4ayYgl. +Li, W., Li, Y., Li, Z., HAO, J., and Pang, Y. DAG matters! GFlownets enhanced explainer for graph neural networks. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=jgmuRzM-sb6. +Li, Y., Zhou, J., Verma, S., and Chen, F. A survey of explainable graph neural networks: Taxonomy and evaluation metrics. arXiv preprint arXiv:2207.12599, 2022. +Luo, D., Cheng, W., Xu, D., Yu, W., Zong, B., Chen, H., and Zhang, X. Parameterized explainer for graph neural network. Advances in neural information processing systems, 33:19620-19631, 2020. +Luo, D., Zhao, T., Cheng, W., Xu, D., Han, F., Yu, W., Liu, X., Chen, H., and Zhang, X. Towards inductive and efficient explanations for graph neural networks. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2024. + +Maddison, C. J., Mnih, A., and Teh, Y. W. The concrete distribution: A continuous relaxation of discrete random variables. In International Conference on Learning Representations, 2017. URL https://openreview.net/forum?id=S1jE5L5gl. +Miao, S., Liu, M., and Li, P. Interpretable and generalizable graph learning via stochastic attention mechanism. In International Conference on Machine Learning, pp. 15524-15543. PMLR, 2022. +Pope, P. E., Kolouri, S., Rostami, M., Martin, C. E., and Hoffmann, H. Explainability methods for graph convolutional neural networks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 10772-10781, 2019. +Qiu, L., Yang, Y., Cao, C. C., Zheng, Y., Ngai, H., Hsiao, J., and Chen, L. Generating perturbation-based explanations with robustness to out-of-distribution data. In Proceedings of the ACM Web Conference 2022, pp. 3594-3605, 2022. +Sanchez-Lengeling, B., Wei, J., Lee, B., Reif, E., Wang, P., Qian, W., McCloskey, K., Colwell, L., and Wiltschko, A. Evaluating attribution for graph neural networks. Advances in neural information processing systems, 33: 5898-5910, 2020. +Scarselli, F., Gori, M., Tsoi, A. C., Hagenbuchner, M., and Monfardini, G. The graph neural network model. IEEE transactions on neural networks, 20(1):61-80, 2008. +Sterling, T. and Irwin, J. J. ZINC 15 - ligand discovery for everyone. J. Chem. Inf. Model., 55(11):2324-2337, 2015. +Tishby, N., Pereira, F. C., and Bialek, W. The information bottleneck method. arXiv preprint physics/0004057, 2000. +Veličković, P., Cucurull, G., Casanova, A., Romero, A., Lio, P., and Bengio, Y. Graph attention networks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id=rJXMpikCZ. +Wang, D., Cui, P., and Zhu, W. Structural deep network embedding. In Proceedings of the 22nd ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 1225-1234, 2016. +Wang, X., Wu, Y., Zhang, A., He, X., and Chua, T.-S. Towards multi-grained explainability for graph neural networks. In Advances in Neural Information Processing Systems, volume 34, pp. 18446-18458, 2021. +Wu, B., Li, J., Yu, J., Bian, Y., Zhang, H., Chen, C., Hou, C., Fu, G., Chen, L., Xu, T., et al. A survey of trustworthy + +graph learning: Reliability, explainability, and privacy protection. arXiv preprint arXiv:2205.10014, 2022. +Wu, T., Ren, H., Li, P., and Leskovec, J. Graph information bottleneck. Advances in Neural Information Processing Systems, 33:20437-20448, 2020. +Xu, K., Hu, W., Leskovec, J., and Jegelka, S. How powerful are graph neural networks? In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id=ryGs6iA5Km. +Ying, Z., Bourgeois, D., You, J., Zitnik, M., and Leskovec, J. Gnnexplainer: Generating explanations for graph neural networks. Advances in neural information processing systems, 32, 2019. +Yuan, H., Yu, H., Wang, J., Li, K., and Ji, S. On explainability of graph neural networks via subgraph explorations. In International Conference on Machine Learning, pp. 12241-12252. PMLR, 2021. +Yuan, H., Yu, H., Gui, S., and Ji, S. Explainability in graph neural networks: A taxonomic survey. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2022. +Zhang, H., Wu, B., Yuan, X., Pan, S., Tong, H., and Pei, J. Trustworthy graph neural networks: Aspects, methods, and trends. Proceedings of the IEEE, 112(2):97-139, 2024. doi: 10.1109/JPROC.2024.3369017. +Zhang, J., Chen, Z., Luo, D., Wei, H., et al. Regexplainer: Generating explanations for graph neural networks in regression tasks. In The Second Learning on Graphs Conference, 2023a. +Zhang, J., Luo, D., and Wei, H. Mixuplexerainer: Generalizing explanations for graph neural networks with data augmentation. In Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pp. 3286-3296, 2023b. +Zhang, S., Liu, Y., Shah, N., and Sun, Y. Gstarx: Explaining graph neural networks with structure-aware cooperative games. In Advances in Neural Information Processing Systems, volume 35, pp. 19810-19823, 2022. +Zheng, X., Shirani, F., Wang, T., Cheng, W., Chen, Z., Chen, H., Wei, H., and Luo, D. Towards robust fidelity for evaluating explainability of graph neural networks. In The Twelfth International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=up6hr4hIQH. + +# A. Notations + +In Table 5, we summarized the main notations we used and their descriptions in this paper. + +Table 5. Symbols and their descriptions. + +
SymbolsDescriptions
GA set of graphs
G, V, EGraph instance, node set, edge set
viThe i-th node
XNode feature matrix
AAdjacency matrix
ZNode representation matrix
YLabel of graph G
yA set of labels
G*Optimal explanatory subgraph
G*A set of G*
G'Candidate explanatory subgraph
GΔNon-explanatory graph
GProxy graph of G' with a fixed distribution
h, h', hGraph embeddings
dDimension of node feature
f(·)To-be-explained GNN model
Ψψ(·)Explanation function
ψParameter of the explanation function
PGDistribution of original training graphs
PG'Distribution of explanation subgraphs
QφParameterized function of P(G|G')
φModel parameters of Qφ
φ*Optimal φ
αBalance parameter between I(G, G') and I(Y, G')
EThe set of node pairs that are unconnected in G
puvProbability of node pair (u, v) in G
βA hyper-parameter to get a trade-off between connected and unconnected node pairs
fenc(·)The front part of GNNs that learns node representations
fcls(·)The back part of GNNs that predicts graph labels based on node embeddings
σ(·)Sigmoid function
τTemperature hyper-parameter for approximation
λA hyper-parameter in Proxy loss function
LdistDistribution loss between G and G
KLKL divergence between distribution of ZΔ and its prior
LproxyProxy loss
LexpExplainer loss
+ +# B. Algorithm + +We take as input a set of graphs $\mathcal{G} = \{G_i\}_{i=0}^N$ . For each graph $G_i$ , we use an explainer model to identify a subgraph $G_i'$ as the explanation and then compute the non-explanatory graph $G_i^\Delta$ , which is obtained by removing edges in $G_i$ that exist in $G_i'$ . We use GAE to reconstruct a subgraph, denoted by $\tilde{G}_i'$ from the subgraph $G_i'$ and another VGAE to generate a new subgraph, denoted by $\tilde{G}_i^\Delta$ , from the non-explainable subgraph $G_i^\Delta$ . The proxy graph, $\tilde{G}_i$ , is obtained by combining them, whose adjacency matrix can be denoted by $\tilde{A}_i = \tilde{A}_i' + \tilde{A}_i^\Delta$ . Here $\tilde{A}_i'$ and $\tilde{A}_i^\Delta$ are adjacency matrices of $\tilde{G}_i'$ and $\tilde{G}_i^\Delta$ , respectively. We alternatively train the explainer model and proxy graph generator as shown in Algorithm 1. + +Algorithm 1 Algorithm of ProxyExplainer +Input: A set of graphs $\mathcal{G} = \{G_i\}_{i=0}^N$ , with each $G_i = (\mathcal{V}_i, \mathcal{E}_i, X_i)$ , a pretrain to-be-explained model $f(\cdot)$ , hyper parameters $\alpha, \lambda, M$ , epochs $E$ . Initialize an explainer function $\Psi_{\psi}(\cdot)$ epoch $\leftarrow 0$ while epoch $< E$ do for $G_i \in \mathcal{G}$ do $G_i' \gets \Psi_{\psi}(G_i)$ $G_i' \gets G_i - G_i'$ Compute $\tilde{A}_i'$ with equation 14 Compute $Z^{\Delta}$ and $\tilde{A}_i^{\Delta}$ with equation 16 Compute proxy loss $\mathcal{L}_{\mathrm{proxy}}$ with equation 18 Update parameters in proxy graph generator with backpropagation if epoch%M == 0 then Compute explainer loss $\mathcal{L}_{\mathrm{exp}}$ Update parameters in the explainer with backpropagation end if end for epoch $\leftarrow$ epoch + 1 end while + +# C. Full Experimental Setups + +We conduct all experiments on a Linux machine with 8 Nvidia A100-PCIE GPUs, each with 40GB of memory. The CUDA version is 12.4 and the driver version is 550.54.15. We use Python 3.9 and Torch 2.0.1 in our project. The code is available at https://github.com/realMoana/ProxyExplainer. + +# C.1. Datasets + +MUTAG (Kazius et al., 2005). MUTAG dataset includes 4,337 molecular graphs, each of them is classified into two groups based on its mutagenic effect on the Gram-negative bacterium S. Typhimurium. This classification comes from several specific virulence gland groups with mutagenicity in molecular mapping by Kazius et al.(Kazius et al., 2005). + +Benzene (Sanchez-Lengeling et al., 2020). Benzene consists 12,000 molecular graphs from the ZINC15(Sterling & Irwin, 2015) database, which can be classified into two classes. The main goal is to determine if a Benzene ring is exited in each molecule. In cases where multiple Benzene rings are present, each Benzene ring is treated as a distinct explanation. + +Alkane-Carbonyl (Sanchez-Lengeling et al., 2020). The Alkane-Carbonyl dataset consists of a total of 4,326 molecule graphs that are categorized into two different classes. Positive samples refer to molecules that have both alkane and carbonyl functional groups. The ground-truth explanation includes alkane and carbonyl functional groups in a given molecule. + +Fluoride-Carbonyl (Sanchez-Lengeling et al., 2020). The Fluoride-Carbonyl dataset has 8,671 molecular graphs. The ground-truth explanation is based on the particular combination of fluoride atoms and carbonyl functional groups present in each molecule. + +BA-2motifs (Luo et al., 2020). The BA-2motifs dataset consists 1,000 synthetic graphs, each derived from a basic Barabasi-Albert (BA) model. The dataset is divided into two categories: one part of the graphs add patterns that mimic the structure of a house, and the remaining integrate five-node cyclic patterns. The classification of these graphs depends on the specific patterns. + +BA-3motifs (Chen et al., 2023b). BA-3motifs is an extended dataset inspired by the BA-2motifs and contains 3,000 synthetic graphs. Each base graph is accompanied by one of three different patterns: house, cycle, or grid. + +# C.2. Baselines + +To evaluate our model, we well-train the GCN model in to ensure that it takes good performance in graph classification tasks. The results are displayed in Table 7. For a comprehensive comparison, we incorporate various post-hoc explanation methods, including GradCAM, GNNExplainer, PGExplainer, ReFine, and MixupExplainer. + +Table 6. Statistics of molecule datasets for graph classification with ground-truth explanations. + +
MUTAGBenzeneAlkane-CarbonylFluoride-CarbonylBA-2motifsBA-3motifs
Graphs4,33712,0004,3268,6711,0003,000
Average nodes29.1520.5821.1321.3625.0021.92
Average edges60.8343.6544.9545.3725.4829.51
Node features14141414104
Original graphC O O H NC OC OC O F
Ground truth explanationNH2, NO2Benzene RingAlkane,C=OF-,C=OHouse, cycleHouse,cycle,grid
+ +Table 7. The graph-classification task performances of the GCN model + +
MUTAGBenzeneAlkane-CarbonylFluoride-CarbonylBA-2motifsBA-3motifs
Train Acc0.8500.9300.9790.9510.9990.997
Val Acc0.8340.9270.9860.9561.00.997
Test Acc0.8040.9150.9750.9511.00.977
+ +- GradCAM (Pope et al., 2019). This method utilizes gradients as a weighting mechanism to merge various feature maps. It operates on heuristic assumptions and cannot elucidate node classification models. +- GNNExplainer (Ying et al., 2019). It learns soft masks for edges and node features, and aims to elucidate predictions through mask optimization. GNNExplainer integrates these masks with the original graph through element-wise multiplifications. The masks are optimized by enhancing the mutual information between the original graph and the modified graph prediction results. +- PGExplainer (Luo et al., 2020). This method extends the idea of GNNExplainer by assuming that the graph is a random Gilbert graph. PGExplainer generates each edge embedding by combining the embeddings of its constituent nodes, then uses these edge embeddings to determine a Bernoulli distribution to indicate whether to mask an edge or not, and utilizes a Gumbel-Softmax approach to model the Bernoulli distribution for end-to-end training. +- ReFine (Wang et al., 2021). ReFine identifies the edge probabilities for the entire category by maximizing the mutual information and contrastive loss between categories. In fine-tuning, it uses the edge probabilities from the previous stage to sample edges, and find explanations that maximize mutual information for specific instances. +- MixupExplainer (Zhang et al., 2023b). This method combines original explanatory subgraphs with randomly sampled, label-independent base graphs in a non-parametric way to mitigate the common OOD issue which found in previous methods. + +# D. Extensive Experiments + +# D.1. Extensive Distribution Analysis + +As shown in previous work (Zhang et al., 2023b), another way to approximate the distribution differences of graphs is to compare their vector embeddings. Here, we adopt the same setting and use Cosine similarity and Euclidean distance to intuitively approximate the similarities between graph distributions. Table 8 presents the computed Cosine similarity and Euclidean distance between the distribution embeddings of the original graph $\pmb{h}$ , the ground truth explanation subgraph $\pmb{h}'$ and the generated proxy graph $\tilde{\pmb{h}}$ . Notably, our proxy graph embedding $\tilde{\pmb{h}}$ exhibits higher Cosine similarity scores and lower Euclidean distance with the original graph embedding $\pmb{h}$ compared to the ground truth explanation embedding $\pmb{h}'$ . We observe an average improvement of $19.5\%$ in Cosine similarity and $35.6\%$ in Euclidean distance. Particularly in the BA-2motifs dataset, there is a significant improvement of $60.4\%$ in Cosine similarity and $51.8\%$ in Euclidean distance. These findings underscore the effectiveness of our ProxyExplainer method in mitigating distribution shifts caused by induction bias in the to-be-explained GNN model $f(\cdot)$ , thereby enhancing explanation performance. + +Table 8. The Cosine similarity score and Euclidean distance between the distribution embeddings of the original graph $\mathbf{h}$ , explanation subgraph $\mathbf{h}'$ , and our proxy graph $\tilde{\mathbf{h}}$ on different datasets. + +
MUTAGBenzeneAlkane-CarbonylFluoride-CarbonylBA-2motifsBA-3motifs
Avg. Cosine(h,h')↑0.8830.8350.8890.9040.5710.686
Avg. Cosine(h,tilde h)↑0.9850.9050.9380.9080.9160.918
Avg. Euclidean(h,h')↓0.9751.0100.9400.8061.2101.199
Avg. Euclidean(h,tilde h)↓0.3680.7670.7190.7790.5830.613
+ +# D.2. Extensive Ablation Study + +In Figure 6, we conduct a comprehensive ablation study across all datasets to examine the impact of different components. The findings illustrate the effectiveness of these components and their positive contribution to our ProxyExplainer. + +![](images/d296e8ac7cbaf013bbd9d3c28d92cc7abbddee2b47e31bbfd5cdc5810c48ac0b.jpg) + +![](images/f74915da5e3ed27e218a8f6d0ea09d8342a40adfc7cb67186dae3eb7794ceb49.jpg) + +![](images/bc74991c50eb927e72620125ae82ac5959acbf594cc454fcf055afc6d7808c9f.jpg) + +![](images/88defe994c9f5f2bea7ae8e7156e724d3c0aff775711bea4c02706437a434c33.jpg) +(a) MUTAG +(d) Fluoride-Carbonyl + +![](images/7979db29f0d8a5f05065ec14c9e1ec06ce6ec476f12a165906b19a1bf9c68640.jpg) +(b) Benzene +(e) BA-2motifs +Figure 6. Ablation study on all datasets. + +![](images/51415cd046c47166aa8e4f163207f0106eaab4e1e1a6ce690311d42bcdb6b13f.jpg) +(c) Alkane-Carbonyl +(f) BA-3motifs + +# D.3. Extensive Experiment with GIN + +In order to show the robustness of our ProxyExplainer in explaining different GNN models, we first pre-train GIN on two real-world datasets and two synthetic datasets to ensure that GIN has the ability to classify graphs accurately. The results are displayed in Figure 7. Then we use both baseline methods in the previous experiment and our method ProxyExplainer to provide explanations for the pre-trained GIN model. As seen in Figure 8, it is noticeable that ProxyExplainer achieves the best performance on these datasets. Specifically, it improves the AUC scores of $2.9\%$ on Alkane-Carbonyl, $7.9\%$ on Fluoride-Carbonyl, $45.9\%$ on BA-2motifs, and $6.1\%$ on BA-3motifs. From the analysis, we can see that our ProxyExplainer can identify accurate explanations across different datasets. + +![](images/05d4165b1af38fd0ff698f6f23d9c12d66f6f645dc2f590ee92aa8300c86fca5.jpg) +Figure 7. The graph-classification task performances of the GIN model. + +![](images/edebe441ea337fee7126ffe4a0cd9ea9e2597e7203d6ddfc050132b41b2436d3.jpg) +(a) Alkane-Carbonyl + +![](images/dd127c34385ff0c2136b284fefd33b63b6858a11e667932aa08bc8d72306ccec.jpg) +(b) Fluoride-Carbonyl + +![](images/971a3f8d4817b89146aac046d6d14ec6b045d8e79c67ffc04e838f3fd23aed06.jpg) +(c) BA-2motifs + +![](images/ab20908370061e9cfa594e4a78a72a4f6fd7a1e4bdc01496677b59f961a6a4b9.jpg) +(d) BA-3motifs +Figure 8. Explanation accuracy in terms of AUC-ROC on edges based on GIN. + +# D.4. Parameter Sensitive Analysis + +In this section, we analyze the influence of parameters including $\lambda$ , which controls the KL divergence during the proxy graph generation process, and the dimension $D$ of node latent embedding. We vary $\lambda$ from 0.01 to 1.0. For $D$ , we vary it among + +{32, 64, 128, 256, 512, 1024}. We only change the value of a specific parameter while fixing the remaining parameters to their respective optimal values. + +Figure 9 shows the performance of our ProxyExplainer with respect to $\lambda$ on two real-world datasets (MUTAG and Alkanecarbonyl) and two synthetic datasets (BA-2motifs and BA-3motifs). From Figure 9, we can see that ProxyExplainer consistently outperforms the best baseline, MixupExplainer, for $\lambda \in [0.25,1.0]$ . This indicates that ProxyExplainer is stable. Figure 10 presents how the dimension of node latent embedding affects performance in ProxyExplainer, the results show that ProxyExplainer can reach the best performance at $D = 512$ . + +![](images/1d08640ca82fbf2f869bf042477453416d62241c19f209a3dc9c06cf2c25fa0e.jpg) +(a) MUTAG + +![](images/173c7b79861ae98533e038bb05561a9bf51bc2e25e0edb5b214fd4c2384893bf.jpg) + +![](images/a316f80d68d8ef1fe75430d32b71cd50c308704508b7c35b3412f601dbae3e44.jpg) +(b) Alkane-Carbonyl + +![](images/53412378ea01bf267dc4d569a8e1bc8025892ac71080bce26a8c76d684ef5356.jpg) + +![](images/768382e95df7cca7c1af2e2c312d6259febd1c96f3c7b1e793f779a6fb275dc5.jpg) +(c) BA-2motifs + +![](images/7142efd12e83bffc6366353427fcbd293d397e336ecdd81d127cf04f555f05ae.jpg) +Figure 9. Parameter analysis of $\lambda$ on four datasets. The left side of each graph shows the explanation performance. The right side shows the Distance Analysis between $h$ and $\tilde{h}$ . + +![](images/6d0b0859330346b05d13c3c8f78609542593a6400cc5a38873ae4592ed94fb64.jpg) +(d) BA-3motifs + +![](images/52d4fe6008d0adbb742fa6c5f18dabcc8098f9400b9d9597021177854b88ed76.jpg) + +![](images/55d7d4be62ce637b8fd40d3b78a124aa79df75056a8d1e26868fb4a8ff648246.jpg) +(a) MUTAG + +![](images/a1d751284676f5c5ca64b3e5833e60f4610e954857880df4f29180714ea2a256.jpg) + +![](images/126fb1db5ea856b13ba385329ae60fb9247c0449669bfbd21329ffdedf931c1a.jpg) +(b) Alkane-Carbonyl + +![](images/013a70a9fb83184959a92304ad70b214b16fdde1db233850f32a430d95f08932.jpg) + +![](images/8049246a7e30d40d042dd25d4bc8b24b586438b74aaf0af1e2b7f5744604efe0.jpg) +(c) BA-2motifs + +![](images/b1c4765a911b6b0c401ef9916de6a88548678c94dd4f3265c9817a5357f64dbb.jpg) +Figure 10. Parameter analysis of the dimension of node latent embedding. The left side of each graph shows the explanation performance and the right side displays the Cosine score and Euclidean distance between $\pmb{h}$ and $\bar{\pmb{h}}$ . + +![](images/30b35465dd5b66802fe915f0e70cba10b6d3adb2166b327f851ee6c85c354573.jpg) +(d) BA-3motifs + +![](images/afe1891e67f803aad46b0d2708f8947133d1c5ad62049206bf6597ad611d6383.jpg) + +# D.5. Extensive Case Study + +We show more visualization examples of explanation graphs on BA-2motifs, BA-3motifs, and Benzene in Figure 11, Figure 12, and Figure 13, respectively. + +![](images/ee0b7fd616cc8396306cdf9fe242cc37ab2d9adcf4ed65d69602cc127485212d.jpg) + +![](images/8f7258060ed44690611ff8d58233091ea96665e2105367b3328843f1ba4ff7d2.jpg) + +![](images/3c3aedd28bb6876aed363aa65b0c69013ebc27beff9074039bad0caeecc4731a.jpg) + +![](images/938139a2f8673fb3aee8e8b9744648c847b05a3fdce266f3cdf582565e518f18.jpg) + +![](images/1245e3400db483bd8b1e716997a074fd6ad22a178cde253c8a0e79a17f6577c6.jpg) + +![](images/46d07eab3975bc14368faba08a6dd2a24e1b531c0c843c11e1783a7bb5004106.jpg) + +![](images/2b11229bbd71f827faace022eb2293c1bbac3a7a82a197195be6c5f5635358c1.jpg) + +![](images/0ea4fb3dff531d6b4569c3dfcf0cdfcbc6a058a34461b80b0171d0d8148d340f.jpg) + +![](images/f6f23a0c783a7d4fdd79ed3f097a57a61f3f07cbb2bade544a8d76aee01cb47b.jpg) + +![](images/96a4a1b0b243bfcdecf95e1e8510877564948cba88b9a27711c7d08405554fa5.jpg) + +![](images/59688ddba7ea01136fbe88a9acf8c54132de049ba43d3ba8612b3f80bd0d07b0.jpg) +(a) Ground Truth + +![](images/37976f3142874ca81f12461ba9ee39d3cfbe11ad8af704685d49b7827a166813.jpg) +(b) ProxyExplainer + +![](images/c5ca61459c22763a9aaab17b92b3b0ef4064af1633bdddddc4cf983ce20eba2e.jpg) +(c) MixupExplainer + +![](images/458592fb93c3fd9198df05b71e75e66dd45de599ae7760a03d346a585e66b54e.jpg) +(d) PGExplainer + +![](images/4db0d5ad507971124b3810aa4a4e568108f281dd1a7c851896d8d7a37e109030.jpg) +(e) GNNExplainer + +![](images/065f3ef3ea696b839494cacdd0cef6e3d2006386967cd32dc904ac469298e523.jpg) + +![](images/38e273e45a27ccc9cefaa4087080c7257e3c9d15ca2cdcd499a1d16b1531cbfe.jpg) +Figure 11. Visualization of explanation on BA-2motifs. + +![](images/c20d8701a83ca9757d1c6ab150e7f2e684db9c1a9964196b71ac1a38b3a8a671.jpg) + +![](images/a5a60394b2f1b82948000640bef2792a5dd7a2aef970e9e71f3136ad024d720a.jpg) + +![](images/5461218781a6900e90b8e5cef32e24282d7ba665be30084f720d3c8d13661239.jpg) + +![](images/f3846a31a9c9534df2da3c26d8d13c18d617ba51726cb0a6a0dd81fa74d3fb69.jpg) + +![](images/4e47897c59c398de2f0c2bf53daf18b7862d7246d060ef351b72feb846374637.jpg) + +![](images/bb47a52ca586f14676cd4fecbf806ca082baed6a571802d07c203a95d141820c.jpg) + +![](images/6580f1f40b90246ab7373e45faeb82302d8e75fc5baeedb437db6146988fc0c6.jpg) + +![](images/4099aaef25bc3194215062fddf4a834284579e9befc03846f62f9d46abbdf201.jpg) + +![](images/06770bee3e222b0c900a95a3178ab784c1e6e65af807adc02b4a10f1c2f31f60.jpg) +(a) Ground Truth + +![](images/cf7e4f0e7e03786d5912eafddf37982976aee984f6f222b6df03b7ffe38d8cc2.jpg) +(b) ProxyExplainer + +![](images/9f9d28d019a78a79c3e468565fd6dc2199c753c8c283bb60075761d3a5632034.jpg) +(c) MixupExplainer + +![](images/e3663b940a7b2f3e344555edb0ab7d50ce6d7da688f60d8682c78abb58b64c76.jpg) +(d) PGExplainer + +![](images/be319b74c3894a45c4ccc47a6217717113dbe854a0fe7e1124ebf054ce5c1e85.jpg) +(e) GNNExplainer +Figure 12. Visualization of explanation on BA-3motifs. + +![](images/395d3a2bb16faabd75abb0f844a5f33ed3d72ddd039c27f5a83c083edc70d0f7.jpg) +Figure 13. Visualization of explanation on Benzene. \ No newline at end of file diff --git a/generatingindistributionproxygraphsforexplaininggraphneuralnetworks/images.zip b/generatingindistributionproxygraphsforexplaininggraphneuralnetworks/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..7a24d3ac2ef340160800a1daaf5b069874c63c6c --- /dev/null +++ b/generatingindistributionproxygraphsforexplaininggraphneuralnetworks/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81993966e1985b2e75c34af2635f274b42ae46efb57f8ea4bc7e84a010d86d31 +size 1350865 diff --git a/generatingindistributionproxygraphsforexplaininggraphneuralnetworks/layout.json b/generatingindistributionproxygraphsforexplaininggraphneuralnetworks/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..44c3d6cdc551cdae6f7c593f4bae1c8175a9a39c --- /dev/null +++ b/generatingindistributionproxygraphsforexplaininggraphneuralnetworks/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e190ec6b6c875ec977758a157ef2b34112bfe453ae50ffc450ac8cb54392c60c +size 829918 diff --git a/generativeactivelearningforlongtailedinstancesegmentation/63ddde24-05f3-439f-ae83-2aaa92bbf75f_content_list.json b/generativeactivelearningforlongtailedinstancesegmentation/63ddde24-05f3-439f-ae83-2aaa92bbf75f_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..35b0a427566f3e45acd4276d3d6c0d0551a0aeaf --- /dev/null +++ b/generativeactivelearningforlongtailedinstancesegmentation/63ddde24-05f3-439f-ae83-2aaa92bbf75f_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea2b4d2095212cfa23e8991f336e7a8ab5b43701839778040eae9c75dae3d0d4 +size 133965 diff --git a/generativeactivelearningforlongtailedinstancesegmentation/63ddde24-05f3-439f-ae83-2aaa92bbf75f_model.json b/generativeactivelearningforlongtailedinstancesegmentation/63ddde24-05f3-439f-ae83-2aaa92bbf75f_model.json new file mode 100644 index 0000000000000000000000000000000000000000..7e7ea2f9a6d364053fabdc442b381b2fa3874049 --- /dev/null +++ b/generativeactivelearningforlongtailedinstancesegmentation/63ddde24-05f3-439f-ae83-2aaa92bbf75f_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:575280d30a91063007ab5ee18700efe0b3603a99137694348a54d811a179c962 +size 162901 diff --git a/generativeactivelearningforlongtailedinstancesegmentation/63ddde24-05f3-439f-ae83-2aaa92bbf75f_origin.pdf b/generativeactivelearningforlongtailedinstancesegmentation/63ddde24-05f3-439f-ae83-2aaa92bbf75f_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a33f56b44c14a4889595f05f36852231d2e2402e --- /dev/null +++ b/generativeactivelearningforlongtailedinstancesegmentation/63ddde24-05f3-439f-ae83-2aaa92bbf75f_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e3f6d546165290d5cc4dd8b75253169cf194d95970db09438e3250190ee51d4 +size 3090901 diff --git a/generativeactivelearningforlongtailedinstancesegmentation/full.md b/generativeactivelearningforlongtailedinstancesegmentation/full.md new file mode 100644 index 0000000000000000000000000000000000000000..c3392ef87b3968af7138ee27cdc1d29e6ca8ab5a --- /dev/null +++ b/generativeactivelearningforlongtailedinstancesegmentation/full.md @@ -0,0 +1,581 @@ +# Generative Active Learning for Long-tailed Instance Segmentation + +Muzhi Zhu $^{1*}$ Chengxiang Fan $^{1*}$ Hao Chen $^{1}$ Yang Liu $^{1}$ Weian Mao $^{2,1}$ Xiaogang Xu $^{3,1}$ Chunhua Shen $^{1,4}$ + +# Abstract + +Recently, large-scale language-image generative models have gained widespread attention and many works have utilized generated data from these models to further enhance the performance of perception tasks. However, not all generated data can positively impact downstream models, and these methods do not thoroughly explore how to better select and utilize generated data. On the other hand, there is still a lack of research oriented towards active learning on generated data. In this paper, we explore how to perform active learning specifically for generated data in the long-tailed instance segmentation task. Subsequently, we propose BSGAL, a new algorithm that online estimates the contribution of the generated data based on gradient cache. BSGAL can handle unlimited generated data and complex downstream segmentation tasks effectively. Experiments show that BSGAL outperforms the baseline approach and effectually improves the performance of long-tailed segmentation. + +# 1. Introduction + +Data is one of the driving forces behind the development of artificial intelligence. In the past, securing high-quality data was a time-consuming and laborious task. Yet, a large amount of high-quality data is crucial for a model to achieve breakthrough performance. Therefore, many active learning methods have emerged to explore the most informative samples from massive unlabeled data to achieve better model performance with minimal annotation costs. Currently, the rapid development of generative models has made it possible to obtain massive amounts of high-quality data, including long-tailed data, at a relatively low cost. In the field of visual perception, there have been many works utilizing + +*Equal contribution 1Zhejiang University, China 2The University of Adelaide, Australia 3The Chinese University of Hong Kong, China 4Ant Group. Correspondence to: Hao Chen . + +Proceedings of the $41^{st}$ International Conference on Machine Learning, Vienna, Austria. PMLR 235, 2024. Copyright 2024 by the author(s). + +generated data to improve perception tasks, including classification (Azizi et al., 2023), detection (Chen et al., 2023), and segmentation (Wu et al., 2023b). However, they often directly use generated samples as mixed training data (Yang et al., 2023) or as data augmentation (Zhao et al., 2023) without exploring how to better filter and utilize the data for downstream models. + +On the other hand, existing data mining and filtering methods, such as active learning, have only been validated on real data and are not suitable for generated data, as there are differences between generated data and real data regarding characteristics and usage scenarios. The differences are mainly as follows: 1) Existing data analysis methods are aimed at a limited data pool, while the scale of generated data is almost infinite. 2) Active learning is often carried out under a specified annotation budget. Thanks to the development of conditional generative models, the annotation cost of generated data can be almost negligible. However, this results in an unclear and uncertain quality of annotation in generated data compared to expert annotations. 3) There are differences in the distribution between real data and generated data, while the target data of previous methods do not have obvious distribution differences. + +In response to the aforementioned challenges, we propose a novel problem called "Generative Active Learning for Long-tailed Instance Segmentation" (see Figure 1), which investigates how to utilize generated data effectively for downstream tasks. We focus on long-tailed instance segmentation for three main reasons. First, data collection for long-tailed categories is exceedingly arduous, and how to do classification well is currently a focus in the segmentation field (Kirillov et al., 2023; Li et al., 2023a; Yuan et al., 2024; ?: Zou et al., 2023; Liu et al., 2023). Given that generated data has demonstrated the potential to alleviate this difficulty (Zhao et al., 2023; Xie et al., 2023; Fan et al., 2024), it is necessary to introduce generated data for long-tail segmentation tasks. Second, the quality requirements for generated data in long-tailed instance segmentation tasks are very high, and not all generated data can have a promoting effect. Therefore, it is necessary to further explore how to screen generated data. Third, this task itself is very comprehensive and challenging, which has more guiding significance for migration to real-world scenarios. + +![](images/72aa04e41c9d7bba0e4ca658eacd046fe19e3de2f3dfa18988c37e3b787faba6.jpg) +(a) Traditional Active Learning + +![](images/1b389ade06293479cdbb7963a5166c713f89f99f033e41e0d5f749b52939bb46.jpg) +(b) Generative Active Learning +Figure 1. Comparison between Traditional Active Learning and Generative Active Learning frameworks. (a) Traditional Active Learning relies on a human oracle, therefore the annotation is accurate but with a limited budget, so the model is required to select the most informative unlabeled data. (b) Generative Active Learning, which relies on a generative oracle, has an unlimited labeled pool. However, the quality of annotation varies greatly, so the model must judiciously accept data. + +Here, our objective is to design a generative active learning pipeline targeted at long-tailed image segmentation tasks. Inspired by data-influence analysis methods (Ling, 1984; Koh and Liang, 2017), we first use the change of the loss value to provide an estimation of the contribution of a single generated instance in the ideal case, as discussed in Section 4.1. Employing the first-order Taylor expansion, we introduce an approximate contribution estimation function based on the gradient dot product, which avoids repeated calculations on the test set in the offline setting. Based on this technique, we conduct a toy experiment on CIFAR-10 (Krizhevsky et al., 2009) in Section 5.1.1 along with a qualitative analysis of each sample on the LVIS dataset in Section 5.2.2, which preliminarily verify the feasibility of our approach. Subsequently, in Section 4.2 we explore how to apply this evaluation function to the actual segmentation training process. We propose the Batched Streaming Generative Active Learning algorithm (BSGAL), which allows for online acceptance or rejection of each batch of generated data. Additionally, based on the first-order gradient approximation, we maintain a gradient cache based on momentum updates to enable a more stable contribution estimation. Finally, experiments are carried out on the LVIS dataset, establishing that our method outperforms both unfiltered or CLIP-filtered counterparts under various backbones. Notably, in the long-tailed category, there is an over $10\%$ improvement in $AP_r$ (Gupta et al., 2019). In addition, We conduct a series of ablation experiments to delve into the particulars of our algorithmic design, including the choice of loss, the way of contribution estimation, and the sampling strategy of the test set. To summarize, our primary contributions are detailed below: + +- We introduce a novel problem called "Generative Ac + +tive Learning for Long-tailed Instance Segmentation": how to design an effective method focused on the successful using generated data, aimed at enhancing the performance of downstream segmentation tasks. Existing data analysis methods are neither directly applicable to generated data nor have they been affirmed as efficient for such data. + +- We propose a batched streaming generative active learning method (BSGAL) based on gradient cache to estimate generated data contribution. This pipeline can adapt to the actual batched segmentation training process, handle unlimited generative data online, and effectively enhance the performance of the model. +- We carry out experiments on the LVIS dataset and demonstrate that our method outperforms both unfiltered and CLIP-filtered methods. Our model surpasses the baseline by $+1.2$ on $AP_{box}$ and $+3.62$ on $AP_{r}$ . We also conduct more comprehensive analysis experiments on the design or hyperparameters of our method. + +# 2. Related work + +# 2.1. Generative Data Augmentation + +Generative data augmentation (GDA) refers to using generative models to synthesize additional data for augmentation. With the continuous improvement in the capabilities of generative models (Goodfellow et al., 2020; Sahara et al., 2022; Rombach et al., 2022b), GDA has become a popular technique for improving model performance. Several works use GDA in perceptual tasks such as classification (Feng et al., 2023; Zhang et al., 2023; Azizi et al., 2023), detection (Zhao et al., 2023; Chen et al., 2023), and segmentation (Li et al., 2023b; Wu et al., 2023b;a; Xie et al., 2023). Early works (Zhang et al., 2021; Li et al., 2022) involve the use of generative models like Generative Adversarial Networks (GANs) (Goodfellow et al., 2020) to generate additional training data. With the evolution of diffusion models, recent works (Azizi et al., 2023; Li et al., 2023b; Wu et al., 2023b; Yang et al., 2023; Zhao et al., 2023) favor using high-quality diffusion models such as Imagen (Saharia et al., 2022) and Stable Diffusion (Rombach et al., 2022b) for data generation. X-Paste (Zhao et al., 2023) has proven the strategy of using copy-paste to be more effective than directly using generated data for mixed training, and for the first time demonstrated that using generated data can enhance the performance of segmentation models on the long-tailed segmentation dataset LVIS (Gupta et al., 2019). Therefore, we consider it as the baseline for our work. However, while previous works have investigated the effects of GDA on different tasks, there has been limited exploration on how to better filter and utilize generative data for downstream perception models. + +# 2.2. Active Learning and Data Analysis + +Analysis of the information or contribution of data samples to a model has been extensively studied long before the advent of deep learning. Among them, two fields are most relevant to our work, one is active learning, and the other is training data influence analysis. + +Active learning (Ren et al., 2021) mainly focuses on how to explore the most informative samples from massive unlabeled data to achieve better model performance with minimal annotation costs. Generally speaking, active learning can be divided into two categories. One is uncertainty-based active learning, which measures the uncertainty of samples by the posterior probability of the predicted category (Lewis and Catlett, 1994; Lewis, 1995; Goudjil et al., 2018) or the entropy of the predicted distribution (Joshi et al., 2009; Luo et al., 2013), and then selects the most uncertain samples for annotation. The other is diversity-based active learning, which is based on clustering (Nguyen and Smeulders, 2004) or core-set (Sener and Savarese, 2018) methods. They attempt to mine the most representative samples from the data to achieve minimal annotation costs. Recently, active learning in deep learning also tends to adopt a batch-based sample querying method (Ash et al., 2020), which is consistent with our work. The most relevant work to our work is VeSSAL (Saran et al., 2023), which does batched active learning in a streaming setting and samples in a gradient space. Another relatively related work (Mahapatra et al., 2018) trains a GAN on medical images, using the GAN to generate more data for active learning. + +Training data influence analysis (Hammoudeh and Lowd, 2022) explores the relationship between training data samples and model performance, which can be divided into retraining-based (Ling, 1984; Roth, 1988; Feldman and Zhang, 2020) and gradient-based (Koh and Liang, 2017; Yeh et al., 2018). The most typical retraining-based method is Leave-One-Out (Ling, 1984; Jia et al., 2021), which measures the contribution of a sample to the model by removing a sample from the training set and then retraining the model. However, this method is obviously impractical for modern large-scale datasets. Therefore, many gradient-based methods have emerged recently, which use gradients to approximate the change of loss, such as using first-order Taylor expansion or Hessian matrix, to estimate the influence of samples. The most relevant work to ours is TracIn (Pruthi et al., 2020), which implements heuristic dynamic estimation through first-order gradient approximation and stored checkpoints. Unlike our work, the ultimate goal of TracIn is to estimate and filter out unlabeled samples in the training set through self-influence. Moreover, TracIn is only applicable to small-scale classification datasets, it is difficult to migrate to larger and complex tasks like segmentation, let alone handle nearly infinite generated data. Our work + +# Algorithm 1 Pipeline for copy-paste baseline + +Require: labeled real data $\mathcal{R}$ , generated data $\mathcal{G}$ , batch size $B$ , number of iterations $T$ , pretrained segmentation network $f$ with parameters $\theta$ , maximum number of paste instances $K$ for each image + +1: for $t = 1$ to $T$ do + +2: Sample a batch of real data $\mathcal{R}_b\in \mathcal{R}$ + +3: for $\mathbf{I}_r\in \mathcal{R}_b$ do + +4: Get a random number $k$ from $[0, K]$ + +5: Sample $k$ instances from $\mathcal{G}$ in a class-balanced way to get $\widehat{\mathbf{I}}_r$ , $\widehat{\mathbf{Y}}_r = \text{Copypaste}(\mathcal{G}_b, \mathbf{I}_r)$ + +6: end for + +7: Train $f$ on this augmented data $\widehat{\mathcal{R}}_b$ and update $\theta$ + +8: end for + +9: return: Final segmentation network $f$ with parameters $\theta$ + +succeeds in designing an automated pipeline for utilizing generated data to enhance downstream perception tasks. + +Most importantly, the above work is all done on relatively simple classification tasks, and only a few works have explored more complex perception tasks such as detection (Shrivastava et al., 2016; Liu et al., 2021) and segmentation (Jain and Grauman, 2016; Vezhnevets et al., 2012; Casanova et al., 2020), but they are all aimed at real data. Our work is the first to explore the generated data on the complex perception task of long-tail instance segmentation. + +# 3. Preliminary + +Formally, in generated data augmented instance segmentation tasks, we have a set of labeled real data $\mathcal{R} = \{(\mathbf{I}_r,\mathbf{Y}_r)\}$ and a set of generated data (with noisy label) $\mathcal{G} = \{(\mathbf{I}_g,\mathbf{Y}_g)\}$ where $\mathbf{I}$ is the image and $\mathbf{Y}$ is the label for instance segmentation. Our goal is to effectively utilize the existing data $\mathcal{R}$ and $\mathcal{G}$ to train a segmentation network $f$ parameterized by $\theta$ to achieve optimal performance on unseen test data $\mathcal{U} = \{(\mathbf{I}_u,\mathbf{Y}_u)\}$ , that is, minimize the loss on the test set $L_{\mathcal{U}}(\theta) = \sum_{(\mathbf{I}_u,\mathbf{Y}_u)\in \mathcal{U}}\ell (\mathbf{I}_u,\mathbf{Y}_u;\theta)$ , where $\ell$ represents the loss of the segmentation network. The most direct way to utilize the two types of data is to perform joint training, and X-Paste proves that using the copy-paste (Ghiasi et al., 2021) method to add instances from $\mathbf{I}_g$ to real images $\mathbf{I}_r$ can achieve better results. Although our method is universal, we build it upon a copy-paste baseline. For the convenience of subsequent description, we record this operation as Copypaste such that $\widehat{\mathbf{I}}_r$ , $\widehat{\mathbf{Y}}_r = \text{Copypaste}(\mathcal{G}_b,\mathbf{I}_r)$ , where $\mathcal{G}_b\in \mathcal{G}$ is a subset sampled from $\mathcal{G}$ , $\widehat{\mathbf{I}}_r$ and $\widehat{\mathbf{Y}}_r$ represent the image and the label obtained after pasting the instance in $\mathcal{G}_b$ to $\mathbf{I}_r$ . + +As shown in Algorithm 1, it displays the overall process of our baseline, which does not consider the different impacts each sample could impose on the model. In other words, + +our aim is to identify a function, $\phi(g, \theta)$ , capable of gauging the contribution of any given generated sample $g \in \mathcal{G}$ to the current model $f$ . Then, via this scoring mechanism, we can filter and retain the most helpful samples for the model and simultaneously discard those that are useless or even harmful to the model. + +# 4. Our method + +# 4.1. Estimation of Contribution in the Ideal Scenario + +Here we first provide the ideal estimation of the contribution of an independent sample. Assuming that a target test set $\mathcal{U}$ is given, the contribution of $g\in \mathcal{G}$ to $f$ can be measured by calculating the change in the loss of $f$ on $\mathcal{U}$ , that is, + +$$ +\phi (g, \theta) = L _ {\mathcal {U}} (\theta) - L _ {\mathcal {U}} (\theta + \Delta \theta_ {g}) \tag {1} +$$ + +where $\Delta \theta_{g}$ represents the one-step gradient update on $g$ , that is, + +$$ +\Delta \theta_ {g} = - \alpha \nabla_ {\theta} \ell (\mathbf {I} _ {g}, \mathbf {Y} _ {g}; \theta) \tag {2} +$$ + +where $\alpha$ represents the learning rate. + +Moreover, we can employ the classic first-order Taylor expansion to approximate $\phi(g,\theta)$ , which has also been widely used in previous work (Pruthi et al., 2020; He et al., 2023). Note that, it is possible to use more sophisticated methods here, e.g., Koh and Liang (2017). + +Lemma 4.1. The loss of a network $f$ on a dataset $\mathcal{U}$ can be approximated by a first-order approximation: + +$$ +L _ {\mathcal {U}} (\theta + \Delta \theta) = L _ {\mathcal {U}} (\theta) + \Delta \theta^ {T} \nabla_ {\theta} L _ {\mathcal {U}} (\theta) + O (\Delta \theta^ {2}) (3) +$$ + +So the contribution of $g$ to $f$ can be approximated by: + +$$ +\phi (g, \theta) \approx \phi_ {a} (g, \theta) = \alpha \nabla_ {\theta} \ell (\mathbf {I} _ {g}, \mathbf {Y} _ {g}; \theta) ^ {T} \nabla_ {\theta} L _ {\mathcal {U}} (\theta) \tag {4} +$$ + +Remark 4.2. Advantages of first-order approximation: In the case of a fixed test set $\mathcal{U}$ , it eliminates the need for multiple forward computations on $\mathcal{U}$ , requiring only one forward computation and one backward propagation. so it brings the possibility expand the scale of $\mathcal{U}$ . Besides, the fact that there is no need to update the weights makes our subsequent designs more flexible. + +Remark 4.3. (Test set) In real-world scenarios, the test set $\mathcal{U}$ is typically unknown. A straightforward solution might be to reserve a part of the training set $\mathcal{R}$ as an unseen test set. However, this approach poses issues for datasets with significant category imbalance, such as LVIS, where certain long-tailed categories only appear once in the training set. In light of this, we resort to a strategy that involves sampling a subset of $\mathcal{R}$ to serve as the test set $\mathcal{U}$ for each iteration. See Section 5.2.2 for more details. + +# 4.2. Batched Streaming Generative Active Learning + +While we have proposed an ideal estimation of contribution in the preceding section, it is not directly transferable to a real segmentation training process. The specific reasons are as follows: + +1. In the previous discussion, we posit that $g \in \mathcal{G}$ is an independent sample, yet we actually paste multiple instances from $\mathcal{G}$ to $I_r$ . This results in reciprocal influences among these instances, as well as interactions with $I_r$ . +2. We conduct batch data training, eliminating the possibility of estimating each instance individually, as this would provoke excessive computation. +3. Our model undergoes constant updates. Therefore, even the same sample's contribution to the model varies under different training stages. Furthermore, given the near-infinite data pool, the entire training process closely resembles a streaming process(Saran et al., 2023). After each data entry, we must decide whether to include this data in the present update. + +For the first and second points, we redefine the contribution function $\phi(g,\theta)$ so that it can simultaneously consider the mutual influence between multiple instances and the real image $I_r$ , and can also adapt to batch data training. + +Definition 4.4. Specifically, for a certain iteration $t$ , we introduce a batch of data $\mathcal{R}_b$ and the corresponding instances $\mathcal{G}_b$ to be pasted. We will paste $\mathcal{G}_b$ to each image in $\mathcal{R}_b$ in a predefined random way to get $\widehat{\mathcal{R}}_b = \mathcal{R}_b \oplus \mathcal{G}_b$ . Then our contribution function $\phi(\mathcal{G}_b, \mathcal{R}_b, \theta)$ can be defined as + +$$ +\phi \left(\mathcal {G} _ {b}, \mathcal {R} _ {b}, \theta\right) = L _ {U} \left(\theta + \Delta \theta_ {\mathcal {R} _ {b}}\right) - L _ {U} \left(\theta + \Delta \theta_ {\widehat {\mathcal {R}} _ {b}}\right) \tag {5} +$$ + +where $\Delta \theta_{\widehat{\mathcal{R}}_b}$ represents a one-step gradient update on $\widehat{\mathcal{R}}_b$ : + +$$ +\Delta \theta_ {\widehat {\mathcal {R}} _ {b}} = - \alpha \nabla_ {\theta} L _ {\widehat {\mathcal {R}} _ {b}} (\theta) \tag {6} +$$ + +Likewise, $\Delta \theta_{\mathcal{R}_b}$ represents a one-step gradient update on $\mathcal{R}_b$ + +In response to the third point, based on Definition 4.4, we can propose an algorithm called Batched Streaming Generative Active Learning (BSGAL), as shown in Algorithm 2. + +The basic idea is to calculate the loss and gradient of the model on $\widehat{\mathcal{R}}_b$ and $\mathcal{R}_b$ respectively and use the two updated models to calculate the loss on $\mathcal{U}_b$ . Then measure the contribution of $\mathcal{G}_b$ with the difference of two losses. Ultimately, we decide whether to accept this batch of generated data. + +As pointed out in Remark 4.2, there are some advantages of using one-order approximation. Building upon Lemma 4.1, + +Algorithm 2 Batched streaming generative active learning (BSGAL) +```txt +Require: labeled real data $\mathcal{R}$ , generated data $\mathcal{G}$ , batch size $B$ , number of iterations $T$ , pretrained segmentation network $f$ with parameters $\theta$ , maximum number of paste instances $K$ for each image, one step learning rate $\alpha$ , contribution threshold $\tau$ +``` + +1: for $t = 1$ to $T$ do +2: Sample a batch of real data $\mathcal{R}_b\in \mathcal{R}$ with batch size $B_{accept}$ . +3: for $(\mathbf{I}_r,\mathbf{Y}_r)\in \mathcal{R}_b$ do +4: Get a random number $k$ from $[0, K]$ +5: Sample $k$ instances in a class-balanced way from $\mathcal{G}$ to get $\hat{\mathbf{I}}_r$ , $\hat{\mathbf{Y}}_r = \text{Copypaste}(\mathcal{G}_b, \mathbf{I}_r)$ +6: end for +7: Merge all the augmented image and label pairs to get $\widehat{\mathcal{R}}_b = \mathcal{R}_b\oplus \mathcal{G}_b$ +8: Calculate loss on $\mathcal{R}_b$ and $\widehat{\mathcal{R}}_b$ and get the gradient $\nabla_{\theta}L_{\mathcal{R}_b}(\theta)$ and $\nabla_{\theta}L_{\widehat{\mathcal{R}}_b}(\theta)$ +9: Sample a batch of data $\mathcal{U}_b\in \mathcal{R}$ as test set with batch size $B_{test}$ +10: Calculate the contribution $\phi (\mathcal{G}_b,\mathcal{R}_b,\theta)$ using Equation (5) +11: if $\phi (\mathcal{G}_b,\mathcal{R}_b,\theta) > \tau$ then +12: Train $f$ on this augmented data $\widehat{\mathcal{R}}_b$ and update $\theta$ +13: else +14: Train $f$ on this real data $\mathcal{R}_b$ and update $\theta$ +15: end if +16: end for +17: return: Final segmentation network $f$ with parameters $\theta$ + +we can further approximate $\phi (\mathcal{G}_b,\mathcal{R}_b,\theta)$ as + +$$ +\phi \left(\mathcal {G} _ {b}, \mathcal {R} _ {b}, \theta\right) \approx \alpha \nabla_ {\theta} \left(L _ {\hat {\mathcal {R}} _ {b}} (\theta) - L _ {\mathcal {R} _ {b}} (\theta)\right) ^ {T} \nabla_ {\theta} L _ {U} (\theta) \tag {7} +$$ + +So the Algorithm 2 can be further simplified by using Equation (7) in Line 10. + +Remark 4.5. (Batch size) It is crucial to note that three distinct batch sizes here, one is the batch size $B_{train}$ for model update, one is the batch size $B_{accept}$ for calculating the data contribution to determine whether to accept, and the other is the batch size $B_{test}$ of the test set formed by sampling. These three are not necessarily identical. Ideally, a smaller $B_{accept}$ is preferable – when the batch size is reduced to 1, it allows for a more accurate per-image estimation. In the actual implementation process, we execute this algorithm independently on each GPU, except for summing up all losses when updating the model. Consequently, the batch size $B_{train} = B_{accept} \times \#GPU$ . + +Usually, due to the limitation of GPU memory, $\mathcal{U}_b$ can only take a very small batch size $B_{test}$ , which will lead to the instability and inaccuracy of the estimation of $\phi (\mathcal{G}_b,\mathcal{R}_b,\theta)$ . Thanks to the one-order approximation, we can consider + +Algorithm 3 Contribution estimation based on gradient cache +```latex +Require: gradient $\nabla_{\theta}L_{\mathcal{R}_b}(\theta)$ , gradient $\nabla_{\theta}L_{\widehat{\mathcal{R}}_b}(\theta)$ , momentum coefficient $\beta$ , current iteration $t$ , model parameters $\theta$ , sampled test set $\mathcal{U}_b$ +``` + +1: Calculate loss on $\mathcal{U}_b$ to get $L_{\mathcal{U}_b}$ and get the grad $\nabla_{\theta}L_{\mathcal{U}_b}(\theta)$ +2: if $t == 1$ then +3: Initialize grad cache $\mathbf{C} = \nabla_{\theta}L_{\mathcal{U}_b}(\theta)$ +4: else +5: Update the grad cache with the grad of current batch $\mathbf{C} = \beta \mathbf{C} + (1 - \beta)\nabla_{\theta}L_{\mathcal{U}_b}(\theta)$ +6: end if +7: Calculate the contribution of $\mathcal{G}_b$ as $\phi (\mathcal{G}_b,\mathcal{R}_b,\theta) = \alpha \nabla_{\theta}(L_{\widehat{\mathcal{R}}_h}(\theta) - L_{\mathcal{R}_b}(\theta))^T\mathbf{C}$ +8: return: $\phi(\mathcal{G}_b, \mathcal{R}_b, \theta)$ + +more test data when calculating $\phi (\mathcal{G}_b,\mathcal{R}_b,\theta)$ . Specifically, we can keep a grad cache to record the grad obtained on other batches in the previous iterations. Every time we get the current batch $\nabla_{\theta}L_{\mathcal{U}_b}(\theta)$ , we will update the grad cache in a momentum way. Then when calculating $\phi (\mathcal{G}_b,\mathcal{R}_b,\theta)$ we use the grad in the grad cache to replace the grad of the current batch, which is equivalent to expanding the scale of $\mathcal{U}_b$ , thereby achieving a more stable estimation. + +However, this batch size $B_{test}$ is not the bigger the better. Our subsequent experiments prove that if we use the grad cache to approximate the entire training set $\mathcal{R}$ as $\mathcal{U}_b$ , it will lead to a decrease in the performance of the model. We believe that this is caused by overfitting. When we approximate the entire training set $\mathcal{R}$ as $\mathcal{U}_b$ , we can only screen out samples similar to the training set $\mathcal{R}$ , thereby inhibiting the diversity of the data. Diversity is also an important factor considered in many active learning works. We believe that the design here parallels the idea of diversity-based active learning (Sener and Savarese, 2018; Geifman and El-Yaniv, 2017) using a core-set, with the only difference being that core-set methods mine the most representative samples from unlabeled data, while we randomly sample some from the labeled real data to act as a kind of "core-set". In our task, the diversity of generated data is particularly crucial for long-tailed categories, which can effectively bridge the gap between scarce training data and real-world distribution. Therefore, we need to balance the stability of the estimation and the diversity of the data. Thus, we use the momentum method to update the grad cache, which can ensure the stability of the estimation to a certain extent, and at the same time will not inhibit the diversity of the data. + +The modified contribution estimation algorithm for the final BSGAL is shown in Algorithm 3. + +Remark 4.6. (Extension to offline learning) Offline learning needs to satisfy the following two assumptions: 1. The generated data is limited or small in scale. 2. The model pa + +rameters will not change significantly during the fine-tuning process. Our method can also be easily extended to the case of offline learning. Specifically, we only need to use a fixed model, and then use the entire dataset $\mathcal{R}$ as the test set $\mathcal{U}$ . Forward and backward once on the entire dataset, we can get the gradient $\nabla_{\theta}L_{\mathcal{U}}(\theta)$ for the entire dataset. Then we can use this gradient to calculate the contribution of each generated sample. Using Equation (4), we can estimate the contribution of each generated sample. + +# 5. Experiments + +First, we perform some analytical experiments in an offline setting (as discussed in Remark 4.6) to verify the feasibility of our method and also to facilitate a better understanding of our method for readers. Then, we conduct the main experiments under the online setting, compared with our baseline. Key ablation studies are also conducted to substantiate the efficiency of our method. Detailed information about the implementation can be found in Appendix A. + +# 5.1. Offline Setting + +# 5.1.1. CIFAR-10 + +In this section, we conduct a toy experiment on CIFAR-10 (Krizhevsky et al., 2009) to verify our method. The original CIFAR-10 dataset comprises five splits within the training set, each containing 10,000 images, and a test set equally housing 10,000 images. We use the first split in the training set as our training set $\mathcal{R}$ , and the remaining 4 splits are added with noise of different scales (40,100,200,400) to simulate the generated data $\mathcal{G}$ . We use the model trained only on the first split to perform offline mining and then use 1000 images in the first split as test set $\mathcal{U}$ . By estimating the contribution of each sample, we can draw the distribution of the contribution of samples on different splits. + +As shown in Figure 2, it is observable that with the escalating scale of noise, the distribution of contributions progressively shifts to the left. This indicates that excessive noise tends to negatively impact the model. Note that the split with a noise of 0 is our training set, so we can see that the contribution values of these samples are concentrated around zero. In other words, these samples can no longer bring positive effects to the model because they have been fully utilized in previous training. This observation is consistent with some previous active learning work (Cai et al., 2013; Ash et al., 2021; Saran et al., 2023), where they also estimate the amount of information or the difficulty level of samples through gradients. However, they do not consider the positive or negative contributions but only select samples with larger absolute values. We further conduct quantitative experiments, as shown in Table 1, to prove that using our method to select data can effectively improve the + +![](images/a7a5ba63e582fd94a75d9e415978694a77be93fa3ab8c90534e4726bb4e583da.jpg) +Figure 2. The distribution of contributions under different noise scales. + +Table 1. Using our method to select samples brings improvement to the model. + +
Training setAccuracy (avg ± std)
only R86.28 ± 0.55
R + all G86.71 ± 0.21
R + selected G87.61 ± 0.20
+ +performance of the model. + +# 5.1.2. LVIS + +We further carry out offline experiments on the generated data of LVIS categories, qualitatively examining the efficacy of our method. We calculate the gradient $\nabla_{\theta}L_{\mathcal{U}}(\theta)$ preemptively on the LVIS training set with a trained model. + +This gradient then serves to estimate each instance's contribution. Subsequently, we rank these instances in decreasing order of their contribution, facilitating per-image analysis. As an illustrative example, we use a 'bun' category from the LVIS, because we discover that Stable Diffusion does not perform optimally within this category, often leading to confusion between 'bun' and 'bunny', thereby resulting in the generation of ambiguous data. As depicted in Figure 3, it can be observed that the instances having the most significant contributions are nearly unambiguous, whereas the instances with minimal contributions are mostly incorrect, resulting in rabbit images being generated. Therefore, through our method, we can effectively filter out the generated data with ambiguity. + +To verify the indispensability of online learning, we first use the offline method to filter the generated data for training and compare it with our baseline. As shown in Figure 4, the offline method can only bring a slight improvement to the + +Table 2. Main results on LVIS. " $^+$ CLIP" means using CLIP to filter the generated data. + +
MethodBackboneAPboxAPmaskAPrboxAPrmaskAPcboxAPcmaskAPfboxAPfmask
BaselineR5034.2030.3924.3322.2133.2329.5739.6334.89
Baseline + CLIPR5034.3530.7025.9924.3832.8329.4139.7134.92
OursR5035.4031.5627.9525.4334.1430.5640.0735.37
BaselineSwin-L49.5743.8544.8739.6649.7444.6451.4644.82
Baseline + CLIPSwin-L49.8044.5145.2840.6249.3344.9652.3045.72
OursSwin-L50.4744.8547.5542.3750.4345.4751.7945.26
+ +![](images/2cf773abf945918bf7f58b0effa176b9869a638d772d0f4090837b6e48aa3cb5.jpg) +Figure 3. The best and worst samples found using our contribution estimation function for a LVIS class 'bun'. +Figure 4. Performance of the model under different iterations. + +final model performance. In addition, in the early stage of model training, this performance improvement is still quite obvious, but with the training process, this performance improvement gradually diminishes. We conjecture that this trend is likely due to the offline contribution estimation's reliance on the initial model, and as the model undergoes training, the parameters change significantly, which leads to the inaccuracy of the offline contribution estimation. Therefore, the necessity arises for online contribution estimation. + +# 5.2. Online Setting + +# 5.2.1. MAIN RESULTS + +To validate the effectiveness of our method in handling long-tailed segmentation tasks, we perform experiments on the LVIS (Gupta et al., 2019) dataset. A strong baseline — X-Paste (Zhao et al., 2023), is compared with our method. We further examine the impact of the usage (or non-usage) of CLIP (Radford et al., 2021), as mentioned in their paper, for filtering generated data. Given that X-Paste does not open source the generated data used, we have re-implemented the data generation pipeline and generated thousands of images + +![](images/cde8cec0fdb697ed84bea93a5259227a2501fd7784ec680cdc614553e3ad1412.jpg) + +for each category of LVIS. The specific generation details are shown in the appendix. In addition, original X-Paste also uses retrieval to obtain extra real data and uses Copy-Paste to augment the real training data. Since the primary focus of our methodology is on the selection of generated data, to mitigate the influences from those additional factors, we choose to refrain from using these tricks. + +As shown in Table 2, following X-Paste, the segmentation architecture we used is CenterNet2 (Zhou et al., 2021), and we test two different backbones, ResNet50 (He et al., 2016) and Swin-L (Liu et al., 2022). It can be observed that the impact of filtration via CLIP is rather subtle, with the $AP^{box}$ witnessing an increment of merely $0.1 \sim 0.2$ points. Furthermore, we also find that CLIP filtering shows a more significant improvement on $AP^{mask}$ . Conversely, our method continues to deliver substantial improvements across all categories when contrasted with the use of CLIP filtration. This improvement is especially notable for long-tailed categories, $AP_{r}^{box}$ increases by $2 \sim 2.3$ , and $AP_{r}^{mask}$ increases by $1 \sim 1.7$ . + +# 5.2.2. ABLATION + +Table 3. Comparison of different ${L}_{\text{test }}$ on contribution estimation. + +
LossAPboxAPmaskAPrboxAPrmask
cls35.2431.4928.1425.74
cls stage034.9431.2326.3424.27
all34.9830.9426.9123.87
+ +Table 4. Comparison of different algorithms we designed. + +
MethodAPboxAPmaskAPrboxAPrmaskAPcboxAPcmaskAPfboxAPfmask
Loss estimate (Algorithm 2)35.1131.2927.4725.1033.5530.1440.2035.30
Grad estimate (Equation (7))35.2431.4928.1425.7433.6730.3140.1235.34
Grad cache (Algorithm 3)35.4031.5627.9525.4334.1430.5640.0735.37
Grad cache (global)35.0731.3826.8424.8233.7430.3640.1835.40
+ +Loss. The algorithm in Section 4.2 deploys two distinct types of loss. First is the loss used to train and finally update the model, $L_{train}$ , which is subject to the original network design. In our case, We utilize the loss in CenterNet2 (Zhou et al., 2021). For the instance segmentation task, the actual $L_{train}$ is composed of multiple tasks and multiple stages of Loss. Specifically, it can be written in the following form1: + +$$ +L _ {\text {t r a i n}} = \sum_ {i = 1} ^ {S} \left(L _ {\text {c l s}} ^ {i} + L _ {\text {b o x}} ^ {i} + L _ {\text {m a s k}} ^ {i}\right) \tag {8} +$$ + +where $S$ represents the number of stages, $L_{cls}^{i}$ , $L_{box}^{i}$ , $L_{mask}^{i}$ represent the classification loss, regression loss, and segmentation loss of the $i$ -th stage, respectively. + +Second is the test loss $L_{test}$ used to estimate the contribution, which does not need to be consistent with $L_{train}$ . Considering that the main purpose of introducing generated data is to improve classification on long-tailed categories, $L_{cls}$ may play a dominant role. Thus, we compare the effects of different $L_{test}$ on contribution estimation in Table 3. + +In this experiment, we are based on Equation (7), where "cls" denotes using all stages of $L_{cls}$ "cls stage0" denotes only using the first stage of $L_{cls}$ , and "all" denotes using all Loss in $L_{train}$ . The findings indicate that if only the $L_{cls}$ of first stage is used, the efficiency of contribution estimation diminishes. Additionally, utilizing all losses within $L_{train}$ does not surpass the performance of solely exploiting $L_{cls}$ , which also verifies our assumption that $L_{cls}$ dominates in contribution estimation, and other losses may cause interference. Therefore, our final decision is to rely singularly on $L_{cls}$ for estimating contribution. + +Contribution estimation. We are interested in whether the three algorithms proposed in Section 4.2 are effective. Therefore, we conduct comparative experiments here, and the specific results are presented in Table 4. + +We observe that there's not a significant difference in performance among the three algorithms, all of which demonstrated efficacy when compared to the baseline. Overall, Algorithm 3 has the best effect, which is also the algorithm we finally adopted. Hence, our proposed method of using a larger test set $\mathcal{U}_b$ , ensuring a smoother and more stable contribution estimation by updating the grad cache with + +momentum, is proven effective. Compared with Grad estimate and Loss estimate, it can be proved that the first-order approximation will not bring significant performance loss. + +As discussed in Section 4.2, there exists a trade-off between the stability of the estimation and the diversity of the filtered data. To verify this, we additionally added the fourth experiment, where we use global average pooling to estimate the contribution. Specifically, We modify the original update method $\mathbf{C} = \beta \mathbf{C} + (1 - \beta)\nabla_{\theta}L_{\mathcal{U}_b}(\theta)$ to be related to the current iteration $t$ , $\mathbf{C} = \frac{t - 1}{t}\mathbf{C} + \frac{1}{t}\nabla_{\theta}L_{\mathcal{U}_b}(\theta)$ . That is, $\mathbf{C} = \frac{1}{t}\sum_{i = 1}^{t}\nabla_{\theta_i}L_{\mathcal{U}_b^i}(\theta_i)$ . + +However, this modification incurs a slight performance drop. We believe that this is due to enforcing the generated data to align with the distribution of the entire training set and suppressing the diversity of the data. For long-tailed categories with relatively few real data, this diversity is quite significant. That's why using global average pooling, $AP_{r}^{box}$ and $AP_{r}^{mask}$ have a significant drop, while $AP_{f}^{mask}$ exhibits an improvement. Correspondingly, Grad estimate, which solely uses the current batch to estimate the contribution of the test set, is most conducive to ensuring data diversity, so the performance of $AP_{r}^{box}$ and $AP_{r}^{mask}$ is the best. + +Table 5. Comparison of different sampling strategies for ${\mathcal{U}}_{b}$ . + +
StrategyAPboxAPmaskAPrboxAPrmask
all classes35.2131.3826.7524.21
pasted classes35.4031.5627.9525.43
all images35.1531.2626.5923.75
+ +Sampling strategy. We compare three different sampling test set strategies: 1. Sample from all classes: Sample uniformly from all categories, and then sample uniformly from the image pool corresponding to the sampled category. 2. Sample from pasted classes: Sample uniformly from the categories in the generated data $\mathcal{G}_b$ used in this batch, and then sample uniformly from the image pool corresponding to the sampled category. 3. Sample from all images: Sample uniformly from all image pools. + +As indicated in Table 5, it is evident that the approach of uniformly sampling from pasted categories delivers the most effective performance, thus we finalize on this sampling strategy. Especially in $AP_{r}^{box}$ and $AP_{r}^{mask}$ , the improvement of this sampling strategy is the most obvious. Compared with sampling from all images, sampling from class + +Table 6. Comparison of random batch-level dropout and our method. + +
MethodAPboxAPmaskAPrboxAPrmask
Random Dropout34.7330.9625.0522.69
Our method35.4031.5627.9525.43
+ +can better ensure the balance of categories, thereby enhancing the impact on rare categories. As for the comparison with sampling from all classes, sampling from pasted classes is more directional, so the estimation of the contribution is more accurate, leading to a boost in overall performance. + +Random batch-level dropout. Our algorithm is essentially to accept or reject the generated data on a batch-by-batch basis. Therefore, when the contribution evaluation of the data is completely invalid, our algorithm degenerates into a random batch-level dropout. To verify that it is not this random dropout that brings performance improvement, we conduct a random batch-level Dropout experiment with the same acceptance rate. Table 6 shows that although random dropout will also bring a slight improvement, compared with our method, there is still a very obvious gap, which shows that the improvement brought by our method is not entirely due to random dropout. + +# 6. Conclusion + +In this paper, we propose a new problem, how to design an effective method to realize the effective screening and utilization of generated data, to further improve the performance of downstream perception tasks. To address this problem, we propose a gradient-based generated data contribution estimation method and embed it into the actual training process. We design a complete pipeline that can automatically generate data to improve the performance of downstream perception tasks. Experiments prove that our method can achieve better performance than unfiltered or CLIP-filtered methods on long-tailed segmentation tasks. + +# Impact Statement + +Our goal is to advance the field of Machine Learning. There are many potential societal consequences of our work, none which we feel must be specifically highlighted here. + +# Acknowledgements + +This work was supported by the National Key R&D Program of China (No. 2022ZD0118700). + +# References + +Jordan Ash, Surbhi Goel, Akshay Krishnamurthy, and Sham Kakade. Gone fishing: Neural active learning with fisher + +embeddings. In Adv. Neural Inform. Process. Syst., pages 8927-8939, 2021. + +Jordan T. Ash, Chicheng Zhang, Akshay Krishnamurthy, John Langford, and Alekh Agarwal. Deep batch active learning by diverse, uncertain gradient lower bounds. In Int. Conf. Learn. Represent., 2020. + +Shekoofeh Azizi, Simon Kornblith, Chitwan Sahara, Mohammad Norouzi, and David J. Fleet. Synthetic data from diffusion models improves imagenet classification. Transactions on Machine Learning Research, 2023. + +Wenbin Cai, Ya Zhang, and Jun Zhou. Maximizing expected model change for active learning in regression. In IEEE Int. Conf. Data Mining, pages 51-60. IEEE, 2013. + +Arantxa Casanova, Pedro O. Pinheiro, Negar Rostamzadeh, and Christopher J. Pal. Reinforced active learning for image segmentation. In Int. Conf. Learn. Represent., 2020. + +Kai Chen, Enze Xie, Zhe Chen, Lanqing Hong, Zhenguo Li, and Dit-Yan Yeung. Integrating geometric control into text-to-image diffusion models for high-quality detection data generation via text prompt. arXiv preprint arXiv:2306.04607, 2023. + +Chengxiang Fan, Muzhi Zhu, Hao Chen, Yang Liu, Weijia Wu, Huaqi Zhang, and Chunhua Shen. Divergen: Improving instance segmentation by learning wider data distribution with more diverse generative data. arXiv preprint arXiv:2405.10185, 2024. + +Vitaly Feldman and Chiyuan Zhang. What neural networks memorize and why: Discovering the long tail via influence estimation. Adv. Neural Inform. Process. Syst., 33: 2881-2891, 2020. + +Chun-Mei Feng, Kai Yu, Yong Liu, Salman Khan, and Wangmeng Zuo. Diverse data augmentation with diffusions for effective test-time prompt tuning. In Int. Conf. Comput. Vis., pages 2704-2714, 2023. + +Yonatan Geifman and Ran El-Yaniv. Deep active learning over the long tail. arXiv preprint arXiv:1711.00941, 2017. + +Golnaz Ghiasi, Yin Cui, Aravind Srinivas, Rui Qian, Tsung-Yi Lin, Ekin D Cubuk, Quoc V Le, and Barret Zoph. Simple copy-paste is a strong data augmentation method for instance segmentation. In IEEE Conf. Comput. Vis. Pattern Recog., pages 2918-2928, 2021. + +Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial networks. Communications of the ACM, 63(11):139-144, 2020. + +Mohamed Goudjil, Mouloud Koudil, Mouldi Bedda, and Noureddine Ghoggali. A novel active learning method using svm for text classification. Int. J. Autom. Comput., 15:290-298, 2018. +Agrim Gupta, Piotr Dollar, and Ross Girshick. Lvis: A dataset for large vocabulary instance segmentation. In IEEE Conf. Comput. Vis. Pattern Recog., pages 5356-5364, 2019. +Zayd Hammoudeh and Daniel Lowd. Training data influence analysis and estimation: A survey. arXiv preprint arXiv:2212.04612, 2022. +Haoyu He, Jianfei Cai, Jing Zhang, Dacheng Tao, and Bohan Zhuang. Sensitivity-aware visual parameter-efficient fine-tuning. In Int. Conf. Comput. Vis., pages 11825-11835, 2023. +Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In IEEE Conf. Comput. Vis. Pattern Recog., pages 770-778, 2016. +Suyog Dutt Jain and Kristen Grauman. Active image segmentation propagation. In IEEE Conf. Comput. Vis. Pattern Recog., pages 2864-2873, 2016. +Ruoxi Jia, Fan Wu, Xuehui Sun, Jiacen Xu, David Dao, Bhavya Kailkhura, Ce Zhang, Bo Li, and Dawn Song. Scalability vs. utility: Do we have to sacrifice one for the other in data importance quantification? In IEEE Conf. Comput. Vis. Pattern Recog., pages 8239-8247, 2021. +Ajay J Joshi, Fatih Porikli, and Nikolaos Papanikolopoulos. Multi-class active learning for image classification. In IEEE Conf. Comput. Vis. Pattern Recog., pages 2372-2379. IEEE, 2009. +Alexander Kirillov, Eric Mintun, Nikhila Ravi, Hanzi Mao, Chloe Rolland, Laura Gustafson, Tete Xiao, Spencer Whitehead, Alexander C. Berg, Wan-Yen Lo, Piotr Dollar, and Ross Girshick. Segment anything. In Int. Conf. Comput. Vis., pages 4015-4026, 2023. +Pang Wei Koh and Percy Liang. Understanding black-box predictions via influence functions. In Proc. Int. Conf. Mach. Learn., pages 1885-1894. PMLR, 2017. +Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009. +David D Lewis. A sequential algorithm for training text classifiers: Corrigendum and additional data. In *Acm Sigir Forum*, pages 13-19. ACM New York, NY, USA, 1995. +David D Lewis and Jason Catlett. Heterogeneous uncertainty sampling for supervised learning. In Machine learning proceedings 1994, pages 148-156. Elsevier, 1994. + +Daiqing Li, Huan Ling, Seung Wook Kim, Karsten Kreis, Sanja Fidler, and Antonio Torralba. Bigdatasetan: Synthesizing imagenet with pixel-wise annotations. In IEEE Conf. Comput. Vis. Pattern Recog., pages 21330-21340, 2022. +Feng Li, Hao Zhang, Peize Sun, Xueyan Zou, Shilong Liu, Jianwei Yang, Chunyuan Li, Lei Zhang, and Jianfeng Gao. Semantic-sam: Segment and recognize anything at any granularity. arXiv preprint arXiv:2307.04767, 2023a. +Ziyi Li, Qinye Zhou, Xiaoyun Zhang, Ya Zhang, Yanfeng Wang, and Weidi Xie. Open-vocabulary object segmentation with diffusion models. In Int. Conf. Comput. Vis., pages 7667-7676, 2023b. +Robert F Ling. Residuals and influence in regression, 1984. +Yang Liu, Muzhi Zhu, Hengtao Li, Hao Chen, Xinlong Wang, and Chunhua Shen. Matcher: Segment anything with one shot using all-purpose feature matching. arXiv preprint arXiv:2305.13310, 2023. +Zhuoming Liu, Hao Ding, Huaping Zhong, Weijia Li, Jifeng Dai, and Conghui He. Influence selection for active learning. In Int. Conf. Comput. Vis., pages 9274-9283, 2021. +Ze Liu, Han Hu, Yutong Lin, Zhuliang Yao, Zhenda Xie, Yixuan Wei, Jia Ning, Yue Cao, Zheng Zhang, Li Dong, Furu Wei, and Baining Guo. Swin transformer v2: Scaling up capacity and resolution. In IEEE Conf. Comput. Vis. Pattern Recog., 2022. +Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017. +Timo Lüddecke and Alexander Ecker. Image segmentation using text and image prompts. In IEEE Conf. Comput. Vis. Pattern Recog., pages 7086-7096, 2022. +Wenjie Luo, Alex Schwing, and Raquel Urtasun. Latent structured active learning. Adv. Neural Inform. Process. Syst., 26, 2013. +Dwarikanath Mahapatra, Behzad Bozortabar, Jean-Philippe Thiran, and Mauricio Reyes. Efficient active learning for image classification and segmentation using a sample selection and conditional generative adversarial network. In Int. Conf. Med. Image Comput. Comput.-Assist. Interv., pages 580-588. Springer, 2018. +Hieu T Nguyen and Arnold Smeulders. Active learning using pre-clustering. In Int. Conf. Learn. Represent., page 79, 2004. +Garima Pruthi, Frederick Liu, Satyen Kale, and Mukund Sundararajan. Estimating training data influence by tracing gradient descent. pages 19920-19930, 2020. + +Xuebin Qin, Zichen Zhang, Chenyang Huang, Masood Dehghan, Osmar R Zaiane, and Martin Jagersand. U2-net: Going deeper with nested u-structure for salient object detection. Pattern recognition, 106:107404, 2020. +Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In Proc. Int. Conf. Mach. Learn., pages 8748-8763. PMLR, 2021. +Pengzhen Ren, Yun Xiao, Xiaojun Chang, Po-Yao Huang, Zhihui Li, Brij B Gupta, Xiaojiang Chen, and Xin Wang. A survey of deep active learning. ACM computing surveys (CSUR), 54(9):1-40, 2021. +Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In IEEE Conf. Comput. Vis. Pattern Recog., pages 10684-10695, 2022a. +Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In IEEE Conf. Comput. Vis. Pattern Recog., pages 10684-10695, 2022b. +Alvin E Roth. The Shapley value: essays in honor of Lloyd S. Shapley. Cambridge University Press, 1988. +Chitwan Sahara, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al. Photorealistic text-to-image diffusion models with deep language understanding. Adv. Neural Inform. Process. Syst., 35:36479-36494, 2022. +Akanksha Saran, Safoora Yousefi, Akshay Krishnamurthy, John Langford, and Jordan T. Ash. Streaming active learning with deep neural networks. In Proc. Int. Conf. Mach. Learn., pages 30005-30021. PMLR, 2023. +Ozan Sener and Silvio Savarese. Active learning for convolutional neural networks: A core-set approach. In Int. Conf. Learn. Represent., 2018. +Alex Shonenkov, Misha Konstantinov, Daria Bakshandaeva, Christoph Schuhmann, Ksenia Ivanova, and Nadija Klokova. Deepfloyd-if, 2023. +Abhinav Shrivastava, Abhinav Gupta, and Ross Girshick. Training region-based object detectors with online hard example mining. In IEEE Conf. Comput. Vis. Pattern Recog., pages 761-769, 2016. + +Yukun Su, Jingliang Deng, Ruizhou Sun, Guosheng Lin, Hanjing Su, and Qingyao Wu. A unified transformer framework for group-based segmentation: Co-segmentation, co-saliency detection and video salient object detection. IEEE Transactions on Multimedia, 2023. +Yoad Tewel, Rinon Gal, Gal Chechik, and Yuval Atzmon. Key-locked rank one editing for text-to-image personalization. ACM SIGGRAPH 2023 Conference Proceedings, 2023. +Alexander Vezhnevets, Joachim M Buhmann, and Vittorio Ferrari. Active learning for semantic segmentation with expected change. In IEEE Conf. Comput. Vis. Pattern Recog., pages 3162-3169. IEEE, 2012. +Weiyao Wang, Matt Feiszli, Heng Wang, Jitendra Malik, and Du Tran. Open-world instance segmentation: Exploiting pseudo ground truth from learned pairwise affinity. In IEEE Conf. Comput. Vis. Pattern Recog., pages 4422-4432, 2022. +Weijia Wu, Yuzhong Zhao, Hao Chen, Yuchao Gu, Rui Zhao, Yefei He, Hong Zhou, Mike Zheng Shou, and Chunhua Shen. Datasetdm: Synthesizing data with perception annotations using diffusion models. Adv. Neural Inform. Process. Syst., 2023a. +Weijia Wu, Yuzhong Zhao, Mike Zheng Shou, Hong Zhou, and Chunhua Shen. Diffumask: Synthesizing images with pixel-level annotations for semantic segmentation using diffusion models. In Int. Conf. Comput. Vis., pages 1206-1217, 2023b. +Jiahao Xie, Wei Li, Xiangtai Li, Ziwei Liu, Yew Soon Ong, and Chen Change Loy. Mosaicfusion: Diffusion models as data augmenters for large vocabulary instance segmentation. arXiv preprint arXiv:2309.13042, 2023. +Lihe Yang, Xiaogang Xu, Bingyi Kang, Yinghuan Shi, and Hengshuang Zhao. Freemask: Synthetic images with dense annotations make stronger segmentation models. In NeurIPS, 2023. +Chih-Kuan Yeh, Joon Kim, Ian En-Hsu Yen, and Pradeep K Ravikumar. Representer point selection for explaining deep neural networks. Adv. Neural Inform. Process. Syst., 31, 2018. +Haobo Yuan, Xiangtai Li, Chong Zhou, Yining Li, Kai Chen, and Chen Change Loy. Open-vocabulary sam: Segment and recognize twenty-thousand classes interactively. arXiv preprint arXiv:2401.02955, 2024. +Yi Ke Yun and Weisi Lin. Selfreformer: Self-refined network with transformer for salient object detection. arXiv preprint arXiv:2205.11283, 2022. + +Renrui Zhang, Xiangfei Hu, Bohao Li, Siyuan Huang, Hanqiu Deng, Yu Qiao, Peng Gao, and Hongsheng Li. Prompt, generate, then cache: Cascade of foundation models makes strong few-shot learners. In IEEE Conf. Comput. Vis. Pattern Recog., pages 15211-15222, 2023. +Yuxuan Zhang, Huan Ling, Jun Gao, Kangxue Yin, Jean-Francois Lafleche, Adela Barriuso, Antonio Torralba, and Sanja Fidler. Datasetgan: Efficient labeled data factory with minimal human effort. In IEEE Conf. Comput. Vis. Pattern Recog., pages 10145-10155, 2021. +Hanqing Zhao, Dianmo Sheng, Jianmin Bao, Dongdong Chen, Dong Chen, Fang Wen, Lu Yuan, Ce Liu, Wenbo Zhou, Qi Chu, Weiming Zhang, and Nenghai Yu. X-paste: Revisiting scalable copy-paste for instance segmentation using clip and stablediffusion. In Proc. Int. Conf. Mach. Learn., 2023. +Xingyi Zhou, Vladlen Koltun, and Philipp Krahenbuhl. Probabilistic two-stage detection. arXiv preprint arXiv:2103.07461, 2021. +Muzhi Zhu, Hengtao Li, Hao Chen, Chengxiang Fan, Weian Mao, Chenchen Jing, Yifan Liu, and Chunhua Shen. Seg-prompt: Boosting open-world segmentation via category-level prompt learning. In Int. Conf. Comput. Vis., pages 999-1008, 2023. +Xueyan Zou, Jianwei Yang, Hao Zhang, Feng Li, Linjie Li, Jianfeng Wang, Lijuan Wang, Jianfeng Gao, and Yong Jae Lee. Segment everything everywhere all at once. In Adv. Neural Inform. Process. Syst., 2023. + +# A. Implementation Details + +# A.1. Dataset + +We choose LVIS (Gupta et al., 2019) as the dataset for our experiments. LVIS is a large-scale instance segmentation dataset, comprising approximately 160,000 images with over 2 million high-quality instance segmentation annotations across 1203 real-world categories. The dataset is further divided into three categories: rare, common, and frequent, based on their occurrence across images. Instances marked as 'rare' appear in 1-10 images, 'common' instances appear in 11-100 images, whereas 'frequent' instances appear in more than 100 images. The overall dataset exhibits a long-tail distribution, closely resembling the data distribution in the real world, and is widely applied under multiple settings, including few-shot segmentation (Liu et al., 2023) and open-world segmentation (Zhu et al., 2023; Wang et al., 2022). Therefore, we believe that selecting LVIS allows for a better reflection of the model's performance in real-world scenarios. We use the official LVIS dataset splits, with about 100,000 images in the training set and 20,000 images in the validation set. + +# A.2. Data Generation + +Our data generation and annotation process is consistent with Zhao et al. (2023), and we briefly introduce it here. We first use StableDiffusion V1.5 (Rombach et al., 2022a) (SD) as the generative model. For the 1203 categories in LVIS (Gupta et al., 2019), we generate 1000 images per category, with image resolution $512 \times 512$ . The prompt template for generation is "a photo of a single {CATEGORY_NAME}" We use U2Net (Qin et al., 2020), SelfReformer (Yun and Lin, 2022), UFO (Su et al., 2023), and CLIPseg (Lüddecke and Ecker, 2022) respectively to annotate the raw generative images, and select the mask with the highest CLIP score as the final annotation. To ensure data quality, images with CLIP scores below 0.21 are filtered out as low-quality images. During training, we also employ the instance paste strategy provided by Zhao et al. (2023) for data augmentation. For each instance, we randomly resize it to match the distribution of its category in the training set. The maximum number of pasted instances per image is set to 20. + +In addition, to further expand the diversity of generated data and make our research more universal, we also use other generative models, including DeepFloyd-IF (Shonenkov et al., 2023) (IF) and Perfusion (Tewel et al., 2023) (PER), with 500 images per category per model. For IF, we use the pre-trained model provided by the author, and the generated images are the output of Stage II, with a resolution of $256 \times 256$ . For PER, the base model we use is StableDiffusion V1.5. For each category, we fine-tune the model using the images cropped from the training set, with 400 fine-tuning steps. We use the fine-tuned model to generate images. + +Table 7. Comparison of different generated data. + +
MethodGenerated DataAPboxAPmaskAPrboxAPrmaskAPcboxAPcmaskAPfboxAPfmask
BaselineSD34.0030.3324.4822.6532.7129.2739.6234.89
BaselineSD + IF34.1530.3926.1223.7632.4028.9739.6234.89
BaselineSD + IF + Per34.2030.3924.3322.2133.2329.5739.6334.89
BSGALSD34.8231.2126.7624.8433.2830.0140.0835.34
BSGALSD + IF35.1331.3426.8324.3233.9230.5740.1335.29
BSGALSD + IF + Per35.4031.5627.9525.4334.1430.5640.0735.37
+ +We also explore the effect of using different generated data on the model performance (see Table 7). We can see that based on the original StableDiffusion V1.5, using other generative models can bring some performance improvement, but this improvement is not obvious. Specifically, for specific frequency categories, we found that IF has a more significant improvement for rare categories, while PER has a more significant improvement for common categories. This is likely because IF data is more diverse, while PER data is more consistent with the distribution of the training set. Considering that the overall performance has been improved to a certain extent, we finally adopt the generated data of $\mathrm{SD} + \mathrm{IF} + \mathrm{PER}$ for subsequent experiments. + +# A.3. Model Training + +Follow Zhao et al. (2023), We use CenterNet2 (Zhou et al., 2021) as our segmentation model, with ResNet-50 (He et al., 2016) or Swin-L (Liu et al., 2022) as the backbone. For ResNet-50, the maximum training iteration is set to 90,000 and the model is initialized with weights first pretrained on ImageNet-22k then finetuned on LVIS (Gupta et al., 2019), as Zhao + +![](images/38edc23e4e6fcb14eed55529878b63b47ab55f31586f3256eca02de2959ef887.jpg) +Figure 5. Model performances when using different amount of generated data. + +et al. (2023) did. And we use 4 Nvidia 4090 GPUs with a batch size of 16 during training. As for Swin-L, the maximum training iteration is set to 180,000 and the model is initialized with weights pretrained on ImageNet-22k, since our early experiments show that this initialization can bring a slight improvement compared to the weights trained with LVIS. And we use 4 Nvidia A100 GPUs with a batch size of 16 for training. Besides, due to the large number of parameters of Swin-L, the additional memory occupied by saving the gradient is large, so we actually use the algorithm in Algorithm 2. + +The other unspecified parameters also follow the same settings as X-Paste (Zhao et al., 2023), such as the AdamW (Loshchilov and Hutter, 2017) optimizer with an initial learning rate of $1\mathrm{e} - 4$ + +# A.4. Data Amount + +In this work, we have generated over 2 million images. Figure 5 shows the model performances when using different amount of generated data(1%,10%,40%,70%,100%). Overall, as the amount of generated data increases, the performance of the model also improves, but there is also some fluctuation. Our method is always better than the baseline, which proves the effectiveness and robustness of our method. + +# A.5. Contribution Estimation + +As mentioned in Section 4.2, we use $\nabla_{\theta}(L_{\widehat{\mathcal{R}}_b}(\theta) - L_{\mathcal{R}_b}(\theta))^T\nabla_{\theta}L_{\mathcal{U}_b}(\theta)$ to estimate the contribution of $\mathcal{G}_b$ + +Here we actually consider both the direction and the magnitude of the gradient. It is worth mentioning that many previous works actually mainly consider the magnitude of the gradient, for example, the data with large gradient magnitude has more information and should be annotated (Cai et al., 2013) or the wrong outlier data should be filtered (Pruthi et al., 2020). + +If we only consider the direction, it is equivalent to normalizing each gradient first, and then calculating, then our calculation formula becomes $\mathcal{G}_b = \frac{\nabla_\theta(L_{\widehat{\mathcal{R}}_b}(\theta) - L_{\mathcal{R}_b}(\theta))^T\nabla_\theta L_{\mathcal{U}_b}(\theta)}{\|\nabla_\theta(L_{\widehat{\mathcal{R}}_b}(\theta) - L_{\mathcal{R}_b}(\theta))\|_2\|\nabla_\theta L_{\mathcal{U}_b}(\theta)\|_2}$ . + +Thus, we essentially calculate the cosine similarity. Then we conducted an experimental comparison, as shown in Table 8, + +Table 8. Comparison of using grad normalization or not. + +
NormalizeAPboxAPmaskAPrboxAPrmaskAPcboxAPcmaskAPfboxAPfmask
×35.0531.2726.7824.3433.7930.3240.1035.39
√35.4031.5627.9525.4334.1430.5640.0735.37
+ +![](images/7c51735fc369a366bae554993625a8764257f1db74523e522288c0840a6d0c93.jpg) +Figure 6. Illustration of noisy images exhibiting various noise scales and categories. Each row, from top to bottom, signifies different noise levels, specifically 0, 40, 100, 200, and 400, respectively. All images are sourced from the CIFAR-10 dataset. + +we can see that if we normalize the gradient, our method will have a certain improvement. In addition, since we need to keep two different thresholds, it is difficult to ensure the consistency of the acceptance rate. So we adopt a dynamic threshold strategy, pre-set an acceptance rate, maintain a queue to save the contribution of the previous iter, and then dynamically adjust the threshold according to the queue, so that the acceptance rate stays at the pre-set acceptance rate. + +# A.6. Toy Experiment + +The following are the specific experimental settings implemented on CIFAR-10: We employed a simple ResNet18 as the baseline model and conducted training over 200 epochs, and the accuracy after training on the original training set is $93.02\%$ . The learning rate is set at 0.1, utilizing the SGD optimizer. A momentum of 0.9 is in effect, with a weight decay of 5e-4. We use a cosine annealing learning rate scheduler. The constructed noisy images are depicted in Figure 6. A decline in image quality is observed as the noise level escalates. Notably, when the noise level reaches 200, the images become significantly challenging to identify. For Table 1, we use Split1 as $R$ , while $G$ consists of 'Split2 + Noise40', 'Split3 + Noise100', 'Split4 + Noise200', + +# A.7. A Simplification Only Forward Once + +In Section 4.2, we actually need one more forward on $\mathcal{R}_b$ compared to our baseline. However, we can simplify it to only one forward. The specific reason is that as mentioned in Table 3, we only use the classification loss, $L_{cls}$ this loss is actually the sum of the cross entropy loss of each instance, and whether this instance is generated or real is known during the training process. so the loss can be further distangled as $L_{cls} = L_{real} + L_{gen} + L_{neg}$ , where $L_{real}$ is the loss of real instances, $L_{gen}$ is the loss of generated instances, and $L_{neg}$ is the loss of negative instances. Consequently, we can use $\nabla_{\theta}L_{gen}$ to replace $\nabla_{\theta}(L_{\widehat{\mathcal{R}}_b}(\theta) - L_{\mathcal{R}_b}(\theta))$ + +# B. More ablations + +Momentum Coefficient $\beta$ . In Algorithm 3, we introduce a momentum coefficient $\beta$ to update the grad cache. Here we explore the effect of different $\beta$ on the model performance. A larger beta signifies a greater focus on global information, while a smaller beta indicates a higher attention to the current test batch $\mathcal{U}_b$ . Detailed results are presented in Table 9. Observations suggest that when $\beta$ is 0.1, the performance is the best, which is also the $\beta$ we finally adopted. + +Table 9. Comparison of different $\beta$ for updating grad cache. + +
βAPboxAPmaskAPrboxAPrmask
0.0535.1431.2427.2424.50
0.1035.4031.5627.9525.43
0.3034.8431.1826.1224.32
0.5034.8731.0325.8022.88
0.8034.5030.7224.3721.89
+ +Contribution threshold $\tau$ . In Algorithm 3, we incorporate a contribution threshold $\tau$ , intended for filtering the produced data. Here we investigate the impact of varying values of $\tau$ on the model's performance. The larger $\tau$ implies a stricter filtration of the generated data, while the smaller $\tau$ signifies a looser filtering of the generated data. The specific results are shown in Table 10. We can see the performance is optimal when $\tau$ equals -0.05, which is also the $\tau$ we eventually settle on for our final model. + +Table 10. Comparison of different $\tau$ for filtering generated data. + +
τAPboxAPmaskAPBoxrAPrmask
-0.1034.6830.8026.6024.40
-0.0535.4031.5627.9525.43
0.0034.7230.9824.9622.79
0.0534.2930.5523.7521.71
+ +Online learning vs. Offline learning We compare online learning and offline learning under different iterations. The result is shown in Figure 9. + +# C. Discussion + +# C.1. Comparing with existing methods + +Table 11. Comparing with existing methods + +
MethodData ScaleDownstreamCostQualityDomain Diff
Traditional Active LearningLimited✓High✓✓
Generated Data Filtering MethodsUnlimited×Low××
Generative Active LearningUnlimited✓Low×✓
+ +We've drawn the Table 11, analyzing our setting compared to previous active learning or generative data filtration methods. We've conducted analysis from aspects of data scale, whether it's oriented towards downstream tasks, label quality, labeling costs, and whether there exists domain difference (between generated and real data). + +# C.2. Analysis of the computational cost + +We recorded the training duration and GPU memory usage for training 90,000 iterations with 4 Nvidia 4090 GPUs. It can be observed that our method based on Grad cache increases the GPU memory usage compared to Loss estimate, but it significantly reduces the training time. Compared with our Baseline, the additional time and memory overheads are within an acceptable range. + +Table 12. Analysis of the computational cost of different algorithms + +
MethodsTotal TimeMax Memory per GPU
Baseline17h6534M
Loss estimate (Algorithm 2)31h7114M
Grad cache (Algorithm 3)21h9836M
+ +# C.3. Future work + +We hope that this paper can provide more inspiration to the academic community on how to utilize generated data and how to design better data analysis methods. It should be pointed out that our method is not limited to specific tasks or specific model architectures. In this work, for the convenience of comparison with the baseline, we use the same dataset and model architecture as the baseline. We hope that in future work, we can further verify it on more tasks and model architectures. At the same time, we can also design more flexible and controllable evaluation functions to better utilize generated data. For example, in this paper, when filtering the data with a gradient, there is a trade-off between diversity and consistency. For rare categories in the data, due to the small number of real data itself, diversity should be considered more, while for common categories, due to the large number of real data itself, consistency should be considered more. Therefore, in the future, we can consider adopting a dynamic strategy for different categories. In the long run, our current research is done under the premise of a fixed generative model. A more ideal situation is to involve the generative model in this loop, further optimizing the generative model based on the downstream model's feedback, to achieve a true "generative model in the loop". + +# D. Visualization + +# D.1. Selected and Discarded Samples + +We show some samples selected and discarded by our method in Figure 7. Our proposed method is able to select high-quality samples (best sample) while filtering out low-quality samples (worst sample), which can effectively improve the data learning efficiency of the model. For example, our method is capable of identifying accurately segmented data for applesauce. In cases where applesauce is not present in the generated raw image or is not encompassed within the segmentation mask, our method can discard such samples. For alarm clocks, our method tends to choose images with more complex appearances. + +# D.2. Instance Augmentation + +We present some augmented data in Figure 8. By randomly pasting generated samples onto the LVIS training set, we effectively enrich the complexity of the scenes and thus increase the model's learning efficiency on the generated data. + +![](images/31f03ba62728abcb4689ff172f8c4b2d06d4e9d7657021205fcdd7c5d53fb12e.jpg) +Figure 7. Examples of selected and discarded samples. + +![](images/62671480a0cce2ba1fa8b609b56e92ae43ce218caa245ab1825373c43941746e.jpg) + +![](images/27c6c01516bcb1330a869b937c14b12c33eaa1b4407be8641ac6b12c596c305c.jpg) + +![](images/1e9d154c900e07d2ba6b29ba578d385519769bfad7cea6b5fa973ec27407dc9c.jpg) + +![](images/d4d2cc3188caaac70887b4b4cc3448f122f5512502dac07a8eba274d4f95b931.jpg) + +![](images/6a9f4f65b4d8702794644395bcff742418dac0b1ffa06745de704c55ba5ffdbd.jpg) + +![](images/a2b1a6b9b7361e3812bbbe66a5e2866ead1ac0e2c0ab5f4bc8f9cd73bff65ba4.jpg) + +![](images/8ec8bc2f5d556973aebcb3598e36a6990b0ec74987a16e52e7e637c7c92b7408.jpg) + +![](images/202893fdc6b533624292839232624e7a10da1beca735597c414dcf0c0ebef543.jpg) + +![](images/cf6e73a38b2f4ced76631eae1ba06c4783b9677eb43daaa09c64fb69a011db7e.jpg) + +![](images/604d3873beb61c931d36f3ba9a150b40ef6584c83c32832067f7664c2c1a9490.jpg) + +![](images/c32294b4e7b4f772b0a69e21451a06f262f3b3754cac798e0c2c67f2f9e76997.jpg) + +![](images/e9ed2cd3aef5be9e9b866a6c64cac8b0eafafacde034c71641b70fb6102fa86f.jpg) + +![](images/7e2b97617894640ec13aaabef43a14bcbebc08415a79003eac5480f70ddcaf64.jpg) + +![](images/be4b38fcc2925087ae37ba14b10f4c27df52328ecf8104e56d80b0865b70178e.jpg) + +![](images/94dd024797eaeb3f948a2c7f7958bd7bacf6cb04728f1168aad69a29f24a932f.jpg) + +![](images/7861649470afc961144a4eb16d4aeb924012b06ef4a77055ab3935d771c972d5.jpg) + +![](images/f1b71b319970c13fb7bffa4a00d5f834af2069dff5d2fed5ee0e9a59169e8749.jpg) + +![](images/95296124182a604134fcdb07fe772cb160fbeb884b5c3f4a02aef43ac5c6dce8.jpg) + +![](images/43aae3b0b874838c28211c5bbdad7bec90eae8fb693f34d1285e74141c335c7a.jpg) + +![](images/c5ea8c3598663f4d912acbbc53a5bf46b5678fac602ae6a009faa49dd6d339aa.jpg) + +![](images/0f93a20f20a48679652f437c346ba64e3eca2667a3f8130a5cde54fae0ceace5.jpg) + +![](images/76235af62127c6a81343b630842f54eae9f68a75b1962e5a2cb36a3601becbf5.jpg) + +![](images/924ceeda8cac471beded76ed00fa486170a7fbac86c3d99a023741e373093a6f.jpg) + +![](images/9833766d1b2ebdc09bd10be212b91f52efecf74d5c7ac1b89c2889a6b4ce8773.jpg) + +![](images/b0f16dc369be51a8f00b296f60388d2657d9711c733aa5c1b8ab6f0de0467995.jpg) + +![](images/3c87f7fbe4792bae0027a1e7ed6909d0f6855f0e56d6cc0fe8ef79229af74881.jpg) +Figure 8. Examples of augmented data. + +![](images/958d4d7761f28fdcb8480ae7f042295f829a81fc4c9542a2bf368813efee4fc7.jpg) + +![](images/54d1efe4ffdec196ac445bfecac9505a7fe9a67f055fcb72f66028c32f20f95f.jpg) + +![](images/10b7bf7c87bc51fab486e21081a076489908e821c8caaa0ecc04dfe8d610a092.jpg) + +![](images/50efdea4d52e96d677a5c16f215a8982983c6ff1481a60d58141318ecec5c82a.jpg) +Figure 9. Performance of the model under different iterations. \ No newline at end of file diff --git a/generativeactivelearningforlongtailedinstancesegmentation/images.zip b/generativeactivelearningforlongtailedinstancesegmentation/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..02cfb167a3933b0177195521bf4ef02461dc98ab --- /dev/null +++ b/generativeactivelearningforlongtailedinstancesegmentation/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9402450e1122fb67eb708df92b798f382bbddd283df2ffd77846d4b9ffc8d204 +size 1604572 diff --git a/generativeactivelearningforlongtailedinstancesegmentation/layout.json b/generativeactivelearningforlongtailedinstancesegmentation/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..4c852661fe5e9f5dd0ff65d5382c1dc4d87c58cb --- /dev/null +++ b/generativeactivelearningforlongtailedinstancesegmentation/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b38378e3c7520661180133277f823f752cd70f25f74ccdad629133e42cfbf29 +size 782810 diff --git a/generativeconditionaldistributionsbyneuralentropicoptimaltransport/801fa1b0-2b58-4b0f-92bb-89020b88d9de_content_list.json b/generativeconditionaldistributionsbyneuralentropicoptimaltransport/801fa1b0-2b58-4b0f-92bb-89020b88d9de_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..3ef1ca7cf04be94b71dd6e367d1c5c1709acfe22 --- /dev/null +++ b/generativeconditionaldistributionsbyneuralentropicoptimaltransport/801fa1b0-2b58-4b0f-92bb-89020b88d9de_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:856d2970f6bd676d7d916680384c6e34e063056b5eaa4fe66738d065fb1946be +size 101736 diff --git a/generativeconditionaldistributionsbyneuralentropicoptimaltransport/801fa1b0-2b58-4b0f-92bb-89020b88d9de_model.json b/generativeconditionaldistributionsbyneuralentropicoptimaltransport/801fa1b0-2b58-4b0f-92bb-89020b88d9de_model.json new file mode 100644 index 0000000000000000000000000000000000000000..1c5e2bf88e378005caf099ba491c5c448270da66 --- /dev/null +++ b/generativeconditionaldistributionsbyneuralentropicoptimaltransport/801fa1b0-2b58-4b0f-92bb-89020b88d9de_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:faed238fd3efc39c875c20e7d8eb0ced93792a6f0f7ca56d36890e8c722e6517 +size 122776 diff --git a/generativeconditionaldistributionsbyneuralentropicoptimaltransport/801fa1b0-2b58-4b0f-92bb-89020b88d9de_origin.pdf b/generativeconditionaldistributionsbyneuralentropicoptimaltransport/801fa1b0-2b58-4b0f-92bb-89020b88d9de_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..cda62aa1adfad693e0e7b39b88a9d9fcb7a29f74 --- /dev/null +++ b/generativeconditionaldistributionsbyneuralentropicoptimaltransport/801fa1b0-2b58-4b0f-92bb-89020b88d9de_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c4e710ac157a607af16c1610eaf41f51b12d38576ea5c02c6463bee5dc77914 +size 614313 diff --git a/generativeconditionaldistributionsbyneuralentropicoptimaltransport/full.md b/generativeconditionaldistributionsbyneuralentropicoptimaltransport/full.md new file mode 100644 index 0000000000000000000000000000000000000000..ec08648bc77f063df5c7a18d7fbb67b531a0ea96 --- /dev/null +++ b/generativeconditionaldistributionsbyneuralentropicoptimaltransport/full.md @@ -0,0 +1,449 @@ +# Generative Conditional Distributions by Neural (Entropic) Optimal Transport + +Bao Nguyen12 Binh Nguyen3 Hieu Trung Nguyen14 Viet Anh Nguyen1 + +# Abstract + +Learning conditional distributions is challenging because the desired outcome is not a single distribution but multiple distributions that correspond to multiple instances of the covariates. We introduce a novel neural entropic optimal transport method designed to effectively learn generative models of conditional distributions, particularly in scenarios characterized by limited sample sizes. Our method relies on the minimax training of two neural networks: a generative network parametrizing the inverse cumulative distribution functions of the conditional distributions and another network parametrizing the conditional Kantorovich potential. To prevent overfitting, we regularize the objective function by penalizing the Lipschitz constant of the network output. Our experiments on real-world datasets show the effectiveness of our algorithm compared to state-of-the-art conditional distribution learning techniques. Our implementation can be found at https://github.com/nguyennocbaocmt02/GENTLE. + +# 1. Introduction + +The conditional distribution of a response variable given the covariate information is a key quantity for numerous tasks in machine learning and data science. For example, knowing the conditional distribution of a patient's health outcome (the response) given the patient's characteristics (the covariate) improves risk assessment and prediction accuracy and allows personalized interventions wherein healthcare providers can tailor treatments based on individual patient profiles. It is also a useful tool to evaluate the effects of a policy in economics (Díaz, 2020; Athey & Imbens, 2015). Access to a response's conditional probability + +1The Chinese University of Hong Kong 2VinUniversity Department of Mathematics, National University of Singapore 4VinAI Research. Correspondence to: Bao Nguyen . + +Proceedings of the $41^{st}$ International Conference on Machine Learning, Vienna, Austria. PMLR 235, 2024. Copyright 2024 by the author(s). + +distribution also leads to an estimate of the treatment effect without explicit, additional experiments. + +Unfortunately, learning the relationship between the response and the covariate is challenging, especially in high-dimensional covariate space or complex dependency settings. Many simple and interpretable methods, such as kernel density estimation, may struggle to capture the complexity of the data-generating conditional distribution accurately (Athey et al., 2021). On the other hand, there are overly complex (deep neural network) models that perform well on the training data but generalize poorly to new data; this overfitting behavior triggers unreliable predictions and interpretations. Additionally, performing inferences on these overly complex models can be time-consuming and environmentally unfriendly. Alternatively, using additional expert inputs, one can build physically informed simulation models to represent the real physical world. However, running simulations can be time-consuming, making them ill-suited for real-time decision-making. + +Another critical obstacle underlying conditional distribution learning is that we are not simply learning one distribution; instead, we need to learn a collection of distributions, one conditional distribution for each possible value of the covariate information. This challenge intensifies because, in reality, the data is scarce. This scarcity is particularly prevalent in healthcare, where privacy concerns or budget constraints prohibit the collection and dissemination of samples. As an illustrative example, we will consider the Lalonde-Dehjia-Wahba (LDW) (LaLonde, 1986; Dehejia & Wahba, 1999) dataset, which is a widely used dataset for analyzing the average treatment effects (Athey et al., 2021). The LDW dataset comprises 16,177 samples aggregated from actual experiments and the Current Population Survey. Each observed sample includes nine covariate attributes of a person and a scalar response reporting the individual's earnings in 1978. Since two persons may have the exact attributes, it happens that for a specific covariate value, there are multiple observations of the response. The histogram in Figure 1 shows the count numbers per distinct covariates for the LDW dataset. We observe that more than 13,000 covariates have only one response. This is an extreme case where we must learn the conditional distribution with a single data point observed at that covariate. On the other hand, we also observe several popular covari + +ates with many responses: the most popular covariate has 47 responses. This again induces unbalanced sampling in which the number of responses is not balanced across different covariate values. A naive solution to fix this problem could be under-sampling (remove data) the more frequent covariate and over-sampling (create synthetic data) for the rare covariate to balance the dataset using popular methods such as SMOTE (Chawla et al., 2002), SMOTER (Torgo et al., 2013) and SMOGN (Branco et al., 2017). Unfortunately, these methods do not scale well for large datasets with more than thousands of covariates. + +![](images/7b18db15641ac49977fac6aecffdbe5c7668c882b39a29f4c820d1fb43083407.jpg) +Figure 1. Histogram count of Number of observed responses for distinct covariate values in the LDW dataset (LaLonde, 1986). This dataset has over 13,000 covariates with only one response. + +The current literature on conditional distribution learning reveals a notable gap in methodologies that can effectively address the aforementioned difficulties. Specifically, our experimental section shows that CWGAN (Athey et al., 2021) suffers from mode collapse and fails to recover the data-generating conditional distributions. + +# 1.1. Problem Statement and Contributions + +We consider $X$ a multi-dimensional covariate and $Y$ a one-dimensional response. For any specific value $x$ , the data-generating conditional distribution of $Y|X = x$ is denoted by $\mu_{x}$ . Our goal is to learn these conditional distributions $\mu_{x}$ uniformly over all $x$ from a finite dataset $\mathcal{D} = \{(x_i, \{y_{i,k}\}_{k=1,\dots,N_i}) \in \mathbb{R}^d \times \mathbb{R}\}$ . Without any loss of generality, we suppose that the covariates $x_{i}$ are distinct, and for each $x_{i}$ , $\{y_{ik}\}_{k=1,\dots,N_i}$ are $N_{i}$ independent samples drawn from $\mu_{x_{i}}$ . + +More importantly, we aim to learn a generative model of the conditional distributions, which can allow us to draw new, unseen samples. This task is more challenging than learning specific finite-dimensional statistics of the conditional distributions, such as learning conditional expecta + +tions or quantiles, especially under a small training sample size. We reemphasize that conditional distribution learning is challenging: our goal is not simply learning one distribution, but instead, a collection of distributions – one conditional distribution for each possible value of the covariate information. This challenge intensifies because of data scarcity. This difficulty is often encountered in real-world deployment, for instance, in health care and finance. + +Contributions. We introduce GENTLE, a generative neural transport learning model for conditional distributions. GENTLE is represented by a neural network $T_{\theta}$ that takes the covariate $x$ and a uniform $(0,1)$ random variable $U$ as input, and it outputs $T_{\theta}(x,U)$ with a distribution that is close to $\mu_x$ , the data-generating conditional distribution of $Y|X = x$ . Due to the low sample size, $T_{\theta}$ can overfit, and we propose learning $\theta$ by minimizing the sum of the fitness and the overfitting regularization trade-off. The overfitting regularizer ensures that $T_{\theta}$ is sufficiently smooth in the covariate $x$ , and we use an entropic optimal transport distance to measure the discrepancy of the generative distribution outputs. To this end, we create a second network $v_{\phi}$ to approximate the conditional potential associated with the semi-dual formulation of the entropic optimal transport distance. This leads to a min-max optimization problem over the pair of generative-conditional potential network parameters $(\theta, \phi)$ . This min-max problem is then solved using a state-of-the-art gradient descent-ascent algorithm. + +Using real-life datasets, we empirically validate that GENTLE performs better than state-of-the-art methods such as conditional Wasserstein GANs across multiple performance metrics (Wasserstein metric and Kolmogorov-Smirnov metric). In particular, even for the case of LDWCPS data that exhibits severe imbalances in observed responses, GENTLE still demonstrates a remarkable ability to generate observations that follow ground truth distributions closely, quantitatively, and qualitatively. + +This paper unfolds as follows: Section 2 provides an overview of the existing literature. Section 3 reviews the technical background on optimal transports and the tools we will utilize. Section 4 presents our approach to generative conditional distributions. The numerical results are provided in Section 5. + +Notations. We write the capital letter $X$ for the random variable and the case letter $x$ for a specific realization of $X$ . For simplicity, we use $Y(x)$ to denote the conditional random variable $Y|X = x$ . For a measurable map $f: \mathbb{R} \to \mathbb{R}$ and any probability measure $\mathbb{P}$ on $\mathbb{R}$ , we use $f_{\#} \mathbb{P}$ to denote the pushforward measure of $\mathbb{P}$ under $f$ . The (standard) uniform distribution on $(0,1)$ is denoted $\mathcal{U}(0,1)$ , and we use $\mathbb{U}$ to represent the probability measure associated with this uniform distribution. We denote $N = \sum_{i} N_{i}$ as the total number of observations in the training dataset. + +# 2. Related Works + +Metamodeling is a computational approach that efficiently captures the relationship between input variables and key output statistics like means or quantiles. This is crucial for real-time simulation applications such as personalized decision making (Shen et al., 2021) and online risk monitoring (Jiang et al., 2020). Traditional metamodeling techniques, while effective, often require pre-specification of relevant statistics, limiting their flexibility. To address this, generative metamodeling has emerged as a promising technique that estimates conditional distributions quickly and dynamically. Generative metamodeling differs from traditional approaches by simulating a wider range of possible outcomes, providing a more comprehensive analysis of potential scenarios. Athey et al. (2021) propose using a Wasserstein Generative Adversarial Model (WGAN, Arjovsky et al. 2017) to simulate the distribution of outcomes conditioned on covariates, offering a novel approach to outcome simulation. Similarly, Hong et al. (2023) propose quantile-regression-based generative metamodeling (QRGMM), another method of conditional distribution learning. QRGMM leverages the conditional quantile regression technique to provide a more detailed understanding of the distribution tails, which is crucial in risk assessment and decision-making processes. These advancements in generative metamodeling can significantly enhance the accuracy and applicability of real-time simulations, paving the way for more personalized and precise decision-making tools in various fields. + +Synthetic evaluation data. Previous works (van Breugel et al., 2024; Parikh et al., 2022) leverage the deep generative model to approximate conditional distribution for synthetic data generation. (Shrivastava & Tuzel, 2019) parameterize a conditionally Gaussian model with a Deep Neural Network to model error distribution for each state of the object. + +Neural Optimal Transport is a recent emergent framework that proposes to learn the optimal transport plan by deep neural networks. Various existing works in this direction include parameterization of the OT map as the gradient of an input convex neural network (Jacob et al., 2019; Makkuva et al., 2020; Bunne et al., 2022; 2023); or solutions of convex-concave problems (Korotin et al., 2022; Gushchin et al., 2022; Choi et al., 2023). However, these formulations are primarily suited to computer vision or computational biology applications. To the best of our knowledge, our paper is the first work attempting to formulate the neural OT framework into a conditional distribution learning task. + +Learning and decision-making with conditional distributions also attracted tremendous attention in artificial intelligence and operations research communities. + +Nguyen et al. (2020b) studied the robust parameter estimation of conditional distributions under the parametric exponential family of distributions, while Nguyen et al. (2020a) studied the non-parametric Wasserstein robust estimation of conditional statistics. Making conditional decisions based on observed covariates is a well-known problem in finance (Nguyen et al., 2024) and operations research (Esteban-Pérez & Morales, 2022); interested readers are invited to the survey by Sadana et al. (2024) for recent developments. + +# 3. Background + +We focus on a one-dimensional response space for $Y$ . The optimal transport distance between two distributions supported on $\mathbb{R}$ is formally defined as follows. + +Definition 3.1 (Optimal Transport Distance, Villani 2009). Given two probability measures $\mu$ and $\nu$ supported on $\mathbb{R}$ with finite second moments, the optimal transport (2-Wasserstein) distance between them is defined as + +$$ +\mathrm {W} _ {2} ^ {2} (\mu , \nu) \stackrel {\text {d e f .}} {=} \inf _ {\pi \in \Pi (\mu , \nu)} \int_ {\mathbb {R} \times \mathbb {R}} | y - y ^ {\prime} | ^ {2} \mathrm {d} \pi (y, y ^ {\prime}), \tag {1} +$$ + +where $\Pi (\mu ,\nu)$ denotes the set of probability distributions on $\mathbb{R}^2$ with marginals $\mu$ and $\nu$ , respectively. + +Optimal transport in 1d. In one dimension, the 2-Wasserstein distance admits a closed form expression (Bobkov & Ledoux, 2019, Theorem 2.10): for two measures $\mu$ and $\nu$ with cumulative density functions (CDF) $F_{\mu}$ and $F_{\nu}$ , respectively, we have + +$$ +\begin{array}{l} \mathrm {W} _ {2} ^ {2} (\mu , \nu) = \int_ {0} ^ {1} | F _ {\mu} ^ {- 1} (t) - F _ {\nu} ^ {- 1} (t) | ^ {2} \mathrm {d} t \tag {2} \\ = \mathbb {E} _ {U \sim \mathcal {U} (0, 1)} \left[ | F _ {\mu} ^ {- 1} (U) - F _ {\nu} ^ {- 1} (U) | ^ {2} \right]. \\ \end{array} +$$ + +Entropic-regularized optimal transport. The recent popularity in applications of OT to machine learning is largely due to its efficient computation by adding negative entropy of the transport plan as a form of regularization to the linear OT program (1). This problem is called entropic optimal transport (EOT), which is smooth and strongly convex, therefore has a unique minimizer: + +$$ +\mathrm {W} _ {2, \varepsilon} ^ {2} (\mu , \nu) \stackrel {\text {d e f .}} {=} \min _ {\pi \in \Pi (\mu , \nu)} \int_ {\mathbb {R} ^ {2}} | y - y ^ {\prime} | ^ {2} \mathrm {d} \pi - \varepsilon H (\pi). \tag {3} +$$ + +Cuturi (2013) showed that the minimization problem (3) can be solved by Sinkhorn's algorithm (a type of matrix scaling algorithm, also called iterative proportional fitting procedure, Kullback 1968) that can be implemented at large scale and is analytically tractable. In addition to its computational advantages, problem (3) can also be interpreted as a specific instance of the Schrödinger bridge + +problem, which has a rich history in physics. For an in-depth theoretical introduction to EOT, readers can refer to Nutz (2021) or Léonard (2014). + +A nice property of the EOT problem (3) is that it allows an equivalent smooth unbounded semi-dual formulation (Genevay et al., 2016, Proposition 2.1) + +$$ +\begin{array}{l} \min _ {\pi \in \Pi (\mu , \nu)} \int_ {\mathbb {R} ^ {2}} | y - y ^ {\prime} | ^ {2} \mathrm {d} \pi - \varepsilon H (\pi) \\ = \sup _ {v (\cdot) \in \mathcal {C}} \int_ {\mathbb {R}} v ^ {\varepsilon} (y) \mathrm {d} \mu + \int_ {\mathbb {R}} v \left(y ^ {\prime}\right) \mathrm {d} \nu - \varepsilon , \tag {4} \\ \end{array} +$$ + +where $\mathcal{C}$ is the space of all continuous functions from $\mathbb{R}$ to $\mathbb{R}$ , and $v^{\varepsilon}$ is defined as + +$$ +v ^ {\varepsilon} (y) = - \varepsilon \log \left(\int_ {\mathbb {R}} \exp \left(\frac {v \left(y ^ {\prime}\right) - \left| y - y ^ {\prime} \right| ^ {2}}{\varepsilon}\right) \mathrm {d} \nu\right). \tag {5} +$$ + +The function $v$ is called Kantorovich potential, along with its smoothed $c$ -transform $v^{\varepsilon}$ , with $c$ being the absolute difference bi-function. Using the semi-dual form is that we need to optimize over only one function $v$ associating with $\nu$ , and we can obtain $v^{\varepsilon}$ as the potential associating with $\mu$ . + +# 4. Methodologies + +We propose to learn a mapping $T: \mathbb{R}^d \times (0,1) \to \mathbb{R}$ such that uniformly over all $x$ , $T(x,U) = Y(x)$ in distribution when $U \sim \mathcal{U}(0,1)$ . The existence of this mapping $T(x,U)$ is guaranteed by the following celebrated result. + +Lemma 4.1 (Noise Outsourcing, Austin 2015). Suppose that $\mathcal{X}$ and $\mathcal{Y}$ are standard Borel spaces and that $(X,Y)$ is an $(\mathcal{X} \times \mathcal{Y})$ -valued random variable. Then, there are random variables $U \sim \mathcal{U}(0,1)$ coupled with $\mathcal{X}$ and $\mathcal{Y}$ and a Borel function $T: \mathcal{X} \times (0,1) \to \mathcal{Y}$ such that $U$ is independent from $X$ and + +$$ +(X, Y) = (X, T (X, U)) \quad a l m o s t s u r e l y. +$$ + +In general, the mapping $T$ is not unique. Following the neural OT framework (Korotin et al., 2022; Makkuva et al., 2020; Bunne et al., 2022), we use a neural network to parametrize a possible instance of $T(x,U)$ , and we denote this network as $T_{\theta}(x,U)$ . For any specific value of the parameter $\theta$ , the network outputs a probability measure $T_{\theta}(x,\cdot)_{\#}\mathbb{U}$ , which represents the distribution of $T_{\theta}(x,U)$ with $U\sim \mathcal{U}(0,1)$ . We propose the following regularized loss to find the optimal map $T_{\theta}$ : + +$$ +\min _ {\theta} \operatorname {F i t} (\theta) + \lambda \operatorname {R e g} (\theta), \tag {6} +$$ + +where the first term is a measure of the fitness of the map, the second is a regularization to prevent overfitting, and $\lambda \geq 0$ is the regularization weight. We explain the detailed formulation of each term and its rationale in the next sections. + +# 4.1. Fitness Measure + +Motivated by the OT distance in (2), a natural choice to measure the discrepancy between the network outputs and the conditional data-generating distributions is by integrating the discrepancy of the respective inverse CDFs over all possible values $x$ , i.e., by evaluating + +$$ +\begin{array}{l} \mathbb {E} _ {X \sim \mathcal {D}, U \sim \mathcal {U} (0, 1)} [ | F _ {\mu_ {X}} ^ {- 1} (U) - T _ {\theta} (X, U) | ^ {2} ] \\ = \mathbb {E} _ {X \sim \mathcal {D}} \left[ \mathbb {E} _ {U \sim \mathcal {U} (0, 1)} \left[ \left| F _ {\mu_ {X}} ^ {- 1} (U) - T _ {\theta} (X, U) \right| ^ {2} \right] \right]. \\ \end{array} +$$ + +Above, $F_{\mu_x}$ is the cumulative distribution function of $Y(x)$ , and the outer expectation is taken over the (uniform) sampling of all distinct values of $X$ in the training dataset $\mathcal{D}$ . Unfortunately, the inverse CDF $F_{\mu_X}^{-1}$ can be unbounded, and the magnitude of $F_{\mu_X}^{-1}$ explodes to infinity for tail events whenever $U$ is to close to the boundary 0 or 1. Hence, learning $T_{\theta}$ with the above metric is not stable. To improve stability, we use the following fitness function + +$$ +\operatorname {F i t} (\theta) \stackrel {\text {d e f .}} {=} \mathbb {E} _ {X \sim \mathcal {D}} \left[ \mathbb {E} _ {U \sim \mathcal {U} (0, 1)} \left[ | U - F _ {\mu_ {X}} \left(T _ {\theta} (X, U)\right) | ^ {2} \right] \right]. \tag {8} +$$ + +In practice, we do not have access to the real cumulative distribution of $Y(x)$ . However, we have a set of responses sampled from $Y(x)$ , so we propose to use a simple method such as Kernel Density Estimator (KDE) with the kernel bandwidth of $h$ to have a smooth conditional density from responses of the covariate $x$ in the training dataset. The kernel bandwidth plays a vital role in our objective function, and tuning this parameter is important. In theory, our KDE smoothness using the Gaussian kernel is strongly related to the smoothed Wasserstein distance. From Nietert et al. (2021, Lemma 1 and Corollary 1), the smooth-2-Wasserstein distance is continuous and monotonically non-increasing in the Gaussian kernel bandwidth. This means that the larger the bandwidth (the more smoothing applied), the smaller the fitness term will become. In practice, we could implement an automatic kernel bandwidth selection such as the Scott (Scott, 1979) or the Silverman (Silverman, 2018) methods. In our implementation, the value of the bandwidth is selected by a grid search to minimize the Wasserstein distance on the validation set. + +# 4.2. Regularization Measure + +Minimizing the $\operatorname{Fit}(\theta)$ term can lead to overfitting due to the low sample sizes for many values of $x_{i}$ . To combat this problem, we add a regularization term to promote the transfer learning across different values of $x_{i}$ . Consider the CPS dataset, we examine the relationship between the covariate distance $\| x_{i} - x_{j}\|$ versus the empirical Wasserstein distance between the conditional random variables $Y(x_{i})$ and $Y(x_{j})$ . For better accuracy, we select only pairs $(x_{i},x_{j})$ such that both $N_{i}$ and $N_{j}$ are greater than 18. The scatter plot in Figure 2 indicates a positive correlation between + +![](images/32ed63d700a911bb31400d3cc80e35428b435ca79c15e0834c5a3c467c91cb71.jpg) +Figure 2. Positive correlation between the Wasserstein distance between $Y(x_{i})$ and $Y(x_{j})$ and the covariate distance $\| x_{i} - x_{j}\|$ . Only covariates $x$ with more than 18 observations are selected. + +the covariate distance and the Wasserstein distance of the conditional distributions. We remark that we observed the same trend in other datasets. + +From this empirical evidence, we can assume that if two covariates $x_{i}$ and $x_{j}$ are similar, their respective conditional distributions of $Y(x_{i})$ and $Y(x_{j})$ should also be similar. We emphasize that relying on this assumption to design the regularization term does not restrict the generalization of our framework. This assumption, in general, holds for the case where the data-generating process follows the form $Y = f(X) + \mathrm{noise}$ , where $f$ is a continuous function. This is a classic setting in distribution learning, a more general form of linear assumption. Moreover, classic algorithms for supervised and unsupervised learning, such as kNN or k-clustering, also require this assumption to work. We can, therefore, assume a Lipschitz condition that there exists a finite positive number $L$ such that + +$$ +W _ {2} ^ {2} (\mu_ {x _ {i}}, \mu_ {x _ {j}}) \leq L \| x _ {i} - x _ {j} \| \qquad \forall i, j, +$$ + +where $\mu_{x}$ is the data-generating conditional probability measure for $Y(x)$ . If the generative network $T_{\theta}$ matches sufficiently well the conditional distributions, then it is reasonable to translate the above Lipschitz assumption into a regularization term: let $\mathcal{E}$ be a set of pairs $(x_{i}, x_{j})$ for which we would like to impose Lipschitz conditions, we can regularize using the sum of the pairwise entropic OT distance: + +$$ +\sum_ {\left(x _ {i}, x _ {j}\right) \in \mathcal {E}} \mathrm {W} _ {2, \varepsilon} ^ {2} \left(T _ {\theta} \left(x _ {i}, \cdot\right) _ {\#} \mathbb {U}, T _ {\theta} \left(x _ {j}, \cdot\right) _ {\#} \mathbb {U}\right). \tag {9} +$$ + +The semi-dual form of the EOT (4) leads to + +$$ +\sum_ {\left(x _ {i}, x _ {j}\right) \in \mathcal {E}} \Big (\max _ {v _ {i j} (\cdot) \in \mathcal {C}} \int_ {\mathbb {R}} v _ {i j} ^ {\varepsilon} (y) \mathrm {d} \mathbb {P} _ {\theta , j} + \int_ {\mathbb {R}} v _ {i j} (y) \mathrm {d} \mathbb {P} _ {\theta , i} - \varepsilon \Big). +$$ + +Above, we have used the shorthand $\mathbb{P}_{\theta ,i} = T_{\theta}(x_i,\cdot)_{\#}\mathbb{U},$ the pushforward measure of the uniform measure under the + +map $T_{\theta}(x_i,\cdot)$ . Each maximization problem inside the sum is an infinite-dimensional optimization problem, in which we need to search over all potentials $v_{ij}$ continuous. To alleviate this computational burden, a naive approach is to use a neural network $v_{\phi}(x_i,x_j,\cdot)\approx v_{ij}(\cdot)$ , where $\phi$ is a learnable parameter. By omitting the constant $\varepsilon$ and switching the order of the summation and the maximization operator, we can regularize using + +max + +$$ +\sum_ {(x _ {i}, x _ {j}) \in \mathcal {E}} \left(\int_ {\mathbb {R}} v _ {\phi} ^ {\varepsilon} (x _ {i}, x _ {j}, y) \mathrm {d} \mathbb {P} _ {\theta , j} + \int_ {\mathbb {R}} v _ {\phi} (x _ {i}, x _ {j}, y) \mathrm {d} \mathbb {P} _ {\theta , i}\right). +$$ + +A downside of this parametrization is that it requires both $x_{i}$ and $x_{j}$ as input to $v_{\phi}$ to output the potential. This leads to redundancy in the parametrization. To combat this problem, we propose a single input network $v_{\phi}(x_i,y)$ to approximate $v_{ij}(y)$ , the potential associating with $\mathbb{P}_{\theta ,i}$ . Further, we compute the smoothed transform $v_{\phi}^{\varepsilon}(x_i,y)$ + +$$ +\begin{array}{l} v _ {\phi} ^ {\varepsilon} (x _ {i}, y) \stackrel {{\text {d e f .}}} {{=}} \\ - \varepsilon \log \left(\int_ {\mathbb {R}} \exp \left(\frac {v _ {\phi} \left(x _ {i} , y ^ {\prime}\right) - \left| y - y ^ {\prime} \right| ^ {2})}{\varepsilon}\right) \mathrm {d} \mathbb {P} _ {\theta , i}\right), \\ \end{array} +$$ + +and use $v_{\phi}^{\varepsilon}(x_i, y)$ to approximate $v_{ij}^{\varepsilon}(y)$ , the potential associating with $\mathbb{P}_{\theta,j}$ . The above single input parametrization no longer takes $x_j$ as input; thus, to make the network well-defined, we need disambiguation by imposing the following condition: for each distinct value $x_i$ , there is at most one pair $(x_i, x_j)$ that belongs to $\mathcal{E}$ . If this condition on $\mathcal{E}$ holds, then we can uniquely identify the $x_j$ such that $v_{\phi}^{\varepsilon}(x_i, y)$ is serving as the potential. + +Thus, for a valid set $\mathcal{E}$ , we propose the following regularization term: + +$$ +\operatorname {R e g} (\theta) \stackrel {\text {d e f .}} {=} \max _ {\phi} \mathcal {R} (\theta , \phi), \tag {10a} +$$ + +where $\mathcal{R}(\theta ,\phi)$ is + +$$ +\mathcal {R} (\theta , \phi) \stackrel {\text {d e f .}} {=} \tag {10b} +$$ + +$$ +\sum_ {(x _ {i}, x _ {j}) \in \mathcal {E}} \left(\int_ {\mathbb {R}} v _ {\phi} ^ {\varepsilon} (x _ {i}, y) \mathrm {d} \mathbb {P} _ {\theta , j} + \int_ {\mathbb {R}} v _ {\phi} (x _ {i}, y) \mathrm {d} \mathbb {P} _ {\theta , i}\right). +$$ + +In this way, $\operatorname{Reg}(\theta)$ is the sum of the semi-dual neural entropic OT distances of all pairwise distributions specified by $\mathcal{E}$ . + +To conclude this section, we elaborate on a reasonable approach to building $\mathcal{E}$ . Ideally, $\mathcal{E}$ should capture neighborhood information about which pair $(x_i, x_j)$ is close to each other; further, it should satisfy our disambiguation criterion that for each distinct value $x_i$ , there is at most one pair $(x_i, x_j)$ that belongs to $\mathcal{E}$ . A reasonable choice of $\mathcal{E}$ that is + +also computationally efficient is to build $\mathcal{E}$ as the directed edge set of a minimum spanning tree of all $x$ . Here, the spanning tree minimizes the sum of distance $\| x_i - x_j\|$ between two connected nodes, and we can employ Kruskal's algorithm (Kruskal, 1956). For the direction of the edge: at each iteration, when we add $x_i$ to the incumbent minimum spanning tree, then $x_i$ is chosen as the tail of the edge, and the other endpoint of the adding edge (which already belongs to the incumbent tree) is chosen as the head of the edge. This construction will satisfy the disambiguation criterion for the set $\mathcal{E}$ . We emphasize that the graph-based approach to identify which $x_j$ is associated with $x_i$ in the regularization term is not restricted only to a discrete set of covariates. This is because the graph-based approach is only employed during the training when the number of covariates is finite. In inference phases, the model can give the distributional prediction to any covariates. + +Remark 4.2. In (8), we use the unregularized OT distance as a discrepancy function for the fit term $\mathrm{Fit}(\theta)$ because therein, we are measuring the discrepancy between a fixed target (a uniform distribution $U$ ) and a quantity that depends on the generative network output $T_{\theta}(X,U)$ and the data-generating CDFs $F_{\mu_X}$ . This contrasts with the regularization term $\mathrm{Reg}(\theta)$ , where we need to compare two distributions that are both outputs of the generative network $T_{\theta}$ . Using the unregularized OT distance for the $\mathrm{Reg}(\theta)$ will require evaluating the CDFs of $T_{\theta}$ . To alleviate this difficulty, we use the semi-dual form of EOT, where we can parametrize a single conditional potential network to evaluate all the pairwise EOT distances between covariate pairs in $\mathcal{E}$ . + +# 4.3. Min-Max Optimization with Smooth Gradient Descent-Ascent + +By substituting the form of the regularization term (10) into (6), we obtain the min-max optimization problem: + +$$ +\min _ {\theta} \max _ {\phi} \operatorname {F i t} (\theta) + \lambda \mathcal {R} (\theta , \phi). \tag {11} +$$ + +Naively optimizing problem (11) will result in a common pitfall in optimization of training GANs: gradient descent-ascent (GDA) on nonconvex-nonconcave objective is, in general, hard to converge (Heusel et al., 2017; Lin et al., 2020; Zheng et al., 2023). To alleviate this problem, we employ the state-of-the-art first-order algorithm for GDA (Zheng et al., 2023) with a convergence guarantee. First, for parameters $r_1 \neq r_2$ , $r_1, r_2 > 0$ , we add two extra regularization (smoothing) terms with auxiliary variables $p$ and $q$ into the loss function. This leads to the augmented objective + +$$ +\begin{array}{l} \mathcal {L} (\theta , \phi , p, q) \\ \stackrel {\text {d e f .}} {=} \operatorname {F i t} (\theta) + \lambda \mathcal {R} (\theta , \phi) + \frac {r _ {1}}{2} \| \theta - p \| _ {2} ^ {2} - \frac {r _ {2}}{2} \| \phi - q \| _ {2} ^ {2}. \tag {12} \\ \end{array} +$$ + +Including the quadratic terms enhances the smoothness of the primal and dual update, facilitating a more balanced trade-off between the gradient updates in our nonconvex-nonconcave setting. In practice, we must evaluate this loss with training samples, detailed in Algorithm 1. Our training procedure is summarized in Algorithm 2. This doubly-smoothed GDA update is guaranteed to converge to a stationary point (Zheng et al., 2023, Theorem 2) as long as the max term $\mathcal{R}(\theta ,\phi)$ satisfies Kurdyka-Lojasiewicz condition (a nonsmooth extension of the more popular Polyak-Lojasiewicz condition). + +In general, we resort to a validation procedure to choose the appropriate parameters $h, \lambda, \varepsilon, r_1, r_2$ , and the optimization algorithm's learning rates $(\alpha, \beta, \gamma, \delta)$ . Details on the parameters grid are given in the Appendix A. + +# Algorithm 1 Empirical loss evaluation + +1: Input: data $(x_{i},\hat{F}_{x_{i}})$ , network $T_{\theta}$ and $v_{\phi}$ , auxiliary variables $p,q$ , batch size $B$ , set of pair covariates $\mathcal{E}$ , regularization parameter $\varepsilon, \lambda, r_1, r_2$ +2: Output: loss estimate $\widehat{\mathcal{L}} (\theta ,\phi ,p,q)$ +3: Initialize: take a batch of $B$ training nodes $\{x_{i}^{(b)}\}_{b\in [B]}$ +4: for each $(x_{i}^{(b)}, x_{j}^{(b)}) \in \mathcal{E}$ do +5: Sample $U^{(b)}\sim \mathcal{U}[0,1]$ +6: for $m = 1,\dots ,M$ do +7: Sample $U^{(b,m)}\sim \mathcal{U}[0,1]$ +8: end for +9: end for +10: Compute following (8): + +$$ +\widehat {\mathrm {F i t}} (\theta) \gets \frac {1}{B} \sum_ {b} \left[ U ^ {(b)} - \hat {F} _ {x _ {i} ^ {(b)}} (T _ {\theta} (x _ {i} ^ {(b)}, U ^ {(b)})) \right] _ {2} ^ {2} +$$ + +11: Compute following (10): + +$$ +\begin{array}{l} \sum_ {\left(x _ {i} ^ {(b)}, x _ {j} ^ {(b)}, U ^ {(b, m)}\right)} \left[ v _ {\phi} ^ {\varepsilon} \left(x _ {i} ^ {(b)}, T _ {\theta} \left(x _ {j} ^ {(b)}, U ^ {(b, m)}\right)\right) \right. \\ \left. \left. + v _ {\phi} \left(x _ {i} ^ {(b)}, T _ {\theta} \left(x _ {i} ^ {(b)}, U ^ {(b, m)}\right)\right) \right] / (M \times B) \right. \\ \end{array} +$$ + +12: Compute following (12): + +$$ +\begin{array}{l} \widehat {\mathcal {L}} (\theta , \phi , p, q) \\ \leftarrow \widehat {\operatorname {F i t}} (\theta) + \lambda \hat {\mathcal {R}} (\theta , \phi) + \frac {r _ {1}}{2} \| \theta - p \| _ {2} ^ {2} - \frac {r _ {2}}{2} \| \phi - q \| _ {2} ^ {2} \\ \end{array} +$$ + +# 5. Experiments + +Datasets. To benchmark our proposed method GENTLE, we use the following two datasets and the same preprocessing steps as in Athey et al. (2021). + +# Algorithm 2 Training of the Minimax loss (12) + +1: Input: data $\mathcal{D} = (x_{i},\{y_{ik}\}_{k = 1,\dots ,N_{i}})$ , network $T_{\theta}$ and $v_{\phi}$ , learning rate $\alpha, \beta$ , extrapolation parameters $\gamma, \delta$ +2: Initialize: $\theta^0, \phi^0, p^0, q^0$ +3: for each number of training iteration $t$ do +4: $\theta^{t + 1}\gets \theta^t -\alpha \nabla_\theta \widehat{\mathcal{L}} (\theta^t,\phi^t,p^t,q^t)$ +5: $\phi^{t + 1}\gets \phi^t +\beta \nabla_\phi \widehat{\mathcal{L}} (\theta^{t + 1},\phi^t,p^t,q^t)$ +6: $p^{t + 1} \gets p^t + \gamma (\theta^{t + 1} - p^t)$ +7: $q^{t + 1}\gets q^t +\delta (\phi^{t + 1} - q^t)$ +8: end for + +The LDW-CPS dataset, constructed by LaLonde (1986); Dehejia & Wahba (1999), is widely used in studies of Average Treatment Effects. This dataset contains 16177 samples from the real-world experiment and the Current Population Survey. Each covariate $x_{i}$ includes the individual's eight attributes: two earnings measure (earning 74, earning 75), two indicators for ethnicity (black, hispanic), marital status (married), age (age), two education measures (education, nodegree), and a binary variable for whether this individual receives treatment (is_treated). The response $y_{i}$ is earning 78, this individual's yearly income in 1978. This dataset has limited samples for each covariate, shown in Figure 1. To achieve better testing evaluation and model selection, we choose covariates based on their frequency for the test and validation sets. Specifically, covariates with a frequency higher than 30 are included in the test set, while those with a frequency higher than 20 but less than or equal to 30 are included in the validation set. According to this split strategy, the training set contains 15,255 samples corresponding to 13,745 covariates, the validation set contains 488 samples corresponding to 19 covariates, and the test set contains 434 samples corresponding to 20 covariates. + +We also apply frameworks to a practical simulator called the Esophageal Cancer Markov Chain Simulation Model (ECM). This simulator enables us to simulate patients' quality-adjusted life years (QALYs) from their current treatment until death. The approach to generate data for training and testing follows the authors in Hong et al. (2023). Each covariate $x_{i}$ consists of five attributes which are Barrett, aspirinEffect, statinEffect, drugIndex, and initialAge. The response feature for this dataset is QALY (quality-adjusted life years). Because we have access to the simulator, we can sample infinite responses for each covariate. We follow the dataset generation in Hong et al. (2023) in which they use the simulator to uniformly generate $2 \times 10^{4}$ different covariates for the train set, and each covariate has one response. The validation set has 200 covariates that are different from those in + +the train set, while the test set also has 200 covariates that are different from both the train and validation sets. Each covariate has $10^{4}$ responses. + +Baselines. We compare our method against state-of-the-art baselines, including CWGAN (Athey et al., 2021), WGAN-GP (Gulrajani et al., 2017), MGAN (Baptista et al., 2020), and CDSB (Shi et al., 2022). We keep the architecture of $T_{\theta}(x,U)$ and $v_{\phi}$ simple with seven fully connected layers with ReLU activation. + +We denote $D_{\mathrm{train}}$ , $D_{\mathrm{val}}$ , and $D_{\mathrm{test}}$ as the set of covariates in the training, validation, and test sets, respectively. While the covariates in the training set are used for training the model parameters, the ones in the validation test are utilized to select hyperparameters. For each distinct $x \in D_{\mathrm{test}}$ , the set of actual respective responses is denoted as $Y_{GT}(x)$ , while we use GENTLE, CWGAN, WGAN-GP, MGAN, and CDSB to generate $K = 10^4$ approximating points for $Y_{\mathrm{GT}}(x)$ , denoted as $Y_{\mathrm{GENTLE}}(x)$ , $Y_{\mathrm{CWGAN}}(x)$ , $Y_{\mathrm{WGAN-GP}}(x)$ , $Y_{\mathrm{MGAN}}(x)$ , $Y_{\mathrm{CDSB}}(x)$ respectively. We then compute the average Wasserstein distance and Kolmogorov-Smirnov statistic (Kolmogorov, 1933) over $D_{\mathrm{test}}$ between $Y_{\mathrm{GT}}(x)$ and the outputs $Y_{\mathrm{GENTLE}}(x)$ , $Y_{\mathrm{CWGAN}}(x)$ , $Y_{\mathrm{WGAN-GP}}(x)$ , $Y_{\mathrm{MGAN}}(x)$ , and $Y_{\mathrm{CDSB}}(x)$ , as shown in Table 1. + +Table 1. Wasserstein distance and K-S statistic on generated $\hat{Y}(x)$ using different methods vs. corresponding ground truth. The symbol $\pm$ represents the standard deviation. + +
DATASETMETHODWD(↓)KS(↓)
LDW-CPSGENTLE3767.62 (±1337.56)0.48 ± 0.05
CWGAN13371.99 (±3637.66)0.88 ± 0.09
MGAN4096.75 (±1004.5)0.91 ± 0.19
WGAN-GP7828.66 (±2306.00)0.99 ± 0.02
CDSB4970.66 (±1094.74)0.56 ± 0.14
ECMGENTLE0.97 ± 0.140.21 ± 0.02
CWGAN4.42 ± 2.010.94 ± 0.05
MGAN1.09 ± 0.590.55 ± 0.13
WGAN-GP1.59 ± 0.770.66 ± 0.27
CDSB2.04 ± 0.430.47 ± 0.12
+ +Results. We plot the qualitative results of estimated densities for different covariates $X$ in Figure 3 and 4. Overall, synthetic observations generated by GENTLE exhibit a strong resemblance to the ground truth distributions in both datasets, while the ones generated by baselines deviate significantly from the data-generating distributions. For each covariate, the distributions generated by CWGAN seem to collapse into the mean of the training data distribution, while those of MGAN and WGAN-GP tend to shrink + +towards the mean of the conditional data distribution of the covariate. Although CDSB does not suffer from this collapse tendency, it still fails to match the data-generating distributions accurately. This is consistent with the quantitative results in Table 1, which show that the data generated by GENTLE have not only smaller Wasserstein distance (WD) and Kolmogorov-Smirnov (KS) values but also smaller standard deviations. This suggests GENTLE's superior performance compared to the other baselines. + +# 5.1. Ablation Study on Training Loss Terms + +We explore the impact of removing specific components from the loss function (12) by considering two ablation versions. The first version omits the smoothing term in the loss function $\mathcal{L}$ by setting $r_1 = r_2 = 0$ , while the second version omits the regularization term by setting $\lambda = 0$ . When we exclude the regularization term, the model generates uniformly distributed responses in the LDW-CPS dataset, as illustrated in Figure 6. We hypothesize that the absence of $\mathrm{Reg}(\theta)$ compromises the model's ability to enforce the Lipschitz condition between the proximity in the covariates and responses space. This absence significantly hampers the method's performance in the dataset with an unbalanced observation of covariates like LDW-CPS. This problem does not exist in the ECM dataset which covariates are uniformly drawn from the simulation, so the performance of this version in ECM just slightly decreases. On the other hand, removing the smoothing term leads the model to get trapped in bad local optima, learning only simple two-peak patterns in both two datasets, as depicted in Figure 7 and Figure 8. This becomes more apparent when examining Table 2, where the KS statistic of this version surpasses that of the main method. This improvement may be attributed to the model's inclination to match high-density regions exclusively, lacking overall generalization. In summary, the results in Table 2 highlight that both ablation versions exhibit significantly worse performance than the official method, particularly regarding Wasserstein distance. This underscores the importance of the regularization and smoothing terms in maintaining the model's robustness and enhancing its overall performance. + +# 6. Conclusions + +This paper introduces a neural generative model for conditional distributions, whose parameters can be learned from limited data. Our method demonstrates remarkable efficacy in generating distributions over response spaces from given inputs. This is exemplified by successfully applying conditional dataset synthesis tasks on LDW-CPS and ECM datasets, where our framework exhibits superior performances. + +An exciting extension of the current work could involve + +Table 2. Wasserstein distance and K-S statistic on generated $\hat{Y}(x)$ using different ablation versions of GENTLE. The version GENTLE w/o SMO does not use the smoothing term while GENTLE w/o REG does not use the regularization term. The symbol $\pm$ represents the standard deviation. + +
DATASETMETHODWD(↓)KS(↓)
LDW-CPSGENTLE3767.62 (±1337.56)0.48 ± 0.05
GENTLE w/o REG13625.83 (±562.10)0.57 ± 0.04
GENTLE w/o SMO6075.02 (±1340.75)0.41 ± 0.04
ECMGENTLE0.97 ± 0.140.21 ± 0.02
GENTLE w/o REG1.13 ± 0.470.29 ± 0.04
GENTLE w/o SMO1.80 ± 1.280.30 ± 0.05
+ +exploring the application of our proposed method to dynamic or time-series data. Incorporating temporal dependencies could enhance the model's ability to capture evolving conditional distributions over time, enabling more accurate predictions in dynamic environments. Additionally, extending the setting of our approach beyond one-dimensional responses could further broaden its scope and impact. Finally, exploring interpretability techniques to elucidate the underlying mechanisms driving the learned conditional distributions could enhance understanding of the model's predictions in real-world decision-making scenarios. + +Acknowledgments. The work of Binh Nguyen is supported by Singapore's Ministry of Education grant A0004595-00-00. Viet Anh Nguyen gratefully acknowledges the generous support from the CUHK's Improvement on Competitiveness in Hiring New Faculties Funding Scheme and the CUHK's Direct Grant Project Number 4055191. + +# Impact Statement + +Our paper presents an advancement in the field of machine learning and also has potential societal implications. By improving the understanding and capabilities of conditional distribution modeling, our framework can contribute to various real-world applications. For instance, it can aid in personalized treatment planning in healthcare by modeling conditional distributions of patient responses to different therapies. In finance, it can enhance risk assessment by predicting conditional distributions of asset returns under varying market conditions. By enabling more accurate and nuanced predictions in diverse domains, our research can positively impact decision-making processes, resource allocation, and, ultimately, the well-being of individuals and society. + +![](images/2ef7822bd95191795abaaddc0c805c9df4f5d6d7f80e0be00282d28113227f18.jpg) + +![](images/c5ef323c31f6cd75bc6c875ee1e4c8ed033a79ca18c235b15e3498156fae7c85.jpg) + +![](images/53bbad6bc1506b477024f16cd27ab8d73ebbcd4b8b29c88b9da1b1a7fb1ff2e6.jpg) + +![](images/342a5fb4651403b349e9423b642348b8a7094150d9607fa24274c9bd80d97712.jpg) +Figure 3. The qualitative results of methods on the LDW-CPS dataset. The density graph 'GT', 'GENTLE' (ours), 'CWGAN', 'WGAN-GP', 'MGAN', 'CDSB' is constructed by applying kernel density estimate (KDE) on $Y_{\mathrm{GT}}(x)$ , $Y_{\mathrm{GENTLE}}(x)$ , $Y_{\mathrm{CWGAN}}(x)$ , $Y_{\mathrm{WGAN-GP}}(x)$ , $Y_{\mathrm{MGAN}}(x)$ , $Y_{\mathrm{CDSB}}(x)$ , respectively. Each subfigure is for a different value $x$ on the test set. We observe that GEN-TLE can produce the true distribution much more effectively than baselines. + +![](images/d2664c5cb82a043d3ff41aac8973435112bd350bd7f0546ae56ed4a0aa0b2fbe.jpg) + +![](images/caabb5cc1963b45e83528f96a7c35ee749ad3aac1b998f3373561e34336ffd75.jpg) + +![](images/24a8b1f67960ccc68b441e118dc9e3fa46afc63c3deabcd574a0dae3f5133704.jpg) + +![](images/67ca8de6f1a8d7c1d473640344a065a6de1843ae789aba6c329cb46ffd88dc65.jpg) + +![](images/e2c0e6cce9053b66860b337ceabc9ad451b2d1b3591849930b7b5ec2ab93ca2a.jpg) + +![](images/4a43aef02931b9bd96efd5058b601a67af58f0e767711055d62c729cbbc9acf1.jpg) +Figure 4. The qualitative results of methods on the ECM dataset. The density graph 'GT', 'GENTLE' (ours), 'CWGAN', 'WGAN-GP', 'MGAN', 'CDSB' is constructed by applying kernel density estimate (KDE) on $Y_{\mathrm{GT}}(x)$ , $Y_{\mathrm{GENTLE}}(x)$ , $Y_{\mathrm{CWGAN}}(x)$ , $Y_{\mathrm{WGAN-GP}}(x)$ , $Y_{\mathrm{MGAN}}(x)$ , $Y_{\mathrm{CDSB}}(x)$ , respectively. Each subfigure is for a different value $x$ on the test set. We observe that GENTLE can produce the true distribution much more effectively than baselines. + +![](images/7e2a3ec168b03536ad205906a494eb77e79c9435c3babec1e36860f2e5d0a0e9.jpg) + +![](images/639f5a1158feeb6e32b16691b86b238ef048a54ff62259b65694c39d173fd06c.jpg) + +# References + +Arjovsky, M., Chintala, S., and Bottou, L. Wasserstein generative adversarial networks. In International Conference on Machine Learning, pp. 214-223. PMLR, 2017. +Athey, S. and Imbens, G. W. Machine learning for estimating heterogeneous causal effects. Technical report, 2015. +Athey, S., Imbens, G. W., Metzger, J., and Munro, E. Using Wasserstein generative adversarial networks for the design of Monte Carlo simulations. Journal of Econometrics, 2021. +Austin, T. Exchangeable random measures. In Annales de l'IHP Probabilités et Statistiques, volume 51, pp. 842-861, 2015. +Baptista, R., Hosseini, B., Kovachki, N. B., and Marzouk, Y. Conditional sampling with monotone GANs: From generative models to likelihood-free inference. arXiv preprint arXiv:2006.06755, 2020. +Bobkov, S. and Ledoux, M. One-Dimensional Empirical Measures, Order Statistics, and Kantorovich Transport distances, volume 261. American Mathematical Society, 2019. +Branco, P., Torgo, L., and Ribeiro, R. P. SMOGN: A preprocessing approach for imbalanced regression. In First International Workshop on Learning with Imbalanced Domains: Theory and Applications, pp. 36-50. PMLR, 2017. +Bunne, C., Krause, A., and Cuturi, M. Supervised training of conditional Monge maps. Advances in Neural Information Processing Systems, 35:6859-6872, 2022. +Bunne, C., Stark, S. G., Gut, G., Del Castillo, J. S., Levesque, M., Lehmann, K.-V., Pelkmans, L., Krause, A., and Ratsch, G. Learning single-cell perturbation responses using neural optimal transport. Nature Methods, 20(11):1759-1768, 2023. +Chawla, N. V., Bowyer, K. W., Hall, L. O., and Kegelmeyer, W. P. Smote: synthetic minority oversampling technique. Journal of artificial intelligence research, 16:321-357, 2002. +Choi, J., Choi, J., and Kang, M. Generative modeling through the semi-dual formulation of unbalanced optimal transport. arXiv preprint arXiv:2305.14777, 2023. +Cuturi, M. Sinkhorn distances: Lightspeed computation of optimal transport. Advances in Neural Information Processing Systems, 26, 2013. + +Dehejia, R. H. and Wahba, S. Causal effects in nonexperimental studies: Reevaluating the evaluation of training programs. Journal of the American statistical Association, 94(448):1053-1062, 1999. +Díaz, I. Machine learning in the estimation of causal effects: Targeted minimum loss-based estimation and double/debiased machine learning. Biostatistics, 21(2):353-358, 2020. +Esteban-Pérez, A. and Morales, J. M. Distributionally robust stochastic programs with side information based on trimmings. Mathematical Programming, 195(1):1069-1105, 2022. +Genevay, A., Cuturi, M., Peyre, G., and Bach, F. Stochastic optimization for large-scale optimal transport. In Proceedings of the 30th International Conference on Neural Information Processing Systems, pp. 3440-3448, 2016. +Gulrajani, I., Ahmed, F., Arjovsky, M., Dumoulin, V., and Courville, A. C. Improved training of Wasserstein GANs. Advances in Neural Information Processing Systems, 30, 2017. +Gushchin, N., Kolesov, A., Korotin, A., Vetrov, D., and Burnaev, E. Entropic neural optimal transport via diffusion processes. arXiv preprint arXiv:2211.01156, 2022. +Heusel, M., Ramsauer, H., Unterthiner, T., Nessler, B., and Hochreiter, S. GANs trained by a two time-scale update rule converge to a local Nash equilibrium. Advances in Neural Information Processing Systems, 30, 2017. +Hong, L. J., Hou, Y., Zhang, Q., and Zhang, X. Learning to simulate: Generative metamodeling via quantile regression. arXiv preprint arXiv:2311.17797, 2023. +Jacob, L., She, J., Almahairi, A., Rajeswar, S., and Courville, A. W2GAN: Recovering an optimal transport map with a GAN, 2019. URL https://openreview.net/forum?id=BJx9f305t7. +Jiang, G., Hong, L. J., and Nelson, B. L. Online risk monitoring using offline simulation. INFORMS Journal on Computing, 32(2):356-375, 2020. +Kolmogorov, A. Sulla determinazione empirica di una legge di distribuzione. Giorn Dell'inst Ital Degli Att, 4: 89-91, 1933. +Korotin, A., Selikhanovych, D., and Burnaev, E. Neural optimal transport. In The Eleventh International Conference on Learning Representations, 2022. +Kruskal, J. B. On the shortest spanning subtree of a graph and the traveling salesman problem. Proceedings of the American Mathematical Society, 7(1):48-50, 1956. + +Kullback, S. Probability densities with given marginals. The Annals of Mathematical Statistics, 39(4):1236-1243, 1968. +LaLonde, R. J. Evaluating the econometric evaluations of training programs with experimental data. The American Economic Review, pp. 604-620, 1986. +Léonard, C. A survey of the Schrödinger problem and some of its connections with optimal transport. Discrete and Continuous Dynamical Systems-Series A, 34 (4):1533-1574, 2014. +Lin, T., Jin, C., and Jordan, M. On gradient descent ascent for nonconvex-concave minimax problems. In International Conference on Machine Learning, pp. 6083-6093. PMLR, 2020. +Makkuva, A., Taghvaei, A., Oh, S., and Lee, J. Optimal transport mapping via input convex neural networks. In International Conference on Machine Learning, pp. 6672-6681. PMLR, 2020. +Nguyen, V. A., Zhang, F., Blanchet, J., Delage, E., and Ye, Y. Distributionally robust local non-parametric conditional estimation. Advances in Neural Information Processing Systems, 33:15232-15242, 2020a. +Nguyen, V. A., Zhang, X., Blanchet, J., and Georgiou, A. Distributionally robust parametric maximum likelihood estimation. In Advances in Neural Information Processing Systems, volume 33, pp. 7922-7932, 2020b. +Nguyen, V. A., Zhang, F., Wang, S., Blanchet, J., Delage, E., and Ye, Y. Robustifying conditional portfolio decisions via optimal transport. Operations Research, 2024. +Nietert, S., Goldfeld, Z., and Kato, K. Smooth $p$ -Wasserstein distance: Structure, empirical approximation, and statistical applications. In International Conference on Machine Learning, pp. 8172-8183. PMLR, 2021. +Nutz, M. Introduction to Entropic Optimal Transport. Lecture notes, Columbia University, 2021. +Parikh, H., Varjao, C., Xu, L., and Tchetgen, E. T. Validating causal inference methods. In International Conference on Machine Learning, pp. 17346-17358. PMLR, 2022. +Sadana, U., Chenreddy, A., Delage, E., Forel, A., Frejinger, E., and Vidal, T. A survey of contextual optimization methods for decision-making under uncertainty. European Journal of Operational Research, 2024. +Scott, D. W. On optimal and data-based histograms. Biometrika, 66(3):605-610, 1979. + +Shen, H., Hong, L. J., and Zhang, X. Ranking and selection with covariates for personalized decision making. INFORMS Journal on Computing, 33(4):1500-1519, 2021. +Shi, Y., De Bortoli, V., Deligiannidis, G., and Doucet, A. Conditional simulation using diffusion Schrödinger bridges. In Uncertainty in Artificial Intelligence, pp. 1792-1802. PMLR, 2022. +Shrivastava, A. and Tuzel, O. Learning conditional error model for simulated time-series data. In CVPR Workshops, pp. 91-94, 2019. +Silverman, B. W. Density Estimation for Statistics and Data Analysis. Routledge, 2018. +Torgo, L., Ribeiro, R. P., Pfahringer, B., and Branco, P. SMOTE for regression. In Portuguese Conference on Artificial Intelligence, pp. 378-389. Springer, 2013. +van Breugel, B., Seedat, N., Imrie, F., and van der Schaar, M. Can you rely on your model evaluation? Improving model evaluation with synthetic test data. Advances in Neural Information Processing Systems, 36, 2024. +Villani, C. Optimal Transport: Old and New, volume 338. Springer, 2009. +Zheng, T., Zhu, L., So, A. M.-C., Blanchet, J., and Li, J. Universal gradient descent ascent method for nonconvex-nonconcave minimax optimization. In Advances in Neural Information Processing Systems, 2023. + +# A. Additional Experimental Details + +# A.1. Parameter Tuning + +We heuristically fix the learning rates $\alpha = \beta = 0.001$ as a reasonable value for almost every simple multilayer perception model. For other parameters, we conducted a grid search on minimizing the WD metric of the validation set. We found that the best combination for our parameters in the LDW-CPS dataset is KDE bandwidth of $h = 0.3$ , $\varepsilon = 1.0$ , $\lambda = 0.4$ , $r_1 = 3.0$ , $r_2 = 2.0$ , $\gamma = 0.5$ , $\delta = 0.7$ . Regarding the ECM dataset, the best combination is $h = 0.2$ , $\varepsilon = 1.0$ , $\lambda = 0.4$ , $r_1 = 3.0$ , $r_2 = 2.0$ , $\gamma = 0.5$ , $\delta = 0.7$ . We fix these parameter values for all our experiments in the main paper. + +# A.2. Comparison between GENTLE and Baselines on Other Metrics + +In this section, we report two additional metrics, including Mean Squared Error (MSE) and $R^2$ score, to evaluate the performance of GENTLE and baselines. Tables 3 and 4 represent the average results of algorithms across ten different seed numbers in terms of these two metrics. We observe that GENTLE outperforms baselines on both MSE and $R^2$ criteria. Although MGAN has comparable results to GENTLE in terms of MSE and $R^2$ , the qualitative results shown in Figures 3 and 4 and the statistical metrics of WD and KS in Tables 1 reveals its trend of collapsing to the mean of the ground truth distribution. + +Table 3. MSE and $R^2$ on generated $\hat{Y}(x)$ using different methods vs. corresponding ground truth on the LDW-CPS dataset. The symbol $\pm$ represents the standard deviation. + +
MethodMSE (×106)(↓)R2(↑)
GENTLE3.70 ± 0.730.92 ± 0.05
CWGAN108.43 ± 42.93-1.83 ± 0.13
MGAN3.82 ± 0.710.92 ± 0.09
WGAN-GP59.64 ± 9.65-0.59 ± 0.07
CDSB8.54 ± 1.210.77 ± 0.08
+ +Table 4. MSE and $R^2$ on generated $\hat{Y}(x)$ using different methods vs. corresponding ground truth on the ECM dataset. The symbol $\pm$ represents the standard deviation. + +
MethodMSE (↓)R2(↑)
GENTLE0.62 ± 0.320.96 ± 0.05
CWGAN24.30 ± 4.360.00 ± 0.13
MGAN1.24 ± 0.220.91 ± 0.10
WGAN-GP2.11 ± 0.330.86 ± 0.08
CDSB2.01 ± 0.390.89 ± 0.04
+ +# A.3. Additional Experimental Results + +In Figure 5, we plot the value of $T_{\theta}(x,U)$ for an increasing grid of $U \sim \mathcal{U}(0,1)$ . We observe that the output of $T_{\theta}$ also increased with $U$ , empirically confirming that $T_{\theta}$ is an increasing function, which conforms with the fact that $T_{\theta}(x,U)$ is an approximation of an increasing function of $U$ . + +![](images/fde31d5e475f170dbba5b6effe9d488fe6f3cc35fab0f274d7fcee44dd944454.jpg) +(a) GENTLE trained on LDW-CPS + +![](images/3a89c47cbf2e9677496f78b395da42ab901d9a8a7cf56e78a80e3022c5e3f18b.jpg) +(b) GENTLE trained on ECM +Figure 5. Empirical evidence for the monotonically increasing property of the learned network $T_{\theta}(x,U)$ in the variable $U$ . + +![](images/4f93c096811597c7cf44ea7a4d955498e3c40cf68bb5a581da8dd42520fcd0d7.jpg) + +![](images/d0aa08d4e18ff470203b23c6374c66e8f8e08d44a9abf0e9ab7c92d361aa3d4b.jpg) + +![](images/ad2b2e3bd93dc0a9eb822b83d1bccd632b4fe891d75a2252a22729b997c8c140.jpg) + +![](images/52a3c682ab1c6a0c34649c09b519f7bd9b91016940c8cd0fd831c4ac8d6a76bb.jpg) +Figure 6. Qualitative result of the GENTLE version without regularization term on the LDW-CPS dataset. Each subfigure represents the results of a different covariate value in the test set. The learned distribution of this version tends to span over the range of the response term uniformly. + +![](images/03541ef79fe9c5583b585ba68236bc4d925f38b8986a6ad628dc5c49cfa1bcfa.jpg) + +![](images/cf1bf7a58a7dd5f88e023af0a2f243d28006dad93769f91647e7988a131c8dbd.jpg) + +![](images/cdcfd43efa1e839f9f995e6ae12a34158157e1f5420c789582e008179c4d327d.jpg) + +![](images/49ebb09b0c8beccb020e0f8b834acfabf9571130e589fcb02a262bf104d353ae.jpg) + +![](images/64ed8785e4a2ea946ed1d84f3b1fa2f87099ba3447be1d017d62b8b9803266a7.jpg) + +![](images/d762c98fa849a72c5ff20070967100a414d362e01284295eb723a9c6674c1032.jpg) +Figure 7. Qualitative result of the GENTLE version without smoothing term on the LDW-CPS dataset. Each subfigure represents the results of a different covariate value in the test set. + +![](images/2979fb86dfd4c18a6b01c9c1b17ed0627cb4be2f25b885d548e2daa39901f7f7.jpg) + +![](images/b6468a43ebb2b8c80e62049e460b772e08c230df8b0b48c206a0a7fa3f9b8fcf.jpg) + +![](images/10ba92ddc6d302f0f5d101b055f01b7d527583a102f6c959da5d79dcbe904264.jpg) + +![](images/98a8fb444421967ec607122bea13ef302b105de582a7ff28e0e04c8da60f20f8.jpg) + +![](images/38061b5862c257f001956ef967e305aad18c1552dec1e44dcde6ea0b914fd5ad.jpg) + +![](images/ba263272fe13bd089b31f0d29c9067d8ddbc4cef53849479fcc0ba9b8a244153.jpg) +Figure 8. Qualitative result of the GENTLE version without smoothing term on the ECM dataset. Each subfigure represents the results of a different covariate value in the test set. + +![](images/928348236fd46f79e60de5b36b5b98bda9c9ef05147ccae5e35a77449041c8cd.jpg) + +![](images/5c199af4a1d1875f860dbc3ce6b540c1cabecba57973e260382a92771ad63e01.jpg) \ No newline at end of file diff --git a/generativeconditionaldistributionsbyneuralentropicoptimaltransport/images.zip b/generativeconditionaldistributionsbyneuralentropicoptimaltransport/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..dbd1e4e5eb5882257ed57a017720547b58129d1a --- /dev/null +++ b/generativeconditionaldistributionsbyneuralentropicoptimaltransport/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd9d9a1b3a1bab7214ee0c2edd2bf71b4f0c79ebdb656e39aea8b83b9b1fcda6 +size 753755 diff --git a/generativeconditionaldistributionsbyneuralentropicoptimaltransport/layout.json b/generativeconditionaldistributionsbyneuralentropicoptimaltransport/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..aa71419d0aebeff3c44628c532a9f288383968e9 --- /dev/null +++ b/generativeconditionaldistributionsbyneuralentropicoptimaltransport/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ee5c690dbde5b1a57a52a35b94f5c609c55cc577ff9e1a799b488da39a35ef7 +size 677545 diff --git a/generativeenzymedesignguidedbyfunctionallyimportantsitesandsmallmoleculesubstrates/6d6c3dc0-4668-4cc6-8ad6-8f39ca3f4ead_content_list.json b/generativeenzymedesignguidedbyfunctionallyimportantsitesandsmallmoleculesubstrates/6d6c3dc0-4668-4cc6-8ad6-8f39ca3f4ead_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..58beb240c46a15ac1e0c49879c9155f25d608cf3 --- /dev/null +++ b/generativeenzymedesignguidedbyfunctionallyimportantsitesandsmallmoleculesubstrates/6d6c3dc0-4668-4cc6-8ad6-8f39ca3f4ead_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:953876778b17dbc4111ee2a9bb93a63a5a260dce8a5633a8ccca799da7865d40 +size 187107 diff --git a/generativeenzymedesignguidedbyfunctionallyimportantsitesandsmallmoleculesubstrates/6d6c3dc0-4668-4cc6-8ad6-8f39ca3f4ead_model.json b/generativeenzymedesignguidedbyfunctionallyimportantsitesandsmallmoleculesubstrates/6d6c3dc0-4668-4cc6-8ad6-8f39ca3f4ead_model.json new file mode 100644 index 0000000000000000000000000000000000000000..abefd6814fc031308840b7369aaaaa0f3a478cdd --- /dev/null +++ b/generativeenzymedesignguidedbyfunctionallyimportantsitesandsmallmoleculesubstrates/6d6c3dc0-4668-4cc6-8ad6-8f39ca3f4ead_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:269c349ed04a37af1fe4619e74a8ae636919f231e385c06436af48e04945494f +size 215221 diff --git a/generativeenzymedesignguidedbyfunctionallyimportantsitesandsmallmoleculesubstrates/6d6c3dc0-4668-4cc6-8ad6-8f39ca3f4ead_origin.pdf b/generativeenzymedesignguidedbyfunctionallyimportantsitesandsmallmoleculesubstrates/6d6c3dc0-4668-4cc6-8ad6-8f39ca3f4ead_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..728b7cdb3c4a11eb82db23ecf2171e2979519c6b --- /dev/null +++ b/generativeenzymedesignguidedbyfunctionallyimportantsitesandsmallmoleculesubstrates/6d6c3dc0-4668-4cc6-8ad6-8f39ca3f4ead_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:33daa0cd74f8dbe2ab1b97419507bc9644c8169afa6e3e9dd96cf9f3c0064eb7 +size 4061090 diff --git a/generativeenzymedesignguidedbyfunctionallyimportantsitesandsmallmoleculesubstrates/full.md b/generativeenzymedesignguidedbyfunctionallyimportantsitesandsmallmoleculesubstrates/full.md new file mode 100644 index 0000000000000000000000000000000000000000..457dd62f31732c1c60a0903b06a7e652820fa927 --- /dev/null +++ b/generativeenzymedesignguidedbyfunctionallyimportantsitesandsmallmoleculesubstrates/full.md @@ -0,0 +1,542 @@ +# Generative Enzyme Design Guided by Functionally Important Sites and Small-Molecule Substrates + +Zhenqiao Song1 Yunlong Zhao2 Wenxian Shi3 Wengong Jin4 Yang Yang5 Lei Li1 + +# Abstract + +Enzymes are genetically encoded biocatalysts capable of accelerating chemical reactions. How can we automatically design functional enzymes? In this paper, we propose EnzyGen, an approach to learn a unified model to design enzymes across all functional families. Our key idea is to generate an enzyme's amino acid sequence and their three-dimensional (3D) coordinates based on functionally important sites and substrates corresponding to a desired catalytic function. These sites are automatically mined from enzyme databases. EnzyGen consists of a novel interleaving network of attention and neighborhood equivariant layers, which captures both long-range correlation in an entire protein sequence and local influence from nearest amino acids in 3D space. To learn the generative model, we devise a joint training objective, including a sequence generation loss, a position prediction loss and an enzyme-substrate interaction loss. We further construct EnzyBench, a dataset with 3157 enzyme families, covering all available enzymes within the protein data bank (PDB). Experimental results show that our EnzyGen consistently achieves the best performance across all 323 testing families, surpassing the best baseline by $10.79\%$ in terms of substrate binding affinity. These findings demonstrate EnzyGen's superior capability in designing well-folded and effective enzymes binding to specific substrates with high affinities. The code, model and dataset are released at https://github.com/LeiLiLab/EnzyGen. + +$^{1}$ Language Technologies Institute, Carnegie Mellon University. $^{2}$ Department of Chemistry, Massachusetts Institute of Technology $^{3}$ Department of EECS, Massachusetts Institute of Technology. $^{4}$ Broad Institute of MIT and Harvard. $^{5}$ Department of Chemistry and Biochemistry, University of California Santa Barbara. Correspondence to: Lei Li , Yang Yang . + +Proceedings of the $41^{st}$ International Conference on Machine Learning, Vienna, Austria. PMLR 235, 2024. Copyright 2024 by the author(s). + +# 1. Introduction + +Enzymes are biological catalysts to accelerate challenging chemical reactions underlying a range of biological processes. They enjoy widespread applications in the production of pharmaceuticals (Wu et al., 2012), specialty chemicals (Carbonell et al., 2018) and biofuels (Liao et al., 2016). In enzymatic reactions, the substrate is a small molecule being converted by the enzyme catalyst. By binding with and acting on specific substrates, enzymes allow for dramatically accelerated rates in the transformation of their substrates (Bar-Even et al., 2011). Designing enzymes that can bind to specific substrates is a critical yet challenging problem. + +Recently, deep learning methods are promising in protein design (Huang et al., 2016; Pearce & Zhang, 2021). Existing deep learning approaches for functional protein design fall into three categories: (a) generative models for protein sequence design guided by fitness landscape (Brookes et al., 2019; Rives et al., 2021; Ren et al., 2022; Song & Li, 2023; Wang et al., 2023); (b) structure to sequence generation based on a targeted protein backbone (Ingraham et al., 2019; Dauparas et al., 2022; Zheng et al., 2023); (c) code of a backbone structure and a protein sequence that encodes it (Anishchenko et al., 2021; Wang et al., 2022; Shi et al., 2022; Yeh et al., 2023). However, these methods face many limitations on enzyme design. First, fitness-guided approaches are limited by the lack of fitness data for the vast majority of enzyme families. Second, the structures of many enzymes remain unknown (Binz et al., 2005; Fischman & Ofran, 2018). Third, prior approaches do not model substrates in enzyme design process. Finally, there is no unified model applicable to all enzyme families. + +In this paper, we aim to learn a unified generative model to design functional enzymes across thousands of enzyme families. The key design idea lies in the notion that the biological function of an enzyme is enabled by a subset of residues (amino acids), known as functionally important sites (Bickel et al., 2002; Chakrabarti & Lanczycki, 2007; Wang et al., 2022), and that an ideal enzyme should be able to bind its substrate(s) in enzymatic reactions. Therefore, we formulate the enzyme design problem as jointly generating the enzyme sequence and backbone structure given auto + +matically mined functionally important sites and substrates related to specific enzyme functions. + +To this end, we propose EnzyGen, a unified model to codeign enzyme sequence and backbone structure. EnzyGen comprises an enzyme modeling module and a substrate representation module. We devise neighborhood attentive equivariant layers (NAELs) to jointly model enzyme amino acid sequence and residue coordinates. Each NAEL consists of a global attention sub-layer and a neighborhood equivariant sub-layer. The global attention sub-layer captures correlations among all residues within an entire enzyme sequence, while the neighborhood equivariant sub-layer updates residue representations and coordinates based on nearest neighbors in the 3D space. This architectural design facilitates information exchange with varying levels of granularity, promoting a comprehensive interaction among different residues. The substrate representation module also uses neighborhood equivariant layers to model a given substrate. Furthermore, We add category tags that correspond to BRENDA enzyme families to guide the design of enzymes with specific functions. To train EnzyGen, we design a joint training objective, which includes an amino acid type prediction loss, a coordinate reconstruction loss and an enzyme-substrate interaction loss. + +Our contributions are listed as follows: + +- We propose EnzyGen to jointly design enzyme sequence and backbone structure. EnzyGen is the first unified enzyme design model across thousands of enzyme families. +- We create EnzyBench, a comprehensive benchmark for enzyme design, including 101,974 PDB entries across 3,157 enzyme families, and a set of three metrics to evaluate enzyme quality before wet-lab experiments. EnzyBench includes a test set with 323 families for various function validation. +- We conduct experiments to evaluate EnzyGen and prior functional protein design methods. These results show that enzymes designed by EnzyGen lead to the best average enzyme-substrate ESP score (Kroll et al., 2023) of 0.65, substrate binding affinity of -9.44, and AlphaFold2 pLDDT (Jumper et al., 2021) of 87.45 across 323 families (BRENDA enzyme classification fourth-level categories). EnzyGen outperforms the best baseline by $10.79\%$ in terms of substrate binding affinity. + +# 2. Related Work + +Methods for Functional Protein Design. Functional protein design has been studied with a wide variety of methods. Some works focus on designing functional proteins guided by fitness landscape, including searching (Brookes & List- + +garten, 2018; Brookes et al., 2019; Kumar & Levine, 2020; Das et al., 2021; Hoffman et al., 2022; Melnyk et al., 2021; Anishchenko et al., 2021; Ren et al., 2022) or directly generating (Jain et al., 2022; Song & Li, 2023) protein sequences through deep generative models. Another category of methods concentrates on designing protein sequences capable of folding into backbone structures to fulfill specific functions (Wang et al., 2018; Strokach et al., 2020; Dauparas et al., 2022; Hsu et al., 2022; Sumida et al., 2023). Owing to the availability of large-scale data, some models are trained on extensive protein sequences from diverse families (Ferruz et al., 2022) or incorporate additional control tags for enhanced modeling (Madani et al., 2023). On the path from sequence to function, the role of structure emerges as a crucial intermediary. Consequently, some studies focus on the design of functional structures (Trippe et al., 2022; Watson et al., 2023). Recognizing the inherently complex interplay between protein sequence and structure, another set of works relies on the simultaneous generation of a new backbone structure and an amino acid sequence that folds into it (Anishchenko et al., 2021; Wang et al., 2022; Shi et al., 2022; Yeh et al., 2023; Song et al., 2023). Compared to the design of other functional proteins, functional enzyme design is largely underdeveloped. Some of the above methods have been applied to specific enzyme families, such as generating satisfactory enzyme sequences using deep generative models (Detlefsen et al., 2022; Lin et al., 2022a; Giessel et al., 2022). However, there is currently no unified generative model that is applicable to all enzyme families. + +Functionally Important Site Discovery in Enzymes. As our method conditions enzyme design on automatically mined functionally important sites, crucial in determining their structures or functions (Tristem, 2000), it is necessary to revisit research on identifying functionally important sites in enzymes. Several databases, such as PROSITE (Hulo et al., 2006), Gene Ontology (Ashburner et al., 2000) and InterPro (Hunter et al., 2009) identify and annotate protein functional sites based on sequentially conserved residues and information extracted from experimental studies and literature searches. Some efforts have also been undertaken to derive functional insights using 3D structural information (Fetrow & Skolnick, 1998; Fetrow et al., 2001; Ivanisenko et al., 2005). Other investigators have predicted functional sites using multiple sequence alignments (Armon et al., 2001; Panchenko et al., 2004; Bray et al., 2009; Hosseini & Ilie, 2022). + +# 3. Proposed Method: EnzyGen + +An enzyme consists of a chain of amino acids (also called residues) connected by peptide bonds, which folds into a proper 3D structure. Let $\mathcal{A}$ be the set of 20 common amino acids. We denote the sequence of a $N$ -residue enzyme by + +![](images/8c4c2c542fe61bb43f63dfdccd44fc3d9fb0ebd623fededafccc42691948f65f.jpg) +Figure 1. (a) EnzyGen architecture, consisting of an enzyme modeling module (left) and a substrate representation module (right). The enzyme modeling module aims to generate the enzyme sequence and backbone structure, and the substrate representation module targets at predicting if an enzyme can bind to a substrate. The dashed box in enzyme input denotes functionally important sites, while other sites need to be generated. [M] denotes mask token. "1.1.1.1" denotes the fourth-level enzyme class in the BRENDA enzyme classification (EC) tree. (b) Neighborhood equivariant layer: neighborhood message update (in green), neighborhood coordinate update (in blue) and neighborhood node feature update (in red). Indexed selection is choosing $x_{j}$ (or $h_{j}$ ) where $j^{th}$ residue is in the $K$ -nearest neighbors of $i^{th}$ residue. + +$\pmb{s} = \{s_1,s_2,\dots,s_N\} \in \mathcal{A}^N$ and their $C_\alpha$ coordinates by $\pmb{x} = [\pmb{x}_1,\pmb{x}_2,\dots,\pmb{x}_N]^T\in \mathbb{R}^{N\times 3}$ . For residue type $s_i\in \mathcal{A}$ where $i\in \{1,2,\ldots ,N\}$ , we denote its one-hot encoding as $\pmb{s}_i = \mathrm{onehot}(s_i)$ and the functionally important site index set as $\mathcal{M}$ . We denote a substrate as $\mathcal{V} = \{v_{1},\dots,v_{m}\}$ , where $m$ is the number of its atoms, and $v_{j} = (h_{j},x_{j})$ denotes an atom where $j\in \{1,2,\dots,m\}$ . Here, $\pmb{h_j}$ represents pre-computed chemical features, and $\pmb{x}_j\in \mathbb{R}^3$ is the corresponding coordinate. Each substrate is paired with a binary label $y$ indicating whether the enzyme can bind with it. Inspired by multilingual machine translation models in natural language processing, which employ language tags to guide model generation in specific target languages (Johnson et al., 2017; Liu et al., 2020), we similarly use enzyme family tags to facilitate enzyme design with desired functions. To provide a systematical and professional enzyme family classification, we leverage the enzyme classification (EC) tree in BRENDA (Schomburg et al., 2004) as illustrated in Appendix Figure 5. + +The problem studied in this paper can be formulated as follows: given a desired enzyme family $c$ in EC tree, a substrate $\mathcal{V}$ , a functionally important site index set $\mathcal{M}$ , its residue set $s_{\mathcal{M}}$ and the corresponding 3D coordinates $\boldsymbol{x}_{\mathcal{M}}$ , generate an enzyme sequence $\boldsymbol{s}$ and $C_{\alpha}$ coordinates $\boldsymbol{x}$ of $N$ residues satisfying the substrate binding constraint $y$ . Essentially, we aim to learn a generative model with probability $P(s, x, y | s_{\mathcal{M}}, x_{\mathcal{M}}, c, \mathcal{V})$ . + +# 3.1. Overall Model Architecture + +We propose a model named EnzyGen, as illustrated in Figure 1 (a), to simultaneously generate an enzyme sequence and its 3D backbone structure, constrained by the enzyme's + +small-molecule substrate. EnzyGen is a deep neural network consisting of an enzyme modeling module and a substrate representation module. The enzyme modeling module is composed of $L_{e}$ stacked neighborhood attentive equivariant layers (NAELs). Each NAEL is composed of a global attention sub-layer using Transformer (Vaswani et al., 2017) and a neighborhood equivariant sub-layer (Figure 1 (b)) to incorporate information from the nearby residues based on $C_{\alpha}$ coordinates. The substrate representation module consists of $L_{s}$ stacked neighborhood equivariant layers to pass messages inside the substrate $\mathcal{V}$ , which will then provide binding constraint on the design of enzyme. + +Suppose $\theta$ are EnzyGen parameters. We can formulate the joint probability as: + +$$ +\begin{array}{l} P (\boldsymbol {s}, \boldsymbol {x}, y | \boldsymbol {s} _ {\mathcal {M}}, \boldsymbol {x} _ {\mathcal {M}}, c, \nu ; \theta) = P (\boldsymbol {s}, \boldsymbol {x} | \boldsymbol {s} _ {\mathcal {M}}, \boldsymbol {x} _ {\mathcal {M}}, c; \theta) \\ \cdot P (y | \boldsymbol {s} _ {\mathcal {M}}, \boldsymbol {x} _ {\mathcal {M}}, c, \mathcal {V}; \theta) \\ \end{array} +$$ + +$$ +\begin{array}{l} P (\boldsymbol {s}, \boldsymbol {x} | \boldsymbol {s} _ {\mathcal {M}}, \boldsymbol {x} _ {\mathcal {M}}, c; \theta) = P (\boldsymbol {s} | \boldsymbol {s} _ {\mathcal {M}}, \boldsymbol {x} _ {\mathcal {M}}, c; \theta) \\ \cdot P (\boldsymbol {x} | \boldsymbol {s} _ {\mathcal {M}}, \boldsymbol {x} _ {\mathcal {M}}, c; \theta) \\ \end{array} +$$ + +$$ +\begin{array}{l} P \left(\boldsymbol {s} \mid \boldsymbol {s} _ {\mathcal {M}}, \boldsymbol {x} _ {\mathcal {M}}, c; \theta\right) = \Pi_ {i = 1 \& i \notin \mathcal {M}} ^ {N} P \left(\boldsymbol {s} _ {i} \mid \boldsymbol {s} _ {\mathcal {M}}, \boldsymbol {x} _ {\mathcal {M}}, c; \theta\right) \\ P \left(\boldsymbol {s} _ {i} \mid \boldsymbol {s} _ {\mathcal {M}}, \boldsymbol {x} _ {\mathcal {M}}, c; \theta\right) = \operatorname {S o f t m a x} \left(W _ {\mathcal {A}} \cdot \boldsymbol {h} _ {i} ^ {L _ {e}}\right) \\ P (\boldsymbol {x} \mid \boldsymbol {s} _ {\mathcal {M}}, \boldsymbol {x} _ {\mathcal {M}}, c; \theta) = \Pi_ {i = 1 \& i \notin \mathcal {M}} ^ {N} P (\boldsymbol {x} _ {i} \mid \boldsymbol {s} _ {\mathcal {M}}, \boldsymbol {x} _ {\mathcal {M}}, c; \theta) \\ \boldsymbol {x} _ {i} \mid \boldsymbol {s} _ {\mathcal {M}}, \boldsymbol {x} _ {\mathcal {M}} \sim \mathcal {N} \left(\boldsymbol {x} _ {i} ^ {L e}; \lambda I\right) \tag {1} \\ \end{array} +$$ + +where $W_{\mathcal{A}}$ is the embedding matrix for 20 common amino acids, $\pmb{h}_i^{L_e}$ is the output embedding for $i^{th}$ residue at the last layer of enzyme modeling module and $\pmb{x}_i^{L_e}$ is the corresponding output coordinate. $\mathcal{N}(\pmb{x}_i^{L_e};\lambda I)$ is the Gaussian distribution with mean $\pmb{x}_i^{L_e}$ and covariance matrix $\lambda I$ ( $I$ is the identity matrix). $\lambda$ is a hyperparameter. To find the optimal $\theta$ , we maximize the conditional log likelihood (i.e., + +minimizing the negative log likelihood): + +$$ +\begin{array}{l} \theta^ {*} = \underset {\theta} {\arg \min } \mathcal {L} (\theta) = \underset {\theta} {\arg \min } - \log P (s, \boldsymbol {x}, y | s _ {\mathcal {M}}, \boldsymbol {x} _ {\mathcal {M}}, c, \mathcal {V}; \theta) \\ = \underset {\theta} {\arg \min} \left\{- \sum_ {i = 1 \& i \notin \mathcal {M}} ^ {N} \log P (\pmb {s} _ {i} | \pmb {s} _ {\mathcal {M}}, \pmb {x} _ {\mathcal {M}}, c; \theta) \right. \\ - \sum_ {i = 1 \& i \notin \mathcal {M}} ^ {N} \log P (\boldsymbol {x} _ {i} | \boldsymbol {s} _ {\mathcal {M}}, \boldsymbol {x} _ {\mathcal {M}}, c; \theta) \\ \left. - \log P (y | \boldsymbol {s} _ {\mathcal {M}}, \boldsymbol {x} _ {\mathcal {M}}, c, \mathcal {V}; \theta) \right\} \tag {2} \\ \end{array} +$$ + +For simplicity, we omit the number of enzyme samples in the dataset. The second log likelihood function can be further simplified as: + +$$ +\log P \left(\boldsymbol {x} _ {i} \mid \boldsymbol {s} _ {\mathcal {M}}, \boldsymbol {x} _ {\mathcal {M}}, c; \theta\right) = - \frac {\lambda}{2} \left| \left| \boldsymbol {x} _ {i} - \boldsymbol {x} _ {i} ^ {L e} \right| \right| _ {2} ^ {2} + \text {c o n s t} \tag {3} +$$ + +Therefore, the overall training objective is: + +$$ +\begin{array}{l} \mathcal {L} (\theta) = - \sum_ {i = 1 \& i \notin \mathcal {M}} ^ {N} \log P (\boldsymbol {s} _ {i} | \boldsymbol {s} _ {\mathcal {M}}, \boldsymbol {x} _ {\mathcal {M}}, c; \theta) \\ + \frac {\lambda}{2} \sum_ {i = 1 \& i \notin \mathcal {M}} ^ {N} \| \boldsymbol {x} _ {i} - \boldsymbol {x} _ {i} ^ {L _ {e}} \| _ {2} ^ {2} - \log P (y | \boldsymbol {s} _ {\mathcal {M}}, \boldsymbol {x} _ {\mathcal {M}}, c, \mathcal {V}; \theta) \tag {4} \\ \end{array} +$$ + +# 3.2. NAEL Global Attention Sub-Layer + +This sub-layer computes global contextual embeddings for all enzyme residues, which does not consider the closeness of residues in 3D space. By allowing every residue to attend to all other residues across the whole sequence, we facilitate information flow through the entire enzyme sequence. + +We adopt the Transformer layer (Vaswani et al., 2017) to compute global contextual embeddings. Specifically, each transformer layer is composed of one multi-head self-attention sub-layer (MHA) and one fully connected feedforward network (FFN). A residue connection and a layer normalization are employed after each of the two sub-layers. The calculation of the global sequence attention can be formulated as follows: + +$$ +\boldsymbol {h} _ {i} ^ {l + 0. 5} = \text {L a y e r N o r m} \left(\operatorname {F F N} \left(\tilde {\boldsymbol {h}} _ {i} ^ {l + 0. 5}\right) + \tilde {\boldsymbol {h}} _ {i} ^ {l + 0. 5}\right), \tag {5} +$$ + +$$ +\tilde {\boldsymbol {h}} _ {i} ^ {l + 0. 5} = \text {L a y e r N o r m} \left(\mathrm {M H A} \left(\boldsymbol {h} _ {i} ^ {l}, \boldsymbol {H} _ {e} ^ {l}\right) + \boldsymbol {h} _ {i} ^ {l}\right) \tag {3} +$$ + +where $\pmb{h}_i^l$ is the $i^{th}$ residue input representation at $l^{\mathrm{th}}$ layer and $H_{e}^{l} = [h_{1}^{l}, h_{2}^{l}, \dots, h_{N}^{l}]^{T}$ . The input residue embeddings for the first layer are either taken from an embedding lookup table for functionally important sites, or initialized with a special [mask] token embedding for other residues. The residue embedding will then be enhanced by the enzyme family embedding $\operatorname{Emb}(c)$ corresponding to the desired enzyme family $c$ : + +$$ +\begin{array}{l} \boldsymbol {h} _ {i} ^ {0} = \hat {\boldsymbol {h}} _ {i} ^ {0} + \operatorname {E m b} (c) \\ \hat {\boldsymbol {h}} _ {i} ^ {0} = \left\{ \begin{array}{l l} W _ {\mathcal {A}} ^ {T} \boldsymbol {s} _ {i}, & i \in \mathcal {M}, \\ \operatorname {E m b} ([ \text {m a s k} ]), & \text {o t h e r w i s e} \end{array} \right. \tag {6} \\ \end{array} +$$ + +Similar to token-level language tags employed in multilingual models (Chi et al., 2020; Song et al., 2021), we also utilize the enzyme family tags at the residue level. + +# 3.3. NAEL Neighborhood Equivariant Sub-Layer + +Properly modeling the interactions of a given residue and its nearest neighboring residues in the 3D space can lead to improved residue representations. We intend to model such impact with a carefully designed subnetwork while keeping the equivariance under 3D translation and rotation. To this end, we propose the neighborhood equivariant sub-layer. This sub-layer includes three components: neighborhood message update, neighborhood coordinate update and neighborhood node feature update (Figure 1 (b)). Updating residue representations and coordinates in 3D space with only nearest neighbors enables more efficient and economic message passing compared to prior approaches which compute messages on the complete pairwise residue graph. + +Neighborhood message update. We first compute distances between residues using $C_{\alpha}$ coordinates, and select $K$ nearest residues (Figure 1 (b) green region). We compute the messages between $i^{th}$ residue and its $K$ -nearest neighbors (denoted as Neighbor(i)) as follows: + +$$ +\begin{array}{l} \boldsymbol {m} _ {i k} ^ {l + 0. 5} = \operatorname {S i L U} \left( \right.\operatorname {F F N} \left( \right.\left[ \right.\left( \right.\boldsymbol {h} _ {i} ^ {l + 0. 5}; \boldsymbol {h} _ {k} ^ {l + 0. 5}; \left\| \boldsymbol {x} _ {i} ^ {l} - \boldsymbol {x} _ {k} ^ {l} \right\| _ {2} \left. \right]\left. \right)\left. \right) \\ w _ {i k} ^ {l + 0. 5} = \frac {\exp \left(W _ {a} ^ {l} \boldsymbol {m} _ {i k} ^ {l + 0 . 5} + b _ {a} ^ {l}\right)}{\sum_ {k ^ {\prime} \in \text {N e i g h b o r (i)}} \exp \left(W _ {a} ^ {l} \boldsymbol {m} _ {i k ^ {\prime}} ^ {l + 0 . 5} + b _ {a} ^ {l}\right)} \tag {7} \\ \boldsymbol {m} _ {i k} ^ {l + 1} = w _ {i k} ^ {l + 0. 5} * \boldsymbol {m} _ {i k} ^ {l + 0. 5} \\ \end{array} +$$ + +where FFN is a two-layer fully connected feed-forward network with SiLU activation function after its first layer. $[\cdot ]$ is concatenation operator and $||\pmb {x}_i^l -\pmb {x}_k^l ||_2$ is the Euclidean distance between $i^{th}$ and $k^{th}$ residue coordinates at $l^{th}$ layer. $W_{*}$ and $b_{*}$ are trainable parameters. + +Neighborhood coordinate update. We update the $C_{\alpha}$ coordinate of $i^{th}$ residue as a $K$ -nearest neighbor vector field in a radial direction (Figure 1 (b) blue region). The $C_{\alpha}$ coordinate $\pmb{x}_i^l$ at $l^{th}$ layer of $i^{th}$ residue is updated with the weighted sum of all relative differences $(\pmb{x}_i^l -\pmb{x}_k^l)_{\forall k\in \mathrm{Neighbor}(\mathrm{i})}$ + +$$ +\boldsymbol {x} _ {i} ^ {l + 1} = \boldsymbol {x} _ {i} ^ {l} + \sum_ {k \in \operatorname {N e i g h b o r} (\mathrm {i})} \left(\boldsymbol {x} _ {i} ^ {l} - \boldsymbol {x} _ {k} ^ {l}\right) \cdot \operatorname {F F N} \left(\boldsymbol {m} _ {i k} ^ {l + 1}\right) \tag {8} +$$ + +The input residue $C_{\alpha}$ coordinates are either the given coordinates for functionally important sites, or randomly initialized as 3D points on the spherical surface centered at its left residue, considering the Euclidean distances between neighboring $C_{\alpha}$ pairs are almost the same (around $r = 3.75\AA$ ): + +$$ +\boldsymbol {x} _ {i} ^ {0} = \left\{ \begin{array}{c} \boldsymbol {x} _ {i}, i \in \mathcal {M}, \\ \boldsymbol {x} _ {i - 1} ^ {0} + r \cdot \left[ \sin \omega_ {1} \cos \omega_ {2}, \sin \omega_ {1} \sin \omega_ {2}, \cos \omega_ {1} \right] ^ {T}, i \notin \mathcal {M} \end{array} \right. \tag {9} +$$ + +![](images/985e59627fb39bb3740afbeeffa9549e69b365fe02a97b0a792d1c5e225e71b8.jpg) +Figure 2. Discovering functionally important sites. Each row is a protein sequence in a same enzyme family (BRENDA fourth-level enzyme classification tree category). We use ClustalW2 to perform multiple sequence alignment and select common residuals above the identity threshold $\tau$ . According to the aligned sequences, E, G and M are common in all the sequences therefore these are selected as important sites. In experiment, $\tau = 30\%$ . + +where $\omega_{1} \sim \mathrm{Uniform}(0, \pi)$ is the angle to Z-axis and $\omega_{2} \sim \mathrm{Uniform}(0, 2\pi)$ is the angle to X-axis in polar coordinate system. + +Neighborhood node feature update. We update the $i^{th}$ residue feature by gathering information from its $K$ -nearest neighbors using a gating mechanism (Figure 1 (b) red region): + +$$ +\boldsymbol {c} _ {i} ^ {l + 1} = \sum_ {k \in \text {N e i g h b o r (i)}} \boldsymbol {m} _ {i k} ^ {l + 1} \tag {10} +$$ + +$$ +\boldsymbol {h} _ {i} ^ {l + 1} = \boldsymbol {h} _ {i} ^ {l + 0. 5} + \sigma (\operatorname {F F N} (\boldsymbol {e} _ {i} ^ {l + 1})) \odot \boldsymbol {e} _ {i} ^ {l + 1} +$$ + +where FFN is a two-layer fully connected feed-forward network with ReLU activation function after its first layer. $\sigma$ denotes the sigmoid activation function. + +We stack $L_{e}$ layers of NAEL to model enzymes. The output embedding $\pmb{h}_{i}^{L_{e}}$ and coordinate $\pmb{x}_{i}^{L_{e}}$ for the $i^{th}$ residue are both from the last layer. Then the output probability of amino acid type for $i^{th}$ residue is calculated as: + +$$ +P \left(s _ {i} = a \mid \boldsymbol {s} _ {\mathcal {M}}, \boldsymbol {x} _ {\mathcal {M}}, c\right) = \frac {\exp \left(h _ {i , a} ^ {o}\right)}{\sum_ {a ^ {\prime} = 1} ^ {2 0} \exp \left(h _ {i , a ^ {\prime}} ^ {o}\right)}, \quad \boldsymbol {h} _ {i} ^ {o} = W _ {\mathcal {A}} \cdot \boldsymbol {h} _ {i} ^ {L _ {e}} \tag {11} +$$ + +# 3.4. Substrate Representation Module + +To facilitate effective and efficient message passing inside the substrate, we stack $L_{s}$ neighborhood equivariant layers to learn the substrate representations. With the substrate atom embedding $\pmb{h}_j^l$ and the corresponding coordinate $\pmb{x}_j^l$ at the $l^{th}$ layer, we perform the substrate message passing as follows: + +$$ +\boldsymbol {m} _ {j k} ^ {l + 1} = \phi_ {m} \left(\boldsymbol {h} _ {j} ^ {l}, \boldsymbol {h} _ {k} ^ {l}, \left\| \boldsymbol {x} _ {j} ^ {l} - \boldsymbol {x} _ {k} ^ {l} \right\| _ {2}\right) \tag {12} +$$ + +$$ +\boldsymbol {h} _ {j} ^ {l + 1} = \boldsymbol {h} _ {j} ^ {l} + \phi_ {n} \left(\boldsymbol {h} _ {j} ^ {l}, \sum_ {k \in \operatorname {N e i g h b o r} (j)} \boldsymbol {m} _ {j k} ^ {l + 1}\right) \tag {12} +$$ + +where $\phi_{m}$ and $\phi_{n}$ respectively denotes neighborhood message update and neighborhood node feature update. Following Guan et al. (2022), we initialize the node feature as + +
DatasetTrainingValidationTest
Third-Level Category2563030
Fourth-Level Category3157428323
Size9897415001500
Average Seq. Length327331328
+ +Table 1. EnzyBench statistics. The first two rows are third and fourth-level categories in BRENDA enzyme classification tree. Size indicates the number of protein entries in PDB under the categories. + +five chemical features $\hat{\pmb{h}}_j^0\in \mathbb{R}^5$ and $\pmb {h}_j^0 = W_s\cdot \hat{\pmb{h}}_j^0$ where $W_{s}\in \mathbb{R}^{d\times 5}$ is a mapping matrix and $d$ is the representation dimensionality. Since we have the real 3D structure of the substrate, we do not need to update its atom coordinates. + +Then based on the learned enzyme and substrate representations, we can predict whether the enzyme can bind with the given substrate as follows: + +$$ +P (y \mid s _ {\mathcal {M}}, x _ {\mathcal {M}}, c, \mathcal {V}; \theta) = \operatorname {S o f t m a x} \left(W _ {b} \cdot \left[ f \left(\boldsymbol {H} _ {e} ^ {L _ {e}}\right); f \left(\boldsymbol {H} _ {s} ^ {L _ {s}}\right) \right]\right) \tag {13} +$$ + +where $W_{b} \in \mathbb{R}^{2 \times 2d}$ is a mapping matrix and $f$ denotes sum pooling operation. $H_{e}^{L_{e}} = [h_{1}^{L_{e}}, \dots, h_{N}^{L_{e}}]^{T}$ and $H_{s}^{L_{s}} = [h_{1}^{L_{s}}, \dots, h_{m}^{L_{s}}]^{T}$ denote the output embeddings of enzyme and substrate at the last layer of enzyme modeling module and substrate representation module, respectively. + +# 3.5. Functionally Important Enzyme Site Discovery + +Functional sites are often evolutionarily conserved in a given enzyme family (Tristem, 2000; Bickel et al., 2002). Following previous methods (Armon et al., 2001; Panchenko et al., 2004; Chakrabarti & Lanczycki, 2007; Bray et al., 2009), we leverage multiple sequence alignment (MSA) to mine evolutionarily conserved patterns, which are known as functionally or structurally important sites. Designing enzymes conditioning on these conserved patterns can facilitate the generation of functional enzymes. We employ the ClustalW2 method (Anderson et al., 2011) to perform multiple sequence alignment for all proteins in each enzyme family corresponding to BRENDA fourth-level EC tree category. We select the residues that occur at the same site in more than $\tau$ sequences. These residues are designated as functionally important sites. In practice, we set $\tau$ to be $30\%$ . Figure 2 illustrate the procedure to select functionally important sites. + +# 4. Experiments + +# 4.1. EnzyBench Construction + +We aim to evaluate the effectiveness of our EnzyGen across a diverse range of enzymes. To achieve this, we gather all enzymes from BRENDA (Schomburg et al., 2002), yielding + +
Protein Family1.1.11.11.11.14.131.14.141.2.12.1.12.3.12.4.12.4.22.5.12.6.12.7.12.7.102.7.112.7.4
PROTSEED0.540.670.240.390.570.830.520.290.750.580.450.770.880.810.78
RFDiffusion+IF0.450.940.540.390.470.430.480.390.520.460.530.500.510.600.55
ESM2+EGNN0.580.900.350.350.630.790.530.320.800.590.510.760.880.880.77
EnzyGen0.640.980.380.420.720.800.610.380.860.660.530.760.920.930.80
Protein Family2.7.73.1.13.1.33.1.43.2.23.4.193.4.213.5.13.5.23.6.13.6.43.6.54.1.14.2.14.6.1Avg
PROTSEED0.690.700.900.840.480.290.690.310.100.500.570.370.840.830.420.59
RFDiffusion+IF0.530.330.610.620.490.620.450.470.440.550.630.590.590.840.450.53
ESM2+EGNN0.700.710.780.820.430.220.560.350.110.610.730.370.810.890.540.61
EnzyGen0.790.760.620.880.470.260.730.400.140.660.780.400.800.930.570.65
+ +Table 2. ESP scores (↑) of generated enzymes for 30 testing BRENDA EC categories. ESP evaluates the enzyme-substrate interaction function. Each number is the average ESP score of 50 testing cases for each category. IF denotes the inverse folding model ProteinMPNN. A ESP score of 0.6 or higher indicates a positive substrate binding. The last column (Avg) is the average across 30 categories. Notice that our EnzyGen outperforms all previous methods in ESP by a big margin. + +
Protein Family1.1.11.11.11.14.131.14.141.2.12.1.12.3.12.4.12.4.22.5.12.6.12.7.12.7.102.7.112.7.4
PROTSEED-6.61-3.93-4.27-10.22-6.71-8.84-9.58-7.43-10.01-7.44-5.46-8.07-9.68-10.24-11.68
RFDiffusion+IF-7.11-4.43-4.70-10.74-7.21-9.61-10.04-7.93-10.64-7.84-6.19-8.55-10.60-10.44-12.18
ESM2+EGNN-6.66-4.47-4.81-10.73-7.02-9.57-9.98-8.61-10.90-7.95-6.43-8.79-10.23-10.75-11.31
EnzyGen-8.44-4.58-5.10-10.34-6.95-10.05-9.89-9.65-11.91-9.98-8.05-10.50-11.65-12.51-11.24
Protein Family2.7.73.1.13.1.33.1.43.2.23.4.193.4.213.5.13.5.23.6.13.6.43.6.54.1.14.2.14.6.1Avg
PROTSEED-8.00-6.01-7.20-9.16-9.53-8.79-8.67-5.19-5.44-8.57-10.11-9.37-9.74-4.38-9.11-7.94
RFDiffusion+IF-8.50-6.51-7.70-11.65-10.08-9.29-9.03-5.54-5.94-9.07-11.12-9.87-11.24-4.88-9.68-8.57
ESM2+EGNN-8.47-5.81-7.20-11.45-10.14-8.91-9.25-5.59-5.42-8.23-10.69-11.15-11.34-5.01-9.76-8.52
EnzyGen-8.86-7.01-8.89-11.90-10.50-10.60-10.49-6.37-6.84-9.23-13.10-11.35-11.03-5.51-10.64-9.44
+ +Table 3. Enzyme-substrate binding affinity (↓) (kcal/mol) for 30 testing BRENDA EC categories, evaluated by a docking software Gnina. IF denotes the inverse folding model ProteinMPNN. The last column (Avg) is the average across 30 categories. Notice that our EnzyGen outperforms all previous methods in binding affinity by a big margin. + +
Protein Family1.1.11.11.11.14.131.14.141.2.12.1.12.3.12.4.12.4.22.5.12.6.12.7.12.7.102.7.112.7.4
PROTSEED77.1081.8071.1974.2478.6777.4074.5475.1877.1174.7975.5575.9081.0574.0576.50
RFDiffusion+IF82.4789.6381.1289.3282.0482.4985.1485.6181.1386.2581.6087.5186.7585.9188.30
ESM2+EGNN90.6793.1190.9390.3087.6779.4084.7884.8084.5690.2187.4783.5288.9285.5990.09
EnzyGen91.8694.4093.0292.7091.9983.4787.7192.8187.0289.6989.2085.1987.5587.6491.81
Protein Family2.7.73.1.13.1.33.1.43.2.23.4.193.4.213.5.13.5.23.6.13.6.43.6.54.1.14.2.14.6.1Avg
PROTSEED78.0076.2977.8975.7578.7673.5682.4076.7075.9075.1674.6283.4676.3678.8783.3177.07
RFDiffusion+IF81.2580.0181.5981.2292.0489.7277.2084.0585.4771.3582.8784.4981.3179.0276.1183.43
ESM2+EGNN81.8087.2787.0585.5072.2371.3182.6283.4888.6984.9673.3480.7787.7289.7085.4885.13
EnzyGen83.7589.7985.4089.6874.4477.1489.1186.7089.8085.9876.3184.3285.7191.8887.5587.45
+ +Table 4. pLDDT (↑) predicted by AlphaFold2. IF denotes the inverse folding model ProteinMPNN. The last column (Avg) is the average across 30 categories. Notice that our EnzyGen outperforms all previous methods in pLDDT. It shows EnzyGen's enzyme can fold more stably. + +a total of 101,974 PDB entries. These entries are classified into 3,157 fourth-level enzyme categories based on the EC Tree (Appendix Figure 5). It is noteworthy that there exist a total of 8,422 fourth-level categories; however, our focus lies specifically on those with experimentally confirmed structures. This focus results in our dataset comprising 3,157 fourth-level categories. We then conduct MSAs for each fourth-level category to identify functionally important sites, using an MSA threshold $(\tau)$ of $30\%$ . Given the relatively small size of fourth-level categories, we aggregate data belonging to the same third-level category in the EC Tree, resulting in 256 third-level categories. Then we select 30 third-level categories for validation and testing, respectively including 428 and 323 fourth-level categories. + +For each of the 30 third-level categories, we we randomly split 100 PDB entries with 50 for validation and 50 for testing, while the remaining entries are utilized for training. To prevent data leakage, we cluster the PDB entries with a sequence identity threshold of $50\%$ . We ensure that no PDB entries in the validation or test sets belong to the same cluster as those in the training set. We further collect 23,711 experimentally confirmed pairs from Kroll et al. (2023), ensuring enzymes without a corresponding substrate have a randomly sampled negative one during the training process. We also make sure that all entries in the test set have a corresponding substrate to ensure function evaluation. Detailed data statistics are provided in Table 1 and Appendix C. + +![](images/1971aff98fcda40778a9f18867700af1b730db6eb7577a7be148cd2284e17749.jpg) +(a) ESP score (↑) + +![](images/a2d905df13105557300f768283fcea5366b5b72328d8d14fccda1b551f5ad062.jpg) +(b) pLDDT (↑) +Figure 3. (a) Ablation study comparing EnzyGen against ESM2+EGNN on ESP score. (b) Ablation study comparing EnzyGen against ESM2+EGNN on AlphaFold2 pLDDT. (c) Ablation study comparing EnzyGen against the model removing enzyme-substrate interaction constraint (EnzyGen-w/o-sub). (d) Ablation study on different model scales. + +![](images/49bde87d5f3a92a5725f500d094f28ce372eb8da7cad5900fdbe253e9151ba38.jpg) +(c) Substrate binding affinity $(\downarrow)$ + +![](images/17949707061fa6032b99065f19545c0b8f4ac246d96bc73005bbd4e97bb0d4f8.jpg) +(d) ESP score $(\uparrow)$ + +# 4.2. Experimental Setup + +Implementation Details. We use 33 NAELs to model enzymes and 3 neighborhood equivariant layers for substrate representation module with node feature dimensionality set to 1280. As suggested by Ying et al. (2018), the number of graph layers typically ranges from 2 to 6. To prevent over-fitting and facilitate efficiency, we utilize 3 neighborhood equivariant sub-layers for enzyme modeling, comprising a modified NAEL with every 11 global attention sub-layers followed by one neighborhood equivariant sub-layer. The parameters of the global attention sub-layer are initialized with the released 650M ESM-2 (Lin et al., 2022b) parameters. The total parameter count is 714M. The hyperparameters $\lambda /2$ and $K$ are set to 1.0 and 30, respectively. The model undergoes training for 1,000,000 steps using 8 NVIDIA RTX A6000 GPU cards, among which only the sequence generation and position prediction losses are adopted for the first 200,000 steps. The batch size and learning rate are set to 8192 tokens and 3e-4 respectively. Sequences are decoded using the greedy decoding strategy. We incorporate four-level enzyme tags in the EC tree. For example, an enzyme in the category 1.1.1.1 should have four tags: 1, 1.1, 1.1.1, and 1.1.1.1. + +Baseline Models. We compare the proposed EnzyGen against the following representative baselines: (1) ESM2+EGNN employs ESM2 (Lin et al., 2022b) as the sequence encoder and EGNN (Satorras et al., 2021) as the backbone structure predictor. The node features in EGNN are initialized with the output from ESM2. Both ESM2 and EGNN share the same layer configurations as our EnzyGen. (2) PROTSEED (Shi et al., 2022) co-designs protein sequences and backbone structures based on secondary structure and binary contact maps. (3) RFDiffusion+ProteinMPNN first applies RFDiffusion (Watson et al., 2023) to design an enzyme structure based on the given functionally important sites and then uses ProteinMPNN (Dauparas et al., 2022) to design a sequence based on the generated structure. To ensure a fair and reliable comparison, we train ESM2+EGNN, PROTSEED and Pro + +teinMPNN on our EnzyBench using their official codes and implementations. Since RFDiffusion does not provide a training script, we encountered challenges in training their code and reproducing their results. Consequently, we directly apply their released model to design the structures. + +Function Evaluation. We evaluate the enzyme-substrate interaction function by the following metrics: (1) Following previous work (Li et al., 2013; Vidal-Limon et al., 2022), we use enzyme-substrate binding affinity, calculated by Gnina (McNutt et al., 2021) to quantify the strength of interactions between the designed enzymes and their substrates. A lower binding affinity indicates stronger binding. (2) We also use ESP score, developed by Kroll et al. (2023) to assess the ability of the designed enzymes to bind their corresponding substrates. In their paper, ESP model predicts enzyme-substrate interaction with $91\%$ accuracy across multiple benchmarks. The scale of ESP score is 0-1, and a higher ESP score indicates a stronger enzyme-substrate interaction. Additionally, to evaluate if the designed enzymes are well-folded, we compute (3) pLDDT using AlphaFold2. + +# 4.3. Main Results + +The ESP scores, substrate binding affinities, and pLDDT results are shown in Tables 2, 3 and 4. For clarity, we average the performance of fourth-level categories under the same third-level one, with detailed results for 323 families in Appendix D.1. The results for top-1, top-5 and top-10 candidate are also provided in Appendix D.2. + +EnzyGen excels in designing enzymes that bind their respective substrates with high affinities. Table 2 and 3 highlight the ability of EnzyGen in achieving the highest average ESP score and substrate binding affinity across 323 families. Notably, EnzyGen obtains an average ESP score of 0.65, surpassing the suggested enzyme-substrate interaction threshold of 0.6 from the ESP evaluator developer. In comparison, PROTSEED achieves 0.59, RFDiffusion+ProteinMPNN achieves 0.53, and ESM2+EGNN achieves 0.61 of average ESP score. EnzyGen's ESP score is significantly higher + +than all previous baselines. This is further verified by the binding affinity scores. The enzymes generated by our EnzyGen exhibit stronger binding affinity to their corresponding substrates than all other methods across all 30 third-level testing EC categories. EnzyGen gains an average improvement of $-0.87$ in binding affinity over the previous best method (RFDiffusion+ProteinMPNN), which is significant. These results demonstrate that enzymes designed by our EnzyGen are able to bind their corresponding substrates with high affinities. + +EnzyGen is able to design well-folded enzymes. According to the findings of Guo et al. (2022) and Binder et al. (2022), high pLDDT scores (e.g., $>80$ ) indicate high confidence of the residue structure. EnzyGen attains an average pLDDT score of 87.45 across 323 families. It outperforms all three baselines (PROTSEED, RFDiffusion+ProteinMPNN, ESM2+EGNN). This demonstrates the capability of our model to design enzymes with stable folding, validating the value of incorporating structural information into the enzyme design process. + +# 5. Analysis: Diving Deep into EnzyGen + +# 5.1. Ablation Study: Do Interleaving Network and Substrate Constraint Help? + +They both contribute to designed enzymes with better substrate binding. In comparison to directly concatenating ESM2 and EGNN, Figure 3 (a) illustrates that EnzyGen consistently enhances the average ESP score across 323 families when considering different candidate sets. In Figure 3 (b), EnzyGen achieves higher AlphaFold2 pLDDT than ESM2+EGNN across various candidate sets. These results affirm that the interleaving network within our proposed NAEL facilitates information exchange at different granularities, thereby aiding the design of well-folded enzymes with better substrate binding functions. We further study whether the proposed enzyme-substrate interaction constraint is useful. As shown in Figure 3 (c), incorporating the enzyme-substrate interaction constraint into the training process improves substrate binding affinities, boosting enzyme design with stronger substrate binding. + +# 5.2. Ablation Study: Does Model Scale Help? + +EnzyGen is scalable. To assess the scalability of our EnzyGen, we compare our EnzyGen (714M) with a randomly initialized 12-layer model (117M) trained on the same dataset. Figure 3 (d) presents the average ESP score across 323 categories for different candidate set. The results indicate that EnzyGen attains a higher enzyme-substrate interaction score as the model scales up, and this difference becomes more obvious when more candidates are considered. This confirms the scalability advantage of our EnzyGen. + +# 5.3. Does Further Finetuning Bring Additional Benefits? + +EnzyGen shows improvement with further finetuning. Drawing inspiration from the strategy of finetuning pretrained multilingual models for specific languages (Liu et al., 2020; Conneau et al., 2020), we conduct further finetuning on each third-level category. Each category undergoes an additional finetuning of 30 epochs, leading to EnzyGenfinetune. As presented in Table 5, 15 categories exhibit improvements on ESP scores after finetuning. Simultaneously, the performance of 8 categories shows degradation, and it is noted that all of them have training sizes smaller than 1000, except for 2.3.1. These findings demonstrate that EnzyGen can indeed benefit from the further finetuning technique, with larger training data sizes yielding more substantial improvements. + +# 5.4. Zero-shot Generalization Capability + +To assess the generalization capabilities of our EnzyGen, we respectively select two unseen substrates (magnesium(2+), zinc(2+)) and two unseen fourth-level categories (2.7.13.3, 6.3.2.4) from Swiss-Prot, which are not included in our EnzyBench benchmark. For these enzyme cases, we utilize their structures provided by the AlphaFold Database. The ESP scores of the top-32 candidates for each new fourth-level category or substrate are presented in Figure 4 (a). Remarkably, the average ESP score is 0.83 across two fourth-level categories and 0.89 across two substrates, with more than $85\%$ of the cases scoring over 0.6. These observations confirm that functionally important sites are crucial to design functional enzymes. Even not trained on these categories, our EnzyGen exhibits the capability to design enzymes with substrate binding ability. + +# 5.5. Does EnzyGen Learn the Family Relationship? + +Families with closer functions have closer embeddings. We cluster the 3,157 fourth-level family category embeddings in Figure 4 (b). It shows that enzyme families from the same superfamily are clustered together, displaying closer tag representations in the embedding space. This observation confirms that our family tag learns useful function information which can provide guidance for the design of desirable enzymes. + +# 5.6. Designing Novel Enzymes with EnzyGen + +EnzyGen is able to design novel enzymes that bind to specific substrates. Figure 4 (c) and (d) showcase two designed enzymes based on PDB 1KAG (catalyzing the specific phosphorylation of the 3-hydroxyl group of shikimic acid) and 5L2P (hydrolyzing various p-nitrophenyl phosphates, aromatic esters and p-nitrophenyl fatty acids) respectively. Both of the two designed enzymes achieve pLDDT + +![](images/ee787dc6642540067a4eaa2b773e9dfd75f9f3a4ae88d6ffb316e499e8f095fa.jpg) +(a) Zero-shot generalization + +![](images/211b95274dbc915ea9529356ad289698665ca4ad62492044077839645e2207d1.jpg) +Figure 4. (a) ESP scores of designed enzymes from new fourth-level classes or with new substrates. Dash line denotes median. (b) Fourth-level category embedding clustering. Case Study: (c) Complex of designed 1KAG (2.7.1.71, catalyzing the specific phosphorylation of the 3-hydroxyl group of shikimic acid) and substrate ATP(-4), with pLDDT=90.39, Uniprot blastp recovery rate = 58.5%, (d) Complex of designed 5L2P (3.1.1.2, hydrolyzing various p-nitrophenyl phosphates, aromatic esters and p-nitrophenyl fatty acids) and substrate paraoxon, with pLDDT=89.44, Uniprot blastp recovery rate = 49.4%. Both cases show polar contacts (hydrogen bonds) depicted in purple. + +![](images/6981f9ba488803a81a55f29b2dfdc971b8ddcf88ed359e17d747cf0043b7766e.jpg) +(b) Fourth-level category clustering (c) Complex of 1KAG-ATP(-4) + +![](images/19d06efea2625347688d43523b3b3f7acbf3517faa9da8aeb5e46cb7ec43a4f2.jpg) +(d) Complex of 5L2P-paraoxon + +
Protein Family1.1.11.11.11.14.131.14.141.2.12.1.12.3.12.4.12.4.22.5.12.6.12.7.12.7.102.7.112.7.4
EnzyGen-finetune0.680.950.380.370.680.820.570.380.860.690.540.800.930.940.82
EnzyGen0.640.980.380.420.720.800.610.380.860.660.530.760.920.930.80
Protein Family2.7.73.1.13.1.33.1.43.2.23.4.193.4.213.5.13.5.23.6.13.6.43.6.54.1.14.2.14.6.1Avg
EnzyGen-finetune0.790.770.860.880.480.240.630.400.200.680.790.370.890.930.560.66
EnzyGen0.790.760.620.880.470.260.730.400.140.660.780.400.800.930.570.65
+ +Table 5. ESP score (↑) of EnzyGen and EnzyGen-finetune. Avg denotes average. Finetuning leads to improvement in ESP scores. + +approaching or exceeding 90 and substrate binding affinities below -10. Additionally, the Gnina docked complexes show polar contacts (hydrogen bonds) between the enzymes and substrates. This affirms the enzyme-substrate interaction function. We carry out blastp search of designed enzymes in Uniprot, yielding an amino acid identity of $58.5\%$ and $49.4\%$ , respectively, to the most similar enzyme. Together, these results show that our model is capable of designing novel enzymes with high substrate binding affinities. Additional cases are detailed in Appendix D.3, each exhibiting a pLDDT higher than 80, a binding affinity below -10, and a Uniprot blastp identity rate lower than $65\%$ . Enzyme sequences for all analyzed cases are also available in Appendix Table 19. + +# 6. Discussion + +Enzymes, as genetically encoded biocatalysts, play a crucial role in accelerating chemical reactions and find extensive applications across various fields. Designing enzymes that can specifically bind to target substrates has always been a complex challenge. Our EnzyGen demonstrates a remarkable ability to design well-folded and effective enzymes that bind to specific substrates across diverse enzyme categories. Despite its impressive performance, certain limitations remain, which we will address in this section. + +First, we collected enzyme data from the PDB, covering 3,157 fourth-level enzyme classes. Although there are 8,422 fourth-level classes in total, our dataset includes only + +a subset of these categories. Future work could focus on expanding this dataset by incorporating data from larger databases, such as Swiss-Prot and the AlphaFold structure database, to encompass a broader range of enzyme classes. + +Second, we address the substrate-binding constraint using an enzyme-substrate binding prediction loss. While this provides a basic constraint, it is relatively weak concerning the enzyme's catalytic functions. Future research could focus on designing enzymes that bind to a specific 3D substrate structure, potentially leading to the formation of a more effective enzyme-substrate complex. + +# 7. Conclusion + +This paper introduces EnzyGen, a unified generative model for designing functional enzymes across diverse families. EnzyGen simultaneously generates enzyme sequence and backbone structure guided by automatically identified functionally important sites and a given substrate. We employ a set of three losses to train EnzyGen. To comprehensively evaluate EnzyGen, we construct EnzyBench, a benchmark for enzyme design, including all available enzymes within PDB across 3157 enzyme families. Experimental results demonstrate EnzyGen's capability to design well-folded enzymes with strong enzyme-substrate interaction functions. + +# Acknowledgements + +This research is supported by the National Institutes of Health (R35GM147387 to Y.Y.), a seed grant from the NSF Molecule Maker Lab Institute (grant #2019897), the UC Santa Barbara Faculty Research Grant (to L.L.), and the generous support by Pittsburgh Supercomputing Center Neo-cortex grant. The authors thank the anonymous reviewers and Siqi Ouyang, Yuwei Yang, Yufei Song, Jielin Qiu, and Yujia Gao for their valuable comments. + +# Impact Statement + +This paper contributes to the effective and efficient design of functional enzymes, thereby advancing the fields of functional protein design and AI for molecule design. There are many potential societal consequences of our work, none of which we feel must be specifically highlighted here. + +# References + +Anderson, C. L., Strope, C. L., and Moriyama, E. N. Sitte-ema: visual tools for multiple sequence alignment comparison and molecular sequence simulation. BMC bioinformatics, 12(1):1-14, 2011. +Anishchenko, I., Pellock, S. J., Chidyausiku, T. M., Ramelot, T. A., Ovchinnikov, S., Hao, J., Bafna, K., Norn, C., Kang, A., Bera, A. K., et al. De novo protein design by deep network hallucination. Nature, 600(7889):547-552, 2021. +Armon, A., Graur, D., and Ben-Tal, N. Consurf: an algorithmic tool for the identification of functional regions in proteins by surface mapping of phylogenetic information. Journal of molecular biology, 307(1):447-463, 2001. +Ashburner, M., Ball, C. A., Blake, J. A., Botstein, D., Butler, H., Cherry, J. M., Davis, A. P., Dolinski, K., Dwight, S. S., Eppig, J. T., et al. Gene ontology: tool for the unification of biology. Nature genetics, 25(1):25-29, 2000. +Bar-Even, A., Noor, E., Savir, Y., Liebermeister, W., Davidi, D., Tawfik, D. S., and Milo, R. The moderately efficient enzyme: evolutionary and physicochemical trends shaping enzyme parameters. Biochemistry, 50(21):4402-4410, 2011. +Bickel, P. J., Kechris, K. J., Spector, P. C., Wedemayer, G. J., and Glazer, A. N. Finding important sites in protein sequences. Proceedings of the National Academy of Sciences, 99(23):14764-14771, 2002. +Binder, J. L., Berendzen, J., Stevens, A. O., He, Y., Wang, J., Dokholyan, N. V., and Oprea, T. I. Alphafold illuminates half of the dark human proteins. Current Opinion in Structural Biology, 74:102372, 2022. + +Binz, H. K., Amstutz, P., and Plückthun, A. Engineering novel binding proteins from nonimmunoglobulin domains. Nature biotechnology, 23(10):1257-1268, 2005. +Bray, T., Chan, P., Bougouffa, S., Greaves, R., Doig, A. J., and Warwicker, J. Sitesidentify: a protein functional site prediction tool. BMC bioinformatics, 10(1):1-12, 2009. +Brookes, D., Park, H., and Listgarten, J. Conditioning by adaptive sampling for robust design. In International conference on machine learning, pp. 773-782. PMLR, 2019. +Brookes, D. H. and Listgarten, J. Design by adaptive sampling. arXiv preprint arXiv:1810.03714, 2018. +Carbonell, P., Wong, J., Swainston, N., Takano, E., Turner, N. J., Scrutton, N. S., Kell, D. B., Breitling, R., and Faulon, J.-L. Selenzyme: enzyme selection tool for pathway design. Bioinformatics, 34(12):2153-2154, 2018. +Chakrabarti, S. and Lanczycki, C. J. Analysis and prediction of functionally important sites in proteins. Protein Science, 16(1):4-13, 2007. +Chi, Z., Dong, L., Wei, F., Wang, W., Mao, X.-L., and Huang, H. Cross-lingual natural language generation via pre-training. In Proceedings of the AAAI conference on artificial intelligence, volume 34, pp. 7570-7577, 2020. +Conneau, A., Khandelwal, K., Goyal, N., Chaudhary, V., Wenzek, G., Guzmán, F., Grave, E., Ott, M., Zettlemoyer, L., and Stoyanov, V. Unsupervised cross-lingual representation learning at scale. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics. Association for Computational Linguistics, 2020. +Das, P., Sercu, T., Wadhawan, K., Padhi, I., Gehrmann, S., Cipcigan, F., Chenthamarakshan, V., Strobelt, H., Dos Santos, C., Chen, P.-Y., et al. Accelerated antimicrobial discovery via deep generative models and molecular dynamics simulations. Nature Biomedical Engineering, 5(6):613-623, 2021. +Dauparas, J., Anishchenko, I., Bennett, N., Bai, H., Ragotte, R. J., Milles, L. F., Wicky, B. I., Courbet, A., de Haas, R. J., Bethel, N., et al. Robust deep learning-based protein sequence design using proteinmpnn. Science, 378 (6615):49-56, 2022. +Detlefsen, N. S., Hauberg, S., and Boomsma, W. Learning meaningful representations of protein sequences. Nature communications, 13(1):1914, 2022. +Ferruz, N., Schmidt, S., and Höcker, B. Protagt2 is a deep unsupervised language model for protein design. Nature communications, 13(1):4348, 2022. + +Fetrow, J. S. and Skolnick, J. Method for prediction of protein function from sequence using the sequence-to-structure-to-function paradigm with application to glutaredoxins/thioredoxins and t1ribonucleases. Journal of molecular biology, 281(5):949-968, 1998. +Fetrow, J. S., Siew, N., Di Gennaro, J. A., Martinez-Yamout, M., Dyson, H. J., and Skolnick, J. Genomic-scale comparison of sequence-and structure-based methods of function prediction: Does structure provide additional insight? Protein science, 10(5):1005-1014, 2001. +Fischman, S. and Ofran, Y. Computational design of antibodies. Current opinion in structural biology, 51:156-162, 2018. +Giessel, A., Dousis, A., Ravichandran, K., Smith, K., Sur, S., McFadyen, I., Zheng, W., and Licht, S. Therapeutic enzyme engineering using a generative neural network. Scientific Reports, 12(1):1536, 2022. +Guan, J., Qian, W. W., Peng, X., Su, Y., Peng, J., and Ma, J. 3d equivariant diffusion for target-aware molecule generation and affinity prediction. In The Eleventh International Conference on Learning Representations, 2022. +Guo, H.-B., Perminov, A., Bekele, S., Kedziora, G., Farajollahi, S., Varaljay, V., Hinkle, K., Molinero, V., Meister, K., Hung, C., et al. Alphafold2 models indicate that protein sequence determines both structure and dynamics. Scientific Reports, 12(1):10696, 2022. +Hoffman, S. C., Chenthamarakshan, V., Wadhawan, K., Chen, P.-Y., and Das, P. Optimizing molecules using efficient queries from property evaluations. Nature Machine Intelligence, 4(1):21-31, 2022. +Hosseini, S. and Ilie, L. Pithia: Protein interaction site prediction using multiple sequence alignments and attention. International Journal of Molecular Sciences, 23 (21):12814, 2022. +Hsu, C., Verkuil, R., Liu, J., Lin, Z., Hie, B., Sercu, T., Lerer, A., and Rives, A. Learning inverse folding from millions of predicted structures. In International Conference on Machine Learning, pp. 8946-8970. PMLR, 2022. +Huang, P.-S., Boyken, S. E., and Baker, D. The coming of age of de novo protein design. Nature, 537(7620): 320-327, 2016. +Hulo, N., Bairoch, A., Bulliard, V., Cerutti, L., De Castro, E., Langendijk-Genevaux, P. S., Pagni, M., and Sigrist, C. J. The prosite database. *Nucleic acids research*, 34 (suppl_1):D227–D230, 2006. +Hunter, S., Apweiler, R., Attwood, T. K., Bairoch, A., Bateman, A., Binns, D., Bork, P., Das, U., Daugherty, L., + +Duquenne, L., et al. Interpro: the integrative protein signature database. *Nucleic acids research*, 37(suppl_1): D211–D215, 2009. +Ingraham, J., Garg, V., Barzilay, R., and Jaakkola, T. Generative models for graph-based protein design. Advances in neural information processing systems, 32, 2019. +Ivanisenko, V. A., Pintus, S. S., Grigorovich, D. A., and Kolchanov, N. A. Pdbsite: a database of the 3d structure of protein functional sites. *Nucleic Acids Research*, 33 (suppl_1):D183–D187, 2005. +Jain, M., Bengio, E., Hernandez-Garcia, A., Rector-Brooks, J., Dossou, B. F., Ekbote, C. A., Fu, J., Zhang, T., Kilgour, M., Zhang, D., et al. Biological sequence design with gflownets. In International Conference on Machine Learning, pp. 9786-9801. PMLR, 2022. +Johnson, M., Schuster, M., Le, Q. V., Krikun, M., Wu, Y., Chen, Z., Thorat, N., Viégas, F., Wattenberg, M., Corrado, G., et al. Google's multilingual neural machine translation system: Enabling zero-shot translation. Transactions of the Association for Computational Linguistics, 5:339-351, 2017. +Jumper, J., Evans, R., Pritzel, A., Green, T., Figurnov, M., Ronneberger, O., Tunyasuvunakool, K., Bates, R., Židek, A., Potapenko, A., et al. Highly accurate protein structure prediction with alphafold. Nature, 596(7873):583-589, 2021. +Kroll, A., Ranjan, S., Engqvist, M. K., and Lercher, M. J. A general model to predict small molecule substrates of enzymes based on machine and deep learning. Nature Communications, 14(1):2787, 2023. +Kumar, A. and Levine, S. Model inversion networks for model-based optimization. Advances in Neural Information Processing Systems, 33:5126-5137, 2020. +Li, D., Lyons, J. A., Pye, V. E., Vogeley, L., Aragão, D., Kenyon, C. P., Shah, S. T., Doherty, C., Aherne, M., and Caffrey, M. Crystal structure of the integral membrane diacylglycerol kinase. Nature, 497(7450):521-524, 2013. +Liao, J. C., Mi, L., Pontrelli, S., and Luo, S. Fuelling the future: microbial engineering for the production of sustainable biofuels. Nature Reviews Microbiology, 14 (5):288-304, 2016. +Lin, E., Lin, C.-H., and Lane, H.-Y. De novo peptide and protein design using generative adversarial networks: an update. Journal of Chemical Information and Modeling, 62(4):761-774, 2022a. +Lin, Z., Akin, H., Rao, R., Hie, B., Zhu, Z., Lu, W., Smetanin, N., dos Santos Costa, A., Fazel-Zarandi, M., + +Sercu, T., Candido, S., et al. Language models of protein sequences at the scale of evolution enable accurate structure prediction. *bioRxiv*, 2022b. +Liu, Y., Gu, J., Goyal, N., Li, X., Edunov, S., Ghazvininejad, M., Lewis, M., and Zettlemoyer, L. Multilingual denoising pre-training for neural machine translation. Transactions of the Association for Computational Linguistics, 8: 726-742, 2020. +Madani, A., Krause, B., Greene, E. R., Subramanian, S., Mohr, B. P., Holton, J. M., Olmos Jr, J. L., Xiong, C., Sun, Z. Z., Socher, R., et al. Large language models generate functional protein sequences across diverse families. Nature Biotechnology, pp. 1-8, 2023. +McNutt, A. T., Francoeur, P., Aggarwal, R., Masuda, T., Meli, R., Ragoza, M., Sunseri, J., and Koes, D. R. Gnina 1.0: molecular docking with deep learning. Journal of cheminformatics, 13(1):1-20, 2021. +Melnyk, I., Das, P., Chenthamarakshan, V., and Lozano, A. Benchmarking deep generative models for diverse antibody sequence design. arXiv preprint arXiv:2111.06801, 2021. +Panchenko, A. R., Kondrashov, F., and Bryant, S. Prediction of functional sites by analysis of sequence and structure conservation. Protein science, 13(4):884-892, 2004. +Pearce, R. and Zhang, Y. Deep learning techniques have significantly impacted protein structure prediction and protein design. Current opinion in structural biology, 68: 194-207, 2021. +Ren, Z., Li, J., Ding, F., Zhou, Y., Ma, J., and Peng, J. Proximal exploration for model-guided protein sequence design. *bioRxiv*, 2022. +Rives, A., Meier, J., Sercu, T., Goyal, S., Lin, Z., Liu, J., Guo, D., Ott, M., Zitnick, C. L., Ma, J., et al. Biological structure and function emerge from scaling unsupervised learning to 250 million protein sequences. Proceedings of the National Academy of Sciences, 118(15):e2016239118, 2021. +Satorras, V. G., Hoogeboom, E., and Welling, M. E (n) equivariant graph neural networks. In International conference on machine learning, pp. 9323-9332. PMLR, 2021. +Schomburg, I., Chang, A., and Schomburg, D. Brenda, enzyme data and metabolic information. *Nucleic acids research*, 30(1):47-49, 2002. +Schomburg, I., Chang, A., Ebeling, C., Gremse, M., Heldt, C., Huhn, G., and Schomburg, D. Brenda, the enzyme database: updates and major new developments. *Nucleic acids research*, 32(suppl_1):D431-D433, 2004. + +Shi, C., Wang, C., Lu, J., Zhong, B., and Tang, J. Protein sequence and structure co-design with equivariant translation. In The Eleventh International Conference on Learning Representations, 2022. +Song, Z. and Li, L. Importance weighted expectation-maximization for protein sequence design. In International Conference on Machine Learning, pp. 32349-32364. PMLR, 2023. +Song, Z., Zhou, H., Qian, L., Xu, J., Cheng, S., Wang, M., and Li, L. switch-glat: Multilingual parallel machine translation via code-switch decoder. In International Conference on Learning Representations, 2021. +Song, Z., Zhao, Y., Shi, W., Yang, Y., and Li, L. Functional geometry guided protein sequence and backbone structure co-design. arXiv preprint arXiv:2310.04343, 2023. +Strokach, A., Becerra, D., Corbi-Verge, C., Perez-Riba, A., and Kim, P. M. Fast and flexible protein design using deep graph neural networks. Cell systems, 11(4):402-411, 2020. +Sumida, K. H., Núñez Franco, R., Kalvet, I., Pellock, S. J., Wicky, B. I., Milles, L. F., Dauparas, J., Wang, J., Kipnis, Y., Jameson, N., et al. Improving protein expression, stability, and function with proteinmpnn. bioRxiv, pp. 2023-10, 2023. +Trippe, B. L., Yim, J., Tischer, D., Baker, D., Broderick, T., Barzilay, R., and Jaakkola, T. S. Diffusion probabilistic modeling of protein backbones in 3d for the motif-scaffolding problem. In The Eleventh International Conference on Learning Representations, 2022. +Tristem, M. Molecular evolution—a phylogenetic approach. Heredity, 84(1):131-131, 2000. +Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I. Attention is all you need. Advances in neural information processing systems, 30, 2017. +Vidal-Limon, A., Aguilar-Toala, J. E., and Liceaga, A. M. Integration of molecular docking analysis and molecular dynamics simulations for studying food proteins and bioactive peptides. Journal of Agricultural and Food Chemistry, 70(4):934-943, 2022. +Wang, J., Cao, H., Zhang, J. Z., and Qi, Y. Computational protein design with deep learning neural networks. Scientific reports, 8(1):1-9, 2018. +Wang, J., Lisanza, S., Juergens, D., Tischer, D., Watson, J. L., Castro, K. M., Ragotte, R., Saragovi, A., Milles, L. F., Baek, M., et al. Scaffolding protein functional sites using deep learning. Science, 377(6604):387-394, 2022. + +Wang, Y., Tang, H., Huang, L., Pan, L., Yang, L., Yang, H., Mu, F., and Yang, M. Self-play reinforcement learning guides protein engineering. Nature Machine Intelligence, 5(8):845-860, 2023. +Watson, J. L., Juergens, D., Bennett, N. R., Trippe, B. L., Yim, J., Eisenach, H. E., Ahern, W., Borst, A. J., Ragotte, R. J., Milles, L. F., et al. De novo design of protein structure and function with rfdiffusion. Nature, pp. 1-3, 2023. +Wu, M.-C., Law, B., Wilkinson, B., and Micklefield, J. Bioengineering natural product biosynthetic pathways for therapeutic applications. Current opinion in biotechnology, 23(6):931-940, 2012. +Yeh, A. H.-W., Norn, C., Kipnis, Y., Tischer, D., Pellock, S. J., Evans, D., Ma, P., Lee, G. R., Zhang, J. Z., Anishchenko, I., et al. De novo design of luciferases using deep learning. Nature, 614(7949):774-780, 2023. +Ying, Z., You, J., Morris, C., Ren, X., Hamilton, W., and Leskovec, J. Hierarchical graph representation learning with differentiable pooling. Advances in neural information processing systems, 31, 2018. +Zheng, Z., Deng, Y., Xue, D., Zhou, Y., Ye, F., and Gu, Q. Structure-informed language models are protein designers. In International conference on machine learning, 2023. + +# Appendix + +# A. Proof: SE(3) Equivariance + +# A.1. Proof: NAEL Is SE(3) Equivariant + +In this section we prove that our proposed NAEL is translation equivariant on $\pmb{x}$ for any translation vector $\pmb{t} \in \mathbb{R}^3$ and rotation equivariant for any $R$ from SO(3) group. More formally, we will prove the NAEL satisfies: + +$$ +\boldsymbol {H} ^ {l + 1}, R \boldsymbol {x} ^ {l + 1} + \boldsymbol {t} = \operatorname {N A E L} \left(\boldsymbol {H} ^ {l}, R \boldsymbol {x} ^ {l} + \boldsymbol {t}\right) \tag {14} +$$ + +When $l = 0$ : + +For message update, the distance between two residues is invariant as $d_{ij}^{l} = ||Rx_{i}^{l} + t - (Rx_{j}^{l} + t)||^{2} = (x_{i}^{l} - x_{j}^{l})^{T}R^{T}R(x_{i}^{l} - x_{j}^{l}) = ||x_{i}^{l} - x_{j}^{l}||^{2}$ . $h_{i}^{l}$ is the embedding of residue or [mask] token, and thus it is always invariant. Therefore, $h_{i}^{l + 0.5}$ is also invariant. Since $h_{i}^{l + 0.5}, h_{j}^{l + 0.5}$ and $d_{ij}^{l}$ are all invariant, and thus $m_{ij}^{l + 1}$ is also invariant to translation $t$ and rotation $R$ on $x$ . + +For coordinate update, updated $\pmb{x}^{l + 1}$ is equivariant to the translation $\pmb{t}$ and rotation $R$ on input $\pmb{x}^l$ : + +$$ +\begin{array}{l} (R \boldsymbol {x} _ {i} ^ {l} + \boldsymbol {t}) + \sum_ {j \in \text {N e i g h b o r (i)}} \left(R \boldsymbol {x} _ {i} ^ {l} + \boldsymbol {t} - \left(R \boldsymbol {x} _ {j} ^ {l} + \boldsymbol {t}\right)\right) \cdot \operatorname {F F N} \left(\boldsymbol {m} _ {i j} ^ {l + 1}\right) \\ = R \left(\boldsymbol {x} _ {i} ^ {l} + \sum_ {j \in \text {N e i g h b o r (i)}} \left(\boldsymbol {x} _ {i} ^ {l} - \boldsymbol {x} _ {j} ^ {l}\right) \cdot \operatorname {F F N} \left(\boldsymbol {m} _ {i j} ^ {l + 1}\right)\right) + \boldsymbol {t} \\ = R \boldsymbol {x} _ {i} ^ {l + 1} + \boldsymbol {t} \tag {15} \\ \end{array} +$$ + +For residue update, $m_{ij}^{l + 1}$ and $h_i^{l + 0.5}$ is invariant to translation $t$ and rotation $R$ on $x$ , so $h_i^{l + 1}$ is also invariant to translation $t$ and rotation $R$ on $x$ . + +When $l > = 1$ : + +We have proved that when $l = 0$ , $h_i^1$ is invariant to rotation and translation on $x$ . Taking $H^1$ as the second layer input and following the above process, we can prove $h_i^2$ is also invariant. Repeating this process from $l = 1$ to $L - 1$ , we can get the same conclusion. + +Combining the above two scenarios together, we have $\pmb{H}^{l + 1},R\pmb{x}^{l + 1} + \pmb {t} = \mathrm{NAEL}(\pmb{H}^l,R\pmb{x}^l +\pmb {t})$ for $l = 0$ to $L - 1$ Therefore, our proposed NAEL is $SE(3)$ -equivariant. + +# A.2. Proof: EnzyGen Is SE(3) Equivariant + +We provide the proof of corollary 3.2 as follows: + +Proof. + +$$ +\begin{array}{l} \operatorname {E n z y G e n} \left(\boldsymbol {H} ^ {0}, R \boldsymbol {x} ^ {0} + \boldsymbol {t}\right) \\ = \mathrm {N A E L} ^ {L - 1} \circ \mathrm {N A E L} ^ {L - 2} \circ \dots \circ \mathrm {N A E L} ^ {0} \left(\boldsymbol {H} ^ {0}, R \boldsymbol {x} ^ {0} + \boldsymbol {t}\right)) \\ = \mathrm {N A E L} ^ {L - 1} \circ \mathrm {N A E L} ^ {L - 2} \circ \dots \circ \mathrm {N A E L} ^ {1} \left(\boldsymbol {H} ^ {1}, R \boldsymbol {x} ^ {1} + \boldsymbol {t}\right)) \\ = \dots \\ = \operatorname {N A E L} ^ {L - 1} \left(\boldsymbol {H} ^ {L - 1}, R \boldsymbol {x} ^ {L - 1} + \boldsymbol {t}\right)) = \boldsymbol {H} ^ {L}, R \boldsymbol {x} ^ {L} + \boldsymbol {t} \tag {16} \\ \end{array} +$$ + +# B. Enzyme Classification Tree + +We provide an illustration of enzyme classification (EC) tree in figure 5. These categories are applied by our EnzyGen to guide the enzyme design with specific functions. + +# C. Data Statistics + +We provide the third-level category information in the validation and test sets in Table 6. + +# D. Additional Experimental Results + +# D.1. EnzyGen Performance on 323 Testing Fourth-Level Categories + +The ESP scores, substrate binding affinities and AlphaFold2 pLDDT results for the 323 testing fourth-level categories are respectively provided in Table 7, 9 and 11. + +# D.2. Performance on Different Candidate Set + +# D.2.1. TOP-1 CANDIDATE RESULTS + +ESP scores of top-1 candidate and their corresponding substrate binding affinities as well as pLDDT are respectively reported in Table 8, 10 and 12. The tables show that our EnzyGen achieves the best average scores across different categories on all metrics. Notably, the ESP scores of different models consistently surpass those of the top-5 candidate. This observation is reasonable, as candidates with higher probabilities are more likely to achieve higher function scores. + +# D.2.2. TOP-5 CANDIDATE RESULTS + +ESP scores of top-5 candidate and their corresponding substrate binding affinities as well as pLDDT are respectively reported in Table 13, 14 and 15. The tables show that our EnzyGen achieves the best average scores across different categories on all metrics. + +
Third-Level CategoryFunction
1.1.1With NAD+ or NADP+ as acceptor
1.11.1Peroxidases
1.14.13With NADH or NADPH as one donor, and incorporation of one atom of oxygen into the other donor
1.14.14With reduced flavin or flavoprotein as one donor and incorporation of one atom of oxygen into the other donor
1.2.1With NAD+ or NADP+ as acceptor
2.1.1Methyltransferases
2.3.1Transferring groups other than aminoacyl groups
2.4.1Hexosyltransferases
2.4.2Pentosyltransferases
2.5.1Transferring alkyl or aryl groups, other than methyl groups (only sub-subclass identified to date)
2.6.1Transaminases
2.7.1Phosphotransferases with an alcohol group as acceptor
2.7.10Protein-tyrosine kinases
2.7.11Protein-serine/threonine kinases
2.7.4Phosphotransferases with a phosphate group as acceptor
2.7.7Nucleotidyltransferases
3.1.1Carboxylic-ester hydrolases
3.1.3Phosphoric-monoester hydrolases
3.1.4Phosphoric-diester hydrolases
3.2.2Hydrolysing N-glycosyl compounds
3.4.19Omega peptidases
3.4.21Serine endopeptidases
3.5.1In linear amides
3.5.2In cyclic amides
3.6.1In phosphorus-containing anhydrides
3.6.4Acting on acid anhydrides to facilitate cellular and subcellular movement
3.6.5Acting on GTP to facilitate cellular and subcellular movement
4.1.1Carboxy-lyases
4.2.1Hydro-lyases
4.6.1Phosphorus-oxygen lyases (only sub-subclass identified to date)
+ +Table 6. Third-level category information for validation and test sets. + +# D.2.3. TOP-10 CANDIDATE RESULTS + +ESP scores of top-10 candidate and their corresponding substrate binding affinities as well as pLDDT are respectively reported in Table 16, 17 and 18. Again, our model achieves the best average performance in all cases. It is worth noting that our EnzyGen achieves an average enzyme-substrate ESP score of 0.93, an average substrate binding affinity of -10.12 and an average pLDDT of 90.52, demonstrating EnzyGen's ability to design both well-folded and functional enzymes. + +# D.3. More Novel Cases + +We provide more designed enzymes in Figure 6. All these cases achieve a pLDDT higher than 80, a blastp amino acid identity rate lower than $65\%$ in Uniprot, and a substrate binding affinity lower than -10. After Gnina docking, the corresponding substrates demonstrate polar contacts (hydrogen bonds) with the enzymes (shown in purple), affirming the enzyme-substrate interaction functions. We also provide the enzyme sequences of all the analyzed cases in Table 19. + +![](images/53b0e537d84c8a165ea8db0336010207d4f033597ac4e3411a99f64e42f968c7.jpg) +Figure 5. Enzyme Classification (EC) Tree in BRENDA. + +![](images/55b326f7a538c8bf0ae27fcf8b08e4e22fd5398fd8d14c4080d99bfab2d1e30d.jpg) +(a) Complex of designed 1L1E and S-adenosyl-L-methionine zwitterion. pLDDT=86.86, binding affinity=-11.02, Uniprot blastp recovery rate=56.5% + +![](images/e2c55be6f6e92fad989aa1159c86be6cfa4e5b3ce1675da2ab509dc789b7e6ae.jpg) +(b) Complex of designed 8DSO and ATP. pLDDT=80.95, binding affinity=-11.19, Uniprot blastp recovery rate=58.1% + +![](images/f072b7bec928a653ed4924bf26e5282060ee229a3aec108e31f96217a802d881.jpg) +(c) Complex of designed 5TMP and ATP(4-. pLDDT=85.34, binding affinity=-11.76, Uniprot blastp recovery rate=59.8% + +![](images/a2d5d36f3248c0bd34f9a1cab526118218ccf27eda1eb71762e41679e1524f80.jpg) +(d) Complex of designed 6W7O and ATP. pLDDT=80.84, binding affinity=-10.52, Uniprot blastp recovery rate=58.0% + +![](images/bb470c1eb8937cfc4d7ae229bdc8a32c8015c48acd748fb574fe865daa28062a.jpg) +(e) Complex of designed 3UYO and ATP. pLDDT=81.69, binding affinity=-11.6, Uniprot blastp recovery rate=64.7% + +![](images/9a3d600ce42cbebb929c16c7dd332df8a9b12e2c04f62465dd06c71118b3bc98.jpg) +(f) Complex of designed 4NI2 and ATP. pLDDT=81.32, binding affinity=-11.92, Uniprot blastp recovery rate=55% +Figure 6. Complexes of the EnzyGen designed enzymes and their corresponding substrates. + +
Protein Family1.1.1.2391.1.1.2701.1.1.2011.1.1.1841.1.1.251.1.1.621.1.1.1971.1.1.351.1.1.2481.1.1.2711.1.1.3721.1.1.3571.1.1.271.1.1.2861.1.1.471.1.1.3
EnzyGen0.620.150.090.160.920.380.390.550.890.620.860.710.980.140.990.39
Protein Family1.1.1.561.1.1.1051.1.1.771.1.1.341.1.1.3991.1.1.421.1.1.491.1.1.441.1.1.401.1.1.241.1.1.121.1.1.151.1.1.91.1.1.111.1.1.51.1.1.6
EnzyGen0.390.640.920.070.980.650.820.160.991.01.01.00.990.920.990.9
Protein Family1.1.1.11.14.13.391.14.13.91.14.13.231.14.14.181.14.14.471.14.14.251.14.14.1541.14.14.11.14.14.321.14.14.241.14.14.261.14.14.911.2.1.31.2.1.501.2.1.44
EnzyGen0.990.990.40.190.60.270.240.030.560.360.990.220.040.440.660.48
Protein Family1.2.1.121.2.1.591.2.1.131.2.1.111.2.1.101.2.1.51.2.1.471.2.1.361.2.1.91.2.1.261.2.1.881.2.1.841.2.1.891.2.1.902.1.1.3092.1.1.37
EnzyGen0.940.840.360.920.590.960.870.60.840.990.730.030.820.910.060.94
Protein Family2.1.1.3642.1.1.2212.1.1.3482.1.1.3202.1.1.62.1.1.3662.1.1.3672.1.1.2442.1.1.3592.1.1.722.1.1.2202.1.1.452.1.1.982.1.1.792.1.1.82.1.1.233
EnzyGen0.730.021.00.761.00.840.991.00.950.821.00.850.780.970.020.02
Protein Family2.1.1.3192.1.1.52.1.1.3542.1.1.1732.3.1.482.3.1.572.3.1.822.3.1.2582.3.1.872.3.1.1082.3.1.392.3.1.2862.3.1.942.3.1.1172.3.1.1802.3.1.16
EnzyGen0.490.720.820.760.750.340.970.350.070.20.430.310.670.530.980.79
Protein Family2.3.1.972.3.1.92.3.1.472.3.1.262.3.1.502.3.1.372.4.1.1862.4.1.1352.4.1.382.4.1.2552.4.1.1432.4.1.2642.4.1.1822.4.1.3452.4.1.1152.4.1.15
EnzyGen0.760.770.320.970.350.070.350.680.140.190.110.430.480.520.320.35
Protein Family2.4.1.212.4.1.412.4.1.1552.4.1.112.4.1.2252.4.1.12.4.2.302.4.2.22.4.2.82.4.2.32.4.2.192.4.2.172.4.2.212.4.2.642.4.2.14
EnzyGen0.980.960.290.380.560.840.890.490.930.990.980.930.920.690.650.15
Protein Family2.4.2.362.5.1.182.5.1.312.5.1.682.5.1.552.5.1.162.5.1.12.5.1.152.5.1.792.5.1.872.5.1.292.5.1.592.5.1.262.5.1.472.5.1.462.5.1.54
EnzyGen0.680.270.280.990.640.910.990.580.880.120.990.980.821.00.960.95
Protein Family2.5.1.62.5.1.72.5.1.192.5.1.262.6.1.212.6.1.92.6.1.162.6.1.992.6.1.512.6.1.632.6.1.32.6.1.572.6.1.72.6.1.812.6.1.73
EnzyGen0.980.980.980.950.050.230.320.060.70.990.990.410.311.00.290.94
Protein Family2.6.1.832.6.1.622.6.1.852.6.1.822.7.1.1072.7.1.1542.7.1.262.7.1.712.7.1.242.7.1.1132.7.1.1532.7.1.232.7.1.352.7.1.332.7.1.68
EnzyGen0.950.710.040.660.390.830.060.990.750.140.570.610.940.970.810.98
Protein Family2.7.1.202.7.1.1782.7.1.192.7.1.1592.7.1.822.7.1.732.7.1.402.7.1.12.7.1.472.7.1.1582.7.1.52.7.10.22.7.11.12.7.11.212.7.11.25
EnzyGen0.680.570.340.090.780.130.990.980.890.990.980.880.980.920.631.0
Protein Family2.7.11.222.7.11.302.7.11.242.7.11.262.7.11.22.7.11.162.7.4.62.7.4.82.7.4.142.7.4.92.7.4.252.7.4.102.7.4.222.7.4.242.7.4.1
EnzyGen1.01.01.01.00.991.01.00.750.40.990.960.940.70.240.150.39
Protein Family2.7.7.72.7.7.62.7.7.652.7.7.602.7.7.862.7.7.312.7.7.122.7.7.522.7.7.232.7.7.232.7.7.92.7.7483.1.1.43.1.133.1.1783.1.12
EnzyGen0.910.290.420.80.380.980.980.410.880.150.570.380.990.190.510.84
Protein Family3.1.1.233.1.1.723.1.1.473.1.1.343.1.1.83.1.1.73.1.153.1.3.323.1.3.463.1.3.1043.1.3.163.1.3.1083.1.3.73.1.3.113.1.3.36
EnzyGen0.50.430.960.860.860.910.130.170.670.50.070.830.990.230.930.53
Protein Family3.1.3.103.1.3.763.1.3.13.1.4.523.1.4.173.1.4.553.1.4.353.1.4.533.2.2.63.2.2.93.2.2.163.2.2.83.2.2.33.2.2.13.4.19.12
EnzyGen0.250.210.090.230.950.030.980.990.410.820.20.550.510.870.770.44
Protein Family3.4.19.53.4.19.143.4.19.133.4.21.533.4.21.923.4,21,1073,4,21,223,5,1,983,5,1,263,5,1,973,5,1,1243,5,1,93,5,1,443,5,1,13,5,1,25
EnzyGen0.220.070.070.730.690.910.570.230.080.990.830.320.560.070.070.41
Protein Family3.5.1.163.5.1.923.5.1.993.5.1.623.5.1.233.5,2,173,5,2,63,5,2,103,6,1,123,6,1,233,6,1,553,6,1,563,6,1,93,6,1,603,6,1,72
EnzyGen0.130.110.220.440.270.150.130.630.970.110.630.450.880.930.90.54
Protein Family3.6.1.153.6.1,583.6,1,83,6,1,223,6,1,273,6,1,293,6,1,53,6,4,63,6,4,133,6,4,133,6,4,103,6,5,23,6,5,13,6,5,54,1,1,234,1,1,85
EnzyGen0.630.970.990.840.750.140.760.730.790.40.960.40.420.290.970.87
Protein Family4.1.1.174.1.1.374.1.1.394.1.1.284.1.1.124.1.1,494,1,1,254,1,1,324,2,1,104,2,1,194,2,1,144,2,1,244,2,1,224,2,1,84,2,1,24,6,1,1
EnzyGen0.020.570.880.020.330.990.040.450.810.851.00.640.010.810.960.65
Protein Family4.6.1.174.6.1,124,6,1,2
EnzyGen0.490.40.52
+ +Table 7. Enzyme-substrate ESP score (↑) for the 323 testing fourth-level categories. Note 0.6 or higher ESP score indicates a positive binding. Avg denotes average. + +
Protein Family1.1.11.11.11.14.131.14.141.2.12.1.12.3.12.4.12.4.22.5.12.6.12.7.12.7.102.7.112.7.4Avg
PROTSEED0.980.990.480.980.980.990.990.990.990.990.990.990.990.990.99-
RFDiffusion+IF0.890.950.720.580.950.680.760.950.860.950.950.950.820.950.95-
ESM2+EGNN0.960.970.690.970.980.980.980.970.970.970.970.970.980.980.98-
EnzyGen0.991.000.731.001.001.001.000.981.001.001.001.001.001.001.00
Protein Family2.7.73.1.13.1.33.1.43.2.23.4.193.4.213.5.13.5.23.6.13.6.43.6.54.1.14.2.14.6.1Avg
PROTSEED0.980.930.950.980.920.910.990.990.250.970.980.470.950.990.970.92
RFDiffusion+IF0.980.970.930.940.920.940.970.960.600.970.970.940.920.980.970.94
ESM2+EGNN0.980.970.930.940.920.940.970.960.600.970.970.940.920.980.970.94
EnzyGen1.001.001.001.000.960.991.000.990.630.991.000.890.991.000.990.97
+ +Table 8. Enzyme-substrate ESP score (↑) of the top-1 candidate. IF denotes the inverse folding model ProteinMPNN. Note 0.6 or higher ESP score indicates a positive binding. Avg denotes average. + +
Protein Family EnzyGen1.1.1.239 -4.291.1.1.270 -9.761.1.1.201 -11.741.1.1.184 -12.031.1.1.25 -3.291.1.1.197 -13.141.1.1.197 -3.321.1.1.197 -12.461.1.1.248 -4.751.1.1.271 -3.521.1.1.372 -3.291.1.1.357 -10.411.1.1.27 -8.471.1.1.286 -6.321.1.1.47 -12.561.1.1.3 6.57
Protein Family EnzyGen1.1.1.56 -12.311.1.1.105 -13.011.1.1.77 -10.871.1.1.34 -9.231.1.1.399 -10.651.1.1.42 -9.371.1.1.49 -9.511.1.1.44 -9.011.1.1.40 -9.871.1.1.24 -5.031.11.1.12 -4.421.11.1.15 -4.481.11.1.9 -4.421.11.1.11 -4.381.11.1.5 -4.551.11.1.6 -5.44
Protein Family EnzyGen1.1.1.21 -6.641.14.13.39 -5.11.14.13.9 -6.241.14.13.23 -6.921.14.14.18 -12.341.14.14.47 -10.961.14.14.25 -8.631.14.14.54 -10.251.14.14.1 -7.321.14.14.32 -10.121.14.14.24 -8.761.14.14.26 -9.041.14.14.91 -9.841.2.1.3 -5.641.2.1.50 -5.661.2.1.44 -5.65
Protein Family EnzyGen1.2.1.12 -6.171.2.1.59 -14.721.2.1.13 -6.221.2.1.11 -10.111.2.1.10 -10.981.2.1.5 -7.91.2.1.47 -9.441.2.1.36 -6.311.2.1.9 -12.571.2.1.26 -13.561.2.1.88 -11.751.2.1.84 -7.131.2.1.89 -8.621.2.1.90 -10.262.1.1.309 -9.112.1.1.379 -9.84
Protein Family EnzyGen2.1.1.364 -9.042.1.1.221 -8.162.1.1.348 -10.962.1.1.320 -9.512.1.1.6 -11.432.1.1.366 -9.982.1.1.367 -8.92.1.1.244 -9.012.1.1.359 -9.872.1.1.72 -9.242.1.1.220 -10.812.1.1.45 -9.642.1.1.98 -8.072.1.1.79 -7.942.1.1.8 -10.942.1.1.233 -11.95
Protein Family EnzyGen2.1.1.319 -5.932.1.1.5 -7.972.1.1.354 -8.632.1.1.173 -8.92.3.1.48 -10.632.3.1.57 -6.522.3.1.82 -8.292.3.1.258 -9.472.3.1.87 -9.272.3.1.108 -9.612.3.1.38 -8.762.3.1.286 -10.122.3.1.94 -10.592.3.1.177 -10.912.3.1.180 -9.98
Protein Family EnzyGen2.3.1.97 -7.562.3.1.9 -7.212.3.1.47 -8.342.3.1.26 -10.252.3.1.50 -9.612.3.1.37 -8.92.4.1.186 -8.612.4.1.135 -8.672.4.1.38 -10.832.4.1.255 -11.732.4.1.143 -5.252.4.1.264 -5.932.4.1.182 -6.352.4.1.345 -8.762.4.1.15 -9.442.4.1.15 -10.25
Protein Family EnzyGen2.4.1.21 -11.672.4.1.41 -10.12.4.1.155 -11.322.4.1.11 -11.532.4.1.225 -10.542.4.1.1 -11.842.4.2.30 -11.132.4.2.2 -13.412.4.2.8 -13.882.4.2.3 -9.882.4.2.19 -8.242.4.2.19 -10.612.4.2.17 -9.012.4.2.21 -9.442.4.2.64 -15.762.4.2.14 -13.06
Protein Family EnzyGen2.4.2.36 -10.642.5.1.18 -10.042.5.1.31 -11.412.5.1.68 -8.842.5.1.55 -8.792.5.1.16 -8.272.5.1.15 -8.212.5.1.15 -9.032.5.1.79 -9.982.5.1.87 -10.672.5.1.29 -12.952.5.1.59 -9.852.5.1.126 -9.872.5.1.47 -10.862.5.1.46 -11.232.5.1.54 -10.01
Protein Family EnzyGen2.5.1.6 -5.932.5.1.7 -5.822.5.1.19 -8.632.5.1.26 -9.982.6.1.21 -7.082.6.1.9 -8.82.6.1.16 -8.982.6.1.59 -7.432.6.1.63 -7.022.6.1.3 -8.012.6.1.3 -7.812.6.1.57 -8.362.6.1.7 -8.92.6.1.7 -8.022.6.1.81 -7.652.6.1.73 -8.9
Protein Family EnzyGen2.6.1.83 -8.012.6.1.62 -8.872.6.1.85 -8.122.6.1.82 -9.232.7.1.107 -9.212.7.1.154 -10.642.7.1.26 -12.582.7.1.71 -9.092.7.1.21 -12.072.7.1.24 -12.072.7.1.153 -9.762.7.1.23 -9.232.7.1.35 -9.652.7.1.33 -10.762.7.1.38 -10.872.7.1.68 -10.87
Protein Family EnzyGen2.7.1.20 -8.282.7.1.178 -10.42.7.1.19 -12.432.7.1.159 -10.862.7.1.82 -11.562.7.1.73 -8.012.7.1.40 -10.872.7.1.1 -10.042.7.1.47 -10.852.7.1.158 -11.452.7.1.02 -11.862.7.10.2 -11.652.7.10.1 -9.442.7.11.1 -12.322.7.11.21 -13.132.7.11.25 -11.44
Protein Family EnzyGen2.7.11.22 -10.322.7.11.30 -12.532.7.11.24 -13.652.7.11.26 -11.022.7.11.2 -10.832.7.11.16 -12.362.7.14.6 -11.242.7.43 -8.762.7.48 -9.892.7.44 -13.562.7.49 -13.362.7.45 -10.322.7.40 -11.962.7.42 -8.992.7.42 -8.652.7.42 -13.56
Protein Family EnzyGen2.7.7.7 -9.022.7.7.6 -8.492.7.7.65 -8.82.7.7.60 -8.352.7.7.86 -8.022.7.7.31 -7.322.7.7.12 -7.022.7.7.52 -7.942.7.727 -6.532.7.723 -8.482.7.79 -7.032.7.748 -3.123.1.1.4 -7.793.1.1.3 -8.383.1.1.78 -5.883.1.1.2 -3.32
Protein Family EnzyGen3.1.1.23 -5.843.1.1.72 -5.583.1.1.47 -5.443.1.1.34 -5.233.1.1.8 -7.863.1.1.7 -7.333.1.15 -12.053.1.3.32 -10.073.1.346 -8.253.1.3.3 -6.453.1.3.104 -9.13.1.3.16 -9.363.1.3.08 -9.253.1.3.7 -9.043.1.3.11 -9.133.1.3.36 -9.07
Protein Family EnzyGen3.1.3.10 -8.123.1.3.76 -8.423.1.3.1 -7.953.1.4.52 -7.953.1.4.17 -11.353.1.4.55 3.1.393.1.4.35 3.1.453.1.453 3.1.4533.2.26 3.2263.2.29 3.2263.2.28 3.2283.2.23 3.2283.2.23 3.5143.228 3.5143.228 3.5143.49 3.514
Protein Family EnzyGen3.4.19.5 -10.23.4.19.14 -9.253.4.19.13 -11.563.4.21.53 -11.953.4.21.92 -10.343.4.21.107 -8.323.4.21.22 -9.873.5.1.98 -5.243.5.1.26 -3.973.5.1.97 -4.243.5.1.24 4-7.373.5.19 4-7.93.5.14 4-8.983.5.14 6-583.5.14 6-633.5.14 9-46
Protein Family EnzyGen3.5.1.16 -9.013.5.1.99 -6.923.5.1.99 -4.233.5.1.62 -6.523.5.1.23 -5.243.5.2.17 -5.73.5.26 -6.633.5.20 3-12.823.6.12 3-12.823.6.12 3-8.73.6.15 3-10.373.6.15 3-11.73.6.16 4-7.863.6.16 4-623.6.16 9-843.6.17 8-94
Protein Family EnzyGen3.6.1.15 -9.013.6.1.58 -9.873.6.1.8 -9.233.6.1.22 -9.653.6.1.27 -8.523.6.1.29 -8.253.6.15 8-533.646 3-8,533,64,12 3-11,123,64,13 3-13,853,64,10 3-13,823,65,2 3-13,413,65,5 3-11,353,65,5 3-11,893,65,5 3-12,564,1,1,23 4-10,94
Protein Family EnzyGen4,1,1,17 -10.174,1,1,37 -10,924,1,1,39 -10,924,1,1,28 -10,364,1,1,12 4-10,634,1,1,49 -10,354,1,1,25 4-6,324,1,1,32 4-7,354,2,1,10 4-5,414,2,1,19 4-5,444,2,1,14 4-5,534,2,1,24 4-6,994,2,1,22 4-8,654,2,1,8 4-9,344,2,1,8 4-234,2,1,8 4-0,7
Protein Family EnzyGen4,6,1,17 -10,024,6,1,12 -11,764,6,1,2 4-10,23Avg -9,44
+ +Table 9. Substrate binding affinity (kcal/mol, $\downarrow$ ) for the 323 testing fourth-level categories. Avg denotes average. + +
Protein Family1.1.11.11.11.14.131.14.141.2.12.1.12.3.12.4.12.4.22.5.12.6.12.7.12.7.102.7.112.7.4Avg
PROTSEED-8.37-6.90-7.08-11.69-6.61-7.94-12.26-11.83-12.93-10.09-8.30-8.15-10.09-12.70-10.01-
RFDiffusion+IF-6.54-7.39-7.09-11.63-11.89-12.59-12.39-9.49-14.11-7.87-8.81-10.99-14.19-14.71-11.53-
ESM2+EGNN-12.93-10.03-8.74-10.39-8.20-14.38-12.40-11.41-14.42-12.00-11.01-8.74-13.46-13.32-12.23-
EnzyGen-16.63-7.20-6.85-13.03-14.72-12.43-14.21-11.84-16.31-15.36-9.23-13.31-12.92-15.01-13.56
Protein Family2.7.73.1.13.1.33.1.43.2.23.4.193.4.213.5.13.5.23.6.13.6.43.6.54.1.14.2.14.6.1Avg
PROTSEED-9.06-9.79-8.27-9.02-13.22-9.77-10.59-6.70-7.65-10.32-11.32-13.50-8.97-5.74-10.11-9.63
RFDiffusion+IF-9.56-6.81-10.50-10.00-12.11-12.35-12.05-9.66-7.22-13.16-14.26-11.10-9.47-5.92-9.84-10.51
ESM2+EGNN-11.30-10.19-10.85-10.24-13.65-12.42-12.80-8.80-9.61-12.59-15.68-13.29-10.36-10.35-14.61-11.68
EnzyGen-11.34-13.10-11.36-12.66-12.79-15.25-11.95-11.15-13.08-12.24-13.93-14.17-11.60-9.34-11.76-12.61
+ +Table 10. Substrate binding affinity (kcal/mol, ↓) for the top-1 candidate. IF denotes the inverse folding model ProteinMPNN. Avg denotes average. + +
Protein Family EnzyGen1.1.1.239 92.181.1.1.270 71.921.1.1.201 97.561.1.1.184 94.231.1.1.25 96.241.1.1.62 90.451.1.1.197 92.131.1.1.35 96.451.1.1.248 77.261.1.1.271 94.311.1.1.372 88.151.1.1.357 94.421.1.1.27 88.41.1.1.286 93.721.1.1.47 97.81.1.1.3 95.54
Protein Family EnzyGen1.1.1.56 86.041.1.1.105 96.221.1.1.77 98.321.1.1.34 96.491.1.1.399 96.11.1.1.42 92.631.1.1.49 96.291.1.1.44 96.91.1.1.40 96.351.1.1.24 94.711.1.1.12 95.631.1.1.15 78.961.1.1.9 69.851.1.1.11 96.011.1.1.15 96.041.1.1.6 95.77
Protein Family EnzyGen1.1.1.21 93.841.14.13.39 93.161.14.13.9 90.261.14.13.23 95.011.14.14.18 90.421.14.14.47 96.81.14.14.25 96.371.14.14.54 94.631.14.14.1 88.461.14.14.32 96.791.14.14.24 89.971.14.14.26 95.541.14.14.91 80.311.2.1.3 93.121.2.1.50 40.981.2.1.44 73.57
Protein Family EnzyGen1.2.1.12 97.541.2.1.59 84.781.2.1.13 88.91.2.1.11 96.021.2.1.10 89.111.2.1.5 98.091.2.1.47 95.011.2.1.36 95.721.2.1.9 97.271.2.1.26 97.941.2.1.88 92.611.2.1.84 29.821.2.1.89 90.81.2.1.90 95.952.1.1.309 67.582.1.1.37 58.33
Protein Family EnzyGen2.1.1.364 95.732.1.1.221 36.242.1.1.348 93.462.1.1.320 79.42.1.1.6 82.732.1.1.366 95.492.1.1.367 93.452.1.1.244 82.572.1.1.359 88.352.1.1.72 95.562.1.1.220 70.412.1.1.45 97.372.1.1.98 97.512.1.1.79 86.872.1.1.8 33.082.1.1.233 40.74
Protein Family EnzyGen2.1.1.319 94.272.1.1.5 74.912.1.1.354 96.812.1.1.173 86.122.3.1.48 85.32.3.1.57 91.392.3.1.82 94.012.3.1.258 95.192.3.1.87 92.162.3.1.108 94.572.3.1.39 83.542.3.1.286 80.122.3.1.94 66.062.3.1.117 89.172.3.1.180 90.062.3.1.16 90.08
Protein Family EnzyGen2.3.1.97 93.782.3.1.9 96.912.3.1.47 95.272.3.1.26 90.742.3.1.50 95.232.3.1.37 97.452.4.1.186 87.952.4.1.135 92.442.4.1.38 94.952.4.1.255 94.122.4.1.264 89.152.4.1.182 97.02.4.1.345 89.822.4.1.115 94.92.4.1.15 92.29
Protein Family EnzyGen2.4.1.21 87.52.4.1.41 88.722.4.1.155 87.262.4.1.11 95.222.4.1.225 90.592.4.1.1 94.472.4.2.30 85.372.4.2.2 57.662.4.2.8 86.972.4.2.3 94.282.4.2.19 89.572.4.2.17 94.672.4.2.17 87.782.4.2.21 97.232.4.2.64 84.382.4.2.14 56.9
Protein Family EnzyGen2.4.2.36 95.832.5.1.18 90.42.5.1.31 93.982.5.1.68 90.522.5.1.55 96.32.5.1.16 94.632.5.1.15 94.582.5.1.79 87.212.5.1.87 84.972.5.1.29 48.72.5.1.59 93.432.5.1.126 96.642.5.1.47 97.172.5.1.46 95.032.5.1.54 92.67
Protein Family EnzyGen2.5.1.6 85.442.5.1.7 95.852.5.1.19 97.852.5.1.26 94.612.6.1.21 98.392.6.1.9 95.832.6.1.16 92.462.6.1.99 33.652.6.1.63 87.922.6.1.3 97.822.6.1.1 92.372.6.1.57 91.692.6.1.7 63.42.6.1.8 97.382.6.1.81 92.312.6.1.73 94.62
Protein Family EnzyGen2.6.1.83 97.212.6.1.62 84.112.6.1.85 65.482.6.1.82 91.02.7.1.107 82.462.7.1.154 80.822.7.1.26 34.342.7.1.71 90.392.7.1.24 86.822.7.1.113 94.292.7.1.153 88.442.7.1.23 85.812.7.1.35 84.822.7.1.33 95.642.7.1.33 90.212.7.1.68 92.01
Protein Family EnzyGen2.7.1.20 95.982.7.1.178 84.152.7.1.19 89.492.7.1.159 37.842.7.1.82 82.382.7.1.73 38.892.7.1.40 95.482.7.1.1 98.562.7.1.47 96.632.7.1.158 94.462.7.1.5 96.02.7.10.2 88.842.7.10.1 85.62.7.11.1 87.222.7.11.21 93.532.7.11.25 88.0
Protein Family EnzyGen2.7.11.22 89.92.7.11.30 87.492.7.11.24 82.132.7.11.26 95.352.7.1.12 87.322.7.1.16 93.132.7.1.26 96.782.7.4.3 89.562.7.4.8 96.632.7.4.14 94.292.7.4.29 88.442.7.4.25 85.812.7.4.10 84.822.7.4.22 95.642.7.4.24 90.212.7.4.1 92.01
Protein Family EnzyGen2.7.7.7 89.352.7.7.6 70.582.7.7.65 59.942.7.7.60 95.052.7.7.86 63.212.7.7.31 95.832.7.7.12 92.192.7.7.52 92.192.7.7.27 31.922.7.7.23 93.162.7.7.49 88.782.7.4.25 97.823.1.1.4 94.833.1.1.3 88.533.1.1.78 54.03.1.1.2 89.44
Protein Family EnzyGen3.1.1.23 81.443.1.1.72 98.513.1.1.47 93.263.1.1.34 96.083.1.1.8 94.523.1.1.7 96.323.1.1.5 96.323.1.3.32 50.773.1.3.46 92.353.1.3.104 94.743.1.3.16 42.833.1.3.108 82.733.1.3.7 70.043.1.3.11 78.523.1.3.11 88.953.1.3.36 90.43
Protein Family EnzyGen3.1.3.10 88.663.1.3.70 92.353.1.3.76 97.533.1.4.52 87.533.1.4.17 88.13.1.4.55 38.323.1.4.35 96.683.1.4.53 92.313.2.2.6 77.623.2.2.9 85.883.2.2.16 33.323.2.2.8 95.853.2.2.3 94.013.2.2.1 66.523.2.2.10 57.023.4.19.12 86.04
Protein Family EnzyGen3.4.19.5 77.493.4.19.14 92.473.4.19.13 89.323.4.21.53 85.783.4.21.92 90.283.4,21,107 91.913,4,21,22 95.523,5,1,98 87.983,5,1,26 88.623,5,1,97 94.713,5,1,124 90.083,5,1,9 45.223,5,1,44 71.213,5,1,1 95.293,5,1,25 96.263,5,1,25 95.9
Protein Family EnzyGen3.5.1.16 48.523.5.1.92 95.563.5.1.99 97.243.5.1.62 88.513.5.1.23 32.353.5,2,17 32.73,5,2,6 90,823,5,2,10 97,733,6,1,12 66,373,6,1,23 91,283,6,1,56 87,333,6,1,56 84,843,6,1,9 93,723,6,1,60 85,653,6,1,72 97,473,6,1,72 42,75
Protein Family EnzyGen3.6.1.15 77.063.6.1.58 95.343.6.1.8 61.923.6.1,22 78.63.6,1,27 73,233,6,1,29 57,513,6,1,5 78,073,6,4,6 77,193,6,4,13 79,553,6,4,10 79,553,6,5,2 79,613,6,5,2 84,593,6,5,1 86,293,6,5,5 69,464,1,1,23 84,224,1,1,85 95,33
Protein Family EnzyGen4.1.1.17 77.34.1.1,37 78.754.1.1,37 96.54.1,1,28 95,624,1,1,28 91,494,1,1,49 93,314,1,1,25 95,014,1,1,32 82,34,2,1,10 92,924,2,1,19 88,364,2,1,24 91,394,2,1,24 96,74,2,1,22 93,194,2,1,8 97,284,2,1,8 92,944,2,1,8 86,06
Protein Family EnzyGen4.6.1.17 67.844.6.1,12 95,334.6,1,2 87,6Avg 87,45
+ +Table 11. AlphaFold2 pLDDT (↑) for the 323 testing fourth-level categories. Avg denotes average. + +
Protein Family1.1.11.11.11.14.131.14.141.2.12.1.12.3.12.4.12.4.22.5.12.6.12.7.12.7.102.7.112.7.4Avg
PROTSEED86.2882.4773.3686.4891.3864.9091.8374.3389.8174.4372.7279.6178.3470.5392.71-
RFDiffusion+IF83.8897.9892.5384.1888.0884.9076.3998.0071.6876.9376.7997.8877.2495.8081.25-
ESM2+EGNN96.3597.1988.5092.1296.6477.0395.7394.0994.6996.4096.4493.7094.4392.3197.50-
EnzyGen96.4997.8195.6798.2098.6095.3895.1694.1894.8896.8098.4984.1592.7396.0395.67-
Protein Family2.7.73.1.13.1.33.1.43.2.23.4.193.4.213.5.13.5.23.6.13.6.43.6.54.1.14.2.14.6.1Avg
PROTSEED92.0477.4979.1780.2676.6596.6374.9479.8566.3380.0082.0386.1683.3585.1879.9480.97
RFDiffusion+IF87.4085.0170.3373.1596.1294.7977.3387.2954.4683.9581.3369.3082.9782.4778.3682.93
ESM2+EGNN93.4797.1589.0081.3996.8724.7379.0197.6998.1842.3588.5526.9890.3293.3635.8984.60
EnzyGen97.8298.5191.5541.9397.3585.5297.3098.5591.5877.4396.1895.0874.6397.8668.7691.34
+ +Table 12. AlphaFold2 pLDDT (↑) for the top-1 candidate. IF denotes the inverse folding model ProteinMPNN. Avg denotes average. + +
Protein Family1.1.11.11.11.14.131.14.141.2.12.1.12.3.12.4.12.4.22.5.12.6.12.7.12.7.102.7.112.7.4Avg
PROTSEED0.940.670.410.980.890.990.930.800.980.980.980.980.990.990.95-
RFDiffusion+IF0.770.950.540.520.850.620.640.630.770.750.860.750.560.930.95-
ESM2+EGNN0.940.970.650.970.970.970.960.960.970.960.970.970.980.980.97-
EnzyGen0.971.000.661.001.001.000.990.971.000.991.001.001.001.001.00
Protein Family2.7.73.1.13.1.33.1.43.2.23.4.193.4.213.5.13.5.23.6.13.6.43.6.54.1.14.2.14.6.1Avg
PROTSEED0.980.780.910.970.920.810.980.850.200.500.970.390.910.990.960.85
RFDiffusion+IF0.880.570.890.950.700.950.590.760.580.850.830.840.910.950.810.77
ESM2+EGNN0.970.970.920.930.910.870.970.920.320.960.970.790.910.980.970.92
EnzyGen1.001.001.001.000.940.881.000.980.340.991.000.780.991.000.990.95
+ +Table 13. Enzyme-substrate ESP score (↑) for the top-5 candidate. IF denotes the inverse folding model ProteinMPNN. Note 0.6 or higher ESP score indicates a positive binding. Avg denotes average. + +
Protein Family1.1.11.11.11.14.131.14.141.2.12.1.12.3.12.4.12.4.22.5.12.6.12.7.12.7.102.7.112.7.4Avg
PROTSEED-5.99-5.93-5.55-11.17-6.64-9.61-11.83-8.80-11.84-8.57-6.01-8.72-11.30-12.38-12.59-
RFDiffusion+IF-7.03-6.43-6.70-13.24-8.42-12.59-11.36-10.01-12.74-9.80-7.99-11.90-12.30-12.82-12.90-
ESM2+EGNN-6.85-8.46-7.82-14.01-6.97-12.04-12.65-11.80-15.14-9.34-5.87-10.01-12.65-12.20-11.43-
EnzyGen-14.11-5.63-6.71-11.02-10.05-10.93-12.66-11.68-13.94-14.41-9.14-12.43-12.70-13.80-12.47
Protein Family2.7.73.1.13.1.33.1.43.2.23.4.193.4.213.5.13.5.23.6.13.6.43.6.54.1.14.2.14.6.1Avg
PROTSEED-10.11-7.00-9.20-9.68-13.02-10.12-10.76-5.53-6.00-10.57-13.73-11.76-9.35-6.74-11.77-9.41
RFDiffusion+IF-10.65-9.15-9.70-10.11-11.35-13.10-11.57-6.88-8.09-11.07-12.54-11.45-9.16-6.64-10.55-10.27
ESM2+EGNN-10.23-9.34-9.77-9.75-13.48-11.00-11.27-6.19-12.08-8.94-13.61-13.25-9.69-6.56-10.84-10.44
EnzyGen-9.76-10.73-9.97-12.42-12.08-11.58-11.02-9.51-11.09-11.58-13.83-12.90-11.41-6.52-10.64-11.22
+ +Table 14. Substrate binding affinity (kcal/mol, ↓) for the top-5 candidate. IF denotes the inverse folding model ProteinMPNN. Avg denotes average. + +
Protein Family1.1.11.11.11.14.131.14.141.2.12.1.12.3.12.4.12.4.22.5.12.6.12.7.12.7.102.7.112.7.4Avg
PROTSEED81.0781.8074.3784.1779.2872.9569.8678.3180.0679.1676.6179.8380.3379.2084.10-
RFDiffusion+IF82.8093.5181.1281.1782.4478.8288.3683.5382.3294.4478.4181.9387.3881.5082.43-
ESM2+EGNN93.3591.2590.0087.6895.2869.9691.4386.5086.9391.7693.9289.5390.6488.9894.51-
EnzyGen92.8592.6890.2598.0498.2982.1593.3993.3495.1175.9198.2276.3191.4695.7094.52-
Protein Family2.7.73.1.13.1.33.1.43.2.23.4.193.4.213.5.13.5.23.6.13.6.43.6.54.1.14.2.14.6.1Avg
PROTSEED80.5577.0877.8979.3578.4278.2478.0077.2275.5183.9175.1668.5682.5880.9282.2278.56
RFDiffusion+IF81.9581.9976.1181.0492.5989.9378.3687.0879.2587.4660.6388.1375.8977.2580.0382.60
ESM2+EGNN90.0293.5087.6086.0794.2262.2782.1987.7295.2695.9276.8380.2472.4883.3879.1286.95
EnzyGen96.8098.0489.2281.2796.8271.0496.6498.1280.5780.7895.2380.0587.8893.3890.8790.17
+ +Table 15. AlphaFold2 pLDDT (↑) for the top-5 candidate. IF denotes the inverse folding model ProteinMPNN. Avg denotes average. + +
Protein Family1.1.11.11.11.14.131.14.141.2.12.1.12.3.12.4.12.4.22.5.12.6.12.7.12.7.102.7.112.7.4Avg
PROTSEED0.900.670.380.980.780.990.820.550.980.960.960.980.990.990.80-
RFDiffusion+IF0.680.950.540.470.690.540.550.480.710.660.770.670.510.830.89-
ESM2+EGNN0.890.960.590.940.930.960.910.880.950.950.940.950.960.970.95-
EnzyGen0.951.000.640.990.991.000.990.880.990.990.990.991.001.001.00
Protein Family2.7.73.1.13.1.33.1.43.2.23.4.193.4.213.5.13.5.23.6.13.6.43.6.54.1.14.2.14.6.1Avg
PROTSEED0.970.700.900.950.890.680.970.730.140.500.910.370.860.990.940.81
RFDiffusion+IF0.780.490.850.890.550.920.470.670.530.730.660.760.840.950.600.69
ESM2+EGNN0.950.950.900.900.840.620.940.860.230.930.950.710.890.970.930.88
EnzyGen0.990.990.991.000.910.691.000.940.270.981.000.740.991.000.990.93
+ +Table 16. Enzyme-substrate ESP score (↑) for the top-10 candidate. IF denotes the inverse folding model ProteinMPNN. Note 0.6 or higher ESP score indicates a positive binding. Avg denotes average. + +
Protein Family1.1.11.11.11.14.131.14.141.2.12.1.12.3.12.4.12.4.22.5.12.6.12.7.12.7.102.7.112.7.4Avg
PROTSEED-4.65-4.93-4.76-11.09-7.28-9.46-11.11-9.21-10.29-7.88-5.13-8.38-10.66-11.37-13.20-
RFDiffusion+IF-7.26-5.43-5.70-11.15-6.65-11.45-11.20-9.33-10.88-8.84-7.74-10.02-11.60-11.66-12.90-
ESM2+EGNN-5.38-7.50-6.75-12.81-8.16-11.06-10.54-9.95-13.16-8.24-5.53-9.44-11.88-12.44-10.84-
EnzyGen-10.49-5.05-5.82-10.34-8.18-10.05-10.38-11.17-11.91-11.93-8.84-10.50-11.81-12.51-11.50-
Protein Family2.7.73.1.13.1.33.1.43.2.23.4.193.4.213.5.13.5.23.6.13.6.43.6.54.1.14.2.14.6.1Avg
PROTSEED-8.81-7.01-8.20-8.71-11.37-9.50-9.96-5.21-5.27-13.57-11.53-10.37-7.88-5.24-9.99-8.60
RFDiffusion+IF-9.60-7.51-8.70-8.82-10.89-11.41-10.07-6.43-7.72-10.07-12.27-10.87-8.08-6.14-10.46-9.36
ESM2+EGNN-8.83-8.52-8.92-8.67-9.73-10.16-10.60-5.03-8.67-8.81-10.89-12.41-8.53-5.52-9.45-9.35
EnzyGen-9.17-9.07-9.62-12.13-11.26-10.72-10.69-8.30-8.66-11.15-13.10-11.35-11.29-5.99-10.64-10.12
+ +Table 17. Substrate binding affinity (kcal/mol, ↓) for the top-10 candidate. IF denotes the inverse folding model ProteinMPNN. Avg denotes average. + +
Protein Family1.1.11.11.11.14.131.14.141.2.12.1.12.3.12.4.12.4.22.5.12.6.12.7.12.7.102.7.112.7.4Avg
PROTSEED75.8481.8072.9083.8477.3277.6675.6277.3479.1475.5874.2077.3679.6578.3077.38-
RFDiffusion+IF75.5791.3681.1287.8579.3381.0385.6786.6277.5088.9879.5286.9786.7581.8587.24-
ESM2+EGNN93.2291.6890.1086.2994.9078.7390.9487.9387.0791.1593.9987.4590.5188.1394.98-
EnzyGen90.0591.3092.5697.5698.0889.8188.9193.6791.5686.3097.7573.6690.5394.8196.02-
Protein Family2.7.73.1.13.1.33.1.43.2.23.4.193.4.213.5.13.5.23.6.13.6.43.6.54.1.14.2.14.6.1Avg
PROTSEED76.9076.2977.8979.4177.1172.0679.9173.8379.1375.1668.7483.4676.3378.3785.7177.47
RFDiffusion+IF80.9282.5381.1385.9194.1091.6776.0980.7687.5766.8583.4882.4181.1177.0577.9382.90
ESM2+EGNN89.0092.7487.4186.4389.0558.5882.5691.9490.9385.0974.4682.1788.1589.2684.1487.30
EnzyGen96.4797.6290.1585.1995.7171.3496.3297.5481.3381.0192.4286.1389.6394.8987.3290.52
+ +Table 18. AlphaFold2 pLDDT (↑) for the top-10 candidate. IF denotes the inverse folding model ProteinMPNN. Avg denotes average. + +
PDB Source IDSequence
1KAGMLPPIFLVGPMGAGKTSVGRLARRLGEFLDSDREIEERVGLTVAWIFEELGEANFRRRREEVLRELFSLEPPVLATGGGAVTNKNREFLRKHGTVVLEVPV EELLRRRLRALPLLKLEFKRALFERLVALYRAAADIVVRNGLLVNLLVLLVR
5L2PMPLPPHLEYIYMQMMGKGKFMTMSEVEIRDLSQLASNTEPEVVEIDIKETKFTSKYGVKARQFPIDNKAYPVVLYLHGGSWVIGSKFTHDKVCRAITVSC NCKVISVDYRLFAYEKFPAAYEYCYATWKYENAKFINIDITKAIAINSAGNLLAAVASLLISKENKILKYQILLYPAVSFDLDTKSYKEFADGHFLDTDMIKFI GNNYLFNSKEDKLNPYASPINFADSLNLPPALIVTAEYDPLRDVEGYAKANKLLQAGVDVTISYKVLVHAFAVSVLDEIGDTINIMGKLLEKEYFK
1L1EMNLERFFVLFLDTQTYNCAYFERREMRAEQAIAKIDAIALALGPEPGMTTLDDGCGWATTRRIEYKVDTVVGLDLAKEQANHVRQLLLANSDNLRVRAA MLEKWDFFEEPDRVVSIGAFHEFGYQDARAALFQKTKEHLKPDGGLLLHHIVVPKKRKQEQLSPQHPLAKFKKLKKIEFFPGGNLPSYQMAAKAGWE VTREESLQLDGAYWWDWATAAAAHADEAIAIQSEFAYEAYQHEALAAAAGDFELGYWDIQFVLQK
8DSOHHHNKSESLLLLKKGLLLGFGRKGVFYWKRGQVFVVAVKKIRQSSDSEQFEEVQVMQQRLHENLVQLYGCTEGKDIYITEYMAAGLLLYYKKKKFQM QQILTICKAICSLEEEKLTLLHDLKRNLLLNSEGVAKISDFGLAKFISSSSSTKEFPPPVVLEQSKFSSKSDIWAFGVLMWEEYSYGKMPFKEFTRQETLEHAV AQGLRLYPPDIASEPYVKIMKECWHEKADERPSFISLLSNLEELQEELA
5TMPRGKFIVIEGLDGAGKSTNIDVVVEQLQRDGREEWVFRETREGGTPLAekLRELLTPDEPDVDMDTEMVLMEAARSOLVETVIKPALARGAWVLCDRHDL STAYQGGGRGLVPAQLAESFAINGLRPDLTYLDVPVEIGRLRAQKGRGLERFEQERFQQRVAAYAGRLERAQQDDSWQTIDATQPLSTSDAIRTHLQLR QSEL
6W7OHHLKLTFLKKGELGGGFGVYGKWRQGYEVAVKKIRKQSSSESQFIDEVQVMQQLSHENLVQLYGCCTEGDDIYITEYAMGMSLLQYYLKKHQFQQSQL LQIAKDIAVSALEYLELTLLHPGLSKRLLLNNSEGVAKITDFGLRRVLDSDIISSSFSLLPPIEELQQSKFTSKSDIWSFGLVMEWESYSGKMPWQRSQQE MEEHIRQQLRLYPPDLASPPVYTIMECWEKADERPSFISLLSNLVLLLLE
3UYOGSTKSTSEESHSWYHGPIPREDAERLLVSGIHGSFLRESESTAGDHLSLFLYEGVKYHYRINTALDGKLYVSEGIKFDTLAELVQHYKTHADGLCYVLSEPCPPV GEEEEEE
4NI2QVIAQKHDNVLSILFSDIVGFTSLASQCAQDLVMTLNELFSRFDKLCAENDVYKIETGAYCCVSGLPRKEPDHSQQICEMALDMMEVSSQVKTPHGKIPNMRI GIHSGRVVAGVVGLMRYYCLFGNDVNLANHMESGGVPGKINVPKETYELLKNDFSIPEPRGGSEECPENFPKKIVGYCLFVRRAAA
+ +Table 19. Enzyme sequences for all analyzed cases. \ No newline at end of file diff --git a/generativeenzymedesignguidedbyfunctionallyimportantsitesandsmallmoleculesubstrates/images.zip b/generativeenzymedesignguidedbyfunctionallyimportantsitesandsmallmoleculesubstrates/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..99661108a2d154c0255ba18f3d2e5929af0d4276 --- /dev/null +++ b/generativeenzymedesignguidedbyfunctionallyimportantsitesandsmallmoleculesubstrates/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c657e1b17d7004fe5e81ef0f527f1a55c49bd78347e7850146d6d4645942f98f +size 2684402 diff --git a/generativeenzymedesignguidedbyfunctionallyimportantsitesandsmallmoleculesubstrates/layout.json b/generativeenzymedesignguidedbyfunctionallyimportantsitesandsmallmoleculesubstrates/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..1528286342162b8dea5bc1dab60dcc75a26573ef --- /dev/null +++ b/generativeenzymedesignguidedbyfunctionallyimportantsitesandsmallmoleculesubstrates/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7db92c7ab4afabd5f91027f8c016905d55dc8d506e708f263ea76c3bfd53666f +size 722696 diff --git a/generativeflowsondiscretestatespacesenablingmultimodalflowswithapplicationstoproteincodesign/78e91ff1-68ea-4af4-84af-518a5573c012_content_list.json b/generativeflowsondiscretestatespacesenablingmultimodalflowswithapplicationstoproteincodesign/78e91ff1-68ea-4af4-84af-518a5573c012_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..54d4cc0236a6807f2d30b3267d9b687afd35caad --- /dev/null +++ b/generativeflowsondiscretestatespacesenablingmultimodalflowswithapplicationstoproteincodesign/78e91ff1-68ea-4af4-84af-518a5573c012_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:02a9292bf922e4500d62bc5cd3fd511e919ca074af43086e4587238237666233 +size 430189 diff --git a/generativeflowsondiscretestatespacesenablingmultimodalflowswithapplicationstoproteincodesign/78e91ff1-68ea-4af4-84af-518a5573c012_model.json b/generativeflowsondiscretestatespacesenablingmultimodalflowswithapplicationstoproteincodesign/78e91ff1-68ea-4af4-84af-518a5573c012_model.json new file mode 100644 index 0000000000000000000000000000000000000000..dffb73cafc97d964d96189c1fb981572ffaa41fd --- /dev/null +++ b/generativeflowsondiscretestatespacesenablingmultimodalflowswithapplicationstoproteincodesign/78e91ff1-68ea-4af4-84af-518a5573c012_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f41a8f2f0e4b78b094ee93c4fd9372582b3e58b91e13e4bb5059258e2d5bab0f +size 494084 diff --git a/generativeflowsondiscretestatespacesenablingmultimodalflowswithapplicationstoproteincodesign/78e91ff1-68ea-4af4-84af-518a5573c012_origin.pdf b/generativeflowsondiscretestatespacesenablingmultimodalflowswithapplicationstoproteincodesign/78e91ff1-68ea-4af4-84af-518a5573c012_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..a31d82d2f3e16f46aad098a7e3fb1e086f307095 --- /dev/null +++ b/generativeflowsondiscretestatespacesenablingmultimodalflowswithapplicationstoproteincodesign/78e91ff1-68ea-4af4-84af-518a5573c012_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:484207781c50ace1d746f654bf392121876fd4a194c5e183e1ef12785682d83f +size 7361979 diff --git a/generativeflowsondiscretestatespacesenablingmultimodalflowswithapplicationstoproteincodesign/full.md b/generativeflowsondiscretestatespacesenablingmultimodalflowswithapplicationstoproteincodesign/full.md new file mode 100644 index 0000000000000000000000000000000000000000..3667ceadf96dbeb4b4a7412ab4e3d20500595154 --- /dev/null +++ b/generativeflowsondiscretestatespacesenablingmultimodalflowswithapplicationstoproteincodesign/full.md @@ -0,0 +1,2077 @@ +# Generative Flows on Discrete State-Spaces: Enabling Multimodal Flows with Applications to Protein Co-Design + +Andrew Campbell*1 Jason Yim*2 Regina Barzilay* Tom Rainforth Tommi Jaakkola + +# Abstract + +Combining discrete and continuous data is an important capability for generative models. We present Discrete Flow Models (DFMs), a new flow-based model of discrete data that provides the missing link in enabling flow-based generative models to be applied to multimodal continuous and discrete data problems. Our key insight is that the discrete equivalent of continuous space flow matching can be realized using Continuous Time Markov Chains. DFMs benefit from a simple derivation that includes discrete diffusion models as a specific instance while allowing improved performance over existing diffusion-based approaches. We utilize our DFMs method to build a multimodal flow-based modeling framework. We apply this capability to the task of protein co-design, wherein we learn a model for jointly generating protein structure and sequence. Our approach achieves state-of-the-art co-design performance while allowing the same multimodal model to be used for flexible generation of the sequence or structure. + +# 1. Introduction + +Expanding the capabilities of generative models to handle discrete and continuous data, which we refer to as multimodal, is a fundamental problem to enable their widespread adoption in scientific applications (Wang et al., 2023). One such application requiring a multimodal generative model is protein co-design where the aim is to jointly generate continuous protein structures alongside corresponding discrete amino acid sequences (Shi et al., 2022). Proteins have been + +*Equal contribution $^{1}$ Department of Statistics, University of Oxford, UK $^{2}$ Department of Electrical Engineering and Computer Science, Massachusetts Institute of Technology, Massachusetts, USA. Correspondence to: Andrew Campbell , Jason Yim . + +Proceedings of the $41^{st}$ International Conference on Machine Learning, Vienna, Austria. PMLR 235, 2024. Copyright 2024 by the author(s). + +well-studied: the function of the protein is endowed through its structure while the sequence is the blueprint of how the structure is made. This interplay motivates jointly generating the structure and sequence rather than in isolation. To this end, the focus of our work is to develop a multimodal generative framework capable of co-design. + +Diffusion models (Sohl-Dickstein et al., 2015; Ho et al., 2020; Song et al., 2020) have achieved state-of-the-art performance across multiple applications. They have potential as a multimodal framework because they can be defined on both continuous and discrete spaces (Hoogeboom et al., 2021; Austin et al., 2021). However, their sample time inflexibility makes them unsuitable for multimodal problems. On even just a single modality, finding optimal sampling parameters requires extensive re-training and evaluations (Karras et al., 2022). This problem is exacerbated for multiple modalities. On the other hand, flow-based models (Liu et al., 2023; Albergo & Vanden-Eijnden, 2023; Lipman et al., 2023) improve over diffusion models with a simpler framework that allows for superior performance through sampling flexibility (Ma et al., 2024). Unfortunately, our current inability to define a flow-based model on discrete spaces holds us back from a multimodal flow model. + +We address this by introducing a novel flow-based model for discrete data named Discrete Flow Models (DFMs) and thereby unlock a complete framework for flow-based multimodal generative modeling. Our key insight comes from seeing that a discrete flow-based model can be realized using Continuous Time Markov Chains (CTMCs). DFMs are a new discrete generative modeling paradigm: less restrictive than diffusion, allows for sampling flexibility without re-training and enables simple combination with continuous state space flows to form multimodal flow models. + +Fig. 1A provides an overview of DFMs. We first define a probability flow $p_t$ that linearly interpolates from noise to data. We then generate new data by simulating a sequence trajectory $x_t$ that follows $p_t$ across time which requires training a denoising neural network with cross-entropy. The sequence trajectory could have many transitions or few, a property we term CTMC Stochasticity (Fig. 1B). Prior discrete diffusion models are equivalent to picking a specific stochasticity at training time, whereas we can adjust it at + +![](images/16f7d86ed3c918f65bf79d88d43bfc42002d2722807a33c379c95cfc1867cb41.jpg) +A. Discrete Flow Model +Discrete sequence trajectory: $x_{t}$ + +![](images/c49f73e2b435e561849562077c853b8720d057dac2b85bd0f177450d7f8044af.jpg) +Probability flow: $p_t$ + +![](images/011f3275eb08c9bcfe98c33b6a50fbcad378dd520415b73ede89e3e1c0bbbb80.jpg) +B. CTMC stochasticity + +![](images/8697a386da0a979ecc79b04fc3bedd3e3896f21e098200345adc652883432752.jpg) +Low stochasticity + +![](images/1dab37c1996184f13002ebc7aa4d4f271fcffacaabb5b6ce57e5a67168b7b852.jpg) +C. Multiflow multimodal protein generation +Figure 1. Overview. (A.) A DFM trajectory with masking over a 3-dim. sequence with 4 possible states. (B.) CTMC stochasticity controls the number of transitions in a sequence trajectory while respecting the flow $p_t$ . Shown is a 1-dim. sequence with 5 states. (C.) Sampling with Multiflow can start from noise (bottom left) or with either the structure or sequence given (top left and bottom right). Any sampling tasks (structure/sequence generation, forward/inverse folding, co-generation) can be achieved with a single Multiflow model. + +inference: enhancing sample quality and exerting control over sample distributional properties. + +Using DFMs, we are then able to create a multimodal flow model by defining factorized flows for each data modality. We apply this capability to the task of protein co-design by developing a novel continuous structure and discrete sequence generative model named Multiflow. We combine a DFM for sequence generation and a flow-based structure generation method developed in Yim et al. (2023a). Previous multimodal approaches either generated only the sequence or only the structure and then used a prediction model to infer the remaining modality (see Sec. 5). Our single model can jointly generate sequence and structure while being able to condition on either modality. + +In our experiments (Sec. 6), we first verify on small scale text data that DFMs outperform the discrete diffusion alternative, D3PM (Austin et al., 2021) through their expanded sample time flexibility. We then move to our main focus, assessing Multiflow's performance on the co-design task of jointly generating protein structure and sequence. Multiflow achieves state-of-the-art co-design performance while data distillation allows for obtaining state-of-the-art structure generation. We find CTMC stochasticity enables controlling sample properties such as secondary structure composition and diversity. Preliminary results on inverse and forward folding show Multiflow is a promising path towards a general-purpose protein generative model. + +Our contributions are summarized as follows: + +- We present Discrete Flow Models (DFMs), a novel discrete generative modeling method built through a CTMC simulating a probability flow. +- We combine DFMs with continuous flow-based methods to create a multimodal generative modeling framework. +- We use our multimodal framework to develop Multiflow, a state-of-the-art generative protein co-design model with the flexibility of multimodal protein generation. + +# 2. Background + +We aim to model discrete data where a sequence $x \in \{1, \dots, S\}^D$ has $D$ dimensions, each taking on one of $S$ states. For ease of exposition, we will assume $D = 1$ ; all results hold for $D > 1$ as discussed in App. E. We first explain a class of continuous time discrete stochastic processes called Continuous Time Markov Chains (CTMCs) (Norris, 1998) and then describe the link to probability flows. + +# 2.1. Continuous Time Markov Chains. + +A sequence trajectory $x_{t}$ over time $t\in [0,1]$ that follows a CTMC alternates between resting in its current state and periodically jumping to another randomly chosen state. We show example trajectories in Fig. 1B. The frequency and destination of the jumps are determined by the rate matrix $R_{t}\in \mathbb{R}^{S\times S}$ with the constraint its off-diagonal elements are non-negative. The probability $x_{t}$ will jump to a different state $j$ is $R_{t}(x_{t},j)\mathrm{d}t$ for the next infinitesimal time step $\mathrm{d}t$ . We can write the transition probability as + +$$ +\begin{array}{l} p _ {t + \mathrm {d} t | t} (j | x _ {t}) = \left\{ \begin{array}{l l} R _ {t} \left(x _ {t}, j\right) \mathrm {d} t & \text {f o r} j \neq x _ {t} \\ 1 + R _ {t} \left(x _ {t}, x _ {t}\right) \mathrm {d} t & \text {f o r} j = x _ {t} \end{array} \right. (1) \\ = \delta \left\{x _ {t}, j \right\} + R _ {t} \left(x _ {t}, j\right) \mathrm {d} t (2) \\ \end{array} +$$ + +where $\delta \{i,j\}$ is the Kronecker delta which is 1 when $i = j$ and is otherwise 0 and $R_{t}(x_{t},x_{t})\coloneqq -\sum_{k\neq x}R_{t}(x_{t},k)$ in order for $p_{t + \mathrm{dt}|t}(\cdot |i)$ to sum to 1. We use compact notation Eq.(2) in place of Eq. (1). Therefore, $p_{t + \mathrm{dt}|t}$ is a Categorical distribution with probabilities $\delta \{x_t,\cdot \} +R_t(x_t,\cdot)\mathrm{d}t$ that we denote as $\operatorname {Cat}(\delta \{x_t,j\} +R_t(x_t,j)\mathrm{d}t)$ + +$$ +j \sim p _ {t + \mathrm {d} t | t} (j | x _ {t}) \iff j \sim \operatorname {C a t} (\delta \left\{x _ {t}, j \right\} + R _ {t} (x _ {t}, j) \mathrm {d} t). +$$ + +In practice, we need to simulate the sequence trajectory with finite time intervals $\Delta t$ . A sequence trajectory can be simulated with Euler steps (Sun et al., 2023b) + +$$ +x _ {t + \Delta t} \sim \operatorname {C a t} \left(\delta \left\{x _ {t}, x _ {t + \Delta t} \right\} + R _ {t} \left(x _ {t}, x _ {t + \Delta t}\right) \Delta t\right), \tag {3} +$$ + +where the sequence starts from an initial sample $x_0 \sim p_0$ at time $t = 0$ . The rate matrix $R_{t}$ along with an initial distribution $p_0$ together define the CTMC. + +# 2.2. Kolmogorov equation + +For a sequence trajectory following the dynamics of a CTMC, we write its marginal distribution at time $t$ as $p_t(x_t)$ . The Kolmogorov equation allows us to relate the rate matrix $R_t$ to the change in $p_t(x_t)$ . It has the form: + +$$ +\partial_ {t} p _ {t} \left(x _ {t}\right) = \underbrace {\sum_ {j \neq x _ {t}} R _ {t} \left(j , x _ {t}\right) p _ {t} (j)} _ {\text {i n c o m i n g}} - \underbrace {\sum_ {j \neq x _ {t}} R _ {t} \left(x _ {t} , j\right) p _ {t} \left(x _ {t}\right)} _ {\text {o u t g o i n g}} \tag {4} +$$ + +The difference between the incoming and outgoing probability mass is the time derivative of the marginal $\partial_t p_t(x_t)$ . Using our definition of $R_{t}(x_{t},x_{t})$ , Eq. (4) can be succinctly written as $\partial_t p_t = R_t^\top p_t$ where the marginals are treated as probability mass vectors: $p_t\in [0,1]^S$ . This defines an Ordinary Differential Equation (ODE) in a vector space. We refer to the series of distributions $p_t\forall t\in [0,1]$ satisfying the ODE as a probability flow. + +Key terms: A CTMC is defined by an initial distribution $p_0$ and rate matrix $R_t$ . Samples along CTMC dynamics are called a sequence trajectory $x_t$ . The probability flow $p_t$ is the marginal distribution of $x_t$ at every time $t$ . We say $R_t$ generates $p_t$ if $\partial_t p_t = R_t^\top p_t \forall t \in [0,1]$ . + +# 3. Discrete Flow Models + +A Discrete Flow Model (DFM) is a Discrete data generative model built around a probability Flow that interpolates from noise to data. To sample new datapoints, we simulate a sequence trajectory that matches the noise to data probability flow. The flow construction allows us to combine DFM with continuous data flow models to define a multimodal generative model. Proofs for all propositions are in App. B. + +# 3.1. A Flow Model for Sampling Discrete Data + +We start by constructing the data generating probability flow referred to as the generative flow, $p_t$ , that we will later sample from using a CTMC. The generative flow interpolates from noise to data where $p_0(x_0) = p_{\mathrm{noise}}(x_0)$ and $p_1(x_1) = p_{\mathrm{data}}(x_1)$ . Since $p_t$ is complex to consider directly, the insight of flow matching is to define $p_t$ using a simpler datapoint conditional flow, $p_{t|1}(\cdot | x_1)$ that we will be able to write down explicitly. We can then define $p_t$ as + +$$ +p _ {t} \left(x _ {t}\right) := \mathbb {E} _ {p _ {\text {d a t a}} \left(x _ {1}\right)} \left[ p _ {t | 1} \left(x _ {t} \mid x _ {1}\right) \right]. \tag {5} +$$ + +The conditional flow, $p_{t|1}(\cdot | x_1)$ interpolates from noise to the datapoint $x_1$ . The conditioning allows us to write the flow down in closed form. We are free to define $p_{t|1}(\cdot | x_1)$ + +as needed for the specific application. The conditional flows we use in this paper linearly interpolate towards $x_{1}$ from a uniform prior or an artificially introduced mask state, $M$ : + +$$ +p _ {t \mid 1} ^ {\text {u n i f}} \left(x _ {t} \mid x _ {1}\right) = \operatorname {C a t} \left(t \delta \left\{x _ {1}, x _ {t} \right\} + (1 - t) \frac {1}{S}\right), \tag {6} +$$ + +$$ +p _ {t | 1} ^ {\mathrm {m a s k}} (x _ {t} | x _ {1}) = \mathrm {C a t} (t \delta \{x _ {1}, x _ {t} \} + (1 - t) \delta \{M, x _ {t} \}). +$$ + +We require our conditional flow to converge on the datapoint $x_{1}$ at $t = 1$ , i.e. $p_{t|1}(x_t|x_1) = \delta \{x_1,x_t\}$ . We also require that the conditional flow starts from noise at $t = 0$ , i.e. $p_{t|1}(x_t|x_1) = p_{\mathrm{noise}}(x_t)$ . In our examples, $p_{\mathrm{noise}}^{\mathrm{unif}}(x_t) = \frac{1}{S}$ and $p_{\mathrm{noise}}^{\mathrm{mask}}(x_t) = \delta \{M,x_t\}$ . These two requirements ensure our generative flow, $p_{t}$ , defined in Eq. (5) interpolates from $p_{\mathrm{noise}}$ at $t = 0$ towards $p_{\mathrm{data}}$ at $t = 1$ as desired. Next, we will show how to sample from the generative flow by exploiting $p_{t}$ 's decomposition into conditional flows. + +# 3.1.1. SAMPLING + +To sample from $p_{\mathrm{data}}$ using the generative flow, $p_t$ , we need access to a rate matrix $R_{t}(x_{t},j)$ that generates $p_t$ . Given a $R_{t}(x_{t},j)$ , we could use Eq. (3) to simulate a sequence trajectory that begins with marginal distribution $p_{\mathrm{noise}}$ at $t = 0$ and ends with marginal distribution $p_{\mathrm{data}}$ at $t = 1$ . The definition of $p_t$ in Eq. (5) suggests $R_{t}(x_{t},j)$ can also be derived as an expectation over a simpler conditional rate matrix. Define $R_{t}(x_{t},j|x_{1})$ as a datapoint conditional rate matrix that generates $p_{t|1}(x_t|x_1)$ . We now show $R_{t}(x_{t},j)$ can indeed be defined as an expectation over $R_{t}(x_{t},j|x_{1})$ . + +Proposition 3.1. If $R_{t}(x_{t},j|x_{1})$ is a rate matrix that generates the conditional flow $p_{t|1}(x_t|x_1)$ , then + +$$ +R _ {t} \left(x _ {t}, j\right) := \mathbb {E} _ {p _ {1 \mid t} \left(x _ {1} \mid x _ {t}\right)} \left[ R _ {t} \left(x _ {t}, j \mid x _ {1}\right) \right] \tag {7} +$$ + +is a rate matrix that generates $p_t$ defined in Eq. (5). The expectation is taken over $p_{1|t}(x_1|x_t) = \frac{p_{t|1}(x_t|x_1)p_{\mathrm{data}}(x_1)}{p_t(x_t)}$ . + +Our aim now is to calculate $R_{t}(x_{t},j|x_{1})$ and $p_{1|t}(x_1|x_t)$ to plug into Eq. (7). $p_{1|t}(x_1|x_t)$ is the distribution predicting clean data $x_{1}$ from noisy data $x_{t}$ and in Sec. 3.1.2, we will train a neural network $p_{1|t}^{\theta}(x_1|x_t)$ to approximate it. In Sec. 3.2, we will show how to derive $R_{t}(x_{t},j|x_{1})$ in closed form. Sampling pseudo-code is provided in Alg. 1. + +# Algorithm 1 DFM Sampling + +1: init $t = 0, x_0 \sim p_0$ , choice of $R_t(x_t, \cdot | x_1)$ (Sec. 3.2) +2: while $t < 1$ do +3: $R_{t}^{\theta}(x_{t},\cdot)\gets \mathbb{E}_{p_{1|t}^{\theta}(x_{1}|x_{t})}[R_{t}(x_{t},\cdot |x_{1})]$ +4: $x_{t + \Delta t}\sim \mathrm{Cat}\left(\delta \left\{x_t,x_{t + \Delta t}\right\} +R_t^\theta (x_t,x_{t + \Delta t})\Delta t\right)$ +5: $t\gets t + \Delta t$ +6: end while +7: return $x_{1}$ + +We discuss further CTMC sampling methods in App. G. Our construction of the generative flow from conditional flows + +Table 1. Comparison between continuous space linear interpolant flow models and DFMs with masking. Both start with a conditional flow $p_{t|1}(x_t|x_1)$ interpolating between data and noise. For continuous, $p_{t|1}(x_t|x_1) = \mathcal{N}(tx_1, (1 - t)^2I)$ and for discrete we use $p_{t|1}^{\mathrm{mask}}$ . Solving the Fokker-Planck or Kolmogorov equations with $p_{t|1}(x_t|x_1)$ gives a data conditioned process, specified either by the velocity field $(\nu_t)$ or the rate matrix $(R_t)$ . We train a model to learn the unconditional process – written analytically as the expected value of the conditional quantity – which is then used for sampling. The side-by-side comparison reveals the similar forms of each quantity. + +
QUANTITYCONTINUOUSDISCRETE
FOKKER-PLANCK-KOLMOGOROV∂tpt=-∇·(vtpt)∂tpt=RtTpt
CONDITIONAL PROCESSνt(xt|x1)=x1-xt/1-tRt(xt,j|x1)=δ{j,x1}/1-tδ{xt,M}
GENERATIVE PROCESSνt(xt)=Ep1|t(x1|xt)[νt(xt|x1)]Rt(xt,j)=Ep1|t(x1|xt)[R(xt,j|x1)]
GENERATIVE SAMPLINGxt+Δt=xt+vt(xt)Δtxt+Δt~Cat(δ{xt,xt+Δt}+Rt(xt,xt+Δt)Δt)
+ +is analogous to the construction of generative probability paths from conditional probability paths in Lipman et al. (2023), where instead of a continuous vector field generating the probability path, we have a rate matrix generating the probability flow. We expand on these links in Table. 1. + +# 3.1.2. TRAINING + +We train a neural network with parameters $\theta$ , $p_{1|t}^{\theta}(x_t|x_1)$ to approximate the true denoising distribution using the standard cross-entropy i.e. learning to predict the clean datapoint $x_1$ when given noisy data $x_t \sim p_{t|1}(x_t|x_1)$ . + +$$ +\mathcal {L} _ {\mathrm {c e}} = \mathbb {E} _ {p _ {\text {d a t a}} (x _ {1}) \mathcal {U} (t; 0, 1) p _ {t | 1} (x _ {t} | x _ {1})} \left[ \log p _ {1 | t} ^ {\theta} \left(x _ {1} \mid x _ {t}\right) \right] \tag {8} +$$ + +where $\mathcal{U}(t;0,1)$ is a uniform distribution on $[0,1]$ . $x_{t}$ can be sampled from $p_{t|1}(x_t|x_1)$ in a simulation-free manner by using the explicit form we wrote down for $p_{t|1}$ e.g. Eq. (6). In App. C, we analyse how $\mathcal{L}_{\mathrm{ce}}$ relates to the model log-likelihood and its relation to the Evidence Lower Bound (ELBO) used to train diffusion models. We stress that $\mathcal{L}_{\mathrm{ce}}$ does not depend on $R_{t}(x_{t},j|x_{1})$ and so we can postpone the choice of $R_{t}(x_{t},j|x_{1})$ until after training. This enables inference time flexibility in how our discrete data is sampled. + +# 3.2. Choice of Rate Matrix + +The missing piece in Eq. (7) is a conditional rate matrix $R_{t}(x_{t},j|x_{1})$ that generates the conditional flow $p_{t|1}(x_t|x_1)$ . There are many choices for $R_{t}(x_{t},j|x_{1})$ that all generate the same $p_{t|1}(x_t|x_1)$ as we later show in Prop. 3.3. In order to proceed, we start by giving one valid choice of rate matrix and from this, build a set of rate matrices that all generate $p_{t|1}$ . At inference time, we can then pick the rate matrix from this set that performs the best. Our starting choice for a rate matrix that generates $p_{t|1}$ is defined for $x_{t}\neq j$ as, + +$$ +R _ {t} ^ {*} \left(x _ {t}, j \mid x _ {1}\right) := \frac {\operatorname {R e L U} \left(\partial_ {t} p _ {t \mid 1} (j \mid x _ {1}) - \partial_ {t} p _ {t \mid 1} \left(x _ {t} \mid x _ {1}\right)\right)}{S \cdot p _ {t \mid 1} \left(x _ {t} \mid x _ {1}\right)} +$$ + +where $\mathrm{ReLU}(a) = \max (a,0)$ and $\partial_t p_{t|1}$ can be found by differentiating our explicit form for $p_{t|1}$ . This assumes $p_{t|1}(x_t|x_1) > 0$ , see App. B.2 for the full form. + +We first heuristically justify $R_{t}^{*}$ and then prove it generates $p_{t|1}(x_t|x_1)$ in Prop. 3.2. $R_{t}^{*}$ can be understood as distributing probability mass to states that require it. If $\partial_{t}p_{t|1}(j|x_{1}) > \partial_{t}p_{t|1}(x_{t}|x_{1})$ then state $j$ needs to gain more probability mass than the current state $x_{t}$ resulting in a positive rate. If $\partial_{t}p_{t|1}(j|x_{1})\leq \partial_{t}p_{t|1}(i|x_{1})$ then state $x_{t}$ should give no mass to state $j$ hence the ReLU. This rate should then be normalized by the probability mass in the current state. The ReLU ensures off-diagonal elements of $R_{t}^{*}$ are positive and is inspired by Zhang et al. (2023). + +Proposition 3.2. Assuming zero mass states, $p_{t|1}(j|x_1) = 0$ , have $\partial_t p_{t|1}(j|x_1) = 0$ , then $R_t^*$ generates $p_{t|1}(x_t|x_1)$ . + +The proof is easy to derive by substituting $R_{t}^{*}$ along with $p_{t|1}(x_t|x_1)$ into the Kolmogorov equation Eq. (4). The forms for $R_{t}^{*}(x_{t},j|x_{1})$ under $p_{t|1}^{\mathrm{unif}}$ or $p_{t|1}^{\mathrm{mask}}$ are simple + +$$ +R _ {t} ^ {* \text {u n i f}} = \frac {\delta \left\{x _ {1} , j \right\} \left(1 - \delta \left\{x _ {1} , x _ {t} \right\}\right)}{1 - t}, \quad R _ {t} ^ {* \text {m a s k}} = \frac {\delta \left\{x _ {1} , j \right\} \delta \left\{x _ {t} , M \right\}}{1 - t} +$$ + +as we derive in App. F. Using $R_{t}^{*}$ as a starting point, we now build out a set of rate matrices that all generate $p_{t|1}$ . We can accomplish this by adding on a second rate matrix that is in detailed balance with $p_{t|1}$ . + +Proposition 3.3. Let $R_{t}^{\mathrm{DB}}$ be a rate matrix that satisfies the detailed balance condition for $p_{t|1}$ , + +$$ +p _ {t | 1} (i \mid x _ {1}) R _ {t} ^ {\mathrm {D B}} (i, j \mid x _ {1}) = p _ {t | 1} (j \mid x _ {1}) R _ {t} ^ {\mathrm {D B}} (j, i \mid x _ {1}),. \tag {9} +$$ + +Let $R_{t}^{\eta}$ be defined by $R_{t}^{*}, R_{t}^{\mathrm{DB}}$ and parameter $\eta \in \mathbb{R}^{\geq 0}$ , + +$$ +R _ {t} ^ {\eta} := R _ {t} ^ {*} + \eta R _ {t} ^ {\text {D B}}. +$$ + +Then we have $R_{t}^{\eta}$ generates $p_{t|1}(x_t|x_1),\forall \eta \in \mathbb{R}^{\geq 0}$ + +The detailed balance condition intuitively enforces the incoming probability mass, $p_{t|1}(j|x_1)R_t^{\mathrm{DB}}(j,i|x_1)$ to equal the outgoing probability mass, $p_{t|1}(i|x_1)R_t^{\mathrm{DB}}(i,j|x_1)$ . Therefore, $R_{t}^{\mathrm{DB}}$ has no overall effect on the probability flow and can be added on to $R_{t}^{*}$ with the combined rate still generating $p_{t|1}$ . In many cases, Eq. (9) is easy to solve for $R_{t}^{\mathrm{DB}}$ due to the explicit relation between elements of $R_{t}^{\mathrm{DB}}$ as we exemplify in App. F. Detailed balance has been used previously in CTMC generative models (Campbell et al., 2022) to make post-hoc inference adjustments. + +CTMC stochasticity. We now have a set of rate matrices, $\{R_t^\eta : \eta \geq 0\}$ , that all generate $p_{t|1}$ . We can plug any one of these into our definition for $R_t(x_t, j)$ (Eq. (7)) and sample novel datapoints using Alg. 1. The chosen value for $\eta$ will influence the dynamics of the CTMC we are simulating. For large values of $\eta$ , the increased influence of $R_t^{\mathrm{DB}}$ will cause large exchanges of probability mass between states. This manifests as increasing the frequency of jumps occurring in the sequence trajectory. This leads to a short auto-correlation time for the CTMC and a high level of unpredictability of future states given the current state. We refer to the behaviour that $\eta$ controls as CTMC stochasticity. Fig. 1B shows examples of high and low $\eta$ . + +On a given task, we expect there to be an optimal stochasticity level. Additional stochasticity improves performance in continuous diffusion models (Cao et al., 2023; Xu et al., 2023), but too much stochasticity can result in a poorly performing degenerate CTMC. In some cases, setting $\eta = 0$ , i.e. using $R_{t}^{*}$ , results in the minimum possible number of jumps because the ReLU within $R_{t}^{*}$ removes state pairs that needlessly exchange mass (Zhang et al., 2023). + +Proposition 3.4. For $p_{t|1}^{\mathrm{unif}}$ and $p_{t|1}^{\mathrm{mask}}$ , $R_{t}^{*}$ generates $p_{t|1}$ whilst minimizing the expected number of jumps during the sequence trajectory. This assumes multi-dimensional data under the factorization assumptions listed in App. E. + +# 3.3. DFMs Recipe + +We now summarize the key steps of a DFM. PyTorch code for a minimal DFM implementation is provided in App. F. + +1. Define the desired noise schedule $p_{t|1}(x_t|x_1)$ (Sec. 3.1). +2. Train denoising model $p_{1|t}^{\theta}(x_1|x_t)$ (Sec. 3.1.2). +3. Choose rate matrix $R_{t}^{\eta}$ (Sec. 3.2). +4. Run sampling (Alg. 1). + +# 4. Multimodal Protein Generative Model + +Using our flow formulation on discrete state spaces, we can now combine a DFM with a flow on a continuous space to define a multimodal generative flow. We use this to perform protein joint structure-sequence generation. A protein can be modeled as a linear chain of residues, each with an assigned amino acid and 3D atomic coordinates. Protein codeign aims to jointly generate the amino acids (sequence) and coordinates (structure). Prior works have used a generative model on one modality (sequence or structure) with a separate model to predict the other (see Sec. 5). Instead, our approach uses a single generative model to jointly sample both modalities: a DFM for the sequence and a flow model, FrameFlow (Yim et al., 2023a), for the structure. We refer to our multimodal flow model as Multiflow. + +# 4.1. Multimodal Flows + +Following FrameFlow, we refer to the protein structure as the backbone atomic coordinates of each residue. We leave modeling side-chain atoms as a follow-up work. The structure is represented as elements of SE(3) to capture the rigidity of the local frames along the backbone (Yim et al., 2023b). A protein of length $D$ residues can then be represented as $\{(x^d,r^d,a^d)\}_{d = 1}^D$ where $x\in \mathbb{R}^3$ is the translation of the residue's Carbon- $\alpha$ atom, $r\in \mathrm{SO}(3)$ is a rotation matrix of the residue's local frame with respect to global reference frame, and $a\in \{1,\dots ,20\} \cup \{M\}$ is one of 20 amino acids or the mask state $M$ . For brevity, we refer to the residue state as $T^{d} = (x^{d},r^{d},a^{d})$ and let the full protein's structure and sequence as $\mathbf{T} = \{T^{d}\}_{d = 1}^{D}$ . We define the multimodal conditional flow as $p_{t|1}(\mathbf{T}_t|\mathbf{T}_1)$ which is a shorthand for a probability density over the continuous variables and a probability mass function over the discrete variables. We define $p_{t|1}(\mathbf{T}_t|\mathbf{T}_1)$ to factorize over both dimensions and modality. + +$$ +p _ {t \mid 1} \left(\mathbf {T} _ {t} \mid \mathbf {T} _ {1}\right) := \prod_ {d = 1} ^ {D} p _ {t \mid 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right) p _ {t \mid 1} \left(r _ {t} ^ {d} \mid r _ {1} ^ {d}\right) p _ {t \mid 1} \left(a _ {t} ^ {d} \mid a _ {1} ^ {d}\right) \tag {10} +$$ + +Following Yim et al. (2023a), $p_{t|1}(x_t^d | x_1^d)$ and $p_{t|1}(r_t^d | r_1^d)$ are defined implicitly through specifying how samples $x_t^d, r_t^d$ are generated from $p_{t|1}(x_t^d | x_1^d)$ , $p_{t|1}(r_t^d | r_1^d)$ , + +$$ +x _ {t} ^ {d} = t x _ {1} ^ {d} + (1 - t) x _ {0} ^ {d}, x _ {0} ^ {d} \sim \mathcal {N} (0, I) \tag {11} +$$ + +$$ +r _ {t} ^ {d} = \exp_ {r _ {0} ^ {d}} \left(t \log_ {r _ {0} ^ {d}} \left(r _ {1} ^ {d}\right)\right), r _ {0} ^ {d} \sim \mathcal {U} _ {\mathrm {S O} (3)}, \tag {12} +$$ + +where $\exp$ and $\log$ are the exponential and logarithmic maps. $\mathcal{U}_{\mathrm{SO}(3)}$ is the uniform distribution on SO(3). Following Sec. 3, $p_{t|1}(a_t^d | a_1^d)$ is defined explicitly. + +$$ +p _ {t \mid 1} \left(a _ {t} ^ {d} \mid a _ {1} ^ {d}\right) = \operatorname {C a t} \left(t \delta \left\{a _ {1} ^ {d}, a _ {t} ^ {d} \right\} + (1 - t) \delta \left\{M, a _ {t} ^ {d} \right\}\right) \tag {13} +$$ + +Our conditional trajectory that follows this conditional flow will be an ODE on the continuous modalities with a CTMC for the amino acids. The conditional ODE on translations and rotations is parameterized through conditional velocities $v_{x}^{d}(x_{t}^{d}|x_{1}^{d}) \in \mathbb{R}^{3}$ , $v_{r}^{d}(r_{t}^{d}|r_{1}^{d}) \in \mathrm{Tan}_{r_{t}^{d}}\mathrm{SO}(3)$ (Yim et al., 2023a). $v_{x}^{d}$ is a standard Euclidean vector field whereas $v_{r}^{d}$ is a vector field on the Riemannian Manifold SO(3) (Chen & Lipman, 2023). The trajectory can be simulated using Euler steps with step size $\Delta t$ , + +$$ +x _ {t + \Delta t} ^ {d} = x _ {t} ^ {d} + v _ {x} ^ {d} (x _ {t} ^ {d} | x _ {1} ^ {d}) \Delta t +$$ + +$$ +r _ {t + \Delta t} ^ {d} = \exp_ {r _ {t} ^ {d}} \left(\Delta t \cdot v _ {r} ^ {d} \left(r _ {t} ^ {d} \mid r _ {1} ^ {d}\right)\right) \tag {14} +$$ + +$$ +a _ {t + \Delta t} ^ {d} \sim \mathrm {C a t} \big (\delta \left\{a _ {t} ^ {d}, a _ {t + \Delta t} ^ {d} \right\} + R _ {t} ^ {d} (a _ {t} ^ {d}, a _ {t + \Delta t} ^ {d} | a _ {1} ^ {d}) \Delta t \big). +$$ + +We choose $v_{x}^{d}$ such that it individually generates the $p_{t|1}(x_t^d | x_1^d)$ given by Eq. (11) if it were simulated by itself in $\mathbb{R}^3$ . Similarly, for $v_{r}^{d}$ and $R_{t}^{d}$ , they are chosen such + +that they individually generate $p_{t|1}(r_t^d|r_1^d)$ (Eq. (12)) and $p_{t|1}(a_t^d |a_1^d)$ (Eq. (13)) respectively. The explicit forms for $v_x^d, v_r^d$ and $R_{t}^{d}$ are as follows, + +$$ +v _ {x} ^ {d} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right) = \left(x _ {1} ^ {d} - x _ {t} ^ {d}\right) / (1 - t) +$$ + +$$ +v _ {r} ^ {d} \left(r _ {t} ^ {d} \mid r _ {1} ^ {d}\right) = \log_ {r _ {t} ^ {d}} \left(r _ {1} ^ {d}\right) / (1 - t) \tag {15} +$$ + +$$ +R _ {t} ^ {d} \left(a _ {t} ^ {d}, j ^ {d} | a _ {1} ^ {d}\right) = \delta \left\{j ^ {d}, a _ {1} ^ {d} \right\} \delta \left\{a _ {t} ^ {d}, M \right\} / (1 - t). +$$ + +with velocities following Yim et al. (2023a) and rate matrix derived in App. F.1 assuming $\eta = 0$ . The following proposition verifies these choices are consistent with our initial definition of $p_{t|1}(\mathbf{T}_t|\mathbf{T}_1)$ . + +Proposition 4.1. The multimodal process defined by Eq. (15) has the flow $p_{t|1}(\mathbf{T}_t|\mathbf{T}_1)$ given by Eq. (10). + +We would now like to be able to sample a trajectory that follows the unconditional flow. Mirroring Prop. 3.1, we again find that the desired unconditional velocities and rate matrix are expectations of their respective conditional quantities. + +Proposition 4.2. The following velocities and rate matrix together generate $p_t(\mathbf{T}_t) = \mathbb{E}_{p_{\mathrm{data}}(\mathbf{T}_1)}[p_{t|1}(\mathbf{T}_t|\mathbf{T}_1)]$ , + +$$ +v _ {x} ^ {d} (\mathbf {T} _ {t}) = \mathbb {E} _ {p _ {1 | t} (x _ {1} ^ {d} | \mathbf {T} _ {t})} \left[ v _ {x} ^ {d} (x _ {t} ^ {d} | x _ {1} ^ {d}) \right] +$$ + +$$ +v _ {r} ^ {d} (\mathbf {T} _ {t}) = \mathbb {E} _ {p _ {1 | t} (r _ {1} ^ {d} | \mathbf {T} _ {t})} \left[ v _ {r} ^ {d} (r _ {t} ^ {d} | r _ {1} ^ {d}) \right] +$$ + +$$ +R _ {t} ^ {d} \left(\mathbf {T} _ {t}, j ^ {d}\right) = \mathbb {E} _ {p _ {1 | t} \left(a _ {1} ^ {d} \mid \mathbf {T} _ {t}\right)} \left[ R _ {t} ^ {d} \left(a _ {t} ^ {d}, j ^ {d} \mid a _ {1} ^ {d}\right) \right]. +$$ + +We note that even though the conditional flow is defined to factorize over modality and dimension, the unconditional generative flow has coupled modalities and dimensions because each velocity and rate matrix depends on the entire corrupted protein state $\mathbf{T}_t$ . + +Thus far, we have assumed the same noise level in all modalities. To enable flexible sampling options, we can use a noise level for the structure, $t$ , that is independent to the noise level of the sequence, $\tilde{t}$ (Albergo et al., 2023). We let $\mathbf{T}_{t,\tilde{t}} = (x_t^{1:D}, r_t^{1:D}, a_t^{1:D})$ and use a conditional flow of + +$$ +p _ {t, \tilde {t} | 1} (\mathbf {T} _ {t, \tilde {t}} | \mathbf {T} _ {1}) = \prod_ {d = 1} ^ {D} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d}) p _ {t | 1} (r _ {t} ^ {d} | r _ {1} ^ {d}) p _ {\tilde {t} | 1} (a _ {\tilde {t}} ^ {d} | a _ {1} ^ {d}). +$$ + +The unconditional flow then becomes $p_{t,\tilde{t}}(\mathbf{T}_{t,\tilde{t}}) = \mathbb{E}_{p_{\mathrm{data}}(\mathbf{T}_1)}[p_{t,\tilde{t}|1}(\mathbf{T}_{t,\tilde{t}}|\mathbf{T}_1)]$ , with the expectations for the unconditional velocities and rate matrix in Prop. 4.2 now computed using $p_{1|t,\tilde{t}}(\cdot |\mathbf{T}_{t,\tilde{t}})$ instead of $p_{1|t}(\cdot |\mathbf{T}_t)$ . + +# 4.2. Training + +During training, our network will take as input the noised protein $\mathbf{T}_{t,\tilde{t}}$ and predict the denoised translations $\hat{x}_1(\mathbf{T}_{t,\tilde{t}})$ , rotations $\hat{r}_1(\mathbf{T}_{t,\tilde{t}})$ , and amino acid distribution $p_{\theta}(a_1|\mathbf{T}_{t,\tilde{t}})$ . We then parameterize the unconditional velocities and rate + +matrix in terms of these predicted quantities. + +$$ +\nu_ {x} ^ {d} (\mathbf {T} _ {t, \tilde {t}}) = \frac {\hat {x} _ {1} ^ {d} (\mathbf {T} _ {t , \tilde {t}}) - x _ {t} ^ {d}}{1 - t}, \nu_ {r} ^ {d} (\mathbf {T} _ {t, \tilde {t}}) = \frac {\log_ {r _ {t} ^ {d}} (\hat {r} _ {1} ^ {d} (\mathbf {T} _ {t , \tilde {t}}))}{1 - t}, +$$ + +$$ +R _ {\tilde {t}} ^ {\theta d} \left(\mathbf {T} _ {t, \tilde {t}}, j\right) = \frac {p _ {\theta} \left(a _ {1} ^ {d} = j \mid \mathbf {T} _ {t , \tilde {t}}\right)}{1 - \tilde {t}} \delta \left\{a _ {\tilde {t}} ^ {d}, M \right\}. +$$ + +In order for these to match their optimum values given in Prop. 4.2, we minimize the following loss + +$$ +\mathbb {E} \left[ \sum_ {d = 1} ^ {D} \frac {\left| \left| \hat {x} _ {1} ^ {d} \left(\mathbf {T} _ {t , \tilde {t}}\right) - x _ {1} ^ {d} \right| \right| ^ {2}}{1 - t} - \log p _ {\theta} \left(a _ {1} ^ {d} \mid \mathbf {T} _ {t, \tilde {t}}\right) \right. \tag {16} +$$ + +$$ +\left. + \frac {\left| \left| \log_ {r _ {t} ^ {d}} \big (\hat {r} _ {1} ^ {d} (\mathbf {T} _ {t}) \big) - \log_ {r _ {t} ^ {d}} \big (r _ {1} ^ {d} \big) \right| \right| ^ {2}}{1 - t} \right]. +$$ + +where the expectation is over $t, \tilde{t} \sim \mathcal{U}(0,1)$ , $\mathbf{T}_{1,1} \sim p_{\mathrm{data}}$ and $\mathbf{T}_{t,\tilde{t}} \sim p_{t,\tilde{t}|1}(\mathbf{T}_{t,\tilde{t}}|\mathbf{T}_{1,1})$ . Our independent $t, \tilde{t}$ objective enables the model to learn over different relative levels of corruption between the sequence and structure. Eq. (16) corresponds to the flow matching loss for continuous data and the DFMs loss Eq. (8) for discrete amino acids. The neural network architecture is modified from FrameFlow with a larger transformer, smaller Invariant Point Attention, and extra multi-layer perception head to predict the amino acid logits. + +# 4.3. Sampling + +To sample the generative model, we use the update equations from Eq. (14) but with the learned unconditional velocities and rate matrix. Furthermore, we find sample quality can be improved by using the exponential rate scheduler for rotations from Bose et al. (2023). In practice, this means $v_{r}^{d}$ has the following form, + +$$ +\nu_ {r} ^ {d} (\mathbf {T} _ {t, \tilde {t}}) = c \cdot \log_ {r _ {t} ^ {d}} (\hat {r} _ {1} ^ {d} (\mathbf {T} _ {t, \tilde {t}})). +$$ + +We use $c = 10$ following (Yim et al., 2023a). When sampling the amino acids, we also found it beneficial to utilize purity (Tang et al., 2022) to choose which indices to unmask at each step. The advantage of training with decoupled time schedules is that we have freedom to arbitrarily sample with any combination of $(t, \tilde{t})$ . We use this to perform conditional inpainting where one of the modalities is fixed by setting $t$ or $\tilde{t}$ equal to 1. For example, setting $t = 1$ then using Euler steps to update $\tilde{t}$ from $0 \rightarrow 1$ performs sequence generation conditioned on the structure. We summarize the capabilities in Fig. 1C and in Table. 2. + +Table 2. Flexible multimodal sampling. + +
CodesignInverse foldingForward folding
xt,rtt:0→1t=1t:0→1
a\tilde{t}\tilde{t}:0→1\tilde{t}:0→1\tilde{t}=1
+ +# 5. Related Work + +Discrete Diffusion Models. Our continuous time flow builds on work that extends discrete diffusion (Hoogeboom + +et al., 2021; Austin et al., 2021) to continuous time (Campbell et al., 2022; Sun et al., 2023b; Santos et al., 2023; Lou et al., 2023) but we simplify and extend the framework. We are not restricted to noising processes that can be defined by a matrix exponential as we just write $p_{t|1}$ down directly and we have the freedom to choose $R_{t}(x_{t},j|x_{1})$ at inference time rather than being restricted to the time reversal. We show how DFMs encompasses prior discrete diffusion models in App. H. For molecular retrosynthesis, Igashov et al. (2023) also considered a data conditional process, but did not build a modeling framework around it. Zhang et al. (2023) constructed low-stochasticity rate matrices and their derivation provides the building blocks of Prop. 3.2. Some works have built a multimodal diffusion model for molecule generation (Peng et al., 2023; Vignac et al., 2023b; Hua et al., 2023) whereas we focus on protein co-design using flows. We discuss further related work in App. D. + +Protein Generation. Diffusion and flow models have risen in popularity for generating novel and diverse protein backbones (Yim et al., 2023b; a; Bose et al., 2023; Lin & AlQuraishi, 2023; Ingraham et al., 2023). RFDiffusion achieved notable success by generating proteins validated in wet-lab experiments (Watson et al., 2023). However, these methods required a separate model for sequence generation. Some works have focused only on sequence generation with diffusion models (Alamdari et al., 2023; Gruver et al., 2023; Yang et al., 2023; Yi et al., 2023). We focus on co-design which aims to jointly generate the structure and sequence. + +Prior works have attempted co-design. ProteinGenerator (Lisanza et al., 2023) performs Euclidean diffusion over one-hot amino acids while predicting the structure at each step with RosettaFold (Baek et al., 2021). Conversely, Protpardelle (Chu et al., 2023) performs Euclidean diffusion over structure while iteratively predicting the sequence. Multiflow instead uses a generative model over both the structure and sequence which allows for flexibility in conditioning at inference time (see Sec. 6.2.1). Luo et al. (2022); Shi et al. (2022) are co-design methods, but are limited to generating CDR loops on antibodies. Lastly, Anand & Achim (2022) presented diffusion on structure and sequence, but did not report standard evaluation metrics nor is code available. + +# 6. Experiments + +We first show that tuning stochasticity at sample time improves pure discrete generative modeling performance by modeling text data. We then evaluate Multiflow, the first flow model on discrete and continuous state spaces. We show Multiflow provides state-of-the-art-performance on protein generation compared to prior approaches that do not generate using a true multimodal generative model. Finally, we investigate Multiflow's crossmodal properties of how varying the sequence sampling affects the structure. + +![](images/c6f37adcc0cd288cc5b06dff81f7cec337b7d009052cb1ca428a9c101bcb5edb.jpg) +Figure 2. Negative log-likelihood as measured by GPT-J-6B versus sample entropy. For DFM, D3PM and autoregressive, we sweep the logit temperature for $p_{1|t}^{\theta}(x_1|x_t)$ over $\{0.5, 0.6, \dots, 1\}$ . We aim to minimize NLL whilst staying close to the dataset entropy. + +# 6.1. Text Modeling + +Set-up. We model the text dataset, text8 (Mahoney, 2006), which is 100MB of text from English Wikipedia. We model at the character level, following (Austin et al., 2021), with $S = 28$ categories for 26 lowercase letters, a white-space and a mask token. We split the text into chunks of length $D = 256$ . We train a DFM using $p_{t|1}^{\mathrm{mask}}$ and parameterize the denoising network using a transformer with 86M non-embedding parameters, full details are in App. I. + +Results. Text samples are evaluated following Strudel et al. (2022). A much larger text model, we use GPT-J-6B (Wang & Komatsuzaki, 2021), is used to evaluate the negative log-likelihood (NLL) of the generated samples. The NLL metric alone can be gamed by repeating similar sequences, so the token distribution entropy is also measured. Good samples should have both low NLL and entropy close to the data distribution. For a given value of $\eta$ , we create a Pareto-frontier in NLL vs entropy space by varying the temperature applied to the $p_{1|t}^{\theta}(x_1|x_t)$ logits during the softmax operation. Fig. 2 plots the results for varying levels of $\eta$ and sampling temperature. For comparison, we also include results for the discrete diffusion D3PM method with absorbing state corruption (Austin et al., 2021) as well as the Score Entropy Discrete Diffusion (SEDD) method of Lou et al. (2023) using both uniform and absorbing style corruption. SEDD does not have logits that can be temperature scaled and so only single points in NLL vs entropy space are shown. We find the DFM performs better than D3PM and SEDD due to our additional sample time flexibility. We are able to choose the value of $\eta$ that optimizes the Pareto-frontier at sample time (here $\eta = 15$ ) whereas D3PM and SEDD do not have this flexibility. We show the full $\eta$ sweep in App. I and show the frontier for $\eta = 0$ in Fig. 2. When $\eta = 0$ , performance is similar to D3PM due to DFMs being a continuous time generalization of D3PM at this setting, see App. H.2. We also include results for an autoregressive model in Fig. 2 for reference; however, we note this is not a complete like-for-like comparison as autoregressive models require much less + +compute to train than diffusion based models (Gulrajani & Hashimoto, 2023). + +# 6.2. Protein generation + +Metrics. Evaluating the quality of structure-sequence samples is performed with self-consistency which measures how consistent a generated sequence is with a generated structure by testing how accurately a protein folding network can predict the structure from the sequence. Specifically, either AlphaFold2 (Jumper et al., 2021) or ESMFold (Lin et al., 2023), is first used to predict a structure given only the generated sequence. Our results will use ESMFold but we show results with AlphaFold2 in App. J. Then, we calculate scRMSD: the Root Mean Squared Deviation between the generated and predicted structure's backbone atoms. The generated structure is called designable if scRMSD < 2Å. + +Structure-only generative models such as RFdiffusion first use ProteinMPNN (PMPNN) (Dauparas et al., 2022) to predict a sequence given the generated structure in order to then be able to use the self-consistency metric. We present three variants of self-consistency: + +- Co-design 1: use the sampled (structure, sequence) pair. +- $PMPNN8$ : take only the sampled structure and predict 8 sequences with PMPNN. Then use ESMFold to predict a new structure for each sequence. The final structure-sequence pair is the original sampled structure along with the PMPNN sequence with minimum scRMSD. +- $PMPNN1$ : same as PMPNN 8 except PMPNN only generates one sequence. + +PMPNN 8 and PMPNN 1 evaluate only the quality of a model's generated structures whereas, for co-design models, Co-design 1 evaluates the quality of a model's generated (structure, sequence) pairs. The comparison between PMPNN 1 and Co-design 1 allows for evaluating the quality of co-designed sequences. PMPNN 8 is the procedure used in prior structure-only works. As our main metric of sample quality, we report designability as the percentage of designable samples. As a further sanity check, designable samples are then evaluated on diversity and novelty. We use FoldSeek (van Kempen et al., 2022) to report diversity as the number of unique clusters while novelty is the average TM-score (Zhang & Skolnick, 2005) of each sample to its most similar protein in PDB. + +Training. Our training data consisted of length 60-384 proteins from the Protein Data Bank (PDB) (Berman et al., 2000) that were curated in Yim et al. (2023b) for a total of 18684 proteins. Training took 200 epochs over 3 days on 4 A6000 Nvidia GPUs using the AdamW optimizer (Loshchilov & Hutter, 2017) with learning rate 0.0001. + +Distillation. Multiflow with PDB training generated highly designable structures. However, the co-designed sequences + +suffered from lower designability than PMPNN. Our analysis revealed the original PDB sequences achieved worse designability than PMPNN. We sought to improve performance by distilling knowledge from other models. To accomplish this, we first replaced the original sequence of each structure in the training dataset with the lowest scRMSD sequence out of 8 generated by PMPNN conditioned on the structure. Second, we generated synthetic structures of random lengths between 60-384 using an initial Multiflow model and added those that passed PMPNN 8 designability into the training dataset with the lowest scRMSD PMPNN sequence. We found that we needed to add only an extra 4179 examples to the original set of 18684 proteins to see a dramatic improvement. This procedure can be seen as a single step of reinforced self training (ReST) (Gulcehre et al., 2023). + +# 6.2.1. CO-DESIGN RESULTS. + +Following RFdiffusion's benchmark, we sample 100 proteins for each length 70, 100, 200, and 300. We sample Multiflow with 500 timesteps using a temperature of 0.1 (PMPNN also uses 0.1) and stochasticity level $\eta = 20$ . We compare our structure quality to state-of-the-art structure generation method RFdiffusion. For co-design, we compare to Protpardelle and ProteinGenerator. All methods were ran using their publicly released code and evaluated identically. + +Our results are presented in Table. 3 where we report the average of three seeds for each metric - see Table. 6 for results with standard error. We find that Multiflow's co-design capabilities surpass previous co-design methods, none of which use a joint multimodal generation process. Multiflow generates sequences that are consistent with the generated structure at a comparable level to PMPNN which we see through comparing the Co-design 1 and PMPNN 1 designability. On pure structure generation, we find that Multiflow outperforms all baselines in terms of structure quality measured by PMPNN 8 designability. Multiflow also attains comparable diversity and novelty to previous approaches. We ablate our use of distillation and find that distillation results in overall designability improvements while also improving diversity. Finally, we train our exact same architecture except only modeling the structure on the distilled dataset using the loss presented in Yim et al. (2023a). We find our joint structure-sequence model achieves the same structural quality as the structure-only version, however, additionally including the sequence in our generative process induces extra structural diversity. + +Crossmodal modulation. We next investigate how modulating the CTMC stochasticity of the sequence affects the structural properties of sampled proteins. Fig. 3 shows that varying the stochasticity level $\eta$ results in a change of the secondary structure composition (Kabsch & Sander, 1983) of the sampled proteins. This is an example of the flexibil + +Table 3. Co-design results. Abbreviations: Designability (DES.), Diversity (DIV.), Novelty (NOV.). For Protpardelle, we report Co-design 1 as same numbers as PMPNN 1 since their co-design approach employs PMPNN. We note this is not co-generation since PMPNN is used while Multiflow explicitly learns co-generation without using PMPNN. + +
METHODCo-DESIGN 1PMPNN 8PMPNN 1
DES. (↑)DIV. (↑)Nov. (↓)DES.DIV.Nov.DES.DIV.Nov.
PROTPARDELLE0.63*38*0.60*0.90470.590.63380.60
PROTEINGENERATOR0.37350.690.89750.650.78640.66
RFDIFFUSIONN/A0.871580.630.661110.64
MULTIFLOW0.861430.610.991560.610.881430.61
MULTIFLOW W/O DISTILLATION0.42720.620.891260.620.711010.63
MULTIFLOW W/O SEQUENCEN/A0.991160.630.86970.62
+ +![](images/3125b1fa788a512004e4fc881e202678de25ff3d2da99ad87b929d8449ae6794.jpg) +Figure 3. Multiflow structural properties. Average proportion of residues that are part of an alpha helix or beta strand versus the CTMC stochasticity level. Proportions of helices or strands can be desirable based on the family of proteins to generate (Vinothkumar & Henderson, 2010). Error bars show the standard error. + +ity our multimodal framework provides to tune properties between data modalities at inference time. + +# 6.2.2. FORWARD AND INVERSE FOLDING + +Multiflow can achieve state-of-the-art codeign performance, but can accomplish more tasks as described in Fig. 1B and Table. 4. Expanding Multiflow to achieve competitive performance on all tasks is a future work. Here, we take the same model weights for co-design and evaluate forward and inverse folding without additional training. We compare performance to ESMFold and ProteinPMNN which are specialized models for forward and inverse folding. We curated a clustered test-out set of 449 monomeric proteins with length $< 400$ from the PDB using a date split of our training set. Details of forward/inverse folding and these experiments can be found in App. J. We find Multiflow can achieve very close performance with ProteinMPNN while it achieves poor results compared to ESMFold. This highlights a limitation that Multiflow cannot perform competitively at every generation task, but leaves exciting future work for a potential general-purpose generative model. + +Table 4. Forward and inverse folding: mean $\pm$ std. + +
MethodInverse folding scRMSD (↓)Forward folding RMSD (↓)
ProteinMPNN1.9 ± 2.7N/A
ESMFoldN/A2.7 ± 3.9
Multiflow2.2 ± 2.615.3 ± 4.5
+ +# 7. Discussion + +We presented Discrete Flow Models (DFMs), a flow based generative model framework by making analogy to continuous state space flow models. Our formulation is simple to implement, removes limitations in defining corruption processes, and provides more sampling flexibility for improved performance compared to previous discrete diffusion models. Our framework enables easy application to multimodal generative problems which we apply to protein co-design. The combination of a DFM and FrameFlow enables state-of-the-art co-design with Multiflow. Future work includes to develop more domain specific models with DFMs and improve Multiflow's performance on all protein generation tasks including sidechain modeling. + +# Acknowledgments + +The authors would like to thank Ricardo Baptista, Mathieu Le Provost, George Deligiannidis, Joe Benton, Bowen Jing, Hannes Stärk, Emile Mathieu, Luhuan Wu, Timur Garipov, Rachel Wu, Mingyu Choi, Sidney Lisanza, and Woody Ahern for helpful discussions. AC acknowledges support from the EPSRC CDT in Modern Statistics and Statistical Machine Learning (EP/S023151/1) JY was supported in part by an NSF-GRFP. JY, RB, and TJ acknowledge support from NSF Expeditions grant (award 1918839: Collaborative Research: Understanding the World Through Code), Machine Learning for Pharmaceutical Discovery and Synthesis (MLPDS) consortium, the Abdul Latif Jameel Clinic for Machine Learning in Health, the DTRA Discovery of Medical Countermeasures Against New and Emerging (DOMANE) threats program, the DARPA Accelerated Molecular Discovery program and the Sanofi Computational Antibody Design grant. IF is supported by the Office of Naval Research, the Howard Hughes Medical Institute (HHMI), and NIH (NIMH-MH129046). The authors would like to acknowledge the use of the University of Oxford Advanced Research Computing (ARC) facility in carrying out this work. http://dx.doi.org/10.5281/zenodo.22558. + +# Impact statement + +In this paper we work to advance general purpose generative modeling techniques, specifically those used for modeling discrete and multimodal data. We apply these techniques to the task of protein generation. Improving protein modeling capabilities can have wide ranging societal impacts and care must be taken to ensure these impacts are positive. For example, improved modeling capabilities can help design better enzymes and drug candidates that can then go on to improve the lives of many people. Conversely, these general purpose techniques could also be misused to design toxic substances. To mitigate these risks, we do not present any specific methods to apply Multiflow to tasks that could be easily adjusted to the design of harmful substances without expert knowledge. + +# References + +Alamdari, S., Thakkar, N., van den Berg, R., Lu, A. X., Fusi, N., Amini, A. P., and Yang, K. K. Protein generation with evolutionary diffusion: sequence is all you need. bioRxiv, pp. 2023-09, 2023. +Albergo, M. S. and Vanden-Eijnden, E. Building normalizing flows with stochastic interpolants. International Conference on Learning Representations, 2023. +Albergo, M. S., Boffi, N. M., Lindsey, M., and Vanden-Eijnden, E. Multimarginal generative modeling with stochastic interpolants. arXiv preprint arXiv:2310.03695, 2023. +Anand, N. and Achim, T. Protein structure and sequence generation with equivariant denoising diffusion probabilistic models. arXiv preprint arXiv:2205.15019, 2022. +Austin, J., Johnson, D. D., Ho, J., Tarlow, D., and Van Den Berg, R. Structured denoising diffusion models in discrete state-spaces. Advances in Neural Information Processing Systems, 2021. +Baek, M., DiMaio, F., Anishchenko, I., Dauparas, J., Ovchinnikov, S., Lee, G. R., Wang, J., Cong, Q., Kinch, L. N., Schaeffer, R. D., et al. Accurate prediction of protein structures and interactions using a three-track neural network. Science, 373(6557):871-876, 2021. +Bect, J. A unifying formulation of the fokker-planck-kolmogorov equation for general stochastic hybrid systems. Nonlinear Analysis: Hybrid Systems, 2010. +Bengio, Y., Lahlou, S., Deleu, T., Hu, E. J., Tiwari, M., and Bengio, E. Gfrownet foundations. Journal of Machine Learning Research, 2023. +Berman, H. M., Westbrook, J., Feng, Z., Gilliland, G., Bhat, T. N., Weissig, H., Shindyalov, I. N., and Bourne, P. E. + +The protein data bank. Nucleic acids research, 28(1): 235-242, 2000. +Bose, A. J., Akhound-Sadegh, T., Fatras, K., Huguet, G., Rector-Brooks, J., Liu, C.-H., Nica, A. C., Korablyov, M., Bronstein, M., and Tong, A. Se (3)-stochastic flow matching for protein backbone generation. arXiv preprint arXiv:2310.02391, 2023. +Campbell, A., Benton, J., De Bortoli, V., Rainforth, T., Deligiannidis, G., and Doucet, A. A continuous time framework for discrete denoising models. Advances in Neural Information Processing Systems, 2022. +Cao, Y., Chen, J., Luo, Y., and Zhou, X. Exploring the optimal choice for generative processes in diffusion models: Ordinary vs stochastic differential equations. arXiv preprint arXiv:2306.02063, 2023. +Chen, R. T. and Lipman, Y. Riemannian flow matching on general geometries. arXiv preprint arXiv:2302.03660, 2023. +Chen, T., Zhang, R., and Hinton, G. Analog bits: Generating discrete data using diffusion models with self-conditioning. International Conference on Learning Representations, 2023a. +Chen, Z., Yuan, H., Li, Y., Kou, Y., Zhang, J., and Gu, Q. Fast sampling via de-randomization for discrete diffusion models. arXiv preprint arXiv:2312.09193, 2023b. +Chow, S.-N., Huang, W., Li, Y., and Zhou, H. Fokkerplanck equations for a free energy functional or markov process on a graph. Archive for Rational Mechanics and Analysis, 2012. +Chu, A. E., Cheng, L., El Nesr, G., Xu, M., and Huang, P.-S. An all-atom protein generative model. *bioRxiv*, pp. 2023–05, 2023. +Dauparas, J., Anishchenko, I., Bennett, N., Bai, H., Ragotte, R. J., Milles, L. F., Wicky, B. I., Courbet, A., de Haas, R. J., Bethel, N., et al. Robust deep learning-based protein sequence design using proteinmpnn. Science, 378 (6615):49-56, 2022. +Dehghani, M., Djolonga, J., Mustafa, B., Padlewski, P., Heek, J., Gilmer, J., Steiner, A. P., Caron, M., Geirhos, R., Alabdulmohsin, I., et al. Scaling vision transformers to 22 billion parameters. International Conference on Machine Learning, 2023. +Del Moral, P. and Penev, S. Stochastic processes: From applications to theory. CRC Press, 2017. +Dieleman, S., Sartran, L., Roshannai, A., Savinov, N., Ganin, Y., Richemond, P. H., Doucet, A., Strudel, R., + +Dyer, C., Durkan, C., et al. Continuous diffusion for categorical data. arXiv preprint arXiv:2211.15089, 2022. +Floto, G., Jonsson, T., Nica, M., Sanner, S., and Zhu, E. Z. Diffusion on the probability simplex. arXiv preprint arXiv:2309.02530, 2023. +Gao, W., Mahajan, S. P., Sulam, J., and Gray, J. J. Deep learning in protein structural modeling and design. *Patterns*, 1(9), 2020. +Gillespie, D. T. Approximate accelerated stochastic simulation of chemically reacting systems. The Journal of Chemical Physics, 2001. +Gong, S., Li, M., Feng, J., Wu, Z., and Kong, L. Diffuseq: Sequence to sequence text generation with diffusion models. International Conference on Learning Representations, 2023. +Graves, A., Srivastava, R. K., Atkinson, T., and Gomez, F. Bayesian flow networks. arXiv preprint arXiv:2308.07037, 2023. +Gruver, N., Stanton, S., Frey, N. C., Rudner, T. G., Hotzel, I., Lafrance-Vanasse, J., Rajpal, A., Cho, K., and Wilson, A. G. Protein design with guided discrete diffusion. arXiv preprint arXiv:2305.20009, 2023. +Gulcehre, C., Paine, T. L., Srinivasan, S., Konyushkova, K., Weerts, L., Sharma, A., Siddhant, A., Ahern, A., Wang, M., Gu, C., et al. Reinforced self-training (rest) for language modeling. arXiv preprint arXiv:2308.08998, 2023. +Gulrajani, I. and Hashimoto, T. B. Likelihood-based diffusion language models. Advances in Neural Information Processing Systems, 2023. +Han, X., Kumar, S., and Tsvetkov, Y. Ssd-lm: Semi-autoregressive simplex-based diffusion language model for text generation and modular control. arXiv preprint arXiv:2210.17432, 2022. +Hastings, W. K. Monte carlo sampling methods using markov chains and their applications. Biometrika, 1970. +Ho, J., Jain, A., and Abbeel, P. Denoising diffusion probabilistic models. Advances in neural information processing systems, 2020. +Hoogeboom, E., Nielsen, D., Jaini, P., Forre, P., and Welling, M. Argmax flows and multinomial diffusion: Learning categorical distributions. Advances in Neural Information Processing Systems, 2021. +Hua, C., Luan, S., Xu, M., Ying, R., Fu, J., Ermon, S., and Precup, D. Mudiff: Unified diffusion for complete molecule generation. arXiv preprint arXiv:2304.14621, 2023. + +Huang, C.-W., Lim, J. H., and Courville, A. C. A variational perspective on diffusion-based generative models and score matching. Advances in Neural Information Processing Systems, 2021. +Igashov, I., Schneuing, A., Segler, M., Bronstein, M., and Correia, B. Retrobridge: Modeling retrosynthesis with markov bridges. arXiv preprint arXiv:2308.16212, 2023. +Ingraham, J. B., Baranov, M., Costello, Z., Barber, K. W., Wang, W., Ismail, A., Frappier, V., Lord, D. M., Ng-Thow-Hing, C., Van Vlack, E. R., et al. Illuminating protein space with a programmable generative model. Nature, 2023. +Jumper, J., Evans, R., Pritzel, A., Green, T., Figurnov, M., Ronneberger, O., Tunyasuvunakool, K., Bates, R., Žídek, A., Potapenko, A., et al. Highly accurate protein structure prediction with alphafold. Nature, 2021. +Kabsch, W. and Sander, C. Dictionary of protein secondary structure: pattern recognition of hydrogen-bonded and geometrical features. Biopolymers: Original Research on Biomolecules, 22(12):2577-2637, 1983. +Karras, T., Aittala, M., Aila, T., and Laine, S. Elucidating the design space of diffusion-based generative models. Advances in Neural Information Processing Systems, 35: 26565-26577, 2022. +Kingma, D. P. and Welling, M. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. +Kotelnikov, A., Baranchuk, D., Rubachev, I., and Babenko, A. Tabddpm: Modelling tabular data with diffusion models. International Conference on Machine Learning, 2023. +Li, X., Thickstun, J., Gulrajani, I., Liang, P. S., and Hashimoto, T. B. Diffusion-lm improves controllable text generation. Advances in Neural Information Processing Systems, 2022. +Lin, Y. and AlQuraishi, M. Generating novel, designable, and diverse protein structures by equivariantly diffusing oriented residue clouds. arXiv preprint arXiv:2301.12485, 2023. +Lin, Z., Akin, H., Rao, R., Hie, B., Zhu, Z., Lu, W., Smetanin, N., Verkuil, R., Kabeli, O., Shmueli, Y., et al. Evolutionary-scale prediction of atomic-level protein structure with a language model. Science, 379(6637): 1123-1130, 2023. +Lipman, Y., Chen, R. T., Ben-Hamu, H., Nickel, M., and Le, M. Flow matching for generative modeling. International Conference on Learning Representations, 2023. + +Lisanza, S. L., Gershon, J. M., Tipps, S. W. K., Arnoldt, L., Hendel, S., Sims, J. N., Li, X., and Baker, D. Joint generation of protein sequence and structure with rosettafold sequence space diffusion. bioRxiv, pp. 2023-05, 2023. +Liu, X., Gong, C., and Liu, Q. Flow straight and fast: Learning to generate and transfer data with rectified flow. International Conference on Learning Representations, 2023. +Loshchilov, I. and Hutter, F. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017. +Lou, A., Meng, C., and Ermon, S. Discrete diffusion language modeling by estimating the ratios of the data distribution. Advances in Neural Information Processing Systems, 2023. +Luo, S., Su, Y., Peng, X., Wang, S., Peng, J., and Ma, J. Antigen-specific antibody design and optimization with diffusion-based generative models for protein structures. Advances in Neural Information Processing Systems, 35: 9754-9767, 2022. +Ma, N., Goldstein, M., Albergo, M. S., Boffi, N. M., Vanden-Eijnden, E., and Xie, S. Sit: Exploring flow and diffusion-based generative models with scalable interpolant transformers. arXiv preprint arXiv:2401.08740, 2024. +Mahoney, M. Large text compression benchmark. 2006. URL https://www.mattmahoney.net/ dc/text.html. +Meng, C., Choi, K., Song, J., and Ermon, S. Concrete score matching: Generalized score matching for discrete data. Advances in Neural Information Processing Systems, 2022. +Metropolis, N., Rosenbluth, A. W., Rosenbluth, M. N., Teller, A. H., and Teller, E. Equation of state calculations by fast computing machines. The journal of chemical physics, 1953. +Norris, J. R. Markov chains. Cambridge university press, 1998. +Peng, X., Guan, J., Liu, Q., and Ma, J. Moldiff: Addressing the atom-bond inconsistency problem in 3d molecule diffusion generation. International Conference on Machine Learning, 2023. +Pereira, J., Simpkin, A. J., Hartmann, M. D., Rigden, D. J., Keegan, R. M., and Lupas, A. N. High-accuracy protein structure prediction in casp14. Proteins: Structure, Function, and Bioinformatics, 89(12):1687-1699, 2021. +Qin, Y., Vignac, C., and Frossard, P. Sparse training of discrete diffusion models for graph generation. arXiv preprint arXiv:2311.02142, 2023. + +Radford, A., Wu, J., Child, R., Luan, D., Amodei, D., Sutskever, I., et al. Language models are unsupervised multitask learners. OpenAI blog, 2019. +Rezende, D. J., Mohamed, S., and Wierstra, D. Stochastic backpropagation and approximate inference in deep generative models. International conference on machine learning, 2014. +Richemond, P. H., Dieleman, S., and Doucet, A. Categorical sdes with simplex diffusion. arXiv preprint arXiv:2210.14784, 2022. +Santos, J. E., Fox, Z. R., Lubbers, N., and Lin, Y. T. Blackout diffusion: Generative diffusion models in discrete-state spaces. International Conference on Machine Learning, 2023. +Shaul, N., Chen, R. T., Nickel, M., Le, M., and Lipman, Y. On kinetic optimal probability paths for generative models. International Conference on Machine Learning, 2023. +Shi, C., Wang, C., Lu, J., Zhong, B., and Tang, J. Protein sequence and structure co-design with equivariant translation. arXiv preprint arXiv:2210.08761, 2022. +Shih, A., Sadigh, D., and Ermon, S. Training and inference on any-order autoregressive models the right way. Advances in Neural Information Processing Systems, 2022. +Sohl-Dickstein, J., Weiss, E., Maheswaranathan, N., and Ganguli, S. Deep unsupervised learning using nonequilibrium thermodynamics. International Conference on Machine Learning, 2015. +Song, Y., Sohl-Dickstein, J., Kingma, D. P., Kumar, A., Ermon, S., and Poole, B. Score-based generative modeling through stochastic differential equations. International Conference on Learning Representations, 2020. +Strudel, R., Tallec, C., Altché, F., Du, Y., Ganin, Y., Mensch, A., Grathwohl, W., Savinov, N., Dieleman, S., Sifre, L., et al. Self-conditioned embedding diffusion for text generation. arXiv preprint arXiv:2211.04236, 2022. +Sun, H., Dai, H., Dai, B., Zhou, H., and Schuurmans, D. Discrete Langevin samplers via wasserstein gradient flow. International Conference on Artificial Intelligence and Statistics, 2023a. +Sun, H., Yu, L., Dai, B., Schuurmans, D., and Dai, H. Score-based continuous-time discrete diffusion models. International Conference on Learning Representations, 2023b. +Tang, Z., Gu, S., Bao, J., Chen, D., and Wen, F. Improved vector quantized diffusion models. arXiv preprint arXiv:2205.16007, 2022. + +Trippe, B. L., Yim, J., Tischer, D., Baker, D., Broderick, T., Barzilay, R., and Jaakkola, T. Diffusion probabilistic modeling of protein backbones in 3d for the motif-scaffolding problem. arXiv preprint arXiv:2206.04119, 2022. +van Kempen, M., Kim, S., Tumescheit, C., Mirdita, M., Söding, J., and Steinegger, M. Foldseek: fast and accurate protein structure search. bioRxiv, 2022. +Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I. Attention is all you need. Advances in neural information processing systems, 2017. +Vignac, C., Krawczuk, I., Siraudin, A., Wang, B., Cevher, V., and Frossard, P. Digress: Discrete denoising diffusion for graph generation. International Conference on Learning Representations, 2023a. +Vignac, C., Osman, N., Toni, L., and Frossard, P. Midi: Mixed graph and 3d denoising diffusion for molecule generation. arXiv preprint arXiv:2302.09048, 2023b. +Vinothkumar, K. R. and Henderson, R. Structures of membrane proteins. Quarterly reviews of biophysics, 43(1): 65-158, 2010. +Wang, B. and Komatsuzaki, A. GPT-J-6B: A 6 Billion Parameter Autoregressive Language Model. https://github.com/kingoflolz/mesh-transformer-jax, 2021. +Wang, H., Fu, T., Du, Y., Gao, W., Huang, K., Liu, Z., Chandak, P., Liu, S., Van Katwyk, P., Deac, A., et al. Scientific discovery in the age of artificial intelligence. Nature, 620(7972):47-60, 2023. +Watson, J. L., Juergens, D., Bennett, N. R., Trippe, B. L., Yim, J., Eisenach, H. E., Ahern, W., Borst, A. J., Ragotte, R. J., Milles, L. F., et al. De novo design of protein structure and function with rfdiffusion. Nature, 2023. +Xu, Y., Deng, M., Cheng, X., Tian, Y., Liu, Z., and Jaakkola, T. Restart sampling for improving generative processes. Advance in Neural Information Processing Systems, 2023. +Yang, J. J., Yim, J., Barzilay, R., and Jaakkola, T. Fast non-autoregressive inverse folding with discrete diffusion. arXiv preprint arXiv:2312.02447, 2023. +Yi, K., Zhou, B., Shen, Y., Lio, P., and Wang, Y. G. Graph denoising diffusion for inverse protein folding. arXiv preprint arXiv:2306.16819, 2023. +Yim, J., Campbell, A., Foong, A. Y., Gastegger, M., Jimenez-Luna, J., Lewis, S., Satorras, V. G., Veeling, B. S., Barzilay, R., Jaakkola, T., et al. Fast protein backbone generation with se (3) flow matching. arXiv preprint arXiv:2310.05297, 2023a. + +Yim, J., Trippe, B. L., De Bortoli, V., Mathieu, E., Doucet, A., Barzilay, R., and Jaakkola, T. Se (3) diffusion model with application to protein backbone generation. arXiv preprint arXiv:2302.02277, 2023b. +Zhang, P., Yin, H., Li, C., and Xie, X. Formulating discrete probability flow through optimal transport. arXiv preprint arXiv:2311.03886, 2023. +Zhang, Y. and Skolnick, J. Tm-align: a protein structure alignment algorithm based on the tm-score. Nucleic acids research, 33(7):2302-2309, 2005. + +# Appendix to: + +# Generative Flows on Discrete State-Spaces: Enabling Multimodal Flows with Applications to Protein Co-Design + +# A. Organization of Appendix + +The Appendix is organized as follows. App. B provides proofs for all propositions in the main text. App. C analyses the cross entropy objective used to train DFM and links controlling the cross entropy to controlling the model log-likelihood. App. D discusses further related work. App. E shows how DFM can be applied to multidimensional data through applying factorization assumptions to $p_{t|1}$ . App. F gives concrete realizations with PyTorch code for DFM using the masking or uniform forms for $p_{t|1}$ . App. G discusses methods for sampling from CTMCs and discusses their relation to our sampling method. App. H compares DFM to classical discrete diffusion models in discrete and continuous time finding that they can be fit within the DFM framework. App. I gives further details and results for our text experiment. App. J gives further details and results for our protein co-design experiments. + +# B. Proofs + +Notation When writing rate matrices, $R_{t}(i,j)$ , we will assume $i \neq j$ unless otherwise explicitly stated. + +We write $R_{t}(i)\coloneqq \sum_{j\neq i}R_{t}(i,j)$ + +# B.1. Proof of Proposition 3.1 + +We simply take the expectation with respect to $p_{\mathrm{data}}$ of both sides of the Kolmogorov equation for $p_{t|1}(x_t|x_1)$ and $R_{t}(x_{t},j|x_{1})$ . Note we use the fact that $R_{t}(i,i) = -\sum_{j\neq i}R_{t}(i,j)$ for compactness. + +$$ +\partial_ {t} p _ {t | 1} \left(x _ {t} \mid x _ {1}\right) = \sum_ {j} R _ {t} \left(j, x _ {t} \mid x _ {1}\right) p _ {t | 1} \left(j \mid x _ {1}\right) +$$ + +$$ +\mathbb {E} _ {p _ {\text {d a t a}} (x _ {1})} \left[ \partial_ {t} p _ {t | 1} \left(x _ {t} \mid x _ {1}\right) \right] = \mathbb {E} _ {p _ {\text {d a t a}} (x _ {1})} \left[ \sum_ {j} R _ {t} \left(j, x _ {t} \mid x _ {1}\right) p _ {t | 1} \left(j \mid x _ {1}\right) \right] +$$ + +$$ +\partial_ {t} \mathbb {E} _ {p _ {\text {d a t a}} (x _ {1})} [ p _ {t | 1} (x _ {t} | x _ {1}) ] = \sum_ {j} \sum_ {x _ {1}} p _ {\text {d a t a}} (x _ {1}) p _ {t | 1} (j | x _ {1}) R _ {t} (j, x _ {t} | x _ {1}) +$$ + +$$ +\partial_ {t} p _ {t} \left(x _ {t}\right) = \sum_ {j} \sum_ {x _ {1}} p _ {t} (j) p _ {1 | t} \left(x _ {1} \mid j\right) R _ {t} \left(j, x _ {t} \mid x _ {1}\right) +$$ + +$$ +\partial_ {t} p _ {t} \left(x _ {t}\right) = \sum_ {j} \mathbb {E} _ {p _ {1 | t} \left(x _ {1} \mid j\right)} \left[ R _ {t} \left(j, x _ {t} \mid x _ {1}\right) \right] p _ {t} (j) +$$ + +Where we notice that the final line is the Kolmogorov equation for a CTMC with marginals $p_t(x_t)$ and rate $\mathbb{E}_{p_{1|t}(x_1|x_t)}[R_t(x_t,j|x_t)]$ . Therefore we have shown that $\mathbb{E}_{p_{1|t}(x_1|x_t)}[R_t(x_t,j|x_t)]$ generate $p_t(x_t)$ . + +# B.2. Proof of Proposition 3.2 + +In the main text we provided the form for $R_{t}^{*}$ under the assumption that $p_{t|1}(j|x_1) > 0$ for all $j$ . Before proving Prop. 3.2, we first give the full form for $R_{t}^{*}$ . First, assuming $x_{t} \neq j$ and $p_{t|1}(x_t|x_1) > 0$ we have, + +$$ +R _ {t} ^ {*} (x _ {t}, j | x _ {1}) := \frac {\operatorname {R e L U} \left(\partial_ {t} p _ {t | 1} (j | x _ {1}) - \partial_ {t} p _ {t | 1} (x _ {t} | x _ {1})\right)}{\mathcal {Z} _ {t} p _ {t | 1} (x _ {t} | x _ {1})} +$$ + +where $\mathrm{ReLU}(a) = \max(a, 0)$ and $\mathcal{Z}_t$ is the number of states that have non-zero mass, $\mathcal{Z}_t = |\{x_t : p_{t|1}(x_t|x_1) > 0\}|$ . $R_t^*(x_t, j|x_1) = 0$ when $p_{t|1}(x_t|x_1) = 0$ or $p_{t|1}(j|x_1) = 0$ . When $x_t = j$ , $R_t^*(x_t, x_t|x_1) = -\sum_{j \neq x_t} R_t^*(x_t, j|x_1)$ as we have defined before. + +For our proof, we assume that $p_{t|1}(j|x_1) = 0 \Rightarrow \partial_t p_{t|1}(j|x_1) = 0$ . This assumption means that when we have dead states with zero probability mass, they cannot be resurrected and gain probability mass in the future. We begin the proof with the Kolmogorov equation for processes conditioned on $x_1$ , + +$$ +\partial_ {t} p _ {t | 1} \left(x _ {t} \mid x _ {1}\right) = \sum_ {j \neq x _ {t}} R _ {t} (j, x _ {t} \mid x _ {1}) p _ {t | 1} (j \mid x _ {1}) - \sum_ {j \neq x _ {t}} R _ {t} \left(x _ {t}, j \mid x _ {1}\right) p _ {t | 1} \left(x _ {t} \mid x _ {1}\right) \tag {17} +$$ + +We will now verify that $R_{t}^{*}$ satisfies this Kolmogorov equation and thus generates the desired $p_{t|1}(x_t|x_1)$ conditional flow. We will first check that the Kolmogorov equation is satisfied when $p_{t|1}(x_t|x_1) > 0$ . With this form of rate matrix, the RHS of equation (17) becomes + +$$ +\begin{array}{l} \mathrm {R H S} = \sum_ {j \neq x _ {t}, p _ {t | 1} (j | x _ {1}) > 0} \frac {\operatorname {R e L U} \left(\partial_ {t} p _ {t | 1} \left(x _ {t} | x _ {1}\right) - \partial_ {t} p _ {t | 1} (j | x _ {1})\right)}{\mathcal {Z} _ {t} p _ {t | 1} (j | x _ {1})} p _ {t | 1} (j | x _ {1}) \\ - \sum_ {j \neq x _ {t}, p _ {t | 1} (j | x _ {1}) > 0} \frac {\operatorname {R e L U} \left(\partial_ {t} p _ {t | 1} (j | x _ {1}) - \partial_ {t} p _ {t | 1} \left(x _ {t} \mid x _ {1}\right)\right)}{\mathcal {Z} _ {t} p _ {t | 1} \left(x _ {t} \mid x _ {1}\right)} p _ {t | 1} \left(x _ {t} \mid x _ {1}\right) \\ = \frac{1}{\mathcal{Z}_{t}}\sum_{\substack{j\neq x_{t},p_{t|1}(j|x_{1}) > 0}}\operatorname {ReLU}\left(\partial_{t}p_{t|1}(x_{t}|x_{1}) - \partial_{t}p_{t|1}(j|x_{1})\right) \\ -\frac{1}{\mathcal{Z}_{t}}\sum_{\substack{j\neq x_{t},p_{t|1}(j|x_{1}) > 0}}\operatorname {ReLU}\left(\partial_{t}p_{t|1}(j|x_{1}) - \partial_{t}p_{t|1}(x_{t}|x_{1})\right) \\ = \frac{1}{\mathcal{Z}_{t}}\sum_{\substack{j\neq x_{t},p_{t|1}(j|x_{1}) > 0}}\bigl(\partial_{t}p_{t|1}(x_{t}|x_{1}) - \partial_{t}p_{t|1}(j|x_{1})\bigr) \\ = \frac {\mathcal {Z} _ {t} - 1}{\mathcal {Z} _ {t}} \partial_ {t} p _ {t | 1} \left(x _ {t} \mid x _ {1}\right) - \frac {1}{\mathcal {Z} _ {t}} \sum_ {j \neq x _ {t}, p _ {t | 1} (j \mid x _ {1}) > 0} \partial_ {t} p _ {t | 1} (j \mid x _ {1}) \\ = \frac {\mathcal {Z} _ {t} - 1}{\mathcal {Z} _ {t}} \partial_ {t} p _ {t | 1} \left(x _ {t} \mid x _ {1}\right) - \frac {1}{\mathcal {Z} _ {t}} \partial_ {t} \left(1 - p _ {t | 1} \left(x _ {t} \mid x _ {1}\right)\right) \\ = \frac {\mathcal {Z} _ {t} - 1}{\mathcal {Z} _ {t}} \partial_ {t} p _ {t | 1} \left(x _ {t} \mid x _ {1}\right) + \frac {1}{\mathcal {Z} _ {t}} \partial_ {t} p _ {t | 1} \left(x _ {t} \mid x _ {1}\right) \\ = \partial_ {t} p _ {t | 1} (x _ {t} | x _ {1}) \\ = \mathrm {L H S} \\ \end{array} +$$ + +In the case that $p_{t|1}(x_t|x_1) = 0$ by assumption we have that $\partial_t p_{t|1}(x_t|x_1) = 0$ . We have both $R_t^*(x_t, j|x_1) = 0$ and $R_t^*(j, x_t|x_1) = 0$ because $p_{t|1}(x_t|x_1) = 0$ . Therefore we have $\mathrm{LHS} = \mathrm{RHS} = 0$ and thus the Kolmogorov equation is satisfied. + +Intuitively, we require the assumption that dead states cannot be resurrected because $R_{t}^{*}$ is designed such that all states can equally distribute the mass flux requirements of making sure the marginal derivatives $\partial_t p_{t|1}(x_t|x_1)$ are satisfied. If there is a state for which $p_{t|1}(x_t|x_1) = 0$ but $\partial_t p_{t|1}(x_t|x_1) > 0$ then this state would require mass from other states but could not provide any mass of its own since $p_{t|1}(x_t|x_1) = 0$ . This would then violate the sharing symmetry required for our form of $R_{t}^{*}$ . We note that this assumption is not strictly satisfied for the masking interpolant at $t = 0$ or $t = 1$ and not satisfied for the uniform interpolant at $t = 1$ . However, it is satisfied for any $t \in (0,1)$ and so we can conceptualize starting our process at $t = \epsilon$ , $\epsilon \ll 1$ , $\epsilon > 0$ , approximating a sample from $p_{\epsilon}(x_{\epsilon})$ with a sample from $p_0(x_0)$ and running the process until $t = 1 - \epsilon$ and stopping here. The approximation can be made arbitrarily accurate by taking $\epsilon \rightarrow 0$ . + +# B.3. Proof of Proposition 3.3 + +A rate matrix that satisfies the detailed balance condition (9) will result in $\partial_t p_{t|1}(i|x_1) = 0$ when simulating with this rate. This can be seen by substituting into the conditional Kolmogorov equation (17) + +$$ +\partial_ {t} p _ {t | 1} \left(x _ {t} \mid x _ {1}\right) = \sum_ {j \neq x _ {t}} R _ {t} ^ {\mathrm {D B}} \left(j, x _ {t} \mid x _ {1}\right) p _ {t | 1} \left(j \mid x _ {1}\right) +$$ + +$$ +- \sum_ {j \neq x _ {t}} R _ {t} ^ {\mathrm {D B}} \left(x _ {t}, j \mid x _ {1}\right) p _ {t \mid 1} \left(x _ {t} \mid x _ {1}\right) +$$ + +$$ +\begin{array}{l} \partial_ {t} p _ {t | 1} \left(x _ {t} \mid x _ {1}\right) = \sum_ {j \neq x _ {t}} R _ {t} ^ {\mathrm {D B}} \left(x _ {t}, j \mid x _ {1}\right) p _ {t | 1} \left(x _ {t} \mid x _ {1}\right) \\ - \sum_ {j \neq x _ {t}} R _ {t} ^ {\mathrm {D B}} \left(x _ {t}, j \mid x _ {1}\right) p _ {t \mid 1} \left(x _ {t} \mid x _ {1}\right) \\ \end{array} +$$ + +$$ +\partial_ {t} p _ {t \mid 1} \left(x _ {t} \mid x _ {1}\right) = 0 +$$ + +Given a rate matrix $R_{t}(x_{t},j|x_{1})$ that generates $p_{t|1}(x_t|x_1)$ , we first prove that $R_{t}(x_{t},j|x_{1}) + \eta R_{t}^{\mathrm{DB}}(x_{t},j|x_{1})$ also generates $p_{t|1}(x_t|x_1)$ for any $\eta \in \mathbb{R}^{\geq 0}$ . We show this by verifying that the combined rate matrix satisfies the Kolmogorov equation for conditional flow $p_{t|1}(x_t|x_1)$ . The right hand side of the Kolmogorov equation is + +$$ +\begin{array}{l} \mathrm {R H S} = \sum_ {j} \left(R _ {t} \left(x _ {t}, j \mid x _ {1}\right) + \eta R _ {t} ^ {\mathrm {D B}} \left(x _ {t}, j \mid x _ {1}\right)\right) p _ {t | 1} (j \mid x _ {1}) \\ = \sum_ {j} R _ {t} (x _ {t}, j | x _ {1}) p _ {t | 1} (j | x _ {1}) + \eta \underbrace {\sum_ {j} R _ {t} ^ {\mathrm {D B}} (x _ {t} , j | x _ {1}) p _ {t | 1} (j | x _ {1})} _ {= 0} \\ = \sum_ {j} R _ {t} \left(x _ {t}, j x _ {1}\right) p _ {t | 1} (j | x _ {1}) \\ = \partial_ {t} p _ {t | 1} (x _ {t} | x _ {1}) \\ = \mathrm {L H S} \\ \end{array} +$$ + +where we have used the fact that $R^{\mathrm{DB}}$ is in detailed balance with $p_{t|1}(j|x_1)$ and that $R_t(x_t,j|x_1)$ generates $p_{t|1}$ . Since $R_{t}^{*}$ is a matrix that generates $p_{t|1}$ , we also have the stated result as a specific case: $R_{t}^{*} + \eta R_{t}^{\mathrm{DB}}$ generates $p_{t|1}$ . + +# B.4. Proof of Proposition 3.4 + +We will assume we have $D$ dimensional data $x_{1}^{1:D}$ with each $x_{1}^{d} \in \{1, \dots, S\}$ . We give an overview of how our method operates in the multi-dimensional case in Appendix E. Namely, we assume that our conditional flow factorizes as $p_{t|1}(x_{t}^{1:D}|x_{1}^{1:D}) = \prod_{d=1}^{D} p_{t|1}(x_{t}^{d}|x_{1}^{d})$ . We also assume that our rate matrix is 0 for jumps that vary more than 1 dimension at a time. Our optimality results are derived under these assumptions. + +# B.4.1. MASKING INTERPOLANT + +We first prove that $R_{t}^{*}$ achieves the minimum number of transitions for the masking interpolant case. We have + +$$ +p _ {t | 1} \left(x _ {t} ^ {1: D} \mid x _ {1} ^ {1: D}\right) = \prod_ {d = 1} ^ {D} p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right) +$$ + +with + +$$ +p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d}) = t \delta \left\{x _ {t} ^ {d}, x _ {1} ^ {d} \right\} + (1 - t) \delta \left\{x _ {t} ^ {d}, M \right\} +$$ + +Our rate in dimension $d$ is + +$$ +R _ {t} ^ {* d} (x _ {t} ^ {d}, j ^ {d} | x _ {1} ^ {d}) = \left\{ \begin{array}{l l} \frac {\operatorname {R e L U} \big (\partial_ {t} p _ {t | 1} (j ^ {d} | x _ {1} ^ {d}) - \partial_ {t} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d}) \big)}{\mathcal {Z} _ {t} ^ {d} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d})} & \text {f o r} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d}) > 0, p _ {t | 1} (j ^ {d} | x _ {1} ^ {d}) > 0 \\ = 0 & \text {o t h e r w i s e} \end{array} \right. +$$ + +with $\mathcal{Z}_t^d = |\{j^d:p_{t|1}(j^d|x_1^d) > 0\} |$ . Substituting in $\partial_t p_{t|1}$ and $p_{t|1}$ in the masking case gives + +$$ +R _ {t} ^ {* d} (x _ {t} ^ {d}, j ^ {d} | x _ {1} ^ {d}) = \frac {1}{1 - t} \delta \left\{x _ {t} ^ {d}, M \right\} \delta \left\{j ^ {d}, x _ {1} ^ {d} \right\} +$$ + +We refer to Appendix F.1 for the details of this derivation. Since $R_{t}^{*d}$ depends only on $x_{t}^{d}, j^{d}$ and $x_{1}^{d}$ and not values in any other dimensions, each dimension propagates independently and we can consider each dimension in isolation. Consider the + +process for dimension $d$ . The CTMC begins in state $x_0^d = M$ . We have $R_t^{*d}(x_t^d = M, j^d|x_1^d) = \frac{1}{1 - t}\delta \left\{j^d, x_1^d\right\}$ . Therefore, the only possible next state that the process can jump to is $x_1^d$ . Once the process has jumped to $x_1^d$ , the rate then becomes $R_t^{*d}(x_t^d = x_1^d, j^d|x_1^d) = 0$ . We also know that the process must jump because $p_1(x_t^d|x_1^d) = \delta \left\{x_t^d, x_1^d\right\}$ , $x_1^d \neq M$ and we know our rate matrix traverses our desired margins by Proposition 3.2. Therefore, exactly one jump is made in dimension $d$ . In total, our $D$ dimensional process will make $D$ jumps. Under our factorization assumption, during a jump no more than one dimension can change value. Therefore, the absolute minimum number of jumps for any process that starts at $x_0^{1:D}$ with $x_0^d = M, \forall d$ and ends at $x_1^{1:D}$ , $x_1^d \neq M, \forall d$ is $D$ . Our prior distribution is $p_0(x_0^d) = \delta \left\{x_0^d, M\right\}$ and so for any $x_0$ sample, we will always need to make $D$ jumps. Therefore, the minimum expected number of jumps is $D$ and $R_t^*$ achieves this minimum. + +# B.4.2. UNIFORM INTERPOLANT + +We now prove that $R_{t}^{*}$ achieves the minimum number of transitions for the uniform interpolant case. The conditional flow is + +$$ +p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d}) = t \delta \left\{x _ {t} ^ {d}, x _ {1} ^ {d} \right\} + (1 - t) \frac {1}{S} +$$ + +With this interpolant, our rate matrix becomes + +$$ +R _ {t} ^ {* d} \left(x _ {t} ^ {d}, j ^ {d} | x _ {1} ^ {d}\right) = \frac {1}{1 - t} \delta \left\{j ^ {d}, x _ {1} ^ {d} \right\} \left(1 - \delta \left\{x _ {t} ^ {d}, x _ {1} ^ {d} \right\}\right) +$$ + +We refer to Appendix F.2 for the derivation. As before, $R_{t}^{*d}$ depends only on the values in dimension $d$ , $x_{t}^{d}, j^{d}, x_{1}^{d}$ and therefore each process propagates independently in each dimension and we can consider each dimension in isolation. Considering dimension $d$ , the process begins in state $x_{0}^{d}$ . Both $x_{0}^{d} = x_{1}^{d}$ and $x_{0}^{d} \neq x_{1}^{d}$ are possible in the uniform interpolant case. In the case that $x_{0}^{d} = x_{1}^{d}$ , then $R_{t}^{*d} = 0$ for all $t$ and therefore no jumps are made in this dimension. In the case that $x_{0}^{d} \neq x_{1}^{d}$ then before any jump is made we have $R_{t}^{*d}(x_{t}^{d}, j^{d}|x_{1}^{d}) = \frac{1}{1 - t}\delta\left\{j^{d}, x_{1}^{d}\right\}$ and so the only possible next state the process can jump to is $x_{1}^{d}$ . Once the process has jumped to $x_{1}^{d}$ , the rate then becomes $R_{t}^{*}(x_{t}^{d} = x_{1}^{d}, j^{d}|x_{1}^{d}) = 0$ and so no more jumps are made. We also know that the process must jump at some point because $p_{1}(x_{t}^{d}|x_{1}^{d}) = \delta\left\{x_{t}^{d}, x_{1}^{d}\right\}$ and we know our rate matrix traverses our desired margins by Proposition 3.2. Therefore, in the case that $x_{0}^{d} \neq x_{1}^{d}$ , exactly one jump is made for the process in dimension $d$ . In total, the number of jumps made in all $D$ dimensions is $d_{H}(x_{0}, x_{1}) = |\{d : x_{0}^{d} \neq x_{1}^{d}\}|$ which is the Hamming distance between $x_{0}$ and $x_{1}$ . The expected number of jumps for our process with $R_{t}^{*}$ is thus $\mathbb{E}_{p_{0}(x_{0})p_{\mathrm{data}}(x_{1})}[d_{H}(x_{0}, x_{1})]$ . + +Now consider an optimal process that makes the minimum number of jumps when starting from $x_0$ and meets our factorization assumptions. By this assumption, during a jump only one dimension can change in value. Clearly we have that the minimum number of jumps required to get from $x_0$ to $x_1$ is $d_H(x_0, x_1)$ . Therefore, for this optimal process we also have that the minimum number of expected jumps is $\mathbb{E}_{p_0(x_0) p_{\mathrm{data}}(x_1)}[d_H(x_0, x_1)]$ . Therefore, $R_t^*$ achieves the minimum expected number of jumps. + +# B.4.3. DISCUSSION + +We have proven $x_{1}$ conditioned optimality only for the two simple conditional flows featured in the main text and we note that this result is not generally true for any conditional flow. Intuitively this is because $R_{t}^{*}$ treats the distribution of mass symmetrically between states, considering only the local differences in $\partial_{t}p_{t|1}$ between pairs of states. In general, the optimal rate would need to solve a global programming problem. + +We also note that although we have masking and uniform optimality for $R_{t}^{*}(x_{t},j|x_{1})$ when conditioned on $x_{1}$ , this is not necessarily the case when we consider the unconditional version $\mathbb{E}_{p_{1|t}(x_1|x_t)}[R_t^* (x_t,j|x_1)]$ . There may exist rate matrices that achieve a lower number of average jumps and successfully pass through the unconditional marginals $p_t(x_t) = \mathbb{E}_{p_{\mathrm{data}}(x_1)}\left[p_{t|1}(x_t|x_1)\right]$ . This is analogous to continuous flow-based methods which can create optimal straight-line paths when conditioned on the end point $x_{1}$ , but don't necessarily achieve the optimal transport when considering the unconditional vector field (Shaul et al., 2023). + +# B.5. Proof of Proposition 4.1 + +We have that the individual velocities and rate matrices independently generate their respective flows in each dimension. Specifically, for $x_{t}^{d}\in \mathbb{R}^{3}$ , we have that it satisfies the following Fokker-Planck equation, + +$$ +\partial_ {t} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d}) = - \nabla^ {(d)} \cdot \left(v _ {x} ^ {d} (x _ {t} ^ {d} | x _ {1} ^ {d}) p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d})\right). +$$ + +where $\nabla^{(d)}\cdot$ is the divergence operator for elements in dimension $d$ . Similarly for $r_t\in \mathrm{SO}(3)$ + +$$ +\partial_ {t} p _ {t | 1} (r _ {t} ^ {d} | r _ {1} ^ {d}) = - \nabla^ {(d)} \cdot \left(v _ {r} ^ {d} (r _ {t} ^ {d} | r _ {1} ^ {d}) p _ {t | 1} (r _ {t} ^ {d} | r _ {1} ^ {d})\right), +$$ + +where the divergence operator now acts on elements in $\mathrm{Tan}_{r_t^d}\mathrm{SO}(3)$ (Yim et al., 2023b). Finally, for $a_{t}^{d}$ , we have the familiar Kolmogorov equation, + +$$ +\partial_ {t} p _ {t | 1} (a _ {t} ^ {d} | a _ {1} ^ {d}) = \sum_ {j} R _ {t} (j, a _ {t} ^ {d} | a _ {1} ^ {d}) p _ {t | 1} ^ {d} (j | a _ {1} ^ {d}). +$$ + +For the joint space $\mathbf{T} \in (\mathbb{R}^3 \times \mathrm{SO}(3) \times \{1, \dots, 20, M\})^D$ and process defined by the updates in Eq. (14), we also have a joint continuity equation known as the Fokker-Planck-Kolmogorov equation (Bect, 2010), + +$$ +\begin{array}{l} \partial_ {t} p _ {t | 1} \left(\mathbf {T} _ {t} \mid \mathbf {T} _ {1}\right) = - \nabla \cdot \left(v _ {x} \left(x _ {t} ^ {1: D} \mid x _ {1} ^ {1: D}\right) p _ {t | 1} \left(\mathbf {T} _ {t} \mid \mathbf {T} _ {1}\right)\right) - \nabla \cdot \left(v _ {r} \left(r _ {t} ^ {1: D} \mid r _ {1} ^ {1: D}\right) p _ {t | 1} \left(\mathbf {T} _ {t} \mid \mathbf {T} _ {1}\right)\right) + \\ \sum_ {j ^ {1: D}} R _ {t} \left(j ^ {1: D}, a _ {t} ^ {1: D} \mid a _ {1} ^ {1: D}\right) p _ {t | 1} \left(\left(x _ {t} ^ {1: D}, r _ {t} ^ {1: D}, j ^ {1: D}\right) \mid \mathbf {T} _ {1}\right). \tag {18} \\ \end{array} +$$ + +Our aim is to show that the following choices of $p_{t|1}$ , $v_x$ , $v_r$ and $R_t$ corresponding to independent processes within each modality and dimension are consistent under Eq. (18) i.e. these choices of $v_x$ , $v_r$ and $R_t$ will actually generate $p_{t|1}$ when simulated using Eq. (14) with $\Delta t \to 0$ . The choices are as follows: + +$$ +\begin{array}{l} p _ {t | 1} (\mathbf {T} _ {t} | \mathbf {T} _ {1}) = \prod_ {d = 1} ^ {D} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d}) p _ {t | 1} (r _ {t} ^ {d} | r _ {1} ^ {d}) p _ {t | 1} (a _ {t} ^ {d} | a _ {1} ^ {d}) \\ v _ {x} (x _ {t} ^ {1: D} | x _ {1} ^ {1: D}) = \left[ \begin{array}{c} v _ {x} ^ {1} (x _ {t} ^ {1} | x _ {1} ^ {1}) \\ \vdots \\ v _ {x} ^ {D} (x _ {t} ^ {D} | x _ {1} ^ {D}) \end{array} \right] \\ v _ {r} (r ^ {1: D} | r ^ {1: D}) = \left[ \begin{array}{c} v _ {r} ^ {1} (r _ {t} ^ {1} | r _ {1} ^ {1}) \\ \vdots \\ v _ {r} ^ {D} (r _ {t} ^ {D} | r _ {1} ^ {D}) \end{array} \right] \\ R _ {t} (j ^ {1: D}, a _ {t} ^ {1: D} | a _ {1} ^ {1: D}) = \sum_ {d = 1} ^ {D} \delta \left\{j ^ {1: D \backslash d}, a _ {t} ^ {1: D \backslash d} \right\} R _ {t} ^ {d} (j ^ {d}, a _ {t} ^ {d} | a _ {1} ^ {d}) \\ \end{array} +$$ + +More discussion regarding the form of $R_{t}(j^{1:D}, a_{t}^{1:D}|a_{1}^{1:D})$ can be found in Appendix E. Under these choices, the LHS of Eq. (18) becomes + +$$ +\begin{array}{l} \mathrm {L H S} = \partial_ {t} p _ {t | 1} (\mathbf {T} _ {t} | \mathbf {T} _ {1}) \\ = \sum_ {d = 1} ^ {D} \partial_ {t} p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right) \frac {p _ {t | 1} \left(\mathbf {T} _ {t} \mid \mathbf {T} _ {1}\right)}{p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right)} + \partial_ {t} p _ {t | 1} \left(r _ {t} ^ {d} \mid r _ {1} ^ {d}\right) \frac {p _ {t | 1} \left(\mathbf {T} _ {t} \mid \mathbf {T} _ {1}\right)}{p _ {t | 1} \left(r _ {t} ^ {d} \mid r _ {1} ^ {d}\right)} + \partial_ {t} p _ {t | 1} \left(a _ {t} ^ {d} \mid a _ {1} ^ {d}\right) \frac {p _ {t | 1} \left(\mathbf {T} _ {t} \mid \mathbf {T} _ {1}\right)}{p _ {t | 1} \left(a _ {t} ^ {d} \mid a _ {1} ^ {d}\right)} \\ \end{array} +$$ + +by the product rule for differentiation. The RHS of Eq. (18) becomes + +$$ +\begin{array}{l} \mathrm {R H S} = \sum_ {d = 1} ^ {D} - \nabla^ {(d)} \cdot \left(v _ {x} ^ {d} (x _ {t} ^ {d} | x _ {1} ^ {d}) p _ {t | 1} (\mathbf {T} _ {t} | \mathbf {T} _ {1})\right) - \nabla^ {(d)} \cdot \left(v _ {r} ^ {d} (r _ {t} ^ {d} | r _ {1} ^ {d}) p _ {t | 1} (\mathbf {T} _ {t} | \mathbf {T} _ {1})\right) \\ + \sum_ {j ^ {1: D}} \sum_ {d = 1} ^ {D} \delta \left\{j ^ {1: D \backslash d}, a _ {t} ^ {1: D \backslash d} \right\} R _ {t} ^ {d} (j ^ {d}, a _ {t} ^ {d} | a _ {1} ^ {d}) p _ {t | 1} \left(\left(x _ {t} ^ {1: D}, r _ {t} ^ {1: D}, j ^ {1: D} | \mathbf {T} _ {1}\right) \right. \\ \end{array} +$$ + +$$ +\begin{array}{l} = \sum_ {d = 1} ^ {D} - \nabla^ {(d)} \cdot \left(v _ {x} ^ {d} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right) p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right)\right) \frac {p _ {t | 1} \left(\mathbf {T} _ {t} \mid \mathbf {T} _ {1}\right)}{p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right)} - \nabla^ {(d)} \cdot \left(v _ {r} ^ {d} \left(r _ {t} ^ {d} \mid r _ {1} ^ {d}\right) p _ {t | 1} \left(r _ {t} ^ {d} \mid r _ {1} ^ {d}\right)\right) \frac {p _ {t | 1} \left(\mathbf {T} _ {t} \mid \mathbf {T} _ {1}\right)}{p _ {t | 1} \left(r _ {t} ^ {d} \mid r _ {1} ^ {d}\right)} \\ + \sum_ {d = 1} ^ {D} \left[ \left\{\prod_ {d ^ {\prime} = 1} ^ {D} p _ {t | 1} ^ {d ^ {\prime}} \left(x _ {t} ^ {d ^ {\prime}} \mid x _ {1} ^ {d ^ {\prime}}\right) p _ {t | 1} ^ {d ^ {\prime}} \left(r _ {t} ^ {d ^ {\prime}} \mid r _ {1} ^ {d ^ {\prime}}\right) \right\} \sum_ {j ^ {d}} R _ {t} ^ {d} \left(j ^ {d}, a _ {t} ^ {d} \mid a _ {1} ^ {d}\right) p _ {t | 1} \left(j ^ {d} \mid a _ {1} ^ {d}\right) \right. \\ \left. \sum_ {j ^ {1: D \backslash d}} \delta \left\{j ^ {1: D \backslash d}, a _ {t} ^ {1: D \backslash d} \right\} \left\{\prod_ {d ^ {\prime} = 1 \backslash d} ^ {D} p _ {t | 1} \left(j ^ {d ^ {\prime}} \mid a _ {1} ^ {d ^ {\prime}}\right) \right\} \right] \\ \end{array} +$$ + +$$ +\begin{array}{l} = \sum_ {d = 1} ^ {D} \partial_ {t} p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right) \frac {p _ {t | 1} \left(\mathbf {T} _ {t} \mid \mathbf {T} _ {1}\right)}{p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right)} + \partial_ {t} p _ {t | 1} \left(r _ {t} ^ {d} \mid r _ {1} ^ {d}\right) \frac {p _ {t | 1} \left(\mathbf {T} _ {t} \mid \mathbf {T} _ {1}\right)}{p _ {t | 1} \left(r _ {t} ^ {d} \mid r _ {1} ^ {d}\right)} \\ + \sum_ {d = 1} ^ {D} \left\{\prod_ {d ^ {\prime} = 1} ^ {D} p _ {t | 1} ^ {d ^ {\prime}} \left(x _ {t} ^ {d ^ {\prime}} \mid x _ {1} ^ {d ^ {\prime}}\right) p _ {t | 1} ^ {d ^ {\prime}} \left(r _ {t} ^ {d ^ {\prime}} \mid r _ {1} ^ {d ^ {\prime}}\right) \right\} \sum_ {j ^ {d}} R _ {t} ^ {d} \left(j ^ {d}, a _ {t} ^ {d} \mid a _ {1} ^ {d}\right) p _ {t | 1} \left(j ^ {d} \mid a _ {1} ^ {d}\right) \left\{\prod_ {d ^ {\prime} = 1 \backslash d} ^ {D} p _ {t | 1} \left(a _ {t} ^ {d ^ {\prime}} \mid a _ {1} ^ {d ^ {\prime}}\right) \right\} \\ \end{array} +$$ + +$$ +\begin{array}{l} = \sum_ {d = 1} ^ {D} \partial_ {t} p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right) \frac {p _ {t | 1} \left(\mathbf {T} _ {t} \mid \mathbf {T} _ {1}\right)}{p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right)} + \partial_ {t} p _ {t | 1} \left(r _ {t} ^ {d} \mid r _ {1} ^ {d}\right) \frac {p _ {t | 1} \left(\mathbf {T} _ {t} \mid \mathbf {T} _ {1}\right)}{p _ {t | 1} \left(r _ {t} ^ {d} \mid r _ {1} ^ {d}\right)} + \frac {p _ {t | 1} \left(\mathbf {T} _ {t} \mid \mathbf {T} _ {1}\right)}{p _ {t | 1} \left(a _ {t} ^ {d} \mid a _ {1} ^ {d}\right)} \sum_ {j ^ {d}} R _ {t} ^ {d} \left(j ^ {d}, a _ {t} ^ {d} \mid a _ {1} ^ {d}\right) p _ {t | 1} \left(j ^ {d} \mid a _ {1} ^ {d}\right) \\ = \sum_ {d = 1} ^ {D} \partial_ {t} p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right) \frac {p _ {t | 1} \left(\mathbf {T} _ {t} \mid \mathbf {T} _ {1}\right)}{p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right)} + \partial_ {t} p _ {t | 1} \left(r _ {t} ^ {d} \mid r _ {1} ^ {d}\right) \frac {p _ {t | 1} \left(\mathbf {T} _ {t} \mid \mathbf {T} _ {1}\right)}{p _ {t | 1} \left(r _ {t} ^ {d} \mid r _ {1} ^ {d}\right)} + \partial_ {t} p _ {t | 1} \left(a _ {t} ^ {d} \mid a _ {1} ^ {d}\right) \frac {p _ {t | 1} \left(\mathbf {T} _ {t} \mid \mathbf {T} _ {1}\right)}{p _ {t | 1} \left(a _ {t} ^ {d} \mid a _ {1} ^ {d}\right)} \\ = \mathrm {L H S} \\ \end{array} +$$ + +Therefore we have shown that our choices of $v_{x}, v_{r}$ and $R_{t}$ will generate the desired $p_{t|1}$ . + +# B.6. Proof of Proposition 4.2 + +Our proof will mirror that of Proposition 3.1 by taking the expectation with respect to $p_{\mathrm{data}}(\mathbf{T}_1)$ of both sides of the Fokker-Planck-Kolmogorov equation (Eq. (18)). + +$$ +\begin{array}{l} \mathbb {E} _ {p _ {\mathrm {d a t a}} (\mathbf {T} _ {1})} \left[ \partial_ {t} p _ {t | 1} (\mathbf {T} _ {t} | \mathbf {T} _ {1}) \right] = \mathbb {E} _ {p _ {\mathrm {d a t a}} (\mathbf {T} _ {1})} \Big [ - \nabla \cdot \left(v _ {x} (x _ {t} ^ {1: D} | x _ {1} ^ {1: D}) p _ {t | 1} (\mathbf {T} _ {t} | \mathbf {T} _ {1})\right) - \nabla \cdot \left(v _ {r} (r _ {t} ^ {1: D} | r _ {1} ^ {1: D}) p _ {t | 1} (\mathbf {T} _ {t} | \mathbf {T} _ {1})\right) + \\ \left. \sum_ {j ^ {1: D}} R _ {t} \left(j ^ {1: D}, a _ {t} ^ {1: D}\right) p _ {t | 1} \left(\left(x _ {t} ^ {1: D}, r _ {t} ^ {1: D}, j ^ {1: D}\right) \mid \mathbf {T} _ {1}\right) \right] \\ \partial_ {t} p _ {t} (\mathbf {T} _ {t}) = \sum_ {d = 1} ^ {D} \left\{\mathbb {E} _ {p _ {\text {d a t a}} (\mathbf {T} _ {1})} \left[ - \nabla^ {(d)} \cdot \left(v _ {x} ^ {d} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right) p _ {t \mid 1} (\mathbf {T} _ {t} \mid \mathbf {T} _ {1})\right) \right] + \right. \\ \mathbb {E} _ {p _ {\mathrm {d a t a}} (\mathbf {T} _ {1})} \left[ - \nabla^ {(d)} \cdot \left(v _ {r} ^ {d} (r _ {t} ^ {d} | r _ {1} ^ {d}) p _ {t | 1} (\mathbf {T} _ {t} | \mathbf {T} _ {1})\right) \right] + \\ \left. \mathbb {E} _ {p _ {\text {d a t a}} (\mathbf {T} _ {1})} \left[ \frac {p _ {t | 1} \left(\mathbf {T} _ {t} \mid \mathbf {T} _ {1}\right)}{p _ {t | 1} \left(a _ {t} ^ {d} \mid a _ {1} ^ {d}\right)} \sum_ {j ^ {d}} R _ {t} ^ {d} \left(j ^ {d}, a _ {t} ^ {d} \mid a _ {1} ^ {d}\right) p _ {t | 1} \left(j ^ {d} \mid a _ {1} ^ {d}\right) \right] \right\} \tag {19} \\ \end{array} +$$ + +where on the second line on the left hand side we have used the fact that $p_t(\mathbf{T}_t) = \mathbb{E}_{p_{\mathrm{data}}(\mathbf{T}_1)}[p_{t|1}(\mathbf{T}_t|\mathbf{T}_1)]$ . We shall first examine the $v_x^d$ term on the right hand side in isolation. + +$$ +\begin{array}{l} \mathbb{E}_{p_{\text{data}}(\mathbf{T}_{1})}\left[-\nabla^{(d)}\cdot \big(v_{x}^{d}(x_{t}^{d}|x_{1}^{d})p_{t|1}(\mathbf{T}_{t}|\mathbf{T}_{1})\big)\right] = -\int_{x_{1}^{1:D}}\int_{r_{1}^{1:D}}\sum_{a_{1}^{1:D}}p_{\text{data}}(\mathbf{T}_{1})\nabla^{(d)}\cdot \big(v_{x}^{d}(x_{t}^{d}|x_{1}^{d})p_{t|1}(\mathbf{T}_{t}|\mathbf{T}_{1})\big) \mathrm{d}x_{1}^{1:D}\mathrm{d}r_{1}^{1:D} \\ = - \nabla^ {(d)} \cdot \left(\int_ {x _ {1} ^ {1: D}} \int_ {r _ {1} ^ {1: D}} \sum_ {a _ {1} ^ {1: D}} p _ {\text {d a t a}} (\mathbf {T} _ {1}) v _ {x} ^ {d} (x _ {t} ^ {d} | x _ {1} ^ {d}) p _ {t | 1} (\mathbf {T} _ {t} | \mathbf {T} _ {1}) \mathrm {d} x _ {1} ^ {1: D} \mathrm {d} r _ {1} ^ {1: D}\right) \\ = - \nabla^ {(d)} \cdot \left(\int_ {x _ {1} ^ {d}} v _ {x} ^ {d} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right) \int_ {x _ {1} ^ {1: D \backslash d}} \int_ {r _ {1} ^ {1: D}} \sum_ {a _ {1} ^ {1: D}} p _ {\text {d a t a}} \left(\mathbf {T} _ {1}\right) p _ {t | 1} \left(\mathbf {T} _ {t} \mid \mathbf {T} _ {1}\right) \mathrm {d} x _ {1} ^ {1: D \backslash d} \mathrm {d} r _ {1} ^ {1: D} \mathrm {d} x _ {1} ^ {d}\right) \\ \end{array} +$$ + +$$ +\begin{array}{l} = - \nabla^ {(d)} \cdot \left(\int_ {x _ {1} ^ {d}} v _ {x} ^ {d} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right) p _ {t} \left(\mathbf {T} _ {t}\right) p _ {1 \mid t} \left(x _ {1} ^ {d} \mid \mathbf {T} _ {t}\right)\right) \\ = - \nabla^ {(d)} \cdot \left(\mathbb {E} _ {p _ {1 | t} \left(x _ {1} ^ {d} \mid \mathbf {T} _ {t}\right)} \left[ v _ {x} ^ {d} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right) \right] p _ {t} (\mathbf {T} _ {t})\right) \\ \end{array} +$$ + +The same arguments follow through for the $v_r^d$ term giving + +$$ +\mathbb {E} _ {p _ {\mathrm {d a t a}} (\mathbf {T} _ {1})} \left[ - \nabla^ {(d)} \cdot \big (v _ {r} ^ {d} (r _ {t} ^ {d} | r _ {1} ^ {d}) p _ {t | 1} (\mathbf {T} _ {t} | \mathbf {T} _ {1}) \big) \right] = - \nabla^ {(d)} \cdot \left(\mathbb {E} _ {p _ {1 | t} (r _ {1} ^ {d} | \mathbf {T} _ {t})} \left[ v _ {r} ^ {d} (r _ {t} ^ {d} | r _ {1} ^ {d}) \right] p _ {t} (\mathbf {T} _ {t})\right) +$$ + +We finally analyse the $R_{t}^{d}$ term in isolation. In the following, we will use $a_{t}^{1:D\backslash d}\odot j^{d}$ to refer to the $D$ dimensional discrete variable with the values $a_{t}^{1:D\backslash d}$ in all dimensions except $d$ and the value $j^{d}$ in dimension $d$ . + +$$ +\begin{array}{l} \mathbb {E} _ {p _ {\mathrm {d a t a}} (\mathbf {T} _ {1})} \left[ \frac {p _ {t | 1} (\mathbf {T} _ {t} | \mathbf {T} _ {1})}{p _ {t | 1} (a _ {t} ^ {d} | a _ {1} ^ {d})} \sum_ {j ^ {d}} R _ {t} ^ {d} (j ^ {d}, a _ {t} ^ {d} | a _ {1} ^ {d}) p _ {t | 1} (j ^ {d} | a _ {1} ^ {d}) \right] \\ = \int_ {x _ {1} ^ {1: D}} \int_ {r _ {1} ^ {1: D}} \sum_ {a _ {1} ^ {1: D}} p _ {\text {d a t a}} (\mathbf {T} _ {1}) \frac {p _ {t | 1} (\mathbf {T} _ {t} | \mathbf {T} _ {1})}{p _ {t | 1} (a _ {t} ^ {d} | a _ {1} ^ {d})} \sum_ {j ^ {d}} R _ {t} ^ {d} (j ^ {d}, a _ {t} ^ {d} | a _ {1} ^ {d}) p _ {t | 1} (j ^ {d} | a _ {1} ^ {d}) \mathrm {d} x _ {1} ^ {1: D} \mathrm {d} r _ {1} ^ {1: D} \\ = \int_ {x _ {1} ^ {1: D}} \int_ {r _ {1} ^ {1: D}} \sum_ {a _ {1} ^ {1: D}} \sum_ {j ^ {d}} p _ {t, 1} \left(\left(x _ {t} ^ {1: D}, r _ {t} ^ {1: D}, a _ {t} ^ {1: D \backslash d} \odot j ^ {d}\right), \mathbf {T} _ {1}\right) R _ {t} ^ {d} \left(j ^ {d}, a _ {t} ^ {d} | a _ {1} ^ {d}\right) \mathrm {d} x _ {1} ^ {1: D} \mathrm {d} r _ {1} ^ {1: D} \\ = \int_ {x _ {1} ^ {1: D}} \int_ {r _ {1} ^ {1: D}} \sum_ {a _ {1} ^ {1: D}} \sum_ {j ^ {d}} p _ {t} \left(\left(x _ {t} ^ {1: D}, r _ {t} ^ {1: D}, a _ {t} ^ {1: D \setminus d} \odot j ^ {d}\right)\right) p _ {1 | t} \left(a _ {1} ^ {d} \mid \left(x _ {t} ^ {1: D}, r _ {t} ^ {1: D}, a _ {t} ^ {1: D \setminus d} \odot j ^ {d}\right)\right) \\ p \left(\left(x _ {1} ^ {1: D}, r _ {1} ^ {1: D}, a _ {1} ^ {1: D \backslash d}\right) \mid a _ {1} ^ {d}, \left(x _ {t} ^ {1: D}, r _ {t} ^ {1: D}, a _ {t} ^ {1: D \backslash d} \odot j ^ {d}\right)\right) R _ {t} ^ {d} \left(j ^ {d}, a _ {t} ^ {d} \mid a _ {1} ^ {d}\right) \mathrm {d} x _ {1} ^ {1: D} \mathrm {d} r _ {1} ^ {1: D} \\ = \sum_ {j ^ {d}} p _ {t} \left(\left(x _ {t} ^ {1: D}, r _ {t} ^ {1: D}, a _ {t} ^ {1: D \backslash d} \odot j ^ {d}\right)\right) \sum_ {a _ {1} ^ {d}} p _ {1 | t} \left(a _ {1} ^ {d} \mid \left(x _ {t} ^ {1: D}, r _ {t} ^ {1: D}, a _ {t} ^ {1: D \backslash d} \odot j ^ {d}\right)\right) R _ {t} ^ {d} \left(j ^ {d}, a _ {t} ^ {d} \mid a _ {1} ^ {d}\right) \\ \underbrace{\int_{x_{1}^{1:D}}\int_{r_{1}^{1:D}}\sum_{\substack{a_{1}^{1:D}\setminus d\\ }}p\left((x_{1}^{1:D},r_{1}^{1:D},a_{1}^{1:D\setminus d})|a_{1}^{d},(x_{t}^{1:D},r_{t}^{1:D},a_{t}^{1:D\setminus d}\odot j^{d})\right)\mathrm{d}x_{1}^{1:D}r_{1}^{1:D}}_{= 1} \\ = \sum_ {j ^ {d}} \mathbb {E} _ {p _ {1 | t} \left(a _ {1} ^ {d} \mid \left(x _ {t} ^ {1: D}, r _ {t} ^ {1: D}, a _ {t} ^ {1: D \setminus d} \odot j ^ {d}\right) \right.} \left[ R _ {t} ^ {d} \left(j ^ {d}, a _ {t} ^ {d} \mid a _ {1} ^ {d}\right) \right] p _ {t} \left(\left(x _ {t} ^ {1: D}, r _ {t} ^ {1: D}, a _ {t} ^ {1: D \setminus d} \odot j ^ {d}\right)\right) \\ \end{array} +$$ + +Now we substitute these simplified forms back into Eq. (19). + +$$ +\begin{array}{l} \partial_ {t} p _ {t} (\mathbf {T} _ {t}) = \sum_ {d = 1} ^ {D} \left\{- \nabla^ {(d)} \cdot \left(\mathbb {E} _ {p _ {1 | t} (x _ {1} ^ {d} | \mathbf {T} _ {t})} \left[ v _ {x} ^ {d} (x _ {t} ^ {d} | x _ {1} ^ {d}) \right] p _ {t} (\mathbf {T} _ {t})\right) - \nabla^ {(d)} \cdot \left(\mathbb {E} _ {p _ {1 | t} (r _ {1} ^ {d} | \mathbf {T} _ {t})} \left[ v _ {r} ^ {d} (r _ {t} ^ {d} | r _ {1} ^ {d}) \right] p _ {t} (\mathbf {T} _ {t})\right) + \right. \\ \left. \right. \sum_ {j ^ {d}} \mathbb {E} _ {p _ {1 \mid t} \left( \right.a _ {1} ^ {d} \mid \left(x _ {t} ^ {1: D}, r _ {t} ^ {1: D}, a _ {t} ^ {1: D \setminus d} \odot j ^ {d}\right)\left[ R _ {t} ^ {d} (j ^ {d}, a _ {t} ^ {d} \mid a _ {1} ^ {d}) \right] p _ {t} \left(\left(x _ {t} ^ {1: D}, r _ {t} ^ {1: D}, a _ {t} ^ {1: D \setminus d} \odot j ^ {d}\right)\right)\left. \right\} \tag {20} \\ \end{array} +$$ + +We will now show that Eq. (20) is the Fokker-Planck-Kolmogorov equation for $p_t(\mathbf{T}_t)$ with the following choices for the velocities and rate matrix. + +$$ +v _ {x} (\mathbf {T} _ {t}) = \left[ \begin{array}{c} \mathbb {E} _ {p _ {1 | t} (x _ {1} ^ {1} | \mathbf {T} _ {t})} \left[ v _ {x} ^ {1} (x _ {t} ^ {1} | x _ {1} ^ {1}) \right] \\ \vdots \\ \mathbb {E} _ {p _ {1 | t} (x _ {1} ^ {D} | \mathbf {T} _ {t})} \left[ v _ {x} ^ {D} (x _ {t} ^ {D} | x _ {1} ^ {D}) \right] \end{array} \right] +$$ + +$$ +v _ {r} (\mathbf {T} _ {t}) = \left[ \begin{array}{c} \mathbb {E} _ {p _ {1 | t} (r _ {1} ^ {1} | \mathbf {T} _ {t})} \left[ v _ {r} ^ {1} (r _ {t} ^ {1} | r _ {1} ^ {1}) \right] \\ \vdots \\ \mathbb {E} _ {p _ {1 | t} (r _ {1} ^ {D} | \mathbf {T} _ {t})} \left[ v _ {r} ^ {D} (r _ {t} ^ {D} | r _ {1} ^ {D}) \right] \end{array} \right] +$$ + +$$ +R _ {t} \left(\mathbf {T} _ {t}, j ^ {1: D}\right) = \sum_ {d = 1} ^ {D} \delta \left\{a _ {t} ^ {1: D \backslash d}, j ^ {1: D \backslash d} \right\} \mathbb {E} _ {p _ {1 | t} \left(a _ {1} ^ {d} \mid \mathbf {T} _ {t}\right)} \left[ R _ {t} ^ {d} \left(a _ {t} ^ {d}, j ^ {d} \mid a _ {1} ^ {d}\right) \right] \tag {21} +$$ + +We shall substitute the choices in Eq. (21) into the Fokker-Planck-Kolmogorov equation for $p_t(\mathbf{T}_t)$ and show that this equals Eq. (20). + +$$ +\begin{array}{l} \partial_ {t} p _ {t} (\mathbf {T} _ {t}) = - \nabla \cdot (v _ {x} (\mathbf {T} _ {t}) p _ {t} (\mathbf {T} _ {t})) - \nabla \cdot (v _ {r} (\mathbf {T} _ {t}) p _ {t} (\mathbf {T} _ {t})) + \sum_ {j ^ {1: D}} R _ {t} \left((x _ {t} ^ {1: D}, r _ {t} ^ {1: D}, j ^ {1: D}), a _ {t} ^ {1: D}\right) p _ {t} \left((x _ {t} ^ {1: D}, r _ {t} ^ {1: D}, j ^ {1: D})\right) \\ = \sum_ {d = 1} ^ {D} \left\{ \right.\left. - \nabla^ {(d)} \cdot \left(\mathbb {E} _ {p _ {1 | t} (x _ {1} ^ {d} | \mathbf {T} _ {t})} \left[ v _ {x} ^ {d} (x _ {t} ^ {d} | x _ {1} ^ {d}) \right] p _ {t} (\mathbf {T} _ {t})\right) - \nabla^ {(d)} \cdot \left(\mathbb {E} _ {p _ {1 | t} (r _ {1} ^ {d} | \mathbf {T} _ {t})} \left[ v _ {r} ^ {d} (r _ {t} ^ {d} | r _ {1} ^ {d}) \right] p _ {t} (\mathbf {T} _ {t})\right)\right\} + \\ \sum_ {j ^ {1: D}} \sum_ {d = 1} ^ {D} \delta \left\{j ^ {1: D \backslash d}, a _ {t} ^ {1: D \backslash d} \right\} \mathbb {E} _ {p _ {1 | t} (a _ {1} ^ {d} | (x _ {t} ^ {1: D}, r _ {t} ^ {1: D}, j ^ {1: D}))} \left[ R _ {t} ^ {d} (j ^ {d}, a _ {t} ^ {d} | a _ {1} ^ {d}) \right] p _ {t} \left((x _ {t} ^ {1: D}, r _ {t} ^ {1: D}, j ^ {1: D})\right) \\ = \sum_ {d = 1} ^ {D} \left\{- \nabla^ {(d)} \cdot \left(\mathbb {E} _ {p _ {1 | t} (x _ {1} ^ {d} | \mathbf {T} _ {t})} \left[ v _ {x} ^ {d} (x _ {t} ^ {d} | x _ {1} ^ {d}) \right] p _ {t} (\mathbf {T} _ {t})\right) - \nabla^ {(d)} \cdot \left(\mathbb {E} _ {p _ {1 | t} (r _ {1} ^ {d} | \mathbf {T} _ {t})} \left[ v _ {r} ^ {d} (r _ {t} ^ {d} | r _ {1} ^ {d}) \right] p _ {t} (\mathbf {T} _ {t})\right) + \right. \\ \left. \sum_ {j ^ {d}} \mathbb {E} _ {p _ {1 | t} \left(a _ {1} ^ {d} \mid \left(x _ {t} ^ {1: D}, r _ {t} ^ {1: D}, a _ {t} ^ {1: D \setminus d} \odot j ^ {d}\right) \right.} \left[ R _ {t} ^ {d} \left(j ^ {d}, a _ {t} ^ {d} \mid a _ {1} ^ {d}\right) \right] p _ {t} \left(\left(x _ {t} ^ {1: D}, r _ {t} ^ {1: D}, a _ {t} ^ {1: D \setminus d} \odot j ^ {d}\right)\right) \right\} \\ \end{array} +$$ + +which we see matches Eq. (20). Therefore, we have shown that the choices for the velocities and rate matrix in Eq. (21) create a process that generates $p_t(\mathbf{T}_t)$ as desired. + +# C. Analysis of Training Objective + +In this section we analyse how our cross entropy objective $\mathcal{L}_{\mathrm{ce}}$ relates to the log-likelihood of the data under the generative model and to the ELBO used to train classical discrete diffusion models. + +Our proof is structured as follows. We first introduce path space measures for CTMCs in Section C.1 that we will require for the rest of the derivation. In Section C.1.1 we then derive the standard evidence lower bound, $\mathcal{L}_{\mathrm{ELBO}}$ on the model log likelihood, $\mathbb{E}_{p_{\mathrm{data}}(x_1)}[\log p_\theta (x_1)]$ . We then decompose $\mathcal{L}_{\mathrm{ELBO}}$ into the cross entropy, a rate regularizer and a KL term in Section C.2. Finally in Section C.2.1 we show that $\mathcal{L}_{\mathrm{ELBO}}$ corresponds exactly to the weighted cross entropy loss for the masking interpolant case. + +# C.1. Introduction to CTMC path measures + +Before beginning the proof, we introduce path space measures for CTMC processes, following the exposition in (Del Moral & Penev, 2017), Chapter 18. A path of a CTMC is a single trajectory from time 0 to time $t$ . The trajectory is a function $\omega : s \in [0, t] \mapsto \omega_s \in \{1, \dots, S\}$ that is everywhere right continuous and has left limits everywhere (also known as càdlàg paths). Intuitively, it is a function that takes in a time variable and outputs the position of the particle following the trajectory at that time. The càdlàg condition in our case states that at jump time $\tau$ we have $\omega_{\tau}$ taking the new jumped to value and $\omega_{\tau}^{-} := \lim_{s \uparrow \tau} \omega_s$ being the previous value before the jump, see Fig. 1B. + +A trajectory drawn from the CTMC, $W$ , can be fully described through its jump times, $T_{1},\ldots ,T_{n}$ and its state values between jumps, $W_{0},W_{1},\ldots ,W_{T_{n}}$ where at jump time $T_{k}$ the CTMC jumps from state value $W_{k - 1}$ to value $W_{k}$ . A path space measure $\mathbb{P}$ is able to assign probabilities to a drawn trajectory $W$ from time 0 to $t$ in the sense of + +$$ +\mathbb {P} (W \in \mathrm {d} \omega) := \mathbb {P} \left(W _ {0} \in \mathrm {d} \omega_ {0}, \left(T _ {1}, W _ {T _ {1}}\right) \in \mathrm {d} \left(t _ {1}, \omega_ {t _ {1}}\right), \dots \left(T _ {n}, W _ {T _ {n}}\right) \in \mathrm {d} \left(t _ {n}, \omega_ {t _ {n}}\right), T _ {n + 1} \geq t\right) +$$ + +where $\mathrm{d}\omega_{t_n}$ and $\mathrm{d}t_n$ denote infinitesimal neighborhoods around the points $\omega_{t_n} \in \{1, \dots, S\}$ and $t_n \in [0, t]$ . This is the same sense in which a probability density function assigns probabilities to the infinitesimal neighborhood around a continuous valued variable. + +To understand the form of $\mathbb{P}(W\in \mathrm{d}\omega)$ we remind ourselves of the definition of a CTMC with rate matrix $R_{t}$ . The CTMC waits in the current state for an amount of time determined by an exponential random variable with time-inhomogeneous + +rate $R_{t}(W_{t}) \coloneqq \sum_{k \neq W_{t}} R_{t}(W_{t}, k)$ , see Norris (1998) and Campbell et al. (2022) Appendix A for more details. After the wait time is finished, the CTMC jumps to a next chosen state where the jump distribution is + +$$ +\mathbb {P} \left(W _ {t _ {k}} \mid W _ {t _ {k}} ^ {-}\right) = \frac {R _ {t} \left(W _ {t _ {k}} ^ {-} , W _ {t _ {k}}\right) \left(1 - \delta \left\{W _ {t _ {k}} ^ {-} , W _ {t _ {k}} \right\}\right)}{R _ {t} \left(W _ {t _ {k}} ^ {-}\right)} +$$ + +For an exponential random variable with time-inhomogeneous rate, the cumulative distribution function is given by + +$$ +\mathbb {P} (T < t) = 1 - \exp \left(- \int_ {s = 0} ^ {s = t} R _ {s} (W _ {s} ^ {-}) \mathrm {d} s\right) +$$ + +Therefore, the probability density function, $p(t) = \frac{\partial}{\partial t}\mathbb{P}(T < t)$ , is + +$$ +p (t) = \exp \left(- \int_ {s = 0} ^ {s = t} R _ {s} \left(W _ {s} ^ {-}\right) \mathrm {d} s\right) R _ {t} \left(W _ {t} ^ {-}\right) +$$ + +We finally note that if we wish to know $\mathbb{P}(T_k < t|T_{k - 1})$ i.e. the probability that the $k$ -th jump time is less than $t$ given we know the $k - 1$ -th jump time, then this is just an exponential random variable started at time $T_{k - 1}$ when the previous jump occurred, + +$$ +\mathbb {P} \left(T _ {k} < t \mid T _ {k - 1}\right) = 1 - \exp \left(- \int_ {s = T _ {k - 1}} ^ {s = t} R _ {s} \left(W _ {s} ^ {-}\right) \mathrm {d} s\right) +$$ + +In other words, we simply start a new exponential timer once the previous jump occurs and the same equation carries through. + +We can now write the form of $\mathbb{P}(W\in \mathrm{d}\omega)$ . We split it into a series of conditional distributions + +$$ +\begin{array}{l} \mathbb {P} (W \in \mathrm {d} \omega) = \mathbb {P} (W _ {0} \in \mathrm {d} \omega_ {0}) \mathbb {P} ((T _ {1}, W _ {T _ {1}} \in \mathrm {d} (t _ {1}, \omega_ {t _ {1}}) | W _ {0}) \times \dots \\ \times \mathbb {P} \left(\left(T _ {n}, W _ {T _ {n}}\right) \in \mathrm {d} \left(t _ {n}, \omega_ {t _ {n}}\right) \mid W _ {0}, \left(T _ {1}, W _ {T _ {1}}\right), \dots , \left(T _ {n - 1}, W _ {T _ {n - 1}}\right)\right) \\ \times \mathbb {P} \left(T _ {n + 1} \geq t \mid W _ {0}, \left(T _ {1}, W _ {T _ {1}}\right), \dots , \left(T _ {n}, W _ {T _ {n}}\right)\right) \\ \end{array} +$$ + +$$ +\begin{array}{l} \mathbb {P} (W \in \mathrm {d} \omega) = p _ {0} (W _ {0}) \exp \left(- \int_ {s = 0} ^ {s = T _ {1}} R _ {s} (W _ {s} ^ {-}) \mathrm {d} s\right) R _ {T _ {1}} (W _ {T _ {1}} ^ {-}) \mathbb {P} (W _ {T _ {1}} | W _ {T _ {1}} ^ {-}) \times \dots \\ \times \exp \left(- \int_ {s = T _ {n - 1}} ^ {s = T _ {n}} R _ {s} \left(W _ {s} ^ {-}\right) \mathrm {d} s\right) R _ {T _ {n}} \left(W _ {T _ {n}} ^ {-}\right) \mathbb {P} \left(W _ {T _ {n}} \mid W _ {T _ {n}} ^ {-}\right) \exp \left(- \int_ {s = T _ {n}} ^ {s = t} R _ {s} \left(W _ {s} ^ {-}\right) \mathrm {d} s\right) \\ \end{array} +$$ + +$$ +\mathbb {P} (W \in \mathrm {d} \omega) = p _ {0} (W _ {0}) \exp \left(- \int_ {s = 0} ^ {s = t} R _ {s} (W _ {s} ^ {-}) \mathrm {d} s\right) \prod_ {s: W _ {s} \neq W _ {s} ^ {-}} R _ {s} (W _ {s} ^ {-}, W _ {s}) +$$ + +where $p_0$ is the initial state distribution. + +We will also need to understand Girsanov's transformation for CTMCs. Girsanov's transformation can be thought of as 'importance sampling' for path space measures. Specifically, if we take an expectation with respect to path measure $\mathbb{P}$ , $\mathbb{E}_{\mathbb{P}}[f(W)]$ , then this is equal to $\mathbb{E}_{\mathbb{Q}}\left[f(W)\frac{\mathrm{d}\mathbb{P}}{\mathrm{d}\mathbb{Q}}(W)\right]$ where $\mathbb{Q}$ is a different path measure and $\frac{\mathrm{d}\mathbb{P}}{\mathrm{d}\mathbb{Q}}$ is known as the Radon-Nikodym derivative. The path measure $\mathbb{Q}$ will result from considering a CTMC with a different rate matrix to our original measure $\mathbb{P}$ . Girsanov's transformation allows us to calculate the expectation which should have been taken with respect to the CTMC with $\mathbb{P}$ rate matrix instead with a CTMC with rate matrix corresponding to $\mathbb{Q}$ . + +The Radon-Nikodym derivative in our case has a form that is simply the ratio of $\mathbb{P}(W\in \mathrm{d}\omega)$ and $\mathbb{Q}(W\in \mathrm{d}\omega)$ . Let $R_{t},p_{0}$ be the rate matrix and initial distribution defining $\mathbb{P}$ and let $R_t^\prime ,p_0^\prime$ be the rate matrix and initial distribution defining $\mathbb{Q}$ . + +$$ +\frac {\mathrm {d} \mathbb {P}}{\mathrm {d} \mathbb {Q}} (W) = \frac {p _ {0} (W _ {0}) \exp \left(- \int_ {s = 0} ^ {s = t} R _ {s} \left(W _ {s} ^ {-}\right) \mathrm {d} s\right) \prod_ {s : W _ {s} \neq W _ {s} ^ {-}} R _ {s} \left(W _ {s} ^ {-} , W _ {s}\right)}{p _ {0} ^ {\prime} (W _ {0}) \exp \left(- \int_ {s = 0} ^ {s = t} R _ {s} ^ {\prime} \left(W _ {s} ^ {-}\right) \mathrm {d} s\right) \prod_ {s : W _ {s} \neq W _ {s} ^ {-}} R _ {s} ^ {\prime} \left(W _ {s} ^ {-} , W _ {s}\right)} +$$ + +# C.1.1. DERIVATION OF $\mathcal{L}_{\mathrm{ELBO}}$ + +In this section we will derive the standard evidence lower bound for the model log-likelihood assigned to the data, $\mathbb{E}_{p_{\mathrm{data}}(x_1)}[\log p_\theta (x_1)]$ when using our learned generative process to generate data. The entire structure of this section can be understood intuitively by making analogy to the derivation of the evidence lower bound for VAEs, (Kingma & Welling, 2013; Rezende et al., 2014; Huang et al., 2021). In a VAE, we have a latent variable model $p_{\theta}(z,x)$ for observed data $x$ . To derive the ELBO, we introduce a second distribution over the latent variables $q(z|x)$ with which we will use to take the expectation. The ELBO derivation proceeds as + +$$ +\log p _ {\theta} (x) = \log \sum_ {z} p _ {\theta} (z, x) +$$ + +$\log p_{\theta}(x) = \log \sum_{z}q(z|x)\frac{p_{\theta}(z,x)}{q(z|x)}$ Girsanov's transformation / Importance sampling + +$\log p_{\theta}(x) \geq \sum_{z} q(z|x) \log \left(\frac{p_{\theta}(z,x)}{q(z|x)}\right)$ Jensen's inequality + +$$ +\mathbb {E} _ {p _ {\text {d a t a}} (x)} \left[ p _ {\theta} (x) \right] \geq \mathbb {E} _ {p _ {\text {d a t a}} (x) q (z | x)} \left[ \log p _ {\theta} (z, x) \right] + C +$$ + +In our case, $x$ corresponds to the final state of the generative process at time $t = 1$ , $x_{1}$ . The latent variable $z$ corresponds to all other states of the CTMC $W_{t}$ , $t \in [0,1)$ . Our model $p_{\theta}(z,x)$ corresponds to our generative CTMC with rate matrix $R_{t}^{\theta}(x_{t},j) = \mathbb{E}_{p_{\theta}(x_{1}|x_{t})}[R_{t}(x_{t},j|x_{1})]$ and initial distribution $p_0(x_0)$ . Our latent variable distribution $q(z|x)$ corresponds to the $x_{1}$ conditioned CTMC that begins at distribution $p_{0|1}(x_0|x_1)$ and simulates with $x_{1}$ conditioned rate matrix $R_{t}(x_{t},j|x_{1})$ . We note here that $R_{t}(x_{t},j|x_{1})$ can be any rate matrix that generates the desired $x_{1}$ conditional flow, $p_{t|1}(x_t|x_1)$ as we described in the main text. + +We now derive $\mathcal{L}_{\mathrm{ELBO}}$ using our path space measures for CTMCs. We will use $\mathbb{P}^{\theta}$ to denote the path measure corresponding to the CTMC simulating from $p_0(x_0)$ using the generative rate matrix $R_{t}^{\theta}(x_{t},j) = \mathbb{E}_{p_{\theta}(x_{1}|x_{t})}[R_{t}(x_{t},j|x_{1})]$ . We will use $\mathbb{Q}^{|x_1}$ to denote the path measure corresponding to the CTMC simulating from $p_{0|1}(x_0|x_1)$ using the $x_{1}$ conditioned rate matrix $R_{t}(x_{t},j|x_{1})$ . + +We begin by marginalizing out the latent variables, $W_{t}, t \in [0,1)$ for our generative CTMC + +$$ +\log p _ {\theta} \left(x _ {1}\right) = \log \int_ {W _ {1} = x _ {1}} \mathbb {P} ^ {\theta} (\mathrm {d} \omega) +$$ + +We now apply Girsnov's transformation using our $x_{1}$ conditioned CTMC + +$$ +\log p _ {\theta} (x _ {1}) = \log \int_ {W _ {1} = x _ {1}} \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \frac {\mathrm {d} \mathbb {P} ^ {\theta}}{\mathrm {d} \mathbb {Q} ^ {| x _ {1}}} (\omega) +$$ + +where + +$$ +\frac {\mathrm {d} \mathbb {P} ^ {\theta}}{\mathrm {d} \mathbb {Q} ^ {| x _ {1}}} (\omega) = \frac {p _ {0} (W _ {0}) \exp \left(- \int_ {t = 0} ^ {t = 1} R _ {t} ^ {\theta} \left(W _ {t} ^ {-}\right) \mathrm {d} t\right) \prod_ {t : W _ {t} \neq W _ {t} ^ {-}} R _ {t} ^ {\theta} \left(W _ {t} ^ {-} , W _ {t}\right)}{p _ {0 | 1} \left(W _ {0} | x _ {1}\right) \exp \left(- \int_ {t = 0} ^ {t = 1} R _ {t} \left(W _ {t} ^ {-} | x _ {1}\right) \mathrm {d} t\right) \prod_ {t : W _ {t} \neq W _ {t} ^ {-}} R _ {t} \left(W _ {t} ^ {-} , W _ {t} | x _ {1}\right)} +$$ + +we note at this point that $p_{0|1}(W_0|x_1) = p_0(W_0)$ and the two initial distribution terms cancel out. Now, apply Jensen's inequality + +$$ +\log p _ {\theta} (x _ {1}) \geq \int_ {W _ {1} = x _ {1}} \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \log \frac {\mathrm {d} \mathbb {P} ^ {\theta}}{\mathrm {d} \mathbb {Q} ^ {| x _ {1}}} (\omega) +$$ + +and take the expectation with respect to the data distribution + +$$ +\mathbb {E} _ {p _ {\mathrm {d a t a}} (x _ {1})} \left[ \log p _ {\theta} (x _ {1}) \right] \geq \int p _ {\mathrm {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \log \frac {\mathrm {d} \mathbb {P} ^ {\theta}}{\mathrm {d} \mathbb {Q} ^ {| x _ {1}}} (\omega) +$$ + +Finally, substitute in the form for $\frac{\mathrm{d}\mathbb{P}^{\theta}}{\mathbb{Q}^{|x_1}}$ and take terms that don't depend on $\theta$ out into a constant + +$$ +\mathbb {E} _ {p _ {\mathrm {d a t a}} (x _ {1})} \left[ \log p _ {\theta} (x _ {1}) \right] \geq \int p _ {\mathrm {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \left\{- \int_ {t = 0} ^ {t = 1} R _ {t} ^ {\theta} \left(W _ {t} ^ {-}\right) \mathrm {d} t + \sum_ {t: W _ {t} \neq W _ {t} ^ {-}} \log R _ {t} ^ {\theta} \left(W _ {t} ^ {-}, W _ {t}\right) \right\} + C +$$ + +$$ +\begin{array}{l} = \int p _ {\text {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \left\{- \int_ {t = 0} ^ {t = 1} R _ {t} ^ {\theta} \left(W _ {t} ^ {-}\right) \mathrm {d} t + \sum_ {t: W _ {t} \neq W _ {t} ^ {-}} \log \mathbb {E} _ {p _ {\theta} \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right)} \left[ R _ {t} \left(W _ {t} ^ {-}, W _ {t} \mid \tilde {x} _ {1}\right) \right] \right\} + C \\ = \mathcal {L} _ {\mathrm {E L B O}} + C \\ \end{array} +$$ + +where + +$$ +\mathcal {L} _ {\mathrm {E L B O}} = \int p _ {\mathrm {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \left\{- \int_ {t = 0} ^ {t = 1} R _ {t} ^ {\theta} \left(W _ {t} ^ {-}\right) \mathrm {d} t + \sum_ {t: W _ {t} \neq W _ {t} ^ {-}} \log \mathbb {E} _ {p _ {\theta} \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right)} \left[ R _ {t} \left(W _ {t} ^ {-}, W _ {t} \mid \tilde {x} _ {1}\right) \right] \right\} \tag {22} +$$ + +# C.2. Decomposition of $\mathcal{L}_{\mathrm{ELBO}}$ + +Consider the term $\log \left(\mathbb{E}_{p_{\theta}(\tilde{x}_1|W_t^{-})}\left[R_t(W_t^{-},W_t|\tilde{x}_1)\right]\right)$ + +$$ +\begin{array}{l} \log \left(\mathbb {E} _ {p _ {\theta} (\tilde {x} _ {1} | W _ {t} ^ {-})} \left[ R _ {t} \left(W _ {t} ^ {-}, W _ {t} | \tilde {x} _ {1}\right) \right]\right) = \log \left(\mathbb {E} _ {p (\tilde {x} _ {1} | W _ {t} ^ {-})} \left[ \frac {p _ {\theta} \left(\tilde {x} _ {1} | W _ {t} ^ {-}\right)}{p (\tilde {x} _ {1} | W _ {t} ^ {-})} R _ {t} \left(W _ {t} ^ {-}, W _ {t} | \tilde {x} _ {1}\right) \right]\right) \\ = \log \left(\mathbb {E} _ {p (\tilde {x} _ {1} | W _ {t} ^ {-})} \left[ \frac {p _ {\theta} (\tilde {x} _ {1} | W _ {t} ^ {-})}{p (\tilde {x} _ {1} | W _ {t} ^ {-})} R _ {t} \left(W _ {t} ^ {-}, W _ {t} | \tilde {x} _ {1}\right) \right]\right) \\ + \mathbb {E} _ {p (\tilde {x} _ {1} | W _ {t} ^ {-})} \left[ \log \left(\frac {p _ {\theta} (\tilde {x} _ {1} | W _ {t} ^ {-})}{p (\tilde {x} _ {1} | W _ {t} ^ {-})} R _ {t} \left(W _ {t} ^ {-}, W _ {t} | \tilde {x} _ {1}\right)\right) \right] \\ \left. - \mathbb {E} _ {p \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right)} \left[ \log \left(\frac {p _ {\theta} \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right)}{p \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right)} R _ {t} \left(W _ {t} ^ {-}, W _ {t} \mid \tilde {x} _ {1}\right)\right) \right] \right. \\ = \mathbb {E} _ {p (\tilde {x} _ {1} | W _ {t} ^ {-})} \left[ \log p _ {\theta} (\tilde {x} _ {1} | W _ {t} ^ {-}) \right] + C \\ + \log \left(\mathbb {E} _ {p (\tilde {x} | W _ {t} ^ {-})} \left[ \frac {p _ {\theta} (\tilde {x} _ {1} | W _ {t} ^ {-})}{p (\tilde {x} _ {1} | W _ {t} ^ {-})} R _ {t} \left(W _ {t} ^ {-}, W _ {t} | \tilde {x} _ {1}\right) \right]\right) \\ - \mathbb {E} _ {p (\tilde {x} _ {1} | W _ {t} ^ {-})} \left[ \log \left(\frac {p _ {\theta} (\tilde {x} _ {1} | W _ {t} ^ {-})}{p (\tilde {x} _ {1} | W _ {t} ^ {-})} R _ {t} \left(W _ {t} ^ {-}, W _ {t} | \tilde {x} _ {1}\right)\right) \right] \\ = \mathbb {E} _ {p (\tilde {x} _ {1} | W _ {t} ^ {-})} \left[ \log p _ {\theta} (\tilde {x} _ {1} | W _ {t} ^ {-}) \right] + C \\ \left. \right. + \log \left(\mathbb {E} _ {p (\tilde {x} | W _ {t} ^ {-})} \left[ \frac {p _ {\theta} (\tilde {x} _ {1} | W _ {t} ^ {-})}{p (\tilde {x} _ {1} | W _ {t} ^ {-})} \mathbb {P} \left(W _ {t} | W _ {t} ^ {-}, \tilde {x} _ {1}\right) R _ {t} \left(W _ {t} ^ {-} | \tilde {x} _ {1}\right)\right]\right) \\ \left. \right. - \mathbb {E} _ {p (\tilde {x} _ {1} | W _ {t} ^ {-})} \left[ \log \left(\frac {p _ {\theta} (\tilde {x} _ {1} | W _ {t} ^ {-})}{p (\tilde {x} _ {1} | W _ {t} ^ {-})} \mathbb {P} \left(W _ {t} | W _ {t} ^ {-}, \tilde {x} _ {1}\right) R _ {t} \left(W _ {t} ^ {-} | \tilde {x} _ {1}\right)\right)\right] \\ \end{array} +$$ + +where we have used our definition of the jump distribution of + +$$ +\mathbb {P} \left(W _ {t} \mid W _ {t} ^ {-}, \tilde {x} _ {1}\right) = \frac {R _ {t} \left(W _ {t} ^ {-} , W _ {t} \mid \tilde {x} _ {1}\right)}{R _ {t} \left(W _ {t} ^ {-} \mid \tilde {x} _ {1}\right)} +$$ + +Now we define two new distributions, + +$$ +p _ {\theta} \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right) \mathbb {P} \left(W _ {t} \mid W _ {t} ^ {-}, \tilde {x} _ {1}\right) = p _ {\theta} \left(W _ {t} \mid W _ {t} ^ {-}\right) p _ {\theta} \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}, W _ {t}\right) +$$ + +where + +$$ +p _ {\theta} \left(W _ {t} \mid W _ {t} ^ {-}\right) := \sum_ {\tilde {x} _ {1}} p _ {\theta} \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right) \mathbb {P} \left(W _ {t} \mid W _ {t} ^ {-}, \tilde {x} _ {1}\right) +$$ + +and + +$$ +p _ {\theta} \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}, W _ {t}\right) := \frac {p _ {\theta} \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right) \mathbb {P} \left(W _ {t} \mid W _ {t} ^ {-} , \tilde {x} _ {1}\right)}{\sum_ {x _ {1} ^ {\prime}} p _ {\theta} \left(x _ {1} ^ {\prime} \mid W _ {t} ^ {-}\right) \mathbb {P} \left(W _ {t} \mid W _ {t} ^ {-} , x _ {1} ^ {\prime}\right)} \tag {23} +$$ + +Substitute in these newly defined distributions into our equation for $\log \left(\mathbb{E}_{p_{\theta}(\tilde{x} |W_t^{-})}\left[R_t(W_t^{-},W_t|\tilde{x}_1)\right]\right)$ to get + +$$ +\begin{array}{l} \log \left(\mathbb {E} _ {p _ {\theta} (\tilde {x} | W _ {t} ^ {-})} \left[ R _ {t} \left(W _ {t} ^ {-}, W _ {t} | \tilde {x} _ {1}\right) \right]\right) = \mathbb {E} _ {p (\tilde {x} _ {1} | W _ {t} ^ {-})} \left[ \log p _ {\theta} (\tilde {x} _ {1} | W _ {t} ^ {-}) \right] + C \\ + \log \left(\mathbb {E} _ {p (\tilde {x} | W _ {t} ^ {-})} \left[ \frac {p _ {\theta} \left(W _ {t} | W _ {t} ^ {-}\right) p _ {\theta} \left(\tilde {x} _ {1} | W _ {t} ^ {-} , W _ {t}\right)}{p \left(\tilde {x} _ {1} | W _ {t} ^ {-}\right)} R _ {t} \left(W _ {t} ^ {-} | \tilde {x} _ {1}\right) \right]\right) \\ \left. - \mathbb {E} _ {p \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right)} \left[ \log \left(\frac {p _ {\theta} \left(W _ {t} \mid W _ {t} ^ {-}\right) p _ {\theta} \left(\tilde {x} _ {1} \mid W _ {t} ^ {-} , W _ {t}\right)}{p \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right)} R _ {t} \left(W _ {t} ^ {-} \mid \tilde {x} _ {1}\right)\right) \right] \right. \\ = \mathbb {E} _ {p \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right)} \left[ \log p _ {\theta} \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right) \right] + C \\ + \underline {{\log p _ {\theta} (W _ {t} | W _ {t} ^ {-})}} + \log \left(\mathbb {E} _ {p (\tilde {x} | W _ {t} ^ {-})} \left[ \frac {p _ {\theta} (\tilde {x} _ {1} | W _ {t} ^ {-} , W _ {t})}{p (\tilde {x} _ {1} | W _ {t} ^ {-})} R _ {t} (W _ {t} ^ {-} | \tilde {x} _ {1}) \right]\right) \\ - \underline {{\log p _ {\theta} (W _ {t} | W _ {t} ^ {-})}} - \mathbb {E} _ {p (\tilde {x} _ {1} | W _ {t} ^ {-})} \left[ \log \left(\frac {p _ {\theta} (\tilde {x} _ {1} | W _ {t} ^ {-} , W _ {t})}{p (\tilde {x} _ {1} | W _ {t} ^ {-})} R _ {t} (W _ {t} ^ {-} | \tilde {x} _ {1})\right) \right] \\ = \mathbb {E} _ {p (\tilde {x} _ {1} | W _ {t} ^ {-})} \left[ \log p _ {\theta} (\tilde {x} _ {1} | W _ {t} ^ {-}) \right] \\ + \log \left(\mathbb {E} _ {p _ {\theta} (\tilde {x} _ {1} | W _ {t} ^ {-}, W _ {t})} \left[ R _ {t} \left(W _ {t} ^ {-} | \tilde {x} _ {1}\right) \right]\right) \\ + \operatorname {K L} \left(p \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right) \mid p _ {\theta} \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}, W _ {t}\right)\right) + C \\ \end{array} +$$ + +Substituting this into our form for $\mathcal{L}_{\mathrm{ELBO}}$ given in equation (22) gives + +$$ +\begin{array}{l} \mathcal {L} _ {\mathrm {E L B O}} = \int p _ {\mathrm {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \left\{- \int_ {t = 0} ^ {t = 1} R _ {t} ^ {\theta} \left(W _ {t} ^ {-}\right) \mathrm {d} t + \sum_ {t: W _ {t} \neq W _ {t} ^ {-}} \left(\mathbb {E} _ {p \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right)} \left[ \log p _ {\theta} \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right) \right] + \right. \right. \\ \log \left(\mathbb {E} _ {p _ {\theta} (\tilde {x} _ {1} | W _ {t} ^ {-}, W _ {t})} \left[ R _ {t} \left(W _ {t} ^ {-} | \tilde {x} _ {1}\right) \right]\right) + \\ \left. \left. \operatorname {K L} \left(p \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right) \mid p _ {\theta} \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}, W _ {t}\right)\right)\right) \right\} \\ \end{array} +$$ + +Substituting this into our original bound on the model log-likelihood gives + +$$ +\mathbb {E} _ {p _ {\text {d a t a}} (x _ {1})} \left[ \log p _ {\theta} (x _ {1}) \right] \geq \mathcal {L} _ {\text {EL B O}} + C = \mathcal {L} _ {\text {c e}} + \mathcal {L} _ {R} + \mathcal {L} _ {\text {K L}} + C +$$ + +where + +$$ +\mathcal {L} _ {\mathrm {c e}} = \int p _ {\mathrm {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \sum_ {t: W _ {t} ^ {-} \neq W _ {t}} \mathbb {E} _ {p \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right)} \left[ \log p _ {\theta} \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right) \right] +$$ + +$$ +\mathcal {L} _ {R} = \int p _ {\mathrm {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \left\{- \int_ {t = 0} ^ {t = 1} R _ {t} ^ {\theta} (W _ {t}) \mathrm {d} t + \sum_ {t: W _ {t} ^ {-} \neq W _ {t}} \log \left(\mathbb {E} _ {p _ {\theta} (\tilde {x} _ {1} | W _ {t} ^ {-}, W _ {t})} \left[ R _ {t} (W _ {t} ^ {-} | \tilde {x} _ {1}) \right]\right) \right\} +$$ + +$$ +\mathcal {L} _ {\mathrm {K L}} = \int p _ {\text {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \sum_ {t: W _ {t} ^ {-} \neq W _ {t}} \mathrm {K L} \left(p \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right) | | p _ {\theta} \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}, W _ {t}\right)\right) +$$ + +and $C$ is a constant term independent of $\theta$ . + +In the next stages of the proof, we going to show that $\mathcal{L}_{\mathrm{ce}}$ is the weighted cross-entropy, $\mathcal{L}_R$ is a regularizer towards the arbitrarily chosen $x_{1}$ conditioned rate matrix that we argue we can ignore and $\mathcal{L}_{\mathrm{KL}}$ is a KL term that we will absorb into the bound on the model log-likelihood. + +In order to proceed, we will need to make use of Dynkin's formula + +$$ +\int p _ {\text {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \sum_ {t: W _ {t} ^ {-} \neq W _ {t}} f (W _ {t} ^ {-}, W _ {t}) = \int p _ {\text {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \int_ {t = 0} ^ {t = 1} \sum_ {y \neq W _ {t}} R _ {t} (W _ {t}, y | x _ {1}) f (W _ {t}, y) \mathrm {d} t +$$ + +where $f(\cdot, \cdot)$ is a two-argument function. This formula can be understood intuitively as allowing us to switch from a sum over the jump times to a full integral over the time interval appropriately weighted by the probability that a jump occurs and the destination to which a jump goes to. + +Weighted Cross Entropy We first show that $\mathcal{L}_{\mathrm{ce}}$ is the weighted cross entropy. + +$$ +\begin{array}{l} \mathcal {L} _ {\mathrm {c e}} = \int p _ {\mathrm {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \sum_ {t: W _ {t} ^ {-} \neq W _ {t}} \mathbb {E} _ {p \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right)} \left[ \log p _ {\theta} \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right) \right] \\ = \int p _ {\text {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \int_ {t = 0} ^ {t = 1} \sum_ {y \neq W _ {t}} R _ {t} \left(W _ {t}, y | x _ {1}\right) \mathbb {E} _ {p \left(\tilde {x} _ {1} \mid W _ {t}\right)} \left[ \log p _ {\theta} \left(\tilde {x} _ {1} \mid W _ {t}\right) \right] \mathrm {d} t \quad \text {D y n k i n} \\ = \int \int_ {t = 0} ^ {t = 1} p _ {\text {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \mathbb {E} _ {p (\tilde {x} _ {1} | W _ {t})} [ \log p _ {\theta} (\tilde {x} _ {1} | W _ {t}) ] R _ {t} (W _ {t} | x _ {1}) \mathrm {d} t \\ = \mathbb {E} _ {p _ {\text {d a t a}} (x _ {1}) \mathcal {U} (t; 0, 1) p (x _ {t} | x _ {1})} \left[ R _ {t} (x _ {t} | x _ {1}) \mathbb {E} _ {p (\tilde {x} _ {1} | x _ {t})} [ \log p _ {\theta} (\tilde {x} _ {1} | x _ {t}) ] \right] \\ = \mathbb {E} _ {p _ {\text {d a t a}} (x _ {1}) \mathcal {U} (t; 0, 1) p (x _ {t} | x _ {1}) p (\tilde {x} _ {1} | x _ {t})} \left[ R _ {t} \left(x _ {t} | x _ {1}\right) \log p _ {\theta} \left(\tilde {x} _ {1} | x _ {t}\right) \right] \\ = \mathbb {E} _ {\mathcal {U} (t; 0, 1) p \left(x _ {1}, x _ {t}\right) p \left(\tilde {x} _ {1} \mid x _ {t}\right)} \left[ R _ {t} \left(x _ {t} \mid x _ {1}\right) \log p _ {\theta} \left(\tilde {x} _ {1} \mid x _ {t}\right) \right] \\ = \mathbb {E} _ {\mathcal {U} (t; 0, 1) p \left(x _ {t}\right) p \left(x _ {1} \mid x _ {t}\right) p \left(\tilde {x} _ {1} \mid x _ {t}\right)} \left[ R _ {t} \left(x _ {t} \mid x _ {1}\right) \log p _ {\theta} \left(\tilde {x} _ {1} \mid x _ {t}\right) \right] \\ = \mathbb {E} _ {\mathcal {U} (t; 0, 1) p \left(x _ {t}\right) p \left(\tilde {x} _ {1} \mid x _ {t}\right) p \left(x _ {1} \mid x _ {t}\right)} \left[ R _ {t} \left(x _ {t} \mid \tilde {x} _ {1}\right) \log p _ {\theta} \left(x _ {1} \mid x _ {t}\right) \right] \quad \text {R e l a b e l} x _ {1} \leftrightarrow \tilde {x} _ {1} \\ = \mathbb {E} _ {\mathcal {U} (t; 0, 1) p \left(x _ {t}\right) p \left(x _ {1} \mid x _ {t}\right)} \left[ \mathbb {E} _ {p \left(\tilde {x} _ {1} \mid x _ {t}\right)} \left[ R _ {t} \left(x _ {t} \mid \tilde {x} _ {1}\right) \right] \log p _ {\theta} \left(x _ {1} \mid x _ {t}\right) \right] \\ = \mathbb {E} _ {\mathcal {U} (t; 0, 1) p \left(x _ {t}\right) p \left(x _ {1} \mid x _ {t}\right)} \left[ \omega_ {t} \left(x _ {t}\right) \log p _ {\theta} \left(x _ {1} \mid x _ {t}\right) \right] \\ \end{array} +$$ + +where on the second line we apply Dynkin's formula with $f(W_{t}^{-},W_{t}) = \mathbb{E}_{p(\tilde{x}_{1}|W_{t}^{-})}\left[\log p_{\theta}(\tilde{x}_{1}|W_{t}^{-})\right]$ which we note is independent of $W_{t}$ . $\omega_{t}(x_{t})$ is a weighting function. In diffusion model training it is common for the likelihood based objective to be a weighted form of a recognisable loss e.g. the L2 loss for diffusion models. Here we have a 'likelihood weighted' cross entropy. We can then make the same approximation as in diffusion models and set $\omega (x_{t}) = 1$ to equally weight all loss levels. This also has the benefit of making our loss independent of the arbitrarily chosen rate matrix $R_{t}$ that could have been any rate that generates the desired conditional flow. + +Rate Forcing Term We now analyse the term $\mathcal{L}_R$ . We will show that it is approximately equal to an objective which at its optimum sets the learned generative rate matrix to have the same overall jump probability as the arbitrarily chosen rate matrix that generates our $p_{t|1}(x_t|x_1)$ conditional flow. + +$$ +\begin{array}{l} \mathcal {L} _ {R} = \int p _ {\text {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \left\{- \int_ {t = 0} ^ {t = 1} R _ {t} ^ {\theta} (W _ {t}) \mathrm {d} t + \sum_ {t: W _ {t} ^ {-} \neq W _ {t}} \log \left(\mathbb {E} _ {p _ {\theta} (\tilde {x} _ {1} | W _ {t} ^ {-}, W _ {t})} \left[ R _ {t} (W _ {t} ^ {-} | \tilde {x} _ {1}) \right]\right) \right\} \\ = \int p _ {\text {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \left\{- \int_ {t = 0} ^ {t = 1} R _ {t} ^ {\theta} (W _ {t}) \mathrm {d} t + \int_ {t = 0} ^ {t = 1} \sum_ {y \neq W _ {t}} R _ {t} (W _ {t}, y | x _ {1}) \log \left(\mathbb {E} _ {p _ {\theta} (\tilde {x} _ {1} | W _ {t}, y)} [ R _ {t} (W _ {t} | \tilde {x} _ {1}) ]\right) \mathrm {d} t \right\} \\ \end{array} +$$ + +where on the second line we have applied Dynkin's formula with $f(W_{t}^{-},W_{t}) = \mathbb{E}_{p_{\theta}(\tilde{x}_{1}|W_{t}^{-},W_{t})}\left[R_{t}(W_{t}^{-}|\tilde{x}_{1})\right]$ . To further understand this term, we make the following approximation + +$$ +\mathbb {E} _ {p _ {\theta} (\tilde {x} _ {1} | W _ {t}, y)} \left[ R _ {t} \left(W _ {t} | \tilde {x} _ {1}\right) \right] \approx \mathbb {E} _ {p _ {\theta} (\tilde {x} _ {1} | W _ {t})} \left[ R _ {t} \left(W _ {t} | \tilde {x} _ {1}\right) \right] +$$ + +$p_{\theta}(\tilde{x}_1|W_t,y)$ is the Bayesian posterior update given by equation (23) starting with prior $p_{\theta}(\tilde{x}_1|W_t)$ and with likelihood $\mathbb{P}(y|W_t,\tilde{x}_1)$ . It is therefore the models prediction of $\tilde{x}_1$ updated with the information that the process has jumped to new value $y$ . When our CTMC is multi-dimensional then a single jump will change only a single dimension, see Appendix E, and so when we operate in high-dimensional settings, the Bayesian posterior will be close to the prior. + +We will denote the approximate form of $\mathcal{L}_R$ as $\hat{\mathcal{L}}_R$ . + +$$ +\hat {\mathcal {L}} _ {R} = \int p _ {\mathrm {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \Bigg \{- \int_ {t = 0} ^ {t = 1} R _ {t} ^ {\theta} (W _ {t}) \mathrm {d} t + \int_ {t = 0} ^ {t = 1} \sum_ {y \neq W _ {t}} R _ {t} (W _ {t}, y | x _ {1}) \log \left(\mathbb {E} _ {p _ {\theta} (\tilde {x} _ {1} | W _ {t})} [ R _ {t} (W _ {t} | \tilde {x} _ {1}) ]\right) \mathrm {d} t \Bigg \} +$$ + +$$ +\begin{array}{l} = \int p _ {\text {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \left\{- \int_ {t = 0} ^ {t = 1} R _ {t} ^ {\theta} (W _ {t}) \mathrm {d} t + \int_ {t = 0} ^ {t = 1} \log \left(\mathbb {E} _ {p _ {\theta} (\tilde {x} _ {1} | W _ {t})} [ R _ {t} (W _ {t} | \tilde {x} _ {1}) ]\right) R _ {t} (W _ {t} | x _ {1}) \mathrm {d} t \right\} \\ = \int \int_ {t = 0} ^ {t = 1} p _ {\text {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \left\{- R _ {t} ^ {\theta} (W _ {t}) + R _ {t} (W _ {t} | x _ {1}) \log R _ {t} ^ {\theta} (W _ {t}) \right\} \mathrm {d} t \\ = \mathbb {E} _ {\mathcal {U} (t; 0, 1) p _ {\text {d a t a}} (x _ {1}) p _ {t} (x _ {t} | x _ {1})} \left[ - R _ {t} ^ {\theta} (x _ {t}) + R _ {t} (x _ {t} | x _ {1}) \log R _ {t} ^ {\theta} (x _ {t}) \right] \\ = \mathbb {E} _ {\mathcal {U} (t; 0, 1) p _ {t} \left(x _ {t}\right)} \left[ - R _ {t} ^ {\theta} \left(x _ {t}\right) + \mathbb {E} _ {p \left(x _ {1} \mid x _ {t}\right)} \left[ R _ {t} \left(x _ {t} \mid x _ {1}\right) \right] \log R _ {t} ^ {\theta} \left(x _ {t}\right) \right] \\ \end{array} +$$ + +where on the third line we have used the definition of $R_{t}^{\theta}(W_{t}) = \mathbb{E}_{p_{\theta}(\tilde{x}_{1}|W_{t})}[R_{t}(W_{t}|\tilde{x}_{1})]$ . Now consider maximizing $\hat{\mathcal{L}}_R$ with respect to the value of $R_{\tau}^{\theta}(z)$ at test input $z$ and test time $\tau$ . Differentiating $\hat{\mathcal{L}}_R$ with respect to $R_{\tau}^{\theta}(z)$ and setting to 0 gives + +$$ +\begin{array}{l} \frac {\partial \hat {\mathcal {L}} _ {R}}{\partial R _ {\tau} (z)} = p _ {\tau} (z) \left(- 1 + \mathbb {E} _ {p \left(x _ {1} \mid z\right)} \left[ R _ {\tau} (z \mid x _ {1}) \right] \frac {1}{R _ {\tau} ^ {\theta} (z)}\right) = 0 \\ \Longrightarrow R _ {\tau} ^ {\theta} (z) = \mathbb {E} _ {p \left(x _ {1} \mid z\right)} \left[ R _ {\tau} \left(z \mid x _ {1}\right) \right] \quad \text {a t} \\ \end{array} +$$ + +Therefore, we have found that maximizing $\hat{\mathcal{L}}_R$ encourages $R_t^\theta(x_t)$ to equal $\mathbb{E}_{p(x_1|x_t)}[R_t(x_t|x_1)]$ . However, $R_t(x_t|x_1)$ is the overall rate of jumps for the arbitrarily chosen rate matrix that generates the $p_{t|1}(x_t|x_1)$ conditional flow. This rate of jumps is completely dependent on the level of stochasticity chosen for $R_t(x_t|x_1)$ which does not have any a priori known correct level. Therefore, we do not want to be encouraging our learned generative rate matrix $R_t^\theta$ to be matching this stochasticity level and so the term $\hat{\mathcal{L}}_R$ is undesirable to have in the objective. The true evidence lower bound includes the term $\mathcal{L}_R$ which we expect to have a similar effect as $\hat{\mathcal{L}}_R$ as we argued previously. + +KL Term When we maximize the $\mathcal{L}_{\mathrm{ELBO}}$ objective, we would try to maximize the $\mathcal{L}_{\mathrm{KL}}$ term i.e. we try and push $p(\tilde{x}_1|W_t^-)$ and $p_{\theta}(\tilde{x}_1|W_t^{-},W_t)$ as far apart as possible. This makes sense to do as we try and push the posterior over $\tilde{x}_1$ given the information contained in both the pre-jump state $W_{t}^{-}$ and the post jump state $W_{t}$ away from the distribution over $\tilde{x}_1$ given just the information within $W_{t}^{-}$ . Digging into this term deeper we see that + +$$ +\begin{array}{l} \mathrm {K L} \left(p \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right) \mid \mid p _ {\theta} \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}, W _ {t}\right)\right) \\ = \mathbb {E} _ {p (\tilde {x} _ {1} | W _ {t} ^ {-})} \left[ \log \frac {p (\tilde {x} _ {1} | W _ {t} ^ {-})}{p _ {\theta} (\tilde {x} _ {1} | W _ {t} ^ {-} , W _ {t})} \right] \\ = \mathbb {E} _ {p (\tilde {x} _ {1} | W _ {t} ^ {-})} \left[ - \log \left(p _ {\theta} (\tilde {x} _ {1} | W _ {t} ^ {-}) \mathbb {P} \left(W _ {t} | W _ {t} ^ {-}, \tilde {x} _ {1}\right)\right) + \log \left(\sum_ {x _ {1} ^ {\prime}} p _ {\theta} \left(x _ {1} ^ {\prime} | W _ {t} ^ {-}\right) \mathbb {P} \left(W _ {t} | W _ {t} ^ {-}, x _ {1} ^ {\prime}\right)\right) \right] + C \\ = \mathbb {E} _ {p \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right)} \left[ - \log p _ {\theta} \left(\tilde {x} _ {1} \mid W _ {t} ^ {-}\right) + \log \left(\sum_ {x _ {1} ^ {\prime}} p _ {\theta} \left(x _ {1} ^ {\prime} \mid W _ {t} ^ {-}\right) \mathbb {P} \left(W _ {t} \mid W _ {t} ^ {-}, x _ {1} ^ {\prime}\right)\right) \right] + C \\ \end{array} +$$ + +where we have substituted in our definition of $p_{\theta}(\tilde{x}_1|W_t^{-},W_t)$ given by equation (23). We see that the first term $-\log p_{\theta}(\tilde{x}_1|W_t^{-})$ cancels with our cross entropy term. This then makes clear how we have arrived at our cross entropy decomposition of $\mathcal{L}_{\mathrm{ELBO}}$ . $\mathcal{L}_{\mathrm{ELBO}}$ will usually remove the cross entropy training signal and replace it with the term $\log \left( \sum_{x_1'} p_{\theta}(x_1'|W_t^{-})\mathbb{P}(W_t|W_t^{-},x_1') \right)$ which will be used as the training signal for the denoising model $p_{\theta}(x_1|W_t^{-})$ . The denoising model is encouraged to be such that the expected jump probability assigns high likelihood to the jump observed under the $x_1$ conditioned process $\mathbb{Q}^{|x_1|}$ . This is an indirect training signal for $p_{\theta}(x_1|W_t^{-})$ and one that relies on the arbitrary specification of our $\mathbb{Q}^{|x_1|}$ process. We instead show how we can replace this $p_{\theta}(x_1|W_t^{-})$ training signal with the cross entropy loss and be left with a KL term showing that the cross entropy is a lower bound on $\mathcal{L}_{\mathrm{ELBO}}$ minus the rate regularizing term. We summarize this argument in the next section. + +Summary To summarize, we have first derived the standard evidence lower bound on the model log-likelihood when using our specific generative rate matrix, $R_{t}^{\theta}(x_{t},j) = \mathbb{E}_{p_{\theta}(x_{1}|x_{t})}[R_{t}(x_{t},j|x_{1})]$ for some arbitrarily chosen $R_{t}(x_{t},j|x_{1})$ that generates the $p_{t|1}(x_t|x_1)$ conditional flow. + +$$ +\mathbb {E} _ {p _ {\text {d a t a}} (x _ {1})} \left[ \log p _ {\theta} (x _ {1}) \right] \geq \mathcal {L} _ {\text {E L B O}} + C +$$ + +We then split $\mathcal{L}_{\mathrm{ELBO}}$ into three terms $\mathcal{L}_{\mathrm{ce}} + \mathcal{L}_R + \mathcal{L}_{\mathrm{KL}}$ . We have seen how the term $\mathcal{L}_{\mathrm{KL}}$ allows us to remove the standard $\mathcal{L}_{\mathrm{ELBO}}$ training signal for the denoising model $p_{\theta}(x_1|x_t)$ and replace it with the cross entropy, creating the $\mathcal{L}_{\mathrm{ce}}$ term. This creates a looser bound if we are to train without the $\mathcal{L}_{\mathrm{KL}}$ term, + +$$ +\mathbb {E} _ {p _ {\text {d a t a}} (x _ {1})} \left[ \log p _ {\theta} (x _ {1}) \right] \geq \mathcal {L} _ {\mathrm {c e}} + \mathcal {L} _ {R} + C +$$ + +We then argue that $\mathcal{L}_R$ is close to $\hat{\mathcal{L}}_R$ which is an unnecessary forcing term encouraging our generative rate to achieve a similar jump rate to our chosen $R_{t}(x_{t},j|x_{1})$ even though this $R_{t}$ matrix is an arbitrary decision and will have a different jump rate depending on which $R_{t}$ is chosen. We are then left with the standard cross entropy term as our final objective for $p_{\theta}(x_1|x_t)$ with a final modification to its unweighted form for implementation ease. + +# C.2.1. OBJECTIVE FOR THE MASKING INTERPOLANT + +In this section we will show that $\mathcal{L}_{\mathrm{ELBO}}$ is exactly the weighted cross entropy for the case when we use the masking form for $p_{t|1}(x_t|x_1)$ . We note that a similar result has been proven by Austin et al. (2021) for the discrete time diffusion model, and here we verify that this result also holds for our DFM model. We will assume multi-dimensional data, $x_{1}\in \{1,\dots ,S\}^{D}$ . We refer to Appendix E for the details of the multi-dimensional setting. We will also assume that we use $R_{t}^{*}$ as our rate matrix that generates the $p_{t|1}(x_t|x_1)$ conditional flow. + +Before we manipulate $\mathcal{L}_{\mathrm{ELBO}}$ , we will first find the forms of $R_{t}^{*}(x_{t}^{1:D},j^{1:D}|x_{1}^{1:D})$ , $R_{t}^{\theta}(x_{t}^{1:D},j^{1:D})$ and $R_{t}^{\theta}(x_{t}^{1:D})$ for the masking case. From Appendix F.1, equation (31) we have, + +$$ +R _ {t} ^ {* d} (x _ {t} ^ {d}, j ^ {d} | x _ {1} ^ {d}) = \frac {1}{1 - t} \delta \left\{j ^ {d}, x _ {1} ^ {d} \right\} \delta \left\{x _ {t} ^ {d}, M \right\} +$$ + +and so + +$$ +\begin{array}{l} R _ {t} ^ {*} \left(x _ {t} ^ {1: D}, j ^ {1: D} | x _ {1} ^ {1: D}\right) = \sum_ {d = 1} ^ {D} \delta \left\{x _ {t} ^ {1: D \backslash d}, j ^ {1: D \backslash d} \right\} R _ {t} ^ {*} \left(x _ {t} ^ {d}, j ^ {d} | x _ {1} ^ {d}\right) \\ = \sum_ {d = 1} ^ {D} \delta \left\{x _ {t} ^ {1: D \backslash d}, j ^ {1: D \backslash d} \right\} \delta \left\{j ^ {d}, x _ {1} ^ {d} \right\} \delta \left\{x _ {t} ^ {d}, M \right\} \frac {1}{1 - t} \\ \end{array} +$$ + +From Appendix F.1, equation (32) we have that, + +$$ +R _ {t} ^ {\theta d} (x _ {t} ^ {1: D}, j ^ {d}) = \frac {p _ {\theta} (x _ {1} ^ {d} = j ^ {d} | x _ {t} ^ {1 : D})}{1 - t} \delta \left\{x _ {t} ^ {d}, M \right\} +$$ + +and therefore, + +$$ +\begin{array}{l} R _ {t} ^ {\theta} \left(x _ {t} ^ {1: D}, j ^ {1: D}\right) = \sum_ {d = 1} ^ {D} \delta \left\{x _ {t} ^ {1: D \backslash d}, j ^ {1: D \backslash d} \right\} R _ {t} ^ {\theta d} \left(x _ {t} ^ {1: D}, j ^ {d}\right) \\ = \sum_ {d = 1} ^ {D} \delta \left\{x _ {t} ^ {1: D \backslash d}, j ^ {1: D \backslash d} \right\} \frac {p _ {\theta} (x _ {1} ^ {d} = j ^ {d} | x _ {t} ^ {1 : D})}{1 - t} \delta \left\{x _ {t} ^ {d}, M \right\} \\ \end{array} +$$ + +We now find $R_{t}^{\theta}(x_{t}^{1:D})$ + +$$ +\begin{array}{l} R_{t}^{\theta}(x_{t}^{1:D}) = \sum_{j^{1:D}\neq x_{t}^{1:D}}R_{t}^{\theta}(x_{t}^{1:D},j^{1:D}) \\ = \sum_ {j ^ {1: D}} \left(1 - \delta \left\{j ^ {1: D}, x _ {t} ^ {1: D} \right\}\right) \sum_ {d = 1} ^ {D} \delta \left\{j ^ {1: D \backslash d}, x _ {t} ^ {1: D \backslash d} \right\} \frac {p _ {\theta} \left(x _ {1} ^ {d} = j ^ {d} \mid x _ {t} ^ {1 : D}\right)}{1 - t} \delta \left\{x _ {t} ^ {d}, M \right\} \\ = \sum_ {d = 1} ^ {D} \sum_ {j ^ {1: D \backslash d}} \delta \left\{j ^ {1: D \backslash d}, x _ {t} ^ {1: D \backslash d} \right\} \delta \left\{x _ {t} ^ {d}, M \right\} \frac {1}{1 - t} \sum_ {j ^ {d}} \left(1 - \delta \left\{j ^ {1: D}, x _ {t} ^ {1: D} \right\}\right) p _ {\theta} (x _ {1} ^ {d} = j ^ {d} | x _ {t} ^ {1: D}) \\ \end{array} +$$ + +$$ +\begin{array}{l} = \sum_ {d = 1} ^ {D} \delta \left\{x _ {t} ^ {d}, M \right\} \frac {1}{1 - t} \sum_ {j ^ {d}} \left(1 - \delta \left\{j ^ {d}, x _ {t} ^ {d} \right\}\right) p _ {\theta} \left(x _ {1} ^ {d} = j ^ {d} \mid x _ {t} ^ {1: D}\right) \\ = \sum_ {d = 1} ^ {D} \delta \left\{x _ {t} ^ {d}, M \right\} \frac {1}{1 - t} \sum_ {j ^ {d} \neq x _ {t} ^ {d}} p _ {\theta} \left(x _ {1} ^ {d} = j ^ {d} \mid x _ {t} ^ {1: D}\right) \\ = \sum_ {d = 1} ^ {D} \delta \left\{x _ {t} ^ {d}, M \right\} \frac {1}{1 - t} \\ \end{array} +$$ + +where on the final line we have used the fact that $p_{\theta}(x_1^d = M|x_t^{1:D}) = 0$ . + +We are now ready to manipulate the form of $\mathcal{L}_{\mathrm{ELBO}}$ . We start with + +$$ +\mathcal {L} _ {\mathrm {E L B O}} = \int p _ {\mathrm {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \left(- \int_ {t = 0} ^ {t = 1} R _ {t} ^ {\theta} (W _ {t}) \mathrm {d} t + \sum_ {t: W _ {t} ^ {-} \neq W _ {t}} \log \left(R _ {t} ^ {\theta} \left(W _ {t} ^ {-}, W _ {t}\right)\right)\right) + C +$$ + +We then apply Dynkin's formula + +$$ +\mathcal {L} _ {\mathrm {E L B O}} = \int p _ {\mathrm {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \left(\int_ {t = 0} ^ {t = 1} - R _ {t} ^ {\theta} (W _ {t}) + \sum_ {y \neq W _ {t}} R _ {t} ^ {*} (W _ {t}, y | x _ {1}) \log \left(R _ {t} ^ {\theta} (W _ {t}, y)\right) \mathrm {d} t\right) + C +$$ + +We now substitute in the masking forms for $R_{t}^{\theta}(W_{t})$ , $R_{t}^{*}(W_{t},y|x_{1})$ and $R_{t}^{\theta}(W_{t},y)$ + +$$ +\begin{array}{l} \mathcal {L} _ {\mathrm {E L B O}} = \int p _ {\mathrm {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \left(\int_ {t = 0} ^ {t = 1} \left(- \sum_ {d = 1} ^ {D} \delta \left\{W _ {t} ^ {d}, M \right\} \frac {1}{1 - t}\right) + \right. \\ \sum_ {y ^ {1: D} \neq W _ {t} ^ {1: D}} \left\{\left(\sum_ {d = 1} ^ {D} \delta \left\{W _ {t} ^ {1: D \backslash d}, y ^ {1: D \backslash d} \right\} \delta \left\{y ^ {d}, x _ {1} ^ {d} \right\} \delta \left\{W _ {t} ^ {d}, M \right\} \frac {1}{1 - t}\right) \times \right. \\ \left. \log \left(\sum_ {d = 1} ^ {D} \delta \left\{W _ {t} ^ {1: D \backslash d}, y ^ {1: D \backslash d} \right\} \delta \left\{W _ {t} ^ {d}, M \right\} p _ {\theta} \left(y ^ {d} \mid W _ {t} ^ {1: D}\right) \frac {1}{1 - t}\right)\right\} \mathrm {d} t\left. \right) + C \\ \end{array} +$$ + +$$ +\mathcal {L} _ {\mathrm {E L B O}} = \int p _ {\mathrm {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \left(\int_ {t = 0} ^ {t = 1} \sum_ {d = 1} ^ {D} \sum_ {y ^ {d} \neq W _ {t} ^ {d}} \delta \left\{W _ {t} ^ {d}, M \right\} \delta \left\{y ^ {d}, x _ {1} ^ {d} \right\} \frac {1}{1 - t} \log \left(p _ {\theta} (y ^ {d} | W _ {t} ^ {1: D})\right) \mathrm {d} t\right) + C +$$ + +where we have moved terms that don't depend on $\theta$ into the constant. + +$$ +\begin{array}{l} \mathcal {L} _ {\mathrm {E L B O}} = \int p _ {\mathrm {d a t a}} (\mathrm {d} x _ {1}) \mathbb {Q} ^ {| x _ {1}} (\mathrm {d} \omega) \left(\int_ {t = 0} ^ {t = 1} \sum_ {d = 1} ^ {D} \delta \left\{W _ {t} ^ {d}, M \right\} \frac {1}{1 - t} \log \left(p _ {\theta} \left(x _ {1} ^ {d} | W _ {t} ^ {1: D}\right)\right) \mathrm {d} t\right) + C \\ = \mathbb {E} _ {\mathcal {U} (t; 0, 1) p _ {\text {d a t a}} \left(x _ {1}\right) p _ {t} \left(x _ {t} \mid x _ {1}\right)} \left[ \sum_ {d = 1} ^ {D} \delta \left\{x _ {t} ^ {d}, M \right\} \frac {1}{1 - t} \log p _ {\theta} \left(x _ {1} ^ {d} \mid x _ {t} ^ {1: D}\right) \right] + C \tag {24} \\ \end{array} +$$ + +where we have arrived at the weighted cross entropy, weighted by $\frac{1}{1 - t}$ and only calculated for dimensions that are masked in our corrupted sample $x_{t}$ . + +# D. Discussion of Related Work + +Flow based methods for generative modelling were introduced by (Liu et al., 2023; Albergo & Vanden-Eijnden, 2023; Lipman et al., 2023). These methods simplify the generative modelling framework over diffusion models (Sohl-Dickstein et al., 2015; Ho et al., 2020; Song et al., 2020) by considering noise-data interpolants rather than considering forward/backward + +diffusions. This work brings these benefits to discrete data denoising models which previously have used the diffusion methodology (Sohl-Dickstein et al., 2015; Hoogeboom et al., 2021; Austin et al., 2021) relying on forward/backward processes defined by Markov transition kernels. Specifically, prior discrete diffusion works first define a forward noisng process with a rate matrix $\tilde{R}_t$ . This defines infinitesimal noise additions. To train the model, we need access to the equivalent of $p_{t|1}$ , i.e. the total amount of noise added simulating from 1 to $t$ . To find this value, the matrix exponential needs to be applied to the forward rate matrix, $p_{t|1} = \exp \left(\int_t^1\tilde{R}_s\mathrm{d}s\right)$ . This means that discrete diffusion models are limited in the choice of forward noisng process. The choice of $\tilde{R}_t$ must be such that the matrix exponential is tractable. For DFM, we simply write down $p_{t|1}$ rather than implicitly defining it through the matrix exponential and then can find a rate matrix to simulate with by differentiating $p_{t|1}$ and using $R_t^*$ . Furthermore, the standard ELBO objective used to train discrete diffusion models depends on the initial choice of $\tilde{R}_t$ . At sample time, it is then standard to simulate with the time reversal of $\tilde{R}_t$ . This needlessly limits the choice of simulation process as we have shown in this work that there are infinitely many valid choices of rate matrices that could be used for sampling. + +There have been post-hoc changes to the sampling process made in prior work e.g. corrector steps used by Campbell et al. (2022), however due to the ELBO maximizing the model log-likelihood under the assumption of sampling using the time-reversal, the diffusion framework still revolves around one 'canonical' sample time process (the time-reversal) whereas DFM makes it clear this choice is arbitrary and the sample process can be chosen at inference time for best performance. + +Previous discrete diffusion works have also suggested alternatives to the ELBO. Sun et al. (2023b) introduce a categorical score matching loss that resembles the cross entropy, however, the denoising network is required to make a prediction $x_0^d$ based only on the other $D - 1$ dimensions of the input noisy state, $x_t^{1:D\backslash d}$ . This requires specialized architectures and methods to remain computationally efficient. Vignac et al. (2023a) propose to learn a diffusion based model solely using the cross-entropy but do not analyse the link between the cross-entropy and the log-likelihood of the model as we do in App. C. Meng et al. (2022) propose to learn a discrete score model based on data ratios using an L2 based loss which has some undesirable properties such as not penalizing mode dropping as described by Lou et al. (2023). Lou et al. (2023) refine this approach and propose to learn data ratios using the score entropy loss which, like the standard cross entropy, does not depend on the choice of forward rate matrix. However, in order for the score entropy to be a true ELBO, the forward rate matrix needs to be used as a weighting factor. + +Multimodal diffusion models have been applied to tabular data (Kotelnikov et al., 2023) where continuous diffusion is used for continuous features and a uniform style of corruption under a discrete diffusion framework is applied to discrete features. This idea was then expanded to molecule generation where the task is to generate a molecules atom types, their positions and their connectivity. Peng et al. (2023) use a masking process for the discrete atom types and bond types with a continuous space process for the atom positions. Vignac et al. (2023b) use a discrete process converging towards the independent marginal distribution in each dimension (Vignac et al., 2023a) for atom types, bond types and formal charges of the molecules along with a continuous process for atom positions. Hua et al. (2023) use a uniform discrete process for bond types with a continuous space process applied to atom positions as well as atom features embedded in continuous space. These works also investigate the importance of the multimodal noise schedule. Peng et al. (2023) find that corrupting the bonds first and then the atom positions improves performance by avoiding unphysical bonds appearing in the corruption process. Vignac et al. (2023b) have a similar finding that during corruption, the atom types should be corrupted first, then the bond types and finally the atom positions. We generalize these ideas by using the approach of Albergo et al. (2023) and learning our model over all relative levels of noise between our modalities. This allows picking the desired path through the multimodal noise landscape at inference time either performing co-generation, inverse folding or forward folding. + +Other approaches for discrete data modelling opt to embed the data into a continuous space in order to still use the continuous diffusion framework (Li et al., 2022; Chen et al., 2023a; Richemond et al., 2022; Gong et al., 2023; Dieleman et al., 2022; Han et al., 2022; Strudel et al., 2022; Gulrajani & Hashimoto, 2023; Floto et al., 2023), however, this loses the discrete structure of the data during generation. This can be important when the quantity that is represented by the discrete variable as algorithmic importance. For example, Qin et al. (2023) perform sparse graph generation where the discrete token represents the existence of an edge. It is then important for the edge to be known to physically exist or not so that sparse graph networks can be applied to the problem. + +General Fokker-Planck equations on discrete state spaces (Chow et al., 2012) have been used to construct sampling methods for energy functions (Sun et al., 2023a). Further, in a generative modelling context, the Kolmogorov equation has been used to construct equivalent diffusion processes with fewer transitions (Zhang et al., 2023) making links to optimal transport. We + +take this idea further to build a generative modelling paradigm around the flexibility of the Kolmogorov equation. + +The construction of discrete diffusion model from a marginal distribution perspective as opposed to a forward corruption process has also been used by Chen et al. (2023b). Their method defines the marginal distribution at time $t$ as a combination of the data and a noise sample and then finds a process that generates those marginals, for the masking and uniform case. They use this to create a faster sampling algorithm by exploiting the fact that if you have a low stochasticity process, you know there should only be $D$ transitions in the masking case (although this is not the case in the unconditional uniform case). Therefore, when conditioning on these times, only $D$ function evaluations are needed. This approach could also be used with a DFM when $\eta = 0$ , however, our general framework also demonstrates the benefits of allowing $\eta > 0$ . + +The consideration of flows on discrete state spaces has also been used to construct GFlowNet algorithms (Bengio et al., 2023) which aim to sample from a given energy function. Here we instead focus on the generative modeling context where we aim to sample novel datapoints when only given access to some dataset of training examples. GFlowNets also can use the detailed balance equation Eq. (9) as a training training objective. Detailed balance is also used in Markov Chain Monte Carlo methods (Metropolis et al., 1953; Hastings, 1970) to construct a transition probability with the desired energy function that we wish to sample from as its stationary distribution. In our work, we use the detailed balance condition as a way to increase the inference time flexibility in our framework + +# E. Multidimensional Data + +In this section we derive how we can efficiently model $D$ dimensional data, $x_{1} \in \{1, \dots, S\}^{D}$ by using factorization assumptions. When we wish to emphasize the multidimensional aspect we can write $x_{1}^{1:D}$ and use $x_{1}^{d} \in \{1, \dots, S\}$ to refer to the value in dimension $d$ . We use $1: D \backslash d$ to denote all dimensions except $d$ . To operate in multidimensional spaces, we will make the following assumptions + +Assumption 1 $p_{t|1}(x_t^{1:D}|x_1^{1:D}) = \prod_{d=1}^D p_{t|1}(x_t^d|x_1^d)$ +- Assumption 2 $p_{t|1}(x_t^d | x_1^d) = 0 \Rightarrow \partial_t p_{t|1}(x_t^d | x_1^d) = 0, \forall d$ +- Assumption 3 $R_{t}(x_{t}^{1:D},j^{1:D}|x_{1}^{1:D}) = \sum_{d = 1}^{D}\delta \{x_{t}^{1:D\setminus d},j^{1:D\setminus d}\} R_{t}^{d}(x_{t}^{d},j^{d}|x_{1}^{d})$ + +The first assumption creates independent corruption processes in each dimension, similar to the factorization assumptions made in diffusion models where the forward noising processes proceed independently in each dimension. Assumption 2 is the same assumption we made in order to derive $R_{t}^{*}$ in 1-dimension but now we assume it individually for every dimension. Finally, assumption 3 states that for our data conditional rate matrix, it decomposes into a sum of rate matrices for each dimension and so the rate for transitions that change more than 1 dimension at a time are 0. This is the same assumption made by Campbell et al. (2022) in order to make calculations tractable. We will enable our process to make multiple dimensional changes simultaneously later when we come to derive our sampling algorithm. + +Under these assumptions, we will now derive DFM for the multidimensional case. We start with the data conditional Kolmogorov equation + +$$ +\partial_ {t} p _ {t | 1} \left(x _ {t} ^ {1: D} \mid x _ {1} ^ {1: D}\right) = \sum_ {j ^ {1: D}} R _ {t} \left(j ^ {1: D}, x _ {t} ^ {1: D} \mid x _ {1} ^ {1: D}\right) p _ {t | 1} \left(j ^ {1: D} \mid x _ {t} ^ {1: D}\right) \tag {25} +$$ + +We now substitute the form for the rate matrix under Assumption 3 into the RHS of (25) to get + +$$ +\begin{array}{l} \mathrm {R H S} = \sum_ {j ^ {1: D}} \sum_ {d = 1} ^ {D} \delta \left\{x _ {t} ^ {1: D \backslash d}, j ^ {1: D \backslash d} \right\} R _ {t} ^ {d} \left(j ^ {d}, x _ {t} ^ {d} | x _ {1} ^ {d}\right) p _ {t | 1} \left(j ^ {1: D} | x _ {1} ^ {1: D}\right) \\ = \sum_ {d = 1} ^ {D} \sum_ {j ^ {d}} R _ {t} ^ {d} \left(j ^ {d}, x _ {t} ^ {d} \mid x _ {1} ^ {d}\right) p _ {t | 1} \left(x _ {t} ^ {1: D \backslash d} \odot j ^ {d} \mid x _ {1} ^ {1: D}\right) \tag {26} \\ \end{array} +$$ + +where we use $x_{t}^{1:D\setminus d}\odot j^{d}$ to denote a vector of dimension $D$ where in the $d$ -th dimension it has the value of $j^d$ and in the other dimensions it has values $x_{t}^{1:D\setminus d}$ . We now verify that the following form for $R_{t}^{d}$ satisfies the Kolmogorov equation, + +$$ +R _ {t} ^ {* d} \left(x _ {t} ^ {d}, j ^ {d} \mid x _ {1} ^ {d}\right) = \left\{ \begin{array}{l l} \frac {\operatorname {R e L U} \left(\partial_ {t} p _ {t | 1} \left(j ^ {d} \mid x _ {1} ^ {d}\right) - \partial_ {t} p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right)\right)}{\mathcal {Z} _ {t} ^ {d} p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right)} & \text {f o r} p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right) > 0, p _ {t | 1} \left(j ^ {d} \mid x _ {1} ^ {d}\right) > 0 \\ = 0 & \text {o t h e r w i s e} \end{array} \right. \tag {27} +$$ + +where $\mathcal{Z}_t^d = |\{j^d:p_{t|1}(j^d|x_1^d) > 0\} |$ and we only define $R_{t}^{*d}$ for off-diagonal entries, $x_{t}^{d}\neq j^{d}$ remembering that $R_{t}^{*d}(x_{t}^{d},x_{t}^{d}|x_{1}^{d}) = -\sum_{j^{d}\neq x_{t}^{d}}R_{t}^{*d}(x_{t}^{d},j^{d}|x_{1}^{d}).$ + +We first assume $p_{t|1}(x_t^d | x_1^d) > 0 \forall d$ and substitute in $R_t^{*d}$ into equation (26). + +$$ +\begin{array}{l} \mathrm {R H S} = \sum_ {d = 1} ^ {D} \sum_ {j ^ {d} \neq x _ {t} ^ {d}, p _ {t | 1} (j ^ {d} | x _ {1} ^ {d}) > 0} \left(\frac {\mathrm {R e L U} \left(\partial_ {t} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d}) - \partial_ {t} p _ {t | 1} (j ^ {d} | x _ {1} ^ {d})\right)}{\mathcal {Z} _ {t} ^ {d} p _ {t | 1} (j ^ {d} | x _ {1} ^ {d})} p _ {t | 1} (x _ {t} ^ {1: D \setminus d} \odot j ^ {d} | x _ {1} ^ {1: D}) \right. \\ - \left. \frac {\mathrm {R e L U} \left(\partial_ {t} p _ {t | 1} (j ^ {d} | x _ {1} ^ {d}) - \partial_ {t} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d})\right)}{\mathcal {Z} _ {t} ^ {d} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d})} p _ {t | 1} (x _ {t} ^ {1: D} | x _ {1} ^ {1: D})\right) \\ \end{array} +$$ + +$$ +\begin{array}{l} \mathrm {R H S} = \sum_ {d = 1} ^ {D} \frac {1}{\mathcal {Z} _ {t} ^ {d}} p _ {t | 1} \left(x _ {t} ^ {1: D \backslash d} \mid x _ {1} ^ {1: D}\right) \sum_ {j ^ {d} \neq i ^ {d}, p _ {t | 1} \left(j ^ {d} \mid x _ {1} ^ {d}\right) > 0} \left(\operatorname {R e L U} \left(\partial_ {t} p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right) - \partial_ {t} p _ {t | 1} \left(j ^ {d} \mid x _ {1} ^ {d}\right)\right) \right. \\ \left. \right.\left. - \operatorname {R e L U} \left(\partial_ {t} p _ {t | 1} (j ^ {d} | x _ {1} ^ {d}) - \partial_ {t} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d})\right)\right) \\ \end{array} +$$ + +$$ +\begin{array}{l} \mathrm {R H S} = \sum_ {d = 1} ^ {D} \frac {1}{\mathcal {Z} _ {t} ^ {d}} p _ {t | 1} (x _ {t} ^ {1: D \backslash d} | x _ {1} ^ {1: D}) \sum_ {j ^ {d} \neq i ^ {d}, p _ {t | 1} (j ^ {d} | x _ {1} ^ {d}) > 0} \left(\partial_ {t} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d}) - \partial_ {t} p _ {t | 1} (j ^ {d} | x _ {1} ^ {d})\right) \\ = \sum_ {d = 1} ^ {D} p _ {t | 1} \left(x _ {t} ^ {1: D \backslash d} \mid x _ {1} ^ {1: D}\right) \partial_ {t} p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right) \\ = \partial_ {t} \left(\prod_ {d = 1} ^ {D} p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right)\right) \\ = \mathrm {L H S} \\ \end{array} +$$ + +where we have used the fact that $p_{t|1}(x_t^{1:D}|x_1^{1:D}) = \prod_{d=1}^D p_{t|1}(x_t^d|x_1^d)$ . + +For the case that there exists a $d'$ for which $p_{t|1}(x_t^{d'}|x_1^{d'}) = 0$ we have $\partial_t p_{t|1}(x_t^{d'}|x_1^{d'}) = 0$ by assumption. We first examine the LHS of equation (25) in this case. + +$$ +\begin{array}{l} \mathrm {L H S} = \partial_ {t} p _ {t | 1} \left(x _ {t} ^ {1: D} \mid x _ {1} ^ {1: D}\right) \\ = \partial_ {t} \left(\prod_ {d = 1} ^ {D} p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right)\right) \\ = \sum_ {d = 1} ^ {D} p _ {t | 1} (x _ {t} ^ {1: D \backslash d} | x _ {1} ^ {1: D \backslash d}) \partial_ {t} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d}) \\ = p _ {t | 1} (x _ {t} ^ {1: D \backslash d ^ {\prime}} | x _ {1} ^ {1: D \backslash d ^ {\prime}}) \partial_ {t} p _ {t | 1} (x _ {t} ^ {d ^ {\prime}} | x _ {1} ^ {d ^ {\prime}}) + \sum_ {d = 1 \backslash d ^ {\prime}} ^ {D} p _ {t | 1} (x _ {t} ^ {1: D \backslash d} | x _ {1} ^ {1: D \backslash d}) \partial_ {t} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d}) \\ = p _ {t | 1} (x _ {t} ^ {1: D \setminus d ^ {\prime}} | x _ {1} ^ {1: D \setminus d ^ {\prime}}) \underbrace {\partial_ {t} p _ {t | 1} (x _ {t} ^ {d ^ {\prime}} | x _ {1} ^ {d ^ {\prime}})} _ {0} + \sum_ {d = 1 \setminus d ^ {\prime}} ^ {D} \underbrace {p _ {t | 1} (x _ {t} ^ {d ^ {\prime}} | x _ {1} ^ {d ^ {\prime}})} _ {0} p _ {t | 1} (x _ {t} ^ {1: D \setminus d, d ^ {\prime}} | x _ {1} ^ {1: D \setminus d, d ^ {\prime}}) \partial_ {t} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d}) \\ = 0 \\ \end{array} +$$ + +where we use $1:D\backslash d,d^{\prime}$ to mean all dimensions except $d$ and $d^{\prime}$ . We now examine the RHS of equation (25). + +$$ +\mathrm {R H S} = \sum_ {d = 1} ^ {D} \sum_ {j ^ {d}} R _ {t} ^ {* d} (j ^ {d}, x _ {t} ^ {d} | x _ {1} ^ {d}) p _ {t | 1} (x _ {t} ^ {1: D \backslash d} \odot j ^ {d} | x _ {1} ^ {1: D}) +$$ + +$$ +\begin{array}{l} = \sum_ {j ^ {d ^ {\prime}}} R _ {t} ^ {* d ^ {\prime}} (j ^ {d ^ {\prime}}, x _ {t} ^ {d ^ {\prime}} | x _ {1} ^ {d ^ {\prime}}) p _ {t | 1} (x _ {t} ^ {1: D \setminus d ^ {\prime}} \odot j ^ {d ^ {\prime}} | x _ {1} ^ {1: D}) + \sum_ {d = 1 \setminus d ^ {\prime}} ^ {D} \sum_ {j ^ {d}} R _ {t} ^ {* d} (j ^ {d}, x _ {t} ^ {d} | x _ {1} ^ {d}) p _ {t | 1} (x _ {t} ^ {1: D \setminus d} \odot j ^ {d} | x _ {1} ^ {1: D}) \\ = \sum_ {j ^ {d ^ {\prime}}} \underbrace {R _ {t} ^ {* d ^ {\prime}} \left(j ^ {d ^ {\prime}} , x _ {t} ^ {d ^ {\prime}} \mid x _ {1} ^ {d ^ {\prime}}\right)} _ {0} p _ {t | 1} \left(x _ {t} ^ {1: D \setminus d ^ {\prime}} \odot j ^ {d ^ {\prime}} \mid x _ {1} ^ {1: D}\right) \\ + \sum_ {d = 1 \backslash d ^ {\prime}} ^ {D} \sum_ {j ^ {d}} R _ {t} ^ {* d} (j ^ {d}, x _ {t} ^ {d} | x _ {1} ^ {d}) \underbrace {p _ {t | 1} (x _ {t} ^ {d ^ {\prime}} | x _ {1} ^ {d ^ {\prime}})} _ {0} p _ {t | 1} (x _ {t} ^ {1: D \backslash d, d ^ {\prime}} \odot j ^ {d} | x _ {1} ^ {1: D \backslash d ^ {\prime}}) \\ = 0 \\ = \mathrm {L H S} \\ \end{array} +$$ + +where we have used the fact that $R_{t}^{*d^{\prime}}(j^{d^{\prime}},x_{t}^{d^{\prime}}|x_{1}^{d^{\prime}}) = 0$ because $p_{t|1}(j^{d^{\prime}}|x_1^{d^{\prime}}) = 0$ . Therefore, for both cases we have $R_{t}^{*}$ satisfies the conditional Kolmogorov equation (25) and thus we have found a rate matrix that generates our desired conditional flow. The final step is to convert this rate matrix conditioned on $x_{1}^{1:D}$ into an unconditional rate matrix that can be used for generative modeling. We first write down the unconditional multi-dimensional Kolmogorov equation + +$$ +\partial_ {t} p _ {t} \left(x _ {t} ^ {1: D}\right) = \sum_ {j ^ {1: D}} R _ {t} \left(j ^ {1: D}, x _ {t} ^ {1: D}\right) p _ {t} \left(j ^ {1: D}\right) \tag {28} +$$ + +We now make the following assumption for the form of the unconditional rate matrix and verify that it indeed satisfies the unconditional multi-dimensional Kolmogorov equation, (28). + +$$ +R _ {t} \left(x _ {t} ^ {1: D}, j ^ {1: D}\right) = \sum_ {d = 1} ^ {D} \delta \left\{x _ {t} ^ {1: D \backslash d}, j ^ {1: D \backslash d} \right\} R _ {t} ^ {d} \left(x _ {t} ^ {1: D}, j ^ {d}\right) \tag {29} +$$ + +with + +$$ +R _ {t} ^ {d} (x _ {t} ^ {1: D}, j ^ {d}) = \mathbb {E} _ {p (x _ {1} ^ {d} | x _ {t} ^ {1: D})} \left[ R _ {t} ^ {* d} (x _ {t} ^ {d}, j ^ {d} | x _ {1} ^ {d}) \right] +$$ + +with $R_{t}^{*d}(x_{t}^{d},j^{d}|x_{1}^{d})$ being given by (27). Substitute this form into (28) + +$$ +\begin{array}{l} \mathrm {R H S} = \sum_ {j ^ {1: D}} \sum_ {d = 1} ^ {D} \delta \{j ^ {1: D \backslash d}, x _ {t} ^ {1: D \backslash d} \} \mathbb {E} _ {p (x _ {1} ^ {d} | j ^ {1: D})} \left[ R _ {t} ^ {* d} (j ^ {d}, x _ {t} ^ {d} | x _ {1} ^ {d}) \right] p _ {t} (j ^ {1: D}) \\ = \sum_ {d = 1} ^ {D} \sum_ {j ^ {d}} \mathbb {E} _ {p (x _ {1} ^ {d} | x _ {t} ^ {1: D \setminus d} \odot j ^ {d})} \left[ R _ {t} ^ {* d} (j ^ {d}, x _ {t} ^ {d} | x _ {1} ^ {d}) \right] p _ {t} (x _ {t} ^ {1: D \setminus d} \odot j ^ {d}) \\ = \sum_ {d = 1} ^ {D} \sum_ {j ^ {d}} \sum_ {x _ {1} ^ {d}} p (x _ {1} ^ {d} | x _ {t} ^ {1: D \backslash d} \odot j ^ {d}) R _ {t} ^ {* d} (j ^ {d}, x _ {t} ^ {d} | x _ {1} ^ {d}) p _ {t} (x _ {t} ^ {1: D \backslash d} \odot j ^ {d}) \\ = \sum_ {d = 1} ^ {D} \sum_ {j ^ {d}} \sum_ {x _ {1} ^ {d}} p (x _ {1} ^ {d} | x _ {t} ^ {1: D \backslash d} \odot j ^ {d}) R _ {t} ^ {* d} (j ^ {d}, x _ {t} ^ {d} | x _ {1} ^ {d}) p _ {t} (x _ {t} ^ {1: D \backslash d} \odot j ^ {d}) \underbrace {\sum_ {x _ {1} ^ {1 : D \backslash d}} p (x _ {1} ^ {1 : D \backslash d} | x _ {1} ^ {d} , x _ {t} ^ {1 : D \backslash d} \odot j ^ {d})} _ {= 1} \\ = \sum_ {d = 1} ^ {D} \sum_ {j ^ {d}} \sum_ {x _ {1} ^ {1: D}} p (x _ {1} ^ {1: D} | x _ {t} ^ {1: D \backslash d} \odot j ^ {d}) R _ {t} ^ {* d} (j ^ {d}, x _ {t} ^ {d} | x _ {1} ^ {d}) p _ {t} (x _ {t} ^ {1: D \backslash d} \odot j ^ {d}) \\ = \sum_ {d = 1} ^ {D} \sum_ {j ^ {d}} \sum_ {x _ {1} ^ {1: D}} p _ {\mathrm {d a t a}} (x _ {1} ^ {1: D}) p _ {t | 1} (x _ {t} ^ {1: D \backslash d} \odot j ^ {d} | x _ {1} ^ {1: D}) R _ {t} ^ {* d} (j ^ {d}, x _ {t} ^ {d} | x _ {1} ^ {d}) \\ = \mathbb {E} _ {p _ {\text {d a t a}} \left(x _ {1} ^ {1: D}\right)} \left[ \sum_ {d = 1} ^ {D} \sum_ {j ^ {d}} p _ {t | 1} \left(x _ {t} ^ {1: D \backslash d} \odot j ^ {d} \mid x _ {1} ^ {1: D}\right) R _ {t} ^ {* d} \left(j ^ {d}, x _ {t} ^ {d} \mid x _ {1} ^ {d}\right) \right] \\ \end{array} +$$ + +$$ +\begin{array}{l} = \mathbb {E} _ {p _ {\text {d a t a}} \left(x _ {1} ^ {1: D}\right)} \left[ \partial_ {t} p _ {t | 1} \left(x _ {t} ^ {1: D} \mid x _ {1} ^ {1: D}\right) \right] \quad \text {b y} (2 6) \\ = \partial_ {t} p _ {t} (x _ {t} ^ {1: D}) \\ = \mathrm {L H S} \\ \end{array} +$$ + +where we have used Eq. (26) with the fact that we know $R_{t}^{*}$ given by Eq. (27) satisfies the conditional Kolmogorov equation Eq. (25). We have now verified that the rate given by Eq. (29) gives us our desired unconditional flow and we can use it for generative modeling. + +# E.1. Training + +In order to approximate the true generative rate matrix given by equation (29), we need approximations to the denoising distributions in each dimension, $p(x_1^d | x_t^{1:D})$ , for $d = 1, \ldots, D$ . We can parameterize these conditionally independent $x_1^d$ distributions through a neural network that outputs logits of shape $D \times S$ when given input $x_t^{1:D}$ of shape $D$ . We then apply a softmax to the logits to obtain approximate denoising probabilities $p_{\theta}(x_1^d | x_t^{1:D})$ , $d = 1, \ldots, D$ of shape $D \times S$ . We learn the parameters of the neural network with the cross entropy loss for each dimension + +$$ +\mathcal {L} _ {\mathrm {c e}} = \mathbb {E} _ {p _ {\mathrm {d a t a}} (x _ {1} ^ {1: D}) \mathcal {U} (t; 0, 1) p _ {t | 1} (x _ {t} ^ {1: D} | x _ {1} ^ {1: D})} \left[ \sum_ {d = 1} ^ {D} \log p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} | x _ {t} ^ {1: D}) \right] +$$ + +# E.2. Sampling + +The standard Euler step transition probability for our CTMC defined through our learned denoising model with time step $\Delta t$ is + +$$ +\begin{array}{l} p _ {t + \Delta t | t} (j ^ {1: D} | x _ {t} ^ {1: D}) = \delta \{x _ {t} ^ {1: D}, j ^ {1: D} \} + R _ {t} ^ {\theta} (x _ {t} ^ {1: D}, j ^ {1: D}) \Delta t \\ = \delta \left\{x _ {t} ^ {1: D}, j ^ {1: D} \right\} + \sum_ {d = 1} ^ {D} \delta \left\{x _ {t} ^ {1: D \backslash d}, j ^ {1: D \backslash d} \right\} \mathbb {E} _ {p _ {\theta} \left(x _ {1} ^ {d} \mid x _ {t} ^ {1: D}\right)} \left[ R _ {t} ^ {d} \left(x _ {t} ^ {d}, j ^ {d} \mid x _ {1} ^ {d}\right) \right] \Delta t \tag {30} \\ \end{array} +$$ + +In this form, we would be unable to make transition steps that involve more than 1 dimension changing at a time due to our factorized form for $R_{t}^{\theta}(x_{t}^{1:D}, j^{1:D})$ . To enable multiple dimensions to transition simultaneously in a single update step we can approximate the standard Euler transition step (30) with a factorized version $\tilde{p}_{t + \Delta t|t}(j^{1:D}|x_t^{1:D})$ with the following form + +$$ +\begin{array}{l} \tilde {p} _ {t + \Delta t | t} (j ^ {1: D} | x _ {t} ^ {1: D}) = \prod_ {d = 1} ^ {D} \tilde {p} _ {t + \Delta t | t} ^ {d} (j ^ {d} | x _ {t} ^ {1: D}) \\ = \prod_ {d = 1} ^ {D} \left\{\delta \left\{x _ {t} ^ {d}, j ^ {d} \right\} + \mathbb {E} _ {p _ {\theta} \left(x _ {1} ^ {d} \mid x _ {t} ^ {1: D}\right)} \left[ R _ {t} ^ {d} \left(x _ {t} ^ {d}, j ^ {d} \mid x _ {1} ^ {d}\right) \right] \Delta t \right\} \\ = \delta \{x _ {t} ^ {1: D}, j ^ {1: D} \} + \sum_ {d = 1} ^ {D} \delta \{x _ {t} ^ {1: D \backslash d}, j ^ {1: D \backslash d} \} \mathbb {E} _ {p _ {\theta} (x _ {1} ^ {d} | x _ {t} ^ {1: D})} \left[ R _ {t} ^ {d} (x _ {t} ^ {d}, j ^ {d} | x _ {1} ^ {d}) \right] \Delta t + O (\Delta t ^ {2}) \\ \end{array} +$$ + +where we can see on the final line that $\tilde{p}_{t + \Delta t|t}$ approximates $p_{t + \Delta t|t}$ to first order. Sampling from $\tilde{p}_{t + \Delta t|t}$ can be seen as taking an Euler step in each dimension independently for each simulation step. + +We note this sampling method is similar to the tau-leaping method used in prior CTMC based approaches (Gillespie, 2001; Campbell et al., 2022) however tau-leaping allows multiple jumps to be made in the same dimensions which is unsuitable for categorical data. + +# E.3. Detailed Balance + +In this section we verify that if we achieve detailed balance individually and independently in each dimension, then our full dimensional process will also be in detailed balance. + +Consider the multidimensional detailed balance equation + +$$ +p _ {t | 1} (x _ {t} ^ {1: D} | x _ {1} ^ {1: D}) R _ {t} (x _ {t} ^ {1: D}, j ^ {1: D} | x _ {1} ^ {1: D}) = p _ {t | 1} (j ^ {1: D} | x _ {1} ^ {1: D}) R _ {t} (j ^ {1: D}, x _ {t} ^ {1: D} | x _ {1} ^ {1: D}) +$$ + +Now, substitute in our factorized forms for $R_{t}(x_{t}^{1:D}, j^{1:D}|x_{1}^{1:D})$ and $p_{t|1}(x_t^{1:D}|x_1^{1:D})$ + +$$ +\left(\prod_ {d = 1} ^ {D} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d})\right) \left(\sum_ {d = 1} ^ {D} \delta \{x _ {t} ^ {1: D \setminus d}, j ^ {1: D \setminus d} \} R _ {t} ^ {d} (x _ {t} ^ {d}, j ^ {d} | x _ {1} ^ {d})\right) = \left(\prod_ {d = 1} ^ {D} p _ {t | 1} (j ^ {d} | x _ {1} ^ {d})\right) \left(\sum_ {d = 1} ^ {D} \delta \{j ^ {1: D \setminus d}, x _ {t} ^ {1: D \setminus d} \} R _ {t} ^ {d} (j ^ {d}, x _ {t} ^ {d} | x _ {1} ^ {d})\right) +$$ + +Now, both sides are 0 for when $x_{t}$ and $j$ differ in more than one dimension. Consider the case when they differ in exactly one dimension, call it $d$ . The detailed balance equation simplifies to + +$$ +p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d}) R _ {t} ^ {d} (x _ {t} ^ {d}, j ^ {d} | x _ {1} ^ {d}) = p _ {t | 1} (j ^ {d} | x _ {1} ^ {d}) R _ {t} ^ {d} (j ^ {d}, x _ {t} ^ {d} | x _ {1} ^ {d}) +$$ + +which we note is the standard single dimensional detailed balance equation for dimension $d$ . Therefore, if our $R_{t}^{d}$ matrices are all in detailed balance with their respective $p_{t|1}(x_t^d | x_1^d)$ conditional marginals, then the full dimensional rate matrix $R_{t}(x_{t}^{1:D}, j^{1:D}|x_{1}^{1:D})$ will also be in detailed balance with the full dimensional conditional marginals $p_{t|1}(x_t^{1:D}|x_1^{1:D})$ . + +# F. Implementation Details + +In this section we provide concrete derivations of our DFM method. We use a masking process in App. F.1, a uniform process in App. F.2 and explore the general case for any given $p_{t|1}$ in App. F.3. We also provide minimal PyTorch implementations for our training and sampling loops in each case. We will assume multi-dimensional data under the factorization assumptions listed in App. E. + +Notebooks containing these minimal examples can be found at https://github.com/andreW-cr/discrete_flow_models. + +# F.1. Masking Example + +Here, we assume the masking form for $p_{t|1}$ . We begin by writing this data conditional flow + +$$ +\begin{array}{l} p _ {t | 1} (x _ {t} ^ {1: D} | x _ {1} ^ {1: D}) = \prod_ {d = 1} ^ {D} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d}) \\ = \prod_ {d = 1} ^ {D} \left(t \delta \left\{x _ {t} ^ {d}, x _ {1} ^ {d} \right\} + (1 - t) \delta \left\{x _ {t} ^ {d}, M \right\}\right) \\ \end{array} +$$ + +This is the distribution we will use to train our denoising model $p_{1|t}^{\theta}(x_{1}^{1:D}|x_{t}^{1:D})$ . PyTorch code for the training loop is given in Listing 1 + +Listing 1. Masking Training loop +```python +import torch +import torch.nnfunctional as F +# Variables, B, D, S for batch size, number of dimensions and state space size respectively +# Assume we have a model that takes as input xt of shape (B, D) and time of shape $(\mathtt{B},)$ and outputs x1 prediction logits of shape (B, D, S-1). We know the clean data contains no masks and hence we only need to output logits over the valid values. +mask_index $= S - 1$ # Assume the final state is the mask state +for x1 in dataset: # x1 has shape (B, D) optimizer.zero_grad() t = torch RAND(B,) xt = x1.clone() xt[torch rand(B,D) < (1 - t[;, None])] = mask_index logits $=$ model(xt,t)# (B,D,S-1) x1[xt != mask_index] $= -1$ # Don't compute the loss on unmasked dimensions loss $=$ F.cross_entropy(logits.transpose(1,2),x1,reduction='mean', ignore_index=-1) loss.backup() optimizer step() +``` + +We will also derive the form for $R_{t}^{*d}(i^{d},j^{d}|x_{1}^{d})$ . For this we need to find $\partial_t p_{t|1}(x_t^d |x_1^d)$ . + +$$ +\begin{array}{l} \partial_ {t} p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right) = \partial_ {t} \left(t \delta \left\{x _ {t} ^ {d}, x _ {1} ^ {d} \right\} + (1 - t) \delta \left\{x _ {t} ^ {d}, M \right\}\right) \\ = \delta \left\{x _ {t} ^ {d}, x _ {1} ^ {d} \right\} - \delta \left\{x _ {t} ^ {d}, M \right\} \\ \end{array} +$$ + +We can now find $R_{t}^{*d}(x_{t}^{d}, j^{d}|x_{1}^{d})$ . When working with rate matrices in this section, we will always assume $x_{t}^{d} \neq j^{d}$ and calculate the diagonal entries as $R_{t}(i,i) = -\sum_{j \neq i} R_{t}(i,j)$ later. We note that $R_{t}^{*d}(x_{t}^{d}, j^{d}|x_{1}^{d}) = 0$ for $p_{t|1}(x_{t}^{d}|x_{1}^{d}) = 0$ or $p_{t|1}(j^{d}|x_{1}^{d}) = 0$ . Further, our initial distribution $p_{0}(x_{0}^{1:D}) = \prod_{d=1}^{D} \delta\{x_{0}^{d}, M\}$ . Therefore, at all points in our CTMC, $x_{t}^{d}$ is only ever $M$ or $x_{1}^{d}$ . Furthermore, we only ever have to consider transitions to a $j^{d}$ that is either $j^{d} = M$ or $j^{d} = x_{1}^{d}$ . Now, for $p_{t|1}(x_{t}^{d}|x_{1}^{1:D}) > 0$ and $p_{t|1}(j^{d}|x_{1}^{1:D}) > 0$ we have + +$$ +\begin{array}{l} R _ {t} ^ {* d} (x _ {t} ^ {d}, j ^ {d} | x _ {1} ^ {d}) = \frac {\mathrm {R e L U} \left(\partial_ {t} p _ {t | 1} (j ^ {d} | x _ {1} ^ {d}) - \partial_ {t} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d})\right)}{\mathcal {Z} _ {t} ^ {d} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d})} \\ = \frac {\operatorname {R e L U} \left(\delta \left\{j ^ {d} , x _ {1} ^ {d} \right\} - \delta \left\{j ^ {d} , M \right\} - \delta \left\{x _ {t} ^ {d} , x _ {1} ^ {d} \right\} + \delta \left\{x _ {t} ^ {d} , M \right\}\right)}{2 \left(t \delta \left\{x _ {t} ^ {d} , x _ {1} ^ {d} \right\} + (1 - t) \delta \left\{x _ {t} ^ {d} , M \right\}\right)} \\ = \frac {1}{1 - t} \quad \text {f o r} j ^ {d} = x _ {1} ^ {d}, x _ {t} ^ {d} = M \text {a n d} 0 \tag {31} \\ \end{array} +$$ + +We note here that our calculation may not strictly be valid for exactly $t = 0$ or $t = 1$ but are valid for any $t \in (0,1)$ and so we can simply ignore these edge cases, see App. B.2 for further discussion. Now we find our unconditional rate matrix + +$$ +\begin{array}{l} R _ {t} ^ {\theta d} (x _ {t} ^ {1: D}, j ^ {d}) = \mathbb {E} _ {p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} | x _ {t} ^ {1: D})} \left[ R _ {t} ^ {* d} (x _ {t} ^ {d}, j ^ {d} | x _ {1} ^ {d}) \right] \\ = \mathbb {E} _ {p _ {1 | t} ^ {\theta} \left(x _ {1} ^ {d} \mid x _ {t} ^ {1: D}\right)} \left[ \frac {1}{1 - t} \delta \left\{j ^ {d}, x _ {1} ^ {d} \right\} \delta \left\{x _ {t} ^ {d}, M \right\} \right] \\ = \frac {p _ {1 | t} ^ {\theta} \left(x _ {1} ^ {d} = j ^ {d} \mid x _ {t} ^ {1 : D}\right)}{1 - t} \delta \left\{x _ {t} ^ {d}, M \right\} \tag {32} \\ \end{array} +$$ + +Our transition step is then + +$$ +p _ {t + \Delta t | t} (j ^ {d} | x _ {t} ^ {1: D}) = \delta \left\{j ^ {d}, x _ {t} ^ {d} \right\} + R _ {t} ^ {\theta d} \left(x _ {t} ^ {1: D}, j ^ {d}\right) \Delta t +$$ + +For $j^d \neq x_t^d$ this is + +$$ +p _ {t + \Delta t | t} \left(j ^ {d} \mid x _ {t} ^ {1: D}\right) = \Delta t \frac {p _ {1 | t} ^ {\theta} \left(x _ {1} ^ {d} = j ^ {d} \mid x _ {t} ^ {1 : D}\right)}{1 - t} \delta \left\{x _ {t} ^ {d}, M \right\} \tag {33} +$$ + +For $j^d = x_t^d$ this is + +$$ +\begin{array}{l} p _ {t + \Delta t | t} (j ^ {d} = x _ {t} ^ {d} | x _ {t} ^ {1: D}) = 1 - \sum_ {k \neq x _ {t} ^ {d}} p _ {t + \Delta t | t} (k | x _ {t} ^ {1: D}) \\ = 1 - \sum_ {k \neq x _ {t} ^ {d}} \Delta t \frac {p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} = k | x _ {t} ^ {1 : D})}{1 - t} \delta \left\{x _ {t} ^ {d}, M \right\} \\ = 1 - \frac {\Delta t}{1 - t} \delta \left\{x _ {t} ^ {d}, M \right\} \\ \end{array} +$$ + +where on the final line we have used the fact that when $p_{1|t}^{\theta}(x_1^d = M|x_t^{1:D}) = 0$ . Therefore, if $x_{t}^{d} = M$ then we have a $\frac{\mathrm{d}t}{1 - t}$ chance of flipping to some unmasked state with the probabilities for the token to unmask to given by $p_{1|t}^{\theta}(x_1^d |x_t^{1:D})$ . If $x_{t}^{d} \neq M$ (i.e. it has already been unmasked) then we simply stay in the current unmasked state. + +Listing 2 shows PyTorch code that implements this sampling loop. + +Listing 2. Masking Sampling loop +```python +import torch +import torch.nnfunctional as F +from torch.distributions.categorical import Categorical +# Variables, B, D, S for batch size, number of dimensions and state space size respectively +# Assume we have a model that takes as input xt of shape (B, D) and time of shape (B,) and outputs x1 prediction logits of shape (B, D, S-1). We know the clean data contains no masks and hence we only need to output logits over the valid values. +t = 0.0 +dt = 0.001 +mask_index = S-1 +xt = mask_index \* torch.ones((B, D), dtype=torch.long) +while t < 1.0: logits $=$ model(xt, t \* torch.ones((B,))) # (B, D, S-1) x1_prob $=$ F softmax(logits, dim=-1) # (B, D, S-1) x1 $=$ Categorical(x1_prob).sample() # (B, D) will_unmask $=$ torch rand((B, D)) $<$ (dt / (1-t)) # (B, D) will_unmask $=$ will_unmask \* (xt $= =$ mask_index) # (B,D) only unmask currently masked positions xt[will_unmask] $=$ x1[will_unmask] +t += dt +``` + +# F.1.1. DETAILED BALANCE + +In order to expand our family of rate matrices that we can use at sampling time, we want to find a detailed balance rate matrix $R_{t}^{\mathrm{DB}}$ that satisfies the detailed balance equation + +$$ +p _ {t | 1} (i | x _ {1}) R _ {t} ^ {\mathrm {D B}} (i, j | x _ {1}) = p _ {t | 1} (j | x _ {1}) R _ {t} ^ {\mathrm {D B}} (j, i | x _ {1}) +$$ + +We now have to make some assumptions on the form for $R_{t}^{\mathrm{DB}}$ . With this masking noise a process that is in detailed balance will have some rate for transitions going from a mask state towards $x_{1}$ and some rate for transitions going from $x_{1}$ back + +towards the mask state. Such a rate would have the following form + +$$ +R _ {t} ^ {\mathrm {D B}} (i, j | x _ {1}) = a _ {t} \delta \left\{i, x _ {1} \right\} \delta \left\{j, M \right\} + b _ {t} \delta \left\{i, M \right\} \delta \left\{j, x _ {1} \right\} +$$ + +for some constants $a_{t}$ and $b_{t}$ that we must find. Substituting this into the detailed balance equation along with the masking interpolation form for $p_{t|1}(x_t|x_1)$ gives + +$$ +\left(t \delta \{i, x _ {1} \} + (1 - t) \delta \{i, M \}\right) \left(a _ {t} \delta \{i, x _ {1} \} \delta \{j, M \} + b _ {t} \delta \{i, M \} \delta \{j, x _ {1} \}\right) = +$$ + +$$ +\left(t \delta \{j, x _ {1} \} + (1 - t) \delta \{j, M \}\right) \left(a _ {t} \delta \{j, x _ {1} \} \delta \{i, M \} + b _ {t} \delta \{j, M \} \delta \{i, x _ {1} \}\right) +$$ + +$$ +t a _ {t} \delta \{i, x _ {1} \} \delta \{j, M \} + (1 - t) b _ {t} \delta \{i, M \} \delta \{j, x _ {1} \} = t a _ {t} \delta \{j, x _ {1} \} \delta \{i, M \} + (1 - t) b _ {t} \delta \{j, M \} \delta \{i, x _ {1} \} +$$ + +This equation must be true for all $i, j$ . Pick $i = x_{1}$ and $j = M$ to get + +$$ +t a _ {t} = (1 - t) b _ {t} +$$ + +If we pick $i = M$ and $j = x_{1}$ then we would obtain the same equation and if we pick any other values for $i, j$ with $i \neq j$ then we would get $0 = 0$ . Note that we will find $R_{t}^{\mathrm{DB}}$ for $i \neq j$ and then the value for $R_{t}^{\mathrm{DB}}(i, i)$ is simply calculated using $R_{t}^{\mathrm{DB}}(i, i) = -\sum_{j \neq i} R_{t}^{\mathrm{DB}}(i, j)$ . Since we will obtain no more constraints on the values of $a_{t}$ and $b_{t}$ , we will need to pick a value for one of them. We can simply set $a_{t} = \eta$ where $\eta$ is our stochasticity parameter since this value sets the rate at which points that are already at $x_{1}$ will come off $x_{1}$ and travel back to the mask state. This gives $b_{t} = \frac{\eta t}{1 - t}$ and so for $i \neq j$ , + +$$ +R _ {t} ^ {\mathrm {D B}} (i, j | x _ {1}) = \eta \delta \left\{i, x _ {1} \right\} \delta \left\{j, M \right\} + \frac {\eta t}{1 - t} \delta \left\{i, M \right\} \delta \left\{j, x _ {1} \right\}. +$$ + +We now combine this rate with $R_{t}^{*d}$ that we calculated previously to find a new unconditional rate matrix with a variable amount of stochasticity. + +$$ +\begin{array}{l} R _ {t} ^ {\theta d} (x _ {t} ^ {1: D}, j ^ {d}) = \mathbb {E} _ {p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} | x _ {t} ^ {1: D})} \left[ R _ {t} ^ {* d} (x _ {t} ^ {d}, j ^ {d} | x _ {1} ^ {d}) + R _ {t} ^ {\mathrm {D B} ^ {d}} (x _ {t} ^ {d}, j ^ {d} | x _ {1} ^ {d}) \right] \\ = \mathbb {E} _ {p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} | x _ {t} ^ {1: D})} \left[ \frac {1}{1 - t} \delta \left\{j ^ {d}, x _ {1} ^ {d} \right\} \delta \left\{x _ {t} ^ {d}, M \right\} + \eta \delta \left\{x _ {t} ^ {d}, x _ {1} ^ {d} \right\} \delta \left\{j ^ {d}, M \right\} + \frac {\eta t}{1 - t} \delta \left\{x _ {t} ^ {d}, M \right\} \delta \left\{j ^ {d}, x _ {1} ^ {d} \right\} \right] \\ = \frac {p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} = j ^ {d} | x _ {t} ^ {1 : D})}{1 - t} \delta \left\{x _ {t} ^ {d}, M \right\} + \eta p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} = x _ {t} ^ {d} | x _ {t} ^ {1: D}) \delta \left\{j ^ {d}, M \right\} + \frac {\eta t}{1 - t} \delta \left\{x _ {t} ^ {d}, M \right\} p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} = j ^ {d} | x _ {t} ^ {1: D}) \\ = \frac {1 + \eta t}{1 - t} p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} = j ^ {d} | x _ {t} ^ {1: D}) \delta \left\{x _ {t} ^ {d}, M \right\} + \eta (1 - \delta \left\{x _ {t} ^ {d}, M \right\}) \delta \left\{j ^ {d}, M \right\} \\ \end{array} +$$ + +where on the final line we have used the fact that $p_{1|t}^{\theta}(x_1^d = x_t^d | x_t^{1:D}) = 0$ for $x_t^d = M$ and $p_{1|t}^{\theta}(x_1^d = x_t^d | x_t^{1:D}) = 1$ when $x_t^d \neq M$ because if a dimension is unmasked then it must be the true $x_1$ value under our definition of $p_{t|1}(x_t|x_1)$ . We now find our transition probabilities + +$$ +p _ {t + \Delta t | t} (j ^ {d} | x _ {t} ^ {1: D}) = \delta \left\{j ^ {d}, x _ {t} ^ {d} \right\} + R _ {t} ^ {\theta d} (x _ {t} ^ {1: D}, j ^ {d}) \Delta t +$$ + +For $j^d \neq x_t^d$ , + +$$ +p _ {t + \Delta t | t} (j ^ {d} | x _ {t} ^ {1: D}) = \Delta t \frac {1 + \eta t}{1 - t} p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} = j ^ {d} | x _ {t} ^ {1: D}) \delta \left\{x _ {t} ^ {d}, M \right\} + \Delta t \eta (1 - \delta \left\{x _ {t} ^ {d}, M \right\}) \delta \left\{j ^ {d}, M \right\} +$$ + +and for $j^{d} = x_{t}^{d}$ + +$$ +\begin{array}{l} p _ {t + \Delta t | t} (j ^ {d} = x _ {t} ^ {d} | x _ {t} ^ {1: D}) = 1 - \sum_ {k \neq x _ {t} ^ {d}} p _ {t + \Delta t | t} (k | x _ {t} ^ {1: D}) \\ = 1 - \sum_ {k \neq x _ {t} ^ {d}} \left(\Delta t \frac {1 + \eta t}{1 - t} p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} = k | x _ {t} ^ {1: D}) \delta \left\{x _ {t} ^ {d}, M \right\} + \Delta t \eta (1 - \delta \left\{x _ {t} ^ {d}, M \right\}) \delta \left\{k, M \right\}\right) \\ \end{array} +$$ + +$$ += 1 - \Delta t \frac {1 + \eta t}{1 - t} \delta \left\{x _ {t} ^ {d}, M \right\} - \Delta t \eta (1 - \delta \left\{x _ {t} ^ {d}, M \right\}) +$$ + +where again we have used the fact that $p_{1|t}^{\theta}(x_1^d = M|x_t^{1:D}) = 0$ . Inspecting $p_{t + \Delta t|t}(j^d |x_t^{1:D})$ for $j^d \neq x_t^d$ , we see that if $x_{t}^{d} = M$ then we have an overall probability of unmasking of $\frac{1 + \eta t}{1 - t}\Delta t$ and once we do unmask, the new value is drawn from $p_{1|t}^{\theta}(x_1^d |x_t^{1:D})$ . This is like before but now there is a bonus probability of unmasking of $\frac{\eta t}{1 - t}$ . When $x_{t}^{d} \neq M$ then we have a probability of $\eta \Delta t$ of jumping back to the mask state. This creates a flux of states switching back and forth between masked and unmasked for $\eta > 0$ hence why these processes are more 'stochastic'. However, because when $\eta$ is increased we also increase the rate at which we unmask, the desired conditional flow $p_{t|1}(x_t|x_1)$ is maintained for any value of $\eta$ . Listing 3 shows PyTorch code that implements sampling with this extra stochasticity. + +Listing 3. Masking sampling loop with noise +```python +import torch +import torch.nnfunctional as F +from torch.distributions.categorical import Categorical +# Variables, B, D, S for batch size, number of dimensions and state space size respectively +# Assume we have a model that takes as input xt of shape (B, D) and time of shape (B,) and outputs x1 prediction logits of shape (B, D, S-1). We know the clean data contains no masks and hence we only need to output logits over the valid values. +t = 0.0 +dt = 0.001 +mask_index = S-1 +N = 10 # Level of stochasticity +xt = mask_index \* torch.ones((B, D), dtype=torch.long) +while t < 1.0: logits $=$ model(xt, t \* torch.ones((B,))) # (B, D, S-1) x1_prob $=$ F softmax(logits, dim=-1) # (B, D, S-1) x1 $=$ Categorical(x1_prob).sample() # (B, D) will_unmask $=$ torch rand((B, D)) < (dt \* (1 + N \* t) / (1-t)) # (B, D) will_unmask $=$ will_unmask \* (xt $= =$ mask_index) # (B,D) only unmask currently masked positions will_mask $=$ torch[rand((B, D)) < dt \* N # (B, D) will_mask $=$ will_mask \* (xt != mask_index) # (B, D) only re-mask currently unmasked positions xt[will_unmask] $=$ x1[will_unmask] t += dt if t < 1.0: # Don't re-mask on the final step xt[will_mask] $=$ mask_index +``` + +Our method has similarities to other discrete diffusion models when using this form for $p_{t|1}$ and we clarify these links in App. H.2. + +# F.1.2. PURITY SAMPLING + +When using the masking form for $p_{t|1}$ we can also easily implement a purity sampling scheme (Tang et al., 2022). This sampling method decides which dimensions to unmask based on an estimate of the model confidence in that dimension's final value. Currently, our sampling method will uniformly at random choose which dimension to unmask. To improve upon this approach, purity sampling will instead rank dimensions based on which dimension has the highest model probability. More specifically, for each dimension we calculate a purity score for dimension $d$ defined as + +$$ +\mathrm{purity}_{d} = \max_{x_{1}^{d}}\quad p_{1|t}^{\theta}(x_{1}^{d}|x_{t}^{1:D}) +$$ + +For the next simulation step, we then decide how many dimensions should be unmasked. The number of dimensions to unmask is binomially distributed with probability of success $\frac{\Delta t}{1 - t}$ and number of trials equal to the number of dimensions + +that are currently masked. Once we have sampled a number of dimensions to unmask from this binomial distribution, we then unmask that number of dimensions starting from the dimension with highest purity score, then the dimension with second highest purity score and so on. We only consider dimensions that are currently masked to be eligible for unmasking. When using $\eta > 0$ , the probability of success in our binomial distribution increases to $\Delta t \frac{1 + \eta t}{1 - t}$ and so on average more dimensions get unmasked during each simulation step. At the end of each simulation step, we then remask a sample of randomly chosen dimensions which are uniformly chosen at random each with a probability $\Delta t \eta$ of being chosen. + +# F.2. Uniform Example + +In this section we walk through the derivation and implementation of DFM when using the uniform based interpolation distribution. We start with the data conditional marginal distribution + +$$ +\begin{array}{l} p _ {t | 1} (x _ {t} ^ {1: D} | x _ {1} ^ {1: D}) = \prod_ {d = 1} ^ {D} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d}) \\ = \prod_ {d = 1} ^ {D} \left(t \delta \left\{x _ {t} ^ {d}, x _ {1} ^ {d} \right\} + (1 - t) \frac {1}{S}\right) \\ \end{array} +$$ + +This distribution is all that is needed to train the denoising model $p_{1|t}^{\theta}(x_1^{1:D}|x_t^{1:D})$ . We give PyTorch code for the training loop with the uniform interpolant in Listing 4. + +Listing 4. Uniform training loop +```python +import torch +import torch.nnfunctional as F +# Variables,B,D,S for batch size,number of dimensions and state space size respectively +# Assume we have a model that takes as input xt of shape (B,D) and time of shape $(\mathbb{B},)$ and outputs x1 prediction logits of shape (B,D,S). +for x1 in dataset: #x1 has shape (B,D) optimizer.zero_grad() t $=$ torch rand((B,) xt $=$ x1.clone() uniform_noise $=$ torch.randint(0,S,(B,D)) corrupt_mask $=$ torch rand((B,D)) $< (1 - t[(:,$ None]) xt[corrupt_mask] $=$ uniform_noise[corrupt_mask] logits $=$ model(xt,t)# (B,D,S) loss $=$ F.cross_entropy(logits.transpose(1,2),x1,reduction $\equiv$ mean') loss.backup() optimizer step() +``` + +In order to sample our trained model, we will need to derive $R_{t}^{*d}(i^{d},j^{d}|x_{1}^{d})$ . The first step is to find $\partial_t p_{t|1}(x_t^d |x_1^d)$ , + +$$ +\begin{array}{l} \partial_ {t} p _ {t | 1} \left(x _ {t} ^ {d} \mid x _ {1} ^ {d}\right) = \partial_ {t} \left(t \delta \left\{x _ {t} ^ {d}, x _ {1} ^ {d} \right\} + (1 - t) \frac {1}{S}\right) \\ = \delta \left\{x _ {t} ^ {d}, x _ {1} ^ {d} \right\} - \frac {1}{S} \\ \end{array} +$$ + +We will now find $R_{t}^{*d}(x_{t}^{d},j^{d}|x_{1}^{d})$ . As before we will always assume $x_{t}^{d}\neq j^{d}$ and calculate diagonal entries as needed using the relation $R_{t}(i,i) = -\sum_{j\neq i}R_{t}(i,j)$ . + +$$ +\begin{array}{l} R _ {t} ^ {* d} (x _ {t} ^ {d}, j ^ {d} | x _ {1} ^ {d}) = \frac {\mathrm {R e L U} \left(\partial_ {t} p _ {t | 1} (j ^ {d} | x _ {1} ^ {d}) - \partial_ {t} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d})\right)}{\mathcal {Z} _ {t} ^ {d} p _ {t | 1} (x _ {t} ^ {d} | x _ {1} ^ {d})} \\ = \frac {\operatorname {R e L U} \left(\delta \left\{j ^ {d} , x _ {1} ^ {d} \right\} - \frac {1}{S} - \delta \left\{x _ {t} ^ {d} , x _ {1} ^ {d} \right\} + \frac {1}{S}\right)}{S \left(t \delta \left\{x _ {t} ^ {d} , x _ {1} ^ {d} \right\} + (1 - t) \frac {1}{S}\right)} \\ \end{array} +$$ + +$$ += \frac {\operatorname {R e L U} \left(\delta \left\{j ^ {d} , x _ {1} ^ {d} \right\} - \delta \left\{x _ {t} ^ {d} , x _ {1} ^ {d} \right\}\right)}{S (t \delta \left\{x _ {t} ^ {d} , x _ {1} ^ {d} \right\} + (1 - t) \frac {1}{S}} +$$ + +The only non-zero value is when $j^d = x_1^d$ and $x_t^d \neq x_1^d$ and so $R_t^{*d}(x_t^d, j^d | x_1^d)$ is + +$$ +R _ {t} ^ {* d} \left(x _ {t} ^ {d}, j ^ {d} \mid x _ {1} ^ {d}\right) = \frac {1}{1 - t} \delta \left\{j ^ {d}, x _ {1} ^ {d} \right\} \left(1 - \delta \left\{x _ {t} ^ {d}, x _ {1} ^ {d} \right\}\right) +$$ + +We can now find the unconditional rate matrix, still assuming $x_{t}^{d} \neq j^{d}$ + +$$ +\begin{array}{l} R _ {t} ^ {\theta d} (x _ {t} ^ {1: D}, j ^ {d}) = \mathbb {E} _ {p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} | x _ {t} ^ {1: D})} \left[ R _ {t} ^ {* d} (x _ {t} ^ {d}, j ^ {d} | x _ {1} ^ {d}) \right] \\ = \mathbb {E} _ {p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} | x _ {t} ^ {1: D})} \left[ \frac {1}{1 - t} \delta \left\{j ^ {d}, x _ {1} ^ {d} \right\} (1 - \delta \left\{x _ {t} ^ {d}, x _ {1} ^ {d} \right\}) \right] \\ = \frac {1}{1 - t} p _ {1 | t} ^ {\theta} \left(x _ {1} ^ {d} = j ^ {d} \mid x _ {t} ^ {1: D}\right) \\ \end{array} +$$ + +Our transition step is + +$$ +p _ {t + \Delta t | t} (j ^ {d} | x _ {t} ^ {1: D}) = \delta \left\{j ^ {d}, x _ {t} ^ {d} \right\} + R _ {t} ^ {\theta d} (x _ {t} ^ {1: D}, j ^ {d}) \Delta t +$$ + +For $j^d \neq x_t^d$ this is + +$$ +p _ {t + \Delta t | t} (j ^ {d} | x _ {t} ^ {1: D}) = \frac {\Delta t}{1 - t} p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} = j ^ {d} | x _ {t} ^ {1: D}) +$$ + +and for $j^d = x_t^d$ this is + +$$ +\begin{array}{l} p _ {t + \Delta t | t} (j ^ {d} = x _ {t} ^ {d} | x _ {t} ^ {1: D}) = 1 - \sum_ {k \neq x _ {t} ^ {d}} p _ {t + \Delta t | t} (k | x _ {t} ^ {1: D}) \\ = 1 - \sum_ {k \neq x _ {t} ^ {d}} \frac {\Delta t}{1 - t} p _ {1 | t} ^ {\theta} \left(x _ {1} ^ {d} = k \mid x _ {t} ^ {1: D}\right) \\ = 1 - \frac {\Delta t}{1 - t} \left(1 - p _ {1 | t} ^ {\theta} \left(x _ {1} ^ {d} = x _ {t} ^ {d} \mid x _ {t} ^ {1: D}\right)\right) \\ \end{array} +$$ + +Listing 5 shows PyTorch code that implements this sampling loop. + +Listing 5. Uniform sampling loop +```python +import torch +import torch.nnfunctional as F +from torch.distributions.categorical import Categorical +# Variables, B, D, S for batch size, number of dimensions and state space size respectively +# Assume we have a model that takes as input xt of shape (B, D) and time of shape $(\mathtt{B},)$ and outputs x1 prediction logits of shape (B, D, S). +t = 0.0 +dt = 0.001 +xt = torch.randint(0, S, (B, D)) +while t < 1.0: logits $=$ model(xt, t $\star$ torch.ones((B,) # (B, D, S) x1shima $=$ F softmax(logits, dim=-1) # (B, D, S) # Calculate the off-diagonal step probabilities stepshima $=$ ((dt / (1-t)) $\star$ x1shima).clamp(max=1.0) # (B, D, S) # Calculate the on-diagnoal step probabilities # 1) Zero out the diagonal entries stepshimascatter_(-1, xt[(:, :, None], 0.0) # 2) Calculate the diagonal entries such that the probability row sums to 1 stepshimascatter_(-1, xt[(:, :, None], (1.0 - stepshima-sum(dim=-1, keepdim=True)).clamp(min=0.0)) xt $=$ Categorical(stepshima).sample() # (B, D) +t += dt +``` + +# F.2.1. DETAILED BALANCE + +Here we derive the form of $R_{t}^{\mathrm{DB}}$ for the uniform interpolant case which we can use to vary the stochasticity of sampling. $R_{t}^{\mathrm{DB}}$ satisfies the detailed balance equation + +$$ +p _ {t | 1} (i | x _ {1}) R _ {t} ^ {\mathrm {D B}} (i, j | x _ {1}) = p _ {t | 1} (j | x _ {1}) R _ {t} ^ {\mathrm {D B}} (j, i | x _ {1}) +$$ + +We now make some assumptions for the form of $R_{t}^{\mathrm{DB}}$ . We will assume there will be some rate of transitions from $x_{1}$ back towards a random other state and a rate towards $x_{1}$ in order to cancel out this effect and achieve detailed balance. We note there are other choices for detailed balance, some of which we explore in App. H.1. We will again be assuming $i \neq j$ in the following calculations. + +$$ +R _ {t} ^ {\mathrm {D B}} (i, j | x _ {1}) = a _ {t} \delta \left\{i, x _ {1} \right\} + b _ {t} \delta \left\{j, x _ {1} \right\} +$$ + +We have parameterized $R_{t}^{\mathrm{DB}}$ with some time-dependent constants $a_{t}$ and $b_{t}$ . Substituting this into the detailed balance equation gives + +$$ +\left(t \delta \left\{i, x _ {1} \right\} + (1 - t) \frac {1}{S}\right) \left(a _ {t} \delta \left\{i, x _ {1} \right\} + b _ {t} \delta \left\{j, x _ {1} \right\}\right) = \left(t \delta \left\{j, x _ {1} \right\} + (1 - t) \frac {1}{S}\right) \left(a _ {t} \delta \left\{j, x _ {1} \right\} + b _ {t} \delta \left\{i, x _ {1} \right\}\right) +$$ + +Now, this equation must be true for any $i \neq j$ . Pick $i = x_{1}$ and $j \neq x_{1}$ to get + +$$ +\left(t + (1 - t) \frac {1}{S}\right) a _ {t} = (1 - t) \frac {1}{S} b _ {t} +$$ + +$$ +b _ {t} = a _ {t} \frac {t + (1 - t) \frac {1}{S}}{(1 - t) \frac {1}{S}} +$$ + +$$ += a _ {t} \frac {S t + 1 - t}{1 - t} \tag {34} +$$ + +We would obtain the same equation if we were to instead pick $i \neq x_{1}$ and $j = x_{1}$ . Therefore we have to fix one of $a_{t}$ or $b_{t}$ . If we want a stochasticity level of $\eta$ then we can set $a_{t} = \eta$ which is the rate at which points that are at the clean data come back off the clean datapoint. $b_{t}$ can then be found from equation (34). This gives a form for $R_{t}^{\mathrm{DB}}$ of + +$$ +R _ {t} ^ {\mathrm {D B}} (i, j | x _ {1}) = \eta \delta \left\{i, x _ {1} \right\} + \eta \frac {S t + 1 - t}{1 - t} \delta \left\{j, x _ {1} \right\} +$$ + +This can now be combined with $R_{t}^{*d}$ to create a new unconditional rate matrix with a variable amount of stochasticity. + +$$ +\begin{array}{l} R _ {t} ^ {\theta d} (x _ {t} ^ {1: D}, j ^ {d}) = \mathbb {E} _ {p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} | x _ {t} ^ {1: D})} \left[ R _ {t} ^ {* d} (x _ {t} ^ {d}, j ^ {d} | x _ {1} ^ {d}) + R _ {t} ^ {\mathrm {D B}} ^ {d} (x _ {t} ^ {d}, j ^ {d} | x _ {1} ^ {d}) \right] \\ = \mathbb {E} _ {p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} | x _ {t} ^ {1: D})} \left[ \frac {1}{1 - t} \delta \left\{j ^ {d}, x _ {1} ^ {d} \right\} (1 - \delta \left\{x _ {t} ^ {d}, x _ {1} ^ {d} \right\}) + \eta \delta \left\{x _ {t} ^ {d}, x _ {1} ^ {d} \right\} + \eta \frac {S t + 1 - t}{1 - t} \delta \left\{j ^ {d}, x _ {1} ^ {d} \right\} \right] \\ = \mathbb {E} _ {p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} | x _ {t} ^ {1: D})} \left[ \frac {1 + \eta + \eta (S - 1) t}{1 - t} \delta \left\{j ^ {d}, x _ {1} ^ {d} \right\} (1 - \delta \left\{x _ {t} ^ {d}, x _ {1} ^ {d} \right\}) + \eta \delta \left\{x _ {t} ^ {d}, x _ {1} ^ {d} \right\} \right] \\ = \frac {1 + \eta + \eta (S - 1) t}{1 - t} p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} = j ^ {d} | x _ {t} ^ {1: D}) + \eta p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} = x _ {t} ^ {d} | x _ {t} ^ {1: D}) \\ \end{array} +$$ + +We can interpret this rate, with the first term being the rate at which we should transition to states that are predicted to correspond to the clean data. The second term is a 'noise term' which creates transitions away from the current state if it is predicted to correspond to the final clean data. The first term then has additional weighting as $\eta$ is increased to counter act this effect. The effect of the stochasticity is then to create a flux going on and off the predicted final clean state during generation. We now find our transition probabilities + +$$ +p _ {t + \Delta t | t} (j ^ {d} | x _ {t} ^ {1: D}) = \delta \left\{j ^ {d}, x _ {t} ^ {d} \right\} + R _ {t} ^ {\theta d} (x _ {t} ^ {1: D}, j ^ {d}) \Delta t +$$ + +For $j^d \neq x_t^d$ , + +$$ +p _ {t + \Delta t | t} (j ^ {d} | x _ {t} ^ {1: D}) = \Delta t \frac {1 + \eta + \eta (S - 1) t}{1 - t} p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} = j ^ {d} | x _ {t} ^ {1: D}) + \Delta t \eta p _ {1 | t} ^ {\theta} (x _ {1} ^ {d} = x _ {t} ^ {d} | x _ {t} ^ {1: D}) +$$ + +We can find $p_{t + \Delta t|t}(j^d |x_t^{1:D})$ for $j^d = x_t^d$ programmatically as before by requiring that the probability vector sum to 1. Listing 6 shows the implementation for the uniform interpolant with noise. + +Listing 6. Uniform sampling loop with noise +```python +import torch +import torch.nnfunctional as F +import torch.distributions.categorical import Categorical +# Variables, B, D, S for batch size, number of dimensions and state space size respectively +# Assume we have a model that takes as input xt of shape (B, D) and time of shape (B,) and outputs x1 prediction logits of shape (B, D, S). +t = 0.0 +dt = 0.001 +noise = 1 +xt = torch.randint(0, S, (B, D)) +while t < 1.0: logits $=$ model(xt, t $\star$ torch.ones((B,))) # (B, D, S) x1_prob $=$ F softmax(logits, dim=-1) # (B, D, S) x1_prob_at_xt $=$ torch.gather(x1_prob, -1, xt[(:, :, None]) # (B, D, 1) # Don't add noise on the final step if t + dt < 1.0: N = noise else: N = 0 +# Calculate the off-diagonal step probabilities step_prob $=$ ( dt $\star$ ((1 + N + N $\star$ (S - 1) $\star$ t) / (1-t)) $\star$ x1_prob + dt $\star$ N $\star$ x1_prob_at_xt ).clamp(max=1.0) # (B, D, S) +# Calculate the on-diagnoal step probabilities # 1) Zero out the diagonal entries step_probscatter_(-1, xt[(:, :, None], 0.0) # 2) Calculate the diagonal entries such that the probability row sums to 1 step_probscatter_(-1, xt[(:, :, None], (1.0 - step_prob-sum(dim=-1, keepdim=True)).clamp(min=0.0)) +xt = Categorical(step_prob).sample() # (B, D) +t += dt +``` + +# F.3. General Case + +We now describe the training and sampling loop for a general conditional flow $p_{t|1}(x_t|x_1)$ . We require this interpolant to be factorized, $p_{t|1}(x_t^{1:D}|x_1^{1:D}) = \prod_{d=1}^D p_{t|1}(x_d^d|x_1^d)$ , be differentiable and have $p_{t|1}(j^d|x_1^d) = 0 \Rightarrow \partial_t p_{t|1}(j^d|x_1^d) = 0$ . We assume that we have access to functions that can sample from $p_{t|1}(x_t|x_1)$ , evaluate $p_{t|1}(x_t|x_1)$ and evaluate $\partial_t p_{t|1}(x_t|x_1)$ . Our training loop consists of sampling data, sampling $x_t \sim p_{t|1}(x_t|x_1)$ and training with the cross entropy loss, see Listing 7. + +Listing 7. General training loop +```python +import torch +import torch.nnfunctional as F +# Variables,B,D,S for batch size,number of dimensions and state space size respectively +# Assume we have a model that takes as input xt of shape (B,D) and time of shape $(\mathtt{B},)$ and outputs x1 prediction logits of shape (B,D,S). +def sample_p_xt_g_x1(x1,t): #x1(B,D) #t(B,) # Returns xt (B,D) +for x1 in dataset: # x1 has shape (B,D) optimizer.zero_grad() t $=$ torch rand((B,) xt $=$ sample_p_xt_g_x1(x1,t) logits $=$ model(xt,t)# (B,D,S) loss $=$ F.cross_entropy(logits.transpose(1,2),x1,reduction='mean') loss.backup() optimizer.step() +``` + +Now for sampling we can programmatically calculate $R_{t}^{*d}(x_{t}^{d}, j^{d}|x_{1}^{d})$ using Eq. (27). It may not be possible to analytically calculate the expectation with respect to $p_{1|t}^{\theta}(x_{1}^{1:D}|x_{t}^{1:D})$ but we note that our Euler step is still valid if we instead take a sample from $p_{1|t}^{\theta}(x_{1}^{1:D}|x_{t}^{1:D})$ and substitute into $R_{t}^{d}(x_{t}^{d}, j^{d}|x_{1}^{d})$ , see App. G. We assume access further to a function that can produce samples from the prior distribution $p_{\mathrm{noise}}$ corresponding to the chosen $p_{t|1}$ . We provide the general case sampling loop in Listing 8. + +Listing 8. General sampling loop +```python +def dt_p_xt_g_xt(x1, t): + # x1 (B, D) + # t float + # returns (B, D, S) for varying x_t value +def p_xt_g_x1(x1, t): + # x1 (B, D) + # t float + # returns (B, D, S) for varying x_t value +def sample_prior(num_samples, D): + # num_samples, D both integer + # returns prior sample of shape (num_samples, D) +t = 0.0 +dt = 0.001 +num_samples = 1000 +xt = sample_prior(num_samples, D) +while t < 1.0: + logits = model(xt, t * torch.ones((num_samples,))) # (B, D, S) + x1_prob = F softmax(logits, dim=-1) # (B, D, S) + x1 = Categorical(x1_prob).sample() # (B, D) + # Calculate R_t^* + # For p(x_t | x_1) > 0 and p(j | x_1) > 0 + R_t^* (x_t, j | x_1) = Relu(dtp(j | x_1) - dtp(x_t | x_1)) / (Z_t * p(x_t | x_1)) + # For p(x_t | x_1) = 0 or p(j | x_1) = 0 we have R_t^* = 0 + # We will ignore issues with diagonal entries as later on we will set + # diagnoal probabilities such that the row sums to one later on. +dt_p_vals = dt_p_xt_g_xt(x1, t) # (B, D, S) +dt_p_vals_at_xt = dt_p_vals.gather(-1, xt[ :, :, None]).squeeze(-1) # (B, D) +# Numerator of R_t^* +R_t_numer = F.relu(dt_p_vals - dt_p_vals_at_xt[ :, :, None]) # (B, D, S) +pt_vals = p_xt_g_x1(x1, t) # (B, D, S) +Z_t = torch.count_nonzero(pt_vals, dim=-1) # (B, D) +pt_vals_at_xt = pt_vals.gather(-1, xt[ :, :, None]).squeeze(-1) # (B, D) +# Denominator of R_t^* +R_t_denom = Z_t * pt_vals_at_xt # (B, D) +R_t = R_t_numer / R_t_denom[ :, :, None] # (B, D, S) +# Set p(x_t | x_1) = 0 or p(j | x_1) = 0 cases to zero +R_t[(pt_vals_at_xt == 0.0)][ :, None].repeat(1, 1, S)] = 0.0 +R_t[ pt_vals == 0.0] = 0.0 +# Calculate the off-diagonal step probabilities +step_prob = (R_t * dt).clamp(max=1.0) # (B, D, S) +# Calculate the on-diagonal step probabilities +# 1) Zero out the diagonal entries +step_prob.scatter(-1, xt[ :, None], 0.0) +# 2) Calculate the diagonal entries such that the probability row sums to 1 +step_prob.scatter(-1, xt[ :, None], (1.0 - step_prob-sum(dim=-1, +keepdim=True)).clamp(min=0.0)) +``` + +# F.3.1. DETAILED BALANCE + +There are many ways one could solve the detailed balance equation for $R_{t}^{\mathrm{DB}}$ as the choice will depend on what kinds of noise are desirable to include in the generative process. A baseline example of how you could solve the detailed balance equation for generate $p_{t|1}(x_t|x_1)$ is to note + +$$ +\begin{array}{l} R _ {t} ^ {\mathrm {D B}} (i, j | x _ {1}) p _ {t | 1} (i | x _ {1}) = R _ {t} ^ {\mathrm {D B}} (j, i | x _ {1}) p _ {t | 1} (j | x _ {1}) \\ \frac {R _ {t} ^ {\mathrm {D B}} (i , j | x _ {1})}{R _ {t} ^ {\mathrm {D B}} (j , i | x _ {1})} = \frac {p _ {t | 1} (i | x _ {1})}{p _ {t | 1} (j | x _ {1})} \\ \end{array} +$$ + +which gives a relation between the diagonal elements of $R_{t}^{\mathrm{DB}}$ . As a first choice we could simply set the upper triangular section of $R_{t}^{\mathrm{DB}}$ to 1 and set the lower triangular part to the ratio $\frac{p_{t|1}(i|x_1)}{p_{t|1}(j|x_1)}$ which would satisfy detailed balance. + +# G. CTMC Sampling Methods + +In the main text, our sampling algorithm Alg. 1 first constructs the unconditional rate matrix $R_{t}^{\theta}(x_{t},j) = \mathbb{E}_{p_{1|t}^{\theta}(x_{1}|x_{t})}[R_{t}(x_{t},j|x_{1})]$ and then samples the next state from the Euler step, + +$$ +x _ {t + \Delta t} \sim \operatorname {C a t} \left(\delta \left\{x _ {t}, x _ {t + \Delta t} \right\} + R _ {t} ^ {\theta} (x _ {t}, x _ {t + \Delta t}) \Delta t\right). +$$ + +The form of this update means that we don't necessarily need to calculate the full expectation over $R_{t}(x_{t},j|x_{1})$ . We can simply sample $x_{1}$ from $p_{1|t}^{\theta}(x_1|x_t)$ and then plug this sample into $R_{t}(x_{t},j|x_{1})$ which we then use in the Euler update. To see that this strategy still samples from the same distribution over $x_{t + \Delta t}$ , we can write the distribution over $x_{t + \Delta t}$ as $p_{t + \Delta t|t}$ , + +$$ +\begin{array}{l} p _ {t + \Delta t | t} \left(x _ {t + \Delta t} \mid x _ {t}\right) = \delta \left\{x _ {t}, x _ {t + \Delta t} \right\} + \mathbb {E} _ {p _ {1 | t} ^ {\theta} \left(x _ {1} \mid x _ {t}\right)} \left[ R _ {t} \left(x _ {t}, x _ {t + \Delta t} \mid x _ {1}\right) \right] \Delta t \\ = \mathbb {E} _ {p _ {1 | t} ^ {\theta} (x _ {1} | x _ {t})} [ \delta \left\{x _ {t}, x _ {t + \Delta t} \right\} + R _ {t} (x _ {t}, x _ {t + \Delta t} | x _ {1}) \Delta t ] \\ = \sum_ {x _ {1}} p _ {1 | t} ^ {\theta} \left(x _ {1} \mid x _ {t}\right) p _ {t + \Delta t | t} \left(x _ {t + \Delta t} \mid x _ {1}, x _ {t}\right) \\ \end{array} +$$ + +where + +$$ +p _ {t + \Delta t | t} \left(x _ {t + \Delta t} \mid x _ {1}, x _ {t}\right) := \delta \left\{x _ {t}, x _ {t + \Delta t} \right\} + R _ {t} \left(x _ {t}, j \mid x _ {1}\right) \Delta t +$$ + +and so $p_{t + \Delta t|t}(x_{t + \Delta t}|x_t)$ can be seen as the marginal of joint distribution $p_{1|t}^{\theta}(x_1|x_t)p_{t + \Delta t|t}(x_{t + \Delta t}|x_1,x_t)$ . Therefore, to produce a sample $x_{t + \Delta t}$ from $p_{t + \Delta t|t}(x_{t + \Delta t}|x_t)$ , we can instead sample $x_1,x_{t + \Delta t}$ from the joint distribution $p_{1|t}^{\theta}(x_1|x_t^{1:D})p_{t + \Delta t|t}(x_{t + \Delta t}|x_1,x_t)$ , and take only the $x_{t + \Delta t}$ part of this joint sample. + +Another method to simulate a CTMC is $\tau$ -leaping, (Gillespie, 2001; Campbell et al., 2022) which allows multiple jumps to be made both across dimensions and within each dimension. Multiple jumps within a single dimension does not make sense for categorical data where there is no ordering, however, it can be useful for ordinal data such as a discretized image where the $\tau$ -leaping update allows multiple jumps to be applied at once to cover a larger distance. To calculate a $\tau$ -leaping update, a Poisson random variable needs to be drawn with the rate matrix giving the rate parameter. Therefore, for this type of update, the full unconditional $R_{t}^{\theta}(x_{t},j)$ would need to be calculated. + +We finally note that there is a body of work creating CTMC samplers for generative models (Sun et al., 2023b; Lou et al., 2023) that may be faster to simulate than the standard Euler step. In this work, we focus on framework simplicity, not optimizing for sampling speed and leave application of these approaches as future work. + +# H. Comparison with Discrete Diffusion Models + +In this section we clarify the relationship between DFM and classical discrete diffusion models. In App. H.1 we compare to continuous time models using the uniform corruption process as an example. In App. H.2 we compare to discrete time models using the masking process as the example. + +# H.1. Continuous Time Discrete Diffusion Models + +Here we compare to continuous time discrete diffusion models (Campbell et al., 2022) using the uniform corruption process as an example. In this section, we will assume $t = 0$ is pure noise and $t = 1$ is clean data which we note is a flipped definition of time to classical diffusion models to aid in our comparison with DFMs. + +For discrete diffusion, we first specify a corruption process and then approximate its time reversal to give us the generative process. Our corruption process will evolve from $t = 1$ back to time $t = 0$ . It will be specified using a rate matrix $R_{t}$ . In order to make calculation of $p_{t|1}(x_t|x_1)$ , $R_{t}$ needs to be of a special form, namely $R_{t} = \beta (t)R_{b}$ where $\beta (t)$ is a time dependent scalar function and $R_{b}$ is a base rate matrix that can be decomposed using the eigendecomposition $R_{b} = Q\Lambda Q^{-1}$ . For uniform corruption, we can set $R_{b} = \mathbb{1}\mathbb{1}^{\top} - S\mathbb{I}$ where $\mathbb{1}$ is a vector of all 1's. We will now assume $S = 3$ so we can carry out all calculations explicitly. + +We have $R_{b} = Q\Lambda Q^{-1}$ with + +$$ +Q = \left[ \begin{array}{c c c} - 1 & - 1 & 1 \\ 0 & 1 & 1 \\ 1 & 0 & 1 \end{array} \right] \quad \Lambda = \left[ \begin{array}{c c c} - 3 & 0 & 0 \\ 0 & - 3 & 0 \\ 0 & 0 & 0 \end{array} \right] \quad Q ^ {- 1} = \left[ \begin{array}{c c c} - \frac {1}{3} & - \frac {1}{3} & \frac {2}{3} \\ - \frac {1}{3} & \frac {2}{3} & - \frac {1}{3} \\ \frac {1}{3} & \frac {1}{3} & \frac {1}{3} \end{array} \right] +$$ + +To calculate $p_{t|1}(x_t|x_1)$ we can use the equation + +$$ +P _ {t} = Q \exp \left(\Lambda \int_ {1} ^ {t} \beta (s) \mathrm {d} s\right) Q ^ {- 1} +$$ + +where $(P_{t})_{ij} = p_{t|1}(x_{t} = j|x_{1} = i)$ and $\exp$ is the element wise exponential. By the symmetry of the problem, we can infer that $p_{t|1}(x_t = j|x_1 = i)$ will have only two possible values. Either $j = i$ and we are finding the probability of staying at $i$ , or $j\neq i$ and we are finding the probability of having left $i$ , and since uniform corruption treats all states equally, these will be same quantities for any starting state and any state $j\neq i$ . So to find our schedule we just need to consider one element of the matrix $P_{t}$ . Let us consider an off-diagonal element $i\neq j$ of $P_{t}$ , which will have probability + +$$ +(P _ {t}) _ {i j} = \frac {1}{3} \left(1 - \exp \left(- 3 \int_ {1} ^ {t} \beta (s) \mathrm {d} s\right)\right), \quad i \neq j +$$ + +We will try and match this to the simple linear schedule that we have had as our running example in the explanation of DFM. + +$$ +\begin{array}{l} \frac {1}{3} \left(1 - \exp \left(- 3 \int_ {t} ^ {1} \beta (s) \mathrm {d} s\right)\right) = \frac {1}{3} (1 - t) \\ \Longrightarrow \beta (t) = \frac {1}{3 t} \\ \end{array} +$$ + +Therefore, we have found that a corruption rate matrix of $R_{t} = \frac{1}{3t}\left(\mathbb{1}\mathbb{1}^{\top} - 3\mathbb{I}\right)$ gives a conditional flow of $p_{t|1}(x_t|x_1) = t\delta \{x_t,x_1\} + (1 - t)\frac{1}{3}$ . + +The next step in a discrete diffusion model is to find the time reversed rate matrix $\hat{R}_t$ which gives a CTMC that runs in the opposite direction to $R_t$ and generates novel data from noise. Here $\hat{R}_t$ is running from time $t = 0$ at noise towards clean data at $t = 1$ . From Campbell et al. (2022), we have + +$$ +\hat {R} _ {t} (i, j) = \sum_ {x _ {1}} R _ {t} (j, i) \frac {p _ {t | 1} (j | x _ {1})}{p _ {t | 1} (i | x _ {1})} p _ {1 | t} (x _ {1} | i) \quad i \neq j +$$ + +We notice a similarity to the DFM equations, where the generative rate is the expectation of a quantity with respect to $p_{1|t}(x_1|i)$ . Indeed we now show that $R_{t}(j,i)\frac{p_{t|1}(j|x_{1})}{p_{t|1}(i|x_{1})}$ is a $x_{1}$ conditioned rate matrix $R_{t}^{\mathrm{diff}}(i,j|x_{1})$ that achieves the conditional flow $p_{t|1}(i|x_1)$ . Consider the Kolmogorov equation + +$$ +\partial_ {t} p _ {t | 1} (i | x _ {1}) = \sum_ {j \neq i} R _ {t} ^ {\text {d i f f}} (j, i | x _ {1}) p _ {t | 1} (j | x _ {1}) - \sum_ {j \neq i} R _ {t} ^ {\text {d i f f}} (i, j | x _ {1}) p _ {t | 1} (i | x _ {1}) +$$ + +Substitute in our form for $R_{t}^{\mathrm{diff}}$ + +$$ +\begin{array}{l} \mathrm {R H S} = \sum_ {j \neq i} R _ {t} (i, j) \frac {p _ {t | 1} (i | x _ {1})}{p _ {t | 1} (j | x _ {1})} p _ {t | 1} (j | x _ {1}) - \sum_ {j \neq i} R _ {t} (j, i) \frac {p _ {t | 1} (j | x _ {1})}{p _ {t | 1} (i | x _ {1})} p _ {t | 1} (i | x _ {1}) \\ = \sum_ {j \neq i} R _ {t} (i, j) p _ {t | 1} (i | x _ {1}) - \sum_ {j \neq i} R _ {t} (j, i) p _ {t | 1} (j | x _ {1}) \\ = - \left[ \sum_ {j \neq i} R _ {t} (j, i) p _ {t | 1} (j | x _ {1}) - \sum_ {j \neq i} R _ {t} (i, j) p _ {t | 1} (i | x _ {1}) \right] \\ = - \left[ - \partial_ {t} p _ {t | 1} (i | x _ {1}) \right] \\ = \mathrm {L H S} \\ \end{array} +$$ + +where on the second to last line we have used the fact that the corruption matrix $R_{t}(i,j)$ when started at $p_{t=1}(x_{t}|x_{1}) = \delta\{x_{t},x_{1}\}$ will evolve the marginals according to $p_{t|1}(x_{t}|x_{1})$ because this is how we derived $p_{t|1}(x_{t}|x_{1})$ in the first place. Note $R_{t}$ runs in the reverse direction hence the negative sign. + +Therefore, the diffusion framework has made an implicit choice for $R_{t}(i,j|x_{1}) = R_{t}^{\mathrm{diff}}(i,j|x_{1})$ and this choice is made at training time. We now show on our uniform noise example that $R_{t}^{\mathrm{diff}}$ is simply $R_{t}^{*} + R_{t}^{\mathrm{DB}}$ for a specific choice of $R_{t}^{\mathrm{DB}}$ . + +Firstly, we write out the explicit form for $R_{t}^{\mathrm{diff}}$ using $R_{t}^{\mathrm{diff}}(i,j|x_{1}) = R_{t}(j,i)\frac{p_{t|1}(j|x_{1})}{p_{t|1}(i|x_{1})}$ , $R_{t} = \frac{1}{3t}\left(\mathbb{1}\mathbb{1}^{\top} - 3\mathbb{I}\right)$ and $p_{t|1}(i|x_1) = t\delta \{x_t,x_1\} +(1 - t)\frac{1}{3}$ . + +$$ +R _ {t} ^ {\mathrm {d i f f}} = \frac {1}{3 t} \left[ \begin{array}{c c c} - 1 - \frac {1 + 2 t}{1 - t} & \frac {1 + 2 t}{1 - t} & 1 \\ \frac {1 - t}{1 + 2 t} & - 2 \frac {1 - t}{1 + 2 t} & \frac {1 - t}{1 + 2 t} \\ 1 & \frac {1 + 2 t}{1 - t} & - 1 - \frac {1 + 2 t}{1 - t} \end{array} \right] +$$ + +We will now find $R_{t}^{\mathrm{DB}}$ such that $R_{t}^{\mathrm{diff}} = R_{t}^{*} + R_{t}^{\mathrm{DB}}$ . We will need a slightly more general form for $R_{t}^{\mathrm{DB}}$ than was previously derived for the uniform noise case. We will have + +$$ +R _ {t} ^ {\mathrm {D B}} (i, j | x _ {1}) = a _ {t} \delta \left\{i, x _ {1} \right\} + b _ {t} \delta \left\{j, x _ {1} \right\} + c _ {t} (1 - \delta \left\{i, x _ {1} \right\}) (1 - \delta \left\{j, x _ {1} \right\}) +$$ + +Using the detailed balance equation, $p_{t|1}(i|x_1)R_t^{\mathrm{DB}}(i,j|x_1) = p_{t|1}(j|x_1)R_t^{\mathrm{DB}}(j,i|x_1)$ , we find that we need + +$$ +a _ {t} = \frac {(1 - t) \frac {1}{3} b _ {t}}{t + (1 - t) \frac {1}{3}} +$$ + +with $b_{t}$ and $c_{t}$ being fully flexible (provided they are positive). Using the form for $R_{t}^{*}(i,j|x_{1}) = \frac{1}{1 - t}\delta \{j,x_{1}\} (1 - \delta \{i,x_{1}\})$ that we derived in Appendix F.2 we have + +$$ +R _ {t} ^ {*} + R _ {t} ^ {\mathrm {D B}} = \left[ \begin{array}{c c c} - \frac {1}{1 - t} - b _ {t} - c _ {t} & \frac {1}{1 - t} + b _ {t} & c _ {t} \\ \frac {(1 - t) \frac {1}{3} b _ {t}}{t + (1 - t) \frac {1}{3}} & - 2 \frac {(1 - t) \frac {1}{3} b _ {t}}{t + (1 - t) \frac {1}{3}} & \frac {(1 - t) \frac {1}{3} b _ {t}}{t + (1 - t) \frac {1}{3}} \\ c _ {t} & \frac {1}{1 - t} + b _ {t} & - c _ {t} - \frac {1}{1 - t} - b _ {t} \end{array} \right] +$$ + +which is equal to $R_{t}^{\mathrm{diff}}$ if we have $b_{t} = c_{t} = \frac{1}{3t}$ . + +In summary, we have found that classical discrete diffusion models make an implicit choice for $R_{t}(i,j|x_{1})$ which corresponds to a certain level of stochasticity in the CTMC and that the choice is made at training time because the rate matrix is used in the ELBO objective. Further, we have seen it is much harder to derive the noise schedule $p_{t|1}(x_t|x_1)$ in classical discrete diffusion models due to the need to be able to apply the matrix exponential to $R_{t}$ . In DFM, we can simply write down the $p_{t|1}(x_t|x_1)$ noise schedule we want and we are not restricted in having to pick $R_{t}$ that are amenable to matrix exponentiation. We also get to choose any $R_{t}(i,j|x_{1})$ at test time rather than being fixed to the implicit choice of $R_{t}^{\mathrm{diff}}$ . + +# H.2. Discrete Time Discrete Diffusion Models + +In this section we will clarify the link to the discrete time diffusion method D3PM (Austin et al., 2021) when using the masking process for both methods. Here, we will use the convention from Austin et al. (2021) of using $t = 0$ for clean data and $t = T$ for noise. + +We will first summarize the key results from (Austin et al., 2021) when using the absorbing state process which is a different name for a masking type process (the mask is the absorbing state). $t$ can take on any discrete value in $t \in \{0, 1, \dots, T\}$ . The diffusion model is first defined using a noising transition kernel + +$$ +p (x _ {t} | x _ {t - 1}) = \left\{ \begin{array}{l l} 1 & \text {i f} x _ {t} = x _ {t - 1} = M \\ 1 - \beta_ {t} & \text {i f} x _ {t} = x _ {t - 1} \neq M \\ \beta_ {t} & \text {i f} x _ {t} = M, x _ {t - 1} \neq M \end{array} \right. +$$ + +From this transition kernel, we can then calculate the noise marginals, $p(x_{t}|x_{0})$ + +$$ +p \left(x _ {t} \mid x _ {0}\right) = \left(1 - \prod_ {k \leq t} \left(1 - \beta_ {k}\right)\right) \delta \left\{x _ {t}, M \right\} + \left(\prod_ {k \leq t} \left(1 - \beta_ {k}\right)\right) \delta \left\{x _ {t}, x _ {0} \right\} +$$ + +We then define our generative reverse process as + +$$ +p _ {\theta} (x _ {t - 1} | x _ {t}) = \sum_ {x _ {0}} p (x _ {t - 1} | x _ {t}, x _ {0}) p _ {\theta} (x _ {0} | x _ {t}) +$$ + +where $p_{\theta}(x_0|x_t)$ is the learned denoising model. Note how this is similar to our generative process, $R_{t}^{\theta}(x_{t},j) = \mathbb{E}_{p_{\theta}(x_1|x_t)}[R_t(x_t,j|x_1)]$ where now $p(x_{t - 1}|x_t,x_0)$ is the transition kernel for the clean data conditioned process. We then create our generative model by taking the expectation of this conditional kernel with respect to our denoising model. + +Continuing with the D3PM example using the absorbing state process, we obtain the following form for $p_{\theta}(x_{t - 1}|x_t)$ + +$$ +p _ {\theta} (x _ {t - 1} | x _ {t}) = \left\{ \begin{array}{l l} \frac {1 - \prod_ {k \leq t - 1} (1 - \beta_ {k})}{1 - \prod_ {k \leq t} (1 - \beta_ {k})} & \text {i f} x _ {t} = x _ {t - 1} = M \\ \frac {\beta_ {t} \prod_ {k < t - 1} (1 - \beta_ {k})}{1 - \prod_ {k \leq t} (1 - \beta_ {k})} p _ {\theta} (x _ {0} = x _ {t - 1} | x _ {t}) & \text {i f} x _ {t} = M, x _ {t - 1} \neq M \\ \delta \{x _ {t - 1}, x _ {t} \} & \text {i f} x _ {t} \neq M \end{array} \right. +$$ + +When we set $\beta_{t} = \frac{1}{T - t + 1}$ , we obtain a linear noise schedule giving + +$$ +p _ {\theta} (x _ {t - 1} | x _ {t}) = \left\{ \begin{array}{l l} \big (1 - \frac {1}{t} \big) & \text {i f} x _ {t} = x _ {t - 1} = M \\ \frac {1}{t} p _ {\theta} (x _ {0} = x _ {t - 1} | x _ {t}) & \text {i f} x _ {t} = M, x _ {t - 1} \neq M \\ \delta \{x _ {t - 1}, x _ {t} \} & \text {i f} x _ {t} \neq M \end{array} \right. +$$ + +Now, let us define $\xi \coloneqq \frac{t}{T}$ to be the proportion that the process is through the total number of time steps. $\xi \in [0,1]$ and if we consider it to be an analogue of our continuous time variable, we can see that the original discretization steps of D3PM correspond to a discretization of the $[0,1]$ interval with timesteps of $\Delta t = \frac{1}{T}$ . Substituting these definitions into our update step gives, + +$$ +p _ {\theta} (x _ {t - 1} | x _ {t}) = \left\{ \begin{array}{l l} \left(1 - \frac {\Delta t}{\xi}\right) & \text {i f} x _ {t} = x _ {t - 1} = M \\ \frac {1}{\xi} \Delta t p _ {\theta} (x _ {0} = x _ {t - 1} | x _ {t}) & \text {i f} x _ {t} = M, x _ {t - 1} \neq M \\ \delta \left\{x _ {t - 1}, x _ {t} \right\} & \text {i f} x _ {t} \neq M \end{array} \right. +$$ + +Now we can see a clear comparison to Eq. (33) noting the flipped definition of time. With our method we can pick any time discretization at test time because our method has been trained on all possible $t \in [0,1]$ . We also derive $R_{t}^{\mathrm{DB}}$ for the masking case which is not included in the prior D3PM framework. For training we note that the ELBO also simplifies down to a weighted cross entropy term for D3PM as noted by (Austin et al., 2021) and is also the case in our framework, see Appendix C.2.1. + +# I. Text Experiment Details + +Code for our text experiments can be found at https://github.com/andreew-cr/discrete_flow_models. + +For our denoising network we use the transformer architecture (Vaswani et al., 2017) as implemented in the nanoGPT repository, https://github.com/karpathy/nanoGPT. We generally follow the smallest GPT2 architecture + +(Radford et al., 2019). At the input we have our input tokens $x_{t}$ of shape $B, D$ where $B$ is the batch size and $D$ is the number of dimensions i.e. the sequence length, our time $t$ of shape $B$ , and, if we are self-conditioning, prior $x_{1}$ prediction tokens of shape $B, D$ . We embed the $x_{t}$ and $x_{1}$ tokens using the same learned embedding, and use a model embedding size of 768 resulting in tensors of shape $B, D, 768$ . We embed the position of each token using a learned embedding for each possible position. We embed the time $t$ , using Transformer sinusoidal embeddings following (Ho et al., 2020). We train all our diffusion models with self-conditioning (Chen et al., 2023a). To input the prior $x_{1}$ prediction, we stack the $x_{t}$ embedded tensor $B, D, 768$ with the $x_{1}$ prior prediction token tensor $B, D, 768$ to obtain a tensor of shape $B, D, 768 \times 2$ . We then apply a linear layer to project down to the model embedding dimension resulting in a tensor of shape $B, D, 768$ . Before applying transformer blocks, we add together the $x_{t}$ (and $x_{1}$ ) embedding tensor, the position embedding and the time embedding to obtain the final $B, D, 768$ input tensor. + +The transformer stack consists of 12 transformer blocks, each block consisting of a LayerNorm, SelfAttention, LayerNorm, MLP stack. Within our SelfAttention block, we use 12 heads and apply Qk-layernorm (Dehghani et al., 2023) to our query and key values as we observed this improved convergence. Our MLP blocks consist of a $768 \to 768 \times 4$ linear layer, followed by a GELU activation, followed by a $768 \times 4 \to 768$ linear layer. We do not apply dropout. Our output layer consists of a linear head with output dimension 28. We use 28 token categories, 26 lower case letters, a whitespace character and a mask token. The model outputs logits of shape $B, D, 28$ which we then apply a softmax to, to obtain $p_{\theta}(x_1 | x_t)$ probabilities. + +The dataset text8 is 100MB of text data from English Wikipedia. The text is all converted to lower case letters, i.e. capital letters are converted to lower case and numbers are written as text, i.e. 8 becomes 'eight'. + +During training, we use a batch size of 256 with 8 gradient accumulation steps. We train on sequences of length 256. The model is therefore trained on 524,288 tokens per gradient update. To train self-conditioning, on $50\%$ of training iterations, we input prior $x_{1}$ prediction tokens as all masks so that the model learns to be able to predict $x_{1}$ without any prior information. On the other $50\%$ of training iterations, we perform two model forward passes. We first predict $x_{1}$ using masks as the prior $x_{1}$ tokens to obtain an initial set of $p_{\theta}(x_1|x_t)$ logits. We then sample from the initial $p_{\theta}(x_1|x_t)$ distribution to obtain predicted $x_{1}$ tokens. We then feed these tokens back into the model through the self-conditioning input and predict the $x_{1}$ logits once more. These logits are then used in the loss. We only back propagate through the second forward pass of the model. + +When training the D3PM model, we found that the default cross entropy weighting of $1 / t$ (with a flipped definition of time) resulted in poor convergence and so we applied an equal weighting of the cross entropy across time to be consistent with the DFM loss. + +We train our D3PM and DFM models for 750k iterations on 4 Nvidia A40 GPUs using a learning rate of $10^{-4}$ and 1000 linear warm up steps. We use a cosine decay schedule after the initial warm up towards a minimum learning rate of $10^{-5}$ which would be reached at 1M iterations. We use the AdamW optimizer (Loshchilov & Hutter, 2017) with weight decay parameter 0.1. We monitor the validation loss throughout training. Validation loss continues to drop throughout training and we evaluate the final $750k$ model in our experiments. When training the autoregressive model, we use the same architecture but find that it begins to overfit the data much faster than the diffusion based models. After 3500 iterations the validation loss begins to increase and so we use the model with minimum validation loss in our evaluations. This is consistent with findings that autoregressive models require much less compute to converge than diffusion based models (Gulrajani & Hashimoto, 2023). + +We use the masking interpolant in our DFM with linear interpolant, as described in Appendix F.1. For D3PM, we use the absorbing state corruption process, the links to the DFM process are described in Appendix H.2. + +For the SEDD baseline, we train two models from scratch using the provided code for $750k$ training iterations with an effective batch size of 2048 to be consistent with the DFM and D3PM training runs. All other parameters are left at their default values with the transformer using the same hidden size, number of blocks and number of layers as our other runs. + +For evaluation, we sample the DFM with $\Delta t = 0.001$ . We simulate up to $t = 0.98$ and then for any remaining tokens that are still mask, we set them to the most likely token under the model's denoising distribution, $p_{\theta}(x_1|x_t)$ . We stop simulating at $t = 0.98$ to avoid any singularities similar to how diffusion models stop near $t = 0$ . For D3PM we train with 1000 timesteps to match DFM. + +For each temperature setting applied to the $p_{\theta}(x_1|x_t)$ logits, we sample 512 sequences all of length 256 tokens. We then + +![](images/c3694d5faffe8d7d0f913dcf4551f59d64d466970252dbe4e7e78764a69b7539.jpg) +Figure 4. Curves in Entropy-NLL space for varying noise levels used during sampling. For each noise level, the temperature applied to the logits of the $p_{\theta}(x_1|x_t)$ prediction is varied over values 0.5, 0.6, 0.7, 0.8, 0.9, 1.0. + +
MethodBPC
DFM η = 0≤ 1.41
Multinomial Diffusion (Hoogeboom et al., 2021)≤ 1.72
MAC (Shih et al., 2022)≤ 1.40
BFN (Graves et al., 2023)≤ 1.41
D3PM Uniform (Austin et al., 2021)≤ 1.61
D3PM Absorb (Austin et al., 2021)≤ 1.45
SEDD Uniform (Lou et al., 2023)≤ 1.41
SEDD Absorb (Lou et al., 2023)≤ 1.32
+ +Table 5. Model log-likelihoods computed on the test set of text8 in bits-per-character (BPC). + +calculate the negative log-likelihood assigned to each sequence using GPT-J-6B (Wang & Komatsuzaki, 2021) and the BPE tokenizer (Radford et al., 2019). We then average the negative log-likelihoods over the 512 sequences. The sample entropy is calculated by first tokenizing with the BPE tokenizer and then calculating the entropy as $\sum_{i} - p_{i}\log p_{i}$ where $p_i$ is the empirical probability of token $i$ estimated using the full set of 512 samples. Tokens for which $p_i = 0$ are not included in the sum. For reference, the dataset achieves a negative log-likelihood of 4.2 as measured by GPT-J-6B. + +# I.1. Stochasticity Sweep + +Here we examine the effect of the noise level $\eta$ on the sample quality of generations from our DFM method. We follow the follow the same procedure as before but vary $\eta$ with values $\eta = 0,1,2,5,10,15,20,30,50$ . We plot the results in Figure 4. We find that generally, as the noise level increases, we lower our negative log-likelihood. However, we find that if the noise level is increased too much, then degenerate behaviour can occur, for example when $\eta = 50$ , at high logit temperatures the negative log-likelihood increases and the sample entropy decreases away from the dataset. Observing the samples, we find that the model generates incoherent text at this point. We find that the intermediate noise level $\eta = 15$ provides good sample quality whilst avoiding this behaviour. + +# I.2. Model Log-Likelihoods + +Here we calculate bounds on the log likelihood $\log p_{\theta}(x_1)$ that the model assigns to the test set of text8. We use Eq. (24) to calculate this bound. We compare our log-likelihoods to other discrete diffusion style methods in terms of bits-per-character in Table. 5, reporting the numbers from Lou et al. (2023). We find that DFM achieves a similar BPC to previous masking style diffusion models with the recent work of Lou et al. (2023) achieving the lowest BPC. + +![](images/050b9de75fc27aa2e501f1317d82158bcac4ea3d3f06dc5bb72b1a4f8527698e.jpg) +Figure 5. The temperature settings for each model for which we will examine sample generations. The selected temperature setting is highlighted with a black circle. + +# I.3. Example Text Generations + +In this section we provide non cherry picked generations from the text models. For each model we have swept over the temperature applied to the logits and it would be impractical to include examples for all models for all temperature settings. Instead, we select one temperature setting for each model such that the samples have similar entropy but vary in negative log-likelihood. We show the selected temperature settings in Figure 5. For SEDD the method does not have a temperature setting and we select the corruption style that is closest in entropy-NLL space to the other methods. + +# SEDD Uniform + +# Samples: + +change status regional courses and markets especially canada sport in canada and tennessee in canada the official light offered an newspaper licence named liu beijing world s main neighbouring fan site was sugar the only man with major historical works lic + +ions of extension one or at least four subsets of a unique value of one example all these extensions heard of the function is called real line the implementation comes distributed with a continuous input extension to input and two classes the diagram emplo + +of physics the radio atomic institutions independently the eastern united states followed into four six countries norway thus was the father of the university of gloucester but while also the father of germany can we also announce the coexistence of limit + +# D3PM Temperature 0.8 + +# Samples: + +ved as a personal area to form the five counties of the area and a country with their own which is usually called paris gietgothic can also lead an area to work in divisions over a pileur as in the name of man the bears have over the last two years from th + +one five zero zero zero zero press money to present this to a meschapel linear industrial base ulse sudan expanded its economy and accounts for car prices and two eight five more than one zero zero of the largest industrial inventions over the world were + +eed alternatively as human being and the anti constitutionalay doctrines a particular example of the concept is one reason for human rights or as in certain regions there is a double constitution more recognized region of europe in this region the glass an + +# DFM $\eta = 0$ Temperature 0.8 Samples: + +ed era vol seven one nine one one december one nine six one junju that s one of nine one one country page of love footnote pages charles s feadman history of the red sea corea one nine nine one red sea vol one january one nine nine seven flying profiles ch + +allows the vectores to be composed as systems of data for example no machine is a computer one would do not know where there are undirected storage of other data storage particularly the computer science eve to substitute such a based data that is one of + +me io the plate n and feminine along the trail to change the amount of naturated information in the start tape selective figurative memory the mind is determined by the second net on the string c with two buttons the tag retes the header when queued the se + +# Autoregressive Temperature 0.9 Samples: + +licklyn american football coach to holy roman emperor and roman stories radio and facilities in the u s civil rights movement the dc circuit collection of the witches leading the transissario times and spinoffs to american cartoonists cartoonist kyle marci + +the british one one eight four minamoto minister or al di nortello ministries son of monte oise klepe which chose to give up its character on the go he was known to publish a wade of white performances started in one eight five one kleine married the gigan + +mausoleum in one eight one six alabama was engaged by a large scale as we know alabama migration the palace of westminsters and proceeded to father she also learned to speak with the abramic mouth of the space the replica was apparently built de provence g + +# DFM $\eta = 15$ Temperature 0.8 Samples: + +e curous greek by alexander van hep ven see archaic origin of the word cupola another meaning suggests that the word kupola is the latin word cupei kupolum old german derived from the latin word for the river the name comes from a latin word for tree with + +es so balloonists refine this combination specifically to preserve your own land in the runner both examples of clean steering creating agout like rods that produced successful rods and for the end the first few pistols compact stunt a musical setting mult + +by reign over agassi is considered a greatest match by the day he will never play and will continue to be imitated agassi can play determinedly but agassi would always look to the victorious build he should not finish years going up to then that he would b + +# J. Protein Generation Experiment Details + +We present additional experiment details and results for protein generation with Multiflow. + +Code for Multiflow and experiments can be found at https://github.com/jasonkyuyim/multiflow + +# J.1. Experimental Details + +Model Architecture. We use an architecture modified from the FrameDiff architecture from Yim et al. (2023b). This architecture consists of Invariant Point Attention (Jumper et al., 2021) combined with transformer blocks, we refer to Yim et al. (2023b) for in-depth details. We modify this network architecture by increasing the number of network blocks to 8, increasing the number of transformer layers within each block to 4, decreasing the number of hidden channels used in the IPA calculation to 16, removing skip connections and removing psi-angle prediction. To enable our model to output logits for the discrete $p_{1|t}^{\theta}(x_1|x_t)$ distribution, we add an output 3 layer MLP with the same embedding size as the main trunk. This results in a network with 21.8M parameters. + +In Yim et al. (2023b), psi-angle prediction is used to infer the location of oxygen atoms, however, this position can be inferred to high accuracy using prior knowledge of the backbone structure of proteins, following (Yim et al., 2023a). + +When training with our $t, \tilde{t}$ objective that enables the model to learn over different relative levels of corruption between structure and sequence, $10\%$ of the time we set $t = 1$ and draw $\tilde{t} \sim \mathcal{U}(0,1)$ and $10\%$ of the time we set $\tilde{t} = 1$ and draw $t \sim \mathcal{U}(0,1)$ . The remaining $80\%$ of the time we draw both $t$ and $\tilde{t}$ independently from $t, \tilde{t} \sim \mathcal{U}(0,1)$ . + +# J.2. Additional Multiflow Results + +We show results of Multiflow across more lengths than done in Sec. 6.2.1 and show that using the ESMFold oracle for data distillation still gives improved performance when we switch the evaluation oracle to AlphaFold2. + +Main metrics with standard error. Table. 6 presents results of Table. 3 with standard error. We see our interpretation of the results do not change. + +Larger length range. Our results in Sec. 6.2.1 only evaluated 4 lengths (70, 100, 200, 300) to match the benchmark in RFdiffusion. However, other works have evaluated designability across all the lengths the method was trained on. We follow Protpardelle (Chu et al., 2023) to use Multiflow in generating 8 samples per length in the range $\{50, 51, \dots, 400\}$ . Fig. 6 shows the results in the same format as Figure 2B in Protpardelle. We see Multiflow achieves near perfect designability up to around length 350 at which point designability starts to drop. This is expected since Multiflow was only trained on lengths up to 384, but also demonstrates the ability to generalize beyond the lengths it was trained on. We see Multiflow also achieves a desirable spread of secondary structure. We show samples above length 370 with the highest and lowest Co-design 1 RMSD in Fig. 7. + +![](images/09c2b64d5ad7a2f70f4950679574dca71334a8cd8b48b442a0033a583fbbaf63.jpg) +Figure 6. Multiflow results on Protpardelle benchmark. (Left) PMPNN 8 scRMSD and designability versus length. Designability is computed as the proportion of samples that have scRMSD $< 2\AA$ within a sliding window of size 11. Average pLDDT as computed by ESMFold for each sample is plotted as the colour of the scatter point. (Right) Secondary structure distribution. For each sample the proportion of residues as part of an alpha helix or beta strand is measured giving an xy scatter point coordinate. + +![](images/4e3ef33a7bc96d57cd1d3aba07fa795c1a197c6c5af76a99da729ec24e67ea83.jpg) + +![](images/a93f69b6809433526fbca8fac1527052b98757cb147aa76cfab47496dfc2e75b.jpg) +Undesignable +Length 376 +scRMSD 14.4 + +![](images/bf7cace6e98c8aca3695d213ea462d69522c9d09f01a060480c743c24500ab98.jpg) +Length 373 +scRMSD 22.5 + +![](images/7333fca6f18763294f93d79124e8ca2a31119e1308448b82bc5fb6a561ddf3a6.jpg) +Length 386 scRMSD 0.9 + +![](images/31427652fa98b356ea1dc3d6d80df2c386f4c54b234a01698c7d087d3850f893.jpg) +Designable +Length 398 scRMSD 1.4 +Figure 7. Multiflow samples. (Left) 2 undesignable Multiflow samples with the highest scRMSD from the benchmark. (Right) 2 designable Multiflow samples with the lowest scRMSD from the benchmark. + +AlphaFold2 evaluation oracle. In Sec. 6.2.1, we presented a distillation technique of filtering out training examples that did + +not pass the designability criterion. This also involved adding more proteins to the training set after sampling structures with Multiflow and filtering with designability using ProteinMPNN and ESMFold. A potential risk of distillation is our model may overfit to ESMFold since this model is used to filter training data and also for evaluation. We show this is not the case in Table. 7 by presenting the Co-design 1 results using AlphaFold2 (AF2) as an alternative oracle. Our main results do not use AF2 since it is very slow and cumbersome to run and evaluate all our baselines. We evaluated Multiflow with and without distillation to test if distillation with ESMFold provides an improvement regardless of the oracle used at evaluation. Overall designability numbers are lower with AF2; however, in both columns we see there is a two fold improvement regardless of the evaluation oracle. This demonstrates distillation is not overfitting to the oracle used at evaluation. + +Table 7. Co-design 1 designability results based on oracle. + +
Designability with ESMFoldDesignability with AF2
Multiflow w/o distillation0.410.38
Multiflow w/ distillation0.880.83
Net improvement+0.47+0.45
+ +# J.3. Uniform Conditional Flow Ablation + +We ablate our use of the masking conditional flow and train a version of our Multiflow model using the uniform conditional flow ( see App. F.2). We assessed the model's co-design performance by measuring the Co-Design 1 designability and diversity versus stochasticity level used at inference time. We also measure the secondary structure composition of the generated samples versus stochasticity level. Our results are given in Fig. 8. We find that in general, the Co-Design 1 designability increases with increasing stochasticity whilst the diversity as measured by the number of structural clusters decreases. We can see the reason when examining the secondary structure statistics versus stochasticity. We see that at high stochasticity levels, the model heavily favours generating alpha helices at the expense of beta strands thus reducing the overall structural diversity. This will be due to interactions between errors in the model and the 'churn' induced by extra stochasticity. It may be counter-intuitive that extra stochasticity reduces model diversity however we hypothesize that this is linked to the stochasticity inducing the model to converge on local optima in the likelihood landscape. When the model is generating a sample that it is confidence about, extra stochasticity will not shift it away from continuing down this simulation trajectory. However, when the model is exploring lower likelihood regions, the stochasticity can shift the models trajectory until it becomes stuck in a local optima again. + +We find an overall worse trade-off between diversity and designability when using the uniform interpolant and so opt to use the masking interpolant in our main models. + +![](images/54b0a47e065b3f97964e4bf5d5f21b84e13fb03e71cc386705f8ef59b00ee8a6.jpg) +Figure 8. Sample metrics for Multiflow trained with the uniform interpolant on the discrete sequence modality. (Left) Co-Design 1 designability and diversity versus stochasticity level used when simulating the discrete CTMC. Higher is better for both designability and diversity. (Right) Average proportion of residues that are part of an alpha helix or beta strand versus the stochasticity level used to simulate the CTMC. Each point corresponds to the mean over 400 samples, 100 samples each for lengths 70, 100, 200, 300. Error bars show the standard error of the mean. + +![](images/5d079587f99799f73fa0c0d5dad2fe2b90ea055a9505c9e38f1458cc81a7d858.jpg) + +# J.4. Forward and Inverse Folding Experiments + +The goal of our work is to develop the missing piece for a general-purpose framework for protein generation – namely DFM to integrate discrete data generation with a flow model. We combined DFM and FrameFlow to develop Multiflow where we have flexibility at inference time to choose which modality to provide and which to generate. The task we focus on in this work is co-generation where the structure and sequence are jointly sampled rather than one after the other as done in prior works. The other useful tasks in protein modeling are forward and inverse folding. The two tasks are briefly described as follows; more in-depth description can be found in Gao et al. (2020). + +1. **Forward folding:** the task is to take the sequence as input and predicts the most thermodynamically plausible structure of the sequence. During evaluation, the ground truth structure is known, so we calculate the aligned structure error between the prediction and the ground truth. Several metrics exist to compute structure error, such as the Global Distance Test (GDT) commonly used in biophysical modeling (Pereira et al., 2021). We choose to use the aligned backbone RMSD error to keep our analysis simple and intuitive. The most well-used methods are AlphaFold2 (Jumper et al., 2021), RosettaFold (Baek et al., 2021), and ESMFold (Lin et al., 2023). AlphaFold2 and RosettaFold rely on using evolutionary information which our model does not have access to (though can be extended to use). We compare against ESMFold, which does not use explicit evolutionary information, and due to its speed. +2. Inverse folding: the task is to use the structure as input and predict the most likely sequence that would forward fold into the structure. By this definition, the most sensible metric is the designability metric also used for co-generation. Specifically, the inverse folding model generates a sequence and we use ESMFold to predict the structure given this generated sequence. We call the self-consistency RMSD (scRMSD) as the RMSD between the structure predicted by ESMFold and the original input structure (Trippe et al., 2022). The objective is to minimize scRMSD. The de facto method for inverse folding is ProteinMPNN (Dauparas et al., 2022). Hence we compare against ProteinMPNN. + +It is important to emphasize that different deep learning models have been specifically developed for forward and inverse folding, but no method can accomplish both tasks nor co-generate both sequence and structure. Multiflow is unique in this regard to be able to perform co-generation, forward folding, and inverse folding. We leave improving forward and inverse folding performance as a future work. Our aim is to demonstrate baseline performance of using a co-generation method to perform forward and inverse folding. We hope others can aid in advancing general purpose protein generative models. + +Test set. ESMFold and ProteinMPNN have their own training and test sets which makes rigorous comparison impossible. Re-training ESMFold and ProteinMPNN with the same training set of Multiflow is beyond the scope of our work. Our results are a initial baseline of how Multiflow generally fares to specialized models on forward and inverse folding. + +Our test set is based on a time-based split of the PDB. We downloaded structures and sequences from the PDB that were released between 1st September 2021 and 28th December 2023. This time-based split ensures that none of the test set proteins are present in the training data for Multiflow, ProteinMPNN or ESMFold. We then select all single chain monomeric proteins with length between 50 and 400 inclusive. We further filter out proteins that are more than $50\%$ coil residues and proteins that have a radius of gyration in the 96th percentile of the original dataset or above. We also filter out structures that have missing residues. We cluster proteins using the $30\%$ sequence identity MMSeqs2 clustering provided by RCSB.org. We take a single protein from each cluster that matches our filtering criteria. This gives us a test set of 449 proteins with minimum length 51 and maximum length 398. + +# J.4.1. FORWARD FOLDING RESULTS + +As described in Table. 2, forward folding with Multiflow is performed by fixing the sequence time to $\tilde{t} = 1$ , providing the ground truth sequence as input, and running DFM from $t = 0$ to $t = 1$ . + +In Fig. 9 we examine the distribution of errors on our test set for both ESMFold and Multiflow. We find that generally Multiflow can have some success with proteins of smaller length but struggles with longer proteins. We investigate salient test examples from the plot to understand success and failure modes of our model. Multiflow is generally able to predict realistic protein structures with often similar secondary structure distributions as to the ground truth example seen by having similar proportions of non-loop residues between the ground truth and predicted structure. However, Multiflow often fails to predict the exact folded structure with high accuracy. + +We quantify the secondary structure prediction accuracy in Fig. 10 by comparing the secondary structure present in the + +ground truth versus the structure predicted by Multiflow. We find good correlation between the predicted secondary structure and ground truth highlighting that Multiflow is able to use information present within the given sequence to generate structures. + +![](images/9e5a2513f1b5419c55d1a59ea10e0434607e572053f1235c3f38e1c9ca97a6d6.jpg) +Figure 9. Forward folding RMSD metrics (Left) RMSD error between ground truth and predicted structures for Multiflow along the x-axis versus RMSD error for ESMFold on the y-axis. Each dot represents a protein in the test set. The shading of each point represents the length of the protein. (Right) Visualizations of ground truth structure (left) in grey and predicted structure (right) in color for 4 salient examples highlighted on the RMSD error plot. For each, the Multiflow RMSD error is given along with the proportion of non-loop residues for both the ground truth and prediction. + +![](images/af485cf42eb455e78663419187cbf164866cc4cb5746407a841f072371e5c93f.jpg) + +![](images/0b2ddd4eff099a63d84ca8c5654308e06223dbc43b34077664c72765ae643efe.jpg) + +![](images/7e6909dfe988cd495f4bdd07631eb5c14bac652c2f977be0dad970344d81e1bb.jpg) + +![](images/51f62f8e1694d9c9c4cf10a597c79dde81b87ade607db96d8b18b048173bcf0f.jpg) + +![](images/4aa9ade7452c85a3be9d7bd150c890b647a68140b1a2f229244d976c65c955ae.jpg) +Figure 10. Proportion of residues that are part of secondary structure elements for both the Multiflow predicted structure and the ground truther structure. We plot the ground truth proportion of residues in a secondary structure element along the x-axis and the proportion of residues in the predicted structure on the y-axis. The left plot examines alpha helices whilst the right plot examines strand elements. Each scatter point represents a test set protein with the colour indicating the length. The perfect result of exactly matching proportion with the ground truth is plotted as a dashed diagonal line. We also report the correlation coefficient for each plot. + +![](images/8a4b7b8f0168094033659d4793f95102fbb26d40eb881ecc07f35c307e67d1e4.jpg) + +# J.4.2. INVERSE FOLDING RESULTS + +Similarly to forward folding, inverse folding with Multiflow is performed by fixing the structure time to $t = 1$ , providing the ground truth structure and running the sequence flow from $\tilde{t} = 0$ to $\tilde{t} = 1$ . + +We plot our results in Fig. 11. We find that Multiflow performs competitively with PMPNN across a wide range of protein lengths with PMPNN achieving slightly lower scRMSD values on average. For both models, scRMSD tends to cluster around 1 to 2 scRMSD. There are test proteins for which PMPNN achieves a lower scRMSD and also cases protein for which Multiflow achieves the lower scRMSD. + +![](images/43832735650bad0b76a44243a4b19f8b6349e70f6e2673452e7483296eccdca3.jpg) +Figure 11. Multiflow scRMSD versus PMPNN scRMSD on our test set. Each scatter point represents a protein with the shading giving the length. We also plot the dividing line of equal scRMSD for the two models for ease of comparison. + +
MethodCo-design 1PMPNN 8PMPNN 1
Des.Div.Nov.Des.Div.Nov.Des.Div.Nov.
Protpardelle0.04 (0.01)5 (0.3)0.69 (0.01)0.9 (0.01)47 (0.7)0.59 (0.01)0.63 (0.01)38 (2.7)0.60 (0.01)
ProteinGenerator0.37 (0.01)35 (2.6)0.69 (0.01)0.89 (0.00)75 (1.5)0.65 (0.02)0.78 (0.02)64 (4.6)0.66 (0.01)
RFdiffusion0.87 (0.02)158 (3.7)0.63 (0.01)0.66 (0.02)111 (5.9)0.64 (0.01)
Cogen0.86 (0.01)143 (6.4)0.61 (0.02)0.99 (0.00)156 (7.7)0.61 (0.01)0.88 (0.01)143 (6.4)0.61 (0.02)
Cogen w/o distillation0.42 (0.02)72 (2.4)0.62 (0.01)0.89 (0.00)126 (1.0)0.62 (0.02)0.71 (0.02)101 (7.1)0.63 (0.02)
Cogen w/o sequence0.99 (0.00)116 (1.0)0.63 (0.01)0.86 (0.01)97 (1.5)0.62 (0.02)
+ +Table 6. Performance metrics for various methods across different configurations. \ No newline at end of file diff --git a/generativeflowsondiscretestatespacesenablingmultimodalflowswithapplicationstoproteincodesign/images.zip b/generativeflowsondiscretestatespacesenablingmultimodalflowswithapplicationstoproteincodesign/images.zip new file mode 100644 index 0000000000000000000000000000000000000000..3646f17780e3aa5eada33eb62947c551b3c8afaa --- /dev/null +++ b/generativeflowsondiscretestatespacesenablingmultimodalflowswithapplicationstoproteincodesign/images.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b7f2dd30facdb925c139d7f452eff5c11635d2a62506810e2392fe648878971 +size 3491664 diff --git a/generativeflowsondiscretestatespacesenablingmultimodalflowswithapplicationstoproteincodesign/layout.json b/generativeflowsondiscretestatespacesenablingmultimodalflowswithapplicationstoproteincodesign/layout.json new file mode 100644 index 0000000000000000000000000000000000000000..33fbb5faff63b5df4f8bb433c750091d90d52e3f --- /dev/null +++ b/generativeflowsondiscretestatespacesenablingmultimodalflowswithapplicationstoproteincodesign/layout.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e6a9c267c5f80569ee568c43e64a4fca4bbe6d7b322fb766c24d2327747ecf4 +size 2425802 diff --git a/generativemarginalizationmodels/2306223c-ebdb-4fef-a4f7-87b8d893bf5f_content_list.json b/generativemarginalizationmodels/2306223c-ebdb-4fef-a4f7-87b8d893bf5f_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..74eb2a747265bb27fab292060216793939cea52d --- /dev/null +++ b/generativemarginalizationmodels/2306223c-ebdb-4fef-a4f7-87b8d893bf5f_content_list.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c7a4dfcd7f8b2dd730888dd0dcdbb047288065859ce70d0d9f0e9cfd763f16fd +size 215721 diff --git a/generativemarginalizationmodels/2306223c-ebdb-4fef-a4f7-87b8d893bf5f_model.json b/generativemarginalizationmodels/2306223c-ebdb-4fef-a4f7-87b8d893bf5f_model.json new file mode 100644 index 0000000000000000000000000000000000000000..00d98b6cb42829a5dc8c8de05404d8e695814ab2 --- /dev/null +++ b/generativemarginalizationmodels/2306223c-ebdb-4fef-a4f7-87b8d893bf5f_model.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d98a66999bec67aa8b7cb453386e324cd778088cc066d90c5d63517d9e16d94d +size 264714 diff --git a/generativemarginalizationmodels/2306223c-ebdb-4fef-a4f7-87b8d893bf5f_origin.pdf b/generativemarginalizationmodels/2306223c-ebdb-4fef-a4f7-87b8d893bf5f_origin.pdf new file mode 100644 index 0000000000000000000000000000000000000000..3ff869f391f605291892f6f1f65021f2a3c02768 --- /dev/null +++ b/generativemarginalizationmodels/2306223c-ebdb-4fef-a4f7-87b8d893bf5f_origin.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:35fa1e8b8c9d3733283793f760baba3bba36aad8e6fcba67655308a2ffb8fd3d +size 4810868 diff --git a/generativemarginalizationmodels/full.md b/generativemarginalizationmodels/full.md new file mode 100644 index 0000000000000000000000000000000000000000..0dae5f43c89df44ccf59ee553a117f87409ae2e8 --- /dev/null +++ b/generativemarginalizationmodels/full.md @@ -0,0 +1,1002 @@ +# Abstract + +We introduce marginalization models (MAMs), a new family of generative models for high-dimensional discrete data. They offer scalable and flexible generative modeling by explicitly modeling all induced marginal distributions. Marginalization models enable fast approximation of arbitrary marginal probabilities with a single forward pass of the neural network, which overcomes a major limitation of arbitrary marginal inference models, such as any-order autoregressive models. MAMs also address the scalability bottleneck encountered in training any-order generative models for high-dimensional problems under the context of energy-based training, where the goal is to match the learned distribution to a given desired probability (specified by an unnormalized log-probability function such as energy or reward function). We propose scalable methods for learning the marginals, grounded in the concept of "marginalization self-consistency". We demonstrate the effectiveness of the proposed model on a variety of discrete data distributions, including images, text, physical systems, and molecules, for maximum likelihood and energy-based training settings. MAMs achieve orders of magnitude speedup in evaluating the marginal probabilities on both settings. For energy-based training tasks, MAMs enable any-order generative modeling of high-dimensional problems beyond the scale of previous methods. Code is available at github.com/PrincetonLIPS/MaM. + +# 1. Introduction + +Deep generative models have enabled remarkable progress across diverse fields, including image generation, audio synthesis, natural language modeling, and scientific discovery. + +1Princeton University. Correspondence to: Sulin Liu . + +Proceedings of the $41^{st}$ International Conference on Machine Learning, Vienna, Austria. PMLR 235, 2024. Copyright 2024 by the author(s). + +However, there remains a pressing need to better support efficient probabilistic inference for key questions involving marginal probabilities $p(\mathbf{x}_S)$ and conditional probabilities $p(\mathbf{x}_{\mathcal{U}}|\mathbf{x}_{\mathcal{V}})$ , for appropriate subsets $S, \mathcal{U}, \mathcal{V}$ of the variables. The ability to directly address such quantities is critical in applications such as outlier or machine-generated content detection [59, 48], masked language modeling [15, 85], image inpainting [86], and constrained protein/molecule design [81, 65]. Furthermore, the capacity to conduct such inferences for arbitrary subsets of variables empowers users to leverage the model according to their specific needs and preferences. For instance, in protein design, scientists may want to manually guide the generation of a protein from a user-defined substructure under a particular path over the relevant variables. This requires the generative model to perform arbitrary marginal inferences. + +![](images/95d50fc4929bac74d604a313a1cf27e15c7e5a7c5ea7189ce362250aed415115.jpg) +Figure 1. Scalability of sequential discrete generative models. The y-axis unit is # of NN forward passes required. + +Towards this end, neural autoregressive models (ARMs) [3, 38] have shown great performance in conditional/marginal inference based on the idea of modeling a high-dimensional joint distribution as a factorization of univariate conditionals using the chain rule of probability. Many efforts have been made to scale up ARMs and enable any-order generative modeling under the setting of maximum likelihood estimation (MLE) [38, 78, 24], and great progress has been made in applications such as masked language modeling [85] and image inpainting [24]. However, marginal likelihood evaluation on a sequence of $D$ variables is limited by $\mathcal{O}(D)$ neural network passes with the most widely-used modern neural network architectures (e.g., Transformers [80] and U-Nets [62]). This scaling makes it difficult to evaluate + +![](images/10f161b50009fda5377cbaa427a6d90c5ded0047798a7be95908453727c87d08.jpg) +Figure 2. Marginalization models (MAMs) enable estimation of any marginal probability with a neural network $\theta$ that learns to "marginalize out" variables. The figure illustrates marginalization of a single variable on bit strings (representing molecules) with two alternatives (versus $K$ in general) for clarity. The bars represent probability masses. + +likelihoods on long sequences arising in data such as natural language and proteins. In addition to MLE, the setting of energy-based training (EB) has recently received growing interest with its applications in science domains [49, 12, 35]. Instead of empirical data samples, we only have access to an unnormalized (log) probability function (specified by a reward or energy function) that can be evaluated pointwise for the generative model to match. In such settings, ARMs are limited to fixed-order generative modeling and lack scalability in training. The subsampling techniques developed to scale the training of conditionals for MLE are no longer applicable when matching log probabilities in energy-based training (see Section 4.3 for details). + +To enhance scalability and flexibility in the generative modeling of discrete data, we propose a new family of generative models, **marginalization models (MAMs)**, that directly model the marginal distribution $p(\mathbf{x}_S)$ for any subset of variables $\mathbf{x}_S$ in $\mathbf{x}$ . Direct access to marginals has two important advantages: 1) significantly speeding up inference for any marginal, and 2) enabling scalable training of any-order generative models under both MLE and EB settings. + +The unique structure of the model allows it to simultaneously represent the coupled collection of all marginal distributions of a given discrete joint probability mass function. For the model to be valid, it must be consistent with the sum rule of probability, a condition we refer to as "marginalization self-consistency" (see Figure 2); learning to enforce this with scalable training objectives is one of the key contributions of this work. + +We show that MAMs can be trained under both maximum likelihood and energy-based training settings with scalable learning objectives. We demonstrate the effectiveness of MAMs in both settings on a variety of discrete data distributions, including binary images, text, physical systems, and molecules. We empirically show that MAMs achieve orders of magnitude speedup in marginal likelihood evaluation. For + +energy-based training, MAMs are able to scale training of any-order generative models to high-dimensional problems that previous methods fail to achieve. + +# 2. Background + +We first review two prevalent settings for training a generative model: maximum likelihood estimation and energy-based training. Then we introduce autoregressive models. + +Maximum likelihood (MLE) Given a dataset $\mathcal{D} = \{\mathbf{x}^{(i)}\}_{i=1}^{N}$ drawn i.i.d. from a data distribution $p = p_{\mathrm{data}}$ , we aim to learn the distribution $p_{\theta}(\mathbf{x})$ via maximum likelihood estimation: + +$$ +\max _ {\theta} \mathbb {E} _ {\mathbf {x} \sim p _ {\mathrm {d a t a}}} [ \log p _ {\theta} (\mathbf {x}) ] \approx \frac {1}{N} \sum_ {i = 1} ^ {N} \log p _ {\theta} \left(\mathbf {x} ^ {(i)}\right) \tag {1} +$$ + +which is equivalent to minimizing the Kullback-Leibler divergence under the empirical distribution, i.e., minimizing $D_{\mathrm{KL}}(p_{\mathrm{data}}(\mathbf{x})||p_{\theta}(\mathbf{x}))$ . This is the setting that is most commonly used in generation of images (e.g., diffusion models [69, 22, 70]) and language (e.g. GPT [58]) where we can easily draw observed data from the distribution. + +Energy-based training (EB) In other cases, data from the distribution are not always available. Instead, we have access to an unnormalized probability distribution $f(\cdot)$ typically specified as $f(\mathbf{x}) = \exp (r(\mathbf{x}) / \tau)$ where $r(\mathbf{x})$ is an energy (or reward) function and $\tau > 0$ is a temperature parameter. In this setting, the objective is to match $p_{\theta}(\mathbf{x})$ to $f(\mathbf{x}) / Z$ , where $Z$ is the normalization constant of $f$ . This can be done by minimizing the KL divergence [49, 84, 12], + +$$ +\min _ {\theta} D _ {\mathrm {K L}} \left(p _ {\theta} (\mathbf {x}) \| \frac {f (\mathbf {x})}{Z}\right) \tag {2} +$$ + +The reward function $r(\mathbf{x})$ can be defined either by human preferences or by the physical system from first principles. For example, (a) In aligning large language models, $r(\mathbf{x})$ + +can represent human preferences [51, 50]; (b) In molecular/material design, it can specify the proximity of a sample's measured or calculated properties to some functional desiderata [2]; and (c) In modeling the thermodynamic equilibrium ensemble of physical systems, it is the (negative) energy function of a given sample [49, 84, 12, 35]. + +The training objective in Equation (2) can be optimized using a Monte Carlo estimate of the gradient using the REINFORCE algorithm [83]. A generative model $\theta$ allows us to efficiently generate samples approximately from the distribution, which would otherwise be much more expensive via running MCMC with the energy function $f(\cdot)$ . + +Autoregressive models Autoregressive models (ARMs) [3, 38] model a complex high-dimensional distribution $p(\mathbf{x})$ by factorizing it into univariate conditionals using the chain rule: + +$$ +\log p _ {\phi} (\mathbf {x}) = \sum_ {d = 1} ^ {D} \log p _ {\phi} \left(x _ {d} \mid \mathbf {x} _ {< d}\right), \tag {3} +$$ + +where $\mathbf{x}_{2. + +$$ +p _ {\theta} \left(\mathbf {x} _ {\sigma (< d)}\right) p _ {\phi} \left(\mathbf {x} _ {\sigma (d)} \mid \mathbf {x} _ {\sigma (< d)}\right) \approx p _ {\theta} \left(\mathbf {x} _ {\sigma (\leq d)}\right), \tag {7} +$$ + +$$ +\forall \sigma \in S _ {D}, \mathbf {x} \in \{1, \dots , K \} ^ {D}, d \in [ 1: D ]. +$$ + +The consistency error for each constraint can be defined correspondingly as follows: + +ConsistencyError(x, $\sigma ,d$ + +$$ += \left[ \log \left(p _ {\theta} (\mathbf {x} _ {\sigma (< d)}) p _ {\phi} (\mathbf {x} _ {\sigma (d)} | \mathbf {x} _ {\sigma (< d)})\right) - \log p _ {\theta} (\mathbf {x} _ {\sigma (\leq d)}) \right] ^ {2}. +$$ + +Other distances such as KL divergence can also be considered. We choose squared distance for its flexibility in selecting the $q(\mathbf{x})$ , allowing us to fit marginals for various use cases with different $q(\mathbf{x})$ at test time. It's also worth noting that training with KL divergence and squared distance are quite similar (see Malkin et al. [47]). The REINFORCE gradient of $D_{\mathrm{KL}} \left(p_{\theta}(\mathbf{x}_{<\sigma(d)}) p_{\phi}(x_{\sigma(d)} | \mathbf{x}_{<\sigma(d)}) \parallel p_{\theta}(\mathbf{x}_{\leq \sigma(d)}). \mathrm{detach}() \right)$ is equivalent to the squared distance loss when $q$ is set to $p_{\theta}$ . + +By breaking the original marginalization self-consistency in Equation (4) into highly parallel marginalization self-consistency in Equation (7), we introduce a total of $K^{D} \times D! \times D \times K$ constraints. Although this increases the number of constraints, it becomes highly scalable to train on the marginalization self-consistency via randomly sampling constraints following a specified distribution $q(\mathbf{x})$ and $q(\sigma)$ . In our experiments, $q(\sigma)$ is set to the uniform distribution over all orderings $\mathcal{U}(S_D)$ and $q(\mathbf{x})$ is set to the data distribution of interest for marginal inference, such as the empirical data distribution $p_{\mathrm{data}}(\mathbf{x})$ or the generative model's distribution $p_{\theta, \phi}(\mathbf{x})$ . We found that a training objective that decomposes into highly parallel terms for sampling is key to effectively fitting marginals with scalability. + +# 4. Training the Marginalization Models + +# 4.1. Maximum Likelihood Estimation Training + +In this setting, we train MAMs with the maximum likelihood objective while additionally enforcing the marginalization constraints in Equation (5): + +$$ +\max _ {\theta , \phi} \mathbb {E} _ {\mathbf {x} \sim p _ {\mathrm {d a t a}}} \log p _ {\theta} (\mathbf {x}) \tag {8} +$$ + +s.t. $p_{\theta}(\mathbf{x}_{\sigma (< d)})p_{\phi}(\mathbf{x}_{\sigma (d)}|\mathbf{x}_{\sigma (< d)})\approx p_{\theta}(\mathbf{x}_{\sigma (\leq d)}),$ + +$$ +\forall \sigma \in S _ {D}, \mathbf {x} \in \{1, \dots , K \} ^ {D}, d \in [ 1: D ]. +$$ + +Two-stage training A typical way to solve the above optimization problem is to convert the marginalization constraint into another objective and optimize both objectives jointly. However, maximizing $\log p_{\theta}(\mathbf{x}_{\leq D})$ directly in Equation (8) is unbounded, we empirically found this causes the training to be slow and unstable by over-emphasizing likelihood at the expense of self-consistency. Instead, we identify an theoretically equivalent two-stage optimization formulation that leads to more effective training strategy based on the following observation: + +Proposition 1. Solving the optimization problem in (8) is equivalent to the following two-stage optimization procedure, under mild assumptions about the neural networks + +used being universal approximators: + +Stage 1: $\max_{\phi} \mathbb{E}_{\mathbf{x} \sim p_{data}} \mathbb{E}_{\sigma} \sum_{d=1}^{D} \log p_{\phi}\left(x_{\sigma(d)} \mid \mathbf{x}_{\sigma(4. (1.0 means a perfect linear correlation with the best model's marginal estimates.) For evaluating NLL, the conditional network and marginal network perform similarly in ablation studies (see Appendix B.2). We use the conditional network for evaluating NLL. The marginal network is used for evaluating margins. + +Image We evaluate MAMs on Binary MNIST [63], CIFAR-10 [37] and ImageNet32 [14, 10]. The image dimension is $1 \times 28 \times 28$ for MNIST and $3 \times 32 \times 32$ for CIFAR-10 and ImageNet32. MAMs achieve competitive NLL on all tasks, equaling the best-performing arbitrary marginal inference models. In terms of marginal inference, MAM produces high quality marginal estimates while achieving close to 4 orders of magnitude speed-up in computation time. The Pearson correlation coefficients are close to 1.0, which means the marginal estimates are consistent with the best marginal estimates. It can also be interpreted as a measure of marginalization self-consistency, since the marginals of MAM are evaluated against the same conditionals of + +Table 1. Pixel modeling on Binary-MNIST + +
NLL (bpd) ↓Pearson ↑Time (s) ↓
GflowNet [88]0.189--
AO-ARM♦ [24]0.1460.99132.4 ± 0.03
PC (EiNets)♦ [54]0.1870.750.015 ± 0.00
MAM♦0.1460.990.018 ± 0.00
+ +Table 2. Pixel modeling on CIFAR-10 + +
NLL (bpd) ↓Pearson ↑Time (s) ↓
D3PM [1]3.44--
PixelCNN++ [64]2.99--
VDM [33]2.49--
Sparse Transformer [7, 32]2.56--
PC (LVD-PG)♦ [42]3.87--
AO-ARM♦ (800 epochs)2.880.992401 ± 1
MAM♦ (800 epochs)2.880.980.495 ± 0.00
+ +# AO-ARM and MAM. + +Molecule We evaluate MAM on the molecular generation benchmark MOSES [55] refined from the ZINC database [72]. The generated molecules from MAM and AO-ARM are comparable to standard state-of-the-art molecular generative models, such as CharRNN [66], JTNVAE [30], and LatentGAN [57] (see Tables 10 and 11), with added controllability and flexibility in any-order generation. MAM supports much much faster marginal inference, which is useful for domain scientists to easily reason about the likelihood of (sub)structures. Generated molecules and property histogram plots of are available in Appendix C.4. + +Text We train a character-level generative model on Text8 [45], which consists of 100M characters from Wikipedia in chunks of 250 character. MAM achieves significant speed-up in marginal inference while maintaining comparable performance as an arbitrary marginal inference model. The test NLL is close to a Transformer model that is trained to only model one ordering (from left to right). + +# 6.2. Energy-based Training + +In the existing literature, only ARM with fixed variable order has been used for this training setting (for example in Wu et al. [84], Damewood et al. [12]). We additionally implement two more baselines: ARM-MC that uses single-step conditional as a Monte Carlo estimate to $\log p_{\phi}$ and GFlowNet [46]. The effective batch size for ARM and GFlowNet is $B \times D$ for batch of $B$ data samples (due to reasons mentioned in Section 4.3), and $B \times 1$ for ARM-MC and MAM. MAM and ARM use the REINFORCE gradient estimator with baseline. GFlowNet is trained on per-sample gradient of squared distance [88]. Note that MAM is an any- + +![](images/cf0f611449ec00e50c2fdca95ce90f5156ccc57545c6bbb719b15f76f13253ff.jpg) +-0.4627, 0.0000 + +![](images/804bc73b7ca644dcd795fabc0136f811db7e156b329c0e80049dceaa09728c68.jpg) +-2326.1995, -2156.8149 + +![](images/50b9bd2a16abd773504fd0d0fd9a304a2e8ad2779b99c26354fa12682b8329e3.jpg) +-3975.1997, -3873.0151 + +![](images/7ca649b4515731f887df316c29f56559ffb16eddd2702e18304e14372d2714d8.jpg) +-5427.7236, -5406.5122 + +![](images/3523ce961e0190bfd7356d06577b1a09ee15988546f60c8ce35c60d7b7f2cf98.jpg) +-6642.8984, -6739.9624 + +![](images/ddfc69b4e5f66e8750f5533f2ccbca7764bdd6efe3c44f646392607ebf767f22.jpg) +-7707.4326, -7895.3428 + +![](images/34bedfe83e8b0f4dbdee31201d4338e1f0c487260a3add94bf5927211e5b7444.jpg) +-8697.5957, -8974.0234 + +Table 3. Pixel modeling on ImageNet32 + +
NLL (bpd) ↓Pearson ↑Time (s) ↓
Image Transformer [53]3.77--
VDM [33]3.72--
PC (LVD-PG)♦ [42]4.06--
AO-ARM♦ (16 epochs)3.600.994995 ± 1
MAM♦ (16 epochs)3.600.981.243 ± 0.00
+ +Table 4. Character modeling on text8 + +
NLL (bpc) ↓Pearson ↑Time (s) ↓
D3PM [1]1.47--
Discrete Flow [77]1.23--
Transformer [80]1.35--
AO-ARM♦ (3000 epochs)1.480.98741.40 ± 0.01
MAM♦ (3000 epochs)1.480.9450.005 ± 0.00
+ +order generative model, which is a more difficult learning task than ARM that uses fixed ordering and GFlowNet that uses learned ordering. + +Table 5. Energy-based modeling of Ising model $\left( {D = {100}}\right)$ + +
NLL (bpd) ↓KL div. ↓Time (s) ↓
ARM-One-Order◇ [12]0.79-78.635.3±0.1e-01
ARM-MC-One-Order◇24.84-18.015.3±0.1e-01
GFlowNet [88]0.78-78.17-
MAM-Any-Order◆0.80-77.773.7±0.1e-04
+ +Table 6. Energy-based modeling of Ising model $\left( {D = {900}}\right)$ + +
NLL (bpd) ↓ KL div. ↓ Time (s) ↓
ARM-One-Order◇ [12]– Out of GPU memory –
Random Samples1.00-623.9–
MAM-Any-Order♦0.83-685.83.7±0.1e-04
+ +Physical systems Ising models [28] model interacting spins on a square lattice and are widely studied in mathematics and physics (see MacKay [43]). The spins of the $D$ sites are represented by a $D$ -dimensional binary vector $\mathbf{x}$ , whose distribution $p^{*}(\mathbf{x}) \propto \exp(-E_{\mathbf{J}}(\mathbf{x}))$ is determined by the energy function $E_{\mathbf{J}}(\mathbf{x}) \triangleq -\mathbf{x}^{\top} \mathbf{J} \mathbf{x} - \boldsymbol{\theta}^{\top} \mathbf{x}$ , with $\mathbf{J}$ + +![](images/6f2a18e3d11cc51d81d4b156a1a6fc985bfe6c6f1124bf709dd6c35b02b1c472.jpg) +Figure 4. An example of the marginal estimates of an ImageNet32 image along the generation trajectory using a random ordering. The numbers in the captions show that the learned (log) marginals (left) v.s. learned (log) conditionals (right) are approximately self-consistent. + +![](images/a1aad73b8bf3868024a35a68ec33f43792fd52cedc2167f71b1285825eab7ccb.jpg) +Figure 5. Ising model. Left: $D = 10 \times 10$ . Right: $D = 30 \times 30$ + +being the adjacency matrix. We compare MAM with ARM, ARM-MC, and GFlowNet on a $10 \times 10$ ( $D = 100$ ) and a larger $30 \times 30$ ( $D = 900$ ) Ising model where ARMs and GFlowNets fail to scale. We generate 2000 ground truth samples following Grathwohl et al. [21] and we measure test negative log-likelihood on those samples. We also measure $D_{\mathrm{KL}}(p_{\theta}(\mathbf{x})||p^{*})$ by sampling from the learned model and evaluating $\sum_{i=1}^{M}(\log p_{\theta}(\mathbf{x}_i) - \log f^*(\mathbf{x}_i))$ . Figure 5 contains KDE plots of $-E_{\mathbf{J}}(\mathbf{x})$ for the generated samples. We validate the analysis in Section 4.3, the ARM-MC gradient has high variance which leads to non-convergence or mode collapse. MAM achieves significant speedup in marginal inference and is the only model that supports any-order generative modeling. The performance in terms of KL divergence and likelihood are only slightly worse than models with fixed/learned order, which is expected since any-order modeling is harder than fixed-order modeling, and MAM is solving a more complicated task of jointly learning conditionals and marginals. On a $30 \times 30$ ( $D = 900$ ) Ising model, MAM achieves a bpd of 0.835 while ARM and GFlowNet fail to fit in the GPU memory (see Figure 5 and Table 6). + +Molecular generation with target property In this task, we are interested in training generative models towards a specific target property of interest $g(x)$ , such as lipophilicity (logP), synthetic accessibility (SA), etc. We define the distribution of molecules to follow $p^* (x)\propto \exp (-(g(x) - g^*)^2 /\tau)$ , where $g^{*}$ is the target value of the property and $\tau$ is a temperature parameter. We train ARM and MAM for lipophilicity of target values 4.0 and -4.0, both with $\tau = 1.0$ and $\tau = 0.1$ . Both models are trained for 4000 iterations with batch size 512. Results are shown in Figure 6 (additional results in Appendix C). + +![](images/e06f9c3186367a8cc49310a0aec37701c1ee5672a17e8d95e93d242c9292a856.jpg) +Figure 6. EB molecule targeted generation. Left: 55d. Right: 500d + +![](images/d45d378d5553ac377a346a5221d66ee54de3cc6f02698ad69881d4d390dc86c4.jpg) + +Findings are consistent with the Ising model experiments. Again, MAM performs just marginally below ARM. However, only MAM supports any-order modeling and scales to high-dimensional problems. Figure 6 (right) shows molecular generation with MAM for $D = 500$ . + +![](images/1531b5ea093f436d7806c7302ecfb0773d4d47d8172b819d48362f4f58cb08de.jpg) +Figure 7. Illustration of conditional design of molecules towards low lipophilicity from a user-defined substructure in a given order. Left: Impainting the left 4 characters. Right: Impainting the right 4-20 characters. Shaded regions denote the impainted structures. + +# 6.3. Comparison with Parallel AO-ARMs + +Inference of AO-ARMs can be parallelized with fewer steps using dynamic programming at cost of minimal log-likelihood degradation, which make it a strong baseline for accelerated inference as shown in Hoogeboom et al. [24]. In Figure 8, we compare the quality of MAM against P-AO-ARM (PARM) with varying number of sampling steps $T$ . MAM is consistently faster and produces better-correlated marginal estimates than PARM. PARM's effectiveness varies across datasets. Text and molecule data require more steps of PARM for accurate estimation due to their sequential dependencies. Interestingly, ImageNet32 needs much fewer PARM steps for correlated log-likelihoods (despite values being quite off), suggesting easier parallelization of sampling/inference once some pixels are filled. + +# 6.4. Out-of-distribution Robustness + +The marginal estimates from MAM are not perfectly normalized but only approximate log-likelihood values. Hence we test the how useful and robust those approximate marginals are in real-world use cases which are often out-of-distribution with various degrees. + +We tested MAM's marginal estimates on generated "syn + +![](images/4dd9a920c72857ac923b54d6af0c6fc93eb23c5cdcf4c3bd4d238ff6236dae4d.jpg) + +![](images/4fcbe15f6a2b240711b8da39712ee78777fae0949e0f73aae3d8532a3c73df26.jpg) + +![](images/616915fe809836b7ae37791a4dff4cd0cb47ec8b91ab385f8f5334951111100a.jpg) +Figure 8. Comparison with Parallel AO-ARMs. + +![](images/132002416c34bd29fe3319bfc3bdf738fa45c987fe7c45c0d360790ccccd17f4.jpg) + +theoretic" data from masked MNIST (Appendix C.3.3) and Text8 examples (Appendix C.5). MAM $\log p$ estimates maintain a high correlation with actual log-likelihoods on data that are on-manifold but slightly out-of-distribution. In Appendix C.5.1, we also tested the model's generalizability for length extrapolation on Text8. The model is trained on $D = 250$ and tested on sequences with $D = 300$ from the same dataset. MAM's predicted $\log p$ marginals generalize gracefully to longer sequences. The quality matches Parallel AO-ARM with $10\sim 20$ steps while using significantly less time $(2000\times)$ . Finally, in Appendix C.4, we tested the model on a more challenging task: using MAM model's marginal likelihood estimates trained on Molecular Sets (a general chemical space of drug-like compounds) to distinguish between two focused chemical spaces (tyrosine kinase inhibitors and organic photodiodes) that are not seen during training. We created 1000 pairs consisting of one of each using datasets from Subramanian et al. [74], controlling for other factors like SMILES length and chemical space to increase difficulty. MAM marginals correctly identified the drug molecule $74\%$ of the time (v.s. $79\%$ for AO-ARM), with $90\%$ alignment on marginal estimates with AO-ARM. + +# 7. Conclusion + +In conclusion, marginalization models are a novel family of generative models for high-dimensional discrete data that offer scalable and flexible generative modeling. These models explicitly model all induced marginal distributions, allowing for fast evaluation of arbitrary marginal probabilities with a single neural net forward pass. MAMs also support scalable training objectives for any-order generative modeling, which previous methods struggle to achieve under the energy-based training context. Potential future work includes designing novel neural network architectures that automatically satisfy the marginalization self-consistency. + +# Acknowledgments + +We thank members of the Princeton Laboratory for Intelligent Probabilistic Systems and anonymous reviewers for valuable discussions and feedback. We thank Andrew Novick and Eric Toberer for valuable discussions on energy-based training in scientific applications. We thank Akshay Subramanian and Soojung Yang for valuable discussions on designing the drug-or-photodiode out-of-distribution evaluation task. This work was partially supported by NSF grants IIS-2007278 and OAC-2118201. + +# Impact Statement + +As a deep learning model, MAM has the risk of low robustness on data from unseen domain or manifold. In practice, one should not blindly apply it to data that is far away from the training data distribution and expect the marginal likelihood estimate can be trusted. For the same reason, MAM will also be susceptible to adversarial attacks just as other commonly deep learning models. + +MaM enables training of a new type of generative model. Access to fast marginal likelihood is helpful for many downstream tasks such as outlier detection, protein/molecule design or screening. By allowing the training of order-agnostic discrete generative models scalable for distribution matching, it enhances the flexibility and controllability of generation towards a target distribution. This also poses the potential risk of deliberate misuse, leading to the generation of content/designs/materials that could cause harm to individuals. + +# References + +[1] Austin, J., Johnson, D. D., Ho, J., Tarlow, D., and van den Berg, R. Structured denoising diffusion models in discrete state-spaces. Advances in Neural Information Processing Systems, 34:17981-17993, 2021. (pages 7, 8, and 17) +[2] Bengio, E., Jain, M., Korablyov, M., Precup, D., and Bengio, Y. Flow network based generative models for non-iterative diverse candidate generation. Advances in Neural Information Processing Systems, 34:27381-27394, 2021. (pages 3, 6, and 17) +[3] Bengio, S. and Bengio, Y. Taking on the curse of dimensionality in joint distributions using neural networks. IEEE Transactions on Neural Networks, 11(3): 550-557, 2000. (pages 1 and 3) +[4] Bengio, Y., Lahlou, S., Deleu, T., Hu, E. J., Tiwari, M., and Bengio, E. Gfownet foundations. Journal of Machine Learning Research, 24(210):1-55, 2023. (pages 6, 16, and 17) +[5] Berthelot, D., Autef, A., Lin, J., Yap, D. A., Zhai, S., Hu, S., Zheng, D., Talbott, W., and Gu, E. Tract: Denoising diffusion models with transitive closure time-distillation. arXiv preprint arXiv:2303.04248, 2023. (page 5) +[6] Burda, Y., Grosse, R., and Salakhutdinov, R. Importance weighted autoencoders. arXiv preprint arXiv:1509.00519, 2015. (page 21) +[7] Child, R., Gray, S., Radford, A., and Sutskever, I. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019. (page 7) +[8] Choi, Y., Vergari, A., and Van den Broeck, G. Probabilistic circuits: A unifying framework for tractable probabilistic models. UCLA. URL: http://starai.cs.ucla.edu/papers/ProbCirc20.pdf, 2020. (pages 6 and 17) +[9] Chow, C. and Liu, C. Approximating discrete probability distributions with dependence trees. IEEE transactions on Information Theory, 14(3):462-467, 1968. (page 6) +[10] Chrabaszcz, P., Loshchilov, I., and Hutter, F. A downsampled variant of imagenet as an alternative to the CIFar datasets. arXiv preprint arXiv:1707.08819, 2017. (pages 7 and 22) +[11] Cybenko, G. Approximation by superpositions of a sigmoidal function. Mathematics of control, signals and systems, 2(4):303-314, 1989. (page 15) + +[12] Damewood, J., Schwalbe-Koda, D., and Gomez-Bombarelli, R. Sampling lattices in semi-grand canonical ensemble with autoregressive machine learning. npj Computational Materials, 8(1):61, 2022. (pages 2, 3, 6, 7, and 8) +[13] Darwiche, A. A differential approach to inference in Bayesian networks. Journal of the ACM (JACM), 50 (3):280-305, 2003. (page 6) +[14] Deng, J., Dong, W., Socher, R., Li, L.-J., Li, K., and Fei-Fei, L. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248-255. IEEE, 2009. (pages 7 and 22) +[15] Devlin, J., Chang, M.-W., Lee, K., and Toutanova, K. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. (page 1) +[16] Dinh, L., Krueger, D., and Bengio, Y. NICE: Nonlinear independent components estimation. arXiv preprint arXiv:1410.8516, 2014. (page 17) +[17] Dinh, L., Sohl-Dickstein, J., and Bengio, S. Density estimation using real NVP. arXiv preprint arXiv:1605.08803, 2016. (page 17) +[18] Douglas, L., Zarov, I., Gourgoulias, K., Lucas, C., Hart, C., Baker, A., Sahani, M., Perov, Y., and Johri, S. A universal marginalizer for amortized inference in generative models. Advances in Approximate Bayesian Inference, NIPS 2017 Workshop, 2017. (page 6) +[19] Flam-Shepherd, D., Zhu, K., and Aspuru-Guzik, A. Language models can learn complex molecular distributions. Nature Communications, 13(1):3293, 2022. (page 3) +[20] Germain, M., Gregor, K., Murray, I., and Larochelle, H. Made: Masked autoencoder for distribution estimation. In International conference on machine learning, pp. 881-889. PMLR, 2015. (page 6) +[21] Grathwohl, W., Swersky, K., Hashemi, M., Duvenaud, D., and Maddison, C. Oops I took a gradient: Scalable sampling for discrete distributions. In International Conference on Machine Learning, pp. 3831-3841. PMLR, 2021. (pages 8 and 22) +[22] Ho, J., Jain, A., and Abbeel, P. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840-6851, 2020. (page 2) + +[23] Hoogeboom, E., Peters, J., Van Den Berg, R., and Welling, M. Integer discrete flows and lossless compression. Advances in Neural Information Processing Systems, 32, 2019. (page 17) +[24] Hoogeboom, E., Gritsenko, A. A., Bastings, J., Poole, B., Berg, R. v. d., and Salimans, T. Autoregressive diffusion models. arXiv preprint arXiv:2110.02037, 2021. (pages 1, 3, 5, 6, 7, 9, 15, 17, 18, 22, 23, and 24) +[25] Hoogeboom, E., Nielsen, D., Jaini, P., Forre, P., and Welling, M. Argmax flows and multinomial diffusion: Learning categorical distributions. Advances in Neural Information Processing Systems, 34:12454-12465, 2021. (page 17) +[26] Hornik, K. Approximation capabilities of multilayer feedforward networks. Neural networks, 4(2):251-257, 1991. (page 15) +[27] Hornik, K., Stinchcombe, M., and White, H. Multi-layer feedforward networks are universal approximators. Neural networks, 2(5):359-366, 1989. (page 15) +[28] Ising, E. Beitrag zur Theorie des Ferromagnetismus. Zeitschrift fur Physik, 31(1):253-258, February 1925. doi: 10.1007/BF02980577. (page 8) +[29] Ivanov, O., Figurnov, M., and Vetrov, D. Variational autoencoder with arbitrary conditioning. arXiv preprint arXiv:1806.02382, 2018. (page 6) +[30] Jin, W., Barzilay, R., and Jaakkola, T. Junction tree variational autoencoder for molecular graph generation. In International conference on machine learning, pp. 2323-2332. PMLR, 2018. (page 7) +[31] Johnson, D. D., Austin, J., Berg, R. v. d., and Tarlow, D. Beyond in-place corruption: Insertion and deletion in denoising probabilistic models. arXiv preprint arXiv:2107.07675, 2021. (page 17) +[32] Jun, H., Child, R., Chen, M., Schulman, J., Ramesh, A., Radford, A., and Sutskever, I. Distribution augmentation for generative modeling. In International Conference on Machine Learning, pp. 5006-5019. PMLR, 2020. (page 7) +[33] Kingma, D., Salimans, T., Poole, B., and Ho, J. Variational diffusion models. Advances in neural information processing systems, 34:21696-21707, 2021. (pages 7 and 8) +[34] Kingma, D. P., Salimans, T., Jozefowicz, R., Chen, X., Sutskever, I., and Welling, M. Improved variational inference with inverse autoregressive flow. Advances in Neural Information Processing Systems, 29, 2016. (page 17) + +[35] Kohler, J., Invernizzi, M., De Haan, P., and Noé, F. Rigid body flows for sampling molecular crystal structures. arXiv preprint arXiv:2301.11355, 2023. (pages 2 and 3) +[36] Krenn, M., Häse, F., Nigam, A., Friederich, P., and Aspuru-Guzik, A. Self-referencing embedded strings (SELFIES): A $100\%$ robust molecular string representation. Machine Learning: Science and Technology, 1 (4):045024, 2020. (pages 3 and 22) +[37] Krizhevsky, A., Hinton, G., et al. Learning multiple layers of features from tiny images. 2009. (pages 7 and 22) +[38] Larochelle, H. and Murray, I. The neural autoregressive distribution estimator. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, pp. 29-37. JMLR Workshop and Conference Proceedings, 2011. (pages 1, 3, and 7) +[39] Li, Y., Akbar, S., and Oliva, J. Acflow: Flow models for arbitrary conditional likelihoods. In International Conference on Machine Learning, pp. 5831-5841. PMLR, 2020. (page 6) +[40] Lin, Z., Akin, H., Rao, R., Hie, B., Zhu, Z., Lu, W., Smetanin, N., Verkuil, R., Kabeli, O., Shmueli, Y., et al. Evolutionary-scale prediction of atomic-level protein structure with a language model. Science, 379 (6637):1123-1130, 2023. (page 3) +[41] Liu, A., Zhang, H., and Broeck, G. V. d. Scaling up probabilistic circuits by latent variable distillation. arXiv preprint arXiv:2210.04398, 2022. (pages 6 and 17) +[42] Liu, X., Liu, A., Van den Broeck, G., and Liang, Y. Understanding the distillation process from deep generative models to tractable probabilistic circuits. In International Conference on Machine Learning, pp. 21825-21838. PMLR, 2023. (pages 6, 7, 8, and 17) +[43] MacKay, D. J. Information Theory, Inference and Learning Algorithms. Cambridge University Press, 2003. (page 8) +[44] Madani, A., Krause, B., Greene, E. R., Subramanian, S., Mohr, B. P., Holton, J. M., Olmos Jr, J. L., Xiong, C., Sun, Z. Z., Socher, R., et al. Large language models generate functional protein sequences across diverse families. Nature Biotechnology, pp. 1-8, 2023. (page 3) +[45] Mahoney, M. Large text compression benchmark, 2011. (page 7) + +[46] Malkin, N., Jain, M., Bengio, E., Sun, C., and Bengio, Y. Trajectory balance: Improved credit assignment in gflownets. Advances in Neural Information Processing Systems, 35:5955-5967, 2022. (pages 6, 7, and 17) +[47] Malkin, N., Lahlou, S., Deleu, T., Ji, X., Hu, E., Everett, K., Zhang, D., and Bengio, Y. Gfownets and variational inference. arXiv preprint arXiv:2210.00580, 2022. (pages 4 and 17) +[48] Mitchell, E., Lee, Y., Khazatsky, A., Manning, C. D., and Finn, C. Detectgpt: Zero-shot machine-generated text detection using probability curvature. arXiv preprint arXiv:2301.11305, 2023. (page 1) +[49] Noé, F., Olsson, S., Köhler, J., and Wu, H. Boltzmann generators: Sampling equilibrium states of many-body systems with deep learning. Science, 365(6457), 2019. (pages 2 and 3) +[50] OpenAI. ChatGPT, 2023. URL https://openai.com. (page 3) +[51] Ouyang, L., Wu, J., Jiang, X., Almeida, D., Wainwright, C., Mishkin, P., Zhang, C., Agarwal, S., Slama, K., Ray, A., et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35:27730-27744, 2022. (page 3) +[52] Papamakarios, G., Pavlakou, T., and Murray, I. Masked autoregressive flow for density estimation. Advances in Neural Information Processing Systems, 30, 2017. (page 17) +[53] Parmar, N., Vaswani, A., Uszkoreit, J., Kaiser, L., Shazeer, N., Ku, A., and Tran, D. Image transformer. In International conference on machine learning, pp. 4055-4064. PMLR, 2018. (page 8) +[54] Peharz, R., Lang, S., Vergari, A., Stelzner, K., Molina, A., Trapp, M., Van den Broeck, G., Kersting, K., and Ghahramani, Z. Einsum networks: Fast and scalable learning of tractable probabilistic circuits. In International Conference on Machine Learning, pp. 7563-7574. PMLR, 2020. (pages 6, 7, and 17) +[55] Polykovskiy, D., Zhebrak, A., Sanchez-Lengeling, B., Golovanov, S., Tatanov, O., Belyaev, S., Kurbanov, R., Artamonov, A., Aladinskiy, V., Veselov, M., et al. Molecular sets (moses): a benchmarking platform for molecular generation models. Frontiers in Pharmacology, 11:565644, 2020. (pages 7 and 26) + +[56] Poon, H. and Domingos, P. M. Sum-product networks: A new deep architecture. In Proceedings of the Twenty-Seventh Conference on Uncertainty in Artificial Intelligence, 2011. (page 6) +[57] Prykhodko, O., Johansson, S. V., Kotsias, P.-C., Arús-Pous, J., Bjerrum, E. J., Engkvist, O., and Chen, H. A de novo molecular generation method using latent vector based generative adversarial network. Journal of Cheminformatics, 11(1):1-13, 2019. (page 7) +[58] Radford, A., Wu, J., Child, R., Luan, D., Amodei, D., Sutskever, I., et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019. (page 2) +[59] Ren, J., Liu, P. J., Fertig, E., Snoek, J., Poplin, R., Depristo, M., Dillon, J., and Lakshminarayanan, B. Likelihood ratios for out-of-distribution detection. Advances in neural information processing systems, 32, 2019. (page 1) +[60] Rezende, D. and Mohamed, S. Variational inference with normalizing flows. In International Conference on Machine Learning, pp. 1530-1538. PMLR, 2015. (page 17) +[61] Rippel, O. and Adams, R. P. High-dimensional probability estimation with deep density models. arXiv preprint arXiv:1302.5125, 2013. (page 17) +[62] Ronneberger, O., Fischer, P., and Brox, T. U-net: Convolutional networks for biomedical image segmentation. In Medical Image Computing and Computer-Assisted Intervention-MICCAI 2015: 18th International Conference, Munich, Germany, October 5-9, 2015, Proceedings, Part III 18, pp. 234-241. Springer, 2015. (pages 1 and 3) +[63] Salakhutdinov, R. and Murray, I. On the quantitative analysis of deep belief networks. In Proceedings of the 25th international conference on Machine learning, pp. 872-879, 2008. (pages 7 and 21) +[64] Salimans, T., Karpathy, A., Chen, X., and Kingma, D. P. PixelCNN++: Improving the pixelCNN with discretized logistic mixture likelihood and other modifications. arXiv preprint arXiv:1701.05517, 2017. (page 7) +[65] Schneuing, A., Du, Y., Harris, C., Jamasb, A., Igashov, I., Du, W., Blundell, T., Lió, P., Gomes, C., Welling, M., et al. Structure-based drug design with equivariant diffusion models. arXiv preprint arXiv:2210.13695, 2022. (page 1) +[66] Segler, M. H., Kogej, T., Tyrchan, C., and Waller, M. P. Generating focused molecule libraries for drug discovery with recurrent neural networks. ACS Central Science, 4(1):120-131, 2018. (pages 3 and 7) + +[67] Shih, A., Sadigh, D., and Ermon, S. Training and inference on any-order autoregressive models the right way. arXiv preprint arXiv:2205.13554, 2022. (pages 6 and 18) +[68] Shin, J.-E., Riesselman, A. J., Kollasch, A. W., McMahon, C., Simon, E., Sander, C., Manglik, A., Kruse, A. C., and Marks, D. S. Protein design and variant prediction using autoregressive generative models. Nature Communications, 12(1):2403, 2021. (page 3) +[69] Sohl-Dickstein, J., Weiss, E., Maheswaranathan, N., and Ganguli, S. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, pp. 2256-2265. PMLR, 2015. (pages 2 and 17) +[70] Song, Y. and Ermon, S. Generative modeling by estimating gradients of the data distribution. Advances in neural information processing systems, 32, 2019. (page 2) +[71] Song, Y., Dhariwal, P., Chen, M., and Sutskever, I. Consistency models. arXiv preprint arXiv:2303.01469, 2023. (page 5) +[72] Sterling, T. and Irwin, J. J. ZINC 15-ligand discovery for everyone. Journal of Chemical Information and Modeling, 55(11):2324-2337, 2015. (page 7) +[73] Strauss, R. and Oliva, J. B. Arbitrary conditional distributions with energy. Advances in Neural Information Processing Systems, 34:752-763, 2021. (page 6) +[74] Subramanian, A., Greenman, K. P., Gervaix, A., Yang, T., and Gomez-Bombarelli, R. Automated patent extraction powers generative modeling in focused chemical spaces. Digital Discovery, 2(4):1006-1015, 2023. (pages 9 and 26) +[75] Tabak, E. G. and Turner, C. V. A family of nonparametric density estimation algorithms. Communications on Pure and Applied Mathematics, 66(2):145-164, 2013. (page 17) +[76] Tieleman, T. Training restricted Boltzmann machines using approximations to the likelihood gradient. In Proceedings of the 25th International Conference on Machine Learning, pp. 1064-1071, 2008. (page 5) +[77] Tran, D., Vafa, K., Agrawal, K., Dinh, L., and Poole, B. Discrete flows: Invertible generative models of discrete data. Advances in Neural Information Processing Systems, 32, 2019. (pages 7, 8, and 17) +[78] Uria, B., Murray, I., and Larochelle, H. A deep and tractable density estimator. In International Conference on Machine Learning, pp. 467-475. PMLR, 2014. (pages 1, 3, 5, 6, and 15) + +[79] Van Den Oord, A., Kalchbrenner, N., and Kavukcuoglu, K. Pixel recurrent neural networks. In International conference on machine learning, pp. 1747-1756. PMLR, 2016. (page 6) +[80] Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, L., and Polosukhin, I. Attention is all you need. Advances in Neural Information Processing Systems, 30, 2017. (pages 1, 3, and 8) +[81] Wang, J., Lisanza, S., Juergens, D., Tischer, D., Watson, J. L., Castro, K. M., Ragotte, R., Saragovi, A., Milles, L. F., Baek, M., et al. Scaffolding protein functional sites using deep learning. Science, 377(6604): 387-394, 2022. (page 1) +[82] Weininger, D., Weininger, A., and Weininger, J. L. SMILES. 2. algorithm for generation of unique SMILES notation. Journal of Chemical Information and Computer Sciences, 29(2):97-101, 1989. (pages 3 and 22) +[83] Williams, R. J. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8:229-256, 1992. (pages 3 and 5) +[84] Wu, D., Wang, L., and Zhang, P. Solving statistical mechanics using variational autoregressive networks. Physical review letters, 122(8):080602, 2019. (pages 2, 3, 6, and 7) +[85] Yang, Z., Dai, Z., Yang, Y., Carbonell, J., Salakhutdinov, R. R., and Le, Q. V. Xlnet: Generalized autoregressive pretraining for language understanding. Advances in Neural Information Processing Systems, 32, 2019. (pages 1 and 6) +[86] Yeh, R. A., Chen, C., Yian Lim, T., Schwing, A. G., Hasegawa-Johnson, M., and Do, M. N. Semantic image inpainting with deep generative models. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5485-5493, 2017. (page 1) +[87] Zhang, D., Chen, R. T., Malkin, N., and Bengio, Y. Unifying generative models with gflownets. arXiv preprint arXiv:2209.02606, 2022. (pages 6 and 17) +[88] Zhang, D., Malkin, N., Liu, Z., Volokhova, A., Courville, A., and Bengio, Y. Generative flow networks for discrete probabilistic modeling. In International Conference on Machine Learning, pp. 26412-26428. PMLR, 2022. (pages 6, 7, 8, and 17) + +# A. Additional Technical Details + +# A.1. Proof of Proposition 1 + +Proof. From the single-step marginalization self-consistency in (7), we have + +$$ +\log p _ {\theta} (\mathbf {x}) = \sum_ {d = 1} ^ {D} \log p _ {\phi} \left(x _ {\sigma (d)} | \mathbf {x} _ {\sigma (< d)}\right), \forall \mathbf {x}, \sigma . +$$ + +Therefore we can rewrite the optimization in (8) as: + +$$ +\max _ {\phi} \mathbb {E} _ {\mathbf {x} \sim p _ {\mathrm {d a t a}}} \mathbb {E} _ {\sigma \sim \mathcal {U} (S _ {D})} \sum_ {d = 1} ^ {D} \log p _ {\phi} \left(x _ {\sigma (d)} \mid \mathbf {x} _ {\sigma (< d)}\right) \tag {10} +$$ + +$$ +\begin{array}{l l} \text {s . t .} & p _ {\theta} (\mathbf {x} _ {\sigma (< d)}) p _ {\phi} (\mathbf {x} _ {\sigma (d)} | \mathbf {x} _ {\sigma (< d)}) = p _ {\theta} (\mathbf {x} _ {\sigma (\leq d)}), \forall \sigma \in S _ {D}, \mathbf {x} \in \{1, \dots , K \} ^ {D}, d \in [ 1: D ]. \end{array} +$$ + +Let $p^*$ be the optimal probability distribution that maximizes the likelihood on training data, and from the chain rule we have: + +$$ +p ^ {*} = \underset {p} {\arg \max} \mathbb {E} _ {\mathbf {x} \sim p _ {\mathrm {d a t a}}} \log p (\mathbf {x}) = \mathbb {E} _ {\mathbf {x} \sim p _ {\mathrm {d a t a}}} \mathbb {E} _ {\sigma \sim \mathcal {U} (S _ {D})} \sum_ {d = 1} ^ {D} \log p \left(x _ {\sigma (d)} | \mathbf {x} _ {\sigma (< d)}\right) +$$ + +Then $p^*$ is also the optimal solution to (10) the marginalization constraints are automatically satisfied by $p^*$ since it is a valid distribution. From the universal approximation theorem [27, 26, 11], we can use separate neural networks to model $p_\theta$ (marginals) and $p_\phi$ (conditionals), and obtain optimal solutions to (10) with $\theta^*$ and $\phi^*$ that approximates $p^*$ arbitrarily well. + +Specifically, if $\theta^{*}$ and $\phi^{*}$ satisfy the following three conditions below, they are the optimal solution to (10): + +$$ +p _ {\phi^ {*}} \left(x _ {\sigma (d)} \mid \mathbf {x} _ {\sigma (< d)}\right) = p ^ {*} \left(x _ {\sigma (d)} \mid \mathbf {x} _ {\sigma (< d)}\right), \quad \forall \mathbf {x}, \sigma \tag {11} +$$ + +$$ +p _ {\theta^ {*}} \left(\mathbf {x} _ {s}\right) = p ^ {*} \left(\mathbf {x} _ {s}\right) Z _ {\theta^ {*}}, \quad \forall \mathbf {x}, s \subseteq \{1, \dots , D \} \tag {12} +$$ + +$$ +p _ {\theta^ {*}} \left(\mathbf {x} _ {\sigma (< d)}\right) p _ {\phi^ {*}} \left(\mathbf {x} _ {\sigma (d)} \mid \mathbf {x} _ {\sigma (< d)}\right) = p _ {\theta^ {*}} \left(\mathbf {x} _ {\sigma (\leq d)}\right), \forall \sigma \in S _ {D}, \mathbf {x} \in \{1, \dots , K \} ^ {D}, d \in [ 1: D ] \tag {13} +$$ + +where $Z_{\theta^{*}}$ is the normalization constant of $p_{\theta^{*}}$ and is equal to $p_{\theta^{*}}((\triangle, \dots, \triangle))$ . It is easy to see from the definition of conditional probabilities that satisfying any two of the optimal conditions leads to the third one. + +To obtain the optimal $\phi^{*}$ , it suffices to solve the following optimization problem: + +$$ +\text {S t a g e 1 :} \quad \max _ {\phi} \mathbb {E} _ {\mathbf {x} \sim p _ {\mathrm {d a t a}}} \mathbb {E} _ {\sigma \sim \mathcal {U} (S _ {D})} \sum_ {d = 1} ^ {D} \log p _ {\phi} \left(x _ {\sigma (d)} \mid \mathbf {x} _ {\sigma (< d)}\right) +$$ + +because $p^* = \arg \max_p \mathbb{E}_{\mathbf{x} \sim p_{\mathrm{data}}} \mathbb{E}_{\sigma \sim \mathcal{U}(S_D)} \sum_{d=1}^{D} \log p^* \left( x_{\sigma(d)} | \mathbf{x}_{\sigma(M)})$ 1 Persistent block Gibbs sampling Sample $\tilde{\mathbf{x}}\sim q(\mathbf{x})$ Sample $\tilde{d}\sim \mathcal{U}(1,\dots ,D),\tilde{\sigma}\sim \mathcal{U}(S_D)$ $\mathcal{L}_{\mathrm{penalty}}\gets$ squared error of Equation (7), for $\tilde{d}$ and $\tilde{\sigma}$ with $\tilde{\mathbf{x}}$ $\nabla_{\theta ,\phi}D_{\mathrm{KL}}\gets$ REINFORCE est. with $\mathbf{x}$ $\nabla_{\theta ,\phi}\gets \nabla_{\theta ,\phi}D_{\mathrm{KL}} + \lambda \nabla_{\theta ,\phi}\mathcal{L}_{\mathrm{penalty}}$ Update $\theta$ and $\phi$ with gradient +end for + +# A.4. Connections between MAMs and GFlowNets + +In this section, we identify an interesting connection between generative marginalization models and GFlowNets. The two type of models are designed with different motivations. GFlowNets are motivated by learning a policy to generate according to an energy function and MAMs are motivated from any-order generation through learning to perform marginalization. However, under certain conditions, there exists an interesting connection between generative marginalization models and GFlowNets. In particular, the marginalization self-consistency condition derived from the definition of marginals in Equation (4) has an equivalence to the "detailed balance" constraint in GFlowNet under the following specific conditions. + +Observation 1. When the directed acyclic graph (DAG) used for generation in GFlowNet is specified by the following conditions, there is an equivalence between the marginalization self-consistency condition in Equation (7) for MAM and the detailed balance constraint proposed for GFlowNet [4]. In particular, the $p_{\theta}(x_{\sigma(d)} | \mathbf{x}_{\sigma(