SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Russell Alan Hart
The University of Texas at Dallas
rah150030@utdallas.edu
Linlin Yu
The University of Texas at Dallas linlin.yu@utdallas.edu
Yifei Lou
University of North Carolina at Chapel Hill yflou@unc.edu
Feng Chen *
The University of Texas at Dallas feng.chen@utdallas.edu
Deep neural networks have achieved significant success in the last decades, but they are not well-calibrated and often produce unreliable predictions. A large number of literature relies on uncertainty quantification to evaluate the reliability of a learning model, which is particularly important for applications of out-of-distribution (OOD) detection and misclassification detection. We are interested in uncertainty quantification for interdependent node-level classification. We start our analysis based on graph posterior networks (GPNs) that optimize the uncertainty cross-entropy (UCE)-based loss function. We describe the theoretical limitations of the widely-used UCE loss. To alleviate the identified drawbacks, we propose a distance-based regularization that encourages clustered OOD nodes to remain clustered in the latent space. We conduct extensive comparison experiments on eight standard datasets and demonstrate that the proposed regularization outperforms the state-of-the-art in both OOD detection and misclassification detection.
In recent years, deep neural networks (DNNs) have been widely used in various fields [10, 28]. However, some neural networks provide under-confident [36] or over-confident [14] predictions, limiting their practical applications in risk-constrained and safety-critical fields, such as drug discovery [38], autonomous driving [30], and medical diagnosis [2]. Take autonomous drug design for an example. Uncertainty estimation on the reliability of model predictions helps to support molecular reasoning and experimental design by saving considerable time and resources [23]. It is important to estimate the predictive uncertainty of a DNN, i.e., indicating when its predictions are likely incorrect. There are two main types of uncertainty: epistemic uncertainty (knowledge uncertainty) and aleatoric uncertainty (data uncertainty) [9]. Epistemic uncertainty is due to the lack of knowledge about unseen data. Aleatoric uncertainty is caused by the inherent complexity of the data, which cannot be reduced by increasing the training data, including sources of noise such as homoscedastic or heteroscedastic noise [17]. These two uncertainty types are typically used for out-of-distribution (OOD) and misclassification detection, respectively.
Most models have been introduced for uncertainty estimation on i.i.d. inputs, such as image and tabular data. However, the uncertainty estimation for classifying interdependent nodes in attributed graph data, such as social networks and citation networks, is under-explored. This work focuses on the node classification tasks with great potential to generalize to others with interdependent inputs.
Among various graph neural networks (GNNs) for processing graph data structures [18, 35, 13, 8], graph posterior network (GPN) has been developed for semi-supervised node classification tasks [32] that achieves state-of-the-art results in uncertainty estimation.
The major contributions of this paper are three-fold: (1) We theoretically analyze the limitations of GPN at OOD detection when minimizing uncertainty cross-entropy (UCE), a widely used loss function for uncertainty estimation. (2) Motivated by the aforementioned limitations, we propose a distance-based regularization that considers the prior knowledge that OOD-specific features are useful for learning representational space mappings. (3) We conduct extensive experiments comparing our proposed model with five state-of-the-art baselines on eight graph datasets for two uncertainty quantification tasks: OOD detection and misclassification detection tasks. The results demonstrate that our proposed regularization can improve the quality of uncertainty quantification.
This section reviews existing uncertainty estimation methods for i.i.d data and graph data.
Uncertainty Quantification for i.i.d inputs - There is plentiful research on uncertainty quantification on i.i.d. inputs as discussed in a recent survey [1]. The first family quantifies the predictive uncertainty of a DNN via multiple forward passes, such as deep ensembles and dropout-based Bayesian neural networks (BNNs). Deep ensembles [19] intuitively sample multiple predictions by training an ensemble of deep neural networks and aggregate the results. Dropout-based methods [11] utilize multiple stochastic forward passes implemented with different dropout initializations to approximate the posterior distribution of network weights. However, the substantial memory and computational demands required for training and testing make it impractical for real-time applications. The second family quantifies uncertainty using deterministic single forward-pass neural networks, including density-based methods and distribution-based methods. The density-based approaches typically fit a distribution (e.g., class-wise Gaussian distribution [3, 20, 34]) in the representation space of a pre-trained or fine-tuned DNN, followed by the associated PDF function to quantify different uncertainty types. The distribution-based methods train a deterministic neural network that directly predicts the conjugate prior distribution of the class probabilities of the input feature vector, called Dirichlet distribution, for uncertainty quantification. The predicted Dirichlet distribution can be interpreted as an approximation of the posterior distribution of class probabilities conditioned on the input feature vector. Popular distribution-based models are prior networks [22], evidential networks [29], and posterior networks (PN) [7], all using UCE as the loss function with different regularizations to improve the quality of uncertainty quantification.
Uncertainty Quantification for Graphs - As pointed out in the survey [1], uncertainty quantification on GNNs and semi-supervised learning is under-explored. Most existing models for uncertainty quantification on graphs are either dropout-based or BNN-based methods that typically drop or assign probabilities to edges. There are two approaches using deterministic single-pass GNNs to quantify uncertainty. One is called graph-based kernel Dirichlet distribution estimation (GKDE) [39], which consists of evidential GCN, graph-based kernel, teacher network, dropout, and loss regularization. Another method is the GPN model that combines PN and personalized page rank (PPR) message passing to disentangle uncertainty with and without network effects. In addition, a recent method [37] used standard classification loss for OOD detection on graphs together with an energy function that is directly extracted from GNN, however, it is limited to OOD detection, not generally on the topic of uncertainty quantification.
We discuss the problem setting of uncertainty quantification on the task of semi-supervised node classification in Section 3.1. In particular, we use a deep neural network to predict the multinomial uncertainty for each node and evaluate the aleatoric uncertainty and epistemic uncertainty by the prediction result. In Section 3.2, we give a brief review of the GPN model [32], which serves as a fundamental framework for our analysis and motivation for the proposed approach.
3.1 Problem Setting
We define a graph with attributed node-level features  $\mathcal{G} = (\mathcal{V},\mathcal{E},X,Y_{\mathbb{L}})$ , where  $\mathcal{V}$  is a set of nodes on the graph with cardinality  $N$  and  $\mathcal{E}\subset \mathcal{V}\times \mathcal{V}$  denotes a set of graph edges that can be represented by an adjacency matrix  $W$ . A feature matrix is denoted by  $X = [\mathbf{x}_1,\dots ,\mathbf{x}_N]^T\in \mathbb{R}^{N\times d}$ , in which each row  $\mathbf{x}_i\in \mathbb{R}^d$  is a feature vector of node  $i$  with dimension  $d$ . Under the semi-supervised learning setting, a set of labels is available, denoted by  $Y_{\mathbb{L}} = \{y_i\mid i\in \mathbb{L}\}$ , where  $\mathbb{L}\subset \mathcal{V}$  and  $y_{i}\in \{1,\ldots ,K\}$  for  $K$  classes.
Our goal is to design and learn a deterministic GNN based on  $\mathcal{G}$  that takes the feature matrix  $X$  and the adjacency matrix  $W$  as INPUT and predicts the parameters of a Dirichlet distribution for each node  $i\in \mathcal{V}$  as OUTPUT, denoted as  $\alpha_{i}$ , which is often referred to as the concentration parameters. Therefore, the network function  $F_{\Theta}$  can be expressed as:  $\mathcal{A} = F_{\Theta}(X,W)$ , where  $\mathcal{A} \coloneqq [\alpha_i]_{i\in \mathcal{V}}$  is a matrix and  $\Theta$  refers to network parameters. The statistical relations between the class label  $\mathbf{y}_i$ , the vector of class probabilities  $\mathbf{p}_i$ , and the Dirichlet parameters  $\alpha_{i}$  can be represented as:
$$
\mathbf {y} _ {i} \mid \mathbf {p} _ {i} \sim \operatorname {C a t} (\mathbf {p} _ {i}), \mathbf {p} _ {i} \mid \boldsymbol {\alpha} _ {i} \sim \operatorname {D i r} (\boldsymbol {\alpha} _ {i}), [ \boldsymbol {\alpha} _ {i} ] _ {i \in \mathcal {V}} = F _ {\Theta} (X, W). \tag {1}
$$
Based on the predictions of  $\mathcal{A}$ , the expected vector of class probabilities  $\bar{\mathbf{p}}_i \coloneqq \mathbb{E}[\mathbf{p}_i|\boldsymbol{\alpha}_i] = [\alpha_{i1} / \alpha_{i0},\dots ,\alpha_{iK} / \alpha_{i0}]^T$ , where  $\alpha_{i0} = \sum_{k=1}^{K}\alpha_{ik}$  is called the Dirichlet strength. The aleatoric and epistemic uncertainties about the classification of each node  $i$  can be calculated as:
$$
u _ {i} ^ {\text {a l e a}} = - \max  \left\{\bar {p} _ {i 1}, \dots , \bar {p} _ {i K} \right\} \quad \text {a n d} \quad u _ {i} ^ {\text {e p i s}} = - \alpha_ {i 0}, \tag {2}
$$
respectively. The aleatoric uncertainty is measured by the negative of the largest class probability in  $\bar{\mathbf{p}}_i$ . This uncertainty is higher when the largest class probability in  $\bar{\mathbf{p}}_i$  is lower, which implies that the model is less confident and the probabilities are more evenly spread across classes. On the other hand, the epistemic uncertainty is measured by the negative of the Dirichlet strength  $\alpha_{i0}$ , whose value is higher when the Dirichlet strength is lower, meaning that the model is unfamiliar with the feature vector of node  $i$  and the predicted Dirichlet distribution is less concentrated around a specific point or set of points on the probability simplex [22]. We note that a high aleatoric uncertainty may not indicate a high epistemic uncertainty and vice versa. For example, two evidence parameters  $\alpha_{i} = [1,\dots ,1]$  and  $\alpha_{j} = [1000,\dots ,1000]$  have the same aleatoric uncertainty:  $-1 / K$ , since they have the same projected class probabilities; but their epistemic uncertainties differ drastically:  $K$  versus  $1000K$ . Please refer to [32, 33] for rationales of aleatoric and epistemic uncertainties in (2).
3.2 Graph Posterior Network
Our framework is based on graph posterior network (GPN) [32], which extends posterior network (PN) [7] to semi-supervised node classification. GPN consists of three main steps. First, a feature encoder maps the original features onto a low-dimensional latent space with a simple two-layer multi-layer perception (MLP) encoder. Second, a radial normalizing flow [27] estimates the density of the latent space per class. Lastly, a personalized page rank message passing scheme [13] diffuses the pseudo counts (density multiplied by the number of training nodes) by taking the graph structure into account. We summarize the three steps with notations as follows,
1. Multi-layer perceptron for representation learning:  $\mathbf{z}_i = f(\mathbf{x}_i;\pmb {\theta})$  or  $f_{\pmb{\theta}}$  in short.
2. Normalizing flow for density estimation:  $g_{\phi}$  for short, and more specifically
$$
g _ {\phi} \left(\mathbf {z} _ {i}\right) _ {k} = N _ {k} \cdot \mathbb {P} \left(\mathbf {z} _ {i} \mid k; \phi\right), \tag {3}
$$
where  $N_{k}$  is the number of training nodes belonging to the class  $k$ ,  $\mathbf{z}_i$  is the embedding vector of node  $i$  obtained via the first step,  $\mathbb{P}(\mathbf{z}_i|k;\phi)$  is the conditional density per class  $k$  estimated by a normalizing flow module, and  $\phi$  denotes the parameters of this module. GPN also includes the evidence computed prior to the graph aggregation, defined by
$$
\boldsymbol {\alpha} _ {i} ^ {\text {f e a t}} = g _ {\phi} \left(\mathbf {z} _ {i}\right) + \mathbf {1}. \tag {4}
$$
3. Personalized page rank (PPR) for evidence diffusion:  $\beta_{i,k}^{\mathrm{aggr}} = \sum_{j\in \mathcal{V}}\Pi_{i,j}^{\mathrm{ppr}}g_{\phi}(\mathbf{z}_j)_k$  , where  $\Pi_{i,j}^{\mathrm{ppr}}$  refer to the dense PPR scores implicitly reflecting the importance of node  $j$  from the perspective of node  $i$ . Then we can get the predicted concentrate parameters  $\alpha$  with a uniform prior 1 for a non-degenerated Dirichlet distribution, i.e.,
$$
\boldsymbol {\alpha} _ {i} = \beta_ {i} ^ {\text {a g g r}} + \mathbf {1}. \tag {5}
$$
As opposed to GPN, PN is designed for uncertainty estimation for i.i.d. inputs, which only considers the first two steps to predict the Dirichlet distribution  $\mathrm{Dir}(\alpha_i^{\mathrm{feat}})$ .
Given the labels of training nodes:  $Y_{\mathbb{L}} = \{y_i \mid i \in \mathbb{L}\}$ , GPN is trained by minimizing the following Bayesian loss:
$$
\mathcal {L} = \operatorname {U C E} (\mathcal {A}, Y) + \lambda \sum_ {i \in \mathbb {L}} \mathbb {H} [ \operatorname {D i r} \left(\boldsymbol {\alpha} _ {i}\right) ]. \tag {6}
$$
The first term in (6), called uncertainty cross entropy (UCE) [5], is defined by
$$
\operatorname {U C E} (\mathcal {A}, Y) = \sum_ {i \in \mathbb {L}} \mathbb {E} _ {\boldsymbol {p} _ {i} \sim \operatorname {D i r} \left(\boldsymbol {\alpha} _ {i}\right)} \left[ - \log \mathbb {P} \left(y _ {i} \mid \boldsymbol {p} _ {i}\right) \right] = \sum_ {i \in \mathbb {L}} \sum_ {k \in [ K ]} y _ {i k} \left(\Psi \left(\alpha_ {i 0}\right) - \Psi \left(\alpha_ {i k}\right)\right), \tag {7}
$$
where  $Y = [\mathbf{y}_i]_{i\in [N]}$ ,  $\mathbf{y}_i\in \{0,1\} ^K$  is the one-hot encoded ground-truth class of the node  $i$ , and  $\Psi$  is the digamma function, in terms of the Gamma function by:  $\Psi (x) = \frac{\Gamma'(x)}{\Gamma(x)}$ . Minimizing UCE is known to increase confidence in classifying observed data (training nodes in this context). The second term in (6) is based on the entropy of each node-level Dirichlet distribution  $\mathrm{Dir}(\alpha_i)$  that favors smooth distributions. For more details on GPN, please refer to Appendix C.
4 Our Contributions
This section provides a series of theoretical analyses relating to the UCE loss term and the GPN model for detecting the OOD nodes, followed by a partial remedy to derived issues via two distance-based regularizations. Specifically, we prove in Theorem 1 that under certain conditions, UCE can be made arbitrarily small with the limiting case of UCE equal to zero in Corollary 3. Theorem 4 gives a construction to make the UCE to be zero. As UCE does not involve the OOD nodes, Theorem 6 and Corollary 7 elucidate scenarios for possibly detecting the OOD nodes. Lastly, Theorem 8 presents a special situation where GPN fails to detect the OOD nodes.
4.1 Theoretical analysis
The loss function plays a pivotal role in learning effective representation functions and density estimations. In this context, we establish several theorems (Theorems 1 and 4) to describe some demanding assumptions on  $f_{\theta}$  and  $g_{\phi}$  that achieve the minimum UCE loss. We then describe a limitation of UCE in separating ID and OOD nodes in Theorem 6 and Corollary 7 for PN, which means that we only consider the first two steps in GPN. The main conclusion of our analysis is that the UCE loss function alone is insufficient to learn a representation space that separates OOD from ID nodes. We take graph connectivity into account in Theorem 8 to study some scenarios where GPN is ineffective for OOD detection. Although our theorems do not completely characterize graph learning, they provide some insights into the behavior of the network parameters in PN/GPN when minimizing the UCE loss.
Theorem 1. If the underlying distribution of feature vectors belonging to class  $k$ , denoted by  $\mathcal{X}_k$ , is disjoint to each other and both the MLP module  $(f_{\theta})$  and the normalizing flow module  $(h_{\phi})$  can be arbitrarily complex, then  $\forall \epsilon > 0$  there exists a configuration of  $f_{\theta}$  and  $g_{\phi}$  such that  $UCE(\mathcal{A}, Y) < \epsilon$ .
For the proofs, please refer to Appendix B. Here, we elaborate on the ideal configuration that satisfies the conclusion of Theorem 1. We assume the MLP function  $f_{\theta}$  is arbitrarily complex such that it maps  $\mathbf{x}_i \in \mathcal{X}_k$  into a bounded ball in the representational space, i.e.,
$$
\left\{f _ {\theta} \left(\mathbf {x} _ {i}\right) \mid i \in [ N ] \text {a n d} \mathbf {x} _ {i} \in \mathcal {X} _ {k} \right\} \subset B \left(\mathbf {z} _ {k}, r _ {k}\right),
$$
where each ball  $B(\mathbf{z}_k, r_k)$  is centered at a point  $\mathbf{z}_k$  and bounded in size with  $r_k < r$  for a positive value  $r$ . Furthermore, we choose the normalizing flow  $g_{\phi}$  to be
$$
g _ {\phi} (\mathbf {z}; k) = \left\{ \begin{array}{l l} \frac {1}{\operatorname {V o l} \left(B \left(\mathbf {z} _ {k} , r _ {k}\right)\right)} & \text {i f} d \left(\mathbf {z}, \mathbf {z} _ {k}\right) <   r _ {k} \\ 0 & \text {o t h e r w i s e ,} \end{array} \right. \tag {8}
$$
where  $\mathrm{Vol}(\cdot)$  refers to the volume of the ball. The conclusion in Theorem 1 states that for every  $\epsilon$ , there exists a suitable upper bound  $r$  of all the balls such that  $\mathrm{UCE}(\mathcal{A}, Y) < \epsilon$ .
An implication of Theorem 1 is that UCE is not sufficient to separate OOD from ID nodes. Example 2 illustrates a scenario that OOD nodes can be close to ID nodes in the learned representation space even though they can be separated in the feature space based on OOD-specific features, which are unfortunately discarded. In other words, the learned representation space by GPN based on the UCE loss is not guaranteed to preserve the distance between OOD and ID nodes in its representation learning step.
Example 2 (Lost Features). Suppose two ID classes in a citation network contain bags of words for SVM and neural networks papers respectively. Additionally, the OOD nodes contain bags of words from reinforcement learning papers. Note that frequencies of keywords are used to discriminate different classes. Then the keywords, "actor critic" and "policy network" are able to separate OOD nodes from ID nodes, but are irrelevant features for discriminating between the two ID classes. UCE, as a discriminatory loss, is only applied on ID nodes, and hence it is almost impossible to learn representations that respect the OOD-specific features such as "actor-critic" and "policy networks".
Limitations and discussions - The first assumption in Theorem 1 regarding the distinct class-specific distributions of feature vectors might not be realistic in practice since certain ID classes may not be clearly distinguishable due to noise in features or class labels. Nevertheless, our intuition suggests that if the UCE loss is inadequate for separating OOD from ID nodes in situations where they are separable, it is even more likely to falter in the more complex, non-separable cases. As for the second assumption in Theorem 1, it is true that arbitrary complexity of  $f_{\theta}$  and  $g_{\phi}$  does not fully respect the inductive bias [24] of the network design, such as the MLP layers with ReLU for the feature encoder  $f(\mathbf{x};\pmb{\theta})$ , our analysis remains insightful and informative about the structures these networks are likely to exhibit. For example, we may expect from Theorem 1 that the representation of each class may favor an embedded space that compresses OOD-specific features, while density estimation  $g_{\phi}$  tends to have higher peaks over smaller volumes as the model consolidates the representation space.
We note that in [7, Theorem 1] and [32, Theorem], the authors demonstrated that PN/GPN is able to achieve reasonable uncertainty estimation when the feature encoder is a ReLU network and PPR diffusion is removed to disregard network effects. Unfortunately, the analysis is based on extreme node features, specifically as  $\delta \rightarrow \infty$ ,
$$
\mathbb {P} (f (\delta \cdot \mathbf {x} _ {i}; \boldsymbol {\theta}) | k; \phi) \rightarrow 0, \quad \text {a n d} \quad \beta_ {i, k} ^ {\mathrm {a g g}} \rightarrow 0,
$$
for any node  $i$  with a high probability. Moreover, Theorem 1 in the GPN paper [32] holds even when the supports of disjoint ID and OOD classes in the latent space overlap. In other words, this result does not prevent distant nodes from having similar representations. In summary, the analysis based on extreme node features may provide limited insights about the issues of GPN studied in this section. See Appendix D for detailed discussions.
By taking  $\epsilon \to 0$ , Theorem 1 reduces to Corollary 3 where UCE is equal to 0.
Corollary 3. In the ideal case, where the representation function  $f_{\theta}$  maps the support of each class,  $\mathcal{X}_k$ , to a countable set (with measure zero),  $\mathcal{Z}_k$  and there exists a normalizing flow that has infinite density on the point set for every class, one achieves  $UCE(\mathcal{A}, Y) = 0$ .
Next, we aim for the construction of a specific case to make UCE equal to zero. As it is challenging to analyze the joint minimization on  $\theta$  and  $\phi$ , we assume that the normalizing flow can be chosen optimally. For this purpose, we consider a simplified problem where the true density function is assumed to be known for a given  $\theta$  and hence it can be used to replace the learning of the normalizing flow. As a result, the problem reduces to the learning of the representation network  $\theta$ .
Theorem 4. Let  $\mathcal{X}_k$  be the true distributions for class-  $k$  in the original feature space. Suppose the normalizing flow module  $g_{\phi}$  obtains the true analytic solution. If the true distributions  $\{\mathcal{X}_k\}$  are disjoint, then the  $f_{\hat{\theta}}$  that minimizes the UCE loss projects the support of each class in the original space to a disjoint point set  $\mathcal{Z}_k$ , where  $\mathcal{Z}_k$  is defined by the projection of  $\mathcal{X}_k$  to the representation space, i.e.,  $\mathcal{Z}_k = f_{\theta}(\mathcal{X}_k)$ .
Notice that the true analytical solution  $\hat{\phi}$  in Theorem 4 is a function of  $\theta$ , i.e.,  $\hat{\phi} = \phi(\theta)$ . It is possible to know an analytical form of  $\phi(\theta)$ . For example, if the data points belonging to each class are sampled from a known Gaussian distribution in the original feature space and the representation network is a linear projection function, then the true density of the projected data points belonging to each class can be derived based on any configuration of the known Gaussian distribution in the original feature space.
Figure 1: Illustration of the representation mapping in Theorem 1 with the conditions to detect far OOD nodes (Theorem 6) and near OOD nodes (Corollary 7).
Before discussing OOD detection, we start with the definition of OOD nodes.
Definition 5. We define out-of-distribution (OOD) nodes to be the nodes that do not belong to any of the  $K$  in-distribution (ID) classes. We denote all the ID distribution supports by  $\mathcal{X}_{[K]} = \bigcup_{k=1}^{K} \mathcal{X}_k$ .